diff --git a/man/remwharead.1.adoc b/man/remwharead.1.adoc index 1de1ca1..71cfd32 100644 --- a/man/remwharead.1.adoc +++ b/man/remwharead.1.adoc @@ -2,7 +2,7 @@ :doctype: manpage :Author: tastytea :Email: tastytea@tastytea.de -:Date: 2019-09-20 +:Date: 2019-09-21 :Revision: 0.0.0 :man source: remwharead :man manual: General Commands Manual @@ -92,7 +92,12 @@ Print version, copyright and license. .Output all articles by Jan Müller, consider different spellings. ==== -`remwharead -e simple -S 'Jan\[[:space:]]+M(ü|ue)ller' -r` +`remwharead -e simple -S 'Jan[\s]+M(ü|ue?)ller' -r` +==== + +.Export all things from the last week to an RSS feed. +==== +`remwharead -e rss -T $(date -d "-1 week" -I),$(date -I) | sed 's||https://example.com/|' > /var/www/feed.rss` ==== === Display database diff --git a/src/lib/export/rss.cpp b/src/lib/export/rss.cpp index 758b8a5..ac82bd8 100644 --- a/src/lib/export/rss.cpp +++ b/src/lib/export/rss.cpp @@ -15,6 +15,7 @@ */ #include +#include #include #include #include @@ -57,7 +58,6 @@ namespace remwharead writer.endElement("", "", "title"); writer.startElement("", "", "link"); - // FIXME: There has to be an URL here. writer.endElement("", "", "link"); writer.startElement("", "", "description"); @@ -79,7 +79,20 @@ namespace remwharead writer.startElement("", "", "item"); writer.startElement("", "", "title"); - writer.characters(entry.title); + if (!entry.title.empty()) + { + writer.characters(entry.title); + } + else + { + constexpr std::uint8_t maxlen = 100; + string title = entry.description.substr(0, maxlen); + if (entry.description.length() > maxlen) + { + title += " […]"; + } + writer.characters(title); + } writer.endElement("", "", "title"); writer.startElement("", "", "link"); @@ -101,11 +114,11 @@ namespace remwharead string description = entry.description; if (!description.empty()) { - description += "\n\n"; + description = "

" + description + "

"; } if (!entry.tags.empty()) { - description += "Tags: "; + description += "

Tags: "; for (const string &tag : entry.tags) { description += tag; @@ -114,10 +127,13 @@ namespace remwharead description += ", "; } } + description += "

"; } if (!entry.archive_uri.empty()) { - description += "\n\nArchived version: " + entry.archive_uri; + description += "

Archived version: " + "" + + entry.archive_uri + ""; } writer.startElement("", "", "description"); writer.characters(description);