Currently, every variable is shown in the table of contents of the
reference manual. Variable list is over 400 items long. This makes the
ToC difficult to work with.

Removing is done by adding an overwriting template for the parent of
variables section (that is sect1 tag with id="variables"). In the
DocBook source matching template calls another template named subtoc
with two parameters: context (self element) and nodes (child
sections). Normally a list of descendant nodes is passed here, but we
don't want that and instead call subtoc with no parameters.

This approach results in semantically correct code being generated in
all modes.

Note, that the ID (variables) will have to be kept in sync with XML
generating code, but that is already hardcoded elsewhere.
---
 doc/TODO     | 4 ----
 doc/mutt.xsl | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/doc/TODO b/doc/TODO
index 75b9596b..da1fb17d 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -30,10 +30,6 @@ Style/Technical
   perl already to build docs, think about/look for simple perl
   templating engine.
 
-* Find a way (XSLT?) to trim the TOC for the option reference; it's
-  ugly but we probably want to keep the TOC depth as-is for other
-  sections.
-
 Content
 -------
 
diff --git a/doc/mutt.xsl b/doc/mutt.xsl
index a075a5b3..a3558e69 100644
--- a/doc/mutt.xsl
+++ b/doc/mutt.xsl
@@ -11,4 +11,7 @@
     </xsl:element>
   </xsl:template>
   <xsl:param name="admon.style"/>
+  <xsl:template match="sect1[@id = 'variables']" mode="toc">
+    <xsl:call-template name="subtoc"/>
+  </xsl:template>
 </xsl:stylesheet>
-- 
2.32.0.rc0

Reply via email to