All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jHelp.htmlHelpIndexBuilder

java.lang.Object
   |
   +----jHelp.htmlHelpIndexBuilder

public class htmlHelpIndexBuilder
extends Object
implements htmlTagConstants
This class provides for a standalone Java console application to generate an index file for htmlHelpIndexFrame. It is also used by the Index Builder Wizard application, jHelp.index.Wizard.

htmlHelpIndexBuilder need not be distributed with the other jHelp components with your application (the same may be said for package jHelp.index and the moondog.* packages provided with the distribution). It is a tool for your documentation writers.

htmlHelpIndexBuilder creates index entries stored into a file as htmlHelpIndexData objects. This class contains a numeric index that points to the index term's position within the help document, relative to tags, images and other words.

IMPORTANT - The numeric index that is used to determine the position within the document depends upon the content of the document. Therefore, if any help documents are revised, added to, or deleted from the help document set, it will be necessary to recompile the index file.

Using htmlHelpIndexBuilder

Assuming the jHelp package is in the default CLASSPATH of the java runtime, htmlHelpIndexBuilder is executed with the following general syntax:

java jHelp.htmlHelpIndexBuilder [options] outputfile inputfile

where:

outputfile is the name of the index file to be created, fully qualified with a path if desired.

inputfile is an ascii text file containing the names of the help files to be indexed, one file name per line. These should be the file names only, and not qualified with a path. The path to the help files is set with the -d switch described below.

New:If the input file is omitted, the index builder will use all htm/html files in the current directory (or directory specified with the -d switch)and recurse subdirectories thereof.

Options:

Options are set using command line switches, preceded with either a '-' or '/' character.

-? or /? displays usage instructions.
-h- or /h- causes header tags to be ignored when creating index entries.
-h+ or /h+ causes header tags to be used in generating index entries (default.)
-t- or /t- do not include the document title with the index entry.
-t+ or /t+ include document titles in the index (default.) This is useful where duplicate terms are indexed that are contained within different documents.
-w- or /w- do not generate a word list
-w+ or /w+ generate a word list (default) The word list will have the same file name as the index, with the extension ".wdx"
-d:path or /d:path the path for the helpfiles named in inputfile. Note that there is no space separating the switch from the path. Note that a trailing path separator is required (see example below.)

Usage Example

A typical command line for executing htmlHelpIndexBuilder on a Windows platform might be as follows:

java htmlHelpIndexBuilder -h- -t- -w+ -d:e:\helpdocs\ e:\helpdocs\help.idx e:\helpdocs\doclist.txt
 

The above line will generate an index, and save it as the file e:\helpdocs\help.idx. It will generate a word list and save it as e:\helpdocs\help.wdx.It will look for a list of document files in the file e:\helpdocs\doclist.txt. Header tags within the help documents will be ignored, and not used to generate index entries. Document titles will not be displayed alongside of the index entries. And finally, all help files listed in doclist.txt are located in the directory e:\helpdocs\. Note the trailing path separator provided for the source directory.

Some aspects of the syntax, such as path separators, will of course vary from the example depending upon your operating system.

Indexing Tags

htmlHelpIndexBuilder will optionally build an index from document header tags. In addition to these, jHelp supports two custom HTML tags, KEYWORD and INDEX.

The KEYWORD tag is used to explicitly define an index entry based on the VALUE attribute. The text assigned to value will be the text that is displayed in the index list. It may contain whitespace, in which case it must be enclosed in quotation marks. The index will find and position the help display to the first text or image that follows the KEYWORD tag.

<KEYWORD VALUE=text>

The INDEX and /INDEX tags are used to set off an index item from actual document text. There are no attributes associated with these tags. Text following the INDEX tag will be used as the displayed index item, until an /INDEX tag is encountered The index will find and position the help display to the first text or image that follows the INDEX tag.

<INDEX>document text that will appear in the index</INDEX>

Indexing Tags Example

The following is a short HTML document demonstrating use of the above tags.

 <pre>
 <HTML>
 <HEAD>
 <TITLE>Indexing Example</TITLE>
 </HEAD>
 <BODY>
 <H1> Creating an Index</H1>
 <P><STRONG><INDEX>htmlHelpIndexBuilder</INDEX></STRONG> is a Java console
 application that automatically builds an alphabetically sorted index from
 a list of help documents.</P>
 <KEYWORD VALUE="Running htmlHelpIndexBuilder">
 <P>htmlHelpIndexBuilder is run from the command line. Syntax for using
 htmlHelpIndexBuilder is as follows:</P>
 <PRE>
 java htmlHelpIndexBuilder [options] outputfile inputfile
 </PRE>
 <P><STRONG><INDEX>Command Line Options</INDEX></STRONG> include
 enabling/disabling header tag indexing, including the document name
 alongside of the index entry, naming a source directory for the listed
 output files, and a help screen.</P>
 </BODY>
 </HTML>
 

If we run htmlHelpIndexBuilder on the above HTML document, with default options to include header tags in the index, and the document title, the following sorted, indexed entries will be created:

Command Line Options (Indexing Example)
Creating an Index (Indexing Example)
htmlHelpIndexBuilder (Indexing Example)
Running htmlHelpIndexBuilder(Indexing Example)


Variable Index

 o vSources

Constructor Index

 o htmlHelpIndexBuilder()
 o htmlHelpIndexBuilder(htmlHelpIndexBuilderProject, TextArea)
This constructor is used by the Index Builder Wizard app.

Method Index

 o main(String[])
static main method for standalone execution.

Variables

 o vSources
 public static Vector vSources

Constructors

 o htmlHelpIndexBuilder
 public htmlHelpIndexBuilder()
 o htmlHelpIndexBuilder
 public htmlHelpIndexBuilder(htmlHelpIndexBuilderProject proj,
                             TextArea ta)
This constructor is used by the Index Builder Wizard app.

Methods

 o main
 public static void main(String args[])
static main method for standalone execution.


All Packages  Class Hierarchy  This Package  Previous  Next  Index