jgm/pandocfilters — pull request #3 by simonlau (2013-10-01 03:31:37+00:00)
Title: Added includes examples from pandoc scripting page

Added a converted python example of "include" from the pandoc scripting page

``` {.haskell}
#!/usr/bin/env runhaskell
-- includes.hs
import Text.Pandoc.JSON

doInclude :: Block -> IO Block
doInclude cb@(CodeBlock (id, classes, namevals) contents) =
case lookup "include" namevals of
Just f -> return . (CodeBlock (id, classes, namevals)) =<< readFile f
Nothing -> return cb
doInclude x = return x

main :: IO ()
main = toJSONFilter doInclude
```