Update dust templates to support the new source code block format.
This commit is contained in:
parent
4cc04bda46
commit
4ea1a46705
@ -4,7 +4,12 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{#.lines}
|
{#.lines}
|
||||||
<tr>
|
<tr>
|
||||||
<td><code class="src_line">{.}</code></td>
|
<td>{#.children}{@select key=.type}
|
||||||
|
{@eq value="raw_text"}<code class="src_line">{.content}</code>{/eq}
|
||||||
|
{@eq value="highlight_start"}<span class="srchl_{.name}">{/eq}
|
||||||
|
{@eq value="highlight_end"}</span>{/eq}
|
||||||
|
{@none}{!TODO: make this panic!}ERROR: Unrecognized type {.type}.{/none}
|
||||||
|
{/select}{/.children}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/.lines}
|
{/.lines}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -17,16 +17,15 @@ pub(crate) struct RenderSrcBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "type")]
|
|
||||||
#[serde(rename = "src_block")]
|
|
||||||
pub(crate) struct RenderSrcLine {
|
pub(crate) struct RenderSrcLine {
|
||||||
children: Vec<RenderSrcSegment>,
|
children: Vec<RenderSrcSegment>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
|
#[serde(tag = "type")]
|
||||||
pub(crate) enum RenderSrcSegment {
|
pub(crate) enum RenderSrcSegment {
|
||||||
#[serde(rename = "raw_text")]
|
#[serde(rename = "raw_text")]
|
||||||
RawText(String),
|
RawText { content: String },
|
||||||
|
|
||||||
#[serde(rename = "highlight_start")]
|
#[serde(rename = "highlight_start")]
|
||||||
HighlightStart { name: String },
|
HighlightStart { name: String },
|
||||||
@ -44,7 +43,9 @@ render!(RenderSrcBlock, ISrcBlock, original, _render_context, {
|
|||||||
.children
|
.children
|
||||||
.iter()
|
.iter()
|
||||||
.map(|original_segment| match original_segment {
|
.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 {
|
ISrcSegment::HighlightStart { name } => RenderSrcSegment::HighlightStart {
|
||||||
name: name.to_owned(),
|
name: name.to_owned(),
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user