Skip to content

Commit

Permalink
feat(converter): support horizontal rulers
Browse files Browse the repository at this point in the history
  • Loading branch information
NTBBloodbath committed Feb 7, 2025
1 parent f088c9f commit c9fa847
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/converter/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

use html_escape::encode_text_minimal_to_string;
use rust_norg::{
parse_tree, CarryoverTag, LinkTarget, NestableDetachedModifier, NorgAST, NorgASTFlat,
parse_tree, CarryoverTag, DelimitingModifier, LinkTarget, NestableDetachedModifier, NorgAST, NorgASTFlat,
ParagraphSegment, ParagraphSegmentToken,
};

Expand Down Expand Up @@ -493,6 +493,27 @@ impl NorgToHtml for NorgAST {
}
}
}
NorgAST::DelimitingModifier(t) => {
if *t == DelimitingModifier::HorizontalRule {
let mut hr_tag = Vec::<String>::new();
hr_tag.push("<hr".to_string());
if !weak_carry.is_empty() {
for weak_carryover in weak_carry.clone() {
hr_tag.push(weak_carryover_attribute(weak_carryover));
// Remove the carryover tag after using it because its lifetime
// ended after invocating it
weak_carry.remove(0);
}
}

hr_tag.push("/>".to_string());
hr_tag.join(" ")
} else {
// XXX: support weak and strong delimiting modifiers?
eprintln!("[converter] {:#?}", self);
todo!()
}
}
_ => {
println!("[converter] {:#?}", self);
todo!() // Fail on stuff that we cannot parse yet
Expand Down

0 comments on commit c9fa847

Please sign in to comment.