]> Lady’s Gitweb - LesML/blobdiff - parser.xslt
Quotes and brackets as multiparagraph divisions
[LesML] / parser.xslt
index f6b38231a9d7d7f0aac4e5739595ed2342fb3aa1..99ee7434f534aec464594df038b17656e7ccf157 100644 (file)
@@ -13,9 +13,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 -->
 <!DOCTYPE transform [
        <!ENTITY LesML "urn:fdc:ladys.computer:20240512:LesML">
-       <!ENTITY section-break "*-.=_~·․‥…⁂⋯─━┄┅┈┉╌╍═╴╶╸╺☙❧ ・*-.=_~">
-       <!ENTITY sigiled-text "(string-length($text)=1 or substring($text, 2, 1)=' ')">
-       <!ENTITY unsigiled-text "substring($text, 3, string-length($text)-2)">
+       <!ENTITY section-break "">
+       <!ENTITY sigiled-text "(string-length($text)=1 or substring($text, 2, 1)=' ' or substring($text, 2, 1)='¶')">
+       <!ENTITY unsigiled-text "concat(translate(substring($text, 2, 1), ' ', ''), substring($text, 3, string-length($text)-2))">
        <!ENTITY xhtml "http://www.w3.org/1999/xhtml">
 ]>
 <transform
@@ -32,6 +32,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
        version="1.0"
 >
        <书社:id>urn:fdc:ladys.computer:20240512:LesML:parser.xslt</书社:id>
+       <param name="LESML_SECTION_BREAK_CHARS" select="'*-.=_~·․‥…⁂⋯─━┄┅┈┉╌╍═╴╶╸╺☙❧ ・*-.=_~'"/>
        <template name="LesML:split">
                <param name="source"/>
                <param name="separator" select="'&#xA;'"/>
@@ -121,31 +122,96 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                        </otherwise>
                </choose>
        </template>
+       <template name="LesML:comment-out">
+               <param name="source"/>
+               <variable name="comment-split-fragment">
+                       <call-template name="LesML:split">
+                               <with-param name="source" select="$source"/>
+                               <with-param name="separator" select="'--'"/>
+                       </call-template>
+               </variable>
+               <comment>
+                       <for-each select="exsl:node-set($comment-split-fragment)/*">
+                               <if test="string()='' or starts-with(., '‐')">
+                                       <text>&#x034F;</text>
+                               </if>
+                               <value-of select="."/>
+                               <if test="substring(., string-length(.), 1)='‐'">
+                                       <text>&#x034F;</text>
+                               </if>
+                               <choose>
+                                       <when test="position()!=last()">
+                                               <text>-&#x034F;-</text>
+                                       </when>
+                               </choose>
+                       </for-each>
+               </comment>
+       </template>
        <template name="LesML:id-and-contents">
                <param name="source"/>
-               <choose>
-                       <when test="starts-with($source, '¶')">
+               <variable name="id-and-lang">
+                       <if test="starts-with($source, '¶')">
                                <choose>
                                        <when test="contains($source, ' ')">
-                                               <variable name="id" select="substring-before(substring-after($source, '¶'), ' ')"/>
-                                               <if test="$id!=''">
-                                                       <attribute name="id">
-                                                               <value-of select="$id"/>
-                                                       </attribute>
-                                               </if>
-                                               <value-of select="substring-after($source, ' ')"/>
+                                               <value-of select="substring-before(substring-after($source, '¶'), ' ')"/>
                                        </when>
                                        <otherwise>
-                                               <attribute name="id">
-                                                       <value-of select="substring-after($source, '¶')"/>
-                                               </attribute>
+                                               <value-of select="substring-after($source, '¶')"/>
                                        </otherwise>
                                </choose>
-                       </when>
-                       <otherwise>
-                               <value-of select="$source"/>
-                       </otherwise>
-               </choose>
+                       </if>
+               </variable>
+               <variable name="restoftext">
+                       <choose>
+                               <when test="starts-with($source, '¶') and contains($source, ' ')">
+                                       <value-of select="substring-after($source, ' ')"/>
+                               </when>
+                               <when test="starts-with($source, '¶')"/>
+                               <otherwise>
+                                       <value-of select="$source"/>
+                               </otherwise>
+                       </choose>
+               </variable>
+               <variable name="maybe-langtag">
+                       <if test="substring($id-and-lang, string-length($id-and-lang), 1)='$' and contains($id-and-lang, '@')">
+                               <variable name="split-tag-fragment">
+                                       <call-template name="LesML:split">
+                                               <with-param name="source" select="substring($id-and-lang, 2, string-length($id-and-lang)-2)"/>
+                                               <with-param name="separator" select="'@'"/>
+                                       </call-template>
+                               </variable>
+                               <value-of select="exsl:node-set($split-tag-fragment)/*[last()]"/>
+                       </if>
+               </variable>
+               <variable name="langtag">
+                       <if test="translate($maybe-langtag, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-', '')=''">
+                               <value-of select="$maybe-langtag"/>
+                       </if>
+               </variable>
+               <variable name="id">
+                       <choose>
+                               <when test="string($langtag)!=''">
+                                       <value-of select="substring($id-and-lang, 1, string-length($id-and-lang)-(string-length($langtag)+2))"/>
+                               </when>
+                               <otherwise>
+                                       <value-of select="$id-and-lang"/>
+                               </otherwise>
+                       </choose>
+               </variable>
+               <if test="string($id)!=''">
+                       <attribute name="id">
+                               <value-of select="$id"/>
+                       </attribute>
+               </if>
+               <if test="string($langtag)!=''">
+                       <attribute name="lang">
+                               <value-of select="$langtag"/>
+                       </attribute>
+                       <attribute name="xml:lang">
+                               <value-of select="$langtag"/>
+                       </attribute>
+               </if>
+               <value-of select="$restoftext"/>
        </template>
        <template name="LesML:parse">
                <param name="lines" select="/.."/>
