mirror of
https://framagit.org/veretcle/scootaloo.git
synced 2025-07-20 17:11:19 +02:00
Merge branch 'html_entities' into 'master'
Html entities See merge request veretcle/scootaloo!4
This commit is contained in:
9
Cargo.lock
generated
9
Cargo.lock
generated
@@ -620,6 +620,12 @@ dependencies = [
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "htmlescape"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163"
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.1.21"
|
||||
@@ -1492,10 +1498,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "scootaloo"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"egg-mode",
|
||||
"htmlescape",
|
||||
"mammut",
|
||||
"reqwest 0.10.3",
|
||||
"serde",
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "scootaloo"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
authors = ["VC <veretcle+framagit@mateu.be>"]
|
||||
edition = "2018"
|
||||
|
||||
@@ -17,3 +17,5 @@ egg-mode = "^0.13"
|
||||
mammut = "^0.13"
|
||||
|
||||
reqwest = { version = "^0.10", features = ["blocking"] }
|
||||
|
||||
htmlescape = "^0.3"
|
||||
|
@@ -37,6 +37,9 @@ use mammut::{
|
||||
// reqwest
|
||||
use reqwest::blocking::Client;
|
||||
|
||||
// htmlescape
|
||||
use htmlescape::decode_html;
|
||||
|
||||
/**********
|
||||
* Generic usage functions
|
||||
***********/
|
||||
@@ -144,9 +147,9 @@ fn build_basic_status(tweet: &Tweet) -> Result<StatusBuilder, Box<dyn Error>> {
|
||||
toot = toot.replace(&decoded_url.0, &decoded_url.1);
|
||||
}
|
||||
|
||||
// remove the & and replace it with &
|
||||
// this is the only entities and/or char that is not available via Twitter API
|
||||
toot = toot.replace("&", "&");
|
||||
if let Ok(t) = decode_html(&toot) {
|
||||
toot = t;
|
||||
}
|
||||
|
||||
Ok(StatusBuilder::new(toot))
|
||||
}
|
||||
|
Reference in New Issue
Block a user