Sat, 11 Jul 2009 02:56:08 +0100
Move config into util.lua
build.lua | file | annotate | diff | comparison | revisions | |
util.lua | file | annotate | diff | comparison | revisions |
--- a/build.lua Sat Jul 11 02:53:24 2009 +0100 +++ b/build.lua Sat Jul 11 02:56:08 2009 +0100 @@ -3,29 +3,11 @@ require "lfs" require "util" --- Config -- - -dofile(arg[1] or ".blogrc") - -posts_dir = posts_dir or "_posts/" -layouts_dir = layouts_dir or "_layouts/" -output_dir = output_dir or "./" --- - -- - -- - -- Logging -- function make_msg(prefix, name) return function (fmt, ...) print(prefix, string.format(fmt, ...)); end end msg_info, msg_warn, msg_error = make_msg("II", "info"), make_msg("WW", "warn"), make_msg("EE", "error"); -- -- - -- -- --- Append '/' to end of posts_dir if necessary -posts_dir = posts_dir:gsub("([^/])$", "%1/") - --- Append '/' to end of output_dir if necessary -output_dir = output_dir:gsub("([^/])$", "%1/") - --- Append '/' to end of base_url if necessary -base_url = base_url:gsub("([^/])$", "%1/") - posts = {};
--- a/util.lua Sat Jul 11 02:53:24 2009 +0100 +++ b/util.lua Sat Jul 11 02:56:08 2009 +0100 @@ -7,3 +7,22 @@ end return short_title; end + +-- Config -- + +dofile(arg[1] or ".blogrc") + +posts_dir = posts_dir or "_posts/" +layouts_dir = layouts_dir or "_layouts/" +output_dir = output_dir or "./" +-- - -- - -- + +-- Append '/' to end of posts_dir if necessary +posts_dir = posts_dir:gsub("([^/])$", "%1/") + +-- Append '/' to end of output_dir if necessary +output_dir = output_dir:gsub("([^/])$", "%1/") + +-- Append '/' to end of base_url if necessary +base_url = base_url:gsub("([^/])$", "%1/") +