From 6888ad9173b69e34243da0195b00d80991ee7584 Mon Sep 17 00:00:00 2001 From: blais Date: Tue, 14 Oct 2008 14:48:04 +0000 Subject: [PATCH] rst-fields: Fixed minor bug with enclosing sections. git-svn-id: https://docutils.svn.sourceforge.net/svnroot/docutils/trunk@5672 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- sandbox/blais/rst-fields/rst-fields | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sandbox/blais/rst-fields/rst-fields b/sandbox/blais/rst-fields/rst-fields index fc05fb636..ee713815a 100755 --- a/sandbox/blais/rst-fields/rst-fields +++ b/sandbox/blais/rst-fields/rst-fields @@ -199,12 +199,15 @@ class FindData(nodes.SparseNodeVisitor): if opts.enclosing_section: assert 'section' not in fields, fields + section = '' node_sec = find_enclosing_section(node) - i = node_sec.first_child_matching_class(nodes.title) - title = node_sec.children[i] - if title is not None: - fields.append( ('section', title.astext()) ) - + if node_sec is not None: + i = node_sec.first_child_matching_class(nodes.title) + title = node_sec.children[i] + if title is not None: + section = title.astext() + fields.append( ('section', section) ) + source, line = utils.get_source_line(node) e = Entry(self.docid, table, fields, '%s:%s' % (abspath(self.filename), line)) -- 2.11.4.GIT