diff options
Diffstat (limited to 'docs/xslt/man.xsl')
-rw-r--r-- | docs/xslt/man.xsl | 237 |
1 files changed, 71 insertions, 166 deletions
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"> |