mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
91cc3ab2a3
commit
35fa14eab3
@ -555,7 +555,13 @@ class MobiMLizer(object):
|
|||||||
# be added.
|
# be added.
|
||||||
istate.ids and tag in ('a', 'span', 'i', 'b', 'u') and
|
istate.ids and tag in ('a', 'span', 'i', 'b', 'u') and
|
||||||
len(elem)==0)):
|
len(elem)==0)):
|
||||||
self.mobimlize_content(tag, text, bstate, istates)
|
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:
|
for child in elem:
|
||||||
self.mobimlize_elem(child, stylizer, bstate, istates)
|
self.mobimlize_elem(child, stylizer, bstate, istates)
|
||||||
tail = None
|
tail = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user