fix: paragraph lexing if it's only 1 char long

This commit is contained in:
Anish Lakhwara 2023-12-07 20:27:20 -08:00
parent 682f37e49c
commit 00db423384
2 changed files with 4 additions and 2 deletions

View file

@ -72,7 +72,10 @@
(table.insert lexed {:type "raw-text" (table.insert lexed {:type "raw-text"
:text (string.sub contents current (length contents))}) :text (string.sub contents current (length contents))})
(set current (length contents)))))) ; No decoration at all (set current (length contents)))))) ; No decoration at all
lexed)) (if (> (length lexed) 0) ; If lexed is nil, the only case is we had a single \n paragraph?
lexed
[{:type "raw-text"
:text "\n"}])))
; ">" (let [(block new-end) ((. grammar :Spoiler) contents current)] ; ">" (let [(block new-end) ((. grammar :Spoiler) contents current)]
; (table.insert lexed block) ; (table.insert lexed block)
; (set current new-end)))) ; (set current new-end))))

View file

@ -10,4 +10,3 @@
(blocks.lexer blocks.grammar) (blocks.lexer blocks.grammar)
(inline.inline-lexer inline.inline-grammar) (inline.inline-lexer inline.inline-grammar)
(_G.pp)) (_G.pp))
; (inline.contents-lexer inline.contents-grammar))