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">
|
<div class="src_block">
|
||||||
<!-- TODO: Get the language from the render context. -->
|
{?.language}<div class="src_language">{.language}</div>{/.language}
|
||||||
<div class="src_language">text</div>
|
<table class="src_body">
|
||||||
<table class="src_body">
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{#.lines}
|
{#.lines}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -11,10 +11,12 @@ use super::macros::render;
|
|||||||
#[serde(rename = "src_block")]
|
#[serde(rename = "src_block")]
|
||||||
pub(crate) struct RenderSrcBlock {
|
pub(crate) struct RenderSrcBlock {
|
||||||
lines: Vec<String>,
|
lines: Vec<String>,
|
||||||
|
language: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
render!(RenderSrcBlock, ISrcBlock, original, _render_context, {
|
render!(RenderSrcBlock, ISrcBlock, original, _render_context, {
|
||||||
Ok(RenderSrcBlock {
|
Ok(RenderSrcBlock {
|
||||||
lines: original.lines.clone(),
|
lines: original.lines.clone(),
|
||||||
|
language: original.language.clone(),
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -5,6 +5,7 @@ use crate::error::CustomError;
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub(crate) struct ISrcBlock {
|
pub(crate) struct ISrcBlock {
|
||||||
pub(crate) lines: Vec<String>,
|
pub(crate) lines: Vec<String>,
|
||||||
|
pub(crate) language: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
intermediate!(
|
intermediate!(
|
||||||
@ -18,6 +19,7 @@ intermediate!(
|
|||||||
.split_inclusive('\n')
|
.split_inclusive('\n')
|
||||||
.map(|s| s.to_owned())
|
.map(|s| s.to_owned())
|
||||||
.collect();
|
.collect();
|
||||||
Ok(ISrcBlock { lines })
|
let language = original.language.map(str::to_owned);
|
||||||
|
Ok(ISrcBlock { lines, language })
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user