diff --git a/CHANGES b/CHANGES index 298a761c4..f0d2c1811 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ Release 1.2 (in development) ============================ +* #1108: The text writer now correctly numbers enumerated lists with + non-default start values (based on patch by Ewan Edwards). + * #1074: Add environment version info to the generated search index to avoid compatibility issues with old builds. diff --git a/sphinx/writers/text.py b/sphinx/writers/text.py index 1f90497e7..9df974079 100644 --- a/sphinx/writers/text.py +++ b/sphinx/writers/text.py @@ -550,7 +550,7 @@ class TextTranslator(nodes.NodeVisitor): self.list_counter.pop() def visit_enumerated_list(self, node): - self.list_counter.append(0) + self.list_counter.append(node.get('start', 1) - 1) def depart_enumerated_list(self, node): self.list_counter.pop() diff --git a/tests/root/contents.txt b/tests/root/contents.txt index de60ec6dd..7486750d6 100644 --- a/tests/root/contents.txt +++ b/tests/root/contents.txt @@ -28,6 +28,7 @@ Contents: extensions versioning/index footnote + lists Python diff --git a/tests/root/lists.txt b/tests/root/lists.txt new file mode 100644 index 000000000..99a55dc39 --- /dev/null +++ b/tests/root/lists.txt @@ -0,0 +1,54 @@ +Various kinds of lists +====================== + + +nested enumerated lists +----------------------- + +#. one + +#. two + + #. two.1 + #. two.2 + +#. three + + +enumerated lists with non-default start values +---------------------------------------------- + +0. zero +#. one + +---------------------------------------- + +1. one +#. two + +---------------------------------------- + +2. two +#. three + + +enumerated lists using letters +------------------------------ + +a. a + +b. b + +#. c + +#. d + +---------------------------------------- + +x. x + +y. y + +#. z + +#. {