47
Integration
Integrating output from the HTMLSearch plug-in with tocjsbis output or with your local favorite HTML implementation
is possible, but challenging. If you have some experience modifying (or hacking) HTML frames and JavaScript code,
have at it. Otherwise, you might consider continuing to use HTMLSearch output as a stand-alone complement to your
other output transformations.
Consider the following tips when planning your customization effort.
• Quotation marks in DITA map navtitles: If the navtitles in your DITA map file(s) contain quotation marks, remove
them before running the HTMLSearch plug-in. HTMLSearch passes these quotation marks through to its indexed
output, effectively breaking JavaScript syntax in the search\htmlFileInfoList.js file.
• Directory levels for XHTML output: The HTMLSearch plug-in writes the hyperlinked results of a keyword search
to a frame named contentwin. The initial static HTML loaded into that frame lives in the output subdirectory
named sub. The filepaths in the hyperlinks written to that frame, therefore, are relative to an HTML file in sub. If
you are using default XHTML output from the tocjs or tocjsbis, you may need to edit the JavaScript code that builds
that relative path. Test removing the three characters "../" in line 131 of search\nwSearchFnt.js if you
need to adjust HTMLSearch hyperlink paths to match target directory paths from tocjsbis or other DITA-OT XHTML
output transformations.
linkString = "<li><a href=\"../"+tempPath+"\">"+tempTitle+"</a>";
• Target frame name for keyword search input box: The HTMLSearch plug-in loads its input box into a frame named
"searchwin" in its default interface. To integrate that input box into a different set of named HTML frames, you will
need to change the name of the input box frame from "searchwin" to the new target frame name in lines 32, 39, 47,
242, and 248 in search\nwSearchFnt.js. For example, change "searchwin" to "your_frame_name" in the
following line in search\nwSearchFnt.js:
expressionInput=parent.frames['searchwin'].document.ditaSearch_Form.textToSearch.value
• Target frame name for keyword search results: The HTMLSearch plug-in writes its list of keyword search results
(hits) to a frame named "contentwin" in its default interface. To have those results displayed in a different frame in
your implementation, you will need to change the name of the input box frame from "contentwin" to the new target
frame name in lines 146 and 414 in search\nwSearchFnt.js. For example, change "contentwin" to
"your_frame_name" in the following line:
with (parent.frames['contentwin'].document) {
• Target frame name for target topics: The HTMLSearch plug-in displays target topics in the same "contentwin" frame
as the search results. If you would like to have both the list of search results and displayed target topics displayed
simultaneously in separate frames, you will need to change that way that HTMLSearch builds hyperlinks. Specifically,
you'll need to add an HTML "target=framename" attribute to line 131 in search\nwSearchFnt.js. For example,
insert the string target='topicwin' (or your_frame_name) into line 131. Here's the original ...
linkString = "<li><a href=\"../"+tempPath+"\">"+tempTitle+"</a>";
and the update ...
linkString = "<li><a href=\"../"+tempPath+"\"
target='topicwin'>"+tempTitle+"</a>";
After this change, HTMLSearch builds hyperlinks in the keyword search results frame that specify a different target
window for displaying target XHTML topics.
These are the most visible variables that you'll need to consider when customizing HTMLSearch output for your own
help implementation.
Output
Although the customization process can sound scary, it does produce some very nice results. Here is a prototype Help
implementation for my current company. The goal here is to integrate the output from HTMLSearch with output from
tocjsbis in a garden-variety three-tab, multi-frame HTML shell. Initially, the search UI is linked to a Search tab.
38 | Draft | Developing Custom DITA-based Help Systems