Changeset

5135:35085e0d52ad

mod_pubsub_summary: Trim preceding and trailing whitespace from title To improve formatting of titles encoded like <title> Lorem Ipsum </title>
author Kim Alvefur <zash@zash.se>
date Tue, 10 Jan 2023 16:05:01 +0100
parents 5134:e0d0ef564095
children 5136:67b2c982bea2
files mod_pubsub_summary/mod_pubsub_summary.lua
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pubsub_summary/mod_pubsub_summary.lua	Sun Jan 08 17:54:11 2023 +0100
+++ b/mod_pubsub_summary/mod_pubsub_summary.lua	Tue Jan 10 16:05:01 2023 +0100
@@ -4,6 +4,7 @@
 module:hook("pubsub-summary/http://www.w3.org/2005/Atom", function (event)
 	local payload = event.payload;
 	local title = payload:get_child_text("title");
+	if title then title = title:gsub("^%s+", ""):gsub("%s+$", ""); end
 	-- Note: This prefers content over summary, it was made for a news feed where
 	-- the interesting stuff was in the content and the summary was .. meh.
 	local content_tag = payload:get_child("content") or payload:get_child("summary");