docutils.utils.punctuation_chars module
Docutils character category patterns.
Patterns for the implementation of the inline markup recognition rules
in the reStructuredText parser docutils.parsers.rst.states.py based
on Unicode character categories.
The patterns are used inside [ ] in regular expressions.
Rule (5) requires determination of matching open/close pairs. However, the
pairing of open/close quotes is ambiguous due to different typographic
conventions in different languages. The quote_pairs function tests
whether two characters form an open/close pair.
The patterns are generated by
docutils/tools/dev/generate_punctuation_chars.py to prevent dependence
on the Python version and avoid the time-consuming generation with every
Docutils run. See there for motives and implementation details.
The category of some characters changed with the development of the Unicode standard. The current lists are generated with the help of the “unicodedata” module of Python 2.7.13 (based on Unicode version 5.2.0).
- quote_pairs = {'»': '»', '‘': '‚', '’': '’', '‚': '‘’', '“': '„', '”': '”', '„': '“”', '›': '›'}
Additional open/close quote pairs.