From: <go...@us...> - 2005-04-07 19:51:57
|
Author: goodger Date: 2005-04-07 21:51:45 +0200 (Thu, 07 Apr 2005) New Revision: 3186 Modified: trunk/docutils/docutils/nodes.py trunk/docutils/docutils/parsers/rst/directives/parts.py trunk/docutils/docutils/transforms/universal.py Log: fixed bugs: don't access a node's children attribute directly\! Modified: trunk/docutils/docutils/nodes.py =================================================================== --- trunk/docutils/docutils/nodes.py 2005-04-07 19:37:12 UTC (rev 3185) +++ trunk/docutils/docutils/nodes.py 2005-04-07 19:51:45 UTC (rev 3186) @@ -1041,9 +1041,9 @@ self.decoration = decoration() index = self.first_child_not_matching_class(Titular) if index is None: - self.children.append(self.decoration) + self.append(self.decoration) else: - self.children.insert(index, self.decoration) + self.insert(index, self.decoration) return self.decoration @@ -1081,12 +1081,12 @@ def get_header(self): if not len(self.children) or not isinstance(self.children[0], header): - self.children.insert(0, header()) + self.insert(0, header()) return self.children[0] def get_footer(self): if not len(self.children) or not isinstance(self.children[-1], footer): - self.children.append(footer()) + self.append(footer()) return self.children[-1] Modified: trunk/docutils/docutils/parsers/rst/directives/parts.py =================================================================== --- trunk/docutils/docutils/parsers/rst/directives/parts.py 2005-04-07 19:37:12 UTC (rev 3185) +++ trunk/docutils/docutils/parsers/rst/directives/parts.py 2005-04-07 19:51:45 UTC (rev 3186) @@ -89,7 +89,7 @@ 'Content block expected for the "%s" directive; none found.' % name, nodes.literal_block(block_text, block_text), line=lineno) - node.children.append(nodes.paragraph( + node.append(nodes.paragraph( '', 'Problem with the "%s" directive: no content supplied.' % name)) return [warning] text = '\n'.join(content) Modified: trunk/docutils/docutils/transforms/universal.py =================================================================== --- trunk/docutils/docutils/transforms/universal.py 2005-04-07 19:37:12 UTC (rev 3185) +++ trunk/docutils/docutils/transforms/universal.py 2005-04-07 19:51:45 UTC (rev 3186) @@ -36,12 +36,12 @@ if header_nodes: decoration = self.document.get_decoration() header = decoration.get_header() - header.children.extend(header_nodes) + header.extend(header_nodes) footer_nodes = self.generate_footer() if footer_nodes: decoration = self.document.get_decoration() footer = decoration.get_footer() - footer.children.extend(footer_nodes) + footer.extend(footer_nodes) def generate_header(self): return None |