Compare commits

..

No commits in common. "main" and "0.13.1" have entirely different histories.
main ... 0.13.1

5 changed files with 15 additions and 22 deletions

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/* This file is part of mastorss.
* Copyright © 2019-2021 tastytea <tastytea@tastytea.de>
* Copyright © 2019, 2020 tastytea <tastytea@tastytea.de>
*
* 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
@ -233,12 +233,11 @@ void Document::parse_rss(const pt::ptree &tree)
}
}
string Document::remove_html(string html)
string Document::remove_html(string html) const
{
html = mastodonpp::unescape_html(html); // Decode HTML entities.
html = regex_replace(html, regex{"<p>"}, "\n\n");
html = regex_replace(html, regex{"<br>"}, "\n");
const list re_list{regex{R"(<!\[CDATA\[)"}, // CDATA beginning.
regex{R"(\]\]>)"}, // CDATA end.

View File

@ -1,5 +1,5 @@
/* This file is part of mastorss.
* Copyright © 2019-2021 tastytea <tastytea@tastytea.de>
* Copyright © 2019, 2020 tastytea <tastytea@tastytea.de>
*
* 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
@ -84,7 +84,7 @@ private:
*/
void download(const string &uri, bool temp_redirect = false);
void parse_rss(const pt::ptree &tree);
[[nodiscard]] static string remove_html(string html);
[[nodiscard]] string remove_html(string html) const;
[[nodiscard]] static string
extract_location(const curl_wrapper::answer &answer);
string add_hashtags(const string &text);

View File

@ -1,5 +1,5 @@
/* This file is part of mastorss.
* Copyright © 2019-2021 tastytea <tastytea@tastytea.de>
* Copyright © 2019, 2020 tastytea <tastytea@tastytea.de>
*
* 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
@ -124,8 +124,6 @@ void MastoAPI::post_item(const Item &item, bool dry_run)
{
if (ret.http_status != 200)
{
BOOST_LOG_TRIVIAL(debug) << "Error message from server: "
<< ret.body;
throw HTTPException{ret.http_status};
}
throw CURLException{ret.curl_error_code};