aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-01-10 22:38:07 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-01-10 22:39:47 -0800
commitf8db21fa16e8f8e3244f4d3fc85ea1df17aae86f (patch)
tree0c374667b4fd18fc9dadf079a839fb3bdf6f1452 /src/Text
parent23ab5ffcb0b708e4f07cafd7a877926ce0dc532b (diff)
downloadpandoc-f8db21fa16e8f8e3244f4d3fc85ea1df17aae86f.tar.gz
Options: Added phpMarkdownExtraExtensions.
And added markdown_phpextra input/output format.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc.hs20
-rw-r--r--src/Text/Pandoc/Options.hs14
2 files changed, 25 insertions, 9 deletions
diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs
index 91fbe0893..c942b037c 100644
--- a/src/Text/Pandoc.hs
+++ b/src/Text/Pandoc.hs
@@ -174,19 +174,20 @@ parseFormatSpec = parse formatSpec ""
'-' -> Set.delete ext
_ -> Set.insert ext
+-- auxiliary function for readers:
+markdown :: ReaderOptions -> String -> IO Pandoc
+markdown o s = do
+ let (doc, warnings) = readMarkdownWithWarnings o s
+ mapM_ warn warnings
+ return doc
+
-- | Association list of formats and readers.
readers :: [(String, ReaderOptions -> String -> IO Pandoc)]
readers = [("native" , \_ s -> return $ readNative s)
,("json" , \_ s -> return $ decodeJSON s)
- ,("markdown_strict" , \o s -> do
- let (doc, warnings) = readMarkdownWithWarnings
- o{ readerExtensions = strictExtensions } s
- mapM_ warn warnings
- return doc)
- ,("markdown" , \o s -> do
- let (doc, warnings) = readMarkdownWithWarnings o s
- mapM_ warn warnings
- return doc)
+ ,("markdown" , markdown)
+ ,("markdown_strict" , markdown)
+ ,("markdown_phpextra" , markdown)
,("rst" , \o s -> return $ readRST o s)
,("mediawiki" , \o s -> return $ readMediaWiki o s)
,("docbook" , \o s -> return $ readDocBook o s)
@@ -245,6 +246,7 @@ writers = [
getDefaultExtensions :: String -> Set Extension
getDefaultExtensions "markdown_strict" = strictExtensions
+getDefaultExtensions "markdown_phpextra" = phpMarkdownExtraExtensions
getDefaultExtensions _ = pandocExtensions
-- | Retrieve reader based on formatSpec (format+extensions).
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index b62187bfe..2382bb3e8 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -31,6 +31,7 @@ options.
module Text.Pandoc.Options ( Extension(..)
, pandocExtensions
, strictExtensions
+ , phpMarkdownExtraExtensions
, ReaderOptions(..)
, HTMLMathMethod (..)
, CiteMethod (..)
@@ -134,6 +135,19 @@ pandocExtensions = Set.fromList
, Ext_implicit_header_references
]
+phpMarkdownExtraExtensions :: Set Extension
+phpMarkdownExtraExtensions = Set.fromList
+ [ Ext_footnotes
+ , Ext_pipe_tables
+ , Ext_raw_html
+ , Ext_markdown_attribute
+ , Ext_fenced_code_blocks
+ , Ext_definition_lists
+ , Ext_intraword_underscores
+ , Ext_header_attributes
+ , Ext_abbreviations
+ ]
+
strictExtensions :: Set Extension
strictExtensions = Set.fromList
[ Ext_raw_html ]