@@ -217,9 +283,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                <variable name="docsep" select="$noshebang[starts-with(., '#!lesml') or starts-with(., '##')][1]"/>
                <variable name="doclines" select="exslset:leading($noshebang, $docsep)"/>
                <if test="starts-with($first-line, '##') and $first-line!='##'">
-                       <comment>
-                               <value-of select="substring-after($first-line, '##')"/>
-                       </comment>
+                       <call-template name="LesML:comment-out">
+                               <with-param name="source" select="substring-after($first-line, '##')"/>
+                       </call-template>
                </if>
                <if test="$doclines[normalize-space()!='']">
                        <variable name="record-separators" select="$doclines[starts-with(., '%%')]"/>
@@ -295,9 +361,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                                </element>
                                                        </if>
                                                        <if test=".!='%%'">
-                                                               <comment>
-                                                                       <value-of select="substring-after(., '%%')"/>
-                                                               </comment>
+                                                               <call-template name="LesML:comment-out">
+                                                                       <with-param name="source" select="substring-after(., '%%')"/>
+                                                               </call-template>
                                                        </if>
                                                </for-each>
                                        </element>
@@ -319,317 +385,364 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                        </call-template>
                </if>
        </template>
-       <template name="LesML:paragraphize">
+       <template name="LesML:block">
                <param name="lines" select="/.."/>
-               <variable name="last-lines" select="$lines[normalize-space()!='' and normalize-space(following-sibling::*[1])='']|$lines[last()]"/>
-               <variable name="blocked">
-                       <for-each select="$last-lines">
-                               <variable name="position" select="position()"/>
-                               <variable name="prev-last" select="$last-lines[($position)-1]"/>
-                               <variable name="linespans" select="(exslset:intersection(exslset:trailing($lines, $prev-last), exslset:leading($lines, .))|.)[normalize-space()!='']"/>
-                               <variable name="quoted" select="not($linespans[not(starts-with(., ' ') or starts-with(., '&#x9;'))])"/>
-                               <variable name="preformatted" select="not($linespans[not(starts-with(normalize-space(), '|'))])"/>
-                               <variable name="text">
-                                       <for-each select="$linespans">
-                                               <choose>
-                                                       <when test="$preformatted">
-                                                               <value-of select="substring-after(., '|')"/>
-                                                       </when>
-                                                       <otherwise>
-                                                               <value-of select="normalize-space()"/>
-                                                       </otherwise>
-                                               </choose>
-                                               <if test="position()!=count($linespans)">
+               <variable name="last-lines" select="$lines[normalize-space()!='' and (normalize-space(following-sibling::*[1])='' or position()=last())]"/>
+               <for-each select="$last-lines">
+                       <variable name="position" select="position()"/>
+                       <variable name="prev-last" select="$last-lines[($position)-1]"/>
+                       <variable name="linespans" select="(exslset:intersection(exslset:trailing($lines, $prev-last), exslset:leading($lines, .))|.)[normalize-space()!='']"/>
+                       <variable name="prefix" select="substring(translate(., ' &#x9;', ''), 1, 1)"/>
+                       <variable name="all-prefixed" select="not($linespans[not(starts-with(translate(., ' &#x9;', ''), $prefix))])"/>
+                       <variable name="quoted" select="$all-prefixed and $prefix='»'"/>
+                       <variable name="bracketed" select="$all-prefixed and $prefix=']'"/>
+                       <choose>
+                               <when test="count($linespans)=1 and translate(., concat($LESML_SECTION_BREAK_CHARS, ' &#x9;'), '')=''">
+                                       <element name="hr" namespace="&xhtml;"/>
+                               </when>
+                               <when test="$quoted or $bracketed">
+                                       <variable name="innerlines-fragment">
+                                               <for-each select="$linespans">
+                                                       <variable name="inner">
+                                                               <value-of select="substring-after(., $prefix)"/>
+                                                       </variable>
+                                                       <copy>
+                                                               <choose>
+                                                                       <when test="starts-with($inner, ' ') or starts-with($inner, '&#x9;')">
+                                                                               <value-of select="substring($inner, 1+count(exslstr:tokenize($inner, '')[normalize-space()='' and not(preceding-sibling::*[normalize-space()!=''])]))"/>
+                                                                       </when>
+                                                                       <otherwise>
+                                                                               <value-of select="$inner"/>
+                                                                       </otherwise>
+                                                               </choose>
+                                                       </copy>
+                                               </for-each>
+                                       </variable>
+                                       <variable name="blocked-fragment">
+                                               <call-template name="LesML:block">
+                                                       <with-param name="lines" select="exsl:node-set($innerlines-fragment)/*"/>
+                                               </call-template>
+                                       </variable>
+                                       <variable name="innerpars" select="exsl:node-set($blocked-fragment)/node()"/>
+                                       <choose>
+                                               <when test="$quoted and $innerpars[position()=last() and self::html:footer]">
+                                                       <element name="figure" namespace="&xhtml;">
+                                                               <element name="blockquote" namespace="&xhtml;">
+                                                                       <copy-of select="$innerpars[position()!=last()]"/>
+                                                               </element>
+                                                               <element name="figcaption" namespace="&xhtml;">
+                                                                       <copy-of select="$innerpars[last()]/node()"/>
+                                                               </element>
+                                                       </element>
+                                               </when>
+                                               <when test="$quoted">
+                                                       <element name="blockquote" namespace="&xhtml;">
+                                                               <copy-of select="$innerpars"/>
+                                                       </element>
+                                               </when>
+                                               <when test="$bracketed">
+                                                       <element name="footer" namespace="&xhtml;">
+                                                               <copy-of select="$innerpars"/>
+                                                       </element>
+                                               </when>
+                                       </choose>
+                               </when>
+                               <otherwise>
+                                       <variable name="preformatted" select="$all-prefixed and $prefix='|'"/>
+                                       <variable name="text">
+                                               <for-each select="$linespans">
                                                        <choose>
                                                                <when test="$preformatted">
