mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-01 08:35:36 +01:00
Make formatting of series_index more robust
This commit is contained in:
parent
97386ccb9d
commit
cd64abe26c
1 changed files with 5 additions and 6 deletions
|
|
@ -63,14 +63,13 @@ def roman(num):
|
|||
def fmt_sidx(i, fmt='%.2f', use_roman=False):
|
||||
if i is None or i == '':
|
||||
i = 1
|
||||
i = float(i)
|
||||
try:
|
||||
i = float(i)
|
||||
except TypeError:
|
||||
return str(i)
|
||||
if int(i) == float(i):
|
||||
return roman(int(i)) if use_roman else '%d'%int(i)
|
||||
try:
|
||||
return fmt%i
|
||||
except TypeError:
|
||||
return fmt%float(i)
|
||||
|
||||
return fmt%i
|
||||
|
||||
class Resource(object):
|
||||
'''
|
||||
|
|
|
|||
Loading…
Reference in a new issue