From a30fc03f28beb0263ec051094b56d4a1dcddc869 Mon Sep 17 00:00:00 2001 From: dvs1 Date: Fri, 14 Mar 2025 14:27:23 +1000 Subject: I'll get this right some day. --- notYetAnotherWiki.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua index 700de34..6eef889 100755 --- a/notYetAnotherWiki.lua +++ b/notYetAnotherWiki.lua @@ -630,7 +630,14 @@ local Context = {} -- Coz can't otherwise pass context through to the deeper L local lunaLinky = function(url) -- Fix up the links. if ('https://wiki.devuan.org/' ~= url) and ('https://fos.wiki.devuan.org/' ~= url) then -- TODO - This might be covering up a bug elsewhere. - if '/Main/' == string.sub(url, 1, 6) then url = linkFrom(Context.path, 'Foswiki/Main') .. string.sub(url, 7) .. '.HTML' end + if '/Main/' == string.sub(url, 1, 6) then + local link = linkFrom(Context.path, 'Foswiki/Main') + if '' == link then + url = string.sub(url, 7) .. '.HTML' + else + url = link .. '/' .. string.sub(url, 7) .. '.HTML' + end + end for i, p in ipairs{'https://wiki.devuan.org/?n=', 'https://wiki.devuan.org?n=', 'PmWiki/uploads/', 'Foswiki/pub/', 'https://fos.wiki.devuan.org/'} do if p == string.sub(url, 1, #p) then local ur = string.sub(url, #p + 1) -- cgit v1.1