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