Changeset

4436:07529dba102d

mod_pubsub_summary: Include multiple links (e.g. podcast media)
author Kim Alvefur <zash@zash.se>
date Wed, 10 Feb 2021 16:05:14 +0100
parents 4435:a620bf249e63
children 4437:09657f758f53
files mod_pubsub_summary/mod_pubsub_summary.lua
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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);