]> Lady’s Gitweb - LesML/commitdiff
Allow block sigils followed by nothing
authorLady <redacted>
Sat, 19 Oct 2024 19:59:57 +0000 (15:59 -0400)
committerLady <redacted>
Sat, 19 Oct 2024 22:53:01 +0000 (18:53 -0400)
README.markdown
parser.xslt

index 2901a5d2a727f574dae63254416971dfb138597c..14716c20c628937e551294aaa4706ae7714d626d 100644 (file)
@@ -107,7 +107,7 @@ Non·empty paragraphs are classified as follows :⁠—
 
 After this classification, each quoted or unquoted paragraph is further
   classified by type based on its first character (which is must be
-   followed by white·space to be recognized) :⁠—
+   followed by white·space, or else the only thing on the line) :⁠—
 
 - If the paragraph begins with `⁌`, it is a chapter heading
     (`<html:h1>`).
index a93f42558110a632c34d80be2c1898a7ac5e7e70..d11dfe6ebfb263129928ec028ef274cf6875044e 100644 (file)
@@ -12,7 +12,9 @@ This Source Code Form is subject to the terms of the Mozilla Public License, v 2
 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/>.
 -->
 <!DOCTYPE transform [
-       <!ENTITY section-break '*-.=_~·․‥…⁂⋯─━┄┅┈┉╌╍═╴╶╸╺☙❧ ・*-.=_~'>
+       <!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)">
 ]>
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
@@ -306,163 +308,163 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                <if test="string($text)!=''">
                                        <variable name="par">
                                                <choose>
-                                                       <when test="starts-with($text, '⁌ ')">
+                                                       <when test="starts-with($text, '⁌') and &sigiled-text;">
                                                                <html:h1>
                                                                        <call-template name="LesML:id-and-contents">
-                                                                               <with-param name="source" select="substring-after($text, '⁌ ')"/>
+                                                                               <with-param name="source" select="&unsigiled-text;"/>
                                                                        </call-template>
                                                                </html:h1>
                                                        </when>
-                                                       <when test="starts-with($text, '§ ')">
+                                                       <when test="starts-with($text, '§') and &sigiled-text;">
                                                                <html:h2>
                                                                        <call-template name="LesML:id-and-contents">
-                                                                               <with-param name="source" select="substring-after($text, '§ ')"/>
+                                                                               <with-param name="source" select="&unsigiled-text;"/>
                                                                        </call-template>
                                                                </html:h2>
                                                        </when>
-                                                       <when test="starts-with($text, '❦ ')">
+                                                       <when test="starts-with($text, '❦') and &sigiled-text;">
                                                                <html:h3>
                                                                        <call-template name="LesML:id-and-contents">
-                                                                               <with-param name="source" select="substring-after($text, '❦ ')"/>
+                                                                               <with-param name="source" select="&unsigiled-text;"/>
                                                                        </call-template>
                                                                </html:h3>
                                                        </when>
-                                                       <when test="starts-with($text, '✠ ')">
+                                                       <when test="starts-with($text, '✠') and &sigiled-text;">
                                                                <html:h4>
                                                                        <call-template name="LesML:id-and-contents">
-                                                                               <with-param name="source" select="substring-after($text, '✠ ')"/>
+                                                                               <with-param name="source" select="&unsigiled-text;"/>
                                                                        </call-template>
                                                                </html:h4>
                                                        </when>
-                                                       <when test="starts-with($text, '• ')">
+                                                       <when test="starts-with($text, '•') and &sigiled-text;">
                                                                <html:li class="unordered" data-level="1">
                                                                        <html:p>
                                                                                <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="substring-after($text, '• ')"/>
+                                                                                       <with-param name="source" select="&unsigiled-text;"/>
                                                                                </call-template>
                                                                        </html:p>
                                                                </html:li>
                                                        </when>
-                                                       <when test="starts-with($text, '🔢 ')">
+                                                       <when test="starts-with($text, '🔢') and &sigiled-text;">
                                                                <html:li class="ordered" data-level="1">
                                                                        <html:p>
                                                                                <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="substring-after($text, '🔢 ')"/>
+                                                                                       <with-param name="source" select="&unsigiled-text;"/>
                                                                                </call-template>
                                                                        </html:p>
                                                                </html:li>
                                                        </when>
-                                                       <when test="starts-with($text, '◦ ')">
+                                                       <when test="starts-with($text, '◦') and &sigiled-text;">
                                                                <html:li class="unordered" data-level="2">
                                                                        <html:p>
                                                                                <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="substring-after($text, '◦ ')"/>
+                                                                                       <with-param name="source" select="&unsigiled-text;"/>
                                                                                </call-template>
                                                                        </html:p>
                                                                </html:li>
                                                        </when>
-                                                       <when test="starts-with($text, '🔠 ')">
+                                                       <when test="starts-with($text, '🔠') and &sigiled-text;">
                                                                <html:li class="ordered" data-level="2">
                                                                        <html:p>
                                                                                <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="substring-after($text, '🔠 ')"/>
+                                                                                       <with-param name="source" select="&unsigiled-text;"/>
                                                                                </call-template>
                                                                        </html:p>
                                                                </html:li>
                                                        </when>
