| 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 |
<!DOCTYPE xsl:stylesheet [ |
| 17 |
<!ENTITY % selectors SYSTEM "../common/dita-selectors.mod"> |
| 18 |
%selectors; |
| 19 |
]> |
| 20 |
|
| 21 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 22 |
xmlns:yelp="http://projects.gnome.org/yelp/" |
| 23 |
xmlns="http://www.w3.org/1999/xhtml" |
| 24 |
exclude-result-prefixes="yelp" |
| 25 |
version="1.0"> |
| 26 |
|
| 27 |
<!--!!========================================================================== |
| 28 |
DITA to HTML - Blocks |
| 29 |
|
| 30 |
REMARK: Describe this module |
| 31 |
--> |
| 32 |
|
| 33 |
|
| 34 |
<!--**========================================================================== |
| 35 |
dita2html.div |
| 36 |
Output an HTML `div` element. |
| 37 |
@revision[version=3.8 date=2012-10-04 status=incomplete] |
| 38 |
|
| 39 |
[xsl:params] |
| 40 |
$node: The source element to output a `div` for. |
| 41 |
$class: The value of the HTML `class` attribute. |
| 42 |
|
| 43 |
FIXME |
| 44 |
--> |
| 45 |
<xsl:template name="dita2html.div"> |
| 46 |
<xsl:param name="node" select="."/> |
| 47 |
<xsl:param name="class" select="''"/> |
| 48 |
<xsl:variable name="conref" select="yelp:dita.ref.conref($node)"/> |
| 49 |
<div> |
| 50 |
<xsl:call-template name="dita.id"> |
| 51 |
<xsl:with-param name="node" select="$node"/> |
| 52 |
</xsl:call-template> |
| 53 |
<xsl:call-template name="html.lang.attrs"> |
| 54 |
<xsl:with-param name="node" select="$node"/> |
| 55 |
</xsl:call-template> |
| 56 |
<xsl:call-template name="html.class.attr"> |
| 57 |
<xsl:with-param name="node" select="$node"/> |
| 58 |
<xsl:with-param name="class" select="$class"/> |
| 59 |
</xsl:call-template> |
| 60 |
<div class="contents"> |
| 61 |
<xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/> |
| 62 |
</div> |
| 63 |
</div> |
| 64 |
</xsl:template> |
| 65 |
|
| 66 |
|
| 67 |
<!--**========================================================================== |
| 68 |
dita2html.p |
| 69 |
Output an HTML `p` element. |
| 70 |
@revision[version=3.8 date=2012-10-04 status=incomplete] |
| 71 |
|
| 72 |
[xsl:params] |
| 73 |
$node: The source element to output a `p` for. |
| 74 |
$class: The value of the HTML `class` attribute. |
| 75 |
|
| 76 |
FIXME |
| 77 |
--> |
| 78 |
<xsl:template name="dita2html.p"> |
| 79 |
<xsl:param name="node" select="."/> |
| 80 |
<xsl:param name="class" select="''"/> |
| 81 |
<xsl:variable name="conref" select="yelp:dita.ref.conref($node)"/> |
| 82 |
<p> |
| 83 |
<xsl:call-template name="dita.id"> |
| 84 |
<xsl:with-param name="node" select="$node"/> |
| 85 |
</xsl:call-template> |
| 86 |
<xsl:call-template name="html.lang.attrs"> |
| 87 |
<xsl:with-param name="node" select="$node"/> |
| 88 |
</xsl:call-template> |
| 89 |
<xsl:call-template name="html.class.attr"> |
| 90 |
<xsl:with-param name="node" select="$node"/> |
| 91 |
<xsl:with-param name="class" select="$class"/> |
| 92 |
</xsl:call-template> |
| 93 |
<xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/> |
| 94 |
</p> |
| 95 |
</xsl:template> |
| 96 |
|
| 97 |
<!--**========================================================================== |
| 98 |
dita2html.pre |
| 99 |
Output an HTML `pre` element. |
| 100 |
@revision[version=3.8 date=2012-10-05 status=incomplete] |
| 101 |
|
| 102 |
[xsl:params] |
| 103 |
$node: The source element to output a `pre` for. |
| 104 |
$class: The value of the HTML `class` attribute. |
| 105 |
|
| 106 |
FIXME |
| 107 |
--> |
| 108 |
<xsl:template name="dita2html.pre"> |
| 109 |
<xsl:param name="node" select="."/> |
| 110 |
<xsl:param name="class" select="''"/> |
| 111 |
<xsl:variable name="conref" select="yelp:dita.ref.conref($node)"/> |
| 112 |
<xsl:variable name="children" select="$conref/node()"/> |
| 113 |
<div> |
| 114 |
<xsl:call-template name="dita.id"> |
| 115 |
<xsl:with-param name="node" select="$node"/> |
| 116 |
</xsl:call-template> |
| 117 |
<xsl:call-template name="html.lang.attrs"> |
| 118 |
<xsl:with-param name="node" select="$node"/> |
| 119 |
</xsl:call-template> |
| 120 |
<xsl:call-template name="html.class.attr"> |
| 121 |
<xsl:with-param name="node" select="$node"/> |
| 122 |
<xsl:with-param name="class" select="$class"/> |
| 123 |
</xsl:call-template> |
| 124 |
<pre class="contents"><code> |
| 125 |
<xsl:if test="$html.syntax.highlight"> |
| 126 |
<xsl:attribute name="class"> |
| 127 |
<xsl:call-template name="html.syntax.class"> |
| 128 |
<xsl:with-param name="node" select="$node"/> |
| 129 |
</xsl:call-template> |
| 130 |
</xsl:attribute> |
| 131 |
</xsl:if> |
| 132 |
<!-- Strip off a leading newline --> |
| 133 |
<xsl:if test="$children[1]/self::text()"> |
| 134 |
<xsl:choose> |
| 135 |
<xsl:when test="starts-with($node/text()[1], '
')"> |
| 136 |
<xsl:value-of select="substring-after($node/text()[1], '
')"/> |
| 137 |
</xsl:when> |
| 138 |
<xsl:otherwise> |
| 139 |
<xsl:value-of select="$node/text()[1]"/> |
| 140 |
</xsl:otherwise> |
| 141 |
</xsl:choose> |
| 142 |
</xsl:if> |
| 143 |
<xsl:apply-templates mode="dita2html.topic.mode" |
| 144 |
select="$children[not(position() = 1 and self::text())]"/> |
| 145 |
</code></pre> |
| 146 |
</div> |
| 147 |
</xsl:template> |
| 148 |
|
| 149 |
|
| 150 |
<!-- == Matched Templates == --> |
| 151 |
|
| 152 |
<!-- = bodydiv = --> |
| 153 |
<xsl:template mode="dita2html.topic.mode" match="&topic_bodydiv_all;"> |
| 154 |
<xsl:call-template name="dita2html.div"> |
| 155 |
<xsl:with-param name="class" select="'bodydiv'"/> |
| 156 |
</xsl:call-template> |
| 157 |
</xsl:template> |
| 158 |
|
| 159 |
<!-- = cmd = --> |
| 160 |
<xsl:template mode="dita2html.topic.mode" match="&topic_cmd;"> |
| 161 |
<xsl:call-template name="dita2html.p"/> |
| 162 |
</xsl:template> |
| 163 |
|
| 164 |
<!-- = codeblock = --> |
| 165 |
<xsl:template mode="dita2html.topic.mode" match="&topic_codeblock;"> |
| 166 |
<xsl:call-template name="dita2html.pre"> |
| 167 |
<xsl:with-param name="class" select="'code'"/> |
| 168 |
</xsl:call-template> |
| 169 |
</xsl:template> |
| 170 |
|
| 171 |
<xsl:template mode="html.syntax.class.mode" match="&topic_codeblock; | &topic_screen;"> |
| 172 |
<xsl:param name="language" select="translate(@outputclass, |
| 173 |
'ABCDEFGHIJKLMNOPQRSTUVWXYX', |
| 174 |
'abcdefghijklmnopqrstuvwxyz')"/> |
| 175 |
<xsl:choose> |
| 176 |
<!-- ActionScript --> |
| 177 |
<xsl:when test="$language = 'actionscript'"> |
| 178 |
<xsl:text>actionscript</xsl:text> |
| 179 |
</xsl:when> |
| 180 |
<!-- Apache --> |
| 181 |
<xsl:when test="$language = 'apache'"> |
| 182 |
<xsl:text>apache</xsl:text> |
| 183 |
</xsl:when> |
| 184 |
<!-- AsciiDoc --> |
| 185 |
<xsl:when test="$language = 'asciidoc' or $language = 'adoc'"> |
| 186 |
<xsl:text>asciidoc</xsl:text> |
| 187 |
</xsl:when> |
| 188 |
<!-- Awk --> |
| 189 |
<xsl:when test="$language = 'awk'"> |
| 190 |
<xsl:text>awk</xsl:text> |
| 191 |
</xsl:when> |
| 192 |
<!-- Bash --> |
| 193 |
<xsl:when test="$language = 'sh' or $language = 'bash' or |
| 194 |
$language = 'csh' or $language = 'bourne'"> |
| 195 |
<xsl:text>bash</xsl:text> |
| 196 |
</xsl:when> |
| 197 |
<!-- C --> |
| 198 |
<xsl:when test="$language = 'c'"> |
| 199 |
<xsl:text>c</xsl:text> |
| 200 |
</xsl:when> |
| 201 |
<!-- C# --> |
| 202 |
<xsl:when test="$language = 'cs' or $language = 'csharp'"> |
| 203 |
<xsl:text>csharp</xsl:text> |
| 204 |
</xsl:when> |
| 205 |
<!-- C++ --> |
| 206 |
<xsl:when test="$language = 'cpp' or $language = 'c++'"> |
| 207 |
<xsl:text>cpp</xsl:text> |
| 208 |
</xsl:when> |
| 209 |
<!-- Clojure --> |
| 210 |
<xsl:when test="$language = 'clojure' or $language = 'clj'"> |
| 211 |
<xsl:text>clojure</xsl:text> |
| 212 |
</xsl:when> |
| 213 |
<!-- CMake --> |
| 214 |
<xsl:when test="$language = 'cmake'"> |
| 215 |
<xsl:text>cmake</xsl:text> |
| 216 |
</xsl:when> |
| 217 |
<!-- CSS --> |
| 218 |
<xsl:when test="$language = 'css' or $language = 'css21'"> |
| 219 |
<xsl:text>css</xsl:text> |
| 220 |
</xsl:when> |
| 221 |
<!-- D --> |
| 222 |
<xsl:when test="$language = 'd'"> |
| 223 |
<xsl:text>d</xsl:text> |
| 224 |
</xsl:when> |
| 225 |
<!-- Diff --> |
| 226 |
<xsl:when test="$language = 'diff' or $language = 'patch'"> |
| 227 |
<xsl:text>diff</xsl:text> |
| 228 |
</xsl:when> |
| 229 |
<!-- Django --> |
| 230 |
<xsl:when test="$language = 'django'"> |
| 231 |
<xsl:text>django</xsl:text> |
| 232 |
</xsl:when> |
| 233 |
<!-- Dockerfile --> |
| 234 |
<xsl:when test="$language = 'dockerfile'"> |
| 235 |
<xsl:text>dockerfile</xsl:text> |
| 236 |
</xsl:when> |
| 237 |
<!-- DOS --> |
| 238 |
<xsl:when test="$language = 'dos'"> |
| 239 |
<xsl:text>dos</xsl:text> |
| 240 |
</xsl:when> |
| 241 |
<!-- Ducktype --> |
| 242 |
<xsl:when test="$language = 'ducktype'"> |
| 243 |
<xsl:text>ducktype</xsl:text> |
| 244 |
</xsl:when> |
| 245 |
<!-- Embedded Ruby --> |
| 246 |
<xsl:when test="$language = 'erb'"> |
| 247 |
<xsl:text>erb</xsl:text> |
| 248 |
</xsl:when> |
| 249 |
<!-- F# --> |
| 250 |
<xsl:when test="$language = 'fsharp'"> |
| 251 |
<xsl:text>fsharp</xsl:text> |
| 252 |
</xsl:when> |
| 253 |
<!-- Go --> |
| 254 |
<xsl:when test="$language = 'go'"> |
| 255 |
<xsl:text>go</xsl:text> |
| 256 |
</xsl:when> |
| 257 |
<!-- Haml --> |
| 258 |
<xsl:when test="$language = 'haml'"> |
| 259 |
<xsl:text>haml</xsl:text> |
| 260 |
</xsl:when> |
| 261 |
<!-- Haskell --> |
| 262 |
<xsl:when test="$language = 'haskell' or $language = 'hs'"> |
| 263 |
<xsl:text>hs</xsl:text> |
| 264 |
</xsl:when> |
| 265 |
<!-- HTML --> |
| 266 |
<xsl:when test="$language = 'html' or $language = 'xhtml'"> |
| 267 |
<xsl:text>html</xsl:text> |
| 268 |
</xsl:when> |
| 269 |
<!-- HTTP --> |
| 270 |
<xsl:when test="$language = 'http'"> |
| 271 |
<xsl:text>http</xsl:text> |
| 272 |
</xsl:when> |
| 273 |
<!-- INI --> |
| 274 |
<xsl:when test="$language = 'ini'"> |
| 275 |
<xsl:text>ini</xsl:text> |
| 276 |
</xsl:when> |
| 277 |
<!-- Java --> |
| 278 |
<xsl:when test="$language = 'java'"> |
| 279 |
<xsl:text>java</xsl:text> |
| 280 |
</xsl:when> |
| 281 |
<!-- Javascript --> |
| 282 |
<xsl:when test="$language = 'js' or $language = 'javascript'"> |
| 283 |
<xsl:text>javascript</xsl:text> |
| 284 |
</xsl:when> |
| 285 |
<!-- JSON --> |
| 286 |
<xsl:when test="$language = 'json'"> |
| 287 |
<xsl:text>json</xsl:text> |
| 288 |
</xsl:when> |
| 289 |
<!-- LISP --> |
| 290 |
<xsl:when test="$language = 'lisp' or $language = 'el' or |
| 291 |
$language = 'cl' or $language = 'lsp'"> |
| 292 |
<xsl:text>lisp</xsl:text> |
| 293 |
</xsl:when> |
| 294 |
<!-- Lua --> |
| 295 |
<xsl:when test="$language = 'lua'"> |
| 296 |
<xsl:text>lua</xsl:text> |
| 297 |
</xsl:when> |
| 298 |
<!-- Makefile --> |
| 299 |
<xsl:when test="$language = 'makefile' or $language = 'make'"> |
| 300 |
<xsl:text>makefile</xsl:text> |
| 301 |
</xsl:when> |
| 302 |
<!-- Markdown --> |
| 303 |
<xsl:when test="$language = 'markdown' or $language = 'md'"> |
| 304 |
<xsl:text>markdown</xsl:text> |
| 305 |
</xsl:when> |
| 306 |
<!-- MATLAB/Octave --> |
| 307 |
<xsl:when test="$language = 'matlab' or $language = 'octave'"> |
| 308 |
<xsl:text>matlab</xsl:text> |
| 309 |
</xsl:when> |
| 310 |
<!-- Nginx --> |
| 311 |
<xsl:when test="$language = 'nginx'"> |
| 312 |
<xsl:text>nginx</xsl:text> |
| 313 |
</xsl:when> |
| 314 |
<!-- Objective C --> |
| 315 |
<xsl:when test="$language = 'objc' or $language = 'm'"> |
| 316 |
<xsl:text>objectivec</xsl:text> |
| 317 |
</xsl:when> |
| 318 |
<!-- Perl --> |
| 319 |
<xsl:when test="$language = 'perl' or |
| 320 |
$language = 'pl' or $language = 'pm'"> |
| 321 |
<xsl:text>perl</xsl:text> |
| 322 |
</xsl:when> |
| 323 |
<!-- PHP --> |
| 324 |
<xsl:when test="$language = 'php'"> |
| 325 |
<xsl:text>php</xsl:text> |
| 326 |
</xsl:when> |
| 327 |
<!-- Python --> |
| 328 |
<xsl:when test="$language = 'py' or $language = 'python'"> |
| 329 |
<xsl:text>python</xsl:text> |
| 330 |
</xsl:when> |
| 331 |
<!-- R/S --> |
| 332 |
<xsl:when test="$language = 'r' or $language = 's'"> |
| 333 |
<xsl:text>r</xsl:text> |
| 334 |
</xsl:when> |
| 335 |
<!-- Ruby --> |
| 336 |
<xsl:when test="$language = 'ruby' or $language = 'rb'"> |
| 337 |
<xsl:text>ruby</xsl:text> |
| 338 |
</xsl:when> |
| 339 |
<!-- Rust --> |
| 340 |
<xsl:when test="$language = 'rust'"> |
| 341 |
<xsl:text>rust</xsl:text> |
| 342 |
</xsl:when> |
| 343 |
<!-- Scala --> |
| 344 |
<xsl:when test="$language = 'scala'"> |
| 345 |
<xsl:text>scala</xsl:text> |
| 346 |
</xsl:when> |
| 347 |
<!-- Scheme --> |
| 348 |
<xsl:when test="$language = 'scheme' or $language = 'scm'"> |
| 349 |
<xsl:text>scheme</xsl:text> |
| 350 |
</xsl:when> |
| 351 |
<!-- Shell --> |
| 352 |
<xsl:when test="$language = 'shell'"> |
| 353 |
<xsl:text>shell</xsl:text> |
| 354 |
</xsl:when> |
| 355 |
<!-- Smalltalk --> |
| 356 |
<xsl:when test="$language = 'smalltalk'"> |
| 357 |
<xsl:text>smalltalk</xsl:text> |
| 358 |
</xsl:when> |
| 359 |
<!-- SML --> |
| 360 |
<xsl:when test="$language = 'sml'"> |
| 361 |
<xsl:text>sml</xsl:text> |
| 362 |
</xsl:when> |
| 363 |
<!-- SQL --> |
| 364 |
<xsl:when test="$language = 'sql' or $language = 'sql92' or |
| 365 |
$language = 'sql1999' or $language = 'sql2003'"> |
| 366 |
<xsl:text>sql</xsl:text> |
| 367 |
</xsl:when> |
| 368 |
<!-- TCL --> |
| 369 |
<xsl:when test="$language = 'tcl'"> |
| 370 |
<xsl:text>tcl</xsl:text> |
| 371 |
</xsl:when> |
| 372 |
<!-- TeX --> |
| 373 |
<xsl:when test="$language = 'tex' or $language = 'latex'"> |
| 374 |
<xsl:text>latex</xsl:text> |
| 375 |
</xsl:when> |
| 376 |
<!-- Vala --> |
| 377 |
<xsl:when test="$language = 'vala'"> |
| 378 |
<xsl:text>vala</xsl:text> |
| 379 |
</xsl:when> |
| 380 |
<!-- XML --> |
| 381 |
<xsl:when test="$language = 'xml' or $language = 'myxml'"> |
| 382 |
<xsl:text>xml</xsl:text> |
| 383 |
</xsl:when> |
| 384 |
<!-- XQuery --> |
| 385 |
<xsl:when test="$language = 'xq' or $language = 'xquery'"> |
| 386 |
<xsl:text>xquery</xsl:text> |
| 387 |
</xsl:when> |
| 388 |
<!-- YAML --> |
| 389 |
<xsl:when test="$language = 'yaml'"> |
| 390 |
<xsl:text>yaml</xsl:text> |
| 391 |
</xsl:when> |
| 392 |
</xsl:choose> |
| 393 |
</xsl:template> |
| 394 |
|
| 395 |
<!-- = context = --> |
| 396 |
<xsl:template mode="dita2html.topic.mode" match="&topic_context;"> |
| 397 |
<xsl:call-template name="dita2html.div"> |
| 398 |
<xsl:with-param name="class" select="'context'"/> |
| 399 |
</xsl:call-template> |
| 400 |
</xsl:template> |
| 401 |
|
| 402 |
<!-- = desc = --> |
| 403 |
<xsl:template mode="dita2html.topic.mode" match="&topic_desc;"> |
| 404 |
<xsl:call-template name="dita2html.div"> |
| 405 |
<xsl:with-param name="class" select="'desc'"/> |
| 406 |
</xsl:call-template> |
| 407 |
</xsl:template> |
| 408 |
|
| 409 |
<!-- = example = --> |
| 410 |
<xsl:template mode="dita2html.topic.mode" match="&topic_example;"> |
| 411 |
<xsl:call-template name="dita2html.div"> |
| 412 |
<xsl:with-param name="class" select="'example'"/> |
| 413 |
</xsl:call-template> |
| 414 |
</xsl:template> |
| 415 |
|
| 416 |
<!-- = fig = --> |
| 417 |
<xsl:template mode="dita2html.topic.mode" match="&topic_fig;"> |
| 418 |
<xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/> |
| 419 |
<!-- If there's images or video, treat it like a Mallard figure. |
| 420 |
Otherwise, treat it like a Mallard listing. --> |
| 421 |
<xsl:variable name="style"> |
| 422 |
<xsl:choose> |
| 423 |
<xsl:when test="$conref/&topic_image; or $conref/&topic_object;"> |
| 424 |
<xsl:text>figure</xsl:text> |
| 425 |
</xsl:when> |
| 426 |
<xsl:otherwise> |
| 427 |
<xsl:text>listing</xsl:text> |
| 428 |
</xsl:otherwise> |
| 429 |
</xsl:choose> |
| 430 |
</xsl:variable> |
| 431 |
<div> |
| 432 |
<xsl:call-template name="dita.id"/> |
| 433 |
<xsl:call-template name="html.class.attr"> |
| 434 |
<xsl:with-param name="class" select="$style"/> |
| 435 |
</xsl:call-template> |
| 436 |
<xsl:call-template name="html.lang.attrs"/> |
| 437 |
<div class="inner"> |
| 438 |
<xsl:if test="$style = 'figure'"> |
| 439 |
<a href="#" class="figure-zoom"> |
| 440 |
<xsl:attribute name="data-zoom-in-title"> |
| 441 |
<xsl:call-template name="l10n.gettext"> |
| 442 |
<xsl:with-param name="msgid" select="'View images at normal size'"/> |
| 443 |
</xsl:call-template> |
| 444 |
</xsl:attribute> |
| 445 |
<xsl:attribute name="data-zoom-out-title"> |
| 446 |
<xsl:call-template name="l10n.gettext"> |
| 447 |
<xsl:with-param name="msgid" select="'Scale images down'"/> |
| 448 |
</xsl:call-template> |
| 449 |
</xsl:attribute> |
| 450 |
<xsl:call-template name="icons.svg.figure.zoom.in"/> |
| 451 |
<xsl:call-template name="icons.svg.figure.zoom.out"/> |
| 452 |
</a> |
| 453 |
</xsl:if> |
| 454 |
<xsl:apply-templates mode="dita2html.topic.mode" select="$conref/&topic_title_all;"/> |
| 455 |
<div class="region"> |
| 456 |
<xsl:if test="$style = 'listing'"> |
| 457 |
<xsl:apply-templates mode="dita2html.topic.mode" select="$conref/&topic_desc;"/> |
| 458 |
</xsl:if> |
| 459 |
<div class="contents"> |
| 460 |
<xsl:apply-templates mode="dita2html.topic.mode" |
| 461 |
select="$conref/node()[not(self::&topic_title_all; or self::&topic_desc;)]"/> |
| 462 |
</div> |
| 463 |
<xsl:if test="$style = 'figure'"> |
| 464 |
<xsl:apply-templates mode="dita2html.topic.mode" select="$conref/&topic_desc;"/> |
| 465 |
</xsl:if> |
| 466 |
</div> |
| 467 |
</div> |
| 468 |
</div> |
| 469 |
</xsl:template> |
| 470 |
|
| 471 |
<!-- = info = --> |
| 472 |
<xsl:template mode="dita2html.topic.mode" match="&topic_info;"> |
| 473 |
<xsl:call-template name="dita2html.p"/> |
| 474 |
</xsl:template> |
| 475 |
|
| 476 |
<!-- = note = --> |
| 477 |
<xsl:template mode="dita2html.topic.mode" match="&topic_note;"> |
| 478 |
<xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/> |
| 479 |
<xsl:variable name="type"> |
| 480 |
<xsl:call-template name="dita.ref.conref.attr"> |
| 481 |
<xsl:with-param name="attr" select="'type'"/> |
| 482 |
<xsl:with-param name="node" select="."/> |
| 483 |
<xsl:with-param name="conref" select="$conref"/> |
| 484 |
</xsl:call-template> |
| 485 |
</xsl:variable> |
| 486 |
<xsl:variable name="notetitle"> |
| 487 |
<xsl:choose> |
| 488 |
<xsl:when test="$type = 'attention' or $type = 'important' or |
| 489 |
$type = 'remember' or $type = 'restriction'"> |
| 490 |
<xsl:text>Important</xsl:text> |
| 491 |
</xsl:when> |
| 492 |
<xsl:when test="$type = 'caution' or $type = 'notice'"> |
| 493 |
<xsl:text>Caution</xsl:text> |
| 494 |
</xsl:when> |
| 495 |
<xsl:when test="$type = 'danger'"> |
| 496 |
<xsl:text>Danger</xsl:text> |
| 497 |
</xsl:when> |
| 498 |
<xsl:when test="$type = 'warning'"> |
| 499 |
<xsl:text>Warning</xsl:text> |
| 500 |
</xsl:when> |
| 501 |
<xsl:when test="$type = 'fastpath' or $type = 'tip'"> |
| 502 |
<xsl:text>Tip</xsl:text> |
| 503 |
</xsl:when> |
| 504 |
<xsl:otherwise> |
| 505 |
<xsl:text>Note</xsl:text> |
| 506 |
</xsl:otherwise> |
| 507 |
</xsl:choose> |
| 508 |
</xsl:variable> |
| 509 |
<xsl:variable name="notetype"> |
| 510 |
<xsl:value-of select="translate($notetitle, |
| 511 |
'ABCDEFGHIJKLMNOPQRSTUVWXYZ', |
| 512 |
'abcdefghijklmnopqrstuvwxyz')"/> |
| 513 |
</xsl:variable> |
| 514 |
<div> |
| 515 |
<xsl:call-template name="dita.id"/> |
| 516 |
<xsl:call-template name="html.lang.attrs"/> |
| 517 |
<xsl:call-template name="html.class.attr"> |
| 518 |
<xsl:with-param name="class"> |
| 519 |
<xsl:text>note</xsl:text> |
| 520 |
<xsl:if test="$notetype != ''"> |
| 521 |
<xsl:text> note-</xsl:text> |
| 522 |
<xsl:value-of select="$notetype"/> |
| 523 |
</xsl:if> |
| 524 |
</xsl:with-param> |
| 525 |
</xsl:call-template> |
| 526 |
<xsl:attribute name="title"> |
| 527 |
<xsl:call-template name="l10n.gettext"> |
| 528 |
<xsl:with-param name="msgid" select="$notetitle"/> |
| 529 |
</xsl:call-template> |
| 530 |
</xsl:attribute> |
| 531 |
<xsl:call-template name="icons.svg.note"> |
| 532 |
<xsl:with-param name="style" select="$notetype"/> |
| 533 |
</xsl:call-template> |
| 534 |
<div class="inner"> |
| 535 |
<div class="region"> |
| 536 |
<div class="contents"> |
| 537 |
<xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/> |
| 538 |
</div> |
| 539 |
</div> |
| 540 |
</div> |
| 541 |
</div> |
| 542 |
</xsl:template> |
| 543 |
|
| 544 |
<!-- = p = --> |
| 545 |
<xsl:template mode="dita2html.topic.mode" match="&topic_p;"> |
| 546 |
<xsl:call-template name="dita2html.p"/> |
| 547 |
</xsl:template> |
| 548 |
|
| 549 |
<!-- = postreq = --> |
| 550 |
<xsl:template mode="dita2html.topic.mode" match="&topic_postreq;"> |
| 551 |
<xsl:call-template name="dita2html.div"> |
| 552 |
<xsl:with-param name="class" select="'postreq'"/> |
| 553 |
</xsl:call-template> |
| 554 |
</xsl:template> |
| 555 |
|
| 556 |
<!-- = pre = --> |
| 557 |
<xsl:template mode="dita2html.topic.mode" match="&topic_pre;"> |
| 558 |
<xsl:call-template name="dita2html.pre"/> |
| 559 |
</xsl:template> |
| 560 |
|
| 561 |
<!-- = prereq = --> |
| 562 |
<xsl:template mode="dita2html.topic.mode" match="&topic_prereq;"> |
| 563 |
<xsl:call-template name="dita2html.div"> |
| 564 |
<xsl:with-param name="class" select="'prereq'"/> |
| 565 |
</xsl:call-template> |
| 566 |
</xsl:template> |
| 567 |
|
| 568 |
<!-- = refsyn = --> |
| 569 |
<xsl:template mode="dita2html.topic.mode" match="&topic_refsyn;"> |
| 570 |
<xsl:call-template name="dita2html.div"> |
| 571 |
<xsl:with-param name="class" select="'synopsis'"/> |
| 572 |
</xsl:call-template> |
| 573 |
</xsl:template> |
| 574 |
|
| 575 |
<!-- = result = --> |
| 576 |
<xsl:template mode="dita2html.topic.mode" match="&topic_result;"> |
| 577 |
<xsl:call-template name="dita2html.div"> |
| 578 |
<xsl:with-param name="class" select="'result'"/> |
| 579 |
</xsl:call-template> |
| 580 |
</xsl:template> |
| 581 |
|
| 582 |
<!-- = screen = --> |
| 583 |
<xsl:template mode="dita2html.topic.mode" match="&topic_screen;"> |
| 584 |
<xsl:call-template name="dita2html.pre"> |
| 585 |
<xsl:with-param name="class" select="'screen'"/> |
| 586 |
</xsl:call-template> |
| 587 |
</xsl:template> |
| 588 |
|
| 589 |
<!-- = section = --> |
| 590 |
<xsl:template mode="dita2html.topic.mode" match="&topic_section;"> |
| 591 |
<xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/> |
| 592 |
<div> |
| 593 |
<xsl:call-template name="dita.id"/> |
| 594 |
<xsl:call-template name="html.lang.attrs"/> |
| 595 |
<xsl:call-template name="html.class.attr"> |
| 596 |
<xsl:with-param name="class" select="'section'"/> |
| 597 |
</xsl:call-template> |
| 598 |
<!-- A DITA section may have an optional title. But it can be anywhere |
| 599 |
in the child node list. And there could be more than one, but all |
| 600 |
but the first are ignored. Apparently. Spec isn't very clear, but |
| 601 |
this is the OT's behavior. --> |
| 602 |
<xsl:apply-templates mode="dita2html.topic.mode" select="$conref/&topic_title_all;[1]"/> |
| 603 |
<div class="region"> |
| 604 |
<div class="contents"> |
| 605 |
<xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()[not(self::&topic_title_all;)]"/> |
| 606 |
</div> |
| 607 |
</div> |
| 608 |
</div> |
| 609 |
</xsl:template> |
| 610 |
|
| 611 |
<!-- = shortdesc = --> |
| 612 |
<xsl:template mode="dita2html.topic.mode" match="&topic_shortdesc;"> |
| 613 |
<xsl:call-template name="dita2html.p"> |
| 614 |
<xsl:with-param name="class" select="'shortdesc'"/> |
| 615 |
</xsl:call-template> |
| 616 |
</xsl:template> |
| 617 |
|
| 618 |
<!-- = stepresult = --> |
| 619 |
<xsl:template mode="dita2html.topic.mode" match="&topic_stepresult;"> |
| 620 |
<xsl:call-template name="dita2html.p"/> |
| 621 |
</xsl:template> |
| 622 |
|
| 623 |
<!-- = steps-informal = --> |
| 624 |
<xsl:template mode="dita2html.topic.mode" match="&topic_steps-informal;"> |
| 625 |
<xsl:call-template name="dita2html.div"> |
| 626 |
<xsl:with-param name="class" select="'steps-informal'"/> |
| 627 |
</xsl:call-template> |
| 628 |
</xsl:template> |
| 629 |
|
| 630 |
<!-- = stepxmp = --> |
| 631 |
<xsl:template mode="dita2html.topic.mode" match="&topic_stepxmp;"> |
| 632 |
<xsl:call-template name="dita2html.div"> |
| 633 |
<xsl:with-param name="class" select="'example'"/> |
| 634 |
</xsl:call-template> |
| 635 |
</xsl:template> |
| 636 |
|
| 637 |
<!-- = title = --> |
| 638 |
<xsl:template mode="dita2html.topic.mode" match="&topic_title_all;"> |
| 639 |
<xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/> |
| 640 |
<xsl:variable name="depth" select="count(ancestor::&topic_topic_all;) + 1"/> |
| 641 |
<xsl:variable name="depth_"> |
| 642 |
<xsl:choose> |
| 643 |
<xsl:when test="$depth < 6"> |
| 644 |
<xsl:value-of select="$depth"/> |
| 645 |
</xsl:when> |
| 646 |
<xsl:otherwise> |
| 647 |
<xsl:value-of select="6"/> |
| 648 |
</xsl:otherwise> |
| 649 |
</xsl:choose> |
| 650 |
</xsl:variable> |
| 651 |
<div> |
| 652 |
<xsl:call-template name="dita.id"/> |
| 653 |
<xsl:call-template name="html.lang.attrs"/> |
| 654 |
<xsl:call-template name="html.class.attr"> |
| 655 |
<xsl:with-param name="class" select="'title'"/> |
| 656 |
</xsl:call-template> |
| 657 |
<xsl:element name="{concat('h', $depth_)}" namespace="{$html.namespace}"> |
| 658 |
<xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/> |
| 659 |
</xsl:element> |
| 660 |
</div> |
| 661 |
</xsl:template> |
| 662 |
|
| 663 |
<!-- = tutorialinfo = --> |
| 664 |
<xsl:template mode="dita2html.topic.mode" match="&topic_tutorialinfo;"> |
| 665 |
<xsl:call-template name="dita2html.p"/> |
| 666 |
</xsl:template> |
| 667 |
|
| 668 |
</xsl:stylesheet> |