summaryrefslogtreecommitdiff
path: root/docs/usage.xsl
diff options
context:
space:
mode:
Diffstat (limited to 'docs/usage.xsl')
-rw-r--r--docs/usage.xsl23
1 files changed, 15 insertions, 8 deletions
diff --git a/docs/usage.xsl b/docs/usage.xsl
index 3c0d2bfb73..339cea6fe6 100644
--- a/docs/usage.xsl
+++ b/docs/usage.xsl
@@ -9,7 +9,8 @@
<xsl:output method="text"
encoding="UTF-8"
indent="no"/>
-<xsl:strip-space elements="arg"/>
+<xsl:strip-space elements="*"/>
+<xsl:preserve-space elements="term" />
<xsl:template match="/">
<!-- Pull out cmdsynopsis to show the command usage line. -->Usage:
@@ -38,7 +39,7 @@
<!-- Any paragraphs which have been marked as role="usage" (principally for global flags). -->
<xsl:text>&#10;</xsl:text>
-<xsl:for-each select="//para[@role='usage']">
+<xsl:for-each select=".//*[title='Options']//para[@role='usage']">
<xsl:value-of select="normalize-space(.)"/><xsl:text>&#10;&#10;</xsl:text>
</xsl:for-each>
@@ -53,15 +54,21 @@
<xsl:text>&#10;</xsl:text>
</xsl:for-each>
-<!-- Any second-level variable lists (for options for subcommands). -->
-<xsl:for-each select=".//*[title='Commands']//varlistentry[@role='usage-has-option-list']">
-&lt;<xsl:value-of select="term/option[@role='usage-option-list']/replaceable"/>&gt; must be a member of the list [<xsl:for-each select="listitem/variablelist/varlistentry"><xsl:apply-templates select="term"/><xsl:if test="not(position() = last())">, </xsl:if></xsl:for-each>].
-</xsl:for-each>
+<xsl:apply-templates select=".//*[title='Commands']/refsect2" mode="command-usage" />
+</xsl:template>
+
+<!-- Option lists in command usage -->
+<xsl:template match="varlistentry[@role='usage-has-option-list']" mode="command-usage">&lt;<xsl:value-of select="term/option[@role='usage-option-list']/replaceable"/>&gt; must be a member of the list [<xsl:for-each select="listitem/variablelist/varlistentry"><xsl:apply-templates select="term"/><xsl:if test="not(position() = last())">, </xsl:if></xsl:for-each>].<xsl:text>&#10;&#10;</xsl:text></xsl:template>
+<!-- Usage paras in command usage -->
+<xsl:template match="para[@role='usage']" mode="command-usage">
+<xsl:value-of select="normalize-space(.)"/><xsl:text>&#10;&#10;</xsl:text>
</xsl:template>
-<xsl:template match="option">[<xsl:apply-templates/>]</xsl:template>
+<!-- Don't show anything else in command usage -->
+<xsl:template match="text()" mode="command-usage"/>
-<xsl:template match="replaceable">&lt;<xsl:value-of select="normalize-space(.)"/>&gt;</xsl:template>
+<xsl:template match="option">[<xsl:apply-templates/>]</xsl:template>
+<xsl:template match="replaceable">&lt;<xsl:value-of select="."/>&gt;</xsl:template>
</xsl:stylesheet>