lua-filters.md doc: Added handout example.

This commit is contained in:
John MacFarlane 2017-11-12 15:36:11 -08:00
parent eeaa3b048c
commit 3d6f98c4a3

View file

@ -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