MOBI Output: Handle the value attribute on <li> tags. Fixes #1273559 [TOC numbers correct, Chapter numbers always 1](https://bugs.launchpad.net/calibre/+bug/1273559)

This commit is contained in:
Kovid Goyal 2014-01-28 12:50:34 +05:30
parent 91cc3ab2a3
commit 35fa14eab3

View File

@ -555,6 +555,12 @@ class MobiMLizer(object):
# be added.
istate.ids and tag in ('a', 'span', 'i', 'b', 'u') and
len(elem)==0)):
if tag == 'li' and len(istates) > 1 and 'value' in elem.attrib:
try:
value = int(elem.attrib['value'])
istates[-2].list_num = value - 1
except:
pass
self.mobimlize_content(tag, text, bstate, istates)
for child in elem:
self.mobimlize_elem(child, stylizer, bstate, istates)