mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix latex: deeply nested enumerated list which is beginning with non-1 causes LaTeX engine crashed
This commit is contained in:
parent
981e044bd5
commit
c6050a3d1e
2
CHANGES
2
CHANGES
@ -23,6 +23,8 @@ Bugs fixed
|
|||||||
topic, admonition, table and section.
|
topic, admonition, table and section.
|
||||||
* #4913: i18n: literal blocks in bullet list are not translated
|
* #4913: i18n: literal blocks in bullet list are not translated
|
||||||
* #4962: cpp domain: raises TypeError on duplicate declaration
|
* #4962: cpp domain: raises TypeError on duplicate declaration
|
||||||
|
* latex: deeply nested enumerated list which is beginning with non-1 causes
|
||||||
|
LaTeX engine crashed
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -18,6 +18,7 @@ from collections import defaultdict
|
|||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
from docutils import nodes, writers
|
from docutils import nodes, writers
|
||||||
|
from docutils.utils.roman import toRoman
|
||||||
from docutils.writers.latex2e import Babel
|
from docutils.writers.latex2e import Babel
|
||||||
from six import itervalues, text_type
|
from six import itervalues, text_type
|
||||||
|
|
||||||
@ -1514,8 +1515,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
|
|
||||||
self.body.append('\\begin{enumerate}\n')
|
self.body.append('\\begin{enumerate}\n')
|
||||||
if 'start' in node:
|
if 'start' in node:
|
||||||
nested = get_nested_level(node)
|
enum_depth = "enum%s" % toRoman(get_nested_level(node)).lower()
|
||||||
self.body.append('\\setcounter{enum%s}{%d}\n' % ('i' * nested, node['start'] - 1))
|
self.body.append('\\setcounter{%s}{%d}\n' % (enum_depth, node['start'] - 1))
|
||||||
if self.table:
|
if self.table:
|
||||||
self.table.has_problematic = True
|
self.table.has_problematic = True
|
||||||
|
|
||||||
|
@ -9,6 +9,12 @@ nested-enumerated-list
|
|||||||
10) Pyramid
|
10) Pyramid
|
||||||
11) Nile River
|
11) Nile River
|
||||||
|
|
||||||
|
(x) Atbara
|
||||||
|
(y) Blue Nile
|
||||||
|
(#) Sobat
|
||||||
|
(#) Semliki
|
||||||
|
(#) Kagera
|
||||||
|
|
||||||
6. Markup
|
6. Markup
|
||||||
|
|
||||||
iii. reStructuredText
|
iii. reStructuredText
|
||||||
|
@ -1239,4 +1239,5 @@ def test_latex_nested_enumerated_list(app, status, warning):
|
|||||||
assert r'\setcounter{enumi}{4}' in result
|
assert r'\setcounter{enumi}{4}' in result
|
||||||
assert r'\setcounter{enumii}{3}' in result
|
assert r'\setcounter{enumii}{3}' in result
|
||||||
assert r'\setcounter{enumiii}{9}' in result
|
assert r'\setcounter{enumiii}{9}' in result
|
||||||
|
assert r'\setcounter{enumiv}{23}' in result
|
||||||
assert r'\setcounter{enumii}{2}' in result
|
assert r'\setcounter{enumii}{2}' in result
|
||||||
|
Loading…
Reference in New Issue
Block a user