Help with Container rename & replace_links methods
I'm trying to figure out how to use the above. Please can you give some guidance how the 2 methods should be used together e.g.
If I have container of an epub and I want to change the name of
oldname = 'text/chap1.html' --> newname = 'text/chap1b.html'
oldname contains links to other files and is also linked to by other files.
I think I need to start with
container.rename(oldname, newname)
and I think I need to use a loop round (opf + ncx + spine items) with some combination of
repl = LinkRebaser(container, oldname, newname)
container.replace_links(name, repl)
container.dirty(name)
to correct any links related to oldname ... but as this isn't working I'm obviously misunderstanding somewhere. Please can you put me on track?
By 'not working' I mean, the file is renamed but I'm failing to get the opf file to update.
Followup question ... if the file to be renamed was an image, rather than html, how would the process differ?
Last edited by jackie_w; 10-21-2015 at 06:23 PM.
|