VirtualBox

Changeset 99014 in vbox for trunk


Ignore:
Timestamp:
Mar 17, 2023 3:34:57 PM (21 months ago)
Author:
vboxsync
Message:

manual: Use the UserManual.ditamap instead of UserManual.xml to generate xslt for link replacement in manual pages. bugref:10302

Location:
trunk/doc/manual
Files:
1 added
2 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/Config.kmk

    r98448 r99014  
    3939 #
    4040
     41 # DITA stuff.
     42 VBOX_DITA_CONVERTER_PATH ?= $(PATH_ROOT)/src/libs/dbdita-1.0
     43 VBOX_DITA_ORIGINAL_PATH  ?= $(PATH_ROOT)/src/libs/dita-ot-1.8.5
     44
     45
    4146 # Source location.
    42  VBOX_PATH_MANUAL_SRC    := $(PATH_ROOT)/doc/manual
     47 VBOX_PATH_MANUAL_SRC     := $(PATH_ROOT)/doc/manual
    4348 # Output location.
    4449 VBOX_PATH_MANUAL_OUTBASE := $(PATH_OBJ)/manual
     
    379384                $$(VBOX_PATH_MANUAL_SRC)/$(1)/docbook-refentry-link-replacement-xsl-gen.xsl \
    380385                $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-link-replacement-xsl-gen.xsl \
    381                 $$(addprefix $$(VBOX_PATH_MANUAL_SRC)/en_US/,$$(VBOX_MANUAL_XML_FILES)) \
     386                $$(VBOX_PATH_MANUAL_SRC)/$(1)/dita-refentry-link-replacement-xsl-gen.xsl \
     387                $$(VBOX_PATH_MANUAL_SRC)/dita-refentry-link-replacement-xsl-gen.xsl \
     388                $$(VBOX_PATH_MANUAL_SRC)/ditamap-to-single-xml.xsl \
     389               $$(VBOX_PATH_MANUAL_SRC)/$(1)/dita/UserManual.ditamap \
     390               $$(wildcard $$(VBOX_PATH_MANUAL_SRC)/$(1)/dita/topics/*.xml) \
    382391                $$(VBOX_MANUAL_XML_FILES_COMMON) \
    383392                $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(VBOX_XML_CATALOG_MANUAL) $$(VBOX_XML_ENTITIES) \
     
    393402                '</catalog>'
    394403        $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT,,$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$$(VBOX_XML_XREF_TO_TEXT).cat) \
    395                 --stringparam 'g_sMode' 'first' --output "$$@" "$$<" $$(filter %UserManual.xml,$$^)
     404                --output "[email protected]" "$$(VBOX_PATH_MANUAL_SRC)/ditamap-to-single-xml.xsl" $$(filter %.ditamap,$$^)
     405#       $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT,,$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$$(VBOX_XML_XREF_TO_TEXT).cat) \
     406#               --path "$$(VBOX_PATH_MANUAL_SRC)/$(1)/dita/topics" \
     407#               --path "$(VBOX_DITA_ORIGINAL_PATH)/dtd/bookmap/dtd" \
     408#               --path "$(VBOX_DITA_ORIGINAL_PATH)/dtd/technicalContent/dtd" \
     409#               --output "[email protected]" "$$(VBOX_PATH_MANUAL_SRC)/ditamap-to-single-xml.xsl" "[email protected]"
     410        $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT,,$$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/$$(VBOX_XML_XREF_TO_TEXT).cat) \
     411                --path "$$(VBOX_PATH_MANUAL_SRC)/$(1)/dita/topics" \
     412                --path "$(VBOX_DITA_ORIGINAL_PATH)/dtd/bookmap/dtd" \
     413                --path "$(VBOX_DITA_ORIGINAL_PATH)/dtd/technicalContent/dtd" \
     414                --stringparam 'g_sMode' 'first' \
     415                --output "$$@" \
     416                "$$(VBOX_PATH_MANUAL_SRC)/$(1)/dita-refentry-link-replacement-xsl-gen.xsl" \
     417                "[email protected]"
    396418        # Using en-US version as section and chapter names until user manual is translated as well
    397419        $$(foreach x, $$(VBOX_MANUAL_XML_REFENTRY_FILES)\
  • trunk/doc/manual/Makefile.kmk

    r99008 r99014  
    9191endif
    9292
    93 VBOX_DITA_CONVERTER_PATH = $(PATH_ROOT)/src/libs/dbdita-1.0
    94 VBOX_DITA_ORIGINAL_PATH = $(PATH_ROOT)/src/libs/dita-ot-1.8.5
    95 VBOX_DITA_PATH = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita-ot-1.8.5
     93VBOX_DITA_PATH          = $(VBOX_PATH_MANUAL_OUTBASE)/en_US/dita-ot-1.8.5
    9694
    9795VBOX_QHELP_OUTPUT_FILES = \
  • trunk/doc/manual/dita-refentry-link-replacement-xsl-gen.xsl

    r99010 r99014  
    11<?xml version="1.0"?>
    22<!--
    3     docbook-refentry-link-replacement-xsl-gen.xsl:
     3    dita-refentry-link-replacement-xsl-gen.xsl:
    44        XSLT stylesheet for generate a stylesheet that replaces links
    55        to the user manual in the manpages.
     
    3838
    3939  <!-- Translatable strings -->
    40   <xsl:variable name="sChapter" select="'chapter'"/>
    41   <xsl:variable name="sSection" select="'section'"/>
    42   <xsl:variable name="sOfManual" select="'of the user manual'"/>
    43   <xsl:variable name="sInManual" select="'in the user manual'"/>
     40  <xsl:variable name="sChapter"   select="'chapter'"/>
     41  <xsl:variable name="sSection"   select="'section'"/>
     42  <xsl:variable name="sInChapter" select="'in chapter'"/>
     43  <xsl:variable name="sPreface"   select="'in the preface to the user manual'"/>
     44  <xsl:variable name="sOfManual"  select="'of the user manual'"/>
     45  <xsl:variable name="sInManual"  select="'in the user manual'"/>
    4446
    4547
     
    4951</xsl:template>
    5052
    51 
    52 <!-- Remove all remarks. -->
    53 <xsl:template match="remark"/>
    5453
    5554<!--
     
    8180Produce the transformation templates:
    8281-->
    83 <xsl:template match="chapter[@id]/title">
     82<xsl:template match="chapter/topic[@id]/title">
    8483  <xsl:text>
    8584&lt;xsl:template match="xref[@linkend='</xsl:text>
     
    9493</xsl:template>
    9594
    96 <xsl:template match="sect1[@id]/title">
     95<xsl:template match="*/topicwrap/topic[@id]/title">
     96  <xsl:variable name="iDepth" select="count(ancestor-or-self::topicwrap)" />
     97
    9798  <xsl:text>&lt;xsl:template match="xref[@linkend='</xsl:text>
    9899  <xsl:value-of select="../@id"/><xsl:text>']"&gt;
    99   &lt;xsl:text&gt;</xsl:text><xsl:value-of select="$sSection"/><xsl:text> </xsl:text>
    100   <xsl:value-of select="count(../../preceding-sibling::chapter) + 1"/><xsl:text>.</xsl:text>
    101   <xsl:value-of select="count(../preceding-sibling::sect1) + 1"/>
     100  &lt;xsl:text&gt;</xsl:text><xsl:value-of select="$sSection"/>
    102101  <xsl:text> &quot;</xsl:text>
    103102  <xsl:value-of select="normalize-space()"/><xsl:text>&quot; </xsl:text>
    104   <xsl:value-of select="$sOfManual"/><xsl:text>&lt;/xsl:text&gt;
     103
     104  <!-- Currently DITA only does chapter numbering, which mean the poor buggers
     105       need to do text searches for the (sub*)section titles. So we emit a
     106       'in chapter xx of the user manual' to help out. -->
     107  <xsl:choose>
     108    <xsl:when test="ancestor-or-self::chapter">
     109      <xsl:value-of select="$sInChapter"/><xsl:text> </xsl:text>
     110      <xsl:choose>
     111        <xsl:when test="$iDepth = 1">
     112          <xsl:value-of select="count(../../preceding-sibling::chapter) + 1" />
     113        </xsl:when>
     114        <xsl:when test="$iDepth = 2">
     115          <xsl:value-of select="count(../../../preceding-sibling::chapter) + 1" />
     116        </xsl:when>
     117        <xsl:when test="$iDepth = 3">
     118          <xsl:value-of select="count(../../../../preceding-sibling::chapter) + 1" />
     119        </xsl:when>
     120        <xsl:when test="$iDepth = 4">
     121          <xsl:value-of select="count(../../../../../preceding-sibling::chapter) + 1" />
     122        </xsl:when>
     123        <xsl:when test="$iDepth = 5">
     124          <xsl:value-of select="count(../../../../../../preceding-sibling::chapter) + 1" />
     125        </xsl:when>
     126        <xsl:otherwise>
     127          <xsl:message terminate="yes">Too deep topic nesting! <xsl:call-template name="get-node-path"/></xsl:message>
     128        </xsl:otherwise>
     129      </xsl:choose>
     130      <xsl:text> </xsl:text>
     131      <xsl:value-of select="$sOfManual"/>
     132    </xsl:when>
     133
     134    <xsl:when test="ancestor-or-self::prefacewrap">
     135      <xsl:if test="$iDepth != 1">
     136        <xsl:message terminate="yes">Too deep preface topic nesting! <xsl:call-template name="get-node-path"/></xsl:message>
     137      </xsl:if>
     138      <xsl:value-of select="$sPreface"/><xsl:text> </xsl:text>
     139    </xsl:when>
     140
     141    <xsl:otherwise>
     142      <xsl:message terminate="yes">Unexpected topicwrap parent: <xsl:call-template name="get-node-path"/></xsl:message>
     143    </xsl:otherwise>
     144  </xsl:choose>
     145  <xsl:text>&lt;/xsl:text&gt;
    105146&lt;/xsl:template&gt;
    106147</xsl:text>
    107148  <xsl:apply-templates/>
    108149</xsl:template>
    109 
    110 <xsl:template match="sect2[@id]/title">
    111   <xsl:text>&lt;xsl:template match="xref[@linkend='</xsl:text>
    112   <xsl:value-of select="../@id"/><xsl:text>']"&gt;
    113   &lt;xsl:text&gt;</xsl:text><xsl:value-of select="$sSection"/><xsl:text> </xsl:text>
    114   <xsl:value-of select="count(../../../preceding-sibling::chapter) + 1"/><xsl:text>.</xsl:text>
    115   <xsl:value-of select="count(../../preceding-sibling::sect1) + 1"/><xsl:text>.</xsl:text>
    116   <xsl:value-of select="count(../preceding-sibling::sect2) + 1"/>
    117   <xsl:text> &quot;</xsl:text>
    118   <xsl:value-of select="normalize-space()"/><xsl:text>&quot; </xsl:text>
    119   <xsl:value-of select="$sOfManual"/><xsl:text>&lt;/xsl:text&gt;
    120 &lt;/xsl:template&gt;
    121 </xsl:text>
    122   <xsl:apply-templates/>
    123 </xsl:template>
    124 
    125 <xsl:template match="sect3[@id]/title">
    126   <xsl:text>&lt;xsl:template match="xref[@linkend='</xsl:text>
    127   <xsl:value-of select="../@id"/><xsl:text>']"&gt;
    128   &lt;xsl:text&gt;</xsl:text><xsl:value-of select="$sSection"/><xsl:text> </xsl:text>
    129   <xsl:value-of select="count(../../../../preceding-sibling::chapter) + 1"/><xsl:text>.</xsl:text>
    130   <xsl:value-of select="count(../../../preceding-sibling::sect1) + 1"/><xsl:text>.</xsl:text>
    131   <xsl:value-of select="count(../../preceding-sibling::sect2) + 1"/><xsl:text>.</xsl:text>
    132   <xsl:value-of select="count(../preceding-sibling::sect3) + 1"/>
    133   <xsl:text> &quot;</xsl:text>
    134   <xsl:value-of select="normalize-space()"/><xsl:text>&quot; </xsl:text>
    135   <xsl:value-of select="$sOfManual"/><xsl:text>&lt;/xsl:text&gt;
    136 &lt;/xsl:template&gt;
    137 </xsl:text>
    138   <xsl:apply-templates/>
    139 </xsl:template>
    140 
    141 <xsl:template match="preface[@id]/title">
    142   <xsl:text>&lt;xsl:template match="xref[@linkend='</xsl:text>
    143   <xsl:value-of select="../@id"/><xsl:text>']"&gt;
    144   &lt;xsl:text&gt;&quot;</xsl:text>
    145   <xsl:value-of select="normalize-space()"/><xsl:text>&quot; </xsl:text>
    146   <xsl:value-of select="$sOfManual"/><xsl:text>&lt;/xsl:text&gt;
    147 &lt;/xsl:template&gt;
    148 </xsl:text>
    149   <xsl:apply-templates/>
    150 </xsl:template>
    151 
    152 <xsl:template match="refentry[@id]/refentryinfo/title">
    153   <xsl:text>&lt;xsl:template match="xref[@linkend='</xsl:text>
    154   <xsl:value-of select="../../@id"/><xsl:text>']"&gt;
    155   &lt;xsl:text&gt; &quot;</xsl:text>
    156   <xsl:value-of select="normalize-space()"/><xsl:text>&quot;&lt;/xsl:text&gt;
    157 &lt;/xsl:template&gt;
    158 </xsl:text>
    159   <xsl:apply-templates/>
    160 </xsl:template>
    161 
    162 <xsl:template match="refsect2[@id]/title">
    163   <xsl:text>&lt;xsl:template match="xref[@linkend='</xsl:text>
    164   <xsl:value-of select="../@id"/><xsl:text>']"&gt;
    165   &lt;xsl:text&gt;&quot;</xsl:text>
    166   <xsl:value-of select="normalize-space()"/><xsl:text>&quot;&lt;/xsl:text&gt;
    167 &lt;/xsl:template&gt;
    168 </xsl:text>
    169   <xsl:apply-templates/>
    170 </xsl:template>
    171 
    172150
    173151<!--
  • trunk/doc/manual/en_US/dita-refentry-link-replacement-xsl-gen.xsl

    r99013 r99014  
    11<?xml version="1.0"?>
    22<!--
    3     docbook-refentry-link-replacement-xsl-gen.xsl:
     3    dita-refentry-link-replacement-xsl-gen.xsl:
    44        XSLT stylesheet for generate a stylesheet that replaces links
    55        to the user manual in the manpages.
     
    3333  >
    3434
    35   <xsl:import href="../docbook-refentry-link-replacement-xsl-gen.xsl"/>
     35  <xsl:import href="../dita-refentry-link-replacement-xsl-gen.xsl"/>
    3636
    3737  <!-- Translated strings -->
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