Check for Pandoc (%) metadata failed if one of the first three document lines was empty
kaminski kaminski@naew.nato.int
Sun, 04 Apr 2021 12:56:50 +0200
1 files changed,
3 insertions(+),
3 deletions(-)
jump to
M
src/hastyscribepkg/markdown.nim
→
src/hastyscribepkg/markdown.nim
@@ -149,13 +149,13 @@ # Check if metadata is present
var lns = s.splitLines var valid_metadata = false var offset = 0 - if (lns[0][0] == '%') and (lns[1][0] == '%') and (lns[2][0] == '%'): + if lns[0].startsWith('%') and lns[1].startsWith('%') and lns[2].startsWith('%'): valid_metadata = true else: valid_metadata = false - if lns[0][0] == '%': + if lns[0].startsWith('%'): offset = 2 - if lns[1][0] == '%': + if lns[1].startsWith('%'): offset = 3 var str = cstring(lns[offset..lns.len-1].join("\n")) var mmiot = mkd_string(str, cint(str.len-1), flags)