~ubuntu-branches/ubuntu/jaunty/python-docutils/jaunty

« back to all changes in this revision

Viewing changes to docutils/transforms/parts.py

  • Committer: Bazaar Package Importer
  • Author(s): Simon McVittie
  • Date: 2008-07-24 10:39:53 UTC
  • mfrom: (1.1.4 upstream) (3.1.7 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080724103953-8gh4uezg17g9ysgy
Tags: 0.5-2
* Upload docutils 0.5 to unstable
* Update rst.el to upstream Subversion r5596, which apparently fixes
  all its performance problems (17_speed_up_rst_el.dpatch, closes: #474941)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Authors: David Goodger, Ueli Schlaepfer, Dmitry Jemerov
2
 
# Contact: goodger@users.sourceforge.net
3
 
# Revision: $Revision: 3909 $
4
 
# Date: $Date: 2005-09-26 20:17:31 +0200 (Mon, 26 Sep 2005) $
 
1
# $Id: parts.py 4891 2007-01-22 08:35:57Z wiemann $
 
2
# Authors: David Goodger <goodger@python.org>; Ueli Schlaepfer; Dmitry Jemerov
5
3
# Copyright: This module has been placed in the public domain.
6
4
 
7
5
"""
103
101
 
104
102
    def build_contents(self, node, level=0):
105
103
        level += 1
106
 
        sections = []
107
 
        i = len(node) - 1
108
 
        while i >= 0 and isinstance(node[i], nodes.section):
109
 
            sections.append(node[i])
110
 
            i -= 1
111
 
        sections.reverse()
 
104
        sections = [sect for sect in node if isinstance(sect, nodes.section)]
112
105
        entries = []
113
106
        autonum = 0
114
107
        depth = self.startnode.details.get('depth', sys.maxint)