]> Lady’s Gitweb - LesML/blob - parser.xslt
186e3896328a4d76f7259bb1a2f60815a1df3234
[LesML] / parser.xslt
1 <?xml version="1.0"?>
2 <!--
3 SPDX-FileCopyrightText: 2024, 2025 Lady <https://www.ladys.computer/about/#lady>
4 SPDX-License-Identifier: MPL-2.0
5 -->
6 <!--
7 ⁌ 💄📝 Les·M·L ∷ parser.xslt
8
9 © 2024–2025 Lady [@ Ladys Computer]
10
11 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
12 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
13 -->
14 <!DOCTYPE transform [
15 <!ENTITY LesML "urn:fdc:ladys.computer:20240512:LesML">
16 <!ENTITY section-break "*-.=_~·․‥…⁂⋯─━┄┅┈┉╌╍═╴╶╸╺☙❧ ・*-.=_~">
17 <!ENTITY sigiled-text "(string-length($text)=1 or substring($text, 2, 1)=' ' or substring($text, 2, 1)='¶')">
18 <!ENTITY unsigiled-text "concat(translate(substring($text, 2, 1), ' ', ''), substring($text, 3, string-length($text)-2))">
19 <!ENTITY xhtml "http://www.w3.org/1999/xhtml">
20 ]>
21 <transform
22 xmlns="http://www.w3.org/1999/XSL/Transform"
23 xmlns:LesML="urn:fdc:ladys.computer:20240512:LesML"
24 xmlns:exsl="http://exslt.org/common"
25 xmlns:exsldyn="http://exslt.org/dynamic"
26 xmlns:exslset="http://exslt.org/sets"
27 xmlns:exslstr="http://exslt.org/strings"
28 xmlns:html="http://www.w3.org/1999/xhtml"
29 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
30 exclude-result-prefixes="LesML"
31 extension-element-prefixes="exsl exsldyn exslset exslstr"
32 version="1.0"
33 >
34 <书社:id>urn:fdc:ladys.computer:20240512:LesML:parser.xslt</书社:id>
35 <template name="LesML:split">
36 <param name="source"/>
37 <param name="separator" select="'&#xA;'"/>
38 <choose>
39 <when test="contains($source, $separator)">
40 <html:span>
41 <value-of select="substring-before($source, $separator)"/>
42 </html:span>
43 <call-template name="LesML:split">
44 <with-param name="source" select="substring-after($source, $separator)"/>
45 <with-param name="separator" select="$separator"/>
46 </call-template>
47 </when>
48 <otherwise>
49 <html:span>
50 <value-of select="$source"/>
51 </html:span>
52 </otherwise>
53 </choose>
54 </template>
55 <template name="LesML:break-and-unescape">
56 <param name="source"/>
57 <variable name="broken-fragment">
58 <call-template name="LesML:split">
59 <with-param name="source" select="$source"/>
60 <with-param name="separator" select="'&#xA;'"/>
61 </call-template>
62 </variable>
63 <variable name="broken" select="exsl:node-set($broken-fragment)/node()"/>
64 <for-each select="$broken">
65 <call-template name="LesML:unescape">
66 <with-param name="source" select="string()"/>
67 </call-template>
68 <if test="position()!=count($broken)">
69 <element name="br" namespace="&xhtml;"/>
70 </if>
71 </for-each>
72 </template>
73 <template name="LesML:unescape">
74 <param name="source"/>
75 <choose>
76 <when test="contains($source, '{U+')">
77 <variable name="after" select="substring-after($source, '{U+')"/>
78 <choose>
79 <when test="contains($after, '}')">
80 <variable name="inner" select="substring-before($after, '}')"/>
81 <variable name="components">
82 <call-template name="LesML:split">
83 <with-param name="source" select="$inner"/>
84 <with-param name="separator" select="'.'"/>
85 </call-template>
86 </variable>
87 <variable name="component-nodes" select="exsl:node-set($components)/node()"/>
88 <value-of select="substring-before($source, '{U+')"/>
89 <choose>
90 <when test="$component-nodes[string(.)='' or translate(., '0123456789ABCDEF', '')!='']">
91 <text>{U+</text>
92 <value-of select="$inner"/>
93 <text>}</text>
94 <call-template name="LesML:unescape">
95 <with-param name="source" select="substring-after($after, '}')"/>
96 </call-template>
97 </when>
98 <otherwise>
99 <for-each select="$component-nodes">
100 <text disable-output-escaping="yes">&amp;#x</text>
101 <value-of select="."/>
102 <text>;</text>
103 </for-each>
104 <call-template name="LesML:unescape">
105 <with-param name="source" select="substring-after($after, '}')"/>
106 </call-template>
107 </otherwise>
108 </choose>
109 </when>
110 <otherwise>
111 <value-of select="substring-before($source, '{U+')"/>
112 <text>{U+</text>
113 <call-template name="LesML:unescape">
114 <with-param name="source" select="$after"/>
115 </call-template>
116 </otherwise>
117 </choose>
118 </when>
119 <otherwise>
120 <value-of select="$source"/>
121 </otherwise>
122 </choose>
123 </template>
124 <template name="LesML:comment-out">
125 <param name="source"/>
126 <variable name="comment-split-fragment">
127 <call-template name="LesML:split">
128 <with-param name="source" select="$source"/>
129 <with-param name="separator" select="'--'"/>
130 </call-template>
131 </variable>
132 <comment>
133 <for-each select="exsl:node-set($comment-split-fragment)/*">
134 <if test="string()='' or starts-with(., '‐')">
135 <text>&#x034F;</text>
136 </if>
137 <value-of select="."/>
138 <if test="substring(., string-length(.), 1)='‐'">
139 <text>&#x034F;</text>
140 </if>
141 <choose>
142 <when test="position()!=last()">
143 <text>-&#x034F;-</text>
144 </when>
145 </choose>
146 </for-each>
147 </comment>
148 </template>
149 <template name="LesML:id-and-contents">
150 <param name="source"/>
151 <variable name="id-and-lang">
152 <if test="starts-with($source, '¶')">
153 <choose>
154 <when test="contains($source, ' ')">
155 <value-of select="substring-before(substring-after($source, '¶'), ' ')"/>
156 </when>
157 <otherwise>
158 <value-of select="substring-after($source, '¶')"/>
159 </otherwise>
160 </choose>
161 </if>
162 </variable>
163 <variable name="restoftext">
164 <choose>
165 <when test="starts-with($source, '¶') and contains($source, ' ')">
166 <value-of select="substring-after($source, ' ')"/>
167 </when>
168 <when test="starts-with($source, '¶')"/>
169 <otherwise>
170 <value-of select="$source"/>
171 </otherwise>
172 </choose>
173 </variable>
174 <variable name="maybe-langtag">
175 <if test="substring($id-and-lang, string-length($id-and-lang), 1)='$' and contains($id-and-lang, '@')">
176 <variable name="split-tag-fragment">
177 <call-template name="LesML:split">
178 <with-param name="source" select="substring($id-and-lang, 2, string-length($id-and-lang)-2)"/>
179 <with-param name="separator" select="'@'"/>
180 </call-template>
181 </variable>
182 <value-of select="exsl:node-set($split-tag-fragment)/*[last()]"/>
183 </if>
184 </variable>
185 <variable name="langtag">
186 <if test="translate($maybe-langtag, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-', '')=''">
187 <value-of select="$maybe-langtag"/>
188 </if>
189 </variable>
190 <variable name="id">
191 <choose>
192 <when test="string($langtag)!=''">
193 <value-of select="substring($id-and-lang, 1, string-length($id-and-lang)-(string-length($langtag)+2))"/>
194 </when>
195 <otherwise>
196 <value-of select="$id-and-lang"/>
197 </otherwise>
198 </choose>
199 </variable>
200 <if test="string($id)!=''">
201 <attribute name="id">
202 <value-of select="$id"/>
203 </attribute>
204 </if>
205 <if test="string($langtag)!=''">
206 <attribute name="lang">
207 <value-of select="$langtag"/>
208 </attribute>
209 <attribute name="xml:lang">
210 <value-of select="$langtag"/>
211 </attribute>
212 </if>
213 <value-of select="$restoftext"/>
214 </template>
215 <template name="LesML:parse">
216 <param name="lines" select="/.."/>
217 <param name="parent-params" select="/.."/>
218 <variable name="first-line" select="$lines[1]"/>
219 <variable name="shebang">
220 <if test="starts-with($first-line, '#!lesml')">
221 <value-of select="$first-line"/>
222 </if>
223 </variable>
224 <variable name="params-string">
225 <choose>
226 <when test="starts-with($shebang, '#!lesml@')">
227 <value-of select="substring-after($shebang, '$')"/>
228 </when>
229 <otherwise>
230 <value-of select="substring-after($shebang, '#!lesml')"/>
231 </otherwise>
232 </choose>
233 </variable>
234 <variable name="params-fragment">
235 <choose>
236 <when test="$shebang!=''">
237 <html:dl>
238 <if test="starts-with($shebang, '#!lesml@') and contains($shebang, '$')">
239 <html:div>
240 <html:dt>
241 <text> LANG </text>
242 </html:dt>
243 <html:dd>
244 <value-of select="substring-before(substring-after($shebang, '#!lesml@'), '$')"/>
245 </html:dd>
246 </html:div>
247 </if>
248 <for-each select="exslstr:tokenize($params-string)">
249 <choose>
250 <when test="contains(., '=')">
251 <html:div>
252 <html:dt>
253 <value-of select="substring-before(., '=')"/>
254 </html:dt>
255 <html:dd>
256 <value-of select="substring-after(., '=')"/>
257 </html:dd>
258 </html:div>
259 </when>
260 <otherwise>
261 <html:div>
262 <html:dt>
263 <value-of select="."/>
264 </html:dt>
265 <html:dd/>
266 </html:div>
267 </otherwise>
268 </choose>
269 </for-each>
270 </html:dl>
271 </when>
272 <when test="$parent-params">
273 <copy-of select="$parent-params"/>
274 </when>
275 <otherwise>
276 <html:dl/>
277 </otherwise>
278 </choose>
279 </variable>
280 <variable name="params" select="exsl:node-set($params-fragment)/*"/>
281 <variable name="noshebang" select="$lines[position()>1 or not(starts-with(., '#!lesml') or starts-with(., '##'))]"/>
282 <variable name="docsep" select="$noshebang[starts-with(., '#!lesml') or starts-with(., '##')][1]"/>
283 <variable name="doclines" select="exslset:leading($noshebang, $docsep)"/>
284 <if test="starts-with($first-line, '##') and $first-line!='##'">
285 <call-template name="LesML:comment-out">
286 <with-param name="source" select="substring-after($first-line, '##')"/>
287 </call-template>
288 </if>
289 <if test="$doclines[normalize-space()!='']">
290 <variable name="record-separators" select="$doclines[starts-with(., '%%')]"/>
291 <element name="article" namespace="&xhtml;">
292 <for-each select="$params/html:div/html:dt[string()=' LANG ']">
293 <attribute name="lang">
294 <value-of select="following-sibling::html:dd"/>
295 </attribute>
296 <attribute name="xml:lang">
297 <value-of select="following-sibling::html:dd"/>
298 </attribute>
299 </for-each>
300 <for-each select="$params/html:div/html:dt[string()='profile']">
301 <attribute name="data-lesml-profile">
302 <value-of select="following-sibling::html:dd"/>
303 </attribute>
304 </for-each>
305 <if test="$record-separators[preceding-sibling::*[normalize-space()!='']]">
306 <element name="footer" namespace="&xhtml;">
307 <attribute name="class">
308 <text>head</text>
309 </attribute>
310 <for-each select="$record-separators">
311 <variable name="position" select="position()"/>
312 <variable name="prev-separator" select="$record-separators[($position)-1]"/>
313 <variable name="fields" select="exslset:leading(exslset:trailing($doclines, $prev-separator), .)"/>
314 <if test="$fields">
315 <element name="dl" namespace="&xhtml;">
316 <for-each select="$fields">
317 <choose>
318 <when test="starts-with(., ' ') and exslset:leading($fields, .)"/>
319 <otherwise>
320 <variable name="next" select="exslset:intersection(following-sibling::*[not(starts-with(., ' '))][1], $fields)"/>
321 <element name="div" namespace="&xhtml;">
322 <element name="dt" namespace="&xhtml;">
323 <value-of select="normalize-space(substring-before(., ':'))"/>
324 </element>
325 <element name="dd" namespace="&xhtml;">
326 <variable name="firstline">
327 <choose>
328 <when test="contains(., ':')">
329 <value-of select="normalize-space(substring-after(., ':'))"/>
330 </when>
331 <otherwise>
332 <value-of select="normalize-space(.)"/>
333 </otherwise>
334 </choose>
335 </variable>
336 <choose>
337 <when test="substring($firstline, string-length($firstline))='\' and following-sibling::*[position()=1 and starts-with(., ' ')]">
338 <value-of select="substring($firstline, 1, string-length($firstline)-1)"/>
339 </when>
340 <otherwise>
341 <value-of select="$firstline"/>
342 </otherwise>
343 </choose>
344 <for-each select="exslset:intersection(following-sibling::*[starts-with(., ' ')], exslset:leading($fields, $next))">
345 <variable name="nextline" select="normalize-space(.)"/>
346 <choose>
347 <when test="substring($nextline, string-length($nextline))='\' and following-sibling::*[position()=1 and starts-with(., ' ')]">
348 <value-of select="substring($nextline, 1, string-length($nextline)-1)"/>
349 </when>
350 <otherwise>
351 <value-of select="$nextline"/>
352 </otherwise>
353 </choose>
354 </for-each>
355 </element>
356 </element>
357 </otherwise>
358 </choose>
359 </for-each>
360 </element>
361 </if>
362 <if test=".!='%%'">
363 <call-template name="LesML:comment-out">
364 <with-param name="source" select="substring-after(., '%%')"/>
365 </call-template>
366 </if>
367 </for-each>
368 </element>
369 </if>
370 <element name="div" namespace="&xhtml;">
371 <attribute name="class">
372 <text>body</text>
373 </attribute>
374 <call-template name="LesML:paragraphize">
375 <with-param name="lines" select="exslset:trailing($doclines, $record-separators[last()])"/>
376 </call-template>
377 </element>
378 </element>
379 </if>
380 <if test="$docsep">
381 <call-template name="LesML:parse">
382 <with-param name="lines" select="$docsep|exslset:trailing($lines, $docsep)"/>
383 <with-param name="parent-params" select="$params"/>
384 </call-template>
385 </if>
386 </template>
387 <template name="LesML:paragraphize">
388 <param name="lines" select="/.."/>
389 <variable name="last-lines" select="$lines[normalize-space()!='' and normalize-space(following-sibling::*[1])='']|$lines[last()]"/>
390 <variable name="blocked">
391 <for-each select="$last-lines">
392 <variable name="position" select="position()"/>
393 <variable name="prev-last" select="$last-lines[($position)-1]"/>
394 <variable name="linespans" select="(exslset:intersection(exslset:trailing($lines, $prev-last), exslset:leading($lines, .))|.)[normalize-space()!='']"/>
395 <variable name="quoted" select="not($linespans[not(starts-with(., ' ') or starts-with(., '&#x9;'))])"/>
396 <variable name="preformatted" select="not($linespans[not(starts-with(normalize-space(), '|'))])"/>
397 <variable name="text">
398 <for-each select="$linespans">
399 <choose>
400 <when test="$preformatted">
401 <value-of select="substring-after(., '|')"/>
402 </when>
403 <otherwise>
404 <value-of select="normalize-space()"/>
405 </otherwise>
406 </choose>
407 <if test="position()!=count($linespans)">
408 <choose>
409 <when test="$preformatted">
410 <text>&#xA;</text>
411 </when>
412 <otherwise>
413 <text> </text>
414 </otherwise>
415 </choose>
416 </if>
417 </for-each>
418 </variable>
419 <if test="string($text)!=''">
420 <variable name="par">
421 <choose>
422 <when test="$preformatted">
423 <element name="pre" namespace="&xhtml;">
424 <call-template name="LesML:id-and-contents">
425 <with-param name="source" select="$text"/>
426 </call-template>
427 </element>
428 </when>
429 <when test="starts-with($text, '⁌') and &sigiled-text;">
430 <element name="h1" namespace="&xhtml;">
431 <call-template name="LesML:id-and-contents">
432 <with-param name="source" select="&unsigiled-text;"/>
433 </call-template>
434 </element>
435 </when>
436 <when test="starts-with($text, '§') and &sigiled-text;">
437 <element name="h2" namespace="&xhtml;">
438 <call-template name="LesML:id-and-contents">
439 <with-param name="source" select="&unsigiled-text;"/>
440 </call-template>
441 </element>
442 </when>
443 <when test="starts-with($text, '❦') and &sigiled-text;">
444 <element name="h3" namespace="&xhtml;">
445 <call-template name="LesML:id-and-contents">
446 <with-param name="source" select="&unsigiled-text;"/>
447 </call-template>
448 </element>
449 </when>
450 <when test="starts-with($text, '✠') and &sigiled-text;">
451 <element name="h4" namespace="&xhtml;">
452 <call-template name="LesML:id-and-contents">
453 <with-param name="source" select="&unsigiled-text;"/>
454 </call-template>
455 </element>
456 </when>
457 <when test="starts-with($text, '•') and &sigiled-text;">
458 <element name="li" namespace="&xhtml;">
459 <attribute name="class">
460 <text>unordered</text>
461 </attribute>
462 <attribute name="data-level">
463 <text>1</text>
464 </attribute>
465 <element name="p" namespace="&xhtml;">
466 <call-template name="LesML:id-and-contents">
467 <with-param name="source" select="&unsigiled-text;"/>
468 </call-template>
469 </element>
470 </element>
471 </when>
472 <when test="starts-with($text, '🔢') and &sigiled-text;">
473 <element name="li" namespace="&xhtml;">
474 <attribute name="class">
475 <text>ordered</text>
476 </attribute>
477 <attribute name="data-level">
478 <text>1</text>
479 </attribute>
480 <element name="p" namespace="&xhtml;">
481 <call-template name="LesML:id-and-contents">
482 <with-param name="source" select="&unsigiled-text;"/>
483 </call-template>
484 </element>
485 </element>
486 </when>
487 <when test="starts-with($text, '◦') and &sigiled-text;">
488 <element name="li" namespace="&xhtml;">
489 <attribute name="class">
490 <text>unordered</text>
491 </attribute>
492 <attribute name="data-level">
493 <text>2</text>
494 </attribute>
495 <element name="p" namespace="&xhtml;">
496 <call-template name="LesML:id-and-contents">
497 <with-param name="source" select="&unsigiled-text;"/>
498 </call-template>
499 </element>
500 </element>
501 </when>
502 <when test="starts-with($text, '🔠') and &sigiled-text;">
503 <element name="li" namespace="&xhtml;">
504 <attribute name="class">
505 <text>ordered</text>
506 </attribute>
507 <attribute name="data-level">
508 <text>2</text>
509 </attribute>
510 <element name="p" namespace="&xhtml;">
511 <call-template name="LesML:id-and-contents">
512 <with-param name="source" select="&unsigiled-text;"/>
513 </call-template>
514 </element>
515 </element>
516 </when>
517 <when test="starts-with($text, '▪') and &sigiled-text;">
518 <element name="li" namespace="&xhtml;">
519 <attribute name="class">
520 <text>unordered</text>
521 </attribute>
522 <attribute name="data-level">
523 <text>3</text>
524 </attribute>
525 <element name="p" namespace="&xhtml;">
526 <call-template name="LesML:id-and-contents">
527 <with-param name="source" select="&unsigiled-text;"/>
528 </call-template>
529 </element>
530 </element>
531 </when>
532 <when test="starts-with($text, '🔡') and &sigiled-text;">
533 <element name="li" namespace="&xhtml;">
534 <attribute name="class">
535 <text>ordered</text>
536 </attribute>
537 <attribute name="data-level">
538 <text>3</text>
539 </attribute>
540 <element name="p" namespace="&xhtml;">
541 <call-template name="LesML:id-and-contents">
542 <with-param name="source" select="&unsigiled-text;"/>
543 </call-template>
544 </element>
545 </element>
546 </when>
547 <when test="starts-with($text, '⁃') and &sigiled-text;">
548 <element name="li" namespace="&xhtml;">
549 <attribute name="class">
550 <text>unordered</text>
551 </attribute>
552 <attribute name="data-level">
553 <text>4</text>
554 </attribute>
555 <element name="p" namespace="&xhtml;">
556 <call-template name="LesML:id-and-contents">
557 <with-param name="source" select="&unsigiled-text;"/>
558 </call-template>
559 </element>
560 </element>
561 </when>
562 <when test="starts-with($text, '🔣') and &sigiled-text;">
563 <element name="li" namespace="&xhtml;">
564 <attribute name="class">
565 <text>ordered</text>
566 </attribute>
567 <attribute name="data-level">
568 <text>4</text>
569 </attribute>
570 <element name="p" namespace="&xhtml;">
571 <call-template name="LesML:id-and-contents">
572 <with-param name="source" select="&unsigiled-text;"/>
573 </call-template>
574 </element>
575 </element>
576 </when>
577 <when test="starts-with($text, '🛈') and &sigiled-text;">
578 <element name="div" namespace="&xhtml;">
579 <attribute name="role">
580 <text>note</text>
581 </attribute>
582 <attribute name="class">
583 <text>info</text>
584 </attribute>
585 <element name="p" namespace="&xhtml;">
586 <call-template name="LesML:id-and-contents">
587 <with-param name="source" select="&unsigiled-text;"/>
588 </call-template>
589 </element>
590 </element>
591 </when>
592 <when test="starts-with($text, '⯑') and &sigiled-text;">
593 <element name="div" namespace="&xhtml;">
594 <attribute name="role">
595 <text>note</text>
596 </attribute>
597 <attribute name="class">
598 <text>query</text>
599 </attribute>
600 <element name="p" namespace="&xhtml;">
601 <call-template name="LesML:id-and-contents">
602 <with-param name="source" select="&unsigiled-text;"/>
603 </call-template>
604 </element>
605 </element>
606 </when>
607 <when test="starts-with($text, '⚠︎') and &sigiled-text;">
608 <element name="div" namespace="&xhtml;">
609 <attribute name="role">
610 <text>note</text>
611 </attribute>
612 <attribute name="class">
613 <text>warn</text>
614 </attribute>
615 <element name="p" namespace="&xhtml;">
616 <call-template name="LesML:id-and-contents">
617 <with-param name="source" select="&unsigiled-text;"/>
618 </call-template>
619 </element>
620 </element>
621 </when>
622 <when test="starts-with($text, '※') and &sigiled-text;">
623 <element name="div" namespace="&xhtml;">
624 <attribute name="role">
625 <text>note</text>
626 </attribute>
627 <attribute name="class">
628 <text>note</text>
629 </attribute>
630 <element name="p" namespace="&xhtml;">
631 <call-template name="LesML:id-and-contents">
632 <with-param name="source" select="&unsigiled-text;"/>
633 </call-template>
634 </element>
635 </element>
636 </when>
637 <when test="starts-with($text, '☡') and &sigiled-text;">
638 <element name="div" namespace="&xhtml;">
639 <attribute name="role">
640 <text>note</text>
641 </attribute>
642 <attribute name="class">
643 <text>caution</text>
644 </attribute>
645 <element name="p" namespace="&xhtml;">
646 <call-template name="LesML:id-and-contents">
647 <with-param name="source" select="&unsigiled-text;"/>
648 </call-template>
649 </element>
650 </element>
651 </when>
652 <when test="starts-with($text, '⋯') and &sigiled-text;">
653 <element name="div" namespace="&xhtml;">
654 <attribute name="class">
655 <text>continuation</text>
656 </attribute>
657 <element name="p" namespace="&xhtml;">
658 <call-template name="LesML:id-and-contents">
659 <with-param name="source" select="&unsigiled-text;"/>
660 </call-template>
661 </element>
662 </element>
663 </when>
664 <when test="starts-with($text, '#') and &sigiled-text;">
665 <call-template name="LesML:comment-out">
666 <with-param name="source" select="&unsigiled-text;"/>
667 </call-template>
668 </when>
669 <otherwise>
670 <element name="p" namespace="&xhtml;">
671 <call-template name="LesML:id-and-contents">
672 <with-param name="source" select="$text"/>
673 </call-template>
674 </element>
675 </otherwise>
676 </choose>
677 </variable>
678 <choose>
679 <when test="translate(string($text), '&section-break; ', '')=''">
680 <element name="hr" namespace="&xhtml;"/>
681 </when>
682 <when test="$quoted">
683 <element name="blockquote" namespace="&xhtml;">
684 <copy-of select="$par"/>
685 </element>
686 </when>
687 <otherwise>
688 <copy-of select="$par"/>
689 </otherwise>
690 </choose>
691 </if>
692 </for-each>
693 </variable>
694 <variable name="inlined">
695 <apply-templates select="exsl:node-set($blocked)/node()" mode="LesML:comment"/>
696 </variable>
697 <apply-templates select="exsl:node-set($inlined)/node()" mode="LesML:finalize-tree"/>
698 </template>
699 <template match="html:script[@type='text/lesml']">
700 <variable name="lines-fragment">
701 <call-template name="LesML:split">
702 <with-param name="source">
703 <for-each select=".//text()">
704 <value-of select="."/>
705 </for-each>
706 </with-param>
707 </call-template>
708 </variable>
709 <element name="div" namespace="&xhtml;">
710 <call-template name="LesML:parse">
711 <with-param name="lines" select="exsl:node-set($lines-fragment)/*"/>
712 </call-template>
713 </element>
714 </template>
715 <template match="node()" mode="LesML:finalize-attributes">
716 <variable name="notattr" select="following-sibling::node()[not(self::text() and translate(., ' &#x9;', '')='' or self::LesML:attribute)]"/>
717 <for-each select="(.|exslset:leading(following-sibling::node(), $notattr)[self::LesML:attribute])/@*">
718 <copy-of select="."/>
719 <if test="local-name()='lang' and namespace-uri()=''">
720 <attribute name="xml:lang">
721 <value-of select="."/>
722 </attribute>
723 </if>
724 </for-each>
725 </template>
726 <template match="LesML:attribute[preceding-sibling::node()[position()=1 and (self::text() or self::*)]]|text()[preceding-sibling::node()[position()=1 and self::*] and following-sibling::node()[position()=1 and self::LesML:attribute] and translate(., ' &#x9;', '')='']" mode="LesML:finalize-tree" priority="2"/>
727 <template match="LesML:attribute|text()[following-sibling::node()[position()=1 and self::LesML:attribute]]" mode="LesML:finalize-tree" priority="1">
728 <element name="span" namespace="&xhtml;">
729 <apply-templates select="." mode="LesML:finalize-attributes"/>
730 <if test="self::text()">
731 <call-template name="LesML:break-and-unescape">
732 <with-param name="source" select="string(.)"/>
733 </call-template>
734 </if>
735 </element>
736 </template>
737 <template match="html:blockquote" mode="LesML:finalize-tree">
738 <if test="not(preceding-sibling::node()) or preceding-sibling::node()[position()=1 and not(self::html:blockquote)]">
739 <variable name="notquote" select="following-sibling::node()[not(self::html:blockquote)][1]"/>
740 <variable name="contents">
741 <copy-of select="node()"/>
742 <for-each select="exslset:leading(following-sibling::node(), $notquote)">
743 <copy-of select="node()"/>
744 </for-each>
745 </variable>
746 <variable name="content-nodes" select="exsl:node-set($contents)/node()"/>
747 <variable name="laststarttext" select="$content-nodes[last()]/self::html:p[not(@class) and not(@role)]/node()[self::text() or self::*][position()=1 and self::text()]"/>
748 <choose>
749 <when test="starts-with($laststarttext, '— ')">
750 <variable name="caption">
751 <copy-of select="$laststarttext/preceding-sibling::node()"/>
752 <value-of select="substring-after($laststarttext, '— ')"/>
753 <copy-of select="$laststarttext/following-sibling::node()"/>
754 </variable>
755 <element name="figure" namespace="&xhtml;">
756 <copy>
757 <apply-templates select="@*|$content-nodes[position()!=last()]" mode="LesML:finalize-tree"/>
758 </copy>
759 <element name="figcaption" namespace="&xhtml;">
760 <for-each select="$content-nodes[last()]">
761 <copy>
762 <apply-templates select="@*|exsl:node-set($caption)/node()" mode="LesML:finalize-tree"/>
763 </copy>
764 </for-each>
765 </element>
766 </element>
767 </when>
768 <otherwise>
769 <copy>
770 <apply-templates select="@*|$content-nodes" mode="LesML:finalize-tree"/>
771 </copy>
772 </otherwise>
773 </choose>
774 </if>
775 </template>
776 <template match="html:div" mode="LesML:finalize-tree">
777 <if test="not(@class='continuation') or not(preceding-sibling::node()) or preceding-sibling::node()[position()=1 and not(self::html:div or self::html:li)]">
778 <variable name="notcontinuation" select="following-sibling::node()[not(self::html:div and @class='continuation')][1]"/>
779 <copy>
780 <apply-templates select="@*|node()" mode="LesML:finalize-tree"/>
781 <for-each select="exslset:leading(following-sibling::node(), $notcontinuation)">
782 <apply-templates select="node()" mode="LesML:finalize-tree"/>
783 </for-each>
784 </copy>
785 </if>
786 </template>
787 <template match="html:li" mode="LesML:finalize-tree">
788 <if test="not(preceding-sibling::node()) or preceding-sibling::node()[not(preceding-sibling::* and self::html:div and @class='continuation')][position()=1 and not(self::html:li)]">
789 <apply-templates select="." mode="LesML:finalize-list"/>
790 </if>
791 </template>
792 <template match="html:li" mode="LesML:finalize-list">
793 <param name="parent-level" select="0"/>
794 <variable name="current-class" select="string(@class)"/>
795 <variable name="current-level" select="number(@data-level)"/>
796 <variable name="wrapper">
797 <choose>
798 <when test="@class='ordered'">
799 <text>ol</text>
800 </when>
801 <otherwise>
802 <text>ul</text>
803 </otherwise>
804 </choose>
805 </variable>
806 <variable name="notinlist" select="following-sibling::node()[not(self::html:div and @class='continuation' or self::html:li and (@data-level>$current-level or @data-level=$current-level and @class=$current-class))][1]"/>
807 <element name="{$wrapper}" namespace="&xhtml;">
808 <for-each select=".|exslset:leading(following-sibling::node(), $notinlist)[self::html:li and @data-level=$current-level]">
809 <variable name="notcontinuation" select="following-sibling::node()[not(self::html:div and @class='continuation')][1]"/>
810 <copy>
811 <apply-templates select="@*|node()" mode="LesML:finalize-tree"/>
812 <for-each select="exslset:leading(following-sibling::node(), $notcontinuation)">
813 <apply-templates select="node()" mode="LesML:finalize-tree"/>
814 </for-each>
815 <if test="$notcontinuation/self::html:li[@data-level>$current-level]">
816 <apply-templates select="$notcontinuation" mode="LesML:finalize-list">
817 <with-param name="parent-level" select="$current-level"/>
818 </apply-templates>
819 </if>
820 </copy>
821 </for-each>
822 </element>
823 <if test="$notinlist/self::html:li[@data-level>$parent-level]">
824 <apply-templates select="$notinlist" mode="LesML:finalize-list">
825 <with-param name="parent-level" select="$parent-level"/>
826 </apply-templates>
827 </if>
828 </template>
829 <template match="processing-instruction()[local-name()='LesML-Token-Escape']" mode="LesML:finalize-tree">
830 <value-of select="."/>
831 </template>
832 <template match="text()" mode="LesML:finalize-tree">
833 <call-template name="LesML:break-and-unescape">
834 <with-param name="source" select="string(.)"/>
835 </call-template>
836 </template>
837 <template match="@*|node()" mode="LesML:finalize-tree" priority="-1">
838 <copy>
839 <apply-templates select="." mode="LesML:finalize-attributes"/>
840 <apply-templates select="node()" mode="LesML:finalize-tree"/>
841 </copy>
842 </template>
843 <template match="node()" mode="LesML:comment">
844 <variable name="result">
845 <choose>
846 <when test="self::*">
847 <variable name="start-node" select="text()[contains(., '⌦')][1]"/>
848 <variable name="after-start">
849 <if test="$start-node">
850 <value-of select="substring-after($start-node, '⌦')"/>
851 </if>
852 </variable>
853 <variable name="has-end-node" select="contains($after-start, '⌫') or $start-node/following-sibling::text()[contains(., '⌫')]"/>
854 <choose>
855 <when test="$start-node and $has-end-node">
856 <variable name="following">
857 <value-of select="$after-start"/>
858 <copy-of select="$start-node/following-sibling::node()"/>
859 </variable>
860 <variable name="end-node" select="exsl:node-set($following)/text()[contains(., '⌫')][last()]"/>
861 <variable name="comment">
862 <for-each select="$end-node/preceding-sibling::node()">
863 <value-of select="."/>
864 </for-each>
865 <value-of select="substring-before($end-node, '⌫')"/>
866 </variable>
867 <variable name="rest-fragment">
868 <element name="span" namespace="&xhtml;">
869 <value-of select="substring-after($end-node, '⌫')"/>
870 <copy-of select="$end-node/following-sibling::node()"/>
871 </element>
872 </variable>
873 <variable name="commented-rest-fragment">
874 <apply-templates select="exsl:node-set($rest-fragment)/node()" mode="LesML:comment"/>
875 </variable>
876 <copy>
877 <copy-of select="@*"/>
878 <copy-of select="$start-node/preceding-sibling::node()"/>
879 <copy-of select="substring-before($start-node, '⌦')"/>
880 <call-template name="LesML:comment-out">
881 <with-param name="source" select="string($comment)"/>
882 </call-template>
883 <copy-of select="exsl:node-set($commented-rest-fragment)/*/node()"/>
884 </copy>
885 </when>
886 <otherwise>
887 <copy>
888 <copy-of select="@*"/>
889 <apply-templates select="node()" mode="LesML:comment"/>
890 </copy>
891 </otherwise>
892 </choose>
893 </when>
894 <when test="self::text()[contains(., '⌧')]">
895 <variable name="split-fragment">
896 <call-template name="LesML:split">
897 <with-param name="source" select="string()"/>
898 <with-param name="separator" select="'⌧'"/>
899 </call-template>
900 </variable>
901 <for-each select="exsl:node-set($split-fragment)/node()">
902 <value-of select="."/>
903 <if test="position()!=last()">
904 <call-template name="LesML:comment-out"/>
905 </if>
906 </for-each>
907 </when>
908 <otherwise>
909 <copy-of select="."/>
910 </otherwise>
911 </choose>
912 </variable>
913 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:attrify"/>
914 </template>
915 <template match="node()" mode="LesML:inline">
916 <param name="element-name"/>
917 <param name="element-namespace" select="'http://www.w3.org/1999/xhtml'"/>
918 <param name="start-sigil"/>
919 <param name="end-sigil"/>
920 <param name="class"/>
921 <param name="role"/>
922 <choose>
923 <when test="self::*">
924 <variable name="end-node" select="text()[contains(., $end-sigil)][1]"/>
925 <variable name="has-start-node" select="$end-node/preceding-sibling::text()[contains(., $start-sigil)] or string-length(substring-after($end-node, $start-sigil))>string-length(substring-after($end-node, $end-sigil))"/>
926 <choose>
927 <when test="$end-node and $has-start-node">
928 <variable name="preceding">
929 <copy-of select="$end-node/preceding-sibling::node()"/>
930 <value-of select="substring-before($end-node, $end-sigil)"/>
931 </variable>
932 <variable name="start-node" select="exsl:node-set($preceding)/text()[contains(., $start-sigil)][last()]"/>
933 <variable name="start-tokens-fragment">
934 <call-template name="LesML:split">
935 <with-param name="source" select="string($start-node)"/>
936 <with-param name="separator" select="$start-sigil"/>
937 </call-template>
938 </variable>
939 <variable name="start-tokens" select="exsl:node-set($start-tokens-fragment)/*"/>
940 <variable name="wrapped">
941 <copy>
942 <copy-of select="@*"/>
943 <copy-of select="$start-node/preceding-sibling::node()"/>
944 <for-each select="$start-tokens[position()!=last()]">
945 <value-of select="."/>
946 <if test="position()!=last()">
947 <value-of select="$start-sigil"/>
948 </if>
949 </for-each>
950 <element name="{$element-name}" namespace="{$element-namespace}">
951 <if test="string($role)!=''">
952 <attribute name="role">
953 <value-of select="$role"/>
954 </attribute>
955 </if>
956 <if test="string($class)!=''">
957 <attribute name="class">
958 <value-of select="$class"/>
959 </attribute>
960 </if>
961 <value-of select="$start-tokens[last()]"/>
962 <copy-of select="$start-node/following-sibling::node()"/>
963 </element>
964 <value-of select="substring-after($end-node, $end-sigil)"/>
965 <copy-of select="$end-node/following-sibling::node()"/>
966 </copy>
967 </variable>
968 <apply-templates select="exsl:node-set($wrapped)/*" mode="LesML:inline">
969 <with-param name="element-name" select="$element-name"/>
970 <with-param name="element-namespace" select="$element-namespace"/>
971 <with-param name="start-sigil" select="$start-sigil"/>
972 <with-param name="end-sigil" select="$end-sigil"/>
973 <with-param name="role" select="$role"/>
974 </apply-templates>
975 </when>
976 <otherwise>
977 <copy>
978 <copy-of select="@*"/>
979 <apply-templates select="node()" mode="LesML:inline">
980 <with-param name="element-name" select="$element-name"/>
981 <with-param name="element-namespace" select="$element-namespace"/>
982 <with-param name="start-sigil" select="$start-sigil"/>
983 <with-param name="end-sigil" select="$end-sigil"/>
984 <with-param name="role" select="$role"/>
985 </apply-templates>
986 </copy>
987 </otherwise>
988 </choose>
989 </when>
990 <otherwise>
991 <copy-of select="."/>
992 </otherwise>
993 </choose>
994 </template>
995 <template match="*" mode="LesML:partition">
996 <param name="start-sigil"/>
997 <param name="end-sigil"/>
998 <param name="separator"/>
999 <param name="ncname-keys" select="false()"/>
1000 <variable name="end-node" select="text()[contains(., $end-sigil)][1]"/>
1001 <variable name="has-start-node" select="$end-node/preceding-sibling::text()[contains(., $start-sigil) and not(following-sibling::* or following-sibling::comment())] or string-length(substring-after($end-node, $start-sigil))>string-length(substring-after($end-node, $end-sigil))"/>
1002 <choose>
1003 <when test="$end-node and $has-start-node">
1004 <variable name="preceding">
1005 <copy-of select="$end-node/preceding-sibling::node()"/>
1006 <value-of select="substring-before($end-node, $end-sigil)"/>
1007 </variable>
1008 <variable name="start-node" select="exsl:node-set($preceding)/text()[contains(., $start-sigil) and not(following-sibling::*)][last()]"/>
1009 <variable name="start-tokens-fragment">
1010 <call-template name="LesML:split">
1011 <with-param name="source" select="string($start-node)"/>
1012 <with-param name="separator" select="$start-sigil"/>
1013 </call-template>
1014 </variable>
1015 <variable name="start-tokens" select="exsl:node-set($start-tokens-fragment)/*"/>
1016 <variable name="innards">
1017 <value-of select="$start-tokens[last()]"/>
1018 <for-each select="$start-node/following-sibling::node()">
1019 <value-of select="."/>
1020 </for-each>
1021 </variable>
1022 <choose>
1023 <when test="contains($innards, $separator)">
1024 <variable name="keyval-fragment">
1025 <call-template name="LesML:split">
1026 <with-param name="source" select="$innards"/>
1027 <with-param name="separator" select="$separator"/>
1028 </call-template>
1029 </variable>
1030 <variable name="keyval" select="exsl:node-set($keyval-fragment)/*"/>
1031 <variable name="key">
1032 <choose>
1033 <when test="$ncname-keys">
1034 <value-of select="$keyval[1]"/>
1035 </when>
1036 <otherwise>
1037 <for-each select="$keyval[position()!=last()]">
1038 <value-of select="."/>
1039 <if test="position()!=last()">
1040 <value-of select="$separator"/>
1041 </if>
1042 </for-each>
1043 </otherwise>
1044 </choose>
1045 </variable>
1046 <variable name="value">
1047 <choose>
1048 <when test="$ncname-keys">
1049 <for-each select="$keyval[position()!=1]">
1050 <value-of select="."/>
1051 <if test="position()!=last()">
1052 <value-of select="$separator"/>
1053 </if>
1054 </for-each>
1055 </when>
1056 <otherwise>
1057 <value-of select="$keyval[last()]"/>
1058 </otherwise>
1059 </choose>
1060 </variable>
1061 <choose>
1062 <when test="not($ncname-keys) or /self::node()[translate(normalize-space($key), ' /([,*', '')=string($key) and exsldyn:evaluate(concat('not(self::html:', $key, ')'))]">
1063 <element name="span" namespace="&xhtml;">
1064 <copy-of select="$start-node/preceding-sibling::node()"/>
1065 <for-each select="$start-tokens[position()!=last()]">
1066 <value-of select="."/>
1067 <if test="position()!=last()">
1068 <value-of select="$start-sigil"/>
1069 </if>
1070 </for-each>
1071 </element>
1072 <element name="span" namespace="&xhtml;">
1073 <value-of select="$key"/>
1074 </element>
1075 <element name="span" namespace="&xhtml;">
1076 <value-of select="$value"/>
1077 </element>
1078 <element name="span" namespace="&xhtml;">
1079 <value-of select="substring-after($end-node, $end-sigil)"/>
1080 <copy-of select="$end-node/following-sibling::node()"/>
1081 </element>
1082 </when>
1083 <otherwise>
1084 <element name="span" namespace="&xhtml;">
1085 <copy-of select="$start-node/preceding-sibling::node()"/>
1086 <for-each select="$start-tokens[position()!=last()]">
1087 <value-of select="."/>
1088 <if test="position()!=last()">
1089 <value-of select="$start-sigil"/>
1090 </if>
1091 </for-each>
1092 <processing-instruction name="LesML-Token-Escape">
1093 <value-of select="$start-sigil"/>
1094 </processing-instruction>
1095 <value-of select="$start-tokens[last()]"/>
1096 <value-of select="$start-node/following-sibling::node()"/>
1097 <value-of select="$end-sigil"/>
1098 <value-of select="substring-after($end-node, $end-sigil)"/>
1099 <copy-of select="$end-node/following-sibling::node()"/>
1100 </element>
1101 </otherwise>
1102 </choose>
1103 </when>
1104 <otherwise>
1105 <element name="span" namespace="&xhtml;">
1106 <copy-of select="$start-node/preceding-sibling::node()"/>
1107 <for-each select="$start-tokens[position()!=last()]">
1108 <value-of select="."/>
1109 <if test="position()!=last()">
1110 <value-of select="$start-sigil"/>
1111 </if>
1112 </for-each>
1113 <processing-instruction name="LesML-Token-Escape">
1114 <value-of select="$start-sigil"/>
1115 </processing-instruction>
1116 <value-of select="$start-tokens[last()]"/>
1117 <value-of select="$start-node/following-sibling::node()"/>
1118 <value-of select="$end-sigil"/>
1119 <value-of select="substring-after($end-node, $end-sigil)"/>
1120 <copy-of select="$end-node/following-sibling::node()"/>
1121 </element>
1122 </otherwise>
1123 </choose>
1124 </when>
1125 <when test="$end-node">
1126 <element name="span" namespace="&xhtml;">
1127 <copy-of select="$end-node/preceding-sibling::node()"/>
1128 <value-of select="substring-before($end-node, $end-sigil)"/>
1129 <processing-instruction name="LesML-Token-Escape">
1130 <value-of select="$end-sigil"/>
1131 </processing-instruction>
1132 <value-of select="substring-after($end-node, $end-sigil)"/>
1133 <copy-of select="$end-node/following-sibling::node()"/>
1134 </element>
1135 </when>
1136 <otherwise>
1137 <processing-instruction name="LesML-All-Done"/>
1138 </otherwise>
1139 </choose>
1140 </template>
1141 <template match="node()" mode="LesML:attrify">
1142 <variable name="result">
1143 <choose>
1144 <when test="self::*">
1145 <variable name="partitioned-fragment">
1146 <apply-templates mode="LesML:partition" select=".">
1147 <with-param name="start-sigil" select="'{@'"/>
1148 <with-param name="end-sigil" select="'&quot;}'"/>
1149 <with-param name="separator" select="'=&quot;'"/>
1150 <with-param name="ncname-keys" select="true()"/>
1151 </apply-templates>
1152 </variable>
1153 <variable name="partitioned" select="exsl:node-set($partitioned-fragment)/node()"/>
1154 <choose>
1155 <when test="count($partitioned)>1">
1156 <variable name="processed">
1157 <copy>
1158 <copy-of select="@*"/>
1159 <copy-of select="$partitioned[1]/node()"/>
1160 <element name="LesML:attribute" namespace="&LesML;">
1161 <attribute name="{$partitioned[2]}">
1162 <value-of select="$partitioned[3]"/>
1163 </attribute>
1164 </element>
1165 <copy-of select="$partitioned[4]/node()"/>
1166 </copy>
1167 </variable>
1168 <apply-templates select="exsl:node-set($processed)/node()" mode="LesML:attrify"/>
1169 </when>
1170 <when test="$partitioned[self::processing-instruction() and local-name()='LesML-All-Done']">
1171 <copy>
1172 <copy-of select="@*"/>
1173 <apply-templates select="node()" mode="LesML:attrify"/>
1174 </copy>
1175 </when>
1176 <otherwise>
1177 <variable name="processed">
1178 <copy>
1179 <copy-of select="@*"/>
1180 <copy-of select="$partitioned/node()"/>
1181 </copy>
1182 </variable>
1183 <apply-templates select="exsl:node-set($processed)/node()" mode="LesML:attrify"/>
1184 </otherwise>
1185 </choose>
1186 </when>
1187 <otherwise>
1188 <copy-of select="."/>
1189 </otherwise>
1190 </choose>
1191 </variable>
1192 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:linkify"/>
1193 </template>
1194 <template match="node()" mode="LesML:linkify">
1195 <variable name="result">
1196 <choose>
1197 <when test="processing-instruction()[local-name()='LesML-All-Done']">
1198 <copy>
1199 <copy-of select="@*|node()[not(self::processing-instruction() and local-name()='LesML-All-Done')]"/>
1200 </copy>
1201 </when>
1202 <when test="self::*">
1203 <variable name="partitioned-fragment">
1204 <apply-templates mode="LesML:partition" select=".">
1205 <with-param name="start-sigil" select="'{🔗'"/>
1206 <with-param name="end-sigil" select="'>}'"/>
1207 <with-param name="separator" select="'&lt;'"/>
1208 </apply-templates>
1209 </variable>
1210 <variable name="partitioned" select="exsl:node-set($partitioned-fragment)/node()"/>
1211 <choose>
1212 <when test="count($partitioned)>1">
1213 <variable name="processed">
1214 <copy>
1215 <copy-of select="@*"/>
1216 <copy-of select="$partitioned[1]/node()"/>
1217 <element name="a" namespace="&xhtml;">
1218 <attribute name="href">
1219 <value-of select="$partitioned[3]"/>
1220 </attribute>
1221 <processing-instruction name="LesML-All-Done"/>
1222 <choose>
1223 <when test="string($partitioned[2])=''">
1224 <value-of select="$partitioned[3]"/>
1225 </when>
1226 <otherwise>
1227 <value-of select="$partitioned[2]"/>
1228 </otherwise>
1229 </choose>
1230 </element>
1231 <copy-of select="$partitioned[4]/node()"/>
1232 </copy>
1233 </variable>
1234 <apply-templates select="exsl:node-set($processed)/node()" mode="LesML:linkify"/>
1235 </when>
1236 <when test="$partitioned[self::processing-instruction() and local-name()='LesML-All-Done']">
1237 <copy>
1238 <copy-of select="@*"/>
1239 <apply-templates select="node()" mode="LesML:linkify"/>
1240 </copy>
1241 </when>
1242 <otherwise>
1243 <variable name="processed">
1244 <copy>
1245 <copy-of select="@*"/>
1246 <copy-of select="$partitioned/node()"/>
1247 </copy>
1248 </variable>
1249 <apply-templates select="exsl:node-set($processed)/node()" mode="LesML:linkify"/>
1250 </otherwise>
1251 </choose>
1252 </when>
1253 <otherwise>
1254 <copy-of select="."/>
1255 </otherwise>
1256 </choose>
1257 </variable>
1258 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:strikethrough"/>
1259 </template>
1260 <template match="node()" mode="LesML:strikethrough">
1261 <variable name="result">
1262 <apply-templates select="." mode="LesML:inline">
1263 <with-param name="element-name" select="'s'"/>
1264 <with-param name="element-namespace" select="'&xhtml;'"/>
1265 <with-param name="start-sigil" select="'⸠'"/>
1266 <with-param name="end-sigil" select="'⸡'"/>
1267 </apply-templates>
1268 </variable>
1269 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:underline"/>
1270 </template>
1271 <template match="node()" mode="LesML:underline">
1272 <variable name="result">
1273 <apply-templates select="." mode="LesML:inline">
1274 <with-param name="element-name" select="'u'"/>
1275 <with-param name="element-namespace" select="'&xhtml;'"/>
1276 <with-param name="start-sigil" select="'⸤'"/>
1277 <with-param name="end-sigil" select="'⸥'"/>
1278 </apply-templates>
1279 </variable>
1280 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:noted"/>
1281 </template>
1282 <template match="node()" mode="LesML:noted">
1283 <variable name="result">
1284 <apply-templates select="." mode="LesML:inline">
1285 <with-param name="element-name" select="'small'"/>
1286 <with-param name="element-namespace" select="'&xhtml;'"/>
1287 <with-param name="start-sigil" select="'⟦'"/>
1288 <with-param name="end-sigil" select="'⟧'"/>
1289 <with-param name="role" select="'note'"/>
1290 </apply-templates>
1291 </variable>
1292 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:parenthetical"/>
1293 </template>
1294 <template match="node()" mode="LesML:parenthetical">
1295 <variable name="result">
1296 <apply-templates select="." mode="LesML:inline">
1297 <with-param name="element-name" select="'small'"/>
1298 <with-param name="element-namespace" select="'&xhtml;'"/>
1299 <with-param name="start-sigil" select="'⸨'"/>
1300 <with-param name="end-sigil" select="'⸩'"/>
1301 </apply-templates>
1302 </variable>
1303 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:code"/>
1304 </template>
1305 <template match="node()" mode="LesML:code">
1306 <variable name="result">
1307 <apply-templates select="." mode="LesML:inline">
1308 <with-param name="element-name" select="'code'"/>
1309 <with-param name="element-namespace" select="'&xhtml;'"/>
1310 <with-param name="start-sigil" select="'`'"/>
1311 <with-param name="end-sigil" select="'´'"/>
1312 </apply-templates>
1313 </variable>
1314 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:titled"/>
1315 </template>
1316 <template match="node()" mode="LesML:titled">
1317 <variable name="result">
1318 <apply-templates select="." mode="LesML:inline">
1319 <with-param name="element-name" select="'cite'"/>
1320 <with-param name="element-namespace" select="'&xhtml;'"/>
1321 <with-param name="start-sigil" select="'⟪'"/>
1322 <with-param name="end-sigil" select="'⟫'"/>
1323 </apply-templates>
1324 </variable>
1325 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:named"/>
1326 </template>
1327 <template match="node()" mode="LesML:named">
1328 <variable name="result">
1329 <apply-templates select="." mode="LesML:inline">
1330 <with-param name="element-name" select="'u'"/>
1331 <with-param name="element-namespace" select="'&xhtml;'"/>
1332 <with-param name="start-sigil" select="'⸶'"/>
1333 <with-param name="end-sigil" select="'⸷'"/>
1334 <with-param name="class" select="'name'"/>
1335 </apply-templates>
1336 </variable>
1337 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:offset"/>
1338 </template>
1339 <template match="node()" mode="LesML:offset">
1340 <variable name="result">
1341 <apply-templates select="." mode="LesML:inline">
1342 <with-param name="element-name" select="'i'"/>
1343 <with-param name="element-namespace" select="'&xhtml;'"/>
1344 <with-param name="start-sigil" select="'⟨'"/>
1345 <with-param name="end-sigil" select="'⟩'"/>
1346 </apply-templates>
1347 </variable>
1348 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:bolded"/>
1349 </template>
1350 <template match="node()" mode="LesML:bolded">
1351 <variable name="result">
1352 <apply-templates select="." mode="LesML:inline">
1353 <with-param name="element-name" select="'b'"/>
1354 <with-param name="element-namespace" select="'&xhtml;'"/>
1355 <with-param name="start-sigil" select="'⦃'"/>
1356 <with-param name="end-sigil" select="'⦄'"/>
1357 </apply-templates>
1358 </variable>
1359 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:important"/>
1360 </template>
1361 <template match="node()" mode="LesML:important">
1362 <variable name="result">
1363 <apply-templates select="." mode="LesML:inline">
1364 <with-param name="element-name" select="'strong'"/>
1365 <with-param name="element-namespace" select="'&xhtml;'"/>
1366 <with-param name="start-sigil" select="'☞'"/>
1367 <with-param name="end-sigil" select="'☜'"/>
1368 </apply-templates>
1369 </variable>
1370 <apply-templates select="exsl:node-set($result)/node()" mode="LesML:emphasized"/>
1371 </template>
1372 <template match="node()" mode="LesML:emphasized">
1373 <apply-templates select="." mode="LesML:inline">
1374 <with-param name="element-name" select="'em'"/>
1375 <with-param name="element-namespace" select="'&xhtml;'"/>
1376 <with-param name="start-sigil" select="'⹐'"/>
1377 <with-param name="end-sigil" select="'⹑'"/>
1378 </apply-templates>
1379 </template>
1380 </transform>
This page took 0.127891 seconds and 3 git commands to generate.