File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55from docutils import __version_info__ as docutils_version_info
66
7- # docutils 0.22+ serializes boolean attributes as "1"/"0" instead of "True"/"False"
87DOCUTILS_0_22_PLUS = docutils_version_info >= (0 , 22 )
98
109
1110def normalize_doctree_xml (text : str ) -> str :
1211 """Normalize docutils XML output for cross-version compatibility.
1312
1413 In docutils 0.22+, boolean attributes are serialized as "1"/"0"
15- instead of "True"/"False". This function normalizes to the new format
14+ instead of "True"/"False". This function normalizes to the old format
1615 for consistent test fixtures.
1716 """
1817 if DOCUTILS_0_22_PLUS :
19- # Normalize new format (True/False ) to old format (1/0)
18+ # Normalize new format (1/0 ) to old format (1/0)
2019 # Only replace when it's clearly a boolean attribute value
21- # Pattern: attribute="True " or attribute="False "
20+ # Pattern: attribute="1 " or attribute="0 "
2221 attrs = [
2322 "force" ,
2423 "glob" ,
You can’t perform that action at this time.
0 commit comments