issue #240 blank line after comment at end of code block. Crash with fenced block at end of document fixed
This commit is contained in:
parent
9f259c59be
commit
c9b6483d6d
|
@ -171,6 +171,7 @@ local function process_multiline_markdown(ldoc, txt, F, filename, deflang)
|
|||
end
|
||||
pretty_code (code,fence)
|
||||
line = getline() -- skip fence
|
||||
if not line then break end
|
||||
end
|
||||
indent, line = indent_line(line)
|
||||
if indent >= 4 then -- indented code block
|
||||
|
|
|
@ -50,6 +50,7 @@ function prettify.lua (lang, fname, code, initial_lineno, pre, linenos)
|
|||
io.stderr:write(fname..':'..tok:lineno()+initial_lineno..': '..msg,'\n')
|
||||
end
|
||||
}
|
||||
local last_t, last_val
|
||||
local t,val = tok()
|
||||
if not t then return nil,"empty file" end
|
||||
while t do
|
||||
|
@ -71,8 +72,12 @@ function prettify.lua (lang, fname, code, initial_lineno, pre, linenos)
|
|||
else
|
||||
res:append(val)
|
||||
end
|
||||
last_t, last_val = t,val
|
||||
t,val = tok()
|
||||
end
|
||||
if last_t == 'comment' then
|
||||
res[#res] = span('comment',last_val:gsub('\r*\n$',''))
|
||||
end
|
||||
local last = res[#res]
|
||||
if last:match '\n$' then
|
||||
res[#res] = last:gsub('\n+','')
|
||||
|
|
Loading…
Reference in New Issue