Update dust templates to support the new source code block format.

This commit is contained in:
Tom Alexander
2025-02-22 16:13:23 -05:00
parent 4cc04bda46
commit 4ea1a46705
2 changed files with 11 additions and 5 deletions

View File

@@ -17,16 +17,15 @@ pub(crate) struct RenderSrcBlock {
}
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "src_block")]
pub(crate) struct RenderSrcLine {
children: Vec<RenderSrcSegment>,
}
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
pub(crate) enum RenderSrcSegment {
#[serde(rename = "raw_text")]
RawText(String),
RawText { content: String },
#[serde(rename = "highlight_start")]
HighlightStart { name: String },
@@ -44,7 +43,9 @@ render!(RenderSrcBlock, ISrcBlock, original, _render_context, {
.children
.iter()
.map(|original_segment| match original_segment {
ISrcSegment::RawText(body) => RenderSrcSegment::RawText(body.to_owned()),
ISrcSegment::RawText(body) => RenderSrcSegment::RawText {
content: body.to_owned(),
},
ISrcSegment::HighlightStart { name } => RenderSrcSegment::HighlightStart {
name: name.to_owned(),
},