Commits

Georg Brandl committed b6bceed

Also fix invalid index entries for Latex output.

  • Participants
  • Parent commits 9974036

Comments (0)

Files changed (3)

File sphinx/latexwriter.py

                 self.body.append(r'\index{%s}' % scre.sub('!', self.encode(string)))
             elif type == 'pair':
                 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':
                 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:
                 self.builder.warn('unknown index entry type %s found' % type)
         raise nodes.SkipNode

File tests/root/markup.txt

    single: entry
    pair: entry; pair
    triple: index; entry; triple
+   keyword: with
+
+Invalid index markup...
+
+.. index::
+   single:
+   pair:
+   keyword:
 
 
 Ö... Some strange characters

File tests/test_build.py

 
 HTML_WARNINGS = ENV_WARNINGS + """\
 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 + """\
 WARNING: None:: no matching candidate for image URI u'foo.*'
+WARNING: invalid pair index entry u''
 """
 
 HTML_XPATH = {