Asciidoc writer: use proper smart quotes with asciidoctor.
Asciidoctor has a different format for smart quotes. Closes #5487.
This commit is contained in:
parent
548ffa38c3
commit
5affa30e8a
2 changed files with 18 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -439,16 +439,16 @@ spaces: a^b c^d, a~b c~d.
|
|||
|
||||
== Smart quotes, ellipses, dashes
|
||||
|
||||
``Hello,'' said the spider. ```Shelob' is my name.''
|
||||
"`Hello,`" said the spider. "`'`Shelob`' is my name.`"
|
||||
|
||||
`A', `B', and `C' are letters.
|
||||
'`A`', '`B`', and '`C`' are letters.
|
||||
|
||||
`Oak,' `elm,' and `beech' are names of trees. So is `pine.'
|
||||
'`Oak,`' '`elm,`' and '`beech`' are names of trees. So is '`pine.`'
|
||||
|
||||
`He said, ``I want to go.''' Were you alive in the 70’s?
|
||||
'`He said, "`I want to go.`"`' Were you alive in the 70’s?
|
||||
|
||||
Here is some quoted ``code`' and a ``http://example.com/?foo=1&bar=2[quoted
|
||||
link]''.
|
||||
Here is some quoted '``code``' and a "`http://example.com/?foo=1&bar=2[quoted
|
||||
link]`".
|
||||
|
||||
Some dashes: one—two — three—four — five.
|
||||
|
||||
|
@ -478,7 +478,7 @@ latexmath:[\alpha + \omega \times x^2].
|
|||
These shouldn’t be math:
|
||||
|
||||
* To get the famous equation, write `$e = mc^2$`.
|
||||
* $22,000 is a _lot_ of money. So is $34,000. (It worked if ``lot'' is
|
||||
* $22,000 is a _lot_ of money. So is $34,000. (It worked if "`lot`" is
|
||||
emphasized.)
|
||||
* Shoes ($20) and socks ($5).
|
||||
* Escaped `$`: $73 _this should be emphasized_ 23$.
|
||||
|
@ -621,7 +621,7 @@ or here: <http://example.com/>
|
|||
|
||||
== Images
|
||||
|
||||
From ``Voyage dans la Lune'' by Georges Melies (1902):
|
||||
From "`Voyage dans la Lune`" by Georges Melies (1902):
|
||||
|
||||
image:lalune.jpg[lalune,title="Voyage dans la Lune"]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue