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
This commit is contained in:
Albert Krewinkel 2017-09-25 09:31:29 +02:00
parent c78a101b7d
commit 3a7663281a
No known key found for this signature in database
GPG key ID: 388DC0B21F631124
2 changed files with 12 additions and 12 deletions

View file

@ -735,15 +735,15 @@ many1TillNOrLessNewlines n p end = try $
-- | Chars allowed to occur before emphasis (spaces and newlines are ok, too)
emphasisPreChars :: [Char]
emphasisPreChars = "\t \"'({"
emphasisPreChars = "-\t ('\"{"
-- | Chars allowed at after emphasis
emphasisPostChars :: [Char]
emphasisPostChars = "\t\n !\"'),-.:;?\\}["
emphasisPostChars = "-\t\n .,:!?;'\")}["
-- | Chars not allowed at the (inner) border of emphasis
emphasisForbiddenBorderChars :: [Char]
emphasisForbiddenBorderChars = "\t\n\r \"',"
emphasisForbiddenBorderChars = "\t\n\r "
-- | The maximum number of newlines within
emphasisAllowedNewlines :: Int

View file

@ -131,18 +131,18 @@ tests =
para (spcSep [ emph $ "t/&" <> space <> "a"
, "/"
, "./r/"
, "(" <> (strong "l") <> ")"
, (emph "e") <> "!"
, (emph "b") <> "."
, "(" <> strong "l" <> ")"
, emph "e" <> "!"
, emph "b" <> "."
])
, "Quotes are forbidden border chars" =:
"/'nope/ *nope\"*" =?>
para ("/'nope/" <> space <> "*nope\"*")
, "Quotes are allowed border chars" =:
"/'yep/ *sure\"*" =?>
para (emph "'yep" <> space <> strong "sure\"")
, "Commata are forbidden border chars" =:
"/nada,/" =?>
para "/nada,/"
, "Spaces are forbidden border chars" =:
"/nada /" =?>
para "/nada /"
, "Markup should work properly after a blank line" =:
T.unlines ["foo", "", "/bar/"] =?>