Merge branch 'develop' into main
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2019-09-21 22:04:48 +02:00
commit 4546aed507
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 28 additions and 7 deletions

View File

@ -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|<link/>|<link>https://example.com/</link>|' > /var/www/feed.rss`
====
=== Display database

View File

@ -15,6 +15,7 @@
*/
#include <ctime>
#include <cstdint>
#include <Poco/XML/XMLWriter.h>
#include <Poco/SAX/AttributesImpl.h>
#include <Poco/DateTime.h>
@ -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 = "<p>" + description + "</p>";
}
if (!entry.tags.empty())
{
description += "Tags: ";
description += "<p><strong>Tags:</strong> ";
for (const string &tag : entry.tags)
{
description += tag;
@ -114,10 +127,13 @@ namespace remwharead
description += ", ";
}
}
description += "</p>";
}
if (!entry.archive_uri.empty())
{
description += "\n\nArchived version: " + entry.archive_uri;
description += "<p><strong>Archived version:</strong> "
"<a href=\"" + entry.archive_uri + "\">"
+ entry.archive_uri + "</a>";
}
writer.startElement("", "", "description");
writer.characters(description);