diff --git a/man/meson.build b/man/meson.build index e6798b7d4e0..e4f2905d602 100644 --- a/man/meson.build +++ b/man/meson.build @@ -190,12 +190,9 @@ if rsync.found() run_target( 'doc-sync', depends : man_pages + html_pages, - command : [rsync, '-rlv', - '--delete-excluded', - '--include=man', - '--include=*.html', - '--exclude=*', - '--omit-dir-times', + command : [sync_docs_py, + '--version', + '@0@'.format(meson.project_version()), meson.current_build_dir(), get_option('www-target')]) endif diff --git a/meson.build b/meson.build index 5e9ca285acd..b01dd9cd73d 100644 --- a/meson.build +++ b/meson.build @@ -1795,6 +1795,7 @@ export_dbus_interfaces_py = find_program('tools/dbus_exporter.py') generate_gperfs = find_program('tools/generate-gperfs.py') make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py') make_directive_index_py = find_program('tools/make-directive-index.py') +sync_docs_py = find_program('tools/sync-docs.py') make_man_index_py = find_program('tools/make-man-index.py') meson_render_jinja2 = find_program('tools/meson-render-jinja2.py') update_dbus_docs_py = find_program('tools/update-dbus-docs.py') diff --git a/tools/sync-docs.py b/tools/sync-docs.py new file mode 100755 index 00000000000..bab99f8cb34 --- /dev/null +++ b/tools/sync-docs.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: LGPL-2.1-or-later + +from argparse import ArgumentParser +import glob +import json +import os +import re +import subprocess +import sys + +import requests + +BASE_URL = "https://www.freedesktop.org/software/systemd/man/" +JQUERY_URL = "https://code.jquery.com/jquery-3.7.1.min.js" +SCRIPT_TAG = '' + +NAV_JS = """ +$(document).ready(function() { + $.getJSON("../index.json", function(data) { + data.sort().reverse(); + + var [filename, dirname] = window.location.pathname.split("/").reverse(); + + var items = []; + $.each( data, function(_, version) { + if (version == dirname) { + items.push( ""); + } else if (dirname == "latest" && version == data[0]) { + items.push( ""); + } else { + items.push( ""); + } + }); + + $("span:first").html($( "