-                                                                       <text>&#xA;</text>
+                                                                       <value-of select="substring-after(., '|')"/>
                                                                </when>
                                                                <otherwise>
-                                                                       <text> </text>
+                                                                       <value-of select="normalize-space()"/>
                                                                </otherwise>
                                                        </choose>
-                                               </if>
-                                       </for-each>
-                               </variable>
-                               <if test="string($text)!=''">
-                                       <variable name="par">
-                                               <choose>
-                                                       <when test="$preformatted">
-                                                               <element name="pre" namespace="&xhtml;">
+                                                       <if test="position()!=count($linespans)">
+                                                               <choose>
+                                                                       <when test="$preformatted">
+                                                                               <text>&#xA;</text>
+                                                                       </when>
+                                                                       <otherwise>
+                                                                               <text> </text>
+                                                                       </otherwise>
+                                                               </choose>
+                                                       </if>
+                                               </for-each>
+                                       </variable>
+                                       <choose>
+                                               <when test="$preformatted">
+                                                       <element name="pre" namespace="&xhtml;">
+                                                               <call-template name="LesML:id-and-contents">
+                                                                       <with-param name="source" select="$text"/>
+                                                               </call-template>
+                                                       </element>
+                                               </when>
+                                               <when test="string($text)=''"/>
+                                               <when test="starts-with($text, '⁌') and &sigiled-text;">
+                                                       <element name="h1" namespace="&xhtml;">
+                                                               <call-template name="LesML:id-and-contents">
+                                                                       <with-param name="source" select="&unsigiled-text;"/>
+                                                               </call-template>
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '§') and &sigiled-text;">
+                                                       <element name="h2" namespace="&xhtml;">
+                                                               <call-template name="LesML:id-and-contents">
+                                                                       <with-param name="source" select="&unsigiled-text;"/>
+                                                               </call-template>
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '❦') and &sigiled-text;">
+                                                       <element name="h3" namespace="&xhtml;">
+                                                               <call-template name="LesML:id-and-contents">
+                                                                       <with-param name="source" select="&unsigiled-text;"/>
+                                                               </call-template>
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '✠') and &sigiled-text;">
+                                                       <element name="h4" namespace="&xhtml;">
+                                                               <call-template name="LesML:id-and-contents">
+                                                                       <with-param name="source" select="&unsigiled-text;"/>
+                                                               </call-template>
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '•') and &sigiled-text;">
+                                                       <element name="li" namespace="&xhtml;">
+                                                               <attribute name="class">
+                                                                       <text>unordered</text>
+                                                               </attribute>
+                                                               <attribute name="data-level">
+                                                                       <text>1</text>
+                                                               </attribute>
+                                                               <element name="p" namespace="&xhtml;">
                                                                        <call-template name="LesML:id-and-contents">
