From 3df55b4a4ad14f984bcdd7296944b18b354ab122 Mon Sep 17 00:00:00 2001 From: John MacFarlane <jgm@berkeley.edu> Date: Mon, 16 May 2022 16:40:09 -0700 Subject: [PATCH] AsciiDoc writer: fix commas in link text. Commas in link text trigger interpretation of attributes. To block this, we replace them with numeric entities. Closes #8070. --- src/Text/Pandoc/Writers/AsciiDoc.hs | 3 ++- test/command/8070.md | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/command/8070.md diff --git a/src/Text/Pandoc/Writers/AsciiDoc.hs b/src/Text/Pandoc/Writers/AsciiDoc.hs index c4624cf5a..2822b3ef8 100644 --- a/src/Text/Pandoc/Writers/AsciiDoc.hs +++ b/src/Text/Pandoc/Writers/AsciiDoc.hs @@ -560,7 +560,8 @@ inlineToAsciiDoc opts (Link _ txt (src, _tit)) = do -- relative: link:downloads/foo.zip[download foo.zip] -- abs: http://google.cod[Google] -- or my@email.com[email john] - linktext <- inlineListToAsciiDoc opts txt + let fixCommas = T.replace "," "," -- see #8070 + linktext <- fmap fixCommas <$> inlineListToAsciiDoc opts txt let isRelative = T.all (/= ':') src let needsPassthrough = "--" `T.isInfixOf` src let prefix = if isRelative diff --git a/test/command/8070.md b/test/command/8070.md new file mode 100644 index 000000000..17422b472 --- /dev/null +++ b/test/command/8070.md @@ -0,0 +1,12 @@ +``` +% pandoc -f html -t asciidoc +<p><a href="https://docs.oracle.com/database/121/BRADV/rcmxplat.htm#BRADV724">12.1 +manual, Database Backup and Recovery User’s Guide: +<span class="enumeration_chapter">Chapter 28</span> Transporting Data Across Platforms, +Steps to Transport a Database to a Different Platform Using Backup Sets</a></p> +^D +https://docs.oracle.com/database/121/BRADV/rcmxplat.htm#BRADV724[12.1 +manual, Database Backup and Recovery User’s Guide: +[.enumeration_chapter]#Chapter 28# Transporting Data Across Platforms, +Steps to Transport a Database to a Different Platform Using Backup Sets] +```