aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-10-07 23:03:14 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-10-07 23:05:51 -0700
commit1be0f0fba8d860b960e79442a891fce6b1aca192 (patch)
tree8a8be459bd7d03e5509382029ba65f2433969240 /src/Text
parenta520181cdbfa69b4c9a0432e12847cd7d666d41f (diff)
downloadpandoc-1be0f0fba8d860b960e79442a891fce6b1aca192.tar.gz
Use double quotes for YAML metadata.
Closes #6727.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index f0643c91b..cddc57850 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -180,7 +180,7 @@ valToYaml (SimpleVal x)
if hasNewlines x
then hang 0 ("|" <> cr) x
else if any hasPunct x
- then "'" <> fmap escapeSingleQuotes x <> "'"
+ then "\"" <> fmap escapeInDoubleQuotes x <> "\""
else x
where
hasNewlines NewLine = True
@@ -192,7 +192,7 @@ valToYaml (SimpleVal x)
isYamlPunct = (`elem` ['-','?',':',',','[',']','{','}',
'#','&','*','!','|','>','\'','"',
'%','@','`',',','[',']','{','}'])
- escapeSingleQuotes = T.replace "'" "''"
+ escapeInDoubleQuotes = T.replace "\"" "\\\"" . T.replace "\\" "\\\\"
valToYaml _ = empty
-- | Return markdown representation of document.