From: Lady <redacted>
Date: Sat, 26 Apr 2025 03:16:03 +0000 (-0400)
Subject: Drop empty shebang documents
X-Git-Tag: 0.5.0~8
X-Git-Url: https://git.ladys.computer/LesML/commitdiff_plain/6590f6413b72dbe0762dbfe847c2ffe06379a7e4?ds=inline

Drop empty shebang documents

Previously, a shebang forced a document to be output, even if it was
empty. However, this conflicts with the ability to add document
comments at the beginning of a document where the shebang is serving as
a magic number (for example, copyright comments): This would create two
documents, one for the shebang and a second one for the final comment.
Now, empty documents will be dropped regardless of whether they use the
shebang or comment syntax.
---

diff --git a/parser.xslt b/parser.xslt
index e726a9e..42d5937 100644
--- a/parser.xslt
+++ b/parser.xslt
@@ -219,7 +219,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 				<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 ']">