mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #7746 (Converting prc->epub: names of streets and lakes)
This commit is contained in:
parent
b9c9e0e29c
commit
fa0799597d
@ -504,6 +504,9 @@ class MobiReader(object):
|
|||||||
'x-large': '5',
|
'x-large': '5',
|
||||||
'xx-large': '6',
|
'xx-large': '6',
|
||||||
}
|
}
|
||||||
|
def barename(x):
|
||||||
|
return x.rpartition(':')[-1]
|
||||||
|
|
||||||
mobi_version = self.book_header.mobi_version
|
mobi_version = self.book_header.mobi_version
|
||||||
for x in root.xpath('//ncx'):
|
for x in root.xpath('//ncx'):
|
||||||
x.getparent().remove(x)
|
x.getparent().remove(x)
|
||||||
@ -512,8 +515,9 @@ class MobiReader(object):
|
|||||||
for x in tag.attrib:
|
for x in tag.attrib:
|
||||||
if ':' in x:
|
if ':' in x:
|
||||||
del tag.attrib[x]
|
del tag.attrib[x]
|
||||||
if tag.tag in ('country-region', 'place', 'placetype', 'placename',
|
if tag.tag and barename(tag.tag.lower()) in \
|
||||||
'state', 'city', 'street', 'address', 'content', 'form'):
|
('country-region', 'place', 'placetype', 'placename',
|
||||||
|
'state', 'city', 'street', 'address', 'content', 'form'):
|
||||||
tag.tag = 'div' if tag.tag in ('content', 'form') else 'span'
|
tag.tag = 'div' if tag.tag in ('content', 'form') else 'span'
|
||||||
for key in tag.attrib.keys():
|
for key in tag.attrib.keys():
|
||||||
tag.attrib.pop(key)
|
tag.attrib.pop(key)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user