diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-11-11 16:18:39 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-11-11 16:18:39 -0800 |
commit | f9c7b49502ffcc69c41737a02b5da733b4a6f93e (patch) | |
tree | 1ddb38a51b295f3a7ae0b937665f973cdb653a5b | |
parent | 1c901057bbadc77f9394c31c07f46096f96c7543 (diff) | |
download | pandoc-f9c7b49502ffcc69c41737a02b5da733b4a6f93e.tar.gz |
lua-filters.md: use real-world man page filter as example.
-rw-r--r-- | doc/lua-filters.md | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md index 1e0b988ba..0d9a2c0e0 100644 --- a/doc/lua-filters.md +++ b/doc/lua-filters.md @@ -335,17 +335,30 @@ will output: </dl> ``` -## Uppercasing text inside all headers +## Modifying pandoc's `MANUAL.txt` for man pages -This filter uses `walk_block` to transform inline elements -inside headers, converting all their text into uppercase. +This is the filter we use when converting `MANUAL.txt` +to man pages. It converts level-1 headers to uppercase +(uisng `walk_block` to transform inline elements +inside headers), removes footnotes, and replaces links +with regular text. ``` lua function Header(el) - return pandoc.walk_block(el, { + if el.level == 1 then + return pandoc.walk_block(el, { Str = function(el) return pandoc.Str(el.text:upper()) end }) + end +end + +function Link(el) + return el.content +end + +function Note(el) + return {} end ``` |