mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 00:43:37 +02:00
EPUB Output: Replace all whitespace in TOC items with spaces, as desktop ADE does not support non space characters.
This commit is contained in:
parent
34b238a3a3
commit
20468383df
2 changed files with 9 additions and 3 deletions
|
|
@ -1543,7 +1543,10 @@ def to_ncx(self, parent=None):
|
|||
attrib['class'] = node.klass
|
||||
point = element(parent, NCX('navPoint'), attrib=attrib)
|
||||
label = etree.SubElement(point, NCX('navLabel'))
|
||||
element(label, NCX('text')).text = node.title
|
||||
title = node.title
|
||||
if title:
|
||||
title = re.sub(r'\s', ' ', title)
|
||||
element(label, NCX('text')).text = title
|
||||
element(point, NCX('content'), src=urlunquote(node.href))
|
||||
node.to_ncx(point)
|
||||
return parent
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from __future__ import with_statement
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
import traceback, os, sys, functools, collections
|
||||
import traceback, os, sys, functools, collections, re
|
||||
from functools import partial
|
||||
from threading import Thread
|
||||
|
||||
|
|
@ -28,7 +28,10 @@
|
|||
class TOCItem(QStandardItem):
|
||||
|
||||
def __init__(self, toc):
|
||||
QStandardItem.__init__(self, toc.text if toc.text else '')
|
||||
text = toc.text
|
||||
if text:
|
||||
text = re.sub(r'\s', ' ', text)
|
||||
QStandardItem.__init__(self, text if text else '')
|
||||
self.abspath = toc.abspath
|
||||
self.fragment = toc.fragment
|
||||
for t in toc:
|
||||
|
|
|
|||
Loading…
Reference in a new issue