MOBI Input: Strip geographic tags from converted MOBI markup as ADE doesn't handle them gracefully.

This commit is contained in:
Kovid Goyal 2009-01-18 10:04:26 -08:00
commit f16fe3e8e6
2 changed files with 7 additions and 1 deletions

View File

@ -11,7 +11,7 @@ def devices():
from calibre.devices.prs700.driver import PRS700
from calibre.devices.cybookg3.driver import CYBOOKG3
from calibre.devices.kindle.driver import KINDLE
return (PRS500, PRS505, PRS700, CYBOOKG3)
return (PRS500, PRS505, PRS700, CYBOOKG3, KINDLE)
import time

View File

@ -267,6 +267,12 @@ class MobiReader(object):
'xx-large' : '6',
}
for tag in root.iter(etree.Element):
if tag.tag in ('country-region', 'place', 'placetype', 'placename',
'state', 'city'):
tag.tag = 'span'
for key in tag.attrib.keys():
tag.attrib.pop(key)
continue
styles, attrib = [], tag.attrib
if attrib.has_key('style'):
style = attrib.pop('style').strip()