Merge bugfix from 0.5.

This commit is contained in:
Georg Brandl 2008-11-30 21:09:28 +01:00
commit 4634b296af
3 changed files with 20 additions and 2 deletions

View File

@ -892,10 +892,16 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.body.append(r'\index{%s}' % scre.sub('!', self.encode(string))) self.body.append(r'\index{%s}' % scre.sub('!', self.encode(string)))
elif type == 'pair': elif type == 'pair':
parts = tuple(self.encode(x.strip()) for x in string.split(';', 1)) parts = tuple(self.encode(x.strip()) for x in string.split(';', 1))
self.body.append(r'\indexii{%s}{%s}' % parts) try:
self.body.append(r'\indexii{%s}{%s}' % parts)
except TypeError:
self.builder.warn('invalid pair index entry %r' % string)
elif type == 'triple': elif type == 'triple':
parts = tuple(self.encode(x.strip()) for x in string.split(';', 2)) parts = tuple(self.encode(x.strip()) for x in string.split(';', 2))
self.body.append(r'\indexiii{%s}{%s}{%s}' % parts) try:
self.body.append(r'\indexiii{%s}{%s}{%s}' % parts)
except TypeError:
self.builder.warn('invalid triple index entry %r' % string)
else: else:
self.builder.warn('unknown index entry type %s found' % type) self.builder.warn('unknown index entry type %s found' % type)
raise nodes.SkipNode raise nodes.SkipNode

View File

@ -148,6 +148,14 @@ Index markup
single: entry single: entry
pair: entry; pair pair: entry; pair
triple: index; entry; triple triple: index; entry; triple
keyword: with
Invalid index markup...
.. index::
single:
pair:
keyword:
Ö... Some strange characters Ö... Some strange characters

View File

@ -35,10 +35,14 @@ file u'wrongenc.inc' seems to be wrong, try giving an :encoding: option
HTML_WARNINGS = ENV_WARNINGS + """\ HTML_WARNINGS = ENV_WARNINGS + """\
WARNING: %(root)s/images.txt:: no matching candidate for image URI u'foo.*' WARNING: %(root)s/images.txt:: no matching candidate for image URI u'foo.*'
WARNING: %(root)s/markup.txt:: invalid index entry u''
WARNING: %(root)s/markup.txt:: invalid pair index entry u''
WARNING: %(root)s/markup.txt:: invalid pair index entry u'keyword; '
""" """
LATEX_WARNINGS = ENV_WARNINGS + """\ LATEX_WARNINGS = ENV_WARNINGS + """\
WARNING: None:: no matching candidate for image URI u'foo.*' WARNING: None:: no matching candidate for image URI u'foo.*'
WARNING: invalid pair index entry u''
""" """
HTML_XPATH = { HTML_XPATH = {