One of the requirements for the Ubuntu Quickly Ebook template is the ability to re-order chapters. I had worked out a mechanism to re-order the toc (table of Content) entries for chapters, meaning that ordering of the ebook chapters could be performed through an XML modification. That’s great – but it causes a problem for the web interface – primarily that the table of content seen in the web edit would need to be updated every time we added a chapter, and the page ordering would need to be read from there. This would have meant potentially quite a lot of disk activity just to add a chapter. Imagine : I want to add a chapter to my ebook – but that would also mean that I would have to update the content.opf file accordingly. And add to this the complexity of what could happen if I roll back the book, but maintain the new chapters. I suddenly realised that the reordering of chapters is simple – all I need to do is to update the date modified for the chapter files, and that way I can be sure that all chapters are written in the correct order, as they are read in date time order. It automatically ensure that new chapters are added at the end of the book – it’s a a simple solution that requires no alteration to the existing files.
The issue now is that bzr doesn’t track these file changes. I think what I will do is following re-ordering of the pages, I will rebuild the content tables – which will re-create the metadata for chapter ordering… That should allow bzr to recognise the new page order