> do_dashes = 1S
> [...]
> if do_dashes == 1:
> text = smartquotes.educateDashes(text)
>
Yes, but the method is actually (at Sphinx 1.6.2, because it is slightly
different in future 1.6.3 regarding backticks) using "2" not "1".
This is decided by the apply() method of SmartQuotes class from
docutils.transforms.universal
> Looking at
https://sourceforge.net/p/docutils/code/HEAD/tree/tags/docutils-0.13.1/docutils/utils/smartquotes.py
> see this:
> [...]
> default_smartypants_attr = "1"
> [...]
> def educateDashes(text):
> """
> Parameter: String (unicode or bytes).
> Returns: The `text`, with each instance of "--" translated to
> an em-dash character.
> """
>
> text = re.sub(r"""---""", smartchars.endash, text) # en (yes, backwards)
> text = re.sub(r"""--""", smartchars.emdash, text) # em (yes, backwards)
> return text
>
> So double dash goes to em (which is the longer dash).
But the actual docutils method used is smartquotes.educateDashesOldSchool(text)
Have you tested ?
Note: at Sphinx 1.6.3, the "2" is overridden to be "qDe"
which is a backport of docutils 0.14 default to earlier
versions of Docutils. The difference is that it skips
the backticks processing, This matches with Sphinx 1.5.6
behaviour. Anyhow, backticks should not occur usually
as they are mainly involved in reST markup. But it is
better for efficiency to not even fiddle with them
when they end up in text nodes.
>
>> Since Sphinx 1.6 such conversion is handled by docutils.
>>
>>
http://docutils.sourceforge.net/docs/user/config.html#smart-quotes
>>
>> Docutils source code has potential for converting ``--`` rather to EM dash,
>> and ``---`` to EN dash, but for versions < 0.14, the smart quotes
>> transform action is hard-coded
>> and it maps ``--`` to EN dash and ``---`` to EM dash.
>>
>> When Docutils>=0.14 is used, Sphinx patches nothing, but uses a derived
>> class for some reasons, and it could benefit from the class attribute
>> added at Docutils 0.14 called ``smartquotes_action``.
>>
>> With Docutils<0.14 Sphinx needs to over-write more, and it could
>> take this opportunity to achieve same as ``smartquotes_action``.
>
> This would be the situation I'm in.
But nothing needs to be changed, a priori.
Please communicate an example if it demonstrates the contrary
>
>> Thus, Sphinx could provide a user config setting to influence this
>> ``smartquotes_action``. But it does not so far.
>>
>> As far as I can tell Docutils has no user interface for its 0.14
>> `smartquotes_action`.
>> It is only customizable at developer level.
>
Side note: I will soon be offline. Please don't worry if I don't reply.
I wrote the above out of memory, if I now realize I am wrong I will
correct before leaving.
Jean-François