thp/doc-generator/src/utils.rs

28 lines
545 B
Rust
Raw Normal View History

2023-03-31 23:23:46 +00:00
use markdown::mdast::Node;
use crate::generator::Printable;
pub fn to_html_fragment(text: &String) -> String {
text.clone().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("-")
}