mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
re-worked unsupported unicode chars Output profile option to use Unidecoder to do simple ascii conversion
This commit is contained in:
parent
217a1716fa
commit
2f04d0b17c
@ -426,7 +426,7 @@ class SonyReaderOutput(OutputProfile):
|
||||
dpi = 168.451
|
||||
fbase = 12
|
||||
fsizes = [7.5, 9, 10, 12, 15.5, 20, 22, 24]
|
||||
unsupported_unicode_chars = [[u'\u2018',u'‘'], [u'\u2019',u'’'], [u'\u201a',u'‘'], [u'\u201b',u'’'], [u'\u201c',u'“'], [u'\u201d',u'”'], [u'\u201e',u'“'], [u'\u201f',u'”']]
|
||||
unsupported_unicode_chars = [u'\u201f', u'\u201b']
|
||||
|
||||
|
||||
class KoboReaderOutput(OutputProfile):
|
||||
|
@ -520,8 +520,12 @@ class HTMLPreProcessor(object):
|
||||
html = self.smarten_punctuation(html)
|
||||
|
||||
unsupported_unicode_chars = self.extra_opts.output_profile.unsupported_unicode_chars
|
||||
for [char, replacement] in unsupported_unicode_chars:
|
||||
html = re.sub('%s' % char, replacement, html)
|
||||
if unsupported_unicode_chars != []:
|
||||
from calibre.ebooks.unidecode.unidecoder import Unidecoder
|
||||
unidecoder = Unidecoder()
|
||||
for char in unsupported_unicode_chars:
|
||||
asciichar = unidecoder.decode(char)
|
||||
html = re.sub('%s' % char, asciichar, html)
|
||||
|
||||
return html
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user