aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-08-12 22:04:23 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2012-08-12 22:04:23 -0700
commit27304513f660cc158d73ec5684a01491fa1fed99 (patch)
treea1bd2ddf8a6773337a2d0702bdaa7b2bc4417f70 /src/Text/Pandoc
parent6f24fdb65811661eac851c10e12330878223454b (diff)
downloadpandoc-27304513f660cc158d73ec5684a01491fa1fed99.tar.gz
Added Ext_raw_html extension.
Closes #556 -- you can now specify markdown-raw_html as your input format. (Read: markdown minus raw_html.)
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Options.hs5
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs9
2 files changed, 10 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index 9992cc9d9..3214a89b6 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -58,6 +58,7 @@ data Extension = Ext_footnotes
| Ext_pipe_tables
| Ext_citations
| Ext_raw_tex
+ | Ext_raw_html
| Ext_tex_math_dollars
| Ext_tex_math_single_backslash
| Ext_tex_math_double_backslash
@@ -97,6 +98,7 @@ pandocExtensions = Set.fromList
, Ext_pipe_tables
, Ext_citations
, Ext_raw_tex
+ , Ext_raw_html
, Ext_tex_math_dollars
, Ext_latex_macros
, Ext_delimited_code_blocks
@@ -119,7 +121,8 @@ pandocExtensions = Set.fromList
]
strictExtensions :: Set Extension
-strictExtensions = Set.empty
+strictExtensions = Set.fromList
+ [ Ext_raw_html ]
data ReaderOptions = ReaderOptions{
readerExtensions :: Set Extension -- ^ Syntax extensions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 995c9c65a..4f13740eb 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -729,9 +729,11 @@ htmlElement :: Parser [Char] ParserState String
htmlElement = strictHtmlBlock <|> liftM snd (htmlTag isBlockTag)
htmlBlock :: Parser [Char] ParserState (F Blocks)
-htmlBlock = return . B.rawBlock "html" <$>
- ((guardEnabled Ext_markdown_in_html_blocks >> rawHtmlBlocks)
- <|> htmlBlock')
+htmlBlock = do
+ guardEnabled Ext_raw_html
+ res <- (guardEnabled Ext_markdown_in_html_blocks >> rawHtmlBlocks)
+ <|> htmlBlock'
+ return $ return $ B.rawBlock "html" res
htmlBlock' :: Parser [Char] ParserState String
htmlBlock' = try $ do
@@ -1507,6 +1509,7 @@ inBrackets parser = do
rawHtmlInline :: Parser [Char] ParserState (F Inlines)
rawHtmlInline = do
+ guardEnabled Ext_raw_html
mdInHtml <- option False $
guardEnabled Ext_markdown_in_html_blocks >> return True
(_,result) <- if mdInHtml