mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1772 (Prc to Mobi conversion)
This commit is contained in:
commit
f3f2d2a0a8
@ -138,7 +138,8 @@ class MobiMLizer(object):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def mobimlize_content(self, tag, text, bstate, istates):
|
def mobimlize_content(self, tag, text, bstate, istates):
|
||||||
bstate.content = True
|
if text or tag != 'br':
|
||||||
|
bstate.content = True
|
||||||
istate = istates[-1]
|
istate = istates[-1]
|
||||||
para = bstate.para
|
para = bstate.para
|
||||||
if tag in SPECIAL_TAGS and not text:
|
if tag in SPECIAL_TAGS and not text:
|
||||||
@ -188,11 +189,6 @@ class MobiMLizer(object):
|
|||||||
vspace -= 1
|
vspace -= 1
|
||||||
if istate.halign != 'auto':
|
if istate.halign != 'auto':
|
||||||
para.attrib['align'] = istate.halign
|
para.attrib['align'] = istate.halign
|
||||||
if istate.ids:
|
|
||||||
last = bstate.body[-1]
|
|
||||||
for id in istate.ids:
|
|
||||||
last.addprevious(etree.Element(XHTML('a'), attrib={'id': id}))
|
|
||||||
istate.ids.clear()
|
|
||||||
pstate = bstate.istate
|
pstate = bstate.istate
|
||||||
if tag in CONTENT_TAGS:
|
if tag in CONTENT_TAGS:
|
||||||
bstate.inline = para
|
bstate.inline = para
|
||||||
@ -200,6 +196,11 @@ class MobiMLizer(object):
|
|||||||
etree.SubElement(para, XHTML(tag), attrib=istate.attrib)
|
etree.SubElement(para, XHTML(tag), attrib=istate.attrib)
|
||||||
elif tag in TABLE_TAGS:
|
elif tag in TABLE_TAGS:
|
||||||
para.attrib['valign'] = 'top'
|
para.attrib['valign'] = 'top'
|
||||||
|
if istate.ids:
|
||||||
|
last = bstate.body[-1]
|
||||||
|
for id in istate.ids:
|
||||||
|
last.addprevious(etree.Element(XHTML('a'), attrib={'id': id}))
|
||||||
|
istate.ids.clear()
|
||||||
if not text:
|
if not text:
|
||||||
return
|
return
|
||||||
if not pstate or istate != pstate:
|
if not pstate or istate != pstate:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user