Skip to content

Commit de20c86

Browse files
committed
Merge branch 'master' into doc-doctest
2 parents bf72d3e + d6da26a commit de20c86

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ dependencies = [
7070
"alabaster>=0.7.14",
7171
"imagesize>=1.3",
7272
"requests>=2.30.0",
73+
"roman-numerals-py>=1.0.0",
7374
"packaging>=23.0",
7475
"colorama>=0.4.6; sys_platform == 'win32'",
7576
]

sphinx/writers/latex.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from typing import TYPE_CHECKING, Any, ClassVar, cast
1414

1515
from docutils import nodes, writers
16+
from roman_numerals import RomanNumeral
1617

1718
from sphinx import addnodes, highlighting
1819
from sphinx.errors import SphinxError
@@ -24,12 +25,6 @@
2425
from sphinx.util.template import LaTeXRenderer
2526
from sphinx.util.texescape import tex_replace_map
2627

27-
try:
28-
from docutils.utils.roman import toRoman
29-
except ImportError:
30-
# In Debian/Ubuntu, roman package is provided as roman, not as docutils.utils.roman
31-
from roman import toRoman # type: ignore[no-redef, import-not-found]
32-
3328
if TYPE_CHECKING:
3429
from docutils.nodes import Element, Node, Text
3530

@@ -1421,8 +1416,9 @@ def get_nested_level(node: Element) -> int:
14211416
else:
14221417
return get_nested_level(node.parent)
14231418

1424-
enum = 'enum%s' % toRoman(get_nested_level(node)).lower()
1425-
enumnext = 'enum%s' % toRoman(get_nested_level(node) + 1).lower()
1419+
nested_level = get_nested_level(node)
1420+
enum = f'enum{RomanNumeral(nested_level).to_lowercase()}'
1421+
enumnext = f'enum{RomanNumeral(nested_level + 1).to_lowercase()}'
14261422
style = ENUMERATE_LIST_STYLE.get(get_enumtype(node))
14271423
prefix = node.get('prefix', '')
14281424
suffix = node.get('suffix', '.')

tests/test_util/test_util_i18n.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_format_date_timezone():
108108
assert fd_gmt == '2016-08-07 05:11:17'
109109
assert fd_gmt == iso_gmt
110110

111-
iso_local = dt.astimezone().isoformat(' ').split('+')[0]
111+
iso_local = dt.astimezone().isoformat(' ')[:19] # strip the timezone
112112
fd_local = i18n.format_date(fmt, date=dt, language='en', local_time=True)
113113
assert fd_local == iso_local
114114
assert fd_local != fd_gmt

0 commit comments

Comments
 (0)