diff options
author | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2007-01-22 08:35:57 +0000 |
---|---|---|
committer | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2007-01-22 08:35:57 +0000 |
commit | fb437f2ed3b39f7a0ff98767fc28140f2accee8b (patch) | |
tree | 57183bd7c5e77f532bc4193ce9a170bcf0910227 | |
parent | 6a692ae5fdb14cd90f076a1fc01e5fbc2168f7ba (diff) | |
download | docutils-fb437f2ed3b39f7a0ff98767fc28140f2accee8b.tar.gz |
cleaned up build_contents code (not worth a test case or history entry though because it occurs for corner cases involving empty section titles)
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4891 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r-- | docutils/transforms/parts.py | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/docutils/transforms/parts.py b/docutils/transforms/parts.py index 2ed919993..39cb74f75 100644 --- a/docutils/transforms/parts.py +++ b/docutils/transforms/parts.py @@ -101,12 +101,7 @@ class Contents(Transform): def build_contents(self, node, level=0): level += 1 - sections = [] - i = len(node) - 1 - while i >= 0 and isinstance(node[i], nodes.section): - sections.append(node[i]) - i -= 1 - sections.reverse() + sections = [sect for sect in node if isinstance(sect, nodes.section)] entries = [] autonum = 0 depth = self.startnode.details.get('depth', sys.maxint) |