ShowWidget: Strip html tags from the description.

This commit is contained in:
Jordan Petridis 2017-12-16 20:45:15 +02:00
parent f7af05a650
commit 440badf1eb
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
2 changed files with 8 additions and 4 deletions

View File

@ -8,7 +8,7 @@ use std::io::{BufWriter, Read, Write};
use std::path::Path; use std::path::Path;
use errors::*; use errors::*;
use hammond_data::{Episode, EpisodeWidgetQuery, Podcast}; use hammond_data::{EpisodeWidgetQuery, Podcast};
use hammond_data::xdg_dirs::{DL_DIR, HAMMOND_CACHE}; use hammond_data::xdg_dirs::{DL_DIR, HAMMOND_CACHE};
// TODO: Replace path that are of type &str with std::path. // TODO: Replace path that are of type &str with std::path.

View File

@ -2,11 +2,11 @@ use gtk::prelude::*;
use gtk; use gtk;
use diesel::Identifiable; use diesel::Identifiable;
use open; use open;
use dissolve;
use std::fs;
use hammond_data::dbqueries; use hammond_data::dbqueries;
use hammond_data::Podcast; use hammond_data::Podcast;
use hammond_data::utils::replace_extra_spaces;
use hammond_downloader::downloader; use hammond_downloader::downloader;
use widgets::episode::episodes_listbox; use widgets::episode::episodes_listbox;
@ -15,6 +15,7 @@ use content::ShowStack;
use headerbar::Header; use headerbar::Header;
use std::rc::Rc; use std::rc::Rc;
use std::fs;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ShowWidget { pub struct ShowWidget {
@ -74,7 +75,9 @@ impl ShowWidget {
self.episodes.add(&l); self.episodes.add(&l);
} }
self.description.set_text(pd.description()); // TODO: Temporary solution until we render html urls/bold/italic probably with markup.
let desc = dissolve::strip_html_tags(pd.description()).join(" ");
self.description.set_text(&replace_extra_spaces(&desc));
let img = get_pixbuf_from_path_128(pd); let img = get_pixbuf_from_path_128(pd);
if let Some(i) = img { if let Some(i) = img {
@ -113,6 +116,7 @@ fn on_unsub_button_clicked(shows: Rc<ShowStack>, pd: &Podcast, unsub_button: &gt
shows.update_podcasts(); shows.update_podcasts();
} }
#[allow(dead_code)]
fn on_played_button_clicked(shows: Rc<ShowStack>, pd: &Podcast) { fn on_played_button_clicked(shows: Rc<ShowStack>, pd: &Podcast) {
let _ = dbqueries::update_none_to_played_now(pd); let _ = dbqueries::update_none_to_played_now(pd);