summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErkin Bahceci <erkinbah@gmail.com>2007-07-24 22:21:41 -0400
committerErkin Bahceci <erkinbah@gmail.com>2007-07-24 22:21:41 -0400
commit98125317db9f37b607e09fa9e53417bd9465a3f2 (patch)
tree38e9bbb58fb611c647df8674858f66a8bb4cee3f
parenta960d2618618b8eb5b79011dd0e149f10e862a4b (diff)
downloadDocumentation-98125317db9f37b607e09fa9e53417bd9465a3f2.tar.gz
Documentation-98125317db9f37b607e09fa9e53417bd9465a3f2.tar.bz2
Add html doc. generator for plugin/core options.origin
-rw-r--r--optionDocGen.xslt175
1 files changed, 175 insertions, 0 deletions
diff --git a/optionDocGen.xslt b/optionDocGen.xslt
new file mode 100644
index 0000000..f31f9a4
--- /dev/null
+++ b/optionDocGen.xslt
@@ -0,0 +1,175 @@
+<!--
+
+ Compiz option documentation generator (produces html)
+
+ Copyright : (C) 2007 by Erkin Bahceci
+ E-mail : erkinbah@gmail.com
+
+ Print helpers : (C) 2007 by Dennis Kasprzyk
+ E-mail : onestone@beryl-project.org
+
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+
+
+ Example usage:
+
+ xsltproc -o doc.html optionDocGen.xslt /usr/share/compiz/animation.xml
+
+
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="html"/>
+
+ <!-- *** main block *** -->
+
+ <xsl:template match="/compiz/core">
+ <HTML><BODY>
+ <H1><B><U><xsl:text>Core</xsl:text></U></B></H1>
+ <xsl:apply-templates select="display"/>
+ <xsl:apply-templates select="screen"/>
+ </BODY></HTML>
+ </xsl:template>
+
+ <xsl:template match="/compiz/plugin">
+ <HTML><BODY>
+ <H1><B><U><xsl:text>Plugin: </xsl:text>
+ <xsl:call-template name="Print">
+ <xsl:with-param name="text">
+ <xsl:value-of select="/compiz/plugin/@name"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </U></B></H1>
+ <xsl:apply-templates select="display"/>
+ <xsl:apply-templates select="screen"/>
+ </BODY></HTML>
+ </xsl:template>
+
+ <xsl:template match="display">
+ <H2><B><xsl:text>Options for All Screens</xsl:text></B></H2>
+ <UL>
+ <xsl:for-each select="option">
+ <xsl:sort select="short"/>
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </UL>
+ </xsl:template>
+
+ <xsl:template match="screen">
+ <H2><B><xsl:text>Options for Screen</xsl:text></B></H2>
+ <UL>
+ <xsl:for-each select="option">
+ <xsl:sort select="short"/>
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ <xsl:for-each select="group">
+ <xsl:sort select="short"/>
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </UL>
+ </xsl:template>
+
+ <xsl:template match="group">
+ <H3><B><xsl:value-of select="./short"/></B></H3>
+ <xsl:if test="short='Effect Settings'">
+ <xsl:if test="/compiz/plugin[@name='animation']">
+ <B><font color="red">
+ <xsl:text disable-output-escaping="yes">Only these options can be used in the "options" part in animation selection lists.</xsl:text>
+ </font></B>
+ </xsl:if>
+ </xsl:if>
+ <UL>
+ <xsl:for-each select="subgroup">
+ <xsl:sort select="short"/>
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </UL>
+ </xsl:template>
+
+ <xsl:template match="subgroup">
+ <LI>
+ <H4><B><xsl:value-of select="./short"/></B></H4>
+ <xsl:for-each select="option">
+ <xsl:sort select="short"/>
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </LI>
+ </xsl:template>
+
+ <xsl:template match="option">
+ <xsl:if test="short">
+ <P><B><xsl:value-of select="short"/></B>
+ <xsl:text>:</xsl:text>
+ <B><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;name: </xsl:text></B>
+ <xsl:value-of select="@name"/>
+ <xsl:if test="@type">
+ <B><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;type: </xsl:text></B>
+ <xsl:value-of select="@type"/>
+ </xsl:if>
+ <xsl:if test="min">
+ <B><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;min: </xsl:text></B>
+ <xsl:value-of select="min"/>
+ </xsl:if>
+ <xsl:if test="max">
+ <B><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;max: </xsl:text></B>
+ <xsl:value-of select="max"/>
+ </xsl:if>
+ <BR/>
+ <xsl:value-of select="long"/>
+ <xsl:if test="desc">
+ <table border="1" cellpadding="2" cellspacing="0">
+ <tr bgcolor="#dddddd">
+ <th align="center">Value</th>
+ <th align="left">Description</th>
+ </tr>
+ <xsl:apply-templates select="desc"/>
+ </table>
+ </xsl:if>
+ </P>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="desc">
+ <TR>
+ <TD align="center"><xsl:value-of select="value"/></TD>
+ <TD align="left"><xsl:value-of select="name"/></TD>
+ </TR>
+ </xsl:template>
+
+ <!-- String conversion helper functions -->
+
+ <xsl:template name="print">
+ <xsl:param name="text"/>
+ <xsl:value-of select="translate($text,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
+ </xsl:template>
+
+ <xsl:template name="PRINT">
+ <xsl:param name="text"/>
+ <xsl:value-of select="translate($text,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+ </xsl:template>
+
+ <xsl:template name="Print">
+ <xsl:param name="text"/>
+ <xsl:call-template name="PRINT">
+ <xsl:with-param name="text">
+ <xsl:value-of select="substring($text,1,1)"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="print">
+ <xsl:with-param name="text">
+ <xsl:value-of select="substring($text,2)"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+</xsl:stylesheet>