Skip to content

Commit

Permalink
chore(term): bump html2text from 0.12.6 to 0.13.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ymgyt committed Oct 21, 2024
1 parent 9ff9b68 commit 6db8cb8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
25 changes: 16 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/synd_term/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ edit = "0.1.5"
either = { workspace = true }
futures-util = { workspace = true }
graphql_client = { workspace = true, features = ["graphql_query_derive"] }
html2text = { version = "0.12" }
html2text = { version = "0.13.2" }
itertools = { workspace = true }
nom = { version = "7.1.3", default-features = false, features = ["std"] }
nucleo = "0.5.0"
Expand Down
13 changes: 10 additions & 3 deletions crates/synd_term/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use chrono::DateTime;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use synd_feed::types::{Category, FeedType, FeedUrl, Requirement};
use tracing::warn;

use crate::{
client::synd_api::{
Expand Down Expand Up @@ -86,9 +87,15 @@ impl From<mutation::subscribe_feed::EntryMeta> for EntryMeta {

impl EntryMeta {
pub fn summary_text(&self, width: usize) -> Option<String> {
self.summary
.as_deref()
.map(|summary| html2text::from_read(summary.as_bytes(), width))
self.summary.as_deref().and_then(|summary| {
match html2text::from_read(summary.as_bytes(), width) {
Ok(text) => Some(text),
Err(err) => {
warn!("convert summary html to text: {err}");
None
}
}
})
}
}

Expand Down

0 comments on commit 6db8cb8

Please sign in to comment.