mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
MOBI Output: Fix use of list elements as link anchors caused links to always point to start of list. Fixes #879391 (Private bug)
This commit is contained in:
parent
7da3cb2c70
commit
7706ffe6aa
@ -138,6 +138,7 @@ class MobiMLizer(object):
|
|||||||
self.mobimlize_elem(body, stylizer, BlockState(nbody),
|
self.mobimlize_elem(body, stylizer, BlockState(nbody),
|
||||||
[FormatState()])
|
[FormatState()])
|
||||||
item.data = nroot
|
item.data = nroot
|
||||||
|
#print etree.tostring(nroot)
|
||||||
|
|
||||||
def mobimlize_font(self, ptsize):
|
def mobimlize_font(self, ptsize):
|
||||||
return self.fnums[self.fmap[ptsize]]
|
return self.fnums[self.fmap[ptsize]]
|
||||||
@ -233,9 +234,19 @@ class MobiMLizer(object):
|
|||||||
elif tag in TABLE_TAGS:
|
elif tag in TABLE_TAGS:
|
||||||
para.attrib['valign'] = 'top'
|
para.attrib['valign'] = 'top'
|
||||||
if istate.ids:
|
if istate.ids:
|
||||||
last = bstate.body[-1]
|
for id_ in istate.ids:
|
||||||
for id in istate.ids:
|
anchor = etree.Element(XHTML('a'), attrib={'id': id_})
|
||||||
last.addprevious(etree.Element(XHTML('a'), attrib={'id': id}))
|
if tag == 'li':
|
||||||
|
try:
|
||||||
|
last = bstate.body[-1][-1]
|
||||||
|
except:
|
||||||
|
break
|
||||||
|
last.insert(0, anchor)
|
||||||
|
anchor.tail = last.text
|
||||||
|
last.text = None
|
||||||
|
else:
|
||||||
|
last = bstate.body[-1]
|
||||||
|
last.addprevious(anchor)
|
||||||
istate.ids.clear()
|
istate.ids.clear()
|
||||||
if not text:
|
if not text:
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user