Quote:
Originally Posted by JimmXinu
 Back up a second! You made a plugin to post-process after my plugin? What on earth are you doing???
|
It was actually written for another source of epubs. There were some things in how they built them that I didn't like. Originally, it was simply to replace the stylesheet. For that, I initially modified the Modify ePub plugin to do this, but then decided to add other things that I was doing for all of these books. This includes smartening the punctuation, tweak some things about the ToC and rebuild it, run count pages and adding them to the appropriate reading lists.
When I started using FFF, I just extended it. The stylesheet was one as I didn't want to add it to the FFF config and maintain it in two places. That isn't as much of a worry since it can now be loaded from a file. One of the things I do is to split the title into a separate page. The above source uses a text title page that has the title and author. This shows nicely in various places on my Kobo ereaders. The first page that FFF produces looks messy as a cover, so I split the title and author to a separate page. And then fiddle with the layout of the titlepage tags (replace the br's with paragraphs and add a class).
And for the record, the code I use to rebuild the ToC is:
Code:
def _rebuild_toc(self, container):
from calibre.ebooks.oeb.polish.toc import from_xpaths, commit_toc
self.log('\t\t\t_rebuild_toc')
header_xpath = ['//h:h%d'%i for i in xrange(1, 4)]
self.log('\t\t\t\theader_xpath: {0}'.format(header_xpath))
new_toc = from_xpaths(container, header_xpath)
if len(new_toc) == 0:
self.log('\t\t\t\tToC not built')
return False
self.log('\t\t\t\tEntries added to ToC: %d' % len(new_toc))
self.log('\t\t\t\tToC: {0}'.format(new_toc))
commit_toc(container, new_toc)
return True
That of assumes the headings are used for chapter titles. For EpubSplit, it would probably be better to use the ToC build from a conversion. I haven't looked at doing that, but, from memory, the Modify ePub does this for a few of its functions, so it should be possible.