This is extracted (with minor adaptations for flake8 compliance) from docutils’ docutils/utils/smartquotes.py as of revision 8097 (30 May 2017), in order to backport for Sphinx usage with Docutils < 0.14 extra language configurations and fixes. Replaces earlier smartypants version as used up to Sphinx 1.5.6.
See the LICENSE file and the original docutils code for details.
Unknown Field: copyright | |
© 2010 Günter Milde, original SmartyPants: © 2003 John Gruber smartypants.py: © 2004, 2007 Chad Miller | |
Unknown Field: license | |
Released under the terms of the 2-Clause BSD license, in short: Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notices and this notice are preserved. This file is offered as-is, without any warranty. |
Variable | langquotes |
Undocumented |
Function | educate_tokens |
Return iterator that "educates" the items of text_tokens . |
Function | educateQuotes |
Parameter: - text string (unicode or bytes). - language (BCP 47 language tag.) Returns: The text , with "educated" curly quote characters. |
Return iterator that "educates" the items of text_tokens
.
This is modified to intercept the attr='2' as it was used by the Docutils 0.13.1 SmartQuotes transform in a hard coded way. Docutils 0.14 uses 'qDe'` and is configurable, and its choice is backported here for use by Sphinx with earlier Docutils releases. Similarly '1' is replaced by 'qde'.
Use attr='qDbe', resp. 'qdbe' to recover Docutils effect of '2', resp. '1'.
refs: https://sourceforge.net/p/docutils/mailman/message/35869025/
Parameters | |
text_tokens:Iterable[ | Undocumented |
attr:str | Undocumented |
language:str | Undocumented |
Returns | |
Generator[ | Undocumented |
BCP 47
language tag.)Returns: The text
, with "educated" curly quote characters.
Example input: "Isn't this fun?" Example output: “Isn’t this fun?“;
Parameters | |
text:str | Undocumented |
language:str | Undocumented |
Returns | |
str | Undocumented |