Skip to content

Commit 220e71a

Browse files
committed
Replace the monkey patch to disable roman lists with an exception
We don't have a single clean method to disable roman lists across docutils versions, but we can blow up the bulid cleanly...
1 parent 799e7bb commit 220e71a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Doc/tools/extensions/pyspecific.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@
2424
# Used in conf.py and updated here by python/release-tools/run_release.py
2525
SOURCE_URI = 'https://github.com/python/cpython/tree/main/%s'
2626

27-
# monkey-patch reST parser to disable alphabetic and roman enumerated lists
27+
# monkey-patch reST parser to detect any alphabetic and roman enumerated lists
28+
# that need escaping. Sadly we don't get a location to point to.
2829
from docutils.parsers.rst.states import Body
30+
def disabled_converter(x):
31+
raise Exception("Detected an alphabetic or Roman enumerated list. "
32+
"It needs to be escaped.")
33+
2934
Body.enum.converters['loweralpha'] = \
3035
Body.enum.converters['upperalpha'] = \
3136
Body.enum.converters['lowerroman'] = \
32-
Body.enum.converters['upperroman'] = lambda x: None
37+
Body.enum.converters['upperroman'] = disabled_converter
3338

3439

3540
class PyAwaitableMixin(object):

0 commit comments

Comments
 (0)