VirtualBox

Changeset 99198 in vbox for trunk


Ignore:
Timestamp:
Mar 28, 2023 1:51:21 PM (22 months ago)
Author:
vboxsync
Message:

manual: More work on the refentry to dita converter - attempt at using non-breaking hyphens (dashes), but doesn't work for the currently PDF monospace font selection (win). bugref:10302

File:
1 edited

Legend:

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

    r99191 r99198  
    3838  <xsl:preserve-space elements="*"/>
    3939  <!-- xsl:strip-space elements="*"/ - never -->
     40
     41
     42<!-- - - - - - - - - - - - - - - - - - - - - - -
     43  parameters
     44 - - - - - - - - - - - - - - - - - - - - - - -->
     45<!-- Replace dashes with non-breaking dashes.
     46     Note! If the monospace font used in the PDF doesn't support it,
     47           then '#' shows up instead for instance.  This is currently
     48           the case, so it's disabled by default. -->
     49<xsl:param name="g_fReplaceHypens">false</xsl:param>
    4050
    4151
     
    325335  <xsl:element name="kwd">
    326336    <xsl:attribute name="rev">command/text</xsl:attribute>
    327     <xsl:value-of select="."/>
     337    <xsl:call-template name="emit-text-with-replacements"/>
    328338  </xsl:element>
    329339</xsl:template>
     
    385395      <xsl:element name="kwd">
    386396        <xsl:attribute name="rev">arg=</xsl:attribute>
    387         <xsl:value-of select="substring(., 1, string-length(.) - 1)"/>
     397        <xsl:call-template name="emit-text-with-replacements">
     398          <xsl:with-param name="a_sText" select="substring(., 1, string-length(.) - 1)"/>
     399        </xsl:call-template>
    388400      </xsl:element>
    389401      <xsl:element name="delim">
     
    397409      <xsl:element name="sep">
    398410        <xsl:attribute name="rev">arg-space</xsl:attribute>
    399         <xsl:value-of select="."/>
     411        <xsl:text> </xsl:text>
    400412      </xsl:element>
    401413    </xsl:when>
     
    421433      <xsl:element name="kwd">
    422434        <xsl:attribute name="rev">arg</xsl:attribute>
    423         <xsl:value-of select="normalize-space(.)"/>
     435        <xsl:call-template name="emit-text-with-replacements">
     436          <xsl:with-param name="a_sText" select="normalize-space(.)"/>
     437        </xsl:call-template>
    424438      </xsl:element>
    425439      <xsl:if test="normalize-space(substring(., string-length(.), 1)) = ''
     
    745759  <xsl:value-of select="substring($text,2)"/>
    746760</xsl:template>
     761
     762
     763<!--
     764 Maybe replace hypens (dashes) with non-breaking ones.
     765 -->
     766<xsl:template name="emit-text-with-replacements">
     767  <xsl:param name="a_sText" select="."/>
     768  <xsl:choose>
     769    <xsl:when test="$g_fReplaceHypens = 'true' or $g_fReplaceHypens = 'yes'">
     770      <xsl:message terminate="yes">wtf?</xsl:message>
     771      <xsl:call-template name="str:subst">
     772          <xsl:with-param name="text"    select="$a_sText"/>
     773          <xsl:with-param name="replace">-</xsl:with-param>
     774          <xsl:with-param name="with">‑</xsl:with-param> <!-- U+2011 / &#8209; -->
     775      </xsl:call-template>
     776    </xsl:when>
     777    <xsl:otherwise>
     778      <xsl:value-of select="$a_sText"/>
     779    </xsl:otherwise>
     780  </xsl:choose>
     781</xsl:template>
     782
    747783
    748784<!--
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