Windows line endings led to wrong section names in Markdown documents

This commit is contained in:
Steve Donovan 2016-06-21 12:26:36 -04:00
parent 04da31d5c7
commit f3e5a5a576
1 changed files with 2 additions and 0 deletions

View File

@ -90,6 +90,8 @@ function markup.add_sections(F, txt)
end
local title = line:match (title_pat)
if title then
--- Windows line endings are the cockroaches of text
title = title:gsub('\r$','')
-- Markdown allows trailing '#'...
title = title:gsub('%s*#+$','')
sections[L] = F:add_document_section(lstrip(title))