summaryrefslogtreecommitdiff
path: root/build/extract-title.hs
diff options
context:
space:
mode:
Diffstat (limited to 'build/extract-title.hs')
-rwxr-xr-xbuild/extract-title.hs25
1 files changed, 0 insertions, 25 deletions
diff --git a/build/extract-title.hs b/build/extract-title.hs
deleted file mode 100755
index 6964d26..0000000
--- a/build/extract-title.hs
+++ /dev/null
@@ -1,25 +0,0 @@
1#!/usr/bin/env runhaskell
2
3-- import Text.Pandoc.Pretty
4-- import Text.Pandoc.JSON
5import Text.Pandoc.Pretty
6import Text.Pandoc.JSON
7import qualified Text.Pandoc.Walk as W
8import System.IO
9import qualified Data.Aeson as A
10import qualified Data.ByteString.Lazy as BL
11
12extract_title :: Pandoc -> String
13extract_title (Pandoc m _) = do
14 title <- render Nothing $ cat $ map pretty (docTitle m)
15 return title
16 where pretty :: Inline -> Doc
17 pretty (Str s) = text s
18 pretty Space = space
19 pretty _ = empty
20
21main :: IO ()
22main = do
23 input <- BL.getContents
24 let title = (W.query extract_title :: Pandoc -> String) . either error id . A.eitherDecode' $ input
25 putStrLn title