diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-05-05 21:47:15 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-05-05 21:47:15 -0700 |
commit | 5affa30e8ad8b5c6ce31240ecd271fd4cccab219 (patch) | |
tree | 8e0665acaafaa64d7e6e9e8c24ff87eea8c73029 /src/Text | |
parent | 548ffa38c3b7850334f80d037521bd30ee171eee (diff) | |
download | pandoc-5affa30e8ad8b5c6ce31240ecd271fd4cccab219.tar.gz |
Asciidoc writer: use proper smart quotes with asciidoctor.
Asciidoctor has a different format for smart quotes.
Closes #5487.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/AsciiDoc.hs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/AsciiDoc.hs b/src/Text/Pandoc/Writers/AsciiDoc.hs index 472fb6a91..47738e69d 100644 --- a/src/Text/Pandoc/Writers/AsciiDoc.hs +++ b/src/Text/Pandoc/Writers/AsciiDoc.hs @@ -425,10 +425,16 @@ inlineToAsciiDoc opts (Subscript lst) = do contents <- inlineListToAsciiDoc opts lst return $ "~" <> contents <> "~" inlineToAsciiDoc opts (SmallCaps lst) = inlineListToAsciiDoc opts lst -inlineToAsciiDoc opts (Quoted SingleQuote lst) = - inlineListToAsciiDoc opts (Str "`" : lst ++ [Str "'"]) -inlineToAsciiDoc opts (Quoted DoubleQuote lst) = - inlineListToAsciiDoc opts (Str "``" : lst ++ [Str "''"]) +inlineToAsciiDoc opts (Quoted qt lst) = do + isAsciidoctor <- gets asciidoctorVariant + inlineListToAsciiDoc opts $ + case qt of + SingleQuote + | isAsciidoctor -> [Str "'`"] ++ lst ++ [Str "`'"] + | otherwise -> [Str "`"] ++ lst ++ [Str "'"] + DoubleQuote + | isAsciidoctor -> [Str "\"`"] ++ lst ++ [Str "`\""] + | otherwise -> [Str "``"] ++ lst ++ [Str "''"] inlineToAsciiDoc _ (Code _ str) = return $ text "`" <> text (escapeStringUsing (backslashEscapes "`") str) <> "`" inlineToAsciiDoc _ (Str str) = return $ text $ escapeString str |