More named entities, documentation update

This commit is contained in:
tastytea 2018-02-22 18:07:21 +01:00
parent a81a200e9f
commit 8991c656c2
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
4 changed files with 24 additions and 10 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7)
project (mastorss
VERSION 0.3.1
VERSION 0.3.2
LANGUAGES CXX
)

View File

@ -43,16 +43,22 @@ In the first run only the newest entry is tooted.
The profile can't be named "global".
## Example config file
{
"example": {
"instance": "botsin.space",
"feedurl": "https:\/\/example.com\/feed.rss",
"access_token": "123abc",
"max_size": "400",
"last_entry": "Example\n\nThis is an example.\n\nhttps:\/\/example.com\/12345.html\n\n#bot"
}
}
## Error codes
| Code | Explanation |
| --------: |:------------------------------|
| 0 | No error |
| 1 | Invalid call |
| 2 | Not implemented |
| 10 | Wrong number of arguments |
| 100 - 999 | HTTP status codes |
| 65535 | Unknown exception |
Same as [mastodon-cpp](https://github.com/tastytea/mastodon-cpp/blob/master/README.md#error-codes)
If you use a debug build, you get more verbose error messages.

View File

@ -41,6 +41,7 @@ std::uint16_t read_config(pt::ptree &config, const string &profile, string &inst
instance = config.get(profile + ".instance", "");
access_token = config.get(profile + ".access_token", "");
feedurl = config.get(profile + ".feedurl", "");
max_size = config.get(profile + ".max_size", max_size);
}
catch (std::exception &e)
{

View File

@ -53,8 +53,15 @@ void unescape_html(string &str)
std::regex relt("<");
std::regex regt(">");
std::regex reamp("&");
std::regex requot(""");
std::regex reapos("'");
str = std::regex_replace(str, relt, "<");
str = std::regex_replace(str, regt, ">");
str = std::regex_replace(str, reamp, "&");
str = std::regex_replace(str, requot, "\"");
str = std::regex_replace(str, reapos, "\'");
}
std::vector<string> parse_website(const string &profile, const string &xml)
@ -140,7 +147,7 @@ std::vector<string> parse_website(const string &profile, const string &xml)
str = std::regex_replace(str, reindyfuckup, "");
str = std::regex_replace(str, redaclosing, "");
str = std::regex_replace(str, reggboclosing, "");
str = std::regex_replace(str, std::regex("[\\n\\r]{3,}"), "\n"); // remove excess newlines
str = std::regex_replace(str, std::regex("[\\n\\r ]{3,}"), "\n"); // remove excess newlines
for (const string &hashtag : watchwords)
{