From 132eaa065b3f5d8320ae5a3bedc28034c64e15ca Mon Sep 17 00:00:00 2001 From: dvs1 Date: Sat, 28 Dec 2024 16:09:59 +1000 Subject: OOPS-- --- notYetAnotherWiki.lua | 81 --------------------------------------------------- 1 file changed, 81 deletions(-) diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua index 65137b5..37bbd94 100755 --- a/notYetAnotherWiki.lua +++ b/notYetAnotherWiki.lua @@ -216,85 +216,4 @@ for k, v in pairs(sites) do end - local h = io.open(file, 'r') - if nil ~= h then - local cm = h:read('*a') - local result = '' - local body, metadata, err = lcmark.convert(cm, "html", {smart = true, yaml_metadata = true, columns = 0}) - - if nil == body then print('oops! ' .. err) else - local bod, err = lcmark.compile_template(body) - if nil == bod then print('oops! ' .. err) else - local templateFile = metadata.template - if nil == file then - templateFile = nil - else - if nil == templateFile then templateFile = 'default' end - templateFile = templateFile .. '.template' - for m, x in pairs(globalData) do - if nil == metadata[m] then metadata[m] = x else print('metadata already has ' .. m) end - end - end - - if nil ~= v.files then - for m, x in ipairs(v.files) do - metadata.menu = metadata.menu .. x.URL .. '\n' - end - end - if nil ~= v.subs then - for m, x in pairs(v.subs) do - metadata.header = metadata.header .. x.URL - end - end - - local num = #(v.bits) - local trail = 'home   ' - local p = v.parent - for i = 1, num do - trail = trail .. '' .. v.bits[i] .. '   ' - end - trail = trail .. w.name - metadata.trail = trail - - metadata.body = lcmark.apply_template(bod, metadata) - - local tm = '' - if nil ~= templateFile then - local h = io.open(templateFile, 'r') - if nil ~= h then - tm = tm .. h:read('*a') - h:close() - else - print('oops! No such file ' .. templateFile) - end - - local template, err = lcmark.compile_template(tm) - if nil == template then print('oops! ' .. err) else - result = lcmark.apply_template(template, metadata) - end - else - result = body - end - - if ('' ~= result) and (nil ~= file) then - local base = path .. w.name .. '.HTML' - print(base) - local a, e = io.open(base, 'w') - if nil == a then print('Could not open ' .. base .. ' - ' .. e) else - a:write(result) - a:close() - end - else - print('') - end - end - end - h:close() - else - print('oops! No such file ' .. file) - end - - end - end -end -- cgit v1.1