1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 05:20:26 +00:00

Fix lexer for "----" (<hr/>) case

The point is that there may be another character in the string.
For example, a space or a line break.

Because we check the whole string, not the first 4 characters - we can ignore the variant where it can be "----\s" or "----\r\n" and make the wrong markup.

Alternatively: use `startsWith("----")`, but this is a bit more expensive operation.
This commit is contained in:
hugmouse 2021-03-05 14:34:56 +08:00
parent f45758cb0e
commit 8dfd2fcf9b
No known key found for this signature in database
GPG Key ID: E2C8CCA3392D75BD

View File

@ -235,7 +235,7 @@ normalState:
case startsWith("<="):
addParagraphIfNeeded()
addLine(parseTransclusion(line, state.name))
case line == "----":
case line[:4] == "----":
addParagraphIfNeeded()
*ast = append(*ast, Line{id: -1, contents: "<hr/>"})
case MatchesImg(line):