blob: f3ca1ba0bf7658a588775b0b06a2a92a580b7ba1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/usr/bin/env runhaskell
import Text.Pandoc.Pretty
import Text.Pandoc.JSON
import System.IO
extract_title :: Pandoc -> IO Pandoc
extract_title d@(Pandoc m _) = do hPutStrLn stderr $ render Nothing $ cat $ map pretty (docTitle m)
return d
where pretty :: Inline -> Doc
pretty (Str s) = text s
pretty Space = space
pretty _ = empty
main :: IO ()
main = toJSONFilter extract_title
|