aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmir Dekel <[email protected]>2022-10-10 12:20:58 +0200
committerGitHub <[email protected]>2022-10-10 12:20:58 +0200
commit31aa660e656dc826e5c66927f645e3854194742d (patch)
tree7d0337f68fee61318d691174658ae343494d3328 /src
parent8f4308f2e575a5251c7b3e5091bb6e1392091d2f (diff)
Org reader: make #+pandoc-emphasis-pre work as expected. (#8360)
So far, `orgStateLastPreCharPos` wasn't updated appropriately after each parsing to native Str (by the parser `str`). In addition to solving this, the guard `notAfterString` in `emphasisStart` is removed to allow emphasis after Str at the first place.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Org/Inlines.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Inlines.hs b/src/Text/Pandoc/Readers/Org/Inlines.hs
index b1da970b8..aeca7575a 100644
--- a/src/Text/Pandoc/Readers/Org/Inlines.hs
+++ b/src/Text/Pandoc/Readers/Org/Inlines.hs
@@ -126,8 +126,12 @@ linebreak :: PandocMonad m => OrgParser m (F Inlines)
linebreak = try $ pure B.linebreak <$ string "\\\\" <* skipSpaces <* newline
str :: PandocMonad m => OrgParser m (F Inlines)
-str = return . B.str <$> many1Char (noneOf $ specialChars ++ "\n\r ")
+str = return . B.str <$>
+ ( many1Char (noneOf $ specialChars ++ "\n\r ") >>= updatePositions' )
<* updateLastStrPos
+ where
+ updatePositions' str' = str' <$
+ maybe mzero (updatePositions . snd) (T.unsnoc str')
-- | An endline character that can be treated as a space, not a structural
-- break. This should reflect the values of the Emacs variable
@@ -680,7 +684,6 @@ rawMathBetween s e = try $ textStr s *> manyTillChar anyChar (try $ textStr e)
emphasisStart :: PandocMonad m => Char -> OrgParser m Char
emphasisStart c = try $ do
guard =<< afterEmphasisPreChar
- guard =<< notAfterString
char c
lookAhead (noneOf emphasisForbiddenBorderChars)
pushToInlineCharStack c