From 3e90eba0ec0a007a1b6a85e4d2f02c4762d82e2b Mon Sep 17 00:00:00 2001 From: dvs1 Date: Fri, 3 Jan 2025 09:50:52 +1000 Subject: whichPage() no longer cares about case, add "about", and fall back to whatever happens to be first. --- notYetAnotherWiki.lua | 9 ++++++--- 1 file 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 -- These functions assume the above file and sub scan has completed. -- Which page in this directory should we show? +-- NOTE - only looking for the .md files we scanned for before, any stray HTML, html, HTM, atd htm files will get ignored. local whichPage = function(f) local fl = '' - if (nil ~= Subs[f]) then + if (nil ~= Subs[f]) and (nil ~= Subs[f].files) then if 1 == #(Subs[f].files) then fl = Subs[f].files[1] .. '.HTML' else -- Standard files to search for. - for i, v in ipairs{'README', 'readme', 'INDEX', 'index'} do + for i, v in ipairs{'about', 'readme', 'index'} do for j, w in ipairs(Subs[f].files) do - if v == w then + if v == string.lower(w) then print('FOUND ' .. v .. '.HTML') fl = v .. '.HTML' break @@ -118,6 +119,8 @@ local whichPage = function(f) end if '' ~= fl then break end end + -- If nothing else, just grab the first one. + if ('' == fl) and (nil ~= Subs[f].files[1]) then fl = Subs[f].files[1] end end end return fl -- cgit v1.1