mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 05:08:55 +02:00
EPUB Output:Replace newlines and all other whitespace in TOC with simple spaces, as Adobe DE cant handle non space whitespace characters in the TOC.
This commit is contained in:
parent
de77871333
commit
d1ca54da77
1 changed files with 3 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?python
|
||||
from uuid import uuid4
|
||||
import re
|
||||
?>
|
||||
<ncx version="2005-1"
|
||||
xml:lang="en"
|
||||
|
|
@ -19,7 +20,7 @@ from uuid import uuid4
|
|||
<py:def function="navpoint(np, level)">
|
||||
${'%*s'%(4*level,'')}<navPoint id="${str(uuid4())}" playOrder="${str(np.play_order)}">
|
||||
${'%*s'%(4*level,'')}<navLabel>
|
||||
${'%*s'%(4*level,'')}<text>${np.text}</text>
|
||||
${'%*s'%(4*level,'')}<text>${re.sub(r'\s+', ' ', np.text)}</text>
|
||||
${'%*s'%(4*level,'')}</navLabel>
|
||||
${'%*s'%(4*level,'')}<content src="${unicode(np.href)+(('#' + unicode(np.fragment)) if np.fragment else '')}" />
|
||||
<py:for each="np2 in np">${navpoint(np2, level+1)}</py:for>
|
||||
|
|
@ -28,4 +29,4 @@ from uuid import uuid4
|
|||
<navMap>
|
||||
<py:for each="np in toc">${navpoint(np, 0)}</py:for>
|
||||
</navMap>
|
||||
</ncx>
|
||||
</ncx>
|
||||
|
|
|
|||
Loading…
Reference in a new issue