Changes to Markdown reader for better conformity to the

Markdown test suite under --strict:
+ Removed check for a following setext header in endline.
  A full test is too inefficient (doubles benchmark time), and
  the substitute we had before is not 100% accurate.
+ Don't use Code elements for autolinks if --strict specified.


git-svn-id: https://pandoc.googlecode.com/svn/trunk@876 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2007-08-20 18:52:49 +00:00
parent 57d52c39ec
commit 84aa875bdb

View file

@ -322,7 +322,7 @@ bulletListStart = try $ do
skipSpaces
anyOrderedListStart = try $ do
optional newline -- if preceded by a Plain block in a list context
optional newline -- if preceded by a Plain block in a list context
nonindentSpaces
state <- getState
if stateStrict state
@ -786,8 +786,6 @@ endline = try $ do
then do
notFollowedBy emailBlockQuoteStart
notFollowedBy (char '#') -- atx header
notFollowedBy (manyTill anyChar newline >> oneOf setextHChars)
-- setext header
else return ()
-- parse potential list-starts differently if in a list:
if stateParserContext st == ListItemState
@ -854,9 +852,10 @@ autoLinkEmail = try $ do
char '<'
name <- many1Till (noneOf "/:<> \t\n") (char '@')
domain <- sepBy1 (many1 (noneOf "/:.@<> \t\n")) (char '.')
let src = name ++ "@" ++ (joinWithSep "." domain)
char '>'
return $ Link [Code src] (("mailto:" ++ src), "")
let src = name ++ "@" ++ (joinWithSep "." domain)
txt <- autoLinkText src
return $ Link txt (("mailto:" ++ src), "")
-- a link <http://like.this.com>
autoLinkRegular = try $ do
@ -864,7 +863,14 @@ autoLinkRegular = try $ do
prot <- oneOfStrings ["http:", "ftp:", "mailto:"]
rest <- many1Till (noneOf " \t\n<>") (char '>')
let src = prot ++ rest
return $ Link [Code src] (src, "")
txt <- autoLinkText src
return $ Link txt (src, "")
autoLinkText src = do
st <- getState
return $ if stateStrict st
then [Str src]
else [Code src]
image = try $ do
char '!'