summaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Parsing/Math.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Parsing/Math.hs b/src/Text/Pandoc/Parsing/Math.hs
index 0be9ac3d6..73ae1e0c2 100644
--- a/src/Text/Pandoc/Parsing/Math.hs
+++ b/src/Text/Pandoc/Parsing/Math.hs
@@ -17,7 +17,7 @@ where
import Control.Monad (mzero, when)
import Data.Text (Text)
-import Text.Parsec ((<|>), ParsecT, Stream(..), notFollowedBy, skipMany, try)
+import Text.Parsec ((<|>), ParsecT, Stream(..), notFollowedBy, many1, try)
import Text.Pandoc.Options
( Extension(Ext_tex_math_dollars, Ext_tex_math_single_backslash,
Ext_tex_math_double_backslash) )
@@ -42,10 +42,8 @@ mathInlineWith op cl = try $ do
(try (string "text" >>
(("\\text" <>) <$> inBalancedBraces 0 ""))
<|> (\c -> T.pack ['\\',c]) <$> anyChar))
- <|> do (blankline <* notFollowedBy' blankline) <|>
- (spaceChar <* skipMany spaceChar)
- notFollowedBy (char '$')
- return " "
+ <|> ("\n" <$ blankline <* notFollowedBy' blankline)
+ <|> (T.pack <$> many1 spaceChar <* notFollowedBy (char '$'))
) (try $ textStr cl)
notFollowedBy digit -- to prevent capture of $5
return $ trimMath $ T.concat words'