Updating hyperlinks after splitting a notebook
- To: mathgroup at smc.vnet.net
- Subject: [mg18375] Updating hyperlinks after splitting a notebook
- From: Tom Burton <tburton at brahea.com>
- Date: Wed, 30 Jun 1999 14:13:34 -0400
- Sender: owner-wri-mathgroup at wolfram.com
When a notebook becomes so large with graphics that navigation and
especially searching is ponderous, I consider splitting the notebook into
several smaller notebooks. The effort needed to restore functionality after
the split has presented a modest potential barrier, tending to keep a
notebook in one piece a little too long.
Recently, as I have become a fan of hyperlinks, this barrier has grown
dramatically: most of the effort to restore functionality consists of
repairing broken hyperlinks. As the list of hyperlinks in a single notebook
becomes hard to scroll in the Create Hyperlink dialog, these same
hyperlinks push me into the barrier.
So I am casting about for an easy way to repair broken links after
splitting up a notebook. I note the simple difference between the
ButtonData of an internal link and those of an external link to a notebook
in the same directory:
internal link external link
tag {nbx, tag}
How about the following algorithm? Does anything like this exist? Thanks.
Read all notebooks of a given directory into the kernel.
For each notebook, made current one at a time,
For each hyperlink in the current notebook:
bbx:ButtonBox[___,ButtonStype->"Hyperlink",___]
Get the link
First at Cases[bbx, (ButtonData->link) -> link]
If the link is a string (just a tag), and
If the tag is in any CellTags within the current notebook, then
break to next hyperlink.
{nbx,tag} = link
If tag is in any CellTags within 0 or >1 of the open notebooks,
then complain and break to the next hyperlink.
Set nbx to the 1 notebook containing tag.
Update the ButtonData:
bbx /. (ButtonData->_) -> (ButtonData->{nbx,tag})