From 7cba8380674ee77e589c1c3f2db599f9ea084fee Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Tue, 9 Jul 2019 16:28:42 -0400 Subject: [PATCH] doc: Prevent ldoc from generating URLs with spaces. For dubious reasons, ldoc uses the human readable name for the URLs instead of the machine readable one. If the name has multiple words, this causes the URLs to have spaces or %20 in them. This commits remove all spaces from the "kinds" and then use `:gsub()` in the template to convert underscores to spaces. **WARNING** This breaks all URLs again. But this is necessary to prevent broken links when the user paste them with spaces instead of %20. --- docs/config.ld | 12 ++++++------ docs/ldoc.ltp | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/config.ld b/docs/config.ld index ca66ae96..e97264a5 100644 --- a/docs/config.ld +++ b/docs/config.ld @@ -100,12 +100,12 @@ sort_modules=true -- Add more project level (left side index) types. new_type("widgetmod" , "Widgets" , true) -new_type("containermod", "Widget containers", true) -new_type("layoutmod" , "Widget layouts" , true) -new_type("coreclassmod", "Core components" , true) -new_type("popupmod" , "Popups and bars" , true) -new_type("utillib" , "Utility libraries", true) -new_type("themelib" , "Theme related libraries", true) +new_type("containermod", "Widget_containers", true) +new_type("layoutmod" , "Widget_layouts" , true) +new_type("coreclassmod", "Core_components" , true) +new_type("popupmod" , "Popups_and_bars" , true) +new_type("utillib" , "Utility_libraries", true) +new_type("themelib" , "Theme_related_libraries", true) file = { -- C parts of libraries diff --git a/docs/ldoc.ltp b/docs/ldoc.ltp index 7550bb78..7a71070c 100644 --- a/docs/ldoc.ltp +++ b/docs/ldoc.ltp @@ -30,6 +30,7 @@ # local function M(txt,item) return ldoc.markup(txt,item,ldoc.plain) end # local nowrap = ldoc.wrap and '' or 'nowrap' # local html_space = function(s) return s:gsub(" ", "%%20") end +# local no_underscores = function(s) return s:gsub("_", " ") end @@ -68,7 +69,7 @@ # local this_mod = module and module.name # for kind, mods, type in ldoc.kinds() do # if ldoc.allowed_in_contents(type,module) then -

$(kind)

+

$(no_underscores(kind))