Quote:
Originally Posted by WS64
How can I rename a HTML file within an epub with a Sigil-plugin?
|
You can't rename html files with the Sigil plugin API. You'll have to delete the file and add it as a new file with the desired name. (However, this method can only be used if the file doesn't contain any link target ids referenced by other .xhtml files, unless your script will also take care of this.)
For example:
The above code will rename
Section0001.xhtml to
new.xhtml.
If you prefer to use pure Python code, you can use
bk.copy_book_contents_to() to copy the current epub to a temporary folder and then use
os.rename() etc. As with the first method, you'll have to update all link targets with your script.