|
|
|
@ -33,7 +33,7 @@ end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
writer.docs.parse_config = [[ |
|
|
|
|
Read a config file in TOML format and load the values into a table. |
|
|
|
|
Read the config and template files, and load the values into a table. |
|
|
|
|
]] |
|
|
|
|
function writer.parse_config(config_file) |
|
|
|
|
local lines = util.split_lines(config_file) |
|
|
|
@ -107,6 +107,14 @@ function writer.parse_config(config_file) |
|
|
|
|
|
|
|
|
|
-- Set lang |
|
|
|
|
lang = require("lang." .. writer.conf.app_lang) |
|
|
|
|
|
|
|
|
|
-- Custom templates override lang defaults (ignore config) |
|
|
|
|
for name, file in pairs(env.defaults.config_files) do |
|
|
|
|
if name ~= "config" then |
|
|
|
|
local template = util.read_file(writer.conf.config_dir .. "/" .. file) |
|
|
|
|
if template ~= "" then lang[name] = template end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -301,16 +309,15 @@ function writer.gen_atom_feed() |
|
|
|
|
-- Reverse insert log posts, newest first |
|
|
|
|
for e = #writer.posts, 1, -1 do |
|
|
|
|
feed_post = lang.atom_entry |
|
|
|
|
-- Escape html entities in post contents. "%" is also a special character |
|
|
|
|
-- for string.gsub() and similar functions, and will cause an error if not |
|
|
|
|
-- escaped. |
|
|
|
|
writer.posts[e]["content"] = |
|
|
|
|
util.replace_html_entities(writer.posts[e]["content"]) |
|
|
|
|
writer.posts[e]["content"] = util.replace_feed_entities( |
|
|
|
|
writer.posts[e]["content"]) |
|
|
|
|
feed_post = util.replace_vars(feed_post, lang.tpl_vars.post, |
|
|
|
|
writer.posts[e]) |
|
|
|
|
feed_text = feed_text .. feed_post |
|
|
|
|
end |
|
|
|
|
feed_text = feed_text .. lang.atom_footer |
|
|
|
|
feed_text = util.replace_feed_entities(feed_text, "post") |
|
|
|
|
|
|
|
|
|
util.write_file(writer.conf.cap.gemlog_dir .. "/" .. |
|
|
|
|
writer.conf.cap.atom_feed, feed_text) |
|
|
|
|
end |
|
|
|
|