VirtualBox

Changeset 99271 in vbox for trunk/doc/manual


Ignore:
Timestamp:
Apr 4, 2023 12:34:29 AM (23 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156654
Message:

manual: More work on the refentry to dita converter - convert to topic rather than reference. bugref:10302

Location:
trunk/doc/manual
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/docbook-refentry-to-manual-dita.xsl

    r99270 r99271  
    5555<xsl:param name="g_fRenderSyntaxAsText">true</xsl:param>
    5656
     57<!-- Convert to reference if true, to topic structure if not.  -->
     58<xsl:param name="g_fToReference">false</xsl:param>
     59
    5760
    5861<!-- - - - - - - - - - - - - - - - - - - - - - -
     
    7881     Also we need to wrap the refsync and refsect1 elements in a refbody. -->
    7982<xsl:template match="refentry">
    80   <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd"&gt;
     83  <xsl:variable name="sRootElement">
     84    <xsl:choose>
     85      <xsl:when test="$g_fToReference = 'true'">reference</xsl:when>
     86      <xsl:otherwise>topic</xsl:otherwise>
     87    </xsl:choose>
     88  </xsl:variable>
     89
     90  <!-- !DOCTYPE -->
     91  <xsl:choose>
     92    <xsl:when test="$g_fToReference = 'true'">
     93      <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"&gt;
    8194</xsl:text>
    82 
    83   <xsl:element name="reference">
     95    </xsl:when>
     96    <xsl:otherwise>
     97      <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd"&gt;
     98</xsl:text>
     99    </xsl:otherwise>
     100  </xsl:choose>
     101
     102  <!-- Root element -->
     103  <xsl:element name="{$sRootElement}">
    84104    <xsl:if test="not(@id)">
    85105      <xsl:message terminate="yes"><xsl:call-template name="error-prefix"/>refentry must have an id attribute!</xsl:message>
     
    103123    </xsl:if>
    104124
    105     <!-- Put everything else side a refbody element -->
    106     <xsl:element name="refbody">
    107       <xsl:apply-templates />
    108     </xsl:element>
     125    <!-- Put everything else side a refbody element if in 'reference' mode, otherwise no body. -->
     126    <xsl:choose>
     127      <xsl:when test="$g_fToReference = 'true'">
     128        <xsl:element name="refbody">
     129          <xsl:apply-templates />
     130        </xsl:element>
     131      </xsl:when>
     132
     133      <xsl:otherwise>
     134        <xsl:apply-templates />
     135      </xsl:otherwise>
     136    </xsl:choose>
    109137
    110138  </xsl:element>
     
    125153  <xsl:if test="title"><xsl:message terminate="yes">No title element supported in refsynopsisdiv</xsl:message></xsl:if>
    126154
    127   <xsl:element name="refsyn">
    128     <xsl:attribute name="rev">refsynopsisdiv</xsl:attribute>
    129     <xsl:element name="title">
    130       <xsl:text>Synopsis</xsl:text>
    131     </xsl:element>
    132     <xsl:apply-templates />
    133   </xsl:element>
    134 
    135 </xsl:template>
    136 
    137 <!-- refsect1 -> section -->
     155  <xsl:choose>
     156    <xsl:when test="$g_fToReference = 'true'">
     157      <xsl:element name="refsyn">
     158        <xsl:attribute name="rev">refsynopsisdiv</xsl:attribute>
     159        <xsl:element name="title">
     160          <xsl:text>Synopsis</xsl:text>
     161        </xsl:element>
     162        <xsl:apply-templates />
     163      </xsl:element>
     164    </xsl:when>
     165
     166    <xsl:otherwise>
     167      <xsl:element name="topic">
     168        <xsl:attribute name="rev">refsynopsisdiv</xsl:attribute>
     169        <xsl:attribute name="toc">no</xsl:attribute>
     170        <xsl:element name="title">
     171          <xsl:text>Synopsis</xsl:text>
     172        </xsl:element>
     173
     174        <xsl:element name="body">
     175          <xsl:apply-templates />
     176        </xsl:element>
     177      </xsl:element>
     178    </xsl:otherwise>
     179
     180  </xsl:choose>
     181</xsl:template>
     182
     183<!-- refsect1 -> section or topic -->
    138184<xsl:template match="refsect1">
    139185  <xsl:if test="not(title)"><xsl:message terminate="yes">refsect1 requires title</xsl:message></xsl:if>
    140   <xsl:element name="section">
    141     <xsl:attribute name="rev">refsect1</xsl:attribute>
    142     <xsl:if test="@id">
    143       <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
    144     </xsl:if>
    145     <xsl:apply-templates />
    146   </xsl:element>
    147 </xsl:template>
    148 
    149 <!-- refsect2 -> sectiondiv. -->
     186
     187  <xsl:choose>
     188    <xsl:when test="$g_fToReference = 'true'">
     189      <xsl:element name="section">
     190        <xsl:attribute name="rev">refsect1</xsl:attribute>
     191        <xsl:if test="@id">
     192          <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
     193        </xsl:if>
     194        <xsl:apply-templates />
     195      </xsl:element>
     196    </xsl:when>
     197
     198    <xsl:otherwise>
     199      <xsl:element name="topic">
     200        <xsl:attribute name="rev">refsect1</xsl:attribute>
     201        <xsl:attribute name="toc">no</xsl:attribute>
     202        <xsl:attribute name="id">
     203          <xsl:choose>
     204            <xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when>
     205            <xsl:otherwise><xsl:value-of select="generate-id()"/></xsl:otherwise>
     206          </xsl:choose>
     207        </xsl:attribute>
     208
     209        <xsl:apply-templates select="title"/>
     210
     211        <!-- Must put cmdsynopsis in a paragraph or it'll get too close to any preceeding section title -->
     212        <xsl:element name="body">
     213          <xsl:for-each select="node()">
     214            <xsl:choose>
     215              <xsl:when test="self::title"/>
     216              <xsl:when test="self::refentry2"/>
     217              <xsl:when test="self::cmdsynopsis">
     218                <xsl:element name="p">
     219                  <xsl:attribute name="rev">refsect1/cmdsynopsis</xsl:attribute>
     220                  <xsl:apply-templates select="." />
     221                </xsl:element>
     222              </xsl:when>
     223              <xsl:otherwise>
     224                <xsl:apply-templates select="." />
     225              </xsl:otherwise>
     226            </xsl:choose>
     227          </xsl:for-each>
     228
     229          <!-- xsl:apply-templates select="node()[not(self::title) and not(self::refentry2)]" / -->
     230        </xsl:element>
     231
     232        <xsl:apply-templates select="refentry2"/>
     233      </xsl:element>
     234    </xsl:otherwise>
     235
     236  </xsl:choose>
     237</xsl:template>
     238
     239<!-- refsect2 -> sectiondiv or topic. -->
    150240<xsl:template match="refsect2">
    151241  <xsl:if test="not(title)"><xsl:message terminate="yes">refsect2 requires title</xsl:message></xsl:if>
    152   <xsl:element name="sectiondiv">
    153     <xsl:attribute name="rev">refsect2</xsl:attribute>
    154     <xsl:attribute name="outputclass">refsect2</xsl:attribute> <!-- how to make xhtml pass these thru... -->
    155     <xsl:if test="@id">
    156       <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
    157     </xsl:if>
    158 
    159     <xsl:apply-templates />
    160 
    161   </xsl:element>
    162 </xsl:template>
    163 
    164 <!-- refsect2/title -> b -->
    165 <xsl:template match="refsect2/title">
    166   <xsl:element name="b">
    167     <xsl:attribute name="rev">refsect2/title</xsl:attribute>
    168     <xsl:attribute name="outputclass">refsect2title</xsl:attribute> <!-- how to make xhtml pass these thru... -->
    169     <xsl:apply-templates />
    170   </xsl:element>
     242
     243  <xsl:choose>
     244    <xsl:when test="$g_fToReference = 'true'">
     245      <xsl:element name="sectiondiv">
     246        <xsl:attribute name="rev">refsect2</xsl:attribute>
     247        <xsl:attribute name="outputclass">refsect2</xsl:attribute> <!-- how to make xhtml pass these thru... -->
     248        <xsl:if test="@id">
     249          <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
     250        </xsl:if>
     251
     252        <xsl:apply-templates />
     253
     254      </xsl:element>
     255    </xsl:when>
     256
     257    <xsl:otherwise>
     258      <xsl:element name="topic">
     259        <xsl:attribute name="rev">refsect2</xsl:attribute>
     260        <xsl:attribute name="toc">no</xsl:attribute>
     261        <xsl:attribute name="id">
     262          <xsl:choose>
     263            <xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when>
     264            <xsl:otherwise><xsl:value-of select="generate-id()"/></xsl:otherwise>
     265          </xsl:choose>
     266        </xsl:attribute>
     267
     268        <xsl:apply-templates select="title"/>
     269
     270        <xsl:element name="body">
     271          <xsl:for-each select="node()">
     272            <xsl:choose>
     273              <xsl:when test="self::title"/>
     274              <xsl:when test="self::refentry3"/>
     275              <xsl:when test="self::cmdsynopsis">
     276                <xsl:element name="p">
     277                  <xsl:attribute name="rev">refsect2/cmdsynopsis</xsl:attribute>
     278                  <xsl:apply-templates select="." />
     279                </xsl:element>
     280                <xsl:element name="p">
     281                  <xsl:attribute name="rev">space hack</xsl:attribute>
     282                  <xsl:text> </xsl:text>
     283                </xsl:element>
     284              </xsl:when>
     285              <xsl:otherwise>
     286                <xsl:apply-templates select="." />
     287              </xsl:otherwise>
     288            </xsl:choose>
     289          </xsl:for-each>
     290
     291          <!-- xsl:apply-templates select="node()[not(self::title) and not(self::refentry3)]"/ -->
     292        </xsl:element>
     293
     294        <xsl:apply-templates select="refentry3"/>
     295      </xsl:element>
     296    </xsl:otherwise>
     297
     298  </xsl:choose>
    171299</xsl:template>
    172300
     
    176304    <xsl:apply-templates />
    177305  </xsl:copy>
     306</xsl:template>
     307
     308<!-- refsect2/title -> b or title -->
     309<xsl:template match="refsect2/title">
     310  <xsl:choose>
     311    <xsl:when test="$g_fToReference = 'true'">
     312      <xsl:element name="b">
     313        <xsl:attribute name="rev">refsect2/title</xsl:attribute>
     314        <xsl:attribute name="outputclass">refsect2title</xsl:attribute> <!-- how to make xhtml pass these thru... -->
     315        <xsl:apply-templates />
     316      </xsl:element>
     317    </xsl:when>
     318
     319    <xsl:otherwise>
     320      <xsl:copy>
     321        <xsl:apply-templates />
     322      </xsl:copy>
     323    </xsl:otherwise>
     324
     325  </xsl:choose>
    178326</xsl:template>
    179327
     
    620768
    621769<!-- replaceable/text() in a cmdsynopsis should have hypens replaced. -->
    622 <xsl:template match="cmdsynopsis/*/replaceable/text()" >
     770<xsl:template match="replaceable/text()[ancestor::cmdsynopsis]" >
    623771  <xsl:call-template name="emit-text-with-replacements"/>
    624772</xsl:template>
  • trunk/doc/manual/pdf-theme-UserManual.yaml

    r99270 r99271  
    215215
    216216
     217    #
    217218    # The following properties requires an pdf-generator git newer than February 2023,
    218219    # or version 0.6.2+ (unreleased).
    219220    #
     221
    220222    # We need to specify the font for each of these elements, so we get a monospace
    221223    # font capable of doing non-breaking hypen glyps. The default "Courier" does do
     
    245247        font-family:        $pdf2-font-monospaced
    246248
     249
     250    # Prevent a parameter and it's definition from ending up on different pages.
     251    plentry:
     252        keep-together.within-page: always
     253
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