diff options
| author | onefang | 2026-01-28 20:31:38 +1000 |
|---|---|---|
| committer | onefang | 2026-01-28 20:31:38 +1000 |
| commit | f3ecb62028a8c44bf9e52613022a95c6fb3b8eac (patch) | |
| tree | add28b4354d1ec6f7422ae7896c376ee96c03d41 | |
| parent | OOps 2 (diff) | |
| download | notYetAnotherWiki-f3ecb62028a8c44bf9e52613022a95c6fb3b8eac.zip notYetAnotherWiki-f3ecb62028a8c44bf9e52613022a95c6fb3b8eac.tar.gz notYetAnotherWiki-f3ecb62028a8c44bf9e52613022a95c6fb3b8eac.tar.bz2 notYetAnotherWiki-f3ecb62028a8c44bf9e52613022a95c6fb3b8eac.tar.xz | |
Moar linky tweakage.
| -rwxr-xr-x | notYetAnotherWiki.lua | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua index 0a1e8b3..b85ede7 100755 --- a/notYetAnotherWiki.lua +++ b/notYetAnotherWiki.lua | |||
| @@ -759,8 +759,8 @@ local lunaLinky = function(url, lab, tit) -- Fix up the links. | |||
| 759 | u = u | 759 | u = u |
| 760 | elseif u:sub(1, 15) == 'wiki.devuan.org' then | 760 | elseif u:sub(1, 15) == 'wiki.devuan.org' then |
| 761 | u = u | 761 | u = u |
| 762 | else | 762 | -- else |
| 763 | return url | 763 | --print('************************ ' .. url) |
| 764 | end | 764 | end |
| 765 | if ('https://wiki.devuan.org/' ~= url) and ('https://fos.wiki.devuan.org/' ~= url) then | 765 | if ('https://wiki.devuan.org/' ~= url) and ('https://fos.wiki.devuan.org/' ~= url) then |
| 766 | -- TODO - This might be covering up a bug elsewhere. | 766 | -- TODO - This might be covering up a bug elsewhere. |
| @@ -775,7 +775,7 @@ local lunaLinky = function(url, lab, tit) -- Fix up the links. | |||
| 775 | if '/System/' == url:sub(1, 8) then | 775 | if '/System/' == url:sub(1, 8) then |
| 776 | url = 'https://fos.wiki.devuan.org' .. url | 776 | url = 'https://fos.wiki.devuan.org' .. url |
| 777 | end | 777 | end |
| 778 | 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 | 778 | 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 |
| 779 | if p == url:sub(1, #p) then | 779 | if p == url:sub(1, #p) then |
| 780 | local ur = url:sub(#p + 1) | 780 | local ur = url:sub(#p + 1) |
| 781 | -- TODO - could probably replace some of this mess with RE.gsub() and friends. Meh, it works. | 781 | -- TODO - could probably replace some of this mess with RE.gsub() and friends. Meh, it works. |
| @@ -820,21 +820,23 @@ local lunaLinky = function(url, lab, tit) -- Fix up the links. | |||
| 820 | end | 820 | end |
| 821 | end | 821 | end |
| 822 | end | 822 | end |
| 823 | if (url:sub(-4) ~= '.png') and (url:sub(-5) ~= '.HTML') then url = url .. '.HTML' end | ||
| 823 | if not done then | 824 | if not done then |
| 824 | --[[ | 825 | -- TODO - Should check if this came from DocuWiki in the first place, AND double check this is for img src. |
| 825 | -- TODO - Should check if this came from DocuWiki in the first place, AND double check this is for img src. | 826 | if url:sub(1, 1) == '/' then |
| 826 | elseif '/' == p then | 827 | local p = url |
| 827 | local cnt = 3 | 828 | local cnt = 0 |
| 828 | for j = 1, #p do | 829 | for j = 1, #p do |
| 829 | if '/' == p:sub(j, j) then cnt = cnt + 1 end | 830 | if '/' == p:sub(j, j) then cnt = cnt + 1 end |
| 830 | end | 831 | end |
| 831 | if p:sub(1, 9) ~= 'DocuWiki/' then cnt = cnt + 1 end | 832 | -- if p:sub(1, 9) ~= 'DocuWiki/' then cnt = cnt + 1 end |
| 832 | if ur:sub(-4) ~= '.png' then ur = ur .. '.HTML'; cnt = cnt - 2 end | 833 | if url:sub(-4) == '.png' then cnt = cnt + 1 end |
| 833 | url = string.rep('../', cnt) .. 'DocuWiki/pages' .. p .. ur | 834 | url = string.rep('../', cnt) .. 'DocuWiki/pages' .. p |
| 834 | ]] | 835 | elseif url:sub(1, 37) == 'https://friendsofdevuan.org/doku.php/' then |
| 836 | url = 'DocuWiki/pages' .. url:sub(37):gsub(':', '/') | ||
| 837 | end | ||
| 835 | end | 838 | end |
| 836 | if (url:sub(-4) ~= '.png') and (url:sub(-5) ~= '.HTML') then url = url .. '.HTML' end | 839 | return url:gsub('//DocuWiki//DocuWiki//', '/DocuWiki/') |
| 837 | return url | ||
| 838 | end | 840 | end |
| 839 | 841 | ||
| 840 | function Writer.header(s, level) | 842 | function Writer.header(s, level) |
