Tricking the TOC to point to 'outside' HTML
Summary
Here's a dirty little trick to get the TOC in a WebWorks Help project to point to non-WebWorks-generated HTML, such as Javadoc. There are probably smarter and cleaner ways of doing this, but it works. You will have to follow Steps 5 - 7 each time you generate your project.
Detailed Description
1. In FrameMaker, create a "dummy" book file (mine is called 'link.book')
2. Add title pages to the book file that contain the text you want to appear in the TOC. The title text must use the same paragraph tag you use for your book titles. For example, I have two title pages in my book file.
3. Add your 'link.book' file to your project.
4. Generate your project.
5. Locate the following files in your output folder:
- \wwhdata\common\files.js
- \wwhdata\xml\files.xml
6. Open each file in a text editor and locate the title text for each TOC entry to point to 'outside' HTML.
7. Edit the 'href' tag to redirect the link to a RELATIVE URL.
For example, in my files, I make the following edits:
In files.xml:
Change:
<Document title="Inquira API Reference" href="APIref.html" />
<Document title="InQuira Events and Messages Reference" href="errors.html" />
To:
<Document title="Inquira API Reference" href="./Javadoc/index.html" />
<Document title="InQuira Events and Messages Reference" href="./Events/HTML/index.html" />
In files.js:
Change:
- P.fA("Inquira API Reference","APIref.html");
P.fA("InQuira Events and Messages Reference","errors.html");
To:
- P.fA("Inquira API Reference","./Javadoc/index.html");
P.fA("InQuira Events and Messages Reference","./Events/HTML/index.html");
Example PERL Script
If you have a lot of edits and/or regenerate your project often, you could automate this update process via a simple PERL script.
Here's an example:
# To run enter: perl UpdateTOC.pl
$path = "C:/MLD_docs/WebWorks/804_Documentation/Output/WebWorks Help 5.0/804_Documentation/wwhdata";
print $path;
@infiles = qw(
- /common/files.js
- /xml/files.xml
);
MAIN: foreach $infile (@infiles) {
- $infile = "$path$infile";
- $outfile = $infile;
- $outfile =~ s/files/tmp_files/;
open(INPUT, "<$infile" ) ; # Open input file
open(OUTPUT, ">$outfile" ) ; # Open output file
while ($line = <INPUT>) {
if (($line =~ /Inquira API Reference/) || ($line =~ /InQuira Events and Messages Reference/))
- {
- $line =~ s/APIref\.html/\.\/Javadoc\/index\.html/;
- $line =~ s/errors.html/\.\/Events\/HTML\/index\.html/;
- }
- print OUTPUT $line; }
mv "$outfile" "$infile";
- {
}
close(INPUT) ; close(OUTPUT) ;