mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Conversion: Replace all non-ascii characters in CSS class anmes, as they cause problems with some broken EPUB renderers. Fixes #1102587 (ODT-EPUB conversion generates invalid CSS)
This commit is contained in:
parent
c64783797e
commit
b79fdfe65a
@ -18,7 +18,7 @@ from calibre import guess_type
|
||||
from calibre.ebooks.oeb.base import (XHTML, XHTML_NS, CSS_MIME, OEB_STYLES,
|
||||
namespace, barename, XPath)
|
||||
from calibre.ebooks.oeb.stylizer import Stylizer
|
||||
from calibre.utils.filenames import ascii_filename
|
||||
from calibre.utils.filenames import ascii_filename, ascii_text
|
||||
|
||||
COLLAPSE = re.compile(r'[ \t\r\n\v]+')
|
||||
STRIPNUM = re.compile(r'[-0-9]+$')
|
||||
@ -437,7 +437,7 @@ class CSSFlattener(object):
|
||||
items.sort()
|
||||
css = u';\n'.join(u'%s: %s' % (key, val) for key, val in items)
|
||||
classes = node.get('class', '').strip() or 'calibre'
|
||||
klass = STRIPNUM.sub('', classes.split()[0].replace('_', ''))
|
||||
klass = ascii_text(STRIPNUM.sub('', classes.split()[0].replace('_', '')))
|
||||
if css in styles:
|
||||
match = styles[css]
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user