aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Parsing.hs10
-rw-r--r--tests/markdown-reader-more.native2
-rw-r--r--tests/markdown-reader-more.txt4
3 files changed, 12 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index 4cd6591c0..8bc042e28 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -464,11 +464,13 @@ mathInlineWith :: String -> String -> Parser [Char] st String
mathInlineWith op cl = try $ do
string op
notFollowedBy space
- words' <- many1Till (count 1 (noneOf "\n\\")
+ words' <- many1Till (count 1 (noneOf " \t\n\\")
<|> (char '\\' >> anyChar >>= \c -> return ['\\',c])
- <|> count 1 newline <* notFollowedBy' blankline
- *> return " ")
- (try $ string cl)
+ <|> do (blankline <* notFollowedBy' blankline) <|>
+ (oneOf " \t" <* skipMany (oneOf " \t"))
+ notFollowedBy (char '$')
+ return " "
+ ) (try $ string cl)
notFollowedBy digit -- to prevent capture of $5
return $ concat words'
diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native
index 0d74c233d..b4713bc93 100644
--- a/tests/markdown-reader-more.native
+++ b/tests/markdown-reader-more.native
@@ -16,6 +16,8 @@
,Header 3 ("my-header",[],[]) [Str "my",Space,Str "header"]
,Header 2 ("in-math",[],[]) [Str "$",Space,Str "in",Space,Str "math"]
,Para [Math InlineMath "\\$2 + \\$3"]
+,Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "math:"]
+,Para [Str "$PATH",Space,Str "90",Space,Str "$PATH"]
,Header 2 ("commented-out-list-item",[],[]) [Str "Commented-out",Space,Str "list",Space,Str "item"]
,BulletList
[[Plain [Str "one",Space,RawInline (Format "html") "<!--\n- two\n-->"]]
diff --git a/tests/markdown-reader-more.txt b/tests/markdown-reader-more.txt
index 739543bfd..4cd69c9d8 100644
--- a/tests/markdown-reader-more.txt
+++ b/tests/markdown-reader-more.txt
@@ -58,6 +58,10 @@
$\$2 + \$3$
+This should not be math:
+
+$PATH 90 $PATH
+
## Commented-out list item
- one