~hristoast/hristoast

c54bc752b70cff74ef8426fe8b0f603fc96229e7 — Hristos N. Triantafillou a month ago 107f8a3
Remove footnotes from excerpts while generating the atom feed
2 files changed, 9 insertions(+), 1 deletions(-)

M plugins/atom.lua
M soupault.conf
M plugins/atom.lua => plugins/atom.lua +8 -1
@@ 12,7 12,6 @@ feed_file = config["feed_file"]
data["site_url"] = soupault_config["custom_options"]["site_url"]
data["feed_id"] = soupault_config["custom_options"]["site_url"]


function in_section(entry)
  return (entry["nav_path"][1] == config["use_section"])
end


@@ 32,6 31,14 @@ while (n <= count) do
    if entry["date"] then
      entry["date"] = Date.reformat(entry["date"], date_input_formats, "%Y-%m-%dT%H:%M:%S%:z")
    end

    if entry["excerpt"] then
        -- Remove unwanted elements (e.g. footnotes) from the excerpt
        local excerpt = HTML.parse(entry["excerpt"])
        Table.iter_values(HTML.delete, HTML.select_all_of(excerpt, config["delete_elements"]))
        entry["excerpt"] = tostring(excerpt)
    end

    entries[m] = entry
    m = m + 1
  end

M soupault.conf => soupault.conf +1 -0
@@ 70,6 70,7 @@
  profile = "live"
  page = "blog/index.html"
  use_section = "blog"
  delete_elements = [".footnote", "a"]
  feed_file = "atom.xml"
  feed_author = "Hristos"
  feed_author_email = "me@hristos.co"