git.iko.soy/typeable/pandoc
on master help sign in
lua-filters.md doc: Added handout example.
commit3d6f98c4a37cc4b0e09f33032f93ed5063a7ea7c authorJohn MacFarlane <jgm@berkeley.edu> dateSun 12 Nov 2017, 15:36 (9 years ago) parenteeaa3b0
1 file changed+21
doc/lua-filters.md+21
doc/lua-filters.md+21
@@ -362,6 +362,27 @@ function Note(el)
362362end
363363```
364364
365+## Creating a handout from a paper
366+
367+This filter extracts all the numbered examples, section
368+headers, block quotes from a document, in addition to any
369+divs with class `handout`:
370+
371+``` lua
372+function Pandoc(doc)
373+ local hblocks = {}
374+ for i,el in pairs(doc.blocks) do
375+ if (el.t == "Div" and el.classes[1] == "handout") or
376+ (el.t == "BlockQuote") or
377+ (el.t == "OrderedList" and el.style == "Example") or
378+ (el.t == "Header") then
379+ table.insert(hblocks, el)
380+ end
381+ end
382+ return pandoc.Pandoc(hblocks, meta)
383+end
384+```
385+
365386## Converting ABC code to music notation
366387
367388This filter replaces code blocks with class `abc` with