mod_pubsub_summary: Include multiple links (e.g. podcast media)
--- a/mod_pubsub_summary/mod_pubsub_summary.lua Wed Feb 10 16:04:17 2021 +0100
+++ b/mod_pubsub_summary/mod_pubsub_summary.lua Wed Feb 10 16:05:14 2021 +0100
@@ -30,15 +30,17 @@
nbsp = utf8 and utf8.char(0xa0) or " ";
});
end
- local link = payload:get_child("link");
local summary;
if title and content then
summary = title .. "\n\n" .. content;
elseif title or content then
summary = content or title;
end
- if link and link.attr.href and link.attr.href ~= content then
- summary = (summary and summary .. "\n" or "") .. link.attr.href;
+ for link in payload:childtags("link") do
+ if link and link.attr.href and link.attr.href ~= content then
+ summary = (summary and summary .. "\n" or "") .. link.attr.href;
+ if link.attr.rel then summary = summary .. " [" .. link.attr.rel .. "]" end
+ end
end
return summary;
end, 1);