From af1cb43bd62e7c81342330e0e775a91f946bf586 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Fri, 30 Mar 2018 22:31:51 +0300 Subject: [PATCH] NewPodcast: Prefer the rss.description attribute. Since we can handle rendering html stuff by converting it to pango we no longer need the text-only itunes summary attribure. --- hammond-data/src/models/new_podcast.rs | 18 ++++++++++-------- hammond-gtk/resources/gtk/show_widget.ui | 4 +--- hammond-gtk/src/widgets/show.rs | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hammond-data/src/models/new_podcast.rs b/hammond-data/src/models/new_podcast.rs index 97aaaa0..9910599 100644 --- a/hammond-data/src/models/new_podcast.rs +++ b/hammond-data/src/models/new_podcast.rs @@ -1,7 +1,7 @@ use diesel; use diesel::prelude::*; -use ammonia; +// use ammonia; use rss; use errors::DataError; @@ -11,7 +11,8 @@ use schema::podcast; use database::connection; use dbqueries; -use utils::{replace_extra_spaces, url_cleaner}; +// use utils::{replace_extra_spaces, url_cleaner}; +use utils::url_cleaner; #[derive(Insertable, AsChangeset)] #[table_name = "podcast"] @@ -90,14 +91,15 @@ impl NewPodcast { pub(crate) fn new(chan: &rss::Channel, source_id: i32) -> NewPodcast { let title = chan.title().trim(); + let description = chan.description().trim(); // Prefer itunes summary over rss.description since many feeds put html into // rss.description. - let summary = chan.itunes_ext().map(|s| s.summary()).and_then(|s| s); - let description = if let Some(sum) = summary { - replace_extra_spaces(&ammonia::clean(sum)) - } else { - replace_extra_spaces(&ammonia::clean(chan.description())) - }; + // let summary = chan.itunes_ext().map(|s| s.summary()).and_then(|s| s); + // let description = if let Some(sum) = summary { + // replace_extra_spaces(&ammonia::clean(sum)) + // } else { + // replace_extra_spaces(&ammonia::clean(chan.description())) + // }; let link = url_cleaner(chan.link()); let itunes_img = chan.itunes_ext() diff --git a/hammond-gtk/resources/gtk/show_widget.ui b/hammond-gtk/resources/gtk/show_widget.ui index 4f41060..c48911c 100644 --- a/hammond-gtk/resources/gtk/show_widget.ui +++ b/hammond-gtk/resources/gtk/show_widget.ui @@ -112,12 +112,10 @@ Tobias Bernard start end foo + True True word-char 90 - - - False diff --git a/hammond-gtk/src/widgets/show.rs b/hammond-gtk/src/widgets/show.rs index 8415ad8..7917d7b 100644 --- a/hammond-gtk/src/widgets/show.rs +++ b/hammond-gtk/src/widgets/show.rs @@ -123,7 +123,7 @@ impl ShowWidget { // markup. // let desc = dissolve::strip_html_tags(text).join(" "); // self.description.set_text(&replace_extra_spaces(&desc)); - self.description.set_text(&html_to_pango_markup(text)); + self.description.set_markup(&html_to_pango_markup(text)); } /// Set scrolled window vertical adjustment.