aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-12-29 06:30:12 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-12-29 06:30:12 +0000
commitf74dda27b6d6a6425cc62d7c9c7c943b69f2d9db (patch)
tree8c3a75a85029867d07e3a348d3fc99d65ddb4ffe
parent05cbdf04fdbb4290197b201a720f3e1796efee5e (diff)
downloadpandoc-f74dda27b6d6a6425cc62d7c9c7c943b69f2d9db.tar.gz
Markdown reader: Make 'block' conditional on strictness state,
instead of using failIfStrict in block parsers. Use a different ordering of parsers in strict mode: raw HTML block before paragraph. This recovers performance that was lost in strict mode with r1154. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1157 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r--Text/Pandoc/Readers/Markdown.hs48
1 files changed, 27 insertions, 21 deletions
diff --git a/Text/Pandoc/Readers/Markdown.hs b/Text/Pandoc/Readers/Markdown.hs
index e9befec12..6ff5ce17c 100644
--- a/Text/Pandoc/Readers/Markdown.hs
+++ b/Text/Pandoc/Readers/Markdown.hs
@@ -226,17 +226,32 @@ noteBlock = try $ do
parseBlocks = manyTill block eof
-block = choice [ header
- , table
- , codeBlock
- , hrule
- , list
- , blockQuote
- , rawLaTeXEnvironment'
- , para
- , htmlBlock
- , plain
- , nullBlock ] <?> "block"
+block = do
+ st <- getState
+ choice (if stateStrict st
+ then [ header
+ , codeBlock
+ , hrule
+ , bulletList
+ , orderedList
+ , blockQuote
+ , htmlBlock
+ , para
+ , plain
+ , nullBlock ]
+ else [ header
+ , table
+ , codeBlock
+ , hrule
+ , bulletList
+ , orderedList
+ , definitionList
+ , blockQuote
+ , rawLaTeXEnvironment
+ , para
+ , htmlBlock
+ , plain
+ , nullBlock ]) <?> "block"
--
-- header blocks
@@ -314,8 +329,6 @@ blockQuote = do
-- list blocks
--
-list = choice [ bulletList, orderedList, definitionList ] <?> "list"
-
bulletListStart = try $ do
optional newline -- if preceded by a Plain block in a list context
nonindentSpaces
@@ -434,7 +447,6 @@ defRawBlock = try $ do
return $ firstline ++ "\n" ++ unlines rawlines ++ trailing
definitionList = do
- failIfStrict
items <- many1 definitionListItem
let (terms, defs) = unzip items
let defs' = compactify defs
@@ -503,12 +515,6 @@ rawHtmlBlocks = do
return $ RawHtml combined'
--
--- LaTeX
---
-
-rawLaTeXEnvironment' = failIfStrict >> rawLaTeXEnvironment
-
---
-- Tables
--
@@ -629,7 +635,7 @@ alignType strLst len =
(True, True) -> AlignCenter
(False, False) -> AlignDefault
-table = failIfStrict >> (simpleTable <|> multilineTable) <?> "table"
+table = simpleTable <|> multilineTable <?> "table"
--
-- inline