-                                                       <when test="starts-with($text, '▪ ')">
+                                                       <when test="starts-with($text, '▪') and &sigiled-text;">
                                                                <html:li class="unordered" data-level="3">
                                                                        <html:p>
                                                                                <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="substring-after($text, '▪ ')"/>
+                                                                                       <with-param name="source" select="&unsigiled-text;"/>
                                                                                </call-template>
                                                                        </html:p>
                                                                </html:li>
                                                        </when>
-                                                       <when test="starts-with($text, '🔡 ')">
+                                                       <when test="starts-with($text, '🔡') and &sigiled-text;">
                                                                <html:li class="ordered" data-level="3">
                                                                        <html:p>
                                                                                <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="substring-after($text, '🔡 ')"/>
+                                                                                       <with-param name="source" select="&unsigiled-text;"/>
                                                                                </call-template>
                                                                        </html:p>
                                                                </html:li>
                                                        </when>
-                                                       <when test="starts-with($text, '⁃ ')">
+                                                       <when test="starts-with($text, '⁃') and &sigiled-text;">
                                                                <html:li class="unordered" data-level="4">
                                                                        <html:p>
                                                                                <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="substring-after($text, '⁃ ')"/>
+                                                                                       <with-param name="source" select="&unsigiled-text;"/>
                                                                                </call-template>
                                                                        </html:p>
                                                                </html:li>
                                                        </when>
-                                                       <when test="starts-with($text, '🔣 ')">
+                                                       <when test="starts-with($text, '🔣') and &sigiled-text;">
                                                                <html:li class="ordered" data-level="4">
                                                                        <html:p>
                                                                                <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="substring-after($text, '🔣 ')"/>
+                                                                                       <with-param name="source" select="&unsigiled-text;"/>
                                                                                </call-template>
                                                                        </html:p>
                                                                </html:li>
                                                        </when>
-                                                       <when test="starts-with($text, '🛈 ')">
+                                                       <when test="starts-with($text, '🛈') and &sigiled-text;">
                                                                <html:div role="note" class="info">
                                                                        <html:p>
                                                                                <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="substring-after($text, '🛈 ')"/>
+                                                                                       <with-param name="source" select="&unsigiled-text;"/>
                                                                                </call-template>
                                                                        </html:p>
                                                                </html:div>
                                                        </when>
-                                                       <when test="starts-with($text, '⯑ ')">
+                                                       <when test="starts-with($text, '⯑') and &sigiled-text;">
                                                                <html:div role="note" class="query">
                                                                        <html:p>
                                                                                <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="substring-after($text, '⯑ ')"/>
+                                                                                       <with-param name="source" select="&unsigiled-text;"/>
                                                                                </call-template>
                                                                        </html:p>
                                                                </html:div>
                                                        </when>
-                                                       <when test="starts-with($text, '⚠︎ ')">
+                                                       <when test="starts-with($text, '⚠︎') and &sigiled-text;">
                                                                <html:div role="note" class="warn">
                                                                        <html:p>
                                                                                <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="substring-after($text, '⚠︎ ')"/>
+                                                                                       <with-param name="source" select="&unsigiled-text;"/>
                                                                                </call-template>
                                                                        </html:p>
                                                                </html:div>
                                                        </when>
-                                                       <when test="starts-with($text, '※ ')">
+                                                       <when test="starts-with($text, '※') and &sigiled-text;">
                                                                <html:div role="note" class="note">
                                                                        <html:p>
                                                                                <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="substring-after($text, '※ ')"/>
+                                                                                       <with-param name="source" select="&unsigiled-text;"/>
                                                                                </call-template>
                                                                        </html:p>
                                                                </html:div>
                                                        </when>
-                                                       <when test="starts-with($text, '☡ ')">
+                                                       <when test="starts-with($text, '☡') and &sigiled-text;">
                                                                <html:div role="note" class="caution">
                                                                        <html:p>
                                                                                <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="substring-after($text, '☡ ')"/>
+                                                                                       <with-param name="source" select="&unsigiled-text;"/>
                                                                                </call-template>
                                                                        </html:p>
                                                                </html:div>
                                                        </when>
-                                                       <when test="starts-with($text, '⋯ ')">
+                                                       <when test="starts-with($text, '⋯') and &sigiled-text;">
                                                                <html:div class="continuation">
                                                                        <html:p>
                                                                                <call-template name="LesML:id-and-contents">
-                                                                                       <with-param name="source" select="substring-after($text, '⋯ ')"/>
+                                                                                       <with-param name="source" select="&unsigiled-text;"/>
                                                                                </call-template>
                                                                        </html:p>
                                                                </html:div>
                                                        </when>
-                                                       <when test="starts-with($text, '# ')">
+                                                       <when test="starts-with($text, '#') and &sigiled-text;">
                                                                <comment>
-                                                                       <value-of select="substring-after($text, '# ')"/>
+                                                                       <value-of select="&unsigiled-text;"/>
                                                                </comment>
                                                        </when>
                                                        <otherwise>
This page took 0.040478 seconds and 4 git commands to generate.