aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2016-07-14 13:23:18 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2016-07-14 13:33:25 +0200
commit529146decf7f0e390964bb7aa709082af6e8639b (patch)
tree735fc7f770e72e612a1cf820830115abb3f0a69c /src/Text/Pandoc/Readers
parent106786ef1b1275cbaab9173e7f1c9372dec88279 (diff)
downloadpandoc-529146decf7f0e390964bb7aa709082af6e8639b.tar.gz
Org reader: fix parsing of verbatim inlines
Org rules for allowed characters before or after markup chars were not checked for verbatim text. This resultet in wrong parsing outcomes of if the verbatim text contained e.g. space enclosed markup characters as part of the text (`=is_substr = True=`). Forcing the parser to update the positions of allowed/forbidden markup border characters fixes this. This fixes #3016.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Org/Inlines.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Inlines.hs b/src/Text/Pandoc/Readers/Org/Inlines.hs
index 6a8773c3c..e1a66a8c7 100644
--- a/src/Text/Pandoc/Readers/Org/Inlines.hs
+++ b/src/Text/Pandoc/Readers/Org/Inlines.hs
@@ -614,7 +614,7 @@ displayMath = return . B.displayMath <$> choice [ rawMathBetween "\\[" "\\]"
]
updatePositions :: Char
- -> OrgParser (Char)
+ -> OrgParser Char
updatePositions c = do
when (c `elem` emphasisPreChars) updateLastPreCharPos
when (c `elem` emphasisForbiddenBorderChars) updateLastForbiddenCharPos
@@ -637,7 +637,9 @@ verbatimBetween :: Char
-> OrgParser String
verbatimBetween c = try $
emphasisStart c *>
- many1TillNOrLessNewlines 1 (noneOf "\n\r") (emphasisEnd c)
+ many1TillNOrLessNewlines 1 verbatimChar (emphasisEnd c)
+ where
+ verbatimChar = noneOf "\n\r" >>= updatePositions
-- | Parses a raw string delimited by @c@ using Org's math rules
mathStringBetween :: Char