VirtualBox

Ignore:
Timestamp:
Jun 17, 2015 3:19:48 PM (9 years ago)
Author:
vboxsync
Message:

Made docbook-refentry-to-manual-sect1.xsl produce valid docbook xml but with a few hints that can be used for nice manpage-like formatting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/common-formatcfg.xsl

    r31972 r56482  
    5656</xsl:attribute-set>
    5757
     58
     59<!--
     60  refentry related layout tweaks.
     61
     62  Note! While we could save us all this work by using refsect1..3 and
     63        refsynopsisdiv docbook-refentry-to-manual-sect1.xsl, we'd like to have
     64        a valid XML document and thus do do some extra markup using the role
     65        and condition attributes.  We catch some of it here.  But the XSLT
     66        for specific targets (html, latex, etc) have a few more tweaks
     67        related to this.
     68
     69        The @role has only one special trick 'not-in-toc' that excludes sections
     70        like 'Synopsis' and 'Description' from the TOCs.
     71
     72        The @condition records the original refentry element name, i.e. it will
     73        have values like refentry, refsynopsisdiv, refsect1, refsect2 and refsect3.
     74  -->
     75
     76<!-- This removes the not-in-toc bits from the toc. -->
     77<xsl:template match="sect2[@role = 'not-in-toc']"      mode="toc" />
     78<xsl:template match="sect3[@role = 'not-in-toc']"      mode="toc" />
     79<xsl:template match="sect4[@role = 'not-in-toc']"      mode="toc" />
     80<xsl:template match="sect5[@role = 'not-in-toc']"      mode="toc" />
     81<xsl:template match="section[@role = 'not-in-toc']"    mode="toc" />
     82<xsl:template match="simplesect[@role = 'not-in-toc']" mode="toc" />
     83
     84<!-- This removes unnecessary <dd><dl> stuff caused by the above. -->
     85<xsl:template match="sect1[sect2/@role = 'not-in-toc']" mode="toc">
     86  <xsl:param name="toc-context" select="."/>
     87  <xsl:call-template name="subtoc">
     88    <xsl:with-param name="toc-context" select="$toc-context"/>
     89    <xsl:with-param name="nodes" select="sect2[@role != 'not-in-toc'] | bridgehead[$bridgehead.in.toc != 0]"/>
     90  </xsl:call-template>
     91</xsl:template>
     92
     93<xsl:template match="sect2[sect3/@role = 'not-in-toc']" mode="toc">
     94  <xsl:param name="toc-context" select="."/>
     95  <xsl:call-template name="subtoc">
     96    <xsl:with-param name="toc-context" select="$toc-context"/>
     97    <xsl:with-param name="nodes" select="sect3[@role != 'not-in-toc'] | bridgehead[$bridgehead.in.toc != 0]"/>
     98  </xsl:call-template>
     99</xsl:template>
     100
     101<!-- This make the refsect* and refsynopsisdiv unnumbered like the default refentry rendering. -->
     102<xsl:template match="sect2[@condition = 'refsynopsisdiv']
     103                   | sect2[starts-with(@condition, 'refsect')]
     104                   | sect3[starts-with(@condition, 'refsect')]
     105                   | sect4[starts-with(@condition, 'refsect')]
     106                   | sect5[starts-with(@condition, 'refsect')]
     107                   | section[starts-with(@condition, 'refsect')]
     108                   | simplesect[starts-with(@condition, 'refsect')]"
     109  mode="object.title.template"
     110  >
     111    <xsl:call-template name="gentext.template">
     112      <xsl:with-param name="context" select="'title-unnumbered'"/>
     113      <xsl:with-param name="name">
     114        <xsl:call-template name="xpath.location"/>
     115      </xsl:with-param>
     116    </xsl:call-template>
     117</xsl:template>
     118
     119
    58120</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette