diff options
author | dvs1 | 2025-03-14 13:39:35 +1000 |
---|---|---|
committer | dvs1 | 2025-03-14 13:39:35 +1000 |
commit | 4490fb5ef230b97430b7597351e69036cebcca7d (patch) | |
tree | 6131705aae4ab98bd9484ce7cc20eea4fcc3c5f2 | |
parent | Commented out not working switching of gradient. (diff) | |
download | notYetAnotherWiki-4490fb5ef230b97430b7597351e69036cebcca7d.zip notYetAnotherWiki-4490fb5ef230b97430b7597351e69036cebcca7d.tar.gz notYetAnotherWiki-4490fb5ef230b97430b7597351e69036cebcca7d.tar.bz2 notYetAnotherWiki-4490fb5ef230b97430b7597351e69036cebcca7d.tar.xz |
Fix up /Main/ and /bin/ linkies.
-rwxr-xr-x | notYetAnotherWiki.lua | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua index 33a9e32..9f543e2 100755 --- a/notYetAnotherWiki.lua +++ b/notYetAnotherWiki.lua | |||
@@ -629,6 +629,8 @@ local Writer = Lunamark.writer.html5.new(LunamarkOpts) | |||
629 | local Context = {} -- Coz can't otherwise pass context through to the deeper Lunamark functions I'm overriding. | 629 | local Context = {} -- Coz can't otherwise pass context through to the deeper Lunamark functions I'm overriding. |
630 | local lunaLinky = function(url) -- Fix up the links. | 630 | local lunaLinky = function(url) -- Fix up the links. |
631 | if ('https://wiki.devuan.org/' ~= url) and ('https://fos.wiki.devuan.org/' ~= url) then | 631 | if ('https://wiki.devuan.org/' ~= url) and ('https://fos.wiki.devuan.org/' ~= url) then |
632 | -- TODO - This might be covering up a bug elsewhere. | ||
633 | if '/Main/' == string.sub(url, 1, 6) then url = 'https://fos.wiki.devuan.org/' .. url end | ||
632 | 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 | 634 | 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 |
633 | if p == string.sub(url, 1, #p) then | 635 | if p == string.sub(url, 1, #p) then |
634 | local ur = string.sub(url, #p + 1) | 636 | local ur = string.sub(url, #p + 1) |
@@ -646,26 +648,28 @@ local lunaLinky = function(url) -- Fix up the links. | |||
646 | end | 648 | end |
647 | if (nil ~= md) and (nil ~= md.realURL) then url = md.realURL end | 649 | if (nil ~= md) and (nil ~= md.realURL) then url = md.realURL end |
648 | 650 | ||
649 | local xlnk = xLinks[string.gsub(ur, '%..*', '', 1)] | 651 | if 'https://fos.wiki.devuan.org/bin/' ~= string.sub(url, 1, 32) then |
650 | if nil == Context.path then | 652 | local xlnk = xLinks[string.gsub(ur, '%..*', '', 1)] |
651 | url = string.gsub(ur, '%.', '/', 1) | 653 | if nil == Context.path then |
652 | else | 654 | url = string.gsub(ur, '%.', '/', 1) |
653 | if nil == xlnk then xlnk = string.gsub(string.gsub(ur, '%..*', '', 1), '/.*', '', 1) end | 655 | else |
654 | if '' ~= Context.path then xlnk = linkFrom(Context.path, xlnk) end | 656 | if nil == xlnk then xlnk = string.gsub(string.gsub(ur, '%..*', '', 1), '/.*', '', 1) end |
655 | if '/' == string.sub(xlnk, 1, 1) then xlnk = string.sub(xlnk, 2) end | 657 | if '' ~= Context.path then xlnk = linkFrom(Context.path, xlnk) end |
656 | if ('' ~= xlnk) and ('/' ~= string.sub(xlnk, -1)) then xlnk = xlnk .. '/' end | 658 | if '/' == string.sub(xlnk, 1, 1) then xlnk = string.sub(xlnk, 2) end |
657 | if 'DUNNO/' == xlnk then print('OOPS! page not found - @' .. Context.path .. ' / ' .. Context.bit .. '\t' .. url .. ' -> ' .. xlnk .. ' ' .. string.gsub(ur, '.*%.', '', 1) .. '.HTML') end | 659 | if ('' ~= xlnk) and ('/' ~= string.sub(xlnk, -1)) then xlnk = xlnk .. '/' end |
658 | end | 660 | if 'DUNNO/' == xlnk then print('OOPS! page not found - @' .. Context.path .. ' / ' .. Context.bit .. '\t' .. url .. ' -> ' .. xlnk .. ' ' .. string.gsub(ur, '.*%.', '', 1) .. '.HTML') end |
661 | end | ||
659 | -- if (nil ~= md) and (nil ~= md.realURL) then url = md.realURL | 662 | -- if (nil ~= md) and (nil ~= md.realURL) then url = md.realURL |
660 | -- else | 663 | -- else |
661 | url = xlnk .. string.gsub(ur, '.*%.', '', 1) | 664 | url = xlnk .. string.gsub(ur, '.*%.', '', 1) |
662 | -- end | 665 | -- end |
663 | if 'PmWiki/uploads/' == p then | 666 | if 'PmWiki/uploads/' == p then |
664 | url = '../' .. p .. string.gsub(ur, '%.', '.', 1) | 667 | url = '../' .. p .. string.gsub(ur, '%.', '.', 1) |
665 | elseif 'Foswiki/pub/' == p then | 668 | elseif 'Foswiki/pub/' == p then |
666 | url = '../' .. p .. ur | 669 | url = '../' .. p .. ur |
667 | else | 670 | else |
668 | url = url .. '.HTML' | 671 | url = url .. '.HTML' |
672 | end | ||
669 | end | 673 | end |
670 | end | 674 | end |
671 | end | 675 | end |