@DiapDealer...While I was writing the plugin code I thought about what you you've said above and realized that all the internal links in the xhtml file are a mixture of either page links or links to ids(boookmarks). The ncx and opf files also contain links -- but these are mostly page links as a rule -- not links to an id or bookmark. And any href + id in the opf and ncx will already be in the xhtml file anyway - ie there are no ids(bookmarks) in the opf or ncx that are referenced by links in the opf or ncx.
The way the plugin works is that it initially gathers all hrefs with ids and splits these and saves each href id into a list. On the second pass through the xhtml files every id is compared to all the ids in the href id list. If the id is not there in the href list it's removed, if the id is there then the id is left unchanged. And because of the way I've done it, no internal links are ever changed or removed because all the plugin code is doing is just removing ids that are not used in only the xhtml files. And if these removed ids are not used in the xhtml then they won't be used in the links in either the opf or ncx.
Last edited by slowsmile; 03-28-2018 at 08:30 AM.
|