diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-08-03 12:49:29 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-08-03 12:49:29 +0200 |
commit | 230688a0b842cf57b316a7ba62910ca387afbce7 (patch) | |
tree | 6367087d25147335972cacf19bd34fb868863fd7 /build/extract-title.hs | |
parent | 7170488c37105691f4a690cbcf1e43000d779b59 (diff) | |
download | dirty-haskell.org-230688a0b842cf57b316a7ba62910ca387afbce7.tar dirty-haskell.org-230688a0b842cf57b316a7ba62910ca387afbce7.tar.gz dirty-haskell.org-230688a0b842cf57b316a7ba62910ca387afbce7.tar.bz2 dirty-haskell.org-230688a0b842cf57b316a7ba62910ca387afbce7.tar.xz dirty-haskell.org-230688a0b842cf57b316a7ba62910ca387afbce7.zip |
Start of complete rewrite to switch to hakyll
Diffstat (limited to 'build/extract-title.hs')
-rwxr-xr-x | build/extract-title.hs | 25 |
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 | ||
5 | import Text.Pandoc.Pretty | ||
6 | import Text.Pandoc.JSON | ||
7 | import qualified Text.Pandoc.Walk as W | ||
8 | import System.IO | ||
9 | import qualified Data.Aeson as A | ||
10 | import qualified Data.ByteString.Lazy as BL | ||
11 | |||
12 | extract_title :: Pandoc -> String | ||
13 | extract_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 | |||
21 | main :: IO () | ||
22 | main = do | ||
23 | input <- BL.getContents | ||
24 | let title = (W.query extract_title :: Pandoc -> String) . either error id . A.eitherDecode' $ input | ||
25 | putStrLn title | ||