Skip to content

Commit

Permalink
Merge branch 'master' into doc-doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Nov 13, 2024
2 parents bf72d3e + d6da26a commit de20c86
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ dependencies = [
"alabaster>=0.7.14",
"imagesize>=1.3",
"requests>=2.30.0",
"roman-numerals-py>=1.0.0",
"packaging>=23.0",
"colorama>=0.4.6; sys_platform == 'win32'",
]
Expand Down
12 changes: 4 additions & 8 deletions sphinx/writers/latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from typing import TYPE_CHECKING, Any, ClassVar, cast

from docutils import nodes, writers
from roman_numerals import RomanNumeral

from sphinx import addnodes, highlighting
from sphinx.errors import SphinxError
Expand All @@ -24,12 +25,6 @@
from sphinx.util.template import LaTeXRenderer
from sphinx.util.texescape import tex_replace_map

try:
from docutils.utils.roman import toRoman
except ImportError:
# In Debian/Ubuntu, roman package is provided as roman, not as docutils.utils.roman
from roman import toRoman # type: ignore[no-redef, import-not-found]

if TYPE_CHECKING:
from docutils.nodes import Element, Node, Text

Expand Down Expand Up @@ -1421,8 +1416,9 @@ def get_nested_level(node: Element) -> int:
else:
return get_nested_level(node.parent)

enum = 'enum%s' % toRoman(get_nested_level(node)).lower()
enumnext = 'enum%s' % toRoman(get_nested_level(node) + 1).lower()
nested_level = get_nested_level(node)
enum = f'enum{RomanNumeral(nested_level).to_lowercase()}'
enumnext = f'enum{RomanNumeral(nested_level + 1).to_lowercase()}'
style = ENUMERATE_LIST_STYLE.get(get_enumtype(node))
prefix = node.get('prefix', '')
suffix = node.get('suffix', '.')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_util/test_util_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_format_date_timezone():
assert fd_gmt == '2016-08-07 05:11:17'
assert fd_gmt == iso_gmt

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

0 comments on commit de20c86

Please sign in to comment.