module documentation

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 educate​Quotes Parameter: - text string (unicode or bytes). - language (BCP 47 language tag.) Returns: The text, with "educated" curly quote characters.
langquotes: dict =

Undocumented

def educate_tokens(text_tokens, attr=smartquotes.default_smartypants_attr, language='en'):

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[Tuple[str, str]]Undocumented
attr:strUndocumented
language:strUndocumented
Returns
Generator[str, None, None]Undocumented
def educateQuotes(text, language='en'):
Parameter: - text string (unicode or bytes).
  • language (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:strUndocumented
language:strUndocumented
Returns
strUndocumented