diff options
author | dvs1 | 2025-01-03 09:50:52 +1000 |
---|---|---|
committer | dvs1 | 2025-01-03 09:50:52 +1000 |
commit | 3e90eba0ec0a007a1b6a85e4d2f02c4762d82e2b (patch) | |
tree | e583b29e113a1e30e2912381853a7f86ccfe0d14 | |
parent | TODO twiddle. (diff) | |
download | notYetAnotherWiki-3e90eba0ec0a007a1b6a85e4d2f02c4762d82e2b.zip notYetAnotherWiki-3e90eba0ec0a007a1b6a85e4d2f02c4762d82e2b.tar.gz notYetAnotherWiki-3e90eba0ec0a007a1b6a85e4d2f02c4762d82e2b.tar.bz2 notYetAnotherWiki-3e90eba0ec0a007a1b6a85e4d2f02c4762d82e2b.tar.xz |
whichPage() no longer cares about case, add "about", and fall back to whatever happens to be first.
-rwxr-xr-x | notYetAnotherWiki.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua index 9909d53..9cff0f3 100755 --- a/notYetAnotherWiki.lua +++ b/notYetAnotherWiki.lua | |||
@@ -103,14 +103,15 @@ end | |||
103 | -- These functions assume the above file and sub scan has completed. | 103 | -- These functions assume the above file and sub scan has completed. |
104 | 104 | ||
105 | -- Which page in this directory should we show? | 105 | -- Which page in this directory should we show? |
106 | -- NOTE - only looking for the .md files we scanned for before, any stray HTML, html, HTM, atd htm files will get ignored. | ||
106 | local whichPage = function(f) | 107 | local whichPage = function(f) |
107 | local fl = '' | 108 | local fl = '' |
108 | if (nil ~= Subs[f]) then | 109 | if (nil ~= Subs[f]) and (nil ~= Subs[f].files) then |
109 | if 1 == #(Subs[f].files) then fl = Subs[f].files[1] .. '.HTML' else | 110 | if 1 == #(Subs[f].files) then fl = Subs[f].files[1] .. '.HTML' else |
110 | -- Standard files to search for. | 111 | -- Standard files to search for. |
111 | for i, v in ipairs{'README', 'readme', 'INDEX', 'index'} do | 112 | for i, v in ipairs{'about', 'readme', 'index'} do |
112 | for j, w in ipairs(Subs[f].files) do | 113 | for j, w in ipairs(Subs[f].files) do |
113 | if v == w then | 114 | if v == string.lower(w) then |
114 | print('FOUND ' .. v .. '.HTML') | 115 | print('FOUND ' .. v .. '.HTML') |
115 | fl = v .. '.HTML' | 116 | fl = v .. '.HTML' |
116 | break | 117 | break |
@@ -118,6 +119,8 @@ local whichPage = function(f) | |||
118 | end | 119 | end |
119 | if '' ~= fl then break end | 120 | if '' ~= fl then break end |
120 | end | 121 | end |
122 | -- If nothing else, just grab the first one. | ||
123 | if ('' == fl) and (nil ~= Subs[f].files[1]) then fl = Subs[f].files[1] end | ||
121 | end | 124 | end |
122 | end | 125 | end |
123 | return fl | 126 | return fl |