mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -1543,7 +1543,10 @@ class TOC(object):
|
|||||||
attrib['class'] = node.klass
|
attrib['class'] = node.klass
|
||||||
point = element(parent, NCX('navPoint'), attrib=attrib)
|
point = element(parent, NCX('navPoint'), attrib=attrib)
|
||||||
label = etree.SubElement(point, NCX('navLabel'))
|
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))
|
element(point, NCX('content'), src=urlunquote(node.href))
|
||||||
node.to_ncx(point)
|
node.to_ncx(point)
|
||||||
return parent
|
return parent
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
__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 functools import partial
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
@ -28,7 +28,10 @@ from calibre.customize.ui import available_input_formats
|
|||||||
class TOCItem(QStandardItem):
|
class TOCItem(QStandardItem):
|
||||||
|
|
||||||
def __init__(self, toc):
|
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.abspath = toc.abspath
|
||||||
self.fragment = toc.fragment
|
self.fragment = toc.fragment
|
||||||
for t in toc:
|
for t in toc:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user