Skip to content

Commit

Permalink
Allow the escaping of comments with the stripComments Lua option
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed Apr 10, 2021
1 parent ec89e6d commit 5f7c5e3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
23 changes: 13 additions & 10 deletions markdown.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -15200,16 +15200,19 @@ parsers.spnl = parsers.optionalspace
parsers.line = parsers.linechar^0 * parsers.newline
parsers.nonemptyline = parsers.line - parsers.blankline

parsers.commented_line = C(((parsers.linechar
- parsers.backslash
- parsers.percent)^1
+ (parsers.backslash
* parsers.backslash)^1
+ (parsers.backslash
* parsers.backslash)^0
* parsers.backslash
* (parsers.linechar
- parsers.backslash)
parsers.commented_line = Cs(((parsers.linechar
- parsers.backslash
- parsers.percent)^1
+ (parsers.backslash
* parsers.backslash)^1
+ (parsers.backslash
* parsers.backslash)^0
* (parsers.backslash / ""
* parsers.percent
+ parsers.backslash
* (parsers.linechar
- parsers.backslash
- parsers.percent))
)^0)
* ((parsers.percent
* parsers.line
Expand Down
4 changes: 3 additions & 1 deletion tests/testfiles/lunamark-markdown/no-strip-comments.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<<<
This test ensures that the Lua `stripComments` option is disabled by default.
The following *emphasi% this is a comment
zed text* should be interrupted.
zed text* should be interrupted and this *emphasi\% another one
zed text* should also be interrupted.
>>>
codeSpan: stripComments
emphasis: emphasi(percentSign) this is a comment zed text
emphasis: emphasi(backslash)(percentSign) another one zed text
6 changes: 4 additions & 2 deletions tests/testfiles/lunamark-markdown/strip-comments.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
<<<
This test ensures that the Lua `stripComments` option correctly propagates
through the plain TeX interface. The following *emphasi% this is a comment
zed text* should be uninterrupted.
zed text* should be uninterrupted, whereas this *emphasi\% another one
zed text* should be interrupted.

The following *emphasi% this is a comment

zed text* should be interrupted.
zed text* should be broken into two paragraphs.
>>>
codeSpan: stripComments
emphasis: emphasized text
emphasis: emphasi(percentSign) another one zed text
interblockSeparator
interblockSeparator

0 comments on commit 5f7c5e3

Please sign in to comment.