VirtualBox

Changeset 76088 in vbox


Ignore:
Timestamp:
Dec 9, 2018 9:47:33 PM (6 years ago)
Author:
vboxsync
Message:

manual/docbook2latex.xsl: Deal with e.g. <replaceable> inside <screen> properly. For this purpose stop using the fancyvrb 'Verbatim' environment for <screen>, it's totally hopeless to get the commands working inside it (not enough unused ASCII chars), and the 'alltt' environment has been long used in the SDK reference already for <programlisting> (which needed a bit of polishing, getting the double quotes and curly brackets right).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/docbook2latex.xsl

    r76081 r76088  
    115115\usepackage{hyperref}
    116116\usepackage{fancybox}
    117 \usepackage{fancyvrb}
    118117\usepackage{alltt}
    119118\usepackage{color}
     
    505504
    506505  <xsl:template match="screen">
    507     <xsl:text>&#x0a;&#x0a;\begin{Verbatim}[fontsize=\footnotesize]&#x0a;</xsl:text>
    508     <xsl:apply-templates />
    509     <xsl:text>&#x0a;\end{Verbatim}&#x0a;</xsl:text>
     506    <xsl:text>&#x0a;&#x0a;{\footnotesize\begin{alltt}&#x0a;</xsl:text>
     507    <xsl:apply-templates />
     508    <xsl:text>&#x0a;\end{alltt}}&#x0a;</xsl:text>
    510509  </xsl:template>
    511510
     
    893892  <xsl:template match="replaceable">
    894893    <xsl:choose>
    895       <xsl:when test="(not(ancestor::cmdsynopsis) and not(ancestor::option)) or ancestor::arg">
     894      <xsl:when test="(not(ancestor::cmdsynopsis) and not(ancestor::option) and not(ancestor::screen)) or ancestor::arg">
    896895        <xsl:text>\texttt{\textit{</xsl:text>
    897896        <xsl:apply-templates />
     
    922921
    923922    <xsl:choose>
    924       <xsl:when test="(name(..)='screen') or (name(../..)='screen')">
    925         <xsl:value-of select="." />
    926       </xsl:when>
    927 
    928923      <xsl:when test="(name(..) = 'computeroutput') or (name(../..) = 'computeroutput')
    929924                   or (name(..) = 'code')           or (name(../..) = 'code')
     
    10201015      </xsl:when>
    10211016
     1017      <!-- <screen> and <programlisting>, which work with alltt environment. -->
    10221018      <xsl:otherwise>
    10231019        <xsl:variable name="subst2">
    10241020          <xsl:call-template name="str:subst">
    10251021            <xsl:with-param name="text" select="$subst1" />
     1022            <xsl:with-param name="replace" select="'{'" />
     1023            <xsl:with-param name="with" select="'\{'" />
     1024            <xsl:with-param name="disable-output-escaping" select="no" />
     1025          </xsl:call-template>
     1026        </xsl:variable>
     1027        <xsl:variable name="subst3">
     1028          <xsl:call-template name="str:subst">
     1029            <xsl:with-param name="text" select="$subst2" />
     1030            <xsl:with-param name="replace" select="'}'" />
     1031            <xsl:with-param name="with" select="'\}'" />
     1032            <xsl:with-param name="disable-output-escaping" select="no" />
     1033          </xsl:call-template>
     1034        </xsl:variable>
     1035        <xsl:variable name="subst4">
     1036          <xsl:call-template name="str:subst">
     1037            <xsl:with-param name="text" select="$subst3" />
    10261038            <xsl:with-param name="replace" select="'_'" />
    10271039            <xsl:with-param name="with" select="'\_'" />
     
    10291041          </xsl:call-template>
    10301042        </xsl:variable>
    1031         <xsl:variable name="subst3">
    1032           <xsl:call-template name="str:subst">
    1033             <xsl:with-param name="text" select="$subst2" />
     1043        <xsl:variable name="subst5">
     1044          <xsl:call-template name="str:subst">
     1045            <xsl:with-param name="text" select="$subst4" />
    10341046            <xsl:with-param name="replace" select="'$'" />
    10351047            <xsl:with-param name="with" select="'\$'" />
     
    10371049          </xsl:call-template>
    10381050        </xsl:variable>
    1039         <xsl:variable name="subst4">
    1040           <xsl:call-template name="str:subst">
    1041             <xsl:with-param name="text" select="$subst3" />
     1051        <xsl:variable name="subst6">
     1052          <xsl:call-template name="str:subst">
     1053            <xsl:with-param name="text" select="$subst5" />
    10421054            <xsl:with-param name="replace" select="'%'" />
    10431055            <xsl:with-param name="with" select="'\%'" />
     
    10451057          </xsl:call-template>
    10461058        </xsl:variable>
    1047         <xsl:variable name="subst5">
    1048           <xsl:call-template name="str:subst">
    1049             <xsl:with-param name="text" select="$subst4" />
     1059        <xsl:variable name="subst7">
     1060          <xsl:call-template name="str:subst">
     1061            <xsl:with-param name="text" select="$subst6" />
    10501062            <xsl:with-param name="replace" select="'#'" />
    10511063            <xsl:with-param name="with" select="'\#'" />
     
    10531065          </xsl:call-template>
    10541066        </xsl:variable>
    1055         <xsl:variable name="subst6">
    1056           <xsl:call-template name="str:subst">
    1057             <xsl:with-param name="text" select="$subst5" />
     1067        <xsl:variable name="subst8">
     1068          <xsl:call-template name="str:subst">
     1069            <xsl:with-param name="text" select="$subst7" />
    10581070            <xsl:with-param name="replace" select="'µ'" />
    10591071            <xsl:with-param name="with" select="'$\mu$'" />
     
    10611073          </xsl:call-template>
    10621074        </xsl:variable>
    1063         <xsl:variable name="subst7">
    1064           <xsl:call-template name="str:subst">
    1065             <xsl:with-param name="text" select="$subst6" />
     1075        <xsl:variable name="subst9">
     1076          <xsl:call-template name="str:subst">
     1077            <xsl:with-param name="text" select="$subst8" />
    10661078            <xsl:with-param name="replace" select="'®'" />
    10671079            <xsl:with-param name="with" select="'\texorpdfstring{\textregistered}{}'" />
     
    10741086             with pretty quotes by invoking sed a few times. Unfortunately there are
    10751087             no regular expressions in XSLT so there's no other way. -->
    1076         <xsl:variable name="subst8">
    1077           <xsl:call-template name="str:subst">
    1078             <xsl:with-param name="text" select="$subst7" />
    1079             <xsl:with-param name="replace" select="$quote" />
    1080             <xsl:with-param name="with" select="'\QUOTE{}'" />
    1081             <xsl:with-param name="disable-output-escaping" select="no" />
    1082           </xsl:call-template>
    1083         </xsl:variable>
    1084         <xsl:variable name="subst9">
    1085           <xsl:call-template name="str:subst">
    1086             <xsl:with-param name="text" select="$subst8" />
     1088        <xsl:variable name="subst10">
     1089          <xsl:choose>
     1090            <xsl:when test="(name(..)='screen') or (name(../..)='screen')
     1091                         or (name(..)='programlisting') or (name(../..)='programlisting')
     1092                           ">
     1093              <xsl:value-of select="$subst9" />
     1094            </xsl:when>
     1095            <xsl:otherwise>
     1096              <xsl:call-template name="str:subst">
     1097                <xsl:with-param name="text" select="$subst9" />
     1098                <xsl:with-param name="replace" select="$quote" />
     1099                <xsl:with-param name="with" select="'\QUOTE{}'" />
     1100                <xsl:with-param name="disable-output-escaping" select="no" />
     1101              </xsl:call-template>
     1102            </xsl:otherwise>
     1103          </xsl:choose>
     1104        </xsl:variable>
     1105        <xsl:variable name="subst11">
     1106          <xsl:call-template name="str:subst">
     1107            <xsl:with-param name="text" select="$subst10" />
    10871108            <xsl:with-param name="replace" select="'~'" />
    10881109            <xsl:with-param name="with" select="'\textasciitilde '" />
     
    10901111          </xsl:call-template>
    10911112        </xsl:variable>
    1092         <xsl:variable name="subst10">
    1093           <xsl:call-template name="str:subst">
    1094             <xsl:with-param name="text" select="$subst9" />
     1113        <xsl:variable name="subst12">
     1114          <xsl:call-template name="str:subst">
     1115            <xsl:with-param name="text" select="$subst11" />
    10951116            <xsl:with-param name="replace" select="'&amp;'" />
    10961117            <xsl:with-param name="with" select="'\&amp;'" />
     
    10981119          </xsl:call-template>
    10991120        </xsl:variable>
    1100         <xsl:value-of select="$subst10" />
     1121        <xsl:value-of select="$subst12" />
    11011122      </xsl:otherwise>
    11021123    </xsl:choose>
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