public
Created

  • Download Gist
convert.lua
Lua
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
function entry(metadata)
local postname = '_posts/' .. metadata.ref .. '.lua'
local pubdate = os.date("*t", metadata.pubdate)
print('Processing ' .. postname)
local convertedname = '_posts/' .. pubdate.year .. '-'
.. pubdate.month .. '-'
.. pubdate.day .. '-'
.. metadata.ref .. '.html'
print('Converting file into ' .. convertedname)
local f = assert(io.open(convertedname, 'w'))
function blogentry(entry)
io.output(f)
io.write('---\n')
io.write('title: ', entry.title, '\n')
io.write('layout: post\n')
io.write('---\n')
io.write(entry.text)
end
dofile(postname)
f:close()
end
 
function convert(file_name)
dofile(file_name)
end
 
convert('blogmeta.lua')
~

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.