-                                                                               <with-param name="source" select="$text"/>
+                                                                               <with-param name="source" select="&unsigiled-text;"/>
                                                                        </call-template>
                                                                </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '⁌') and &sigiled-text;">
-                                                               <element name="h1" namespace="&xhtml;">
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '🔢') and &sigiled-text;">
+                                                       <element name="li" namespace="&xhtml;">
+                                                               <attribute name="class">
+                                                                       <text>ordered</text>
+                                                               </attribute>
+                                                               <attribute name="data-level">
+                                                                       <text>1</text>
+                                                               </attribute>
+                                                               <element name="p" namespace="&xhtml;">
                                                                        <call-template name="LesML:id-and-contents">
                                                                                <with-param name="source" select="&unsigiled-text;"/>
                                                                        </call-template>
                                                                </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '§') and &sigiled-text;">
-                                                               <element name="h2" namespace="&xhtml;">
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '◦') and &sigiled-text;">
+                                                       <element name="li" namespace="&xhtml;">
+                                                               <attribute name="class">
+                                                                       <text>unordered</text>
+                                                               </attribute>
+                                                               <attribute name="data-level">
+                                                                       <text>2</text>
+                                                               </attribute>
+                                                               <element name="p" namespace="&xhtml;">
                                                                        <call-template name="LesML:id-and-contents">
                                                                                <with-param name="source" select="&unsigiled-text;"/>
                                                                        </call-template>
                                                                </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '❦') and &sigiled-text;">
-                                                               <element name="h3" namespace="&xhtml;">
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '🔠') and &sigiled-text;">
+                                                       <element name="li" namespace="&xhtml;">
+                                                               <attribute name="class">
+                                                                       <text>ordered</text>
+                                                               </attribute>
+                                                               <attribute name="data-level">
+                                                                       <text>2</text>
+                                                               </attribute>
+                                                               <element name="p" namespace="&xhtml;">
                                                                        <call-template name="LesML:id-and-contents">
                                                                                <with-param name="source" select="&unsigiled-text;"/>
                                                                        </call-template>
                                                                </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '✠') and &sigiled-text;">
-                                                               <element name="h4" namespace="&xhtml;">
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '▪') and &sigiled-text;">
+                                                       <element name="li" namespace="&xhtml;">
+                                                               <attribute name="class">
+                                                                       <text>unordered</text>
+                                                               </attribute>
+                                                               <attribute name="data-level">
+                                                                       <text>3</text>
+                                                               </attribute>
+                                                               <element name="p" namespace="&xhtml;">
                                                                        <call-template name="LesML:id-and-contents">
                                                                                <with-param name="source" select="&unsigiled-text;"/>
                                                                        </call-template>
                                                                </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '•') and &sigiled-text;">
