Mercurial > prosody-modules
comparison mod_pubsub_summary/mod_pubsub_summary.lua @ 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 | a620bf249e63 |
| children | 09657f758f53 |
comparison
equal
deleted
inserted
replaced
| 4435:a620bf249e63 | 4436:07529dba102d |
|---|---|
| 28 gt = ">"; | 28 gt = ">"; |
| 29 amp = "&"; | 29 amp = "&"; |
| 30 nbsp = utf8 and utf8.char(0xa0) or " "; | 30 nbsp = utf8 and utf8.char(0xa0) or " "; |
| 31 }); | 31 }); |
| 32 end | 32 end |
| 33 local link = payload:get_child("link"); | |
| 34 local summary; | 33 local summary; |
| 35 if title and content then | 34 if title and content then |
| 36 summary = title .. "\n\n" .. content; | 35 summary = title .. "\n\n" .. content; |
| 37 elseif title or content then | 36 elseif title or content then |
| 38 summary = content or title; | 37 summary = content or title; |
| 39 end | 38 end |
| 40 if link and link.attr.href and link.attr.href ~= content then | 39 for link in payload:childtags("link") do |
| 41 summary = (summary and summary .. "\n" or "") .. link.attr.href; | 40 if link and link.attr.href and link.attr.href ~= content then |
| 41 summary = (summary and summary .. "\n" or "") .. link.attr.href; | |
| 42 if link.attr.rel then summary = summary .. " [" .. link.attr.rel .. "]" end | |
| 43 end | |
| 42 end | 44 end |
| 43 return summary; | 45 return summary; |
| 44 end, 1); | 46 end, 1); |
