pandoc/man/capitalizeHeaders.hs
John MacFarlane 7120df9dad Don't capitalize header links in man page.
Also regenerated man page from latest README.
2015-07-21 10:24:59 -07:00

20 lines
506 B
Haskell

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 = 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
-}