-                                                               <element name="li" namespace="&xhtml;">
-                                                                       <attribute name="class">
-                                                                               <text>unordered</text>
-                                                                       </attribute>
-                                                                       <attribute name="data-level">
-                                                                               <text>1</text>
-                                                                       </attribute>
-                                                                       <element name="p" namespace="&xhtml;">
-                                                                               <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="&unsigiled-text;"/>
-                                                                               </call-template>
-                                                                       </element>
-                                                               </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '🔢') and &sigiled-text;">
-                                                               <element name="li" namespace="&xhtml;">
-                                                                       <attribute name="class">
-                                                                               <text>ordered</text>
-                                                                       </attribute>
-                                                                       <attribute name="data-level">
-                                                                               <text>1</text>
-                                                                       </attribute>
-                                                                       <element name="p" namespace="&xhtml;">
-                                                                               <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="&unsigiled-text;"/>
-                                                                               </call-template>
-                                                                       </element>
-                                                               </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '◦') and &sigiled-text;">
-                                                               <element name="li" namespace="&xhtml;">
-                                                                       <attribute name="class">
-                                                                               <text>unordered</text>
-                                                                       </attribute>
-                                                                       <attribute name="data-level">
-                                                                               <text>2</text>
-                                                                       </attribute>
-                                                                       <element name="p" namespace="&xhtml;">
-                                                                               <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="&unsigiled-text;"/>
-                                                                               </call-template>
-                                                                       </element>
-                                                               </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '🔠') and &sigiled-text;">
-                                                               <element name="li" namespace="&xhtml;">
-                                                                       <attribute name="class">
-                                                                               <text>ordered</text>
-                                                                       </attribute>
-                                                                       <attribute name="data-level">
-                                                                               <text>2</text>
-                                                                       </attribute>
-                                                                       <element name="p" namespace="&xhtml;">
-                                                                               <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="&unsigiled-text;"/>
-                                                                               </call-template>
-                                                                       </element>
-                                                               </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '▪') and &sigiled-text;">
-                                                               <element name="li" namespace="&xhtml;">
-                                                                       <attribute name="class">
-                                                                               <text>unordered</text>
-                                                                       </attribute>
-                                                                       <attribute name="data-level">
-                                                                               <text>3</text>
-                                                                       </attribute>
-                                                                       <element name="p" namespace="&xhtml;">
-                                                                               <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="&unsigiled-text;"/>
-                                                                               </call-template>
-                                                                       </element>
-                                                               </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '🔡') and &sigiled-text;">
-                                                               <element name="li" namespace="&xhtml;">
-                                                                       <attribute name="class">
-                                                                               <text>ordered</text>
-                                                                       </attribute>
-                                                                       <attribute name="data-level">
-                                                                               <text>3</text>
-                                                                       </attribute>
-                                                                       <element name="p" namespace="&xhtml;">
-                                                                               <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="&unsigiled-text;"/>
-                                                                               </call-template>
-                                                                       </element>
-                                                               </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '⁃') and &sigiled-text;">
-                                                               <element name="li" namespace="&xhtml;">
-                                                                       <attribute name="class">
-                                                                               <text>unordered</text>
-                                                                       </attribute>
-                                                                       <attribute name="data-level">
-                                                                               <text>4</text>
-                                                                       </attribute>
-                                                                       <element name="p" namespace="&xhtml;">
-                                                                               <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="&unsigiled-text;"/>
-                                                                               </call-template>
-                                                                       </element>
-                                                               </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '🔣') and &sigiled-text;">
-                                                               <element name="li" namespace="&xhtml;">
-                                                                       <attribute name="class">
-                                                                               <text>ordered</text>
-                                                                       </attribute>
-                                                                       <attribute name="data-level">
-                                                                               <text>4</text>
-                                                                       </attribute>
-                                                                       <element name="p" namespace="&xhtml;">
-                                                                               <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="&unsigiled-text;"/>
-                                                                               </call-template>
-                                                                       </element>
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '🔡') and &sigiled-text;">
+                                                       <element name="li" namespace="&xhtml;">
+                                                               <attribute name="class">
+                                                                       <text>ordered</text>
+                                                               </attribute>
+                                                               <attribute name="data-level">
+                                                                       <text>3</text>
+                                                               </attribute>
+                                                               <element name="p" namespace="&xhtml;">
+                                                                       <call-template name="LesML:id-and-contents">
+                                                                               <with-param name="source" select="&unsigiled-text;"/>
+                                                                       </call-template>
                                                                </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '🛈') and &sigiled-text;">
-                                                               <element name="div" namespace="&xhtml;">
-                                                                       <attribute name="role">
-                                                                               <text>note</text>
-                                                                       </attribute>
-                                                                       <attribute name="class">
-                                                                               <text>info</text>
-                                                                       </attribute>
-                                                                       <element name="p" namespace="&xhtml;">
-                                                                               <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="&unsigiled-text;"/>
-                                                                               </call-template>
-                                                                       </element>
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '⁃') and &sigiled-text;">
+                                                       <element name="li" namespace="&xhtml;">
+                                                               <attribute name="class">
+                                                                       <text>unordered</text>
+                                                               </attribute>
+                                                               <attribute name="data-level">
+                                                                       <text>4</text>
+                                                               </attribute>
+                                                               <element name="p" namespace="&xhtml;">
+                                                                       <call-template name="LesML:id-and-contents">
+                                                                               <with-param name="source" select="&unsigiled-text;"/>
+                                                                       </call-template>
                                                                </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '⯑') and &sigiled-text;">
-                                                               <element name="div" namespace="&xhtml;">
-                                                                       <attribute name="role">
-                                                                               <text>note</text>
-                                                                       </attribute>
-                                                                       <attribute name="class">
-                                                                               <text>query</text>
-                                                                       </attribute>
-                                                                       <element name="p" namespace="&xhtml;">
-                                                                               <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="&unsigiled-text;"/>
-                                                                               </call-template>
-                                                                       </element>
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '🔣') and &sigiled-text;">
+                                                       <element name="li" namespace="&xhtml;">
+                                                               <attribute name="class">
+                                                                       <text>ordered</text>
+                                                               </attribute>
+                                                               <attribute name="data-level">
+                                                                       <text>4</text>
+                                                               </attribute>
+                                                               <element name="p" namespace="&xhtml;">
+                                                                       <call-template name="LesML:id-and-contents">
+                                                                               <with-param name="source" select="&unsigiled-text;"/>
+                                                                       </call-template>
                                                                </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '⚠︎') and &sigiled-text;">
-                                                               <element name="div" namespace="&xhtml;">
-                                                                       <attribute name="role">
-                                                                               <text>note</text>
-                                                                       </attribute>
-                                                                       <attribute name="class">
-                                                                               <text>warn</text>
-                                                                       </attribute>
-                                                                       <element name="p" namespace="&xhtml;">
-                                                                               <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="&unsigiled-text;"/>
-                                                                               </call-template>
-                                                                       </element>
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '🛈') and &sigiled-text;">
+                                                       <element name="div" namespace="&xhtml;">
+                                                               <attribute name="role">
+                                                                       <text>note</text>
+                                                               </attribute>
+                                                               <attribute name="class">
+                                                                       <text>info</text>
+                                                               </attribute>
+                                                               <element name="p" namespace="&xhtml;">
+                                                                       <call-template name="LesML:id-and-contents">
+                                                                               <with-param name="source" select="&unsigiled-text;"/>
+                                                                       </call-template>
                                                                </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '※') and &sigiled-text;">
