From aa8ac8cfc4dd77c0ede830469029ece6e824e9b5 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Sun, 19 Jan 2025 01:06:24 +0100 Subject: [PATCH] Doc: building singlepage version Some minor changes were done in the original documentation to allow for easier conversion, and also to make the documentation a little bit more strictly valid. This change caters for the new website automation and allows for future online display of documentation even for development versions. --- Makefile.in | 1 + configure.ac | 2 + doc/Makefile | 15 ++ doc/bird.sgml | 170 +++++++++------- tools/doc-template.html | 58 ++++++ tools/linuxdoc.lua | 440 ++++++++++++++++++++++++++++++++++++++++ tools/logging.lua | 271 +++++++++++++++++++++++++ 7 files changed, 880 insertions(+), 77 deletions(-) create mode 100644 tools/doc-template.html create mode 100644 tools/linuxdoc.lua create mode 100644 tools/logging.lua diff --git a/Makefile.in b/Makefile.in index 839efe243..29e627e1f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -22,6 +22,7 @@ RANLIB=@RANLIB@ INSTALL=@INSTALL@ INSTALL_PROGRAM=@INSTALL_PROGRAM@ INSTALL_DATA=@INSTALL_DATA@ +PANDOC=@PANDOC@ client=$(addprefix $(exedir)/,@CLIENT@) daemon=$(exedir)/bird diff --git a/configure.ac b/configure.ac index ae7b9467d..9793f6d33 100644 --- a/configure.ac +++ b/configure.ac @@ -77,6 +77,7 @@ AC_ARG_WITH([iproutedir], AC_ARG_VAR([FLEX], [location of the Flex program]) AC_ARG_VAR([BISON], [location of the Bison program]) AC_ARG_VAR([M4], [location of the M4 program]) +AC_ARG_VAR([PANDOC], [location of the Pandoc program]) if test "$enable_debug_expensive" = yes; then enable_debug=yes @@ -178,6 +179,7 @@ AC_PROG_RANLIB AC_CHECK_PROG([FLEX], [flex], [flex]) AC_CHECK_PROG([BISON], [bison], [bison]) AC_CHECK_PROGS([M4], [gm4 m4]) +AC_CHECK_PROG([PANDOC], [pandoc], [pandoc]) test -z "$FLEX" && AC_MSG_ERROR([Flex is missing.]) test -z "$BISON" && AC_MSG_ERROR([Bison is missing.]) diff --git a/doc/Makefile b/doc/Makefile index 0d1deb8eb..588b8634f 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -25,6 +25,21 @@ $(o)%.sgml: $(s)%.sgml $(objdir)/.dir-stamp $(o)%.html: $(o)%.sgml cd $(dir $@) && $(toolsdir)/linuxdoc -B html $(notdir $<) +ifeq ($(PANDOC),) +$(o)%.md: $(o)%.sgml + @echo "ERROR: No pandoc available, install pandoc to build documentation" + @false +else +LINUXDOC_PANDOC_PARSER := $(srcdir)/tools/linuxdoc.lua +SINGLEPAGE_HTML_TEMPLATE := $(srcdir)/tools/doc-template.html +$(o)%.md: $(o)%.sgml $(LINUXDOC_PANDOC_PARSER) $(objdir)/.dir-stamp + $(PANDOC) -f $(LINUXDOC_PANDOC_PARSER) -s -t markdown -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="3.0.2" --template=$(SINGLEPAGE_HTML_TEMPLATE) -o $@ $< + +endif + $(o)%.tex: $(o)%.sgml cd $(dir $@) && $(toolsdir)/linuxdoc -B latex --output=tex $(notdir $<) diff --git a/doc/bird.sgml b/doc/bird.sgml index a3563c666..180ec2852 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -774,8 +774,8 @@ to set options. server setups, running GC on hundreds of full BGP routing tables can take significant amount of time, therefore they should use higher GC periods. Default: adaptive, based on number of routing tables in the - configuration. From 10 s (with <= 25 routing tables) up to 600 s (with - >= 1500 routing tables). + configuration. From 10 s (with <= 25 routing tables) up to 600 s (with + >= 1500 routing tables).