diff --git a/ldoc/doc.lua b/ldoc/doc.lua index e91e75f..d964bc0 100644 --- a/ldoc/doc.lua +++ b/ldoc/doc.lua @@ -346,7 +346,7 @@ end -- is not empty. function File:add_document_section(title) - local section = title:gsub('%A','_') + local section = title:gsub('%W','_') self:new_item { name = section, class = 'section', diff --git a/ldoc/html.lua b/ldoc/html.lua index 7840d7d..9684384 100644 --- a/ldoc/html.lua +++ b/ldoc/html.lua @@ -122,7 +122,10 @@ function html.generate_output(ldoc, args, project) else return name end end - function ldoc.no_spaces(s) return (s:gsub('%A','_')) end + function ldoc.no_spaces(s) + s = s:gsub('%s*$','') + return (s:gsub('%W','_')) + end function ldoc.titlecase(s) return (s:gsub('(%a)(%a*)',function(f,r)