From 897061ac17542afa0e91cfe1b8727f1f22726239 Mon Sep 17 00:00:00 2001 From: steve donovan Date: Thu, 28 Mar 2013 13:06:42 +0200 Subject: [PATCH] squashed trailing space problem with section titles; allowing numbers in links --- ldoc/doc.lua | 2 +- ldoc/html.lua | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) 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)