EPUB Output: Close self closing <span> tags explicitly as they cause problems in browser based renderers like the calibre ebook viewer. Fix #3152 (MOBI Error)

This commit is contained in:
Kovid Goyal 2009-08-14 13:55:33 -06:00
parent 207a9728c0
commit a8f065d38f
4 changed files with 20 additions and 5 deletions

View File

@ -88,7 +88,8 @@ def sanitize_file_name(name, substitute='_', as_unicode=False):
one = re.sub(r'^\.+$', '_', one) one = re.sub(r'^\.+$', '_', one)
if as_unicode: if as_unicode:
one = one.decode(filesystem_encoding) one = one.decode(filesystem_encoding)
return one.replace('..', '_') one = one.replace('..', substitute)
return one
def prints(*args, **kwargs): def prints(*args, **kwargs):

View File

@ -1016,7 +1016,7 @@ class Manifest(object):
if isinstance(data, etree._Element): if isinstance(data, etree._Element):
ans = xml2str(data, pretty_print=self.oeb.pretty_print) ans = xml2str(data, pretty_print=self.oeb.pretty_print)
if self.media_type in OEB_DOCS: if self.media_type in OEB_DOCS:
ans = re.sub(r'<(div|a)([^>]*)/>', r'<\1\2></\1>', ans) ans = re.sub(r'<(div|a|span)([^>]*)/>', r'<\1\2></\1>', ans)
return ans return ans
if isinstance(data, unicode): if isinstance(data, unicode):
return data.encode('utf-8') return data.encode('utf-8')

View File

@ -103,6 +103,15 @@ First install the Stanza reader on your iPhone from http://www.lexcycle.com . Th
Now you should be able to access your books on your iPhone. Now you should be able to access your books on your iPhone.
Why is my device not detected in linux?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|app| uses something called SYSFS to detect devices in linux. The linux kernel can export two version of SYSFS, one of which is deprecated. Some linux distributions still ship with kernels that support the deprecated version of SYSFS, even though it was deprecated a long time ago. In this case, device detection in |app| will not work. You can check what version of SYSFS is exported by your kernel with the following command::
grep SYSFS_DEPRECATED /boot/config-`uname -r`
You should see something like ``CONFIG_SYSFS_DEPRECATED_V2 is not set``.
Library Management Library Management
------------------ ------------------

View File

@ -22,9 +22,14 @@ def ascii_text(orig):
return ascii return ascii
def ascii_filename(orig): def ascii_filename(orig, substitute='_'):
return sanitize_file_name(ascii_text(orig).replace('?', '_')) ans = []
orig = ascii_text(orig).replace('?', '_')
for x in orig:
if ord(x) < 32:
x = substitute
ans.append(x)
return sanitize_file_name(''.join(ans), substitute=substitute)
def supports_long_names(path): def supports_long_names(path):
t = ('a'*300)+'.txt' t = ('a'*300)+'.txt'