Debian Codegraph @

xslt/common/icons.xsl

raw
1 <?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
2 <!--
3 This program is free software; you can redistribute it and/or modify it under
4 the terms of the GNU Lesser General Public License as published by the Free
5 Software Foundation; either version 2 of the License, or (at your option) any
6 later version.
7
8 This program is distributed in the hope that it will be useful, but WITHOUT
9 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 details.
12
13 You should have received a copy of the GNU Lesser General Public License
14 along with this program; see the file COPYING.LGPL. If not, see <http://www.gnu.org/licenses/>.
15 -->
16
17 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18 xmlns:svg="http://www.w3.org/2000/svg"
19 version="1.0">
20
21 <!--!!==========================================================================
22 Icons
23 Specify common named icons to style output.
24 @revision[version=3.28 date=2017-05-24 status=final]
25
26 This stylesheet provides a common interface to specify icons for transformations
27 to presentation-oreinted formats. This allows similar output for different
28 types of input documents.
29
30 Many of the icons are output as SVG elements that can be embedded directly
31 into an HTML document. These icons use class names like `yelp-svg-fill` and
32 `yelp-svg-stroke`, allowing you to style them with colors from the {colors}
33 module.
34
35 Some SVG icons are read from separate source SVG files. When this is done, the
36 {icons.svg.mode} mode is applied to reduce the SVG to the minimal form needed
37 for proper presentation.
38 -->
39
40
41 <!--%%==========================================================================
42 icons.svg.mode
43 Reduce SVG icons to elements needed for presentation.
44 @revision[version=3.28 date=2017-05-24 status=final]
45
46 This mode matches SVG elements and outputs only the SVG needed for presentation.
47 It strips out metadata and other elements and attributes used primarily by
48 authoring tools. It also uses the {html.svg.namespace} parameter to output SVG
49 with or without namespace information, compatible with the dual HTML/XHTML
50 output of these stylesheets.
51 -->
52 <xsl:template mode="icons.svg.mode" match="svg:title"/>
53 <xsl:template mode="icons.svg.mode" match="svg:metadata"/>
54 <xsl:template mode="icons.svg.mode" match="svg:*">
55 <xsl:element name="{local-name(.)}" namespace="{$html.svg.namespace}">
56 <xsl:for-each select="@*">
57 <xsl:choose>
58 <xsl:when test="local-name(.) = 'id'"/>
59 <xsl:when test="namespace-uri(.) = 'http://www.inkscape.org/namespaces/inkscape'"/>
60 <xsl:when test="namespace-uri(.) = 'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'"/>
61 <xsl:otherwise>
62 <xsl:copy-of select="."/>
63 </xsl:otherwise>
64 </xsl:choose>
65 </xsl:for-each>
66 <xsl:apply-templates mode="icons.svg.mode" select="node()"/>
67 </xsl:element>
68 </xsl:template>
69 <xsl:template mode="icons.svg.mode" match="text()">
70 <xsl:copy-of select="."/>
71 </xsl:template>
72 <xsl:template mode="icons.svg.mode" match="*"/>
73
74
75 <!--**==========================================================================
76 icons.svg.note
77 Output an `svg` element for a note icon.
78 @revision[version=3.28 date=2017-05-24 status=final]
79
80 [xsl:params]
81 $style: The style of the note.
82
83 This template outputs an SVG `svg` element with an icon suitable for notes
84 and other types of admonitions. It takes a $style parameter specifying a
85 note style. The default style is `"note"`. This template uses the $style
86 parameter to determine which specific template to call to output the SVG
87 content.
88
89 SVG icons can use CSS class names to pick up colors from the {colors} module.
90 -->
91 <xsl:template name="icons.svg.note">
92 <xsl:param name="style"/>
93 <xsl:choose>
94 <xsl:when test="$style = 'advanced'">
95 <xsl:call-template name="icons.svg.note.advanced"/>
96 </xsl:when>
97 <xsl:when test="$style = 'bug'">
98 <xsl:call-template name="icons.svg.note.bug"/>
99 </xsl:when>
100 <xsl:when test="$style = 'caution'">
101 <xsl:call-template name="icons.svg.note.caution"/>
102 </xsl:when>
103 <xsl:when test="$style = 'danger'">
104 <xsl:call-template name="icons.svg.note.danger"/>
105 </xsl:when>
106 <xsl:when test="$style = 'important'">
107 <xsl:call-template name="icons.svg.note.important"/>
108 </xsl:when>
109 <xsl:when test="$style = 'package'">
110 <xsl:call-template name="icons.svg.note.package"/>
111 </xsl:when>
112 <xsl:when test="$style = 'tip'">
113 <xsl:call-template name="icons.svg.note.tip"/>
114 </xsl:when>
115 <xsl:when test="$style = 'warning'">
116 <xsl:call-template name="icons.svg.note.warning"/>
117 </xsl:when>
118 <xsl:otherwise test="$style = 'note'">
119 <xsl:call-template name="icons.svg.note.note"/>
120 </xsl:otherwise>
121 </xsl:choose>
122 </xsl:template>
123
124
125 <!--**==========================================================================
126 icons.svg.note.advanced
127 Output an `svg` element for an advanced note icon.
128 @revision[version=3.28 date=2017-05-24 status=final]
129
130 This template outputs an SVG `svg` element with an icon suitable for notes
131 with advanced information.
132
133 SVG icons can use CSS class names to pick up colors from the {colors} module.
134 By default, this icon uses the `yelp-svg-fill` class name.
135 -->
136 <xsl:template name="icons.svg.note.advanced">
137 <xsl:apply-templates mode="icons.svg.mode"
138 select="document('icons/yelp-note-advanced.svg')"/>
139 </xsl:template>
140
141
142 <!--**==========================================================================
143 icons.svg.note.bug
144 Output an `svg` element for a bug note icon.
145 @revision[version=3.28 date=2017-05-24 status=final]
146
147 This template outputs an SVG `svg` element with an icon suitable for notes
148 about known bugs.
149
150 SVG icons can use CSS class names to pick up colors from the {colors} module.
151 By default, this icon uses the `yelp-svg-fill` class name.
152 -->
153 <xsl:template name="icons.svg.note.bug">
154 <xsl:apply-templates mode="icons.svg.mode"
155 select="document('icons/yelp-note-bug.svg')"/>
156 </xsl:template>
157
158
159 <!--**==========================================================================
160 icons.svg.note.caution
161 Output an `svg` element for a caution note icon.
162 @revision[version=3.28 date=2017-05-24 status=final]
163
164 This template outputs an SVG `svg` element with an icon suitable for notes
165 with cautionary information.
166
167 SVG icons can use CSS class names to pick up colors from the {colors} module.
168 By default, this icon uses the `yelp-svg-fill` class name.
169 -->
170 <xsl:template name="icons.svg.note.caution">
171 <xsl:apply-templates mode="icons.svg.mode"
172 select="document('icons/yelp-note-warning.svg')"/>
173 </xsl:template>
174
175
176 <!--**==========================================================================
177 icons.svg.note.danger
178 Output an `svg` element for a danger note icon.
179 @revision[version=3.28 date=2017-05-24 status=final]
180
181 This template outputs an SVG `svg` element with an icon suitable for notes
182 about dangerous situations.
183
184 SVG icons can use CSS class names to pick up colors from the {colors} module.
185 By default, this icon uses the `yelp-svg-fill` class name.
186 -->
187 <xsl:template name="icons.svg.note.danger">
188 <xsl:apply-templates mode="icons.svg.mode"
189 select="document('icons/yelp-note-warning.svg')"/>
190 </xsl:template>
191
192
193 <!--**==========================================================================
194 icons.svg.note.important
195 Output an `svg` element for an important note icon.
196 @revision[version=3.28 date=2017-05-24 status=final]
197
198 This template outputs an SVG `svg` element with an icon suitable for notes
199 with important information.
200
201 SVG icons can use CSS class names to pick up colors from the {colors} module.
202 By default, this icon uses the `yelp-svg-fill` class name.
203 -->
204 <xsl:template name="icons.svg.note.important">
205 <xsl:apply-templates mode="icons.svg.mode"
206 select="document('icons/yelp-note-important.svg')"/>
207 </xsl:template>
208
209
210 <!--**==========================================================================
211 icons.svg.note.note
212 Output an `svg` element for a note icon.
213 @revision[version=3.28 date=2017-05-24 status=final]
214
215 This template outputs an SVG `svg` element with an icon suitable for notes
216 with general information.
217
218 SVG icons can use CSS class names to pick up colors from the {colors} module.
219 By default, this icon uses the `yelp-svg-fill` class name.
220 -->
221 <xsl:template name="icons.svg.note.note">
222 <xsl:apply-templates mode="icons.svg.mode"
223 select="document('icons/yelp-note-note.svg')"/>
224 </xsl:template>
225
226
227 <!--**==========================================================================
228 icons.svg.note.package
229 Output an `svg` element for a package note icon.
230 @revision[version=3.28 date=2017-05-24 status=final]
231
232 This template outputs an SVG `svg` element with an icon suitable for notes
233 about packages the user may need to install.
234
235 SVG icons can use CSS class names to pick up colors from the {colors} module.
236 By default, this icon uses the `yelp-svg-fill` class name.
237 -->
238 <xsl:template name="icons.svg.note.package">
239 <xsl:apply-templates mode="icons.svg.mode"
240 select="document('icons/yelp-note-package.svg')"/>
241 </xsl:template>
242
243
244 <!--**==========================================================================
245 icons.svg.note.tip
246 Output an `svg` element for a tip note icon.
247 @revision[version=3.28 date=2017-05-24 status=final]
248
249 This template outputs an SVG `svg` element with an icon suitable for notes
250 with tips.
251
252 SVG icons can use CSS class names to pick up colors from the {colors} module.
253 By default, this icon uses the `yelp-svg-fill` class name.
254 -->
255 <xsl:template name="icons.svg.note.tip">
256 <xsl:apply-templates mode="icons.svg.mode"
257 select="document('icons/yelp-note-tip.svg')"/>
258 </xsl:template>
259
260
261 <!--**==========================================================================
262 icons.svg.note.warning
263 Output an `svg` element for a warning note icon.
264 @revision[version=3.28 date=2017-05-24 status=final]
265
266 This template outputs an SVG `svg` element with an icon suitable for notes
267 with warnings.
268
269 SVG icons can use CSS class names to pick up colors from the {colors} module.
270 By default, this icon uses the `yelp-svg-fill` class name.
271 -->
272 <xsl:template name="icons.svg.note.warning">
273 <xsl:apply-templates mode="icons.svg.mode"
274 select="document('icons/yelp-note-warning.svg')"/>
275 </xsl:template>
276
277
278 <!--@@==========================================================================
279 icons.size.quote
280 The size of the quote icons.
281 @revision[version=3.8 date=2012-09-29 status=final]
282
283 This parameter specifies the size of the block quote icon. Use an integer giving
284 the width of the image files in pixels. Icons are assumed to be square, and all
285 quote icons are assumed to have the same size.
286
287 As of version 3.8, there is no longer an actual image file for the quote icon.
288 Instead, a language-appropriate quotation character is placed in the margin.
289 This parameters still affects the size of that character.
290 -->
291 <xsl:param name="icons.size.quote" select="48"/>
292
293
294
295
296 <!--**==========================================================================
297 icons.svg.figure.zoom.in
298 Output an `svg` element for a figure zoom-in icon.
299 @revision[version=3.28 date=2017-05-24 status=final]
300
301 This template outputs an SVG `svg` element with the zoom-in icon for figures.
302 Figures automatically scale images down. This icon shows them at their original
303 size.
304
305 SVG icons can use CSS class names to pick up colors from the {colors} module.
306 By default, this icon uses the `yelp-svg-stroke` and `yelp-svg-fill` class
307 names.
308 -->
309 <xsl:template name="icons.svg.figure.zoom.in">
310 <svg:svg width="10" height="10" class="figure-zoom-in">
311 <svg:rect x="0.5" y="0.5" width="9" height="9"
312 class="yelp-svg-stroke" stroke-width="1" fill="none"/>
313 <svg:rect x="0" y="5" width="5" height="5"
314 class="yelp-svg-fill"/>
315 </svg:svg>
316 </xsl:template>
317
318
319 <!--**==========================================================================
320 icons.svg.figure.zoom.out
321 Output an `svg` element for a figure zoom-out icon.
322 @revision[version=3.28 date=2017-05-24 status=final]
323
324 This template outputs an SVG `svg` element with the zoom-in icon for figures.
325 Figures automatically scale images down. This icon scales them back down after
326 they have been zoomed.
327
328 SVG icons can use CSS class names to pick up colors from the {colors} module.
329 By default, this icon uses the `yelp-svg-stroke` and `yelp-svg-fill` class
330 names.
331 -->
332 <xsl:template name="icons.svg.figure.zoom.out">
333 <svg:svg width="10" height="10" class="figure-zoom-out">
334 <svg:rect x="0.5" y="0.5" width="9" height="9"
335 class="yelp-svg-stroke" stroke-width="1" fill="none"/>
336 <svg:polygon points="0,0 10,0 10,10 5,10 5,5 10,5 0,5"
337 class="yelp-svg-fill"/>
338 </svg:svg>
339 </xsl:template>
340
341
342 <!--**==========================================================================
343 icons.svg.media.play
344 Output an `svg` element for a figure zoom-out icon.
345 @revision[version=3.28 date=2017-05-24 status=final]
346
347 This template outputs an SVG `svg` element with a play icon for media controls.
348
349 SVG icons can use CSS class names to pick up colors from the {colors} module.
350 By default, this icon uses the `yelp-svg-fill` class name.
351 -->
352 <xsl:template name="icons.svg.media.play">
353 <svg:svg width="20" height="20" class="media-play">
354 <svg:polygon points="5,4 5,16 15,10" class="yelp-svg-fill"/>
355 </svg:svg>
356 </xsl:template>
357
358
359 <!--**==========================================================================
360 icons.svg.media.pause
361 Output an `svg` element for a figure zoom-out icon.
362 @revision[version=3.28 date=2017-05-24 status=final]
363
364 This template outputs an SVG `svg` element with a pause icon for media controls.
365
366 SVG icons can use CSS class names to pick up colors from the {colors} module.
367 By default, this icon uses the `yelp-svg-fill` class name.
368 -->
369 <xsl:template name="icons.svg.media.pause">
370 <svg:svg width="20" height="20" class="media-pause">
371 <svg:rect x="4" y="4" width="4" height="12" class="yelp-svg-fill"/>
372 <svg:rect x="12" y="4" width="4" height="12" class="yelp-svg-fill"/>
373 </svg:svg>
374 </xsl:template>
375
376 </xsl:stylesheet>