diff options
author | Nikolay Yakimov <root@livid.pp.ru> | 2015-04-18 01:18:06 +0300 |
---|---|---|
committer | Nikolay Yakimov <root@livid.pp.ru> | 2015-04-18 01:23:41 +0300 |
commit | 4229cf2d92faf5774fe1a3a9c89a5de885cf75cd (patch) | |
tree | 89053b0783e1396068dae6b085d1b15c693529a0 /src/Text/Pandoc/Readers | |
parent | 94e4a5ec44ea3ac53a5cd69479ba716862f86c07 (diff) |
MD Reader: Smart `'` after inline math
Closes #1909.
Adds new parser combinator to Parsing.hs
`a <+?> b`
: if a succeeds, applies b and mappends
output (if any) to result of a. If b fails,
it's just a, if a fails, whole expression fails.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index ccda83576..5e0cef4f8 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1487,7 +1487,8 @@ code = try $ do math :: MarkdownParser Inlines math = (B.displayMath <$> (mathDisplay >>= applyMacros')) - <|> (B.math <$> (mathInline >>= applyMacros')) + <|> ((B.math <$> (mathInline >>= applyMacros')) <+?> + ((getOption readerSmart >>= guard) *> apostrophe <* notFollowedBy space)) -- Parses material enclosed in *s, **s, _s, or __s. -- Designed to avoid backtracking. |