Export as JSON array.
+
Export as JSON array.
- Since
- 0.8.0
diff --git a/docs/classremwharead_1_1Export_1_1RSS-members.html b/docs/classremwharead_1_1Export_1_1RSS-members.html
index 199eb9c..4441b07 100644
--- a/docs/classremwharead_1_1Export_1_1RSS-members.html
+++ b/docs/classremwharead_1_1Export_1_1RSS-members.html
@@ -22,7 +22,7 @@
remwharead
- 0.8.1
+ 0.8.2
|
diff --git a/docs/classremwharead_1_1Export_1_1RSS.html b/docs/classremwharead_1_1Export_1_1RSS.html
index 2f47e7f..bdf04e7 100644
--- a/docs/classremwharead_1_1Export_1_1RSS.html
+++ b/docs/classremwharead_1_1Export_1_1RSS.html
@@ -22,7 +22,7 @@
remwharead
- 0.8.1
+ 0.8.2
|
@@ -74,7 +74,7 @@ $(function() {
-
Export as RSS feed.
+
Export as RSS feed.
More...
#include <remwharead/export/rss.hpp>
@@ -115,7 +115,7 @@ ostream &
_out | |
-
Export as RSS feed.
+
Export as RSS feed.
- Since
- 0.8.0
@@ -176,7 +176,7 @@ ostream &
_out | Print output to std::ostream.
Implements remwharead::Export::ExportBase.
-
42 XMLWriter writer(_out, XMLWriter::CANONICAL);
43 AttributesImpl attrs_rss, attrs_guid;
44 constexpr
char timefmt_rfc822[] =
"%w, %d %b %Y %H:%M:%S %Z";
46 attrs_rss.addAttribute(
"",
"",
"version",
"",
"2.0");
47 attrs_rss.addAttribute(
"",
"",
"xmlns:atom",
"",
48 "http://www.w3.org/2005/Atom");
49 attrs_guid.addAttribute(
"",
"",
"isPermaLink",
"",
"false");
51 writer.startDocument();
52 writer.startElement(
"",
"",
"rss", attrs_rss);
53 writer.startElement(
"",
"",
"channel");
55 writer.startElement(
"",
"",
"title");
56 writer.characters(
"Visited things");
57 writer.endElement(
"",
"",
"title");
59 writer.startElement(
"",
"",
"link");
61 writer.endElement(
"",
"",
"link");
63 writer.startElement(
"",
"",
"description");
64 writer.characters(
"Export from remwharead.");
65 writer.endElement(
"",
"",
"description");
67 writer.startElement(
"",
"",
"generator");
68 writer.characters(
string(
"remwharead ") + global::version);
69 writer.endElement(
"",
"",
"generator");
71 const string now = DateTimeFormatter::format(DateTime(),
73 writer.startElement(
"",
"",
"lastBuildDate");
74 writer.characters(now);
75 writer.endElement(
"",
"",
"lastBuildDate");
79 writer.startElement(
"",
"",
"item");
81 writer.startElement(
"",
"",
"title");
82 writer.characters(entry.title);
83 writer.endElement(
"",
"",
"title");
85 writer.startElement(
"",
"",
"link");
86 writer.characters(entry.uri);
87 writer.endElement(
"",
"",
"link");
89 writer.startElement(
"",
"",
"guid", attrs_guid);
90 writer.characters(entry.uri +
" at " +
91 timepoint_to_string(entry.datetime));
92 writer.endElement(
"",
"",
"guid");
94 const time_t time = system_clock::to_time_t(entry.datetime);
95 const string time_visited = DateTimeFormatter::format(
96 Timestamp::fromEpochTime(time), timefmt_rfc822);
97 writer.startElement(
"",
"",
"pubDate");
98 writer.characters(time_visited);
99 writer.endElement(
"",
"",
"pubDate");
101 string description = entry.description;
102 if (!description.empty())
104 description +=
"\n\n";
106 if (!entry.tags.empty())
108 description +=
"Tags: ";
109 for (
const string &tag : entry.tags)
112 if (tag != *(entry.tags.rbegin()))
118 if (!entry.archive_uri.empty())
120 description +=
"\n\nArchived version: " + entry.archive_uri;
122 writer.startElement(
"",
"",
"description");
123 writer.characters(description);
124 writer.endElement(
"",
"",
"description");
126 writer.endElement(
"",
"",
"item");
129 writer.endElement(
"",
"",
"channel");
130 writer.endElement(
"",
"",
"rss");
131 writer.endDocument();
134 catch (std::exception &e)
136 cerr <<
"Error in " << __func__ <<
": " << e.what() << endl;
struct remwharead::Database::entry entry
Describes a database entry.
+
43 XMLWriter writer(_out, XMLWriter::CANONICAL);
44 AttributesImpl attrs_rss, attrs_guid;
45 constexpr
char timefmt_rfc822[] =
"%w, %d %b %Y %H:%M:%S %Z";
47 attrs_rss.addAttribute(
"",
"",
"version",
"",
"2.0");
48 attrs_rss.addAttribute(
"",
"",
"xmlns:atom",
"",
49 "http://www.w3.org/2005/Atom");
50 attrs_guid.addAttribute(
"",
"",
"isPermaLink",
"",
"false");
52 writer.startDocument();
53 writer.startElement(
"",
"",
"rss", attrs_rss);
54 writer.startElement(
"",
"",
"channel");
56 writer.startElement(
"",
"",
"title");
57 writer.characters(
"Visited things");
58 writer.endElement(
"",
"",
"title");
60 writer.startElement(
"",
"",
"link");
61 writer.endElement(
"",
"",
"link");
63 writer.startElement(
"",
"",
"description");
64 writer.characters(
"Export from remwharead.");
65 writer.endElement(
"",
"",
"description");
67 writer.startElement(
"",
"",
"generator");
68 writer.characters(
string(
"remwharead ") + global::version);
69 writer.endElement(
"",
"",
"generator");
71 const string now = DateTimeFormatter::format(DateTime(),
73 writer.startElement(
"",
"",
"lastBuildDate");
74 writer.characters(now);
75 writer.endElement(
"",
"",
"lastBuildDate");
79 writer.startElement(
"",
"",
"item");
81 writer.startElement(
"",
"",
"title");
82 if (!entry.title.empty())
84 writer.characters(entry.title);
88 constexpr std::uint8_t maxlen = 100;
89 string title = entry.description.substr(0, maxlen);
90 if (entry.description.length() > maxlen)
94 writer.characters(title);
96 writer.endElement(
"",
"",
"title");
98 writer.startElement(
"",
"",
"link");
99 writer.characters(entry.uri);
100 writer.endElement(
"",
"",
"link");
102 writer.startElement(
"",
"",
"guid", attrs_guid);
103 writer.characters(entry.uri +
" at " +
104 timepoint_to_string(entry.datetime));
105 writer.endElement(
"",
"",
"guid");
107 const time_t time = system_clock::to_time_t(entry.datetime);
108 const string time_visited = DateTimeFormatter::format(
109 Timestamp::fromEpochTime(time), timefmt_rfc822);
110 writer.startElement(
"",
"",
"pubDate");
111 writer.characters(time_visited);
112 writer.endElement(
"",
"",
"pubDate");
114 string description = entry.description;
115 if (!description.empty())
117 description =
"<p>" + description +
"</p>";
119 if (!entry.tags.empty())
121 description +=
"<p><strong>Tags:</strong> ";
122 for (
const string &tag : entry.tags)
125 if (tag != *(entry.tags.rbegin()))
130 description +=
"</p>";
132 if (!entry.archive_uri.empty())
134 description +=
"<p><strong>Archived version:</strong> " 135 "<a href=\"" + entry.archive_uri +
"\">" 136 + entry.archive_uri +
"</a>";
138 writer.startElement(
"",
"",
"description");
139 writer.characters(description);
140 writer.endElement(
"",
"",
"description");
142 writer.endElement(
"",
"",
"item");
145 writer.endElement(
"",
"",
"channel");
146 writer.endElement(
"",
"",
"rss");
147 writer.endDocument();
150 catch (std::exception &e)
152 cerr <<
"Error in " << __func__ <<
": " << e.what() << endl;
struct remwharead::Database::entry entry
Describes a database entry.
diff --git a/docs/classremwharead_1_1Export_1_1Simple-members.html b/docs/classremwharead_1_1Export_1_1Simple-members.html
index 42de5b5..996f9ca 100644
--- a/docs/classremwharead_1_1Export_1_1Simple-members.html
+++ b/docs/classremwharead_1_1Export_1_1Simple-members.html
@@ -22,7 +22,7 @@
remwharead
- 0.8.1
+ 0.8.2
|
diff --git a/docs/classremwharead_1_1Export_1_1Simple.html b/docs/classremwharead_1_1Export_1_1Simple.html
index 452cbe5..8281f0d 100644
--- a/docs/classremwharead_1_1Export_1_1Simple.html
+++ b/docs/classremwharead_1_1Export_1_1Simple.html
@@ -22,7 +22,7 @@
remwharead
- 0.8.1
+ 0.8.2
|
diff --git a/docs/classremwharead_1_1Search-members.html b/docs/classremwharead_1_1Search-members.html
index 4097cab..2ae3033 100644
--- a/docs/classremwharead_1_1Search-members.html
+++ b/docs/classremwharead_1_1Search-members.html
@@ -22,7 +22,7 @@
remwharead
- 0.8.1
+ 0.8.2
|
diff --git a/docs/classremwharead_1_1Search.html b/docs/classremwharead_1_1Search.html
index 65fb365..08e34ec 100644
--- a/docs/classremwharead_1_1Search.html
+++ b/docs/classremwharead_1_1Search.html
@@ -22,7 +22,7 @@
remwharead
- 0.8.1
+ 0.8.2
|
diff --git a/docs/classremwharead_1_1URI-members.html b/docs/classremwharead_1_1URI-members.html
index bba1762..1593d13 100644
--- a/docs/classremwharead_1_1URI-members.html
+++ b/docs/classremwharead_1_1URI-members.html
@@ -22,7 +22,7 @@
remwharead
- 0.8.1
+ 0.8.2
|
diff --git a/docs/classremwharead_1_1URI.html b/docs/classremwharead_1_1URI.html
index 8962b6f..d424e6b 100644
--- a/docs/classremwharead_1_1URI.html
+++ b/docs/classremwharead_1_1URI.html
@@ -22,7 +22,7 @@
remwharead
- 0.8.1
+ 0.8.2
|
@@ -154,7 +154,7 @@ string
_uri |
Construct object and set URL.
Initializes TLS and sets proxy from the environment variable http_proxy
, if possible.
- Since
- 0.6.0
-
65 Poco::Net::initializeSSL();
69 HTTPClientSession::ProxyConfig proxy;
70 string proxy_env = Environment::get(
"http_proxy");
74 if ((pos = proxy_env.find(
"//")) != string::npos)
76 proxy_env = proxy_env.substr(pos + 2);
78 if ((pos = proxy_env.find(
'/')) != string::npos)
80 proxy_env = proxy_env.substr(0, pos);
83 if ((pos = proxy_env.find(
':')) != string::npos)
85 proxy.host = proxy_env.substr(0, pos);
86 proxy.port = std::stoi(proxy_env.substr(pos + 1));
90 proxy.host = proxy_env;
93 HTTPClientSession::setGlobalProxyConfig(proxy);
95 catch (
const std::exception &)
+
67 Poco::Net::initializeSSL();
71 HTTPClientSession::ProxyConfig proxy;
72 const string env_proxy = Environment::get(
"http_proxy");
73 const RegEx re_proxy(
"^(?:https?://)?(?:([^:]+):?([^@]*)@)?" 74 "([^:/]+)(?::([\\d]{1,5}))?/?$");
75 vector<string> matches;
77 if (re_proxy.split(env_proxy, matches) >= 4)
79 proxy.username = matches[1];
80 proxy.password = matches[2];
81 proxy.host = matches[3];
82 if (!matches[4].empty())
84 const std::uint32_t &port = std::stoul(matches[4]);
87 throw std::invalid_argument(
"Port number out of range");
92 HTTPClientSession::setGlobalProxyConfig(proxy);
94 catch (
const Poco::RegularExpressionException &e)
96 cerr <<
"Error: Proxy could not be set (" 97 << e.displayText() <<
")\n";
99 catch (
const std::invalid_argument &e)
101 cerr <<
"Error: " << e.what() << endl;
103 catch (
const std::exception &)