summaryrefslogtreecommitdiff
path: root/filters/strip-solutions.lua
diff options
context:
space:
mode:
authorpacien2022-11-30 21:38:44 +0100
committerpacien2022-11-30 21:38:44 +0100
commit0749847aeab2dcaab43f50956f9cf0b21c31943b (patch)
tree45514d319037ceaae85b86b2037c88df800b95fe /filters/strip-solutions.lua
parentf1b105571b35b72f5f32c6e2e9c645580b17c0bc (diff)
downloadmarkdown-course-website-0749847aeab2dcaab43f50956f9cf0b21c31943b.tar.gz
add example content, compile to site and pdf
Diffstat (limited to 'filters/strip-solutions.lua')
-rw-r--r--filters/strip-solutions.lua24
1 files changed, 24 insertions, 0 deletions
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 @@
1-- Pandoc filter which strips "solution" blocks when the environment variable
2-- "STRIP_SOLUTIONS" is set, or wrap them in a block quote otherwise.
3-- Useful to generate public and private handouts from the same source.
4--
5-- Author: Pacien TRAN-GIRARD
6-- Licence: EUPL-1.2
7
8strip_solutions = os.getenv('STRIP_SOLUTIONS')
9
10return {
11 {
12 Div = function(elem)
13 if elem.classes[1] == 'solution' then
14 if strip_solutions then
15 return pandoc.Null()
16 else
17 return pandoc.BlockQuote(elem.content)
18 end
19 else
20 return elem
21 end
22 end,
23 }
24}