Changeset 76235 in vbox
- Timestamp:
- Dec 14, 2018 3:57:25 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/doc/manual/docbook2latex.xsl (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/docbook2latex.xsl
r76088 r76235 911 911 <xsl:template match="//text()"> 912 912 913 <!-- Do the translation of \ into \textbackslash{} in two steps, to avoid 914 running into replacing {} as well which would be very wrong. --> 913 915 <xsl:variable name="subst1"> 914 916 <xsl:call-template name="str:subst"> 915 917 <xsl:with-param name="text" select="." /> 916 918 <xsl:with-param name="replace" select="'\'" /> 919 <xsl:with-param name="with" select="'\textbackslash'" /> 920 <xsl:with-param name="disable-output-escaping" select="no" /> 921 </xsl:call-template> 922 </xsl:variable> 923 <xsl:variable name="subst2"> 924 <xsl:call-template name="str:subst"> 925 <xsl:with-param name="text" select="$subst1" /> 926 <xsl:with-param name="replace" select="'{'" /> 927 <xsl:with-param name="with" select="'\{'" /> 928 <xsl:with-param name="disable-output-escaping" select="no" /> 929 </xsl:call-template> 930 </xsl:variable> 931 <xsl:variable name="subst3"> 932 <xsl:call-template name="str:subst"> 933 <xsl:with-param name="text" select="$subst2" /> 934 <xsl:with-param name="replace" select="'}'" /> 935 <xsl:with-param name="with" select="'\}'" /> 936 <xsl:with-param name="disable-output-escaping" select="no" /> 937 </xsl:call-template> 938 </xsl:variable> 939 <xsl:variable name="subst4"> 940 <xsl:call-template name="str:subst"> 941 <xsl:with-param name="text" select="$subst3" /> 942 <xsl:with-param name="replace" select="'\textbackslash'" /> 917 943 <xsl:with-param name="with" select="'\textbackslash{}'" /> 918 944 <xsl:with-param name="disable-output-escaping" select="no" /> … … 929 955 or (name(..) = 'replaceable') or (name(../..) = 'replaceable') 930 956 "> 931 <xsl:variable name="subst 2">932 <xsl:call-template name="str:subst"> 933 <xsl:with-param name="text" select="translate(normalize-space(concat(' F;',$subst1,'')),'','')" />957 <xsl:variable name="subst5"> 958 <xsl:call-template name="str:subst"> 959 <xsl:with-param name="text" select="translate(normalize-space(concat('',$subst4,'')),'','')" /> 934 960 <xsl:with-param name="replace" select="'--'" /> 935 961 <xsl:with-param name="with" select="'-{}-'" /> … … 937 963 </xsl:call-template> 938 964 </xsl:variable> 939 <xsl:variable name="subst 3">940 <xsl:call-template name="str:subst"> 941 <xsl:with-param name="text" select="$subst 2" />965 <xsl:variable name="subst6"> 966 <xsl:call-template name="str:subst"> 967 <xsl:with-param name="text" select="$subst5" /> 942 968 <xsl:with-param name="replace" select="'_'" /> 943 969 <xsl:with-param name="with" select="'\_'" /> … … 945 971 </xsl:call-template> 946 972 </xsl:variable> 947 <xsl:variable name="subst 4">948 <xsl:call-template name="str:subst"> 949 <xsl:with-param name="text" select="$subst 3" />973 <xsl:variable name="subst7"> 974 <xsl:call-template name="str:subst"> 975 <xsl:with-param name="text" select="$subst6" /> 950 976 <xsl:with-param name="replace" select="'$'" /> 951 977 <xsl:with-param name="with" select="'\$'" /> … … 953 979 </xsl:call-template> 954 980 </xsl:variable> 955 <xsl:variable name="subst 5">956 <xsl:call-template name="str:subst"> 957 <xsl:with-param name="text" select="$subst 4" />981 <xsl:variable name="subst8"> 982 <xsl:call-template name="str:subst"> 983 <xsl:with-param name="text" select="$subst7" /> 958 984 <xsl:with-param name="replace" select="'%'" /> 959 985 <xsl:with-param name="with" select="'\%'" /> … … 961 987 </xsl:call-template> 962 988 </xsl:variable> 963 <xsl:variable name="subst 6">964 <xsl:call-template name="str:subst"> 965 <xsl:with-param name="text" select="$subst 5" />989 <xsl:variable name="subst9"> 990 <xsl:call-template name="str:subst"> 991 <xsl:with-param name="text" select="$subst8" /> 966 992 <xsl:with-param name="replace" select="'#'" /> 967 993 <xsl:with-param name="with" select="'\#'" /> … … 969 995 </xsl:call-template> 970 996 </xsl:variable> 971 <xsl:variable name="subst 7">972 <xsl:call-template name="str:subst"> 973 <xsl:with-param name="text" select="$subst 6" />997 <xsl:variable name="subst10"> 998 <xsl:call-template name="str:subst"> 999 <xsl:with-param name="text" select="$subst9" /> 974 1000 <xsl:with-param name="replace" select="'~'" /> 975 <xsl:with-param name="with" select="'\textasciitilde '" />976 <xsl:with-param name="disable-output-escaping" select="no" /> 977 </xsl:call-template> 978 </xsl:variable> 979 <xsl:variable name="subst 8">980 <xsl:call-template name="str:subst"> 981 <xsl:with-param name="text" select="$subst 7" />1001 <xsl:with-param name="with" select="'\textasciitilde{}'" /> 1002 <xsl:with-param name="disable-output-escaping" select="no" /> 1003 </xsl:call-template> 1004 </xsl:variable> 1005 <xsl:variable name="subst11"> 1006 <xsl:call-template name="str:subst"> 1007 <xsl:with-param name="text" select="$subst10" /> 982 1008 <xsl:with-param name="replace" select="'&'" /> 983 1009 <xsl:with-param name="with" select="'\&'" /> … … 987 1013 <xsl:choose> 988 1014 <xsl:when test="parent::arg or parent::command"> 989 <xsl:variable name="subst 9">1015 <xsl:variable name="subst12"> 990 1016 <xsl:call-template name="str:subst"> 991 <xsl:with-param name="text" select="$subst 8" />1017 <xsl:with-param name="text" select="$subst10" /> 992 1018 <xsl:with-param name="replace" select="' '" /> 993 1019 <xsl:with-param name="with" select="'~'" /> … … 995 1021 </xsl:call-template> 996 1022 </xsl:variable> 997 <xsl:value-of select="$subst 9" />1023 <xsl:value-of select="$subst12" /> 998 1024 </xsl:when> 999 1025 <xsl:otherwise> 1000 <xsl:value-of select="$subst 8" />1026 <xsl:value-of select="$subst11" /> 1001 1027 </xsl:otherwise> 1002 1028 </xsl:choose> … … 1004 1030 1005 1031 <xsl:when test="(name(..)='address') or (name(../..)='address')"> 1006 <xsl:variable name="subst 2">1007 <xsl:call-template name="str:subst"> 1008 <xsl:with-param name="text" select="$subst 1" />1032 <xsl:variable name="subst5"> 1033 <xsl:call-template name="str:subst"> 1034 <xsl:with-param name="text" select="$subst4" /> 1009 1035 <xsl:with-param name="replace" select="'
'" /> 1010 1036 <xsl:with-param name="with" select="' \\'" /> … … 1012 1038 </xsl:call-template> 1013 1039 </xsl:variable> 1014 <xsl:value-of select="$subst 2" />1040 <xsl:value-of select="$subst5" /> 1015 1041 </xsl:when> 1016 1042 1017 1043 <!-- <screen> and <programlisting>, which work with alltt environment. --> 1018 1044 <xsl:otherwise> 1019 <xsl:variable name="subst2"> 1020 <xsl:call-template name="str:subst"> 1021 <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" /> 1045 <xsl:variable name="subst5"> 1046 <xsl:call-template name="str:subst"> 1047 <xsl:with-param name="text" select="$subst4" /> 1038 1048 <xsl:with-param name="replace" select="'_'" /> 1039 1049 <xsl:with-param name="with" select="'\_'" /> … … 1041 1051 </xsl:call-template> 1042 1052 </xsl:variable> 1043 <xsl:variable name="subst 5">1044 <xsl:call-template name="str:subst"> 1045 <xsl:with-param name="text" select="$subst 4" />1053 <xsl:variable name="subst6"> 1054 <xsl:call-template name="str:subst"> 1055 <xsl:with-param name="text" select="$subst5" /> 1046 1056 <xsl:with-param name="replace" select="'$'" /> 1047 1057 <xsl:with-param name="with" select="'\$'" /> … … 1049 1059 </xsl:call-template> 1050 1060 </xsl:variable> 1051 <xsl:variable name="subst 6">1052 <xsl:call-template name="str:subst"> 1053 <xsl:with-param name="text" select="$subst 5" />1061 <xsl:variable name="subst7"> 1062 <xsl:call-template name="str:subst"> 1063 <xsl:with-param name="text" select="$subst6" /> 1054 1064 <xsl:with-param name="replace" select="'%'" /> 1055 1065 <xsl:with-param name="with" select="'\%'" /> … … 1057 1067 </xsl:call-template> 1058 1068 </xsl:variable> 1059 <xsl:variable name="subst 7">1060 <xsl:call-template name="str:subst"> 1061 <xsl:with-param name="text" select="$subst 6" />1069 <xsl:variable name="subst8"> 1070 <xsl:call-template name="str:subst"> 1071 <xsl:with-param name="text" select="$subst7" /> 1062 1072 <xsl:with-param name="replace" select="'#'" /> 1063 1073 <xsl:with-param name="with" select="'\#'" /> … … 1065 1075 </xsl:call-template> 1066 1076 </xsl:variable> 1067 <xsl:variable name="subst 8">1068 <xsl:call-template name="str:subst"> 1069 <xsl:with-param name="text" select="$subst 7" />1077 <xsl:variable name="subst9"> 1078 <xsl:call-template name="str:subst"> 1079 <xsl:with-param name="text" select="$subst8" /> 1070 1080 <xsl:with-param name="replace" select="'µ'" /> 1071 1081 <xsl:with-param name="with" select="'$\mu$'" /> … … 1073 1083 </xsl:call-template> 1074 1084 </xsl:variable> 1075 <xsl:variable name="subst 9">1076 <xsl:call-template name="str:subst"> 1077 <xsl:with-param name="text" select="$subst 8" />1085 <xsl:variable name="subst10"> 1086 <xsl:call-template name="str:subst"> 1087 <xsl:with-param name="text" select="$subst9" /> 1078 1088 <xsl:with-param name="replace" select="'®'" /> 1079 1089 <xsl:with-param name="with" select="'\texorpdfstring{\textregistered}{}'" /> … … 1086 1096 with pretty quotes by invoking sed a few times. Unfortunately there are 1087 1097 no regular expressions in XSLT so there's no other way. --> 1088 <xsl:variable name="subst1 0">1098 <xsl:variable name="subst11"> 1089 1099 <xsl:choose> 1090 1100 <xsl:when test="(name(..)='screen') or (name(../..)='screen') 1091 1101 or (name(..)='programlisting') or (name(../..)='programlisting') 1092 1102 "> 1093 <xsl:value-of select="$subst 9" />1103 <xsl:value-of select="$subst10" /> 1094 1104 </xsl:when> 1095 1105 <xsl:otherwise> 1096 1106 <xsl:call-template name="str:subst"> 1097 <xsl:with-param name="text" select="$subst 9" />1107 <xsl:with-param name="text" select="$subst10" /> 1098 1108 <xsl:with-param name="replace" select="$quote" /> 1099 1109 <xsl:with-param name="with" select="'\QUOTE{}'" /> … … 1103 1113 </xsl:choose> 1104 1114 </xsl:variable> 1105 <xsl:variable name="subst1 1">1106 <xsl:call-template name="str:subst"> 1107 <xsl:with-param name="text" select="$subst1 0" />1115 <xsl:variable name="subst12"> 1116 <xsl:call-template name="str:subst"> 1117 <xsl:with-param name="text" select="$subst11" /> 1108 1118 <xsl:with-param name="replace" select="'~'" /> 1109 <xsl:with-param name="with" select="'\textasciitilde '" />1110 <xsl:with-param name="disable-output-escaping" select="no" /> 1111 </xsl:call-template> 1112 </xsl:variable> 1113 <xsl:variable name="subst1 2">1114 <xsl:call-template name="str:subst"> 1115 <xsl:with-param name="text" select="$subst1 1" />1119 <xsl:with-param name="with" select="'\textasciitilde{}'" /> 1120 <xsl:with-param name="disable-output-escaping" select="no" /> 1121 </xsl:call-template> 1122 </xsl:variable> 1123 <xsl:variable name="subst13"> 1124 <xsl:call-template name="str:subst"> 1125 <xsl:with-param name="text" select="$subst12" /> 1116 1126 <xsl:with-param name="replace" select="'&'" /> 1117 1127 <xsl:with-param name="with" select="'\&'" /> … … 1119 1129 </xsl:call-template> 1120 1130 </xsl:variable> 1121 <xsl:value-of select="$subst1 2" />1131 <xsl:value-of select="$subst13" /> 1122 1132 </xsl:otherwise> 1123 1133 </xsl:choose>
Note:
See TracChangeset
for help on using the changeset viewer.

