summaryrefslogtreecommitdiff
path: root/docs/usage.xsl
diff options
context:
space:
mode:
authorSimon MacMullen <simon@lshift.net>2010-02-24 14:49:10 +0000
committerSimon MacMullen <simon@lshift.net>2010-02-24 14:49:10 +0000
commit60c14baa96118e587b12716b49f7d66e487a5939 (patch)
treecc18d3a2ed0b84a09da6157fc474f75f97fc18b1 /docs/usage.xsl
parent16418a9488e15c4d8ef3bfa9fce69190fb8ec796 (diff)
downloadrabbitmq-server-git-60c14baa96118e587b12716b49f7d66e487a5939.tar.gz
Rewrite rabbitmqctl man page as DocBook XML taken from the website admin guide. Generate man pages, usage guides and a web page from man pages.
Diffstat (limited to 'docs/usage.xsl')
-rw-r--r--docs/usage.xsl65
1 files changed, 65 insertions, 0 deletions
diff --git a/docs/usage.xsl b/docs/usage.xsl
new file mode 100644
index 0000000000..fee452f4e7
--- /dev/null
+++ b/docs/usage.xsl
@@ -0,0 +1,65 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ xmlns:ng="http://docbook.org/docbook-ng"
+ xmlns:db="http://docbook.org/ns/docbook"
+ exclude-result-prefixes="exsl"
+ version='1.0'>
+
+<xsl:output method="text"
+ encoding="UTF-8"
+ indent="no"/>
+<xsl:strip-space elements="arg"/>
+
+<xsl:template match="/">
+<!-- Pull out cmdsynopsis to show the command usage line. -->Usage:
+<xsl:value-of select="refentry/refsynopsisdiv/cmdsynopsis/command"/>
+<xsl:text> </xsl:text>
+<xsl:for-each select="refentry/refsynopsisdiv/cmdsynopsis/arg">
+ <xsl:if test="@choice='opt'">[</xsl:if>
+ <xsl:apply-templates select="." />
+ <xsl:if test="@choice='opt'">]</xsl:if>
+ <xsl:text> </xsl:text>
+</xsl:for-each>
+
+<!-- List options (any variable list in a section called "Options"). -->
+Options:
+<xsl:for-each select=".//*[title='Options']/variablelist">
+ <xsl:for-each select="varlistentry">
+ <xsl:text> </xsl:text>
+ <xsl:for-each select=".//term">
+ <xsl:value-of select="."/>
+ <xsl:if test="not(position() = last())">, </xsl:if>
+ </xsl:for-each><xsl:text>&#10;</xsl:text>
+ </xsl:for-each>
+</xsl:for-each>
+
+<!-- List commands (any first-level variable list in a section called "Commands"). -->
+Commands:
+<xsl:for-each select=".//*[title='Commands']/refsect2/variablelist">
+ <xsl:for-each select="varlistentry">
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates select="term"/>
+ <xsl:text>&#10;</xsl:text>
+ </xsl:for-each>
+ <xsl:text>&#10;</xsl:text>
+</xsl:for-each>
+
+<!-- Any paragraphs which have been marked as role="usage" (principally for global flags). -->
+<xsl:for-each select="//para[@role='usage']">
+<xsl:value-of select="normalize-space(.)"/><xsl:text>&#10;&#10;</xsl:text>
+</xsl:for-each>
+
+<!-- Any second-level variable lists (principally for options for subcommands). -->
+<xsl:for-each select=".//*[title='Commands']//variablelist//variablelist">
+ <xsl:for-each select="varlistentry">&lt;<xsl:apply-templates select="term"/>&gt; - <xsl:apply-templates select="listitem"/>
+ <xsl:text>&#10;</xsl:text>
+ </xsl:for-each>
+ <xsl:text>&#10;</xsl:text>
+</xsl:for-each>
+
+</xsl:template>
+
+<xsl:template match="replaceable">&lt;<xsl:value-of select="normalize-space(.)"/>&gt;</xsl:template>
+
+</xsl:stylesheet>