diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-01-14 21:40:04 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2024-01-14 21:40:04 +0100 |
| commit | d81c91002883c8272f926353cc4b06e8f8197a73 (patch) | |
| tree | 507eeeac662792486e8f133d695684bb1e0ca4c1 /pandoc/filters | |
| parent | 46528f4b10e0c9a00ac108751238d534f8b5af9f (diff) | |
| download | unterricht-d81c91002883c8272f926353cc4b06e8f8197a73.tar.gz unterricht-d81c91002883c8272f926353cc4b06e8f8197a73.zip | |
add my next info lesson in 7B
Allow markdown to use meta data variables with %VARNAME% syntax.
Diffstat (limited to 'pandoc/filters')
| -rw-r--r-- | pandoc/filters/meta-vars.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/pandoc/filters/meta-vars.lua b/pandoc/filters/meta-vars.lua new file mode 100644 index 00000000..9122775b --- /dev/null +++ b/pandoc/filters/meta-vars.lua @@ -0,0 +1,19 @@ +local vars = {} + +function get_vars (meta) + for k, v in pairs(meta) do + if pandoc.utils.type(v) == 'Inlines' then + vars["%" .. k .. "%"] = {table.unpack(v)} + end + end +end + +function replace (el) + if vars[el.text] then + return pandoc.Span(vars[el.text]) + else + return el + end +end + +return {{Meta = get_vars}, {Str = replace}} |
