diff options
-rw-r--r-- | src/Text/Pandoc/Writers/RST.hs | 4 | ||||
-rw-r--r-- | test/Tests/Writers/RST.hs | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs index b299e6135..4a3b1b066 100644 --- a/src/Text/Pandoc/Writers/RST.hs +++ b/src/Text/Pandoc/Writers/RST.hs @@ -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 diff --git a/test/Tests/Writers/RST.hs b/test/Tests/Writers/RST.hs index 8727b38be..e6377c02f 100644 --- a/test/Tests/Writers/RST.hs +++ b/test/Tests/Writers/RST.hs @@ -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" =: |