[Date Prev][Date Next] [Thread Prev][Thread Next]
[Date Index] [Thread Index] [New search]

Re: Find all cross-references to a certain target



On Wed, 22 Sep 2004 22:57:14 -0400, Fred Ma <fma@xxxxxxxxxxxxxxx> wrote:

>Thanks for all the responses about generating a list of cross-references to a
>*specific* cross-reference marker.  It seems to be not possible, though workable
>alternatives were suggested (summarized below).

Actually it *is* possible... with Mif2Go.  And you don't
even need a licensed copy; the sample version does all
you need for this, and we hereby authorize its commercial
use for this purpose.  Free.  ;-)

When we generate HTML, we typically split up the Frame
files into numerous .htm files.  So how do we know what
the name is of the .htm file that contains an <a name=...>
anchor (produced from an xref marker or hypertext newlink) 
that we link to?  We do it using the .ref files that
Mif2Go creates alongside the .htms, one for each .fm.

The .ref files are in standard .ini format, easily read
by scripts (or even by humans).  In each, [IntRefs]
lists the ID of every xref marker, newlink, or other
source (such as a head used in the TOC) that can be 
referenced, whether they are or not:

[IntRefs]
Rhr14061=1
XPGhr9=1
Xhr1004334=1
Xhr1004332=1
Xhr1004333=1
Xhr1004335=1
Rhr67379=1
Xhr1004361=1
Xhr1004360=1

Ignore the right side.  The left item has an R for
xref markers (those are the ones you care about), 
an X for hypertext newlinks (or similar targets), 
and XPG for Frame page number.  The next two letters 
are the FileID (from the mif2go.ini in the dir with 
the .fm files), then the numeric ID (the FrameMaker-
generated <Unique NNNNNNN>) of the link, which can 
be searched for in the matching MIF file.

Now look at the [ExtRefs] section:

[ExtRefs]
hq1004976=Rhr14061
ie1005239=Rhr67379

This time, look at the right side.  After you've run
the Frame book through Mif2Go once, you'll see all the 
*referenced* IDs here, once for each reference to them.  
The left side ID here specifies the referencing item 
(the <a href=...>).  If an item in [IntRefs] is not 
in [ExtRefs], it is not referenced, which is what
you wanted to find out about it.

Looking these up could be a bit onerous manually, but
a perl script could do the job really fast, and even
extract the references in context from their MIFs.

You are not limited to only refs from within the
same book.  There's a simple mechanism in mif2htm.ini
for specifying the locations of "foreign" book files,
both .ref and .htm, the section:

[RefFiles]
; original .fm filename = path to directory containing its .ref file,
; needed for files that are referenced from files in the current book
; and that have .htm and .ref files that are not in the same output
; directory as those produced for the current book by this project

Once you process all files with Mif2Go for HTML output,
in just one pass, the .ref files will all be complete.
There are other .ref-file sections that make this real
easy to work with, mostly self-explanatory, so I won't
make this post any longer (but will answer questions 
about details off-list).  Enjoy!

-- Jeremy H. Griffith, at Omni Systems Inc.
  <jeremy@xxxxxxxxx>  http://www.omsys.com/


** To unsubscribe, send a message to majordomo@xxxxxxxxx **
** with "unsubscribe framers" (no quotes) in the body.   **