package/doc-asciidoc: specify TOC depth for all formats

Commit 17feaf0016 (manual: set toc depth to 4 for html outputs) did
not explain why it set the depth of the table of content (TOC) only for
the html and split-html formats.

From memory, but it is a bit fuzzy after all those years, the TOC for
HTML documentation was by default deeper than for the other formats, so
it was really useless to expand it more than one-level deep, while for
other formats, the default was acceptable.

However, it does not make much sense to limit/enforce the depth of the
TOC only for specific formats, and keep the default for the others;
indeed, there is nothing that prevents the default to change with
various versions of asciidoc and the rendering backends.

Render all the formats with the same, explicit level of TOC.

We move the assignment of _A2X_OPTS above the comment, because the
comment does not apply to the TOC setting. Also note that the previous
assignment to an empty value was completely superfluous...

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
This commit is contained in:
Yann E. MORIN 2023-01-18 08:14:10 +01:00 committed by Arnout Vandecappelle
parent 5d03d2346a
commit 09d954fc4e

View File

@ -86,11 +86,13 @@ ifneq ($$(wildcard $$($(2)_$(3)_ASCIIDOC_CONF)),)
$(2)_$(3)_ASCIIDOC_OPTS += -f $$($(2)_$(3)_ASCIIDOC_CONF)
endif
$(2)_$(3)_A2X_OPTS = \
--xsltproc-opts "--stringparam toc.section.depth 1"
# Handle a2x warning about --destination-dir option only applicable to HTML
# based outputs. So:
# - use the --destination-dir option if possible (html and split-html),
# - otherwise copy the generated document to the output directory
$(2)_$(3)_A2X_OPTS =
ifneq ($$(filter $(4),html split-html),)
$(2)_$(3)_A2X_OPTS += --destination-dir="$$(@D)"
else
@ -161,11 +163,9 @@ $(1)-prepare-sources: $$(BUILD_DIR)/docs/$(1)/.stamp_doc_rsynced
$(2)_ASCIIDOC_CONF = $$($(2)_DOCDIR)/asciidoc.conf
$(call ASCIIDOC_INNER,$(1),$(2),xhtml,html,html,HTML,\
--xsltproc-opts "--stringparam toc.section.depth 1")
$(call ASCIIDOC_INNER,$(1),$(2),xhtml,html,html,HTML)
$(call ASCIIDOC_INNER,$(1),$(2),chunked,split-html,chunked,split HTML,\
--xsltproc-opts "--stringparam toc.section.depth 1")
$(call ASCIIDOC_INNER,$(1),$(2),chunked,split-html,chunked,split HTML)
# dblatex needs to pass the '--maxvars ...' option to xsltproc to prevent it
# from reaching the template recursion limit when processing the (long) target