pub fn handle(
_tag_name: &str,
node_handle: &tl::NodeHandle,
parser: &tl::Parser,
output: &mut String,
options: &crate::options::ConversionOptions,
ctx: &super::Context,
depth: usize,
dom_ctx: &super::DomContext,
) {
if let Some(tl::Node::Tag(tag)) = node_handle.get(parser) {
if ctx.convert_as_inline {
let children = tag.children();
{
for child_handle in children.top().iter() {
super::walk_node(child_handle, parser, output, options, ctx, depth + 1, dom_ctx);
}
}
return;
}
let mut content = String::with_capacity(256);
let children = tag.children();
{
for child_handle in children.top().iter() {
super::walk_node(child_handle, parser, &mut content, options, ctx, depth + 1, dom_ctx);
}
}
if content.trim().is_empty() {
return;
}
if !output.is_empty() && !output.ends_with("\n\n") {
output.push_str("\n\n");
}
output.push_str(&content);
if content.ends_with('\n') && !content.ends_with("\n\n") {
output.push('\n');
} else if !content.ends_with('\n') {
output.push_str("\n\n");
}
}
}