summaryrefslogtreecommitdiff
path: root/doc/lua-filters.md
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-11-11 16:18:39 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2017-11-11 16:18:39 -0800
commitf9c7b49502ffcc69c41737a02b5da733b4a6f93e (patch)
tree1ddb38a51b295f3a7ae0b937665f973cdb653a5b /doc/lua-filters.md
parent1c901057bbadc77f9394c31c07f46096f96c7543 (diff)
lua-filters.md: use real-world man page filter as example.
Diffstat (limited to 'doc/lua-filters.md')
-rw-r--r--doc/lua-filters.md21
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
```