[pve-devel] [PATCH docs] media-wiki: add hint from which docs release this was build

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Jul 5 11:58:24 CEST 2019


Shows a small right floating slightly grayed out note at the top of
the page, which hints from which release those docs are. Can be
helpfull as things change between major release quite a bit, and so
readers have a hint for which version this should be valid.

Add this note just before the for search-index used pvehide tag.
Release version gets generated on build.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

alternatively we could also read the version at runtime, but normally
this should be upgraded with pve-docs anyway.

note: depends on my "make changelog single source of version" patch

 Makefile                     | 7 ++++---
 pve-docs-mediawiki-import.in | 5 +++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 53cf77b..c23bbe4 100644
--- a/Makefile
+++ b/Makefile
@@ -73,9 +73,10 @@ asciidoc-pve: asciidoc-pve.in link-refs.json
 	mv asciidoc-pve.tmp asciidoc-pve
 
 pve-docs-mediawiki-import: pve-docs-mediawiki-import.in link-refs.json
-	cat pve-docs-mediawiki-import.in link-refs.json >  pve-docs-mediawiki-import.tmp
-	chmod +x pve-docs-mediawiki-import.tmp
-	mv pve-docs-mediawiki-import.tmp pve-docs-mediawiki-import
+	cat pve-docs-mediawiki-import.in link-refs.json >  $@.tmp
+	sed -i "s/@RELEASE@;$$/'${DEB_VERSION_UPSTREAM}';/" $@.tmp
+	chmod +x $@.tmp
+	mv $@.tmp $@
 
 INDEX_INCLUDES=								\
 	pve-admin-guide.pdf 						\
diff --git a/pve-docs-mediawiki-import.in b/pve-docs-mediawiki-import.in
index 14dffa0..5d70bb1 100755
--- a/pve-docs-mediawiki-import.in
+++ b/pve-docs-mediawiki-import.in
@@ -16,6 +16,8 @@ while (<main::DATA>) { $data_str .= $_; }
 
 my $fileinfo = decode_json($data_str);
 
+my $docs_release = @RELEASE@;
+
 my $config_fn = "/root/.pve-docs"; # format 'username:pw'
 
 my $fh = IO::File->new("$config_fn") ||
@@ -51,6 +53,9 @@ sub update_page {
     my $starttag = '<!--PVE_IMPORT_START_MARKER-->';
     my $endtag = '<!--PVE_IMPORT_END_MARKER-->';
 
+    $pve_content .= "<div style='font-size: smaller; float: right; color: #555; text-align: right;'>\n";
+    $pve_content .= "Documentation release $docs_release</div>\n";
+
     $pve_content .= "<pvehide>\n";
 
     my $parser_opts = {
-- 
2.20.1





More information about the pve-devel mailing list