View Full Version : Internal links not working after Packaging (copying) indb file


MHC
03-06-2013, 04:02 PM
I have an InDesign CS6 Book (indb) file with 300+ manually created internal hyperlinks to/from endnotes. The endnotes worked fine until I used the Package for Print function to make a copy of everything.

The original indb file was drawing on indd files scattered in different locations and I needed them all in one place to avoid confusion and for backup purposes. So I Packaged them - all files have retained the same name, but I have made extensive edits to them.

Now my internal endnote links don't work. I was thinking the path name could be wrong because of the new location of my file, but I unzipped the ePub and the html reveals that the path is completely missing. On my new file, the endnote link will have, say, <a id="x18" /> in the correct spot, but no href code at all. The working file includes the href after it, ie: <a id="x18" /></span><a href="Endnotes.xhtml#x18">

Is there a way to make my new file work properly without re-doing the hyperlinks? The filenames for the old and new files are identical, BTW.

JSWolf
03-06-2013, 04:25 PM
Now my internal endnote links don't work. I was thinking the path name could be wrong because of the new location of my file, but I unzipped the ePub and the html reveals that the path is completely missing. On my new file, the endnote link will have, say, <a id="x18" /> in the correct spot, but no href code at all. The working file includes the href after it, ie: <a id="x18" /></span><a href="Endnotes.xhtml#x18">

Is there a way to make my new file work properly without re-doing the hyperlinks? The filenames for the old and new files are identical, BTW.

Actually, there is a rather easy way to fix this. Load all the XML files into Notepad++ and do the following search/replace using Regular Expression...

Search for: <a id="(.*)" />
Reaplace with: <a id="\1" /></span><a herf="Endnotes.xhtml#\1">

Then click Replace ALL in All Opened Documents.

Problem solved.

GrannyGrump
03-07-2013, 12:33 AM
Careful, there -- that pattern will also replace the anchor links in the Endnotes, so they will link back to themselves, I think.

Don't you need one pattern to fix the link that goes from the paragraph TO the endnote, and another pattern to fix the link that goes from the endnote BACK to the source paragraph?

MHC
03-07-2013, 09:33 AM
I appreciate the script and may try it if needed, but can anyone shed light on why this is happening? I'd like to be able to re-export my ePub from InDesign and have the endnotes link properly.

JSWolf
03-07-2013, 11:15 AM
Careful, there -- that pattern will also replace the anchor links in the Endnotes, so they will link back to themselves, I think.

Don't you need one pattern to fix the link that goes from the paragraph TO the endnote, and another pattern to fix the link that goes from the endnote BACK to the source paragraph?

If the regex I posted will modified the endnotes so they are not correct, just don't load the endnotes file into Notepad++ and let it do its work on the rest of the XML files.

But given that the endnotes will be referring back to different files, I think the endnotes may have to be edited by hand.

GrannyGrump
03-08-2013, 01:48 AM
Being a lazy typist, I made an AutoHotkey script to handle that kind of manual editing. It pops up a little input box, where I type in the unique ID number, and the script types the anchor tags, including the ID, then brings up the search window with the Find pattern already there, I just have to hit Enter to go to the next instance, then hit my single hotkey, and type in the next ID number, and rinse, lather, repeat til done.

AutoHotkey is excellent for entering repetitive text, and saves lots of time.

dgatwood
03-09-2013, 01:50 PM
Also, unless you're talking about an EMP weapon, I think you meant href.