Compare commits

...

7 Commits
0.13.1 ... main

Author SHA1 Message Date
tastytea 87760bba2d
Print error messages from servers in debug output.
continuous-integration/drone/push Build is passing Details
2021-08-18 18:36:44 +02:00
tastytea 5275c1d9e3
Make Document::remove_html static.
continuous-integration/drone/push Build is passing Details
2021-07-12 23:39:00 +02:00
tastytea 2ad4b46551
Replace <br> with newline. 2021-07-12 23:35:53 +02:00
tastytea 59f0302281
Move usage information above install instructions.
continuous-integration/drone/push Build is passing Details
2021-05-17 23:35:10 +02:00
tastytea 344abb6a29
Add repology badge.
continuous-integration/drone/push Build was killed Details
2021-05-17 23:34:04 +02:00
tastytea 86f5c45172
Fix documentation of the “fixes” config option.
continuous-integration/drone/push Build is passing Details
2021-01-18 23:48:03 +01:00
tastytea 5e2bfe13d4
Clarify when “fixes” and “replacements” apply.
continuous-integration/drone/push Build is passing Details
2021-01-16 19:59:53 +01:00
5 changed files with 22 additions and 15 deletions

View File

@ -16,8 +16,15 @@
*mastorss* reads RSS feeds and posts the items via the Mastodon API. Does not *mastorss* reads RSS feeds and posts the items via the Mastodon API. Does not
support Atom at the moment. support Atom at the moment.
== Usage
See link:{uri-branch-main}/man/mastorss.1.adoc[manpage].
== Install == Install
[alt="Packaging status" link=https://repology.org/project/mastorss/versions]
image::https://repology.org/badge/vertical-allrepos/mastorss.svg[]
=== Gentoo === Gentoo
[source,shell] [source,shell]
@ -76,8 +83,4 @@ cmake --build .
Install with `make install`. Install with `make install`.
== Usage
See link:{uri-branch-main}/man/mastorss.1.adoc[manpage].
include::{uri-base}/raw/branch/main/CONTRIBUTING.adoc[] include::{uri-base}/raw/branch/main/CONTRIBUTING.adoc[]

View File

@ -2,7 +2,7 @@
:doctype: manpage :doctype: manpage
:Author: tastytea :Author: tastytea
:Email: tastytea@tastytea.de :Email: tastytea@tastytea.de
:Date: 2020-12-03 :Date: 2021-01-18
:Revision: 0.0.0 :Revision: 0.0.0
:man source: mastorss :man source: mastorss
:man manual: General Commands Manual :man manual: General Commands Manual
@ -67,8 +67,9 @@ This string will be appended to every post.
The URI of the source feed. The URI of the source feed.
*fixes*:: *fixes*::
Array of regular expressions that should be deleted from the text. For Array of regular expressions that should be deleted from the text. Applies to
information about the syntax see *perlre*(1). RSS descriptions (before the HTML is stripped). For information about the syntax
see *perlre*(1).
*instance*:: *instance*::
Hostname of the instance you're using to post. Hostname of the instance you're using to post.
@ -97,9 +98,9 @@ content warning) of the post.
If true, only post titles, no descriptions. If true, only post titles, no descriptions.
*replacements*:: *replacements*::
Object with a list of regular expressions and replacements. Applies to posts, Object with a list of regular expressions and replacements. Applies to posts
subjects and links, but not to the string in _append_. For information about the (after the HTML is stripped), subjects and links, but not to the string in
syntax see *perlre*(1). _append_. For information about the syntax see *perlre*(1).
*add_hashtags*:: *add_hashtags*::
If true, replace words with hashtags according to `watchwords.json`. If true, replace words with hashtags according to `watchwords.json`.

View File

@ -1,5 +1,5 @@
/* This file is part of mastorss. /* This file is part of mastorss.
* Copyright © 2019, 2020 tastytea <tastytea@tastytea.de> * Copyright © 2019-2021 tastytea <tastytea@tastytea.de>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -233,11 +233,12 @@ void Document::parse_rss(const pt::ptree &tree)
} }
} }
string Document::remove_html(string html) const string Document::remove_html(string html)
{ {
html = mastodonpp::unescape_html(html); // Decode HTML entities. html = mastodonpp::unescape_html(html); // Decode HTML entities.
html = regex_replace(html, regex{"<p>"}, "\n\n"); html = regex_replace(html, regex{"<p>"}, "\n\n");
html = regex_replace(html, regex{"<br>"}, "\n");
const list re_list{regex{R"(<!\[CDATA\[)"}, // CDATA beginning. const list re_list{regex{R"(<!\[CDATA\[)"}, // CDATA beginning.
regex{R"(\]\]>)"}, // CDATA end. regex{R"(\]\]>)"}, // CDATA end.

View File

@ -1,5 +1,5 @@
/* This file is part of mastorss. /* This file is part of mastorss.
* Copyright © 2019, 2020 tastytea <tastytea@tastytea.de> * Copyright © 2019-2021 tastytea <tastytea@tastytea.de>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -84,7 +84,7 @@ private:
*/ */
void download(const string &uri, bool temp_redirect = false); void download(const string &uri, bool temp_redirect = false);
void parse_rss(const pt::ptree &tree); void parse_rss(const pt::ptree &tree);
[[nodiscard]] string remove_html(string html) const; [[nodiscard]] static string remove_html(string html);
[[nodiscard]] static string [[nodiscard]] static string
extract_location(const curl_wrapper::answer &answer); extract_location(const curl_wrapper::answer &answer);
string add_hashtags(const string &text); string add_hashtags(const string &text);

View File

@ -1,5 +1,5 @@
/* This file is part of mastorss. /* This file is part of mastorss.
* Copyright © 2019, 2020 tastytea <tastytea@tastytea.de> * Copyright © 2019-2021 tastytea <tastytea@tastytea.de>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -124,6 +124,8 @@ void MastoAPI::post_item(const Item &item, bool dry_run)
{ {
if (ret.http_status != 200) if (ret.http_status != 200)
{ {
BOOST_LOG_TRIVIAL(debug) << "Error message from server: "
<< ret.body;
throw HTTPException{ret.http_status}; throw HTTPException{ret.http_status};
} }
throw CURLException{ret.curl_error_code}; throw CURLException{ret.curl_error_code};