From 3a53ea84ab037c2814b9f831cf27c2c551ec649d Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Sat, 25 Jan 2025 23:01:11 +0100 Subject: [PATCH] Doc: building singlepage version with the appropriate template This change caters for the new website automation and allows for future online display of documentation even for development versions. --- doc/Makefile | 5 ++-- tools/doc-template.html | 58 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 tools/doc-template.html diff --git a/doc/Makefile b/doc/Makefile index c17648877..8545472b9 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -31,11 +31,12 @@ $(o)%.md: $(s)%.sgml @false else LINUXDOC_PANDOC_PARSER := $(srcdir)/tools/linuxdoc.lua +SINGLEPAGE_HTML_TEMPLATE := $(srcdir)/tools/doc-template.html $(o)%.md: $(s)%.sgml $(LINUXDOC_PANDOC_PARSER) $(objdir)/.dir-stamp $(PANDOC) -f $(LINUXDOC_PANDOC_PARSER) -s -t markdown -o $@ $< -$(o)%-singlepage.html: $(o)%.md - $(PANDOC) -f markdown -t html5 -s -o $@ $< +$(o)%-singlepage.html: $(o)%.sgml $(SINGLEPAGE_HTML_TEMPLATE) $(LINUXDOC_PANDOC_PARSER) $(objdir)/.dir-stamp + $(PANDOC) -f $(LINUXDOC_PANDOC_PARSER) -t html5 --shift-heading-level-by=1 --section-divs --table-of-contents --toc-depth=3 -M bird_version="$(VERSION)" --template=$(SINGLEPAGE_HTML_TEMPLATE) -o $@ $< endif diff --git a/tools/doc-template.html b/tools/doc-template.html new file mode 100644 index 000000000..25f63c525 --- /dev/null +++ b/tools/doc-template.html @@ -0,0 +1,58 @@ +{%- set title = "$pagetitle$" %} +{%- set is_docs = True %} +{%- set template_part = "header" %} +{%- set authors = [ $for(author-meta)$ "$author-meta$", $endfor$ ] %} +{%- set meta_additional = { "author": authors, } %} +{%- include "main.html.j2" %} + +
+
+
+
+
+
+

{{ title }}

+
+

Version $bird_version$ | TGZ

+ Available versions: + {% for v in releases | reverse -%} + {% if (v.type == 'current') or 'show_doc' in v %} + + {{- v.version -}} + + {%- if not loop.last %} | {% endif -%} + {%- endif -%} + {%- endfor %} +
+

Authors: + {%- for a in authors %} + {{ a.split('<')[0][:-1] }}{% if not loop.last %}, {% endif %} + {%- endfor %} +

+

$abstract$

+
+
+
+
+
+ +
+ $body$ +
+
+
+
+
+{% set template_part = "footer" %} +{% include "main.html.j2" %} -- 2.47.2