summaryrefslogtreecommitdiff
path: root/doc/lua-filters.md
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-11-12 15:36:11 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2017-11-12 15:36:11 -0800
commit3d6f98c4a37cc4b0e09f33032f93ed5063a7ea7c (patch)
treeb4b908fc2e779be174fd4c9010282933184d5f65 /doc/lua-filters.md
parenteeaa3b048c325859d049f1b7aa7f60553c897aa6 (diff)
lua-filters.md doc: Added handout example.
Diffstat (limited to 'doc/lua-filters.md')
-rw-r--r--doc/lua-filters.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md
index 0aed95cb5..ab6d221fa 100644
--- a/doc/lua-filters.md
+++ b/doc/lua-filters.md
@@ -362,6 +362,27 @@ function Note(el)
end
```
+## Creating a handout from a paper
+
+This filter extracts all the numbered examples, section
+headers, block quotes from a document, in addition to any
+divs with class `handout`:
+
+``` lua
+function Pandoc(doc)
+ local hblocks = {}
+ for i,el in pairs(doc.blocks) do
+ if (el.t == "Div" and el.classes[1] == "handout") or
+ (el.t == "BlockQuote") or
+ (el.t == "OrderedList" and el.style == "Example") or
+ (el.t == "Header") then
+ table.insert(hblocks, el)
+ end
+ end
+ return pandoc.Pandoc(hblocks, meta)
+end
+```
+
## Converting ABC code to music notation
This filter replaces code blocks with class `abc` with