Move the data to HTML conversion to a separate function

Sometimes data needs to be converted to HTML without it being list data
(yet).
This commit is contained in:
Paul van Tilburg 2017-12-27 21:31:12 +01:00
parent e709985ba2
commit b01d331742
1 changed files with 6 additions and 2 deletions

View File

@ -6,6 +6,11 @@ use std::io::prelude::*;
use std::path::PathBuf;
use std::time::SystemTime;
pub fn data_to_html(data: &String) -> String {
comrak::markdown_to_html(data,
&comrak::ComrakOptions::default())
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct List {
pub id: String,
@ -18,8 +23,7 @@ pub struct List {
impl List {
pub fn to_html(&self) -> String {
comrak::markdown_to_html(&self.data,
&comrak::ComrakOptions::default())
data_to_html(&self.data)
}
pub fn update_data(&mut self, data : &String) {