path: root/man/capitalizeHeaders.hs
diff options
authorJohn MacFarlane <>2015-07-01 11:21:34 -0700
committerJohn MacFarlane <>2015-07-01 11:27:15 -0700
commita04c15a422cac279e75b012db9614cdc85aa1188 (patch)
tree55660afa214a1de454c7ddc0edefbfe150664479 /man/capitalizeHeaders.hs
parent6862aa26871071a5e9072e32f559321af3f88793 (diff)
New method for building man pages.
+ Removed `--man1`, `--man5` options (breaking change). + Removed `Text.Pandoc.ManPages` module (breaking API change). + Version bump to 1.15 because of the breaking changes, even though they involve features that have only been in pandoc for a day. + Makefile target for `man/man1/pandoc.1`. This uses pandoc to create the man page from README using a custom template and filters. + Added `man/` directory with template and filters needed to build man page. + We no longer have two man pages: pandoc.1 and pandoc_markdown.5. Now there is just pandoc.1, which has all the content from README. This change was needed because of the extensive cross-references between parts of the README. + Removed old `data/pandoc.1.template` and `data/pandoc_markdown.5.template`.
Diffstat (limited to 'man/capitalizeHeaders.hs')
1 files changed, 18 insertions, 0 deletions
diff --git a/man/capitalizeHeaders.hs b/man/capitalizeHeaders.hs
new file mode 100644
index 000000000..d3909df76
--- /dev/null
+++ b/man/capitalizeHeaders.hs
@@ -0,0 +1,18 @@
+import Text.Pandoc.JSON
+import Text.Pandoc.Walk
+import Data.Char (toUpper)
+main :: IO ()
+main = toJSONFilter capitalizeHeaders
+capitalizeHeaders :: Block -> Block
+capitalizeHeaders (Header 1 attr xs) = Header 1 attr $ walk capitalize xs
+capitalizeHeaders x = walk capitalizeHeaderLinks x
+capitalize :: Inline -> Inline
+capitalize (Str xs) = Str $ map toUpper xs
+capitalize x = x
+capitalizeHeaderLinks :: Inline -> Inline
+capitalizeHeaderLinks (Link xs t@('#':_,_)) = Link (walk capitalize xs) t
+capitalizeHeaderLinks x = x