1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 20_preserve_linebreaks_in_screen_userinput.dpatch by Beno�t Guillon <benoit.guillon@tele2.fr>
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: Fix for BTS report #528964:
6
## DP: Preserve the verbatim nature of <userinput> elements even as children of
7
## DP: a <screen> element, that is preserve linebreaks.
8
## DP: The patch is likely to be included in the next upstream release.
11
diff -urNad dblatex~/xsl/callout.xsl dblatex/xsl/callout.xsl
12
--- dblatex~/xsl/callout.xsl 2009-06-21 21:53:58.000000000 +0200
13
+++ dblatex/xsl/callout.xsl 2009-06-25 20:05:45.000000000 +0200
15
############################################################################ -->
17
<!-- Callout parameters -->
18
-<xsl:param name="co.tagout" select="':>'"/>
19
+<xsl:param name="co.tagout" select="'</t>'"/>
20
<xsl:param name="co.linkends.show" select="'1'"/>
21
<xsl:param name="callout.markup.circled" select="'1'"/>
22
<xsl:param name="callout.linkends.hot" select="'1'"/>
26
<!-- Generate the enter TeX escape sequence for <co>. The principle is to
27
- find the first sequence of the form "<[try]:" that is not contained in
28
+ find the first sequence of the form "<[try]" that is not contained in
29
the listing, to ensure that no conflict will occur with lstlisting -->
31
<xsl:template name="co-tagin-gen">
33
<xsl:if test="$try > 0">
34
<xsl:value-of select="$try"/>
36
- <xsl:text>:</xsl:text>
40
<xsl:when test="contains($text, $tag)">
41
- <xsl:message>Try another escape sequence for <co></xsl:message>
42
+ <xsl:message>Try another escape sequence in verbatim</xsl:message>
43
<xsl:call-template name="co-tagin-gen">
44
<xsl:with-param name="text" select="$text"/>
45
<xsl:with-param name="try" select="$try+1"/>
48
<xsl:template match="co|area" mode="latex.programlisting">
49
<xsl:param name="rnode" select="/"/>
50
- <xsl:param name="co-tagin" select="'<:'"/>
51
+ <xsl:param name="co-tagin" select="'<'"/>
52
<xsl:param name="co-tagout" select="$co.tagout"/>
53
<xsl:param name="co-hide" select="0"/>
54
<xsl:variable name="conum">
55
<xsl:apply-templates select="." mode="conumber"/>
58
- <xsl:value-of select="$co-tagin"/>
59
+ <xsl:if test="$co-tagin != ''">
60
+ <xsl:value-of select="concat($co-tagin, 't>')"/>
63
<xsl:when test="$co-hide != 0">
66
<!-- Print the markup of the co referenced by coref -->
67
<xsl:template match="coref" mode="latex.programlisting">
68
<xsl:param name="rnode" select="/"/>
69
- <xsl:param name="co-tagin" select="'<:'"/>
70
+ <xsl:param name="co-tagin" select="'<'"/>
71
<xsl:param name="co-tagout" select="$co.tagout"/>
72
<xsl:variable name="co" select="$rnode//*[@id=current()/@linkend]"/>
75
<xsl:apply-templates select="$co" mode="conumber"/>
77
<!-- Entry tex sequence -->
78
- <xsl:value-of select="$co-tagin"/>
79
+ <xsl:value-of select="concat($co-tagin, 't>')"/>
80
<!-- The same number mark than the pointed <co> -->
81
<xsl:text>\conum{</xsl:text>
82
<xsl:value-of select="$conum"/>
83
diff -urNad dblatex~/xsl/index.xsl dblatex/xsl/index.xsl
84
--- dblatex~/xsl/index.xsl 2009-06-21 21:53:58.000000000 +0200
85
+++ dblatex/xsl/index.xsl 2009-06-25 20:05:45.000000000 +0200
88
<!-- in a programlisting -->
89
<xsl:template match="indexterm" mode="latex.programlisting">
90
- <xsl:param name="co-tagin" select="'<:'"/>
91
+ <xsl:param name="co-tagin" select="'<'"/>
92
<xsl:param name="rnode" select="/"/>
93
<xsl:param name="probe" select="0"/>
95
diff -urNad dblatex~/xsl/inlined.xsl dblatex/xsl/inlined.xsl
96
--- dblatex~/xsl/inlined.xsl 2009-06-21 21:53:58.000000000 +0200
97
+++ dblatex/xsl/inlined.xsl 2009-06-25 20:05:45.000000000 +0200
99
<!-- ==================================================================== -->
100
<!-- inline elements in program listings -->
102
+<xsl:template name="verbatim.boldseq">
103
+ <xsl:param name="co-tagin" select="'<'"/>
104
+ <xsl:param name="rnode" select="/"/>
105
+ <xsl:param name="probe" select="0"/>
106
+ <xsl:param name="style" select="'b'"/>
107
+ <xsl:param name="content"/>
109
+ <xsl:call-template name="verbatim.format">
110
+ <xsl:with-param name="co-tagin" select="$co-tagin"/>
111
+ <xsl:with-param name="rnode" select="$rnode"/>
112
+ <xsl:with-param name="probe" select="$probe"/>
113
+ <xsl:with-param name="style" select="'b'"/>
114
+ <xsl:with-param name="content" select="$content"/>
115
+ </xsl:call-template>
118
<xsl:template match="userinput" mode="latex.programlisting">
119
<xsl:param name="co-tagin" select="'<:'"/>
120
<xsl:param name="rnode" select="/"/>
121
<xsl:param name="probe" select="0"/>
123
- <xsl:call-template name="verbatim.embed">
124
- <xsl:with-param name="co-taging" select="$co-tagin"/>
125
+ <xsl:call-template name="verbatim.boldseq">
126
+ <xsl:with-param name="co-tagin" select="$co-tagin"/>
127
<xsl:with-param name="rnode" select="$rnode"/>
128
<xsl:with-param name="probe" select="$probe"/>
129
- <xsl:with-param name="content">
130
- <xsl:call-template name="inline.boldseq"/>
135
@@ -649,11 +662,50 @@
136
<xsl:param name="rnode" select="/"/>
137
<xsl:param name="probe" select="0"/>
139
- <xsl:call-template name="verbatim.embed">
140
- <xsl:with-param name="co-taging" select="$co-tagin"/>
141
+ <xsl:variable name="style">
143
+ <xsl:when test="@role='bold' or @role='strong'">
144
+ <xsl:value-of select="'b'"/>
147
+ <xsl:value-of select="'i'"/>
152
+ <xsl:call-template name="verbatim.format">
153
+ <xsl:with-param name="co-tagin" select="$co-tagin"/>
154
<xsl:with-param name="rnode" select="$rnode"/>
155
<xsl:with-param name="probe" select="$probe"/>
156
+ <xsl:with-param name="style" select="$style"/>
160
+<xsl:template match="replaceable" mode="latex.programlisting">
161
+ <xsl:param name="co-tagin" select="'<:'"/>
162
+ <xsl:param name="rnode" select="/"/>
163
+ <xsl:param name="probe" select="0"/>
165
+ <xsl:call-template name="verbatim.format">
166
+ <xsl:with-param name="co-tagin" select="$co-tagin"/>
167
+ <xsl:with-param name="rnode" select="$rnode"/>
168
+ <xsl:with-param name="probe" select="$probe"/>
169
+ <xsl:with-param name="style" select="'i'"/>
170
+ </xsl:call-template>
173
+<xsl:template match="optional" mode="latex.programlisting">
174
+ <xsl:param name="co-tagin" select="'<:'"/>
175
+ <xsl:param name="rnode" select="/"/>
176
+ <xsl:param name="probe" select="0"/>
178
+ <xsl:value-of select="$arg.choice.opt.open.str"/>
179
+ <xsl:apply-templates mode="latex.programlisting">
180
+ <xsl:with-param name="co-tagin" select="$co-tagin"/>
181
+ <xsl:with-param name="rnode" select="$rnode"/>
182
+ <xsl:with-param name="probe" select="$probe"/>
183
+ </xsl:apply-templates>
184
+ <xsl:value-of select="$arg.choice.opt.close.str"/>
188
diff -urNad dblatex~/xsl/verbatim.xsl dblatex/xsl/verbatim.xsl
189
--- dblatex~/xsl/verbatim.xsl 2009-06-21 21:53:58.000000000 +0200
190
+++ dblatex/xsl/verbatim.xsl 2009-06-25 20:05:45.000000000 +0200
194
<xsl:template name="verbatim.embed">
195
- <xsl:param name="co-tagin" select="'<:'"/>
196
+ <xsl:param name="co-tagin" select="'<'"/>
197
<xsl:param name="rnode" select="/"/>
198
<xsl:param name="probe" select="0"/>
199
<xsl:param name="content"/>
201
- <xsl:value-of select="$co-tagin"/>
202
+ <xsl:value-of select="concat($co-tagin, 't>')"/>
203
<xsl:if test="$probe = 0">
205
<xsl:when test="$content != ''">
206
@@ -100,15 +100,48 @@
210
- <xsl:value-of select="$co.tagout"/>
211
+ <xsl:value-of select="'</t>'"/>
214
+<!-- Template to format (bold, italic) the calling element. The format is
215
+ specified by the <style> that drives the corresponding delimiter
216
+ sequence. Styles can be nested, so apply the same template mode to
220
+ <xsl:template name="verbatim.format">
221
+ <xsl:param name="co-tagin" select="'<'"/>
222
+ <xsl:param name="rnode" select="/"/>
223
+ <xsl:param name="probe" select="0"/>
224
+ <xsl:param name="style" select="'b'"/>
225
+ <xsl:param name="content"/>
227
+ <xsl:value-of select="concat($co-tagin, $style, '>')"/>
228
+ <xsl:if test="$probe = 0">
230
+ <xsl:when test="$content != ''">
231
+ <xsl:value-of select="$content"/>
234
+ <xsl:apply-templates mode="latex.programlisting">
235
+ <xsl:with-param name="co-tagin" select="$co-tagin"/>
236
+ <xsl:with-param name="rnode" select="$rnode"/>
237
+ <xsl:with-param name="probe" select="$probe"/>
238
+ </xsl:apply-templates>
242
+ <xsl:value-of select="concat('</', $style, '>')"/>
245
+<!-- ==================================================================== -->
247
<!-- By default an element in a programlisting environment just prints out its
248
text() adapted to this environment, and apply to its children the same
251
<xsl:template match="*" mode="latex.programlisting">
252
- <xsl:param name="co-tagin" select="'<:'"/>
253
+ <xsl:param name="co-tagin" select="'<'"/>
254
<xsl:param name="rnode" select="/"/>
255
<xsl:param name="probe" select="0"/>
260
<xsl:apply-templates mode="latex.programlisting">
261
- <xsl:with-param name="co-taging" select="$co-tagin"/>
262
+ <xsl:with-param name="co-tagin" select="$co-tagin"/>
263
<xsl:with-param name="rnode" select="$rnode"/>
264
<xsl:with-param name="probe" select="$probe"/>
265
</xsl:apply-templates>
266
@@ -226,13 +259,11 @@
267
<xsl:text>,</xsl:text>
270
- <!-- TeX delimiters if some tex stuff is embedded (like <co>s) -->
271
+ <!-- TeX/verb delimiters if tex or formatting is embedded (like <co>s) -->
272
<xsl:if test="$co-tagin!=''">
273
- <xsl:text>escapeinside={</xsl:text>
274
- <xsl:value-of select="$co-tagin"/>
275
- <xsl:text>}{</xsl:text>
276
- <xsl:value-of select="$co.tagout"/>
277
- <xsl:text>},</xsl:text>
278
+ <xsl:call-template name="listing-delim">
279
+ <xsl:with-param name="tagin" select="$co-tagin"/>
280
+ </xsl:call-template>
288
+<!-- ==================================================================== -->
290
+<!-- Defines the style delimiters to use, and the tex sequence delimiters -->
292
+<xsl:template name="listing-delim">
293
+ <xsl:param name="tagin" select="'<'"/>
294
+ <xsl:variable name="tex" select="concat($tagin, 't>')"/>
295
+ <xsl:variable name="bf" select="concat($tagin, 'b>')"/>
296
+ <xsl:variable name="it" select="concat($tagin, 'i>')"/>
298
+ <xsl:text>escapeinside={</xsl:text>
299
+ <xsl:value-of select="$tex"/>
300
+ <xsl:text>}{</t>}</xsl:text>
301
+ <xsl:text>,</xsl:text>
302
+ <xsl:text>moredelim={**[is][\bfseries]{</xsl:text>
303
+ <xsl:value-of select="$bf"/>
304
+ <xsl:text>}{</b>}},</xsl:text>
305
+ <xsl:text>moredelim={**[is][\itshape]{</xsl:text>
306
+ <xsl:value-of select="$it"/>
307
+ <xsl:text>}{</i>}},</xsl:text>
310
<!-- ==================================================================== -->