diff options
Diffstat (limited to 'pandoc')
| -rw-r--r-- | pandoc/filters/div-class-to-env.lua | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/pandoc/filters/div-class-to-env.lua b/pandoc/filters/div-class-to-env.lua new file mode 100644 index 00000000..1a87777b --- /dev/null +++ b/pandoc/filters/div-class-to-env.lua @@ -0,0 +1,31 @@ +--- div-class-to-env.lua – filter to convert classes to LaTeX environments +--- +--- Copyright: © 2026 Florian Fischer +--- License: MIT – see LICENSE file for details + +if FORMAT:match('beamer') then + function Div(d) + -- ignore code blocks which are not of class "env". + if not d.classes:includes 'env' then + return + end + + local env + for _, v in ipairs(d.classes) do + if v ~= 'env' then + env = v + break + end + end + + if not env then + return + end + + return { + pandoc.RawInline('latex', '\\begin{'..env..'}'), + d, + pandoc.RawInline('latex', '\\end{'..env..'}') + } + end +end |
