mirror of
https://github.com/YGGverse/rssto.git
synced 2026-03-31 09:05:29 +00:00
add strip tags function
This commit is contained in:
parent
5701ccf273
commit
a4bbb0be68
2 changed files with 9 additions and 4 deletions
|
|
@ -17,6 +17,7 @@ log = "0.4"
|
|||
reqwest = { version = "0.12", features = ["blocking"] }
|
||||
rss = "2.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
strip-tags = "0.1"
|
||||
toml = "0.9"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
url = "2.5"
|
||||
|
|
|
|||
12
src/main.rs
12
src/main.rs
|
|
@ -13,6 +13,7 @@ use std::{
|
|||
io::Write,
|
||||
path::PathBuf,
|
||||
};
|
||||
use strip_tags::*;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
if var("RUST_LOG").is_ok() {
|
||||
|
|
@ -86,8 +87,8 @@ fn crawl(feed: &Feed) -> Result<()> {
|
|||
})?
|
||||
.write_all(
|
||||
index
|
||||
.replace("{title}", channel.title())
|
||||
.replace("{description}", channel.description())
|
||||
.replace("{title}", &strip_tags(channel.title()))
|
||||
.replace("{description}", &strip_tags(channel.description()))
|
||||
.replace("{link}", channel.link())
|
||||
.replace("{language}", channel.language().unwrap_or_default())
|
||||
.replace(
|
||||
|
|
@ -106,8 +107,11 @@ fn crawl(feed: &Feed) -> Result<()> {
|
|||
.take(channel_items_limit)
|
||||
.map(|i| {
|
||||
index_item
|
||||
.replace("{title}", i.title().unwrap_or_default())
|
||||
.replace("{description}", i.description().unwrap_or_default())
|
||||
.replace("{title}", &strip_tags(i.title().unwrap_or_default()))
|
||||
.replace(
|
||||
"{description}",
|
||||
&strip_tags(i.description().unwrap_or_default()),
|
||||
)
|
||||
.replace("{link}", i.link().unwrap_or_default())
|
||||
.replace("{pub_date}", &time(i.pub_date(), &feed.pub_date_format))
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue