]> Lady’s Gitweb - LesML/commitdiff
Support definition lists (finally!) 🆕 0.7.1
authorLady <redacted>
Tue, 31 Mar 2026 01:31:16 +0000 (21:31 -0400)
committerLady <redacted>
Tue, 31 Mar 2026 02:11:44 +0000 (22:11 -0400)
README.lesml
TESTING/ð\9f\93¤/dl [new file with mode: 0644]
TESTING/ð\9f\93¥/dl [new file with mode: 0644]
xslt/lesml.xslt

index dfc813bea62feb5d6fd2d1e540a4a31cc2758a27c5a0bc61da01be7fb8837578..4754226ccb99b9f08b942cca9133b9cd361e8d4904e11737e978fbeb1745521a 100644 (file)
@@ -1,5 +1,5 @@
 #!lesml@en$
-## @(#)💄📝 Les·M·L      README.lesml    2026-03-31T01:28:11Z
+## @(#)💄📝 Les·M·L      README.lesml    2026-03-31T01:31:16Z
 ## SPDX-FileCopyrightText: 2024, 2025, 2026 Lady <https://www.ladys.computer/about/#lady>
 ## SPDX-License-Identifier: CC0-1.0
 
@@ -86,6 +86,9 @@ Following this, new blocks are opened for each successive sigil :⁠—
 When it is the first sigil in the list, `◦´ may be used as a
   shorthand for `⋮•´, `▪´ for `⋮⋮•´, and `⁃´ for `⋮⋮⋮•´.
 
+• A `℣´ sigil indicates a definition term, and a `℟´ sigil indicates
+  the corresponding value.
+
 • A `№´ sigil indicates an ordered list item.
 
 • A `※´ sigil indicates an ordinary note.
diff --git a/TESTING/ð\9f\93¤/dl b/TESTING/ð\9f\93¤/dl
new file mode 100644 (file)
index 0000000..098e356
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<div xmlns="http://www.w3.org/1999/xhtml"><article lang="en" xml:lang="en"><div class="body"><dl><div><dt><dl><div><dt data-level="1"><p>Nesting is allowed</p></dt><dd data-level="1"><p>And works as expected</p></dd></div></dl></dt><dd><ul><li class="unordered" data-level="1"><p>As can other things</p></li></ul></dd></div><div><dt><p>One</p></dt><dt><p>Two</p></dt><dd><p>Response one</p></dd><dd><p>Response two</p></dd></div><div><dt><p>A trailing versicle creates an empty &lt;dd&gt;</p></dt><dd/></div></dl><ul><li class="unordered"><p>A different kind of list</p></li></ul><dl><div><dt/><dd><p>A leading response creates an empty &lt;dt&gt;</p></dd></div></dl></div></article></div>
diff --git a/TESTING/ð\9f\93¥/dl b/TESTING/ð\9f\93¥/dl
new file mode 100644 (file)
index 0000000..077a43e
--- /dev/null
@@ -0,0 +1,21 @@
+#?lesml@en$
+
+℣ ℣ Nesting is allowed
+
+⋮ ℟ And works as expected
+
+℟ • As can other things
+
+℣ One
+
+℣ Two
+
+℟ Response one
+
+℟ Response two
+
+℣ A trailing versicle creates an empty <dd>
+
+• A different kind of list
+
+℟ A leading response creates an empty <dt>
index 2100e06d787944131c9850d06fe21643561edaaf8507b564b62b1303739e7a06..61539dda4b77146b7074cf5e04f10cfc247e2be9db5625ab3d703fdf769e11ed 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <!--
-@(#)💄📝 Les·M·L xslt/lesml.xslt 2026-03-31T01:29:32Z
+@(#)💄📝 Les·M·L xslt/lesml.xslt 2026-03-31T01:31:16Z
 SPDX-FileCopyrightText: 2024, 2025, 2026 Lady <https://www.ladys.computer/about/#lady>
 SPDX-License-Identifier: MPL-2.0
 -->
@@ -290,6 +290,12 @@ If a block is nested within the wrapping `<div>´ of a paragraph, the
                                                                </attribute>
                                                        </element>
                                                </when>
+                                               <when test="$sigils[1]='℣'">
+                                                       <element name="dt" namespace="&xhtml;"/>
+                                               </when>
+                                               <when test="$sigils[1]='℟'">
+                                                       <element name="dd" namespace="&xhtml;"/>
+                                               </when>
                                                <when test="$sigils[1]='※'">
                                                        <element name="section" namespace="&xhtml;">
                                                                <attribute name="role">
@@ -625,7 +631,7 @@ This also requires processing any paragraph‐type indicators and
                                        </otherwise>
                                </choose>
                        </variable>
-                       <variable name="firstnosigil" select="substring(translate($nobullet, '•№※⯑∫☡⚠🛈💡»∎', ''), 1, 1)"/>
+                       <variable name="firstnosigil" select="substring(translate($nobullet, '•№※⯑∫☡⚠🛈💡»∎℣℟', ''), 1, 1)"/>
                        <variable name="sigilling">
                                <choose>
                                        <when test="$firstnosigil!=''">
@@ -1834,6 +1840,40 @@ These templates finalize the resulting tree.
                        </attribute>
                </if>
        </template>
+       <template match="html:dt|html:dd" mode="LesML:finalize-list">
+               <param name="used-footnotes" select="/.."/>
+               <variable name="current-level" select="number(&level-pi;)"/>
+               <variable name="notinlist" select="following-sibling::node()[not((self::html:dt or self::html:dd) and &level-pi;=$current-level)][1]"/>
+               <variable name="inlist" select=".|exslset:leading(following-sibling::node(), $notinlist)"/>
+               <variable name="lasts-in-pairing" select="$inlist[self::html:dd and not(exslset:intersection(following-sibling::node()[1]/self::html:dd, $inlist))]|$inlist[last()]"/>
+               <element name="dl" namespace="&xhtml;">
+                       <for-each select="$lasts-in-pairing">
+                               <variable name="prev-position" select="position()-1"/>
+                               <variable name="prev-last" select="$lasts-in-pairing[$prev-position]"/>
+                               <element name="div" namespace="&xhtml;">
+                                       <for-each select="exslset:leading(exslset:trailing($inlist, $prev-last), .)|.">
+                                               <if test="position()=1 and self::html:dd">
+                                                       <element name="dt" namespace="&xhtml;"/>
+                                               </if>
+                                               <copy>
+                                                       <apply-templates select="." mode="LesML:finalize-attributes"/>
+                                                       <apply-templates select="node()" mode="LesML:finalize">
+                                                               <with-param name="used-footnotes" select="$used-footnotes"/>
+                                                       </apply-templates>
+                                               </copy>
+                                               <if test="position()=last() and self::html:dt">
+                                                       <element name="dd" namespace="&xhtml;"/>
+                                               </if>
+                                       </for-each>
+                               </element>
+                       </for-each>
+               </element>
+               <if test="$notinlist/self::html:dt or $notinlist/self::html:dd">
+                       <apply-templates select="$notinlist" mode="LesML:finalize-list">
+                               <with-param name="used-footnotes" select="$used-footnotes"/>
+                       </apply-templates>
+               </if>
+       </template>
        <template match="html:li" mode="LesML:finalize-list">
                <param name="used-footnotes" select="/.."/>
                <variable name="current-class" select="string(@class)"/>
@@ -1943,6 +1983,14 @@ These templates finalize the resulting tree.
                        </apply-templates>
                </element>
        </template>
+       <template match="html:dt|html:dd" mode="LesML:finalize">
+               <param name="used-footnotes" select="/.."/>
+               <if test="not(preceding-sibling::node()) or preceding-sibling::node()[position()=1 and not(self::html:dt or self::html:dd)]">
+                       <apply-templates select="." mode="LesML:finalize-list">
+                               <with-param name="used-footnotes" select="$used-footnotes"/>
+                       </apply-templates>
+               </if>
+       </template>
        <template match="html:li" mode="LesML:finalize">
                <param name="used-footnotes" select="/.."/>
                <if test="not(preceding-sibling::node()) or preceding-sibling::node()[position()=1 and not(self::html:li)]">
This page took 0.138686 seconds and 4 git commands to generate.