From f100e861884cb261bf0598215d3e7d8aba1f3f89 Mon Sep 17 00:00:00 2001 From: dvs1 Date: Thu, 27 Mar 2025 09:47:22 +1000 Subject: directory -> folder Let's be consistent, now we are using a folder icon. --- notYetAnotherWiki.lua | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'notYetAnotherWiki.lua') diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua index f12547a..0883d87 100755 --- a/notYetAnotherWiki.lua +++ b/notYetAnotherWiki.lua @@ -215,10 +215,11 @@ else print("Can't open everything.md for writing.") end --- Scan the subdirectories looking for our files. -local Directory = arg[1] +-- Scan the sub folders looking for our files. +local Folder = arg[1] toSub('') -if nil == Directory then Directory = '.' end +if nil == Folder then Folder = '.' end +--GlobalMetaData.root = Folder --[[ Sort out realURL for symlinked .md.md files. realURL is the generic URL part for this page. By policy it points to whatever is the latest copy / symlink of the original download .md.md. @@ -230,7 +231,7 @@ if nil == Directory then Directory = '.' end For the "page moved" problem, that'll be the most recent symlink, the old one still has it's symlink pointing to the download .md.md, which gets updated with the current realURL. So when some external old URL points to someplace a page used to be, it's old symlink points to the up to date download .md.md, and we know where to go to find the page now. ]] -for l in io.popen('find -L ' .. Directory .. ' -name unsorted -prune -o -name "*.md.md" -xtype l -printf "%P\n"'):lines() do +for l in io.popen('find -L ' .. Folder .. ' -name unsorted -prune -o -name "*.md.md" -xtype l -printf "%P\n"'):lines() do local metadata = readMdMd(string.sub(l, 1, -4), {}) if nil == metadata.realURL then metadata.realURL = string.sub(l, 1, -7) @@ -256,7 +257,7 @@ for l in io.popen('find -L ' .. Directory .. ' -name unsorted -prune -o -name "* end -- Clean up unsorted. -for l in io.popen('find -L ' .. Directory .. ' -name unsorted -prune -o -name "*.md" -a -not -name "*.md.md" -xtype l -printf "%P\n"'):lines() do +for l in io.popen('find -L ' .. Folder .. ' -name unsorted -prune -o -name "*.md" -a -not -name "*.md.md" -xtype l -printf "%P\n"'):lines() do local tp = '_fos' local metadata = readMdMd(l, {}) if nil ~= metadata then @@ -273,7 +274,7 @@ for l in io.popen('find -L ' .. Directory .. ' -name unsorted -prune -o -name "* end -- Look for copied pages from the other wikis. -for l in io.popen('find -L ' .. Directory .. ' -name "*.HTM" -type f,l -printf "%P\n"'):lines() do +for l in io.popen('find -L ' .. Folder .. ' -name "*.HTM" -type f,l -printf "%P\n"'):lines() do -- Only do this if .HTM is newer than .md, or .md doesn't exist. local htime = io.popen("date -ur " .. l .. " +%s"):read('l') local mtime = io.popen("date -ur " .. string.sub(l, 1, -4) .. "md +%s 2>/dev/null"):read('l') @@ -424,14 +425,14 @@ writeString(l .. '_ORIGINAL1', body) end end -if '.' ~= Directory then +if '.' ~= Folder then for l in io.popen('find -L . -name "*.md" -type f,l -printf "%P\n"'):lines() do toFile(string.gsub(l, '%.md$', '')) end end --- Can add in a distant directory to, for putting it's results in the current directory. -for l in io.popen('find -L ' .. Directory .. ' -name "*.md" -type f,l -printf "%P\n"'):lines() do +-- Can add in a distant folder to, for putting it's results in the current folder. +for l in io.popen('find -L ' .. Folder .. ' -name "*.md" -type f,l -printf "%P\n"'):lines() do local n = string.gsub(l, '%.md$', '') if nil == Files[n] then toFile(n) end end @@ -492,7 +493,7 @@ for name, sub in pairs(Subs) do print("EMPTY " .. name) h = io.open(name .. '/index.md', 'w') if nil ~= h then - h:write('This directory has no files.') + h:write('This folder has no files.') h:close() else print("Can't open " .. name .. '/index.md for writing.') @@ -504,7 +505,7 @@ end --------------------------------------------------------------------------------- -- These functions assume the above file and sub scan has completed. --- Which page in this directory should we show? +-- Which page in this folder should we show? -- NOTE - only looking for the .md files we scanned for before, any stray HTML, html, HTM, and htm files will get ignored. local whichPage = function(f) local fl = '' @@ -547,7 +548,7 @@ local whichWiki = function(metadata) end --- Calculate a link from the source directory to the destination directory. +-- Calculate a link from the source folder to the destination folder. local linkFrom = function(source, dest) -- Evil hacks! if 'Profiles' == dest then dest = 'PmWiki/Profiles' end -- cgit v1.1