diff --git a/default_environment/templates/html/src_block.dust b/default_environment/templates/html/src_block.dust index d8560bb..f0a6357 100644 --- a/default_environment/templates/html/src_block.dust +++ b/default_environment/templates/html/src_block.dust @@ -1,7 +1,6 @@
- -
text
- + {?.language}
{.language}
{/.language} +
{#.lines} diff --git a/src/context/src_block.rs b/src/context/src_block.rs index d5346d7..bc9451a 100644 --- a/src/context/src_block.rs +++ b/src/context/src_block.rs @@ -11,10 +11,12 @@ use super::macros::render; #[serde(rename = "src_block")] pub(crate) struct RenderSrcBlock { lines: Vec, + language: Option, } render!(RenderSrcBlock, ISrcBlock, original, _render_context, { Ok(RenderSrcBlock { lines: original.lines.clone(), + language: original.language.clone(), }) }); diff --git a/src/intermediate/src_block.rs b/src/intermediate/src_block.rs index 0e1b2d1..5ec4520 100644 --- a/src/intermediate/src_block.rs +++ b/src/intermediate/src_block.rs @@ -5,6 +5,7 @@ use crate::error::CustomError; #[derive(Debug, Clone)] pub(crate) struct ISrcBlock { pub(crate) lines: Vec, + pub(crate) language: Option, } intermediate!( @@ -18,6 +19,7 @@ intermediate!( .split_inclusive('\n') .map(|s| s.to_owned()) .collect(); - Ok(ISrcBlock { lines }) + let language = original.language.map(str::to_owned); + Ok(ISrcBlock { lines, language }) } );