VirtualBox

Changeset 99101 in vbox for trunk


Ignore:
Timestamp:
Mar 21, 2023 11:59:33 PM (23 months ago)
Author:
vboxsync
Message:

manual: More work on the refentry to dita converter. bugref:10302

Location:
trunk/doc/manual
Files:
2 edited

Legend:

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

    r99099 r99101  
    221221</xsl:template>
    222222
    223 <!-- command in cmdsynopsis -> syntaxdiagram -->
    224 <xsl:template match="cmdsynopsis">
     223<!-- command in cmdsynopsis -> syntaxdiagram
     224     If sbr is used, this gets a bit more complicated... -->
     225<xsl:template match="cmdsynopsis[not(sbr)]">
    225226  <xsl:element name="syntaxdiagram">
    226227    <xsl:attribute name="rev">cmdsynopsis</xsl:attribute>
     
    231232  </xsl:element>
    232233</xsl:template>
     234
     235<!--  This isn't working.
     236<xsl:key name="G_keyUpToNextSbr"
     237  match="cmdsynopsis/node()[not(self::sbr)]"
     238  use="generate-id((..|preceding-sibling::sbr[1])[last()])"/>
     239
     240<xsl:template match="cmdsynopsis[sbr]">
     241  <xsl:element name="syntaxdiagram">
     242    <xsl:attribute name="rev">cmdsynopsis</xsl:attribute>
     243    <xsl:if test="@id">
     244      <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
     245    </xsl:if>
     246    <xsl:element name="groupcomp">
     247      <xsl:attribute name="rev">sbr/0</xsl:attribute>
     248      <xsl:apply-templates select="key('G_keyUpToNextSbr', generate-id())"/>
     249    </xsl:element>
     250    <xsl:apply-templates select="sbr"/>
     251  </xsl:element>
     252</xsl:template>
     253
     254<xsl:template match="cmdsynopsis/sbr">
     255  <xsl:element name="groupcomp">
     256    <xsl:attribute name="rev">sbr/n</xsl:attribute>
     257    <xsl:apply-templates select="key('G_keyUpToNextSbr', generate-id())"/>
     258  </xsl:element>
     259</xsl:template>
     260-->
     261<xsl:template match="cmdsynopsis[sbr]">
     262  <xsl:if test="count(sbr) != 1">
     263    <xsl:message terminate="yes">Currently only support a single sbr element in a cmdsynopsis. Sorry.</xsl:message>
     264  </xsl:if>
     265  <xsl:element name="syntaxdiagram">
     266    <xsl:attribute name="rev">cmdsynopsis</xsl:attribute>
     267    <xsl:if test="@id">
     268      <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
     269    </xsl:if>
     270    <xsl:element name="groupcomp">
     271      <xsl:apply-templates select="sbr[1]/preceding-sibling::node()"/>
     272    </xsl:element>
     273    <xsl:apply-templates select="sbr[1]/following-sibling::node()"/>
     274  </xsl:element>
     275</xsl:template>
     276
    233277
    234278<!-- command in cmdsynopsis -> groupseq + kwd -->
     
    275319</xsl:template>
    276320
    277 <xsl:template match="arg[@choice='plain' and (not(@rep) or @rep='norepeat')]" >
     321<xsl:template match="arg[not(*) and not(ancestor::group) and ancestor::cmdsynopsis and @choice='plain' and (not(@rep) or @rep='norepeat')]" >
     322  <xsl:element name="kwd">
     323    <xsl:attribute name="rev">arg[plain]</xsl:attribute>
     324    <xsl:apply-templates />
     325  </xsl:element>
     326</xsl:template>
     327
     328<xsl:template match="group/arg[replaceable and @choice='plain' and (not(@rep) or @rep='norepeat')]" >
     329  <xsl:if test="./*[not(self::replaceable)] or ./text()">
     330    <xsl:message terminate="yes"><xsl:call-template name="error-prefix"/>
     331      Did not expect group/arg[@choice=plain] to have children other than replaceable:
     332      <xsl:for-each select="./*|./text()">
     333        <xsl:value-of select="concat(', ', name(.))"/>
     334      </xsl:for-each>
     335    </xsl:message>
     336  </xsl:if>
     337  <xsl:element name="var">
     338    <xsl:attribute name="rev">arg[plain]/replaceable</xsl:attribute>
     339    <xsl:value-of select="."/>
     340  </xsl:element>
     341</xsl:template>
     342
     343<xsl:template match="group/arg[@choice='plain' and (not(@rep) or @rep='norepeat') and not(replaceable)]" >
    278344  <xsl:if test="./*">
    279     <xsl:message terminate="yes"><xsl:call-template name="error-prefix"/>Expected only text under arg[choice=plain]</xsl:message>
     345    <xsl:message terminate="yes"><xsl:call-template name="error-prefix"/>Did not expect arg[@choice=plain] to have children
     346      <xsl:for-each select="./*">
     347        <xsl:text>
     348        </xsl:text>
     349        <xsl:value-of select="name()"/>
     350      </xsl:for-each>
     351    </xsl:message>
    280352  </xsl:if>
    281353  <xsl:element name="kwd">
     
    285357</xsl:template>
    286358
     359<xsl:template match="arg[(not(@choice) or @choice='opt') and @rep='repeat' and not(ancestor::group) and not(group)]" >
     360  <xsl:element name="groupseq">
     361    <xsl:attribute name="rev">arg[opt,repeat]</xsl:attribute>
     362    <xsl:attribute name="importance">optional</xsl:attribute>
     363    <xsl:apply-templates />
     364    <xsl:element name="repsep">
     365      <xsl:attribute name="rev">arg[opt,repeat]</xsl:attribute>
     366      <xsl:text>...</xsl:text>
     367    </xsl:element>
     368  </xsl:element>
     369</xsl:template>
     370
     371
    287372<!-- replaceable under arg -> var -->
    288373<xsl:template match="arg/replaceable" >
     
    294379
    295380<!-- replaceable in para or term -> synph+var -->
    296 <xsl:template match="para/replaceable | term/replaceable" >
     381<xsl:template match="para/replaceable | term/replaceable | screen/replaceable" >
    297382  <xsl:element name="synph">
    298383    <xsl:attribute name="rev">replaceable</xsl:attribute>
     
    312397</xsl:template>
    313398
    314 <!-- group under cmdsynopsis -> groupchoice -->
     399<!-- replaceable in computeroutput -> varname -->
     400<xsl:template match="computeroutput/replaceable" >
     401  <xsl:element name="varname">
     402    <xsl:attribute name="rev">computeroutput/replaceable</xsl:attribute>
     403    <xsl:apply-templates />
     404  </xsl:element>
     405</xsl:template>
     406
     407<!-- group under arg and cmdsynopsis -> groupchoice -->
    315408<xsl:template match="arg/group[@choice='plain'] | cmdsynopsis/group[@choice='plain']">
    316409  <xsl:element name="groupchoice">
     
    320413</xsl:template>
    321414
     415<xsl:template match="arg/group[@choice='req'] | cmdsynopsis/group[@choice='req']">
     416  <xsl:element name="groupchoice">
     417    <xsl:attribute name="rev">group</xsl:attribute>
     418    <xsl:attribute name="importance">required</xsl:attribute>
     419    <xsl:apply-templates />
     420  </xsl:element>
     421</xsl:template>
     422
     423<xsl:template match="cmdsynopsis/group[(@choice='opt' or not(@choice)) and (not(@rep) or @rep='norepeat')]" >
     424  <xsl:if test="not(./arg[@choice='plain'])">
     425    <xsl:message terminate="yes"><xsl:call-template name="error-prefix"/>Did not expect group[@choice=opt] to have children other than arg[@choice=plain]:
     426      <xsl:for-each select="node()"><xsl:value-of select="concat(' ', name())"/>[@choice=<xsl:value-of select="@choice"/>]</xsl:for-each>
     427    </xsl:message>
     428  </xsl:if>
     429  <xsl:element name="groupchoice">
     430    <xsl:attribute name="rev">group[opt]</xsl:attribute>
     431    <xsl:attribute name="importance">optional</xsl:attribute>
     432    <xsl:value-of select="."/>
     433  </xsl:element>
     434</xsl:template>
    322435
    323436<!-- option -->
     
    336449</xsl:template>
    337450
    338 <!-- literal -> codeph -->
    339 <xsl:template match="literal" >
     451<!-- literal w/o sub-elements -> codeph -->
     452<xsl:template match="literal[not(*)]" >
    340453  <xsl:element name="codeph">
    341454    <xsl:attribute name="rev">literal</xsl:attribute>
    342455    <xsl:apply-templates />
     456  </xsl:element>
     457</xsl:template>
     458
     459<!-- literal with replaceable sub-elements -> synph -->
     460<xsl:template match="literal[replaceable]" >
     461  <xsl:element name="synph">
     462    <xsl:attribute name="rev">literal/replaceable</xsl:attribute>
     463    <xsl:for-each select="node()">
     464      <xsl:choose>
     465        <xsl:when test="self::text()">
     466          <xsl:element name="kwd">
     467            <xsl:value-of select="."/>
     468          </xsl:element>
     469        </xsl:when>
     470        <xsl:when test="self::replaceable">
     471          <xsl:if test="./*">
     472            <xsl:message terminate="yes"><xsl:call-template name="error-prefix"/>Unexpected literal/replaceable child</xsl:message>
     473          </xsl:if>
     474          <xsl:element name="var">
     475            <xsl:value-of select="."/>
     476          </xsl:element>
     477        </xsl:when>
     478        <xsl:otherwise>
     479          <xsl:message terminate="yes"><xsl:call-template name="error-prefix"/>Unexpected literal child:
     480            <xsl:value-of select="name(.)" />
     481          </xsl:message>
     482        </xsl:otherwise>
     483      </xsl:choose>
     484    </xsl:for-each>
    343485  </xsl:element>
    344486</xsl:template>
     
    359501</xsl:template>
    360502
    361 
     503<!-- computeroutput -> systemoutput-->
     504<xsl:template match="computeroutput">
     505  <xsl:element name="systemoutput">
     506    <xsl:attribute name="rev">computeroutput</xsl:attribute>
     507    <xsl:apply-templates />
     508  </xsl:element>
     509</xsl:template>
     510
     511<!-- xref -> xref, but attributes differ. -->
     512<xsl:template match="xref">
     513  <xsl:element name="xref">
     514    <xsl:attribute name="href"><xsl:value-of select="@linkend"/></xsl:attribute>
     515    <xsl:if test="contains(@linkend, 'http')">
     516      <xsl:attribute name="scope">external</xsl:attribute>
     517      <xsl:apply-templates />
     518    </xsl:if>
     519  </xsl:element>
     520</xsl:template>
     521
     522<!-- emphasis -> i -->
     523<xsl:template match="emphasis">
     524  <xsl:if test="*">
     525    <xsl:message terminate="yes"><xsl:call-template name="error-prefix"/>Did not expect emphasis to have children!</xsl:message>
     526  </xsl:if>
     527  <xsl:element name="i">
     528    <xsl:attribute name="rev">emphasis</xsl:attribute>
     529    <xsl:apply-templates />
     530  </xsl:element>
     531</xsl:template>
    362532
    363533<!--
  • trunk/doc/manual/en_US/man_VBoxHeadless.xml

    r98103 r99101  
    4949    <cmdsynopsis id="synopsis-vboxmanage-vboxheadless">
    5050      <command>VBoxHeadless</command>
    51       <arg>--startvm=<group>
     51      <arg>--startvm=<group choice="req">
    5252          <arg choice="plain"><replaceable>uuid</replaceable></arg>
    5353          <arg choice="plain"><replaceable>vmname</replaceable></arg>
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