diff options
author | John MacFarlane <jgm@berkeley.edu> | 2010-12-11 00:06:03 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2010-12-11 00:06:03 -0800 |
commit | f5c208230451c2f8446b639a4458a255e14778fb (patch) | |
tree | 6c433dac8a04895d102e43755c86996c12c4b2f2 /src | |
parent | dab645440af063b0c8e260bcda89080f986ad0e3 (diff) | |
parent | 167eeef6cb68d7cf4b5bd94f6543f84543df8c8c (diff) | |
download | pandoc-f5c208230451c2f8446b639a4458a255e14778fb.tar.gz |
Added JSON reader and writer.
The JSON reader is about 20x faster than the native reader.
So this can be a good way to serialize a pandoc document.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc.hs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs index 0ac558663..7d3468461 100644 --- a/src/Text/Pandoc.hs +++ b/src/Text/Pandoc.hs @@ -130,6 +130,7 @@ import Text.Pandoc.Templates import Text.Pandoc.Parsing import Text.Pandoc.Shared import Data.Version (showVersion) +import Text.JSON.Generic import Paths_pandoc (version) -- | Version number of pandoc library. @@ -139,6 +140,7 @@ pandocVersion = showVersion version -- | Association list of formats and readers. readers :: [(String, ParserState -> String -> Pandoc)] readers = [("native" , \_ -> read) + ,("json" , \_ -> decodeJSON) ,("markdown" , readMarkdown) ,("markdown+lhs" , readMarkdown) ,("rst" , readRST) @@ -153,6 +155,7 @@ readers = [("native" , \_ -> read) -- binary writers, odt and epub). writers :: [ ( String, WriterOptions -> Pandoc -> String ) ] writers = [("native" , writeNative) + ,("json" , \_ -> encodeJSON) ,("html" , writeHtmlString) ,("html+lhs" , writeHtmlString) ,("s5" , writeHtmlString) |