From 0749847aeab2dcaab43f50956f9cf0b21c31943b Mon Sep 17 00:00:00 2001 From: pacien Date: Wed, 30 Nov 2022 21:38:44 +0100 Subject: add example content, compile to site and pdf --- filters/strip-solutions.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 filters/strip-solutions.lua (limited to 'filters/strip-solutions.lua') diff --git a/filters/strip-solutions.lua b/filters/strip-solutions.lua new file mode 100644 index 0000000..2bba42f --- /dev/null +++ b/filters/strip-solutions.lua @@ -0,0 +1,24 @@ +-- Pandoc filter which strips "solution" blocks when the environment variable +-- "STRIP_SOLUTIONS" is set, or wrap them in a block quote otherwise. +-- Useful to generate public and private handouts from the same source. +-- +-- Author: Pacien TRAN-GIRARD +-- Licence: EUPL-1.2 + +strip_solutions = os.getenv('STRIP_SOLUTIONS') + +return { + { + Div = function(elem) + if elem.classes[1] == 'solution' then + if strip_solutions then + return pandoc.Null() + else + return pandoc.BlockQuote(elem.content) + end + else + return elem + end + end, + } +} -- cgit v1.2.3