From ba4d886cb510a1c9b829bc7db9d636fa6083011b Mon Sep 17 00:00:00 2001 From: dvs1 Date: Fri, 14 Mar 2025 18:07:31 +1000 Subject: Sort out unsorted. --- notYetAnotherWiki.lua | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua index 527a4e2..44f311c 100755 --- a/notYetAnotherWiki.lua +++ b/notYetAnotherWiki.lua @@ -217,7 +217,7 @@ toSub('') if nil == Directory then Directory = '.' end -- Sort out realURL for symlinked .md.md files. -for l in io.popen('find -L ' .. Directory .. ' -name "*.md.md" -xtype l -printf "%P\n"'):lines() do +for l in io.popen('find -L ' .. Directory .. ' -name unsorted -prune -o -name "*.md.md" -xtype l -printf "%P\n"'):lines() do local metadata = readMdMd(string.sub(l, 1, -4), {}) -- FIXME - if this already exists, compare the timestamps, most recent wins. metadata.realURL = string.sub(l, 1, -7) @@ -230,6 +230,24 @@ for l in io.popen('find -L ' .. Directory .. ' -name "*.md.md" -xtype l -printf end 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 + local tp = '_fos' + local metadata = readMdMd(l, {}) + if nil ~= metadata then + if "PmWiki" == metadata.ogWiki then tp = '_pm' end + if nil ~= metadata.ogFile then + local unsort = 'unsorted/' .. metadata.ogFile + local a, e = io.open(unsort .. tp .. '.md' , 'r') + if nil ~= a then + a:close() + os.execute('rm ' .. unsort .. tp .. '.*') + end + end + end +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 -- print('pandoc converting ' .. l .. ' -> ' .. string.sub(l, 1, -4) .. 'md') -- Open the HTM files and do the initial cleanups, then pandoc them. -- cgit v1.1