diff options
-rwxr-xr-x | notYetAnotherWiki.lua | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua index 527a4e2..44f311c 100755 --- a/notYetAnotherWiki.lua +++ b/notYetAnotherWiki.lua | |||
@@ -217,7 +217,7 @@ toSub('') | |||
217 | if nil == Directory then Directory = '.' end | 217 | if nil == Directory then Directory = '.' end |
218 | 218 | ||
219 | -- Sort out realURL for symlinked .md.md files. | 219 | -- Sort out realURL for symlinked .md.md files. |
220 | for l in io.popen('find -L ' .. Directory .. ' -name "*.md.md" -xtype l -printf "%P\n"'):lines() do | 220 | for l in io.popen('find -L ' .. Directory .. ' -name unsorted -prune -o -name "*.md.md" -xtype l -printf "%P\n"'):lines() do |
221 | local metadata = readMdMd(string.sub(l, 1, -4), {}) | 221 | local metadata = readMdMd(string.sub(l, 1, -4), {}) |
222 | -- FIXME - if this already exists, compare the timestamps, most recent wins. | 222 | -- FIXME - if this already exists, compare the timestamps, most recent wins. |
223 | metadata.realURL = string.sub(l, 1, -7) | 223 | 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 | |||
230 | end | 230 | end |
231 | end | 231 | end |
232 | 232 | ||
233 | -- Clean up unsorted. | ||
234 | 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 | ||
235 | local tp = '_fos' | ||
236 | local metadata = readMdMd(l, {}) | ||
237 | if nil ~= metadata then | ||
238 | if "PmWiki" == metadata.ogWiki then tp = '_pm' end | ||
239 | if nil ~= metadata.ogFile then | ||
240 | local unsort = 'unsorted/' .. metadata.ogFile | ||
241 | local a, e = io.open(unsort .. tp .. '.md' , 'r') | ||
242 | if nil ~= a then | ||
243 | a:close() | ||
244 | os.execute('rm ' .. unsort .. tp .. '.*') | ||
245 | end | ||
246 | end | ||
247 | end | ||
248 | end | ||
249 | |||
250 | -- Look for copied pages from the other wikis. | ||
233 | for l in io.popen('find -L ' .. Directory .. ' -name "*.HTM" -type f,l -printf "%P\n"'):lines() do | 251 | for l in io.popen('find -L ' .. Directory .. ' -name "*.HTM" -type f,l -printf "%P\n"'):lines() do |
234 | -- print('pandoc converting ' .. l .. ' -> ' .. string.sub(l, 1, -4) .. 'md') | 252 | -- print('pandoc converting ' .. l .. ' -> ' .. string.sub(l, 1, -4) .. 'md') |
235 | -- Open the HTM files and do the initial cleanups, then pandoc them. | 253 | -- Open the HTM files and do the initial cleanups, then pandoc them. |