Browse Source

Pas de support de Python<2.6. #13

pull/20/head
Louis 11 years ago
parent
commit
9750b49c74
  1. 11
      songbook_core/index.py

11
songbook_core/index.py

@ -163,23 +163,14 @@ class Index(object):
@staticmethod @staticmethod
def ref_to_str(ref): def ref_to_str(ref):
"""Return the LaTeX code corresponding to the reference.""" """Return the LaTeX code corresponding to the reference."""
if sys.version_info >= (2, 6): return r'\hyperlink{{{0[link]}}}{{{0[num]}}}'.format(ref)
return r'\hyperlink{{{0[link]}}}{{{0[num]}}}'.format(ref)
else:
return r'\hyperlink{%(link)s}{%(num)s}' % ref
def entry_to_str(self, key, entry): def entry_to_str(self, key, entry):
"""Return the LaTeX code corresponding to the entry.""" """Return the LaTeX code corresponding to the entry."""
if sys.version_info >= (2, 6):
return unicode(r'\idxentry{{{0}}}{{{1}}}' + EOL).format( return unicode(r'\idxentry{{{0}}}{{{1}}}' + EOL).format(
key, key,
r'\\'.join([self.ref_to_str(ref) for ref in entry]), r'\\'.join([self.ref_to_str(ref) for ref in entry]),
) )
else:
return unicode(r'\idxentry{%s}{%s}' + EOL) % (
key,
r'\\'.join([self.ref_to_str(ref) for ref in entry]),
)
def idxblock_to_str(self, letter, entries): def idxblock_to_str(self, letter, entries):
"""Return the LaTeX code corresponding to an index block. """Return the LaTeX code corresponding to an index block.

Loading…
Cancel
Save