aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/UTF8.hs
diff options
context:
space:
mode:
authorEmily Bourke <undergroundquizscene@gmail.com>2021-08-17 16:20:33 +0100
committerGitHub <noreply@github.com>2021-08-17 08:20:33 -0700
commit415f445fc136f5832a6e2512833c2ff6a3e89038 (patch)
tree36078a21cb7331689a99d7631d9871e0fcd1305a /src/Text/Pandoc/UTF8.hs
parentabb35d8b0ffa1160dd63a15ec0d5c391da31093f (diff)
downloadpandoc-415f445fc136f5832a6e2512833c2ff6a3e89038.tar.gz
Escape backslashes in haddock comments (#7505)
Any literal backslash needs to be escaped: these are currently showing up as “‘r’” instead of “‘\r’”. Co-authored-by: Emily Bourke <undergroundquizscene@protonmail.com>
Diffstat (limited to 'src/Text/Pandoc/UTF8.hs')
-rw-r--r--src/Text/Pandoc/UTF8.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Text/Pandoc/UTF8.hs b/src/Text/Pandoc/UTF8.hs
index 4d5921faf..e154f0535 100644
--- a/src/Text/Pandoc/UTF8.hs
+++ b/src/Text/Pandoc/UTF8.hs
@@ -96,7 +96,7 @@ hGetContents :: Handle -> IO Text
hGetContents = fmap toText . B.hGetContents
-- | Convert UTF8-encoded ByteString to Text, also
--- removing '\r' characters.
+-- removing '\\r' characters.
toText :: B.ByteString -> Text
toText = T.decodeUtf8 . filterCRs . dropBOM
where dropBOM bs =
@@ -106,12 +106,12 @@ toText = T.decodeUtf8 . filterCRs . dropBOM
filterCRs = B.filter (/='\r')
-- | Convert UTF8-encoded ByteString to String, also
--- removing '\r' characters.
+-- removing '\\r' characters.
toString :: B.ByteString -> String
toString = T.unpack . toText
-- | Convert UTF8-encoded ByteString to Text, also
--- removing '\r' characters.
+-- removing '\\r' characters.
toTextLazy :: BL.ByteString -> TL.Text
toTextLazy = TL.decodeUtf8 . filterCRs . dropBOM
where dropBOM bs =
@@ -121,7 +121,7 @@ toTextLazy = TL.decodeUtf8 . filterCRs . dropBOM
filterCRs = BL.filter (/='\r')
-- | Convert UTF8-encoded ByteString to String, also
--- removing '\r' characters.
+-- removing '\\r' characters.
toStringLazy :: BL.ByteString -> String
toStringLazy = TL.unpack . toTextLazy