git.iko.soy/typeable/pandoc
on master help sign in
Org reader: update emphasis border chars

The org reader was updated to match current org-mode behavior: the set of characters which are acceptable to occur as the first or last character in an org emphasis have been changed and now allows all non-whitespace chars at the inner border of emphasized text (see `org-emphasis-regexp-components`). Fixes: #3933

commit3a7663281a35292b87471da4f5b7a88808546076 authorAlbert Krewinkel <albert@zeitkraut.de> dateMon 25 Sep 2017, 09:31 (9 years ago) parentc78a101
2 files changed+12−12
src/Text/Pandoc/Readers/Org/Inlines.hs+3−3 test/Tests/Readers/Org.hs+9−9
src/Text/Pandoc/Readers/Org/Inlines.hs+3−3
@@ -735,15 +735,15 @@ many1TillNOrLessNewlines n p end = try $
735735
736736-- | Chars allowed to occur before emphasis (spaces and newlines are ok, too)
737737emphasisPreChars :: [Char]
738−emphasisPreChars = "\t \"'({"
738+emphasisPreChars = "-\t ('\"{"
739739
740740-- | Chars allowed at after emphasis
741741emphasisPostChars :: [Char]
742−emphasisPostChars = "\t\n !\"'),-.:;?\\}["
742+emphasisPostChars = "-\t\n .,:!?;'\")}["
743743
744744-- | Chars not allowed at the (inner) border of emphasis
745745emphasisForbiddenBorderChars :: [Char]
746−emphasisForbiddenBorderChars = "\t\n\r \"',"
746+emphasisForbiddenBorderChars = "\t\n\r "
747747
748748-- | The maximum number of newlines within
749749emphasisAllowedNewlines :: Int
test/Tests/Readers/Org.hs+9−9
@@ -131,18 +131,18 @@ tests =
131131 para (spcSep [ emph $ "t/&" <> space <> "a"
132132 , "/"
133133 , "./r/"
134− , "(" <> (strong "l") <> ")"
135− , (emph "e") <> "!"
136− , (emph "b") <> "."
134+ , "(" <> strong "l" <> ")"
135+ , emph "e" <> "!"
136+ , emph "b" <> "."
137137 ])
138138
139− , "Quotes are forbidden border chars" =:
140− "/'nope/ *nope\"*" =?>
141− para ("/'nope/" <> space <> "*nope\"*")
139+ , "Quotes are allowed border chars" =:
140+ "/'yep/ *sure\"*" =?>
141+ para (emph "'yep" <> space <> strong "sure\"")
142142
143− , "Commata are forbidden border chars" =:
144− "/nada,/" =?>
145− para "/nada,/"
143+ , "Spaces are forbidden border chars" =:
144+ "/nada /" =?>
145+ para "/nada /"
146146
147147 , "Markup should work properly after a blank line" =:
148148 T.unlines ["foo", "", "/bar/"] =?>