Created
October 5, 2011 16:26
-
-
Save metaphox/1264916 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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