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:
parent
e709985ba2
commit
b01d331742
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue