aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-08-11 15:04:12 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2012-08-11 15:04:12 -0700
commit78d3a0fb9d3f862d5e2b61bd45434f7af9cd9f18 (patch)
treed9d421ec88fb89baa93e25199e4df419b1b235ca /src/Text/Pandoc/Readers
parent9591fc96147610fddd210ae6396f54850018754e (diff)
downloadpandoc-78d3a0fb9d3f862d5e2b61bd45434f7af9cd9f18.tar.gz
Implemented Ext_markdown_attribute.
This adds markdown=1 to block tags.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 8a1299de6..fbcdeeb14 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -736,10 +736,19 @@ rawTeXBlock = do
spaces
return $ return result
+addMarkdownAttribute :: (Tag String, String) -> Parser [Char] ParserState String
+addMarkdownAttribute (t,s) = do
+ (guardDisabled Ext_markdown_attribute >> return s)
+ <|> case t of
+ TagOpen x attrs
+ | "markdown" `elem` map fst attrs -> return s
+ | otherwise -> return $ renderTags [TagOpen x (("markdown","1"):attrs)]
+ _ -> return s
+
rawHtmlBlocks :: Parser [Char] ParserState String
rawHtmlBlocks = do
htmlBlocks <- many1 $ do blk <- rawVerbatimBlock <|>
- liftM snd (htmlTag isBlockTag)
+ (htmlTag isBlockTag >>= addMarkdownAttribute)
sps <- do sp1 <- many spaceChar
sp2 <- option "" (blankline >> return "\n")
sp3 <- many spaceChar