It is not easy. Renaming an xhtml file to some other extension involves walking the complete set of files and fixing all internal links, all toc.ncx entries, opf manifest entries. This ability is built into Sigil itself. So if you want to rename files, even multiple files, you should do this inside of Sigil before invoking an edit plugin.
FYI, The Sigil plugin system uses a copy on change approach and so you are not working with files internal to Sigil, just copies. This is to prevent a plugin from crashing Sigil. Instead the modified files are passed back to Sigil who then checks them and if okay merges the changed files in.
Please see the Plugin documentation and the sample plugin for use of the iterators for each file types and how manifest ids are used to access files.
Ask if you have questions.
|