download patch
commit 7bb7f8f57eb4ae1872ea9767b1cf032093041f5b
Author: gemmaro <gemmaro.dev@gmail.com>
Date: Sun Jul 2 11:08:35 2023 +0900
Allow comment end with attribute end.
diff --git a/djot/attributes.lua b/djot/attributes.lua
index 259cd65..ad6a62a 100644
--- a/djot/attributes.lua
+++ b/djot/attributes.lua
handlers[SCANNING] = function(self, pos)
end
handlers[SCANNING_COMMENT] = function(self, pos)
- if sub(self.subject, pos, pos) == "%" then
+ local c = sub(self.subject, pos, pos)
+ if c == "%" then
return SCANNING
+ elseif c == "}" then
+ return DONE
else
return SCANNING_COMMENT
end
diff --git a/test/attributes.test b/test/attributes.test
index f84151c..b42f641 100644
--- a/test/attributes.test
+++ b/test/attributes.test
two
```
Comments start at a `%` character
-(not in quotes) and end with another `%`.
+(not in quotes) and end with another `%` or
+the end of the attribute (`}`).
These can be used to comment up an attribute
list or without any real attributes.
foo{#ident % this is a comment % .class}
<p><span class="class" id="ident">foo</span></p>
```
+```
+foo{#ident % this is a comment}
+.
+<p><span id="ident">foo</span></p>
+```
+
In block-level comment, subsequent lines must
be indented, as with attributes: