?? nroff.xsl
字號:
<xsl:call-template name="filter.escape">
<xsl:with-param name="text" select="normalize-space(title)"/>
</xsl:call-template>
<xsl:text>"</xsl:text>&lf;
<xsl:apply-templates />
</xsl:template>
<!-- /section/section -->
<!-- ==================================================================== -->
<!-- <summary> -->
<!-- process summary section -->
<!-- ==================================================================== -->
<xsl:template match="summary">
&lf;
<xsl:text>.SH "</xsl:text>
<xsl:call-template name="filter.escape">
<xsl:with-param name="text" select="normalize-space(translate($message
[@id='summary'], $lowercase, $uppercase))"/>
</xsl:call-template>
<xsl:text>"</xsl:text>&lf;
<xsl:apply-templates />
</xsl:template>
<!-- /summary -->
<!-- ==================================================================== -->
<!-- <var>, <em> -->
<!-- show it somewhat special (italic) -->
<!-- ==================================================================== -->
<xsl:template match="var|em">
<xsl:text>\fI</xsl:text>
<xsl:apply-templates />
<xsl:text>\fR</xsl:text>
</xsl:template>
<!-- ==================================================================== -->
<!-- <strong> -->
<!-- show it somewhat special (bold) -->
<!-- ==================================================================== -->
<xsl:template match="strong">
<xsl:text>\fB</xsl:text>
<xsl:apply-templates />
<xsl:text>\fR</xsl:text>
</xsl:template>
<!-- ==================================================================== -->
<!-- <directive> -->
<!-- ==================================================================== -->
<xsl:template match="directive">
<xsl:if test="@type = 'section'"><</xsl:if>
<xsl:apply-templates />
<xsl:if test="@type = 'section'">></xsl:if>
</xsl:template>
<!-- ==================================================================== -->
<!-- <dl> -->
<!-- ==================================================================== -->
<xsl:template match="dl">
&lf;
<xsl:apply-templates />&lf;
</xsl:template>
<!-- ==================================================================== -->
<!-- <dt> -->
<!-- ==================================================================== -->
<xsl:template match="dt">
&lf;
<xsl:text>.TP</xsl:text>&lf;
<xsl:variable name="dt-content">
<xsl:apply-templates />
</xsl:variable>
<xsl:value-of select="normalize-space($dt-content)" />&lf;
<xsl:variable name="dd-content">
<xsl:apply-templates
select="following-sibling::dd[position() = 1]/node()" />
</xsl:variable>
<xsl:value-of select="normalize-space($dd-content)" />
</xsl:template>
<!-- /dt -->
<!-- ==================================================================== -->
<!-- <example> -->
<!-- ==================================================================== -->
<xsl:template match="example[ancestor::dd]">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="example[not(ancestor::dd)]">
&lf;
<xsl:text>.nf</xsl:text>&lf;
<xsl:apply-templates />&lf;
<xsl:text>.fi</xsl:text>&lf;
</xsl:template>
<!-- /example -->
<!-- ==================================================================== -->
<!-- simple table support ... (exactly 2 columns) -->
<!-- ==================================================================== -->
<xsl:template match="table/tr">
<xsl:if test="count(./*) > 2">
<xsl:message terminate="yes">
FATAL: only tables with two (2) columns are supported.
</xsl:message>
</xsl:if>
&lf;
<xsl:text>.Ip "\(bu \s-1</xsl:text>
<xsl:variable name="first-content">
<xsl:apply-templates select="./*[1]/node()" />
</xsl:variable>
<xsl:value-of select="normalize-space($first-content)" />
<xsl:text>\s0 \- </xsl:text>
<xsl:variable name="second-content">
<xsl:apply-templates select="./*[2]/node()" />
</xsl:variable>
<xsl:value-of select="normalize-space($second-content)" />&lf;
</xsl:template>
<!-- /table/tr -->
<!-- ==================================================================== -->
<!-- text filter -->
<!-- ==================================================================== -->
<xsl:template match="text()">
<xsl:choose>
<xsl:when test="normalize-space(.) != ''">
<xsl:call-template name="filter.escape">
<xsl:with-param name="text" select="." />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<!-- pass through content -->
<!-- ==================================================================== -->
<xsl:template match="a|code|module|table|program">
<xsl:apply-templates />
</xsl:template>
<!-- ==================================================================== -->
<!-- remove some stuff from the output -->
<!-- ==================================================================== -->
<xsl:template match="parentdocument|seealso|dd|td|example/br" />
<!-- ==================================================================== -->
<!-- the rest will be rejected -->
<!-- ==================================================================== -->
<xsl:template match="*">
<xsl:message terminate="yes">
FATAL: the behaviour of the <<xsl:value-of select="local-name()" />>
element was not tested. You need to modify
the XSLT stylesheet in order to get it work.
</xsl:message>
</xsl:template>
<!-- ==================================================================== -->
<!-- filter.escape -->
<!-- escape special characters -->
<!-- ==================================================================== -->
<xsl:template name="filter.escape">
<xsl:param name="text" />
<xsl:choose>
<xsl:when test="contains($text, '\')">
<xsl:call-template name="filter.escape.period">
<xsl:with-param name="text" select="substring-before($text, '\')" />
</xsl:call-template>
<xsl:text>\\</xsl:text>
<xsl:call-template name="filter.escape">
<xsl:with-param name="text" select="substring-after($text, '\\')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="filter.escape.period">
<xsl:with-param name="text" select="$text" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- /filter.escape -->
<!-- ==================================================================== -->
<!-- filter.period -->
<!-- accompanying template to filter.escape -->
<!-- ==================================================================== -->
<xsl:template name="filter.escape.period">
<xsl:param name="text" />
<xsl:choose>
<xsl:when test="contains($text, '.')"><!-- period replaced by \&. -->
<xsl:value-of select="substring-before($text, '.')" />
<xsl:text>\&.</xsl:text>
<xsl:call-template name="filter.escape.period">
<xsl:with-param name="text" select="substring-after($text, '.')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- /filter.escape.period -->
</xsl:stylesheet>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -