<value-of select="substring-after($first-line, '##')"/>
</comment>
</if>
- <if test="$shebang!='' or $doclines[normalize-space()!='']">
+ <if test="$doclines[normalize-space()!='']">
<variable name="record-separators" select="$doclines[starts-with(., '%%')]"/>
<element name="article" namespace="&xhtml;">
<for-each select="$params/html:div/html:dt[string()=' LANG ']">
</for-each>
</variable>
<variable name="inlined">
- <apply-templates select="exsl:node-set($blocked)/node()" mode="LesML:linkify"/>
+ <apply-templates select="exsl:node-set($blocked)/node()" mode="LesML:comment"/>
</variable>
<apply-templates select="exsl:node-set($inlined)/node()" mode="LesML:finalize-tree"/>
</template>
</with-param>
</call-template>
</variable>
- <call-template name="LesML:parse">
- <with-param name="lines" select="exsl:node-set($lines-fragment)/*"/>
- </call-template>
+ <element name="div" namespace="&xhtml;">
+ <call-template name="LesML:parse">
+ <with-param name="lines" select="exsl:node-set($lines-fragment)/*"/>
+ </call-template>
+ </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)]">
<apply-templates select="@*|node()" mode="LesML:finalize-tree"/>
</copy>
</template>
+ <template match="node()" mode="LesML:comment">
+ <variable name="result">
+ <choose>
+ <when test="self::*">
+ <variable name="start-node" select="text()[contains(., '⌦')][1]"/>
+ <variable name="after-start">
+ <if test="$start-node">
+ <value-of select="substring-after($start-node, '⌦')"/>
+ </if>
+ </variable>
+ <variable name="has-end-node" select="contains($after-start, '⌫') or $start-node/following-sibling::text()[contains(., '⌫')]"/>
+ <choose>
+ <when test="$start-node and $has-end-node">
+ <variable name="following">
+ <value-of select="$after-start"/>
+ <copy-of select="$start-node/following-sibling::node()"/>
+ </variable>
+ <variable name="end-node" select="exsl:node-set($following)/text()[contains(., '⌫')][last()]"/>
+ <variable name="comment">
+ <for-each select="$end-node/preceding-sibling::node()">
+ <value-of select="."/>
+ </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, '⌫')"/>
+ <copy-of select="$end-node/following-sibling::node()"/>
+ </element>
+ </variable>
+ <variable name="commented-rest-fragment">
+ <apply-templates select="exsl:node-set($rest-fragment)/node()" mode="LesML:comment"/>
+ </variable>
+ <copy>
+ <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>͏</text>
+ </if>
+ <value-of select="."/>
+ <if test="substring(., string-length(.), 1)='‐'">
+ <text>͏</text>
+ </if>
+ <choose>
+ <when test="position()!=last()">
+ <text>-͏-</text>
+ </when>
+ </choose>
+ </for-each>
+ </comment>
+ <copy-of select="exsl:node-set($commented-rest-fragment)/*/node()"/>
+ </copy>
+ </when>
+ <otherwise>
+ <copy>
+ <copy-of select="@*"/>
+ <apply-templates select="node()" mode="LesML:comment"/>
+ </copy>
+ </otherwise>
+ </choose>
+ </when>
+ <when test="self::text()[contains(., '⌧')]">
+ <variable name="split-fragment">
+ <call-template name="LesML:split">
+ <with-param name="source" select="string()"/>
+ <with-param name="separator" select="'⌧'"/>
+ </call-template>
+ </variable>
+ <for-each select="exsl:node-set($split-fragment)/node()">
+ <value-of select="."/>
+ <if test="position()!=last()">
+ <comment>
+ <text>͏</text>
+ </comment>
+ </if>
+ </for-each>
+ </when>
+ <otherwise>
+ <copy-of select="."/>
+ </otherwise>
+ </choose>
+ </variable>
+ <apply-templates select="exsl:node-set($result)/node()" mode="LesML:linkify"/>
+ </template>
<template match="node()" mode="LesML:inline">
<param name="element-name"/>
<param name="element-namespace" select="'http://www.w3.org/1999/xhtml'"/>
<param name="start-sigil"/>
<param name="end-sigil"/>
+ <param name="class"/>
<param name="role"/>
<param name="langtag-supported" select="false()"/>
<choose>
<value-of select="$role"/>
</attribute>
</if>
+ <if test="string($class)!=''">
+ <attribute name="class">
+ <value-of select="$class"/>
+ </attribute>
+ </if>
<if test="string($langtag)!=''">
<if test="$element-namespace='http://www.w3.org/1999/xhtml'">
<attribute name="lang">
<with-param name="end-sigil" select="'⟫'"/>
</apply-templates>
</variable>
+ <apply-templates select="exsl:node-set($result)/node()" mode="LesML:named"/>
+ </template>
+ <template match="node()" mode="LesML:named">
+ <variable name="result">
+ <apply-templates select="." mode="LesML:inline">
+ <with-param name="element-name" select="'u'"/>
+ <with-param name="element-namespace" select="'&xhtml;'"/>
+ <with-param name="start-sigil" select="'⸶'"/>
+ <with-param name="end-sigil" select="'⸷'"/>
+ <with-param name="class" select="'name'"/>
+ </apply-templates>
+ </variable>
<apply-templates select="exsl:node-set($result)/node()" mode="LesML:offset"/>
</template>
<template match="node()" mode="LesML:offset">