Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart quotes incorrectly converted before a link [SF:bugs:343] #412

Closed
chrisjsewell opened this issue Aug 9, 2020 · 0 comments
Closed

Comments

@chrisjsewell
Copy link
Owner

author: mapio
created: 2018-04-23 14:58:40.540000
assigned: None
SF_url: https://sourceforge.net/p/docutils/bugs/343

When converting something like

bell'`esempio <http://example.net/>`_ 

to HTML you get

bell”<a class="reference external" href="http://example.net/">esempio</a>

where a smart quote takes the place of the single quote (that is the apostrophe, quite common in italian, for example).

This can be avoided if smartquotes = False is added to the configuration, in such case the conversion becomes

bell'<a class="reference external" href="http://example.net/">esempio</a>

as expected (and correct).


commenter: mapio
posted: 2018-04-23 15:00:25.479000
title: #343 Smart quotes incorrectly converted before a link

Please see sphinx-doc/sphinx#4864 (comment)


commenter: milde
posted: 2018-04-29 07:01:38.125000
title: #343 Smart quotes incorrectly converted before a link

This is actually a documented limitation of the "smartquotes" feature:

A single quote before a link is detected as a closing single quote.

The core problem is, that "smartquotes" cannot
distinguish a single quote from an apostrophe. You will see this also with
apostrophes at the end of a word, apostrophes inside a word if "smartquotes"
are activate because of escaped spaces, and with other inline markup.

This is masked in English because the single quote is converted to
RIGHT SINGLE QUOTATION MARK (’) and, according to the Unicode Standard,
"this is the preferred character to use for apostrophe".

As a result, smartquotes must be uses with special caution (or not at all)
with languages where the closing single quote glyph differs from the
apostrophe glyph.

Workarounds include:

a) disable smartquotes for languages where the closing single quote
differs from the apostrophe,
b) use literal Unicode character (bell’esempio) for apostrophe,
c) escape the ASCII APOSTROPHE character to prevent "education"
(bell'esempio).
d) set custom smart-quotes-locale with RIGHT SINGLE QUOTATION MARK (’) for
apostrophe and literal Unicode characters for single quotes,

IMO, workaround a) would be the safe thing to do for Sphinx.


commenter: milde
posted: 2018-04-29 07:02:13.385000
title: #343 Smart quotes incorrectly converted before a link

To see the limitation, test with e.g.::

rst2html5 --smart-quotes=alt --language=it

Quotes: "double", 'single', apostroph'

Inline markup:
bell'esempio <http://example.net/>_

The same happens with other inline markup:

.. |subs| replace:: issima

bell'name, bell'emphasized, bel'literal,
bel'|subs|, bel':sup:2

and with escaped spaces: bell'\ esempio


commenter: mapio
posted: 2018-04-29 22:04:50.834000
title: #343 Smart quotes incorrectly converted before a link

Thank you for your clarification; I've copied it also to the Sphinx bugtracker sphinx-doc/sphinx#4864 (comment)


commenter: milde
posted: 2018-04-30 06:33:18.037000
title: #343 Smart quotes incorrectly converted before a link

  • status: open --> closed-wont-fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant