diff options
Diffstat (limited to 'docs/xslt')
-rw-r--r-- | docs/xslt/expand-sambadoc.xsl | 102 | ||||
-rw-r--r-- | docs/xslt/expand-smbconfdoc.xsl | 2 | ||||
-rw-r--r-- | docs/xslt/man.xsl | 237 |
3 files changed, 128 insertions, 213 deletions
diff --git a/docs/xslt/expand-sambadoc.xsl b/docs/xslt/expand-sambadoc.xsl index 0a6326ef0b..3e1028189c 100644 --- a/docs/xslt/expand-sambadoc.xsl +++ b/docs/xslt/expand-sambadoc.xsl @@ -21,22 +21,63 @@ </xsl:copy> </xsl:template> + <xsl:template name="smbconfoption"> + <xsl:param name="name"/> + <xsl:param name="content"/> + <xsl:variable name="linkcontent"> + <xsl:element name="parameter"> + <xsl:attribute name="moreinfo"> + <xsl:text>none</xsl:text> + </xsl:attribute> + <xsl:value-of select="$name"/> + </xsl:element> + + <xsl:choose> + <xsl:when test="$content != ''"> + <xsl:text> = </xsl:text> + <xsl:value-of select="$content"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:choose> + <xsl:when test="$noreference = 1"> + <xsl:value-of select="$linkcontent"/> + </xsl:when> + <xsl:otherwise> + <xsl:element name="link"> + <xsl:attribute name="linkend"> + <xsl:value-of select="translate(translate(string($name),' ',''),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/> + </xsl:attribute> + <xsl:value-of select="$linkcontent"/> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="related"> + <xsl:element name="para"> + <xsl:text>Related command: </xsl:text> + <xsl:call-template name="smbconfoption"> + <xsl:with-param name="name" select="text()"/> + </xsl:call-template> + </xsl:element> + </xsl:template> + <xsl:template match="smbconfblock/smbconfoption"> <xsl:element name="member"> - <xsl:element name="indexterm"> - <xsl:element name="primary"> + <xsl:element name="term"> <xsl:value-of select="@name"/> - </xsl:element> </xsl:element> - <xsl:element name="parameter"> - <xsl:value-of select="@name"/> - <xsl:choose> - <xsl:when test="text() != ''"> + <xsl:choose> + <xsl:when test="text() != ''"> + <xsl:element name="parameter"> + <xsl:value-of select="@name"/> <xsl:text> = </xsl:text> <xsl:value-of select="text()"/> - </xsl:when> - </xsl:choose> - </xsl:element> + </xsl:element> + </xsl:when> + </xsl:choose> </xsl:element> </xsl:template> @@ -59,44 +100,13 @@ </xsl:template> <xsl:template match="smbconfoption"> - <!-- Include an index term --> - <xsl:element name="indexterm"> - <xsl:element name="primary"> - <xsl:value-of select="@name"/> - </xsl:element> - </xsl:element> - - <xsl:variable name="linkcontent"> - <xsl:element name="parameter"> - <xsl:attribute name="moreinfo"> - <xsl:text>none</xsl:text> - </xsl:attribute> - <xsl:value-of select="@name"/> - </xsl:element> - - <xsl:choose> - <xsl:when test="text() != ''"> - <xsl:text> = </xsl:text> - <xsl:value-of select="text()"/> - </xsl:when> - </xsl:choose> - </xsl:variable> - - <xsl:choose> - <xsl:when test="$noreference = 1"> - <xsl:value-of select="$linkcontent"/> - </xsl:when> - <xsl:otherwise> - <xsl:element name="link"> - <xsl:attribute name="linkend"> - <xsl:value-of select="translate(translate(string(@name),' ',''),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/> - </xsl:attribute> - <xsl:value-of select="$linkcontent"/> - </xsl:element> - </xsl:otherwise> - </xsl:choose> + <xsl:call-template name="smbconfoption"> + <xsl:with-param name="name" select="@name"/> + <xsl:with-param name="content"><xsl:copy-of select="text()"/></xsl:with-param> + </xsl:call-template> </xsl:template> + <xsl:template match="smbconfblock"> <xsl:element name="simplelist"> <xsl:apply-templates/> diff --git a/docs/xslt/expand-smbconfdoc.xsl b/docs/xslt/expand-smbconfdoc.xsl index 8cad9b8328..712a7f4ae1 100644 --- a/docs/xslt/expand-smbconfdoc.xsl +++ b/docs/xslt/expand-smbconfdoc.xsl @@ -18,7 +18,7 @@ <xsl:template match="synonym"><xsl:apply-templates/></xsl:template> - <xsl:template match="related"><xsl:apply-templates/></xsl:template> + <xsl:template match="related"><xsl:element name="para"><xsl:text>Related command</xsl:text><xsl:apply-templates/></xsl:element></xsl:template> <xsl:template match="samba:parameterlist"> <xsl:apply-templates> diff --git a/docs/xslt/man.xsl b/docs/xslt/man.xsl index 5232d2ead2..e403122965 100644 --- a/docs/xslt/man.xsl +++ b/docs/xslt/man.xsl @@ -9,27 +9,6 @@ <xsl:param name="chunk.first.sections" select="1"/> <xsl:param name="use.id.as.filename" select="1"/> -<xsl:template name="string-subst"> - <xsl:param name="content" select="''"/> - <xsl:param name="replace" select="''"/> - <xsl:param name="with" select="''"/> - <xsl:choose> - <xsl:when test="not(contains($content,$replace))"> - <xsl:value-of select="$content"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="substring-before($content,$replace)"/> - <xsl:value-of select="$with"/> - <xsl:call-template name="string-subst"> - <xsl:with-param name="content" - select="substring-after($content,$replace)"/> - <xsl:with-param name="replace" select="$replace"/> - <xsl:with-param name="with" select="$with"/> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> -</xsl:template> - <!-- Our ulink stylesheet omits @url part if content was specified --> @@ -48,159 +27,85 @@ </xsl:if> </xsl:template> -<xsl:template match="refentry"> - - <xsl:variable name="section" select="refmeta/manvolnum"/> - <xsl:variable name="name" select="refnamediv/refname[1]"/> - <xsl:variable name="base.dir" select="$base.dir"/> - <!-- standard man page width is 64 chars; 6 chars needed for the two - (x) volume numbers, and 2 spaces, leaves 56 --> - <xsl:variable name="twidth" select="(74 - string-length(refmeta/refentrytitle)) div 2"/> - - <xsl:variable name="reftitle" - select="substring(refmeta/refentrytitle, 1, $twidth)"/> - - <xsl:variable name="title"> - <xsl:choose> - <xsl:when test="refentryinfo/title"> - <xsl:value-of select="refentryinfo/title"/> - </xsl:when> - <xsl:when test="../referenceinfo/title"> - <xsl:value-of select="../referenceinfo/title"/> - </xsl:when> - </xsl:choose> - </xsl:variable> - - <xsl:variable name="date"> - <xsl:choose> - <xsl:when test="refentryinfo/date"> - <xsl:value-of select="refentryinfo/date"/> - </xsl:when> - <xsl:when test="../referenceinfo/date"> - <xsl:value-of select="../referenceinfo/date"/> - </xsl:when> - </xsl:choose> - </xsl:variable> - - <xsl:variable name="productname"> - <xsl:choose> - <xsl:when test="refentryinfo/productname"> - <xsl:value-of select="refentryinfo/productname"/> - </xsl:when> - <xsl:when test="../referenceinfo/productname"> - <xsl:value-of select="../referenceinfo/productname"/> - </xsl:when> - </xsl:choose> - </xsl:variable> - - <xsl:call-template name="write.text.chunk"> - <xsl:with-param name="filename" - select="concat($base.dir, normalize-space ($name), '.', $section)"/> - <xsl:with-param name="content"> - <xsl:text>.\"Generated by db2man.xsl. Don't modify this, modify the source. -.de Sh \" Subsection -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. -.de Sp \" Vertical space (when we can't use .PP) -.if t .sp .5v -.if n .sp -.. -.de Ip \" List item -.br -.ie \\n(.$>=3 .ne \\$3 -.el .ne 3 -.IP "\\$1" \\$2 -.. -.TH "</xsl:text> - <xsl:value-of select="translate($reftitle,'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/> - <xsl:text>" </xsl:text> - <xsl:value-of select="refmeta/manvolnum[1]"/> - <xsl:text> "</xsl:text> - <xsl:value-of select="normalize-space($date)"/> - <xsl:text>" "</xsl:text> - <xsl:value-of select="normalize-space($productname)"/> - <xsl:text>" "</xsl:text> - <xsl:value-of select="$title"/> - <xsl:text>" -</xsl:text> - <xsl:apply-templates/> - <xsl:text> </xsl:text> - - <!-- Author section --> - <xsl:choose> - <xsl:when test="refentryinfo//author"> - <xsl:apply-templates select="refentryinfo" mode="authorsect"/> - </xsl:when> - </xsl:choose> - </xsl:with-param> - </xsl:call-template> -</xsl:template> - -<xsl:template match="informalexample|screen|programlisting"> - <xsl:text> .nf </xsl:text> - <xsl:apply-templates/> - <xsl:text> .fi </xsl:text> -</xsl:template> - -<xsl:template match="//emphasis"> - <xsl:text>\fB</xsl:text> - <xsl:apply-templates/> - <xsl:text>\fR</xsl:text> -</xsl:template> - -<xsl:template match="//quote"> - <xsl:text>\fB</xsl:text> - <xsl:apply-templates/> - <xsl:text>\fR</xsl:text> -</xsl:template> - -<xsl:template match="//literal"> -<xsl:variable name="foo"> - <xsl:apply-templates /> -</xsl:variable> - <xsl:call-template name="string-subst"> - <xsl:with-param name="content" select="$foo" /> - <xsl:with-param name="replace" select="'\'" /> - <xsl:with-param name="with" select="'\\'" /> - </xsl:call-template> -</xsl:template> - <xsl:template match="itemizedlist/listitem"> - <xsl:text>\(bu </xsl:text> - <xsl:apply-templates/> - <xsl:if test="following-sibling::listitem"> - <xsl:text>.TP</xsl:text> - <xsl:text> </xsl:text> + <!-- * We output a real bullet here (rather than, "\(bu", --> + <!-- * the roff bullet) because, when we do character-map --> + <!-- * processing before final output, the character-map will --> + <!-- * handle conversion of the • to "\(bu" for us --> + <xsl:text> </xsl:text> + <xsl:text>.sp</xsl:text> + <xsl:text> </xsl:text> + <xsl:text>.RS</xsl:text> + <xsl:if test="not($list-indent = '')"> + <xsl:text> </xsl:text> + <xsl:value-of select="$list-indent"/> </xsl:if> -</xsl:template> - - -<xsl:template match="para|simpara|remark" mode="list"> - <xsl:variable name="foo"> - <xsl:apply-templates/> - </xsl:variable> - <xsl:choose match="node()"> - <!-- Don't normalize-space() for verbatim paragraphs --> - <xsl:when test="informalexample|screen|programlisting"> - <xsl:value-of select="$foo"/> + <xsl:text> </xsl:text> + <!-- * if "n" then we are using "nroff", which means the output is for --> + <!-- * TTY; so we do some fixed-width-font hackery with \h to make a --> + <!-- * hanging indent (instead of using .IP, which has some --> + <!-- * undesirable side effects under certain circumstances) --> + <xsl:call-template name="roff-if-else-start"/> + <xsl:text>\h'-</xsl:text> + <xsl:choose> + <xsl:when test="not($list-indent = '')"> + <xsl:text>0</xsl:text> + <xsl:value-of select="$list-indent"/> </xsl:when> <xsl:otherwise> - <xsl:value-of select="normalize-space($foo)"/> - <xsl:text> </xsl:text> + <xsl:text>\n(INu</xsl:text> </xsl:otherwise> </xsl:choose> - <xsl:text> </xsl:text> - <xsl:if test="following-sibling::para or following-sibling::simpara or - following-sibling::remark"> - <!-- Make sure multiple paragraphs within a list item don't --> - <!-- merge together. --> + <xsl:text>'</xsl:text> + <xsl:text>•</xsl:text> + <xsl:text>\h'+</xsl:text> + <xsl:choose> + <xsl:when test="not($list-indent = '')"> + <xsl:text>0</xsl:text> + <xsl:value-of select="$list-indent - 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>\n(INu-1</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>'\c </xsl:text> + <!-- * else, we are not using for "nroff", but instead "troff" - which --> + <!-- * means not for TTY, but for PS or whatever; so we’re not using a --> + <!-- * fixed-width font, so use a real .IP instead --> + <xsl:call-template name="roff-else"/> + <!-- * .IP generates a blank like of space, so let’s go backwards one --> + <!-- * line up to compensate for that --> + <xsl:text>.sp -1 </xsl:text> + <xsl:text>.IP \(bu 2.3 </xsl:text> + <!-- * The value 2.3 is the amount of indentation; we use 2.3 instead --> + <!-- * of 2 because when the font family is New Century Schoolbook it --> + <!-- * seems to require the extra space. --> + <xsl:call-template name="roff-if-end"/> + <xsl:apply-templates/> + <xsl:if test=" following-sibling::listitem"> + <xsl:text> .RE </xsl:text> + </xsl:if> +</xsl:template> + +<xsl:template match="itemizedlist|orderedlist|procedure"> + <xsl:if test="title"> + <xsl:text>.PP </xsl:text> + <xsl:call-template name="bold"> + <xsl:with-param name="node" select="title"/> + <xsl:with-param name="context" select="."/> + </xsl:call-template> <xsl:text> </xsl:text> </xsl:if> + <!-- * DocBook allows just about any block content to appear in --> + <!-- * lists before the actual list items, so we need to get that --> + <!-- * content (if any) before getting the list items --> + <xsl:apply-templates + select="*[not(self::listitem) and not(self::title)]"/> + <xsl:apply-templates select="listitem"/> + <xsl:if test="(parent::para or parent::listitem) or following-sibling::node()"> + <xsl:text>.sp </xsl:text> + <xsl:text>.RE </xsl:text> + </xsl:if> </xsl:template> <xsl:template match="refsect3"> |