-                                                               <element name="div" namespace="&xhtml;">
-                                                                       <attribute name="role">
-                                                                               <text>note</text>
-                                                                       </attribute>
-                                                                       <attribute name="class">
-                                                                               <text>note</text>
-                                                                       </attribute>
-                                                                       <element name="p" namespace="&xhtml;">
-                                                                               <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="&unsigiled-text;"/>
-                                                                               </call-template>
-                                                                       </element>
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '⯑') and &sigiled-text;">
+                                                       <element name="div" namespace="&xhtml;">
+                                                               <attribute name="role">
+                                                                       <text>note</text>
+                                                               </attribute>
+                                                               <attribute name="class">
+                                                                       <text>query</text>
+                                                               </attribute>
+                                                               <element name="p" namespace="&xhtml;">
+                                                                       <call-template name="LesML:id-and-contents">
+                                                                               <with-param name="source" select="&unsigiled-text;"/>
+                                                                       </call-template>
                                                                </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '☡') and &sigiled-text;">
-                                                               <element name="div" namespace="&xhtml;">
-                                                                       <attribute name="role">
-                                                                               <text>note</text>
-                                                                       </attribute>
-                                                                       <attribute name="class">
-                                                                               <text>caution</text>
-                                                                       </attribute>
-                                                                       <element name="p" namespace="&xhtml;">
-                                                                               <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="&unsigiled-text;"/>
-                                                                               </call-template>
-                                                                       </element>
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '⚠︎') and &sigiled-text;">
+                                                       <element name="div" namespace="&xhtml;">
+                                                               <attribute name="role">
+                                                                       <text>note</text>
+                                                               </attribute>
+                                                               <attribute name="class">
+                                                                       <text>warn</text>
+                                                               </attribute>
+                                                               <element name="p" namespace="&xhtml;">
+                                                                       <call-template name="LesML:id-and-contents">
+                                                                               <with-param name="source" select="&unsigiled-text;"/>
+                                                                       </call-template>
                                                                </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '⋯') and &sigiled-text;">
-                                                               <element name="div" namespace="&xhtml;">
-                                                                       <attribute name="class">
-                                                                               <text>continuation</text>
-                                                                       </attribute>
-                                                                       <element name="p" namespace="&xhtml;">
-                                                                               <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="&unsigiled-text;"/>
-                                                                               </call-template>
-                                                                       </element>
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '※') and &sigiled-text;">
+                                                       <element name="div" namespace="&xhtml;">
+                                                               <attribute name="role">
+                                                                       <text>note</text>
+                                                               </attribute>
+                                                               <attribute name="class">
+                                                                       <text>note</text>
+                                                               </attribute>
+                                                               <element name="p" namespace="&xhtml;">
+                                                                       <call-template name="LesML:id-and-contents">
+                                                                               <with-param name="source" select="&unsigiled-text;"/>
+                                                                       </call-template>
                                                                </element>
-                                                       </when>
-                                                       <when test="starts-with($text, '#') and &sigiled-text;">
-                                                               <comment>
-                                                                       <value-of select="&unsigiled-text;"/>
-                                                               </comment>
-                                                       </when>
-                                                       <otherwise>
+                                                       </element>
+                                               </when>
+                                               <when test="starts-with($text, '☡') and &sigiled-text;">
+                                                       <element name="div" namespace="&xhtml;">
+                                                               <attribute name="role">
+                                                                       <text>note</text>
+                                                               </attribute>
+                                                               <attribute name="class">
+                                                                       <text>caution</text>
+                                                               </attribute>
                                                                <element name="p" namespace="&xhtml;">
                                                                        <call-template name="LesML:id-and-contents">
-                                                                               <with-param name="source" select="$text"/>
+                                                                               <with-param name="source" select="&unsigiled-text;"/>
                                                                        </call-template>
                                                                </element>
-                                                       </otherwise>
-                                               </choose>
-                                       </variable>
-                                       <choose>
-                                               <when test="translate(string($text), '&section-break; ', '')=''">
-                                                       <element name="hr" namespace="&xhtml;"/>
+                                                       </element>
                                                </when>
-                                               <when test="$quoted">
-                                                       <element name="blockquote" namespace="&xhtml;">
-                                                               <copy-of select="$par"/>
+                                               <when test="starts-with($text, '⋯') and &sigiled-text;">
+                                                       <element name="div" namespace="&xhtml;">
+                                                               <attribute name="class">
+                                                                       <text>continuation</text>
+                                                               </attribute>
+                                                               <element name="p" namespace="&xhtml;">
+                                                                       <call-template name="LesML:id-and-contents">
+                                                                               <with-param name="source" select="&unsigiled-text;"/>
+                                                                       </call-template>
+                                                               </element>
                                                        </element>
                                                </when>
