Skip to content

Instantly share code, notes, and snippets.

@metaphox
Created October 5, 2011 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metaphox/1264916 to your computer and use it in GitHub Desktop.
Save metaphox/1264916 to your computer and use it in GitHub Desktop.
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')
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment