For the record ... and so I do not have to spend another set of hours restudying the epub 2 and epub3 specs:
Here are the places in the OPF where idrefs (references to manifest ids) are used (that I can find documented at least), making changing the manifest id for a simple resource file rename more complicated.
- if you are renaming any image file and *change its manifest id*, you would have to walk all of the metadata to make sure you had just not changed the old epub2 cover image idref metadata. Tying it to the manifest properties itself made much more sense (as is done in epub3).
- if you rename the NCX and *change its manifest id*, you would have to change the toc attribute value in the spine tag
- if your opf is using the "bindings" tag (not used much in the wild admittedly) then you must walk all of its mediaType children and compare its "handler" attribute to see if it is a changed idref
- you will need to walk all the manifest item tags looking at every fallback attribute value and updating it if needed ... AND look at every media-overlay attribute value and update it as needed since both are idrefs.
- and of course you will need to walk the spine itemrefs and update each idref as needed
And these are the only ones I can find documented. There may easily be others inside custom metadata and even smil files that would have to be updated.
This is why just changing the unique id of a resource just to match its current name is fraught with issues that all go away if you just leave that unique id alone.
Which is why it was designed in that way - *independent* of the original resource file name. Sigil and others using that expedient of basing it on its original name really was not a good idea when mass renaming/renumbering of files is needed.
So I will look into making BulkRename try to update all of these possible uses of idrefs in the OPF for some FUTURE RELEASE. *If* I can do that and not kill performance with epubs with large numbers of files (read that thousands) then at some point I will add back that rename id "feature" but that is really a big IF.
Hope this explains things.
Last edited by KevinH; 06-22-2024 at 01:12 PM.
|