bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Take account of splitting option in gendocs.sh


From: Gavin Smith
Subject: Take account of splitting option in gendocs.sh
Date: Sun, 26 Feb 2023 20:34:48 +0000

The patch at the bottom of this mail makes gendocs.sh take account
of the --split option.  Texinfo uses this as one of its manuals
(texi2any_internals) uses --split=chapter for the HTML output.  Up to
this point we have been getting around this problem by using a custom
gendocs template.

It appears that the existing gendocs template was written to support
different splitting possibilities but that gendocs.sh didn't use this
fully.

Please let me know if any further work needs to be done on this patch.

I notice that this script also still supports texi2html, which is no
longer developed.  I could produce a patch to remove this support if
it was very likely that nobody was relying on it.

diff --git a/ChangeLog b/ChangeLog
index 9477335e75..d67b9b2f0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-02-26  Gavin Smith <gavinsmith0123@gmail.com>
+
+       gendocs: support chapter- and section-level split
+       * build-aux/gendocs.sh:
+       Strip out parts of the template depending on --split.
+       * doc/gendocs_template: Add lines to mark parts of file to output
+       only when splitting HTML by node.
+
 2023-02-26  Bruno Haible  <bruno@clisp.org>
 
        dfa: Avoid warnings with some Apple clang versions.
diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh
index 1ad5cf4f5d..ca813bffe3 100755
--- a/build-aux/gendocs.sh
+++ b/build-aux/gendocs.sh
@@ -465,12 +465,20 @@ fi
 
 # 
 printf "\nMaking index.html for %s...\n" "$PACKAGE"
-if test -z "$use_texi2html"; then
-  CONDS="/%%IF  *HTML_SECTION%%/,/%%ENDIF  *HTML_SECTION%%/d;\
-         /%%IF  *HTML_CHAPTER%%/,/%%ENDIF  *HTML_CHAPTER%%/d"
+if test x$split = xnode; then
+  CONDS="/%%IF  *HTML_NODE%%/d;/%%ENDIF  *HTML_NODE%%/d;\
+         /%%IF  *HTML_CHAPTER%%/,/%%ENDIF  *HTML_CHAPTER%%/d;\
+         /%%IF  *HTML_SECTION%%/,/%%ENDIF  *HTML_SECTION%%/d;"
+elif test x$split = xchapter; then
+  CONDS="/%%IF  *HTML_CHAPTER%%/d;/%%ENDIF  *HTML_CHAPTER%%/d;\
+         /%%IF  *HTML_SECTION%%/,/%%ENDIF  *HTML_SECTION%%/d;\
+         /%%IF  *HTML_NODE%%/,/%%ENDIF  *HTML_NODE%%/d;"
+elif test x$split = xsection; then
+  CONDS="/%%IF  *HTML_SECTION%%/d;/%%ENDIF  *HTML_SECTION%%/d;\
+         /%%IF  *HTML_CHAPTER%%/,/%%ENDIF  *HTML_CHAPTER%%/d;\
+         /%%IF  *HTML_NODE%%/,/%%ENDIF  *HTML_NODE%%/d;"
 else
-  # should take account of --split here.
-  CONDS="/%%ENDIF.*%%/d;/%%IF  *HTML_SECTION%%/d;/%%IF  *HTML_CHAPTER%%/d"
+  CONDS="/%%IF.*%%/d;/%%ENDIF.*%%/d;" # invalid split argument
 fi
 
 curdate=`$SETLANG date '+%B %d, %Y'`
diff --git a/doc/gendocs_template b/doc/gendocs_template
index a101977dfc..0b959f0379 100644
--- a/doc/gendocs_template
+++ b/doc/gendocs_template
@@ -22,8 +22,10 @@ without any warranty.
 <ul>
 <li><a href="%%PACKAGE%%.html">HTML
     (%%HTML_MONO_SIZE%%K bytes)</a> - entirely on one web page.</li>
+%%IF HTML_NODE%%
 <li><a href="html_node/index.html">HTML</a> - with one web page per
     node.</li>
+%%ENDIF HTML_NODE%%
 %%IF HTML_SECTION%%
 <li><a href="html_section/index.html">HTML</a> - with one web page per
     section.</li>
@@ -35,9 +37,11 @@ without any warranty.
 <li><a href="%%PACKAGE%%.html.gz">HTML compressed
     (%%HTML_MONO_GZ_SIZE%%K gzipped characters)</a> - entirely on
     one web page.</li>
+%%IF HTML_NODE%%
 <li><a href="%%PACKAGE%%.html_node.tar.gz">HTML compressed
     (%%HTML_NODE_TGZ_SIZE%%K gzipped tar file)</a> -
     with one web page per node.</li>
+%%ENDIF HTML_NODE%%
 %%IF HTML_SECTION%%
 <li><a href="%%PACKAGE%%.html_section.tar.gz">HTML compressed
     (%%HTML_SECTION_TGZ_SIZE%%K gzipped tar file)</a> -




reply via email to

[Prev in Thread] Current Thread [Next in Thread]