2015-07-01 20:21:34 +02:00
|
|
|
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
|
2015-07-21 19:24:59 +02:00
|
|
|
capitalizeHeaders x = x
|
2015-07-01 20:21:34 +02:00
|
|
|
|
|
|
|
capitalize :: Inline -> Inline
|
|
|
|
capitalize (Str xs) = Str $ map toUpper xs
|
|
|
|
capitalize x = x
|
|
|
|
|
2015-07-21 19:24:59 +02:00
|
|
|
{-
|
2015-07-01 20:21:34 +02:00
|
|
|
capitalizeHeaderLinks :: Inline -> Inline
|
|
|
|
capitalizeHeaderLinks (Link xs t@('#':_,_)) = Link (walk capitalize xs) t
|
|
|
|
capitalizeHeaderLinks x = x
|
2015-07-21 19:24:59 +02:00
|
|
|
-}
|