And pynch is correct here.
The routine in question is SourceUpdates/AnchorUpdates.cpp in the routine:
void AnchorUpdates::UpdateAllAnchorsWithIDs(const QList<HTMLResource *> &html_resources)
The only way to determine in which of the newly split files an anchor ends up is for the achor to have actually existed previously!
There is simply no way to tell if a non-existent id was before the split or after the split or almost anyplace if multiple splits are done.
The update anchor routine builds a list of all actual ids locations and uses that to determine which of the newly split files that link should be changed to.
So there is no way to really fix it, we can in fact detect if a link fragment is not an actual ID and then ignore changing that link at all but that is still a very broken link that does nothing. It is the location of the id itself which determines which file it should be changed to.
Unfortunately, this routine is invoked only *after* the physical split (and the assigning of filenames)and so we simply can not abort it without lots of broken links.
Perhaps a better solution would be to replace the file portion for non-existing fragment ids with a placeholder, something along the lines of:
UNKNOWN_LINK_BECAUSE_FRAGMENT_ID_DOES_NOT_EXIST
or some other ridiculously long string that could easily be searched for to make things more obvious that there is no way to update a link that has a fragment id if that fragment id does not exist when splitting the file.
KevinH
|