+                                               <when test="starts-with($text, '#') and &sigiled-text;">
+                                                       <call-template name="LesML:comment-out">
+                                                               <with-param name="source" select="&unsigiled-text;"/>
+                                                       </call-template>
+                                               </when>
                                                <otherwise>
-                                                       <copy-of select="$par"/>
+                                                       <element name="p" namespace="&xhtml;">
+                                                               <call-template name="LesML:id-and-contents">
+                                                                       <with-param name="source" select="$text"/>
+                                                               </call-template>
+                                                       </element>
                                                </otherwise>
                                        </choose>
-                               </if>
-                       </for-each>
+                               </otherwise>
+                       </choose>
+               </for-each>
+       </template>
+       <template name="LesML:paragraphize">
+               <param name="lines" select="/.."/>
+               <variable name="blocked-fragment">
+                       <call-template name="LesML:block">
+                               <with-param name="lines" select="$lines"/>
+                       </call-template>
                </variable>
-               <variable name="inlined">
-                       <apply-templates select="exsl:node-set($blocked)/node()" mode="LesML:comment"/>
+               <variable name="inlined-fragment">
+                       <apply-templates select="exsl:node-set($blocked-fragment)/node()" mode="LesML:comment"/>
                </variable>
-               <apply-templates select="exsl:node-set($inlined)/node()" mode="LesML:finalize-tree"/>
+               <apply-templates select="exsl:node-set($inlined-fragment)/node()" mode="LesML:finalize-tree"/>
        </template>
        <template match="html:script[@type='text/lesml']">
                <variable name="lines-fragment">
@@ -669,45 +782,6 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                        </if>
                </element>
        </template>
-       <template match="html:blockquote" mode="LesML:finalize-tree">
-               <if test="not(preceding-sibling::node()) or preceding-sibling::node()[position()=1 and not(self::html:blockquote)]">
-                       <variable name="notquote" select="following-sibling::node()[not(self::html:blockquote)][1]"/>
-                       <variable name="contents">
-                               <copy-of select="node()"/>
-                               <for-each select="exslset:leading(following-sibling::node(), $notquote)">
-                                       <copy-of select="node()"/>
-                               </for-each>
-                       </variable>
-                       <variable name="content-nodes" select="exsl:node-set($contents)/node()"/>
-                       <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()]"/>
-                       <choose>
-                               <when test="starts-with($laststarttext, '— ')">
-                                       <variable name="caption">
-                                               <copy-of select="$laststarttext/preceding-sibling::node()"/>
-                                               <value-of select="substring-after($laststarttext, '— ')"/>
-                                               <copy-of select="$laststarttext/following-sibling::node()"/>
-                                       </variable>
-                                       <element name="figure" namespace="&xhtml;">
-                                               <copy>
-                                                       <apply-templates select="@*|$content-nodes[position()!=last()]" mode="LesML:finalize-tree"/>
-                                               </copy>
-                                               <element name="figcaption" namespace="&xhtml;">
-                                                       <for-each select="$content-nodes[last()]">
-                                                               <copy>
-                                                                       <apply-templates select="@*|exsl:node-set($caption)/node()" mode="LesML:finalize-tree"/>
-                                                               </copy>
-                                                       </for-each>
-                                               </element>
-                                       </element>
-                               </when>
-                               <otherwise>
-                                       <copy>
-                                               <apply-templates select="@*|$content-nodes" mode="LesML:finalize-tree"/>
-                                       </copy>
-                               </otherwise>
-                       </choose>
-               </if>
-       </template>
        <template match="html:div" mode="LesML:finalize-tree">
                <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)]">
                        <variable name="notcontinuation" select="following-sibling::node()[not(self::html:div and @class='continuation')][1]"/>
@@ -799,12 +873,6 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                                </for-each>
                                                                <value-of select="substring-before($end-node, '⌫')"/>
                                                        </variable>
-                                                       <variable name="comment-split-fragment">
-                                                               <call-template name="LesML:split">
-                                                                       <with-param name="source" select="string($comment)"/>
-                                                                       <with-param name="separator" select="'--'"/>
-                                                               </call-template>
-                                                       </variable>
                                                        <variable name="rest-fragment">
                                                                <element name="span" namespace="&xhtml;">
                                                                        <value-of select="substring-after($end-node, '⌫')"/>
@@ -818,22 +886,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                                <copy-of select="@*"/>
                                                                <copy-of select="$start-node/preceding-sibling::node()"/>
                                                                <copy-of select="substring-before($start-node, '⌦')"/>
