aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xnotYetAnotherWiki.lua17
1 files changed, 12 insertions, 5 deletions
diff --git a/notYetAnotherWiki.lua b/notYetAnotherWiki.lua
index c7b205d..90c8514 100755
--- a/notYetAnotherWiki.lua
+++ b/notYetAnotherWiki.lua
@@ -103,11 +103,18 @@ for name, file in pairs(Files) do
103 else 103 else
104 -- Ordinary md file, stash it's metadata and parsed body. 104 -- Ordinary md file, stash it's metadata and parsed body.
105 -- I need cmark-gfm, coz lcmark doesn't support tables and stuff, it only does basic cmark. 105 -- I need cmark-gfm, coz lcmark doesn't support tables and stuff, it only does basic cmark.
106 -- Have to strip out the metadata first, coz cmark-gfm doesn't grok that. 106 local out = ''
107 h = io.popen('cp "' .. name .. '.md" "' .. name .. '02" ; csplit -ksz -f "' .. name .. '" "' .. name .. '.md" "/^---$/+1" "{1}" 2>/dev/null ; rm "' .. name .. '00" ; rm "' .. name .. '01" 2>/dev/null') 107 h = io.popen('if which cmark-gfm ; then echo "found" ; fi | tail -n 1')
108 if nil ~= h then h:close() end 108 if nil ~= h then out = h:read('a') ; h:close() end
109 h = io.popen('cmark-gfm -t html -e footnotes -e table -e strikethrough -e autolink -e tagfilter -e tasklist "' .. name .. '02" ; rm "' .. name .. '02"') 109 if 'found\n' == out then
110 if nil ~= h then body = h:read('*a') ; h:close() end 110 -- Have to strip out the metadata first, coz cmark-gfm doesn't grok that.
111 h = io.popen('cp "' .. name .. '.md" "' .. name .. '02" ; csplit -ksz -f "' .. name .. '" "' .. name .. '.md" "/^---$/+1" "{1}" 2>/dev/null ; rm "' .. name .. '00" ; rm "' .. name .. '01" 2>/dev/null')
112 if nil ~= h then h:close() end
113 h = io.popen('cmark-gfm -t html -e footnotes -e table -e strikethrough -e autolink -e tagfilter -e tasklist "' .. name .. '02" ; rm "' .. name .. '02"')
114 if nil ~= h then body = h:read('*a') ; h:close() end
115 else
116 print('cmark-gfm not found')
117 end
111 Files[name].metadata = metadata 118 Files[name].metadata = metadata
112 Files[name].body = body 119 Files[name].body = body
113 table.insert(Subs[path].files, bit) 120 table.insert(Subs[path].files, bit)