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 {
|
|
|
|
text.clone().to_lowercase().replace(" ", "-")
|
|
|
|
}
|
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("-")
|
|
|
|
}
|