diff options
| -rw-r--r-- | src/Text/Pandoc/Readers/Org/Inlines.hs | 7 | ||||
| -rw-r--r-- | test/Tests/Readers/Org/Inline.hs | 6 | ||||
| -rw-r--r-- | test/Tests/Readers/Org/Meta.hs | 17 |
3 files changed, 21 insertions, 9 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 diff --git a/test/Tests/Readers/Org/Inline.hs b/test/Tests/Readers/Org/Inline.hs index bec796972..e54b9c28c 100644 --- a/test/Tests/Readers/Org/Inline.hs +++ b/test/Tests/Readers/Org/Inline.hs @@ -104,8 +104,10 @@ tests = "[fn::Schreib mir eine E-Mail]" =?> para (note $ para "Schreib mir eine E-Mail") - , "Markup-chars not occurring on word break are symbols" =: - T.unlines [ "this+that+ +so+on" + , "By default, markup-chars not occurring on word break are symbols" =: + T.unlines [ "#+pandoc-emphasis-pre:" + , "#+pandoc-emphasis-post:" + , "this+that+ +so+on" , "seven*eight* nine*" , "+not+funny+" ] =?> diff --git a/test/Tests/Readers/Org/Meta.hs b/test/Tests/Readers/Org/Meta.hs index cce3f7a06..7ef8fe75d 100644 --- a/test/Tests/Readers/Org/Meta.hs +++ b/test/Tests/Readers/Org/Meta.hs @@ -208,12 +208,19 @@ tests = ] , testGroup "emphasis config" - [ "Changing pre and post chars for emphasis" =: - T.unlines [ "#+pandoc-emphasis-pre: \"[)\"" - , "#+pandoc-emphasis-post: \"]\\n\"" - , "([/emph/])*foo*" + [ "Changing pre chars for emphasis" =: + T.unlines [ "#+pandoc-emphasis-pre: \"[)$a1%\"" + , "[/emph/.)*strong*.a~code~" ] =?> - para ("([" <> emph "emph" <> "])" <> strong "foo") + para ("[" <> emph "emph" <> ".)" <> strong "strong" <> + ".a" <> code "code") + + , "Changing post chars for emphasis" =: + T.unlines [ "#+pandoc-emphasis-post: \"(]$a1%\"" + , "/emph/('*strong*]'~code~a" + ] =?> + para (emph "emph" <> "('" <> strong "strong" <> "]'" <> + code "code" <> "a") , "setting an invalid value restores the default" =: T.unlines [ "#+pandoc-emphasis-pre: \"[\"" |
