Add basic support for panels and code block in jiradoc

This commit is contained in:
Daan Boerlage 2025-01-22 03:42:18 +01:00
parent fa387c5546
commit dcc8882740
Signed by: daan
GPG key ID: FCE070E1E4956606
2 changed files with 21 additions and 1 deletions

View file

@ -33,15 +33,34 @@ fn render_doc_node(f: &mut String, node: &DocNode) -> Result<(), Box<dyn std::er
writeln!(f, "---")?; writeln!(f, "---")?;
} }
DocNode::Heading(x) => { DocNode::Heading(x) => {
writeln!(f)?;
write!(f, "## ")?;
for node in x { for node in x {
render_text_node(f, node)?; render_text_node(f, node)?;
} }
writeln!(f)?;
writeln!(f)?;
} }
DocNode::MediaSingle(x) => { DocNode::MediaSingle(x) => {
for node in x { for node in x {
render_text_markets(f, node)?; render_text_markets(f, node)?;
} }
} }
DocNode::Panel(x) => {
writeln!(f, "┌{:─<79}", "")?;
for node in x {
render_doc_node(f, node)?;
}
writeln!(f, "└{:─<79}", "")?;
}
DocNode::CodeBlock(x) => {
writeln!(f, "┌---------------")?;
for node in x {
render_text_node(f, node)?;
}
writeln!(f)?;
writeln!(f, "└---------------")?;
}
} }
Ok(()) Ok(())

View file

@ -17,6 +17,8 @@ pub enum DocNode {
Rule, Rule,
Heading(Vec<DocTextNode>), Heading(Vec<DocTextNode>),
MediaSingle(Vec<DocTextMarker>), MediaSingle(Vec<DocTextMarker>),
Panel(Vec<DocNode>),
CodeBlock(Vec<DocTextNode>),
} }
#[derive(Debug, Clone, Deserialize, Serialize)] #[derive(Debug, Clone, Deserialize, Serialize)]
@ -86,5 +88,4 @@ pub struct DocMention {
pub struct DocMentionAttrs { pub struct DocMentionAttrs {
pub id: String, pub id: String,
pub text: String, pub text: String,
pub local_id: String,
} }