diff options
-rw-r--r-- | README | 7 | ||||
-rw-r--r-- | pandoc.cabal | 6 | ||||
-rw-r--r-- | src/Text/Pandoc.hs | 3 |
3 files changed, 11 insertions, 5 deletions
@@ -140,8 +140,8 @@ Options ======= `-f` *FORMAT*, `-r` *FORMAT*, `--from=`*FORMAT*, `--read=`*FORMAT* -: Specify input format. *FORMAT* can be - `native` (native Haskell), `markdown` (markdown or plain text), +: Specify input format. *FORMAT* can be `native` (native Haskell), + `json` (JSON version of native AST), `markdown` (markdown), `textile` (Textile), `rst` (reStructuredText), `html` (HTML), or `latex` (LaTeX). If `+lhs` is appended to `markdown`, `rst`, or `latex`, the input will be treated as literate Haskell source: @@ -150,7 +150,8 @@ Options `-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT* : Specify output format. *FORMAT* can be `native` (native Haskell), - `plain` (plain text), `markdown` (markdown), `rst` (reStructuredText), + `json` (JSON version of native AST), `plain` (plain text), + `markdown` (markdown), `rst` (reStructuredText), `html` (HTML), `latex` (LaTeX), `context` (ConTeXt), `man` (groff man), `mediawiki` (MediaWiki markup), `textile` (Textile), `org` (Emacs Org-Mode), `texinfo` (GNU Texinfo), `docbook` (DocBook XML), diff --git a/pandoc.cabal b/pandoc.cabal index 08e2bc415..727bae405 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -169,7 +169,8 @@ Library HTTP >= 4000.0.5, texmath >= 0.4, xml >= 1.3.5 && < 1.4, random, extensible-exceptions, citeproc-hs >= 0.3 && < 0.4, - pandoc-types == 1.7.* + pandoc-types == 1.7.*, + json >= 0.4 && < 0.5 if impl(ghc >= 6.10) Build-depends: base >= 4 && < 5, syb else @@ -240,7 +241,8 @@ Executable pandoc HTTP >= 4000.0.5, texmath, xml >= 1.3.5 && < 1.4, random, extensible-exceptions, citeproc-hs >= 0.3 && < 0.4, - pandoc-types == 1.7.* + pandoc-types == 1.7.*, + json >= 0.4 && < 0.5 if impl(ghc >= 6.10) Build-depends: base >= 4 && < 5, syb else 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) |