mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make formatting of series_index more robust
This commit is contained in:
parent
97386ccb9d
commit
cd64abe26c
@ -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…
x
Reference in New Issue
Block a user