-                                                               <comment>
-                                                                       <for-each select="exsl:node-set($comment-split-fragment)/*">
-                                                                               <if test="string()='' or starts-with(., '‐')">
-                                                                                       <text>&#x034F;</text>
-                                                                               </if>
-                                                                               <value-of select="."/>
-                                                                               <if test="substring(., string-length(.), 1)='‐'">
-                                                                                       <text>&#x034F;</text>
-                                                                               </if>
-                                                                               <choose>
-                                                                                       <when test="position()!=last()">
-                                                                                               <text>-&#x034F;-</text>
-                                                                                       </when>
-                                                                               </choose>
-                                                                       </for-each>
-                                                               </comment>
+                                                               <call-template name="LesML:comment-out">
+                                                                       <with-param name="source" select="string($comment)"/>
+                                                               </call-template>
                                                                <copy-of select="exsl:node-set($commented-rest-fragment)/*/node()"/>
                                                        </copy>
                                                </when>
@@ -855,9 +910,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                        <for-each select="exsl:node-set($split-fragment)/node()">
                                                <value-of select="."/>
                                                <if test="position()!=last()">
-                                                       <comment>
-                                                               <text>&#x034F;</text>
-                                                       </comment>
+                                                       <call-template name="LesML:comment-out"/>
                                                </if>
                                        </for-each>
                                </when>
@@ -875,7 +928,6 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                <param name="end-sigil"/>
                <param name="class"/>
                <param name="role"/>
-               <param name="langtag-supported" select="false()"/>
                <choose>
                        <when test="self::*">
                                <variable name="end-node" select="text()[contains(., $end-sigil)][1]"/>
@@ -887,17 +939,6 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                        <value-of select="substring-before($end-node, $end-sigil)"/>
                                                </variable>
                                                <variable name="start-node" select="exsl:node-set($preceding)/text()[contains(., $start-sigil)][last()]"/>
-                                               <variable name="restoftext" select="substring-after($end-node, $end-sigil)"/>
-                                               <variable name="maybe-langtag">
-                                                       <if test="$langtag-supported and starts-with($restoftext, '@') and contains($restoftext, '$')">
-                                                               <value-of select="substring-before(substring-after($restoftext, '@'), '$')"/>
-                                                       </if>
-                                               </variable>
-                                               <variable name="langtag">
-                                                       <if test="translate($maybe-langtag, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-', '')=''">
-                                                               <value-of select="$maybe-langtag"/>
-                                                       </if>
-                                               </variable>
                                                <variable name="start-tokens-fragment">
                                                        <call-template name="LesML:split">
                                                                <with-param name="source" select="string($start-node)"/>
@@ -926,27 +967,10 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                                                        <value-of select="$class"/>
                                                                                </attribute>
                                                                        </if>
-                                                                       <if test="string($langtag)!=''">
-                                                                               <if test="$element-namespace='http://www.w3.org/1999/xhtml'">
-                                                                                       <attribute name="lang">
-                                                                                               <value-of select="$langtag"/>
-                                                                                       </attribute>
-                                                                               </if>
-                                                                               <attribute name="xml:lang">
-                                                                                       <value-of select="$langtag"/>
-                                                                               </attribute>
-                                                                       </if>
                                                                        <value-of select="$start-tokens[last()]"/>
                                                                        <copy-of select="$start-node/following-sibling::node()"/>
                                                                </element>
-                                                               <choose>
-                                                                       <when test="string($langtag)!=''">
-                                                                               <value-of select="substring-after($restoftext, '$')"/>
-                                                                       </when>
-                                                                       <otherwise>
-                                                                               <value-of select="$restoftext"/>
-                                                                       </otherwise>
-                                                               </choose>
+                                                               <value-of select="substring-after($end-node, $end-sigil)"/>
                                                                <copy-of select="$end-node/following-sibling::node()"/>
                                                        </copy>
                                                </variable>
@@ -956,7 +980,6 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                        <with-param name="start-sigil" select="$start-sigil"/>
                                                        <with-param name="end-sigil" select="$end-sigil"/>
                                                        <with-param name="role" select="$role"/>
-                                                       <with-param name="langtag-supported" select="$langtag-supported"/>
                                                </apply-templates>
                                        </when>
                                        <otherwise>
@@ -968,7 +991,6 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                                <with-param name="start-sigil" select="$start-sigil"/>
                                                                <with-param name="end-sigil" select="$end-sigil"/>
                                                                <with-param name="role" select="$role"/>
-                                                               <with-param name="langtag-supported" select="$langtag-supported"/>
                                                        </apply-templates>
                                                </copy>
                                        </otherwise>
@@ -1330,7 +1352,6 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                <with-param name="element-namespace" select="'&xhtml;'"/>
                                <with-param name="start-sigil" select="'⟨'"/>
                                <with-param name="end-sigil" select="'⟩'"/>
-                               <with-param name="langtag-supported" select="true()"/>
                        </apply-templates>
                </variable>
                <apply-templates select="exsl:node-set($result)/node()" mode="LesML:bolded"/>
This page took 0.774218 seconds and 4 git commands to generate.