mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-01 15:38:09 +08:00
RST writer: fix backslash escaping after strings
The check whether a complex inline element following a string must be escaped, now depends on the last character of the string instead of the first. Fixes: #5906
This commit is contained in:
@@ -462,7 +462,7 @@ transformInlines = insertBS .
|
||||
okBeforeComplex Space = True
|
||||
okBeforeComplex SoftBreak = True
|
||||
okBeforeComplex LineBreak = True
|
||||
okBeforeComplex (Str (T.uncons -> Just (c,_)))
|
||||
okBeforeComplex (Str (T.unsnoc -> Just (_,c)))
|
||||
= isSpace c || c `elemText` "-:/'\"<([{–—"
|
||||
okBeforeComplex _ = False
|
||||
isComplex :: Inline -> Bool
|
||||
@@ -491,7 +491,7 @@ flatten outer
|
||||
combineAll = foldl combine []
|
||||
|
||||
combine :: [Inline] -> Inline -> [Inline]
|
||||
combine f i =
|
||||
combine f i =
|
||||
case (outer, i) of
|
||||
-- quotes are not rendered using RST inlines, so we can keep
|
||||
-- them and they will be readable and parsable
|
||||
|
||||
@@ -105,6 +105,9 @@ tests = [ testGroup "rubrics"
|
||||
, "keeps quotes" =:
|
||||
strong (str "f" <> doubleQuoted (str "d") <> str "l") =?>
|
||||
"**f“d”l**"
|
||||
, "backslash inserted between str and code" =:
|
||||
str "/api?query=" <> code "foo" =?>
|
||||
"/api?query=\\ ``foo``"
|
||||
]
|
||||
, testGroup "headings"
|
||||
[ "normal heading" =:
|
||||
|
||||
Reference in New Issue
Block a user