Issue #108: sorting modules etc is off by default, switch back on using 'sort_modules=true'. Section lookup in docs was borked, fixed by stripping any extra whitespace before section titles
This commit is contained in:
parent
4666e464cc
commit
9fc5697cff
4
ldoc.lua
4
ldoc.lua
|
@ -198,7 +198,7 @@ local ldoc_contents = {
|
||||||
'readme','all','manual_url', 'ignore', 'colon', 'sort', 'module_file','vars',
|
'readme','all','manual_url', 'ignore', 'colon', 'sort', 'module_file','vars',
|
||||||
'boilerplate','merge', 'wrap', 'not_luadoc', 'template_escape','merge_error_groups',
|
'boilerplate','merge', 'wrap', 'not_luadoc', 'template_escape','merge_error_groups',
|
||||||
'no_return_or_parms','no_summary','full_description','backtick_references', 'custom_see_handler',
|
'no_return_or_parms','no_summary','full_description','backtick_references', 'custom_see_handler',
|
||||||
'no_space_before_args','parse_extra','no_lua_ref',
|
'no_space_before_args','parse_extra','no_lua_ref','sort_modules',
|
||||||
}
|
}
|
||||||
ldoc_contents = tablex.makeset(ldoc_contents)
|
ldoc_contents = tablex.makeset(ldoc_contents)
|
||||||
|
|
||||||
|
@ -544,9 +544,11 @@ if not args.all and not ldoc.all then
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ldoc.sort_modules then
|
||||||
table.sort(module_list,function(m1,m2)
|
table.sort(module_list,function(m1,m2)
|
||||||
return m1.name < m2.name
|
return m1.name < m2.name
|
||||||
end)
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
ldoc.single = modcount == 1 and first_module or nil
|
ldoc.single = modcount == 1 and first_module or nil
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ end
|
||||||
function markup.add_sections(F, txt)
|
function markup.add_sections(F, txt)
|
||||||
local sections, L, first = {}, 1, true
|
local sections, L, first = {}, 1, true
|
||||||
local title_pat
|
local title_pat
|
||||||
|
local lstrip = stringx.lstrip
|
||||||
for line in stringx.lines(txt) do
|
for line in stringx.lines(txt) do
|
||||||
if first then
|
if first then
|
||||||
local level,header = line:match '^(#+)%s*(.+)'
|
local level,header = line:match '^(#+)%s*(.+)'
|
||||||
|
@ -67,14 +68,14 @@ function markup.add_sections(F, txt)
|
||||||
level = '##'
|
level = '##'
|
||||||
end
|
end
|
||||||
title_pat = '^'..level..'([^#]%s*.+)'
|
title_pat = '^'..level..'([^#]%s*.+)'
|
||||||
title_pat = stringx.lstrip(title_pat)
|
title_pat = lstrip(title_pat)
|
||||||
first = false
|
first = false
|
||||||
end
|
end
|
||||||
local title = line:match (title_pat)
|
local title = line:match (title_pat)
|
||||||
if title then
|
if title then
|
||||||
-- Markdown does allow this pattern
|
-- Markdown does allow this pattern
|
||||||
title = title:gsub('%s*#+$','')
|
title = title:gsub('%s*#+$','')
|
||||||
sections[L] = F:add_document_section(title)
|
sections[L] = F:add_document_section(lstrip(title))
|
||||||
end
|
end
|
||||||
L = L + 1
|
L = L + 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue