2023-03-31 23:23:46 +00:00
|
|
|
use markdown::mdast::Node;
|
|
|
|
|
|
|
|
use crate::generator::Printable;
|
|
|
|
|
2023-03-30 20:37:22 +00:00
|
|
|
pub fn to_html_fragment(text: &String) -> String {
|
2023-04-05 23:30:03 +00:00
|
|
|
text.clone().replace(" ", "-")
|
2023-03-30 20:37:22 +00:00
|
|
|
}
|
2023-03-31 23:23:46 +00:00
|
|
|
|
|
|
|
pub fn collect_children_html(vec: &Vec<Node>) -> String {
|
|
|
|
let mut result = Vec::<String>::new();
|
|
|
|
|
|
|
|
for node in vec {
|
|
|
|
result.push(node.to_html())
|
|
|
|
}
|
|
|
|
|
|
|
|
result.into_iter().collect()
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn collect_children_text(vec: &Vec<Node>) -> String {
|
|
|
|
let mut result = Vec::<String>::new();
|
|
|
|
|
|
|
|
for node in vec {
|
|
|
|
result.push(node.get_text())
|
|
|
|
}
|
|
|
|
|
|
|
|
result.join("-")
|
|
|
|
}
|