summaryrefslogtreecommitdiff
path: root/build/extract-title.hs
diff options
context:
space:
mode:
Diffstat (limited to 'build/extract-title.hs')
-rwxr-xr-xbuild/extract-title.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/build/extract-title.hs b/build/extract-title.hs
new file mode 100755
index 0000000..f3ca1ba
--- /dev/null
+++ b/build/extract-title.hs
@@ -0,0 +1,16 @@
1#!/usr/bin/env runhaskell
2
3import Text.Pandoc.Pretty
4import Text.Pandoc.JSON
5import System.IO
6
7extract_title :: Pandoc -> IO Pandoc
8extract_title d@(Pandoc m _) = do hPutStrLn stderr $ render Nothing $ cat $ map pretty (docTitle m)
9 return d
10 where pretty :: Inline -> Doc
11 pretty (Str s) = text s
12 pretty Space = space
13 pretty _ = empty
14
15main :: IO ()
16main = toJSONFilter extract_title