aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-08-20 18:52:49 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-08-20 18:52:49 +0000
commit84aa875bdba3215cf79f195a3f2ba6db06498257 (patch)
tree245d69167512c88716f60440ffdc44869ea7a7ed /src/Text/Pandoc
parent57d52c39ec30e785d6014c59088596a2d2a6645b (diff)
downloadpandoc-84aa875bdba3215cf79f195a3f2ba6db06498257.tar.gz
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
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index f4b97527f..5f0c0b7a5 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -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 '!'