diff options
author | John MacFarlane <jgm@berkeley.edu> | 2020-12-07 21:34:23 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2020-12-07 21:34:23 -0800 |
commit | 5990cbb150f3581ab9b2f3d3a726c73dcadfd793 (patch) | |
tree | 63cba22c60584184d2b18ced302829f1d83d443e /src/Text/Pandoc | |
parent | 8031ac137f9f84bf6c12d66592b07a3244b049a9 (diff) | |
download | pandoc-5990cbb150f3581ab9b2f3d3a726c73dcadfd793.tar.gz |
Parsing: Small code improvements.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Parsing.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs index 4ea0d788c..979344f63 100644 --- a/src/Text/Pandoc/Parsing.hs +++ b/src/Text/Pandoc/Parsing.hs @@ -641,7 +641,7 @@ uri = try $ do scheme <- uriScheme char ':' -- Avoid parsing e.g. "**Notes:**" as a raw URI: - notFollowedBy (oneOf "*_]") + notFollowedBy $ satisfy (\c -> c == '*' || c == '_' || c == ']') -- We allow sentence punctuation except at the end, since -- we don't want the trailing '.' in 'http://google.com.' We want to allow -- http://en.wikipedia.org/wiki/State_of_emergency_(disambiguation) @@ -693,7 +693,7 @@ mathInlineWith op cl = try $ do (("\\text" <>) <$> inBalancedBraces 0 "")) <|> (\c -> T.pack ['\\',c]) <$> anyChar)) <|> do (blankline <* notFollowedBy' blankline) <|> - (oneOf " \t" <* skipMany (oneOf " \t")) + (spaceChar <* skipMany spaceChar) notFollowedBy (char '$') return " " ) (try $ textStr cl) @@ -723,7 +723,8 @@ mathInlineWith op cl = try $ do mathDisplayWith :: Stream s m Char => Text -> Text -> ParserT s st m Text mathDisplayWith op cl = try $ fmap T.pack $ do textStr op - many1Till (noneOf "\n" <|> (newline <* notFollowedBy' blankline)) (try $ textStr cl) + many1Till (satisfy (/= '\n') <|> (newline <* notFollowedBy' blankline)) + (try $ textStr cl) mathDisplay :: (HasReaderOptions st, Stream s m Char) => ParserT s st m Text |