diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-09-01 02:18:25 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-09-01 02:18:25 +0000 |
commit | 85d49ee9366e99e45aa791320b5a8b4436715009 (patch) | |
tree | 2c985ae52f061b4e9341bfb2d6e1cebb02af74a9 /src/Text | |
parent | 8d3bec3e4d8cbd5c623e7d83f271a361e761d16a (diff) | |
download | pandoc-85d49ee9366e99e45aa791320b5a8b4436715009.tar.gz |
Combined linebreak and whitespace into a new whitespace
parser, to avoid unnecessary reparsing of space characters.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@978 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index a0d6e9968..97291d501 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -625,9 +625,8 @@ table = failIfStrict >> (simpleTable <|> multilineTable) <?> "table" inline = choice [ str , smartPunctuation - , linebreak - , endline , whitespace + , endline , code , charRef , strong @@ -766,11 +765,11 @@ enDash = try $ char '-' >> notFollowedBy (noneOf "0123456789") >> return EnDash emDash = try $ skipSpaces >> oneOfStrings ["---", "--"] >> skipSpaces >> return EmDash -whitespace = (many1 (oneOf spaceChars) >> return Space) <?> "whitespace" - --- hard line break -linebreak = try $ oneOf spaceChars >> many1 (oneOf spaceChars) >> - endline >> return LineBreak +whitespace = do + sps <- many1 (oneOf spaceChars) + if length sps >= 2 + then option Space (endline >> return LineBreak) + else return Space <?> "whitespace" nonEndline = satisfy (/='\n') |