Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Doc/tools/extensions/pyspecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,21 @@
SOURCE_URI = 'https://github.com/python/cpython/tree/main/%s'

# monkey-patch reST parser to disable alphabetic and roman enumerated lists
def _disable_alphabetic_and_roman(text):
try:
# docutils >= 0.22
from docutils.parsers.rst.states import InvalidRomanNumeralError
raise InvalidRomanNumeralError(text)
except ImportError:
# docutils < 0.22
return None


from docutils.parsers.rst.states import Body
Body.enum.converters['loweralpha'] = \
Body.enum.converters['upperalpha'] = \
Body.enum.converters['lowerroman'] = \
Body.enum.converters['upperroman'] = lambda x: None
Body.enum.converters['upperroman'] = _disable_alphabetic_and_roman


class PyAwaitableMixin(object):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support docutils >= 0.22 for documentation generation.
Loading