aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-11-29 09:56:41 -0800
committerJohn MacFarlane <[email protected]>2022-11-29 09:56:41 -0800
commitfe799eea91089aa90b935d2cab5cd87223906f65 (patch)
tree7fbc91037009d7c00b913782aa1bc959a813bbaa /src
parent6191be11ff81c8fce8509ebf1543e867d8501ba3 (diff)
AsciiDoc writer: in link text, only replace commas...
...with entities when they're in Str elements. If a link contains an image, it may have attributes, and the commas there should not be converted. See #8437, #8070.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/AsciiDoc.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/AsciiDoc.hs b/src/Text/Pandoc/Writers/AsciiDoc.hs
index 1c54584c4..54fd33596 100644
--- a/src/Text/Pandoc/Writers/AsciiDoc.hs
+++ b/src/Text/Pandoc/Writers/AsciiDoc.hs
@@ -40,7 +40,7 @@ import Text.Pandoc.Shared
import Text.Pandoc.URI
import Text.Pandoc.Templates (renderTemplate)
import Text.Pandoc.Writers.Shared
-
+import Text.Pandoc.Walk (walk)
data WriterState = WriterState { defListMarker :: Text
, orderedListLevel :: Int
@@ -563,8 +563,12 @@ inlineToAsciiDoc opts (Link _ txt (src, _tit)) = do
-- relative: link:downloads/foo.zip[download foo.zip]
-- abs: http://google.cod[Google]
-- or [email protected][email john]
- let fixCommas = T.replace "," "&#44;" -- see #8070
- linktext <- fmap fixCommas <$> inlineListToAsciiDoc opts txt
+ let fixCommas (Str t) =
+ intersperse (RawInline (Format "asciidoc") "&#44;")
+ $ map Str $ T.splitOn "," t -- see #8070
+ fixCommas x = [x]
+
+ linktext <- inlineListToAsciiDoc opts $ walk (concatMap fixCommas) txt
let isRelative = T.all (/= ':') src
let needsPassthrough = "--" `T.isInfixOf` src
let prefix = if isRelative