Get the real language for src blocks from the org source.
This commit is contained in:
parent
b538750287
commit
5654c40d03
@ -1,7 +1,6 @@
|
||||
<div class="src_block">
|
||||
<!-- TODO: Get the language from the render context. -->
|
||||
<div class="src_language">text</div>
|
||||
<table class="src_body">
|
||||
{?.language}<div class="src_language">{.language}</div>{/.language}
|
||||
<table class="src_body">
|
||||
<tbody>
|
||||
{#.lines}
|
||||
<tr>
|
||||
|
@ -11,10 +11,12 @@ use super::macros::render;
|
||||
#[serde(rename = "src_block")]
|
||||
pub(crate) struct RenderSrcBlock {
|
||||
lines: Vec<String>,
|
||||
language: Option<String>,
|
||||
}
|
||||
|
||||
render!(RenderSrcBlock, ISrcBlock, original, _render_context, {
|
||||
Ok(RenderSrcBlock {
|
||||
lines: original.lines.clone(),
|
||||
language: original.language.clone(),
|
||||
})
|
||||
});
|
||||
|
@ -5,6 +5,7 @@ use crate::error::CustomError;
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct ISrcBlock {
|
||||
pub(crate) lines: Vec<String>,
|
||||
pub(crate) language: Option<String>,
|
||||
}
|
||||
|
||||
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 })
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user