From: <st...@us...> - 2008-07-17 06:51:59
|
Author: strank Date: 2008-07-17 08:51:45 +0200 (Thu, 17 Jul 2008) New Revision: 5600 Modified: branches/adjacent-citations/docutils/writers/latex2e/__init__.py Log: Use traverse instead of next_node to avoid Text index problem. Modified: branches/adjacent-citations/docutils/writers/latex2e/__init__.py =================================================================== --- branches/adjacent-citations/docutils/writers/latex2e/__init__.py 2008-07-17 06:13:34 UTC (rev 5599) +++ branches/adjacent-citations/docutils/writers/latex2e/__init__.py 2008-07-17 06:51:45 UTC (rev 5600) @@ -1080,14 +1080,15 @@ if self._use_latex_citations: followup_citation = False # check for a following citation separated by a space or newline - next_sibling = node.next_node(descend=0, siblings=1) - if (isinstance(next_sibling, nodes.Text) - and next_sibling.astext() in (' ', '\n')): - nenext_sibling = next_sibling.next_node(descend=0, siblings=1) - if nenext_sibling.__class__ == node.__class__: - followup_citation = True - # remove the space/newline: - next_sibling.data = '' + next_siblings = node.traverse(descend=0, siblings=1, include_self=0) + if len(next_siblings) > 1: + next = next_siblings[0] + if (isinstance(next, nodes.Text) + and next.astext() in (' ', '\n')): + if next_siblings[1].__class__ == node.__class__: + followup_citation = True + # remove the space/newline: + next.data = '' if followup_citation: self.body.append(',') else: |