1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
5 <title>README: Web-based Help from DocBook XML</title>
9 <para>Permission is hereby granted, free of charge, to any person
10 obtaining a copy of this software and associated documentation files
11 (the <quote>Software</quote>), to deal in the Software without
12 restriction, including without limitation the rights to use, copy,
13 modify, merge, publish, distribute, sublicense, and/or sell copies of
14 the Software, and to permit persons to whom the Software is furnished to
15 do so, subject to the following conditions: <itemizedlist>
17 <para>The above copyright notice and this permission notice shall
18 be included in all copies or substantial portions of the
23 <para>Except as contained in this notice, the names of individuals
24 credited with contribution to this software shall not be used in
25 advertising or otherwise to promote the sale, use or other
26 dealings in this Software without prior written authorization from
27 the individuals in question.</para>
31 <para>Any stylesheet derived from this Software that is publicly
32 distributed will be identified with a different name and the
33 version strings in any derived Software will be changed so that no
34 possibility of confusion between the derived package and this
35 Software will exist.</para>
37 </itemizedlist></para>
40 <title>Warranty:</title>
42 <para>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
43 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45 IN NO EVENT SHALL DAVID CRAMER, KASUN GAJASINGHE, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR
46 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
47 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
48 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</para>
51 <para>This package is maintained by Kasun Gajasinghe, <email>kasunbg AT
52 gmail DOT com</email> and David Cramer, <email>david AT thingbag DOT
55 <para>This package also includes the following software written and
56 copyrighted by others:<itemizedlist>
58 <para>Files in <filename
59 class="directory">template/common/jquery</filename> are
60 copyrighted by <ulink url="http://jquery.com/">JQuery</ulink>
61 under the MIT License. The file
62 <filename>jquery.cookie.js</filename> Copyright (c) 2006 Klaus
63 Hartl under the MIT license.</para>
66 <primary>jquery</primary>
71 <para>Some files in the <filename
72 class="directory">template/content/search</filename> and <filename
73 class="directory">indexer</filename> directories were originally
74 part of N. Quaine's htmlsearch DITA plugin. The htmlsearch DITA
75 plugin is available from the <ulink
76 url="http://tech.groups.yahoo.com/group/dita-users/files/Demos/">files
77 page</ulink> of the DITA-users yahoogroup. The htmlsearch plugin
78 was released under a BSD-style license. See
79 <filename>indexer/license.txt</filename> for details. <indexterm>
80 <primary>htmlsearch</primary>
81 </indexterm> <indexterm>
82 <primary>DITA</primary>
84 <secondary>htmlsearch plugin</secondary>
89 <para>Stemmers from the <ulink
90 url="http://snowball.tartarus.org/texts/stemmersoverview.html">Snowball
91 project</ulink> released under a BSD license.</para>
95 <para>Code from the <ulink url="http://lucene.apache.org/">Apache
96 Lucene</ulink> search engine provides support for tokenizing
97 Chinese, Japanese, and Korean content released under the Apache
101 Webhelp for DocBook was developed as a <ulink url="http://socghop.appspot.com">Google Summer of Code</ulink> project.
106 <year>2008-2010</year>
108 <holder>Kasun Gajasinghe</holder>
110 <holder>David Cramer</holder>
114 <firstname>David</firstname>
116 <surname>Cramer</surname>
118 <email>dcramer AT motive DOT com</email>
120 <email>david AT thingbag DOT net</email>
124 <firstname>Kasun</firstname>
126 <surname>Gajasinghe</surname>
128 <email>kasunbg AT gmail DOT com</email>
131 <pubdate>August 2010</pubdate>
137 <!-- This becomes the brief description that appears in search results UNLESS there's a para or phrase with role="summary". If there is, then the role="summary" text wins. -->
139 <para>Overview of the package.</para>
143 <title>Introduction</title>
145 <para>A common requirement for technical publications groups is to produce a Web-based help
146 format that includes a table of contents pane, a search feature, and an index similar to what
147 you get from the Microsoft HTML Help (.chm) format or Eclipse help. If the content is help for
148 a Web application that is not exposed to the Internet or requires that the user be logged in,
149 then it is impossible to use services like Google to add search. <indexterm class="singular">
150 <primary>features</primary>
153 <title>Features</title>
155 <para>Full text search.<indexterm class="singular">
156 <primary>search</primary>
157 <secondary>features</secondary>
161 <para>Stemming support for English, French, and German. Stemming support can be added
162 for other languages by implementing a stemmer.<indexterm class="singular">
163 <primary>search</primary>
164 <secondary>stemming</secondary>
168 <para>Support for Chinese, Japanese, and Korean using code from the Lucene search
172 <para>Search highlighting shows where the searched for term appears in the results.
173 Use the <guibutton>H</guibutton> button to toggle the highlighting off and on.
174 <indexterm class="singular">
175 <primary>search</primary>
176 <secondary>highlighting</secondary>
180 <para>Search results can include brief descriptions of the target.<indexterm
182 <primary>search</primary>
183 <secondary>descriptions</secondary>
189 <para>Table of contents pane with collapsible toc tree.</para>
192 <para>Auto-synchronization of content pane and TOC.</para>
195 <para>TOC and search pane implemented without the use of a frameset.</para>
198 <para>An Ant <filename>build.xml</filename> file to generate output. You can use this
199 build file by importing it into your own or use it as a model for integrating this
200 output format into your own build system.</para>
204 <title>Possible future enhancements</title>
206 <para>Move webhelp-specific parameters and gentext strings into base DocBook stylesheets.
210 <para>Use <sgmltag class="attribute">tabindex</sgmltag> attributes to control the tab
211 order in the output. The Contents and Search tabs should be first and second, then the
212 search box and button, then the table of contents items, and so on.</para>
215 <para>Add "Expand all" and "Collapse all" buttons to the table of contents.</para>
218 <para>Add other search options:</para>
221 <para>Add an option to use Lucene for server-side searches with table of contents
222 state persisted on the server.</para>
225 <para>Add a simple form that uses a Google site:my.domain.com based search.</para>
230 <para>Sort search results based on relevance</para>
233 <para>Support wild card characters in the search query.</para>
236 <para>Parameterize width of the TOC pane OR make the TOC pane resizeable by the
240 <para>Automate search results summary text:</para>
243 <para>Automatically use the first non-heading content as the summary in the search
247 <para>Automatically limit the size of the search description to something 140
253 <para>Support boolean operators in search.</para>
256 <para>Parameterize list of files to exclude from indexing. Currently it's hard coded that
257 we don't index <filename>index.html </filename>and <filename>ix01.html</filename> (the
258 legal notice and index topics). It should be smarter and automatically not index the
259 index file even if it's not named <filename>ix01.html</filename>.</para>
262 <para>Improve performance by moving the table of contents div out of each page and into a
263 separate JavaScript file which then adds it to the page.</para>
266 <para>Add to the indexer the ability to specify a list of files or file patterns not to
267 index. Currently it does not index <filename>index.html</filename> or
268 <filename>ix01.html</filename>, which is generally appropriate, but it should be up to
269 the user to decide.</para>
272 <para>Add an index tab populated by a separate JavaScript file. Include a param/property
273 that allows the content creator to disable the index.</para>
276 <para>Add functionality to the <filename>build.xml</filename> file so that when a property
277 is set, the build generates a pdf version of the document and includes a link to it from
282 url="http://www.comparenetworks.com/developers/jqueryplugins/jbreadcrumb.html"
283 >breadcrumbs</ulink> so the user will know what topics he's been to.</para>
286 <para>Consider using more advanced Lucene indexers for Chinese and Japanese than the
289 </itemizedlist></para>
293 <title>Using the package</title>
295 <para role="summary">The following sections describe how to install and
296 use the package on Windows.</para>
301 <para>Installation instructions</para>
305 <title>Generating webhelp output</title>
308 <title>To install the package on Windows</title>
311 <para>The examples in this procedure assume a Windows installation,
312 but the process is the same in other environments,
313 <foreignphrase>mutatis mutandis</foreignphrase>.</para>
317 <para>If necessary, install <ulink
318 url="http://www.java.com/en/download/manual.jsp">Java 1.6</ulink> or
323 <para>Confirm that Java is installed and in your
324 <envar>PATH</envar> by typing the following at a command prompt:
325 <programlisting>java -version</programlisting></para>
327 <para>To build the indexer, you must have the JDK.</para>
334 <para>If necessary, install <ulink
335 url="http://ant.apache.org/bindownload.cgi">Apache Ant</ulink> 1.6.5
340 <para>Unzip the Ant binary distribution to a convenient location
341 on your system. For example: <filename>c:\Program
342 Files</filename>.</para>
346 <para>Set the environment variable <envar>ANT_HOME</envar> to
347 the top-level Ant directory. For example: <filename>c:\Program
348 Files\apache-ant-1.7.1</filename>. <tip>
350 url="http://support.microsoft.com/kb/310519">How To Manage
351 Environment Variables in Windows XP</ulink> for information
352 on setting environment variables.</para>
357 <para>Add the Ant <filename>bin</filename> directory to your
358 <envar>PATH</envar>. For example: <filename>c:\Program
359 Files\apache-ant-1.7.1\bin</filename></para>
363 <para>Confirm that Ant is installed by typing the following at a
364 command prompt: <programlisting>ant -version</programlisting></para>
367 <para>If you see a message about the file
368 <filename>tools.jar</filename> being missing, you can safely
376 <para>Download <ulink url="http://prdownloads.sourceforge.net/saxon/saxon6-5-5.zip">Saxon
377 6.5.x</ulink> and unzip the distribution to a convenient location on your file system.
378 You will use the path to <filename>saxon.jar</filename> in <xref
379 linkend="edit-build-properties"/> below.<note>
380 <para>The <filename>build.xml</filename> has only been tested with Saxon 6.5, though
381 it could be adapted to work with other XSLT processors. However, when you generate
382 output, the Saxon jar must <emphasis role="bold">not</emphasis> be in your
383 <envar>CLASSPATH</envar>.</para>
387 <step id="edit-build-properties">
388 <para>In a text editor, edit the
389 <filename>build.properties</filename> file in the webhelp directory
390 and make the changes indicated by the comments:<programlisting># The path (relative to the build.xml file) to your input document.
391 # To use your own input document, create a build.xml file of your own
392 # and import this build.xml.
393 input-xml=docsrc/readme.xml
395 # The directory in which to put the output files.
396 # This directory is created if it does not exist.
399 # If you are using a customization layer that imports webhelp.xsl, use
400 # this property to point to it.
401 stylesheet-path=${ant.file.dir}/xsl/webhelp.xsl
403 # If your document has image directories that need to be copied
404 # to the output directory, you can list patterns here.
405 # See the Ant documentation for fileset for documentation
407 #input-images-dirs=images/**,figures/**,graphics/**
409 # By default, the ant script assumes your images are stored
410 # in the same directory as the input-xml. If you store your
411 # image directories in another directory, specify it here.
412 # and uncomment this line.
413 #input-images-basedir=/path/to/image/location
415 # Modify this so that it points to your copy of the Saxon 6.5 jar.
416 xslt-processor-classpath=/usr/share/java/saxon-6.5.5.jar
418 # For non-ns version only, this validates the document
420 validate-against-dtd=true
422 # Set this to false if you don't need a search tab.
423 webhelp.include.search.tab=true
425 # indexer-language is used to tell the search indexer which language
426 # the docbook is written. This will be used to identify the correct
427 # stemmer, and punctuations that differs from language to language.
428 # see the documentation for details. en=English, fr=French, de=German,
429 # zh=Chinese, ja=Japanese etc.
430 webhelp.indexer.language=en</programlisting></para>
434 <para>Test the package by running the command <code>ant webhelp
435 -Doutput-dir=test-ouput</code> at the command line in the webhelp directory. It should
436 generate a copy of this documentation in the <filename class="directory">doc</filename>
437 directory. Type <code>start test-output\index.html</code> to open the output in a
438 browser. Once you have confirmed that the process worked, you can delete the <filename
439 class="directory">test-output</filename> directory. <important>
440 <para>The Saxon 6.5 jar should <emphasis>not</emphasis> be in your
441 <envar>CLASSPATH</envar> when you generate the webhelp output. If you have any
442 problems, try running ant with an empty <envar>CLASSPATH</envar>.</para>
447 <para>To process your own document, simply refer to this package
448 from another <filename>build.xml</filename> in arbitrary location on
453 <para>Create a new <filename>build.xml</filename> file that
454 defines the name of your source file, the desired output
455 directory, and imports the <filename>build.xml</filename> from
456 this package. For example: <programlisting><project>
457 <property name="input-xml" value="<replaceable>path-to/yourfile.xml</replaceable>"/>
458 <property name="input-images-dirs" value="<replaceable>images/** figures/** graphics/**</replaceable>"/>
459 <property name="output-dir" value="<replaceable>path-to/desired-output-dir</replaceable>"/>
460 <import file="<replaceable>path-to/docbook-webhelp/</replaceable>build.xml"/>
461 </project></programlisting></para>
465 <para>From the directory containing your newly created
466 <filename>build.xml</filename> file, type <code>ant
467 webhelp</code> to build your document.</para>
469 <para>The Saxon 6.5 jar should <emphasis>not</emphasis> be in your
470 <envar>CLASSPATH</envar> when you generate the webhelp output. If you have any
471 problems, try running ant with an empty <envar>CLASSPATH</envar>.</para>
480 <title>Using and customizing the output</title>
482 <para>To deep link to a topic inside the help set, simply link directly
483 to the page. This help system uses no frameset, so nothing further is
486 url="http://www.sagehill.net/docbookxsl/Chunking.html">Chunking into
487 multiple HTML files</ulink> in Bob Stayton's <ulink
488 url="http://www.sagehill.net/docbookxsl/index.html">DocBook XSL: The
489 Complete Guide</ulink> for information on controlling output file
490 names and which files are chunked in DocBook.</para>
493 <para>When you perform a search, the results can include brief
494 summaries. These are populated in one of two ways:<itemizedlist>
496 <para>By adding <sgmltag>role="summary"</sgmltag> to a
497 <sgmltag>para</sgmltag> or <sgmltag>phrase</sgmltag> in the
498 <sgmltag>chapter</sgmltag> or <sgmltag>section</sgmltag>.</para>
502 <para>By adding an <sgmltag>abstract</sgmltag> to the
503 <sgmltag>chapterinfo</sgmltag> or <sgmltag>sectioninfo</sgmltag>
506 </itemizedlist></para>
508 <para>To customize the look and feel of the help, study the following
509 css files:<itemizedlist>
511 <para><filename>docs/common/css/positioning.css</filename>: This
512 handles the Positioning of DIVs in appropriate positions. For
513 example, it causes the <code>leftnavigation</code> div to appear
514 on the left, the header on top, and so on. Use this if you need to
515 change the relative positions or need to change the width/height
520 <para><filename>docs/common/jquery/theme-redmond/jquery-ui-1.8.2.custom.css</filename>:
521 This is the theming part which adds colors and stuff. This is a
522 default theme comes with <ulink
523 url="http://jqueryui.com/download">jqueryui</ulink> unchanged. You
524 can get any theme based your interest from this. (Themes are on
525 right navigation bar.) Then replace the css theme folder
526 (theme-redmond) with it, and change the xsl to point to the new
531 <para><filename>docs/common/jquery/treeview/jquery.treeview.css</filename>:
532 This styles the toc Tree. Generally, you don't have to edit this
535 </itemizedlist></para>
538 <title>Recommended Apache configurations</title>
540 <para>If you are serving a long document from an Apache web server, we
541 recommend you make the following additions or changes to your
542 <filename>httpd.conf</filename> or <filename>.htaccess</filename>
543 file. <remark>TODO: Explain what each thing
544 does.</remark><programlisting>AddDefaultCharSet UTF-8 # <co
545 id="AddDefaultCharSet" />
548 <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> # <co
549 id="CachingSettings" />
550 Header set Cache-Control "max-age=290304000, public"
554 <FilesMatch "\.(xml|txt)$">
555 Header set Cache-Control "max-age=172800, public, must-revalidate"
559 <FilesMatch "\.(html|htm)$">
560 Header set Cache-Control "max-age=7200, must-revalidate"
563 # compress text, html, javascript, css, xml:
564 AddOutputFilterByType DEFLATE text/plain # <co id="CompressSetting" />
565 AddOutputFilterByType DEFLATE text/html
566 AddOutputFilterByType DEFLATE text/xml
567 AddOutputFilterByType DEFLATE text/css
568 AddOutputFilterByType DEFLATE application/xml
569 AddOutputFilterByType DEFLATE application/xhtml+xml
570 AddOutputFilterByType DEFLATE application/rss+xml
571 AddOutputFilterByType DEFLATE application/javascript
572 AddOutputFilterByType DEFLATE application/x-javascript
574 # Or, compress certain file types by extension:
576 SetOutputFilter DEFLATE
578 </programlisting><calloutlist>
579 <callout arearefs="AddDefaultCharSet">
581 url="http://www.sagehill.net/docbookxsl/SpecialChars.html">Odd
582 characters in HTML output</ulink> in Bob Stayton's book
583 <citetitle>DocBook XSL: The Complete Guide</citetitle> for more
584 information about this setting.</para>
587 <callout arearefs="CachingSettings">
588 <para>These lines and those that follow cause the browser to
589 cache various resources such as bitmaps and JavaScript files.
590 Note that caching JavaScript files could cause your users to
591 have stale search indexes if you update your document since the
592 search index is stored in JavaScript files.</para>
595 <callout arearefs="CompressSetting">
596 <para>These lines cause the the server to compress html, css,
597 and JavaScript files and the brower to uncompress them to
598 improve download performance.</para>
600 </calloutlist></para>
605 <title>Building the indexer</title>
607 <para role="summary">To build the indexer, you must have installed the
608 JDK version 1.5 or higher and set the <envar>ANT_HOME</envar>
609 environment variable. Run <code>ant build-indexer</code> to recompile
610 <filename>nw-cms.jar</filename></para>
613 <primary>ANT_HOME</primary>
617 <primary>indexer</primary>
619 <secondary>building</secondary>
624 <title>Adding support for other (non-CJKV) languages</title>
626 <para>To support stemming for a language, the search mechanism requires
627 a stemmer implemented in both Java and JavaScript. The Java version is
628 used by the indexer and the JavaScript verison is used to stem the
629 user's input on the search form. Currently the search mechanism supports
630 stemming for English and German. In addition, Java stemmers are included
631 for the following languages. Therefore, to support these languages, you
632 only need to implement the stemmer in JavaScript and add it to the
633 template. If you do undertake this task, please consider contributing
634 the JavaScript version back to this project and to <ulink
635 url="http://snowball.tartarus.org/texts/stemmersoverview.html">Martin
636 Porter's project</ulink>.<itemizedlist>
650 <para>Hungarian</para>
658 <para>Norwegian</para>
662 <para>Portuguese</para>
666 <para>Romanian</para>
684 </itemizedlist></para>
689 <title>Developer Docs</title>
691 <para role="summary">This chapter provides an overview of how webhelp is implemented.</para>
693 <para>The table of contents and search panes are implemented as divs and
694 rendered as if they were the left pane in a frameset. As a result, the
695 page must save the state of the table of contents and the search in
696 cookies when you navigate away from a page. When you load a new page, the
697 page reads these cookies and restores the state of the table of contents
698 tree and search. The result is that the help system behaves exactly as if
699 it were a frameset.</para>
702 <title>Design</title>
703 <para role="summary">An overview of webhelp page structure.</para>
704 <para>DocBook WebHelp page structure is fully built on css-based design
705 abandoning frameset structure. Overall page structure can be divided in to three main sections
708 <para>Header: Header is a separate Div which include company logo,
709 navigation button(prev, next etc.), page title and heading of parent topic.</para>
713 <para>Content: This includes the content of the documentation. The processing of this part is
715 url="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl">
716 DocBook XSL Chunking customization</ulink>. Few further css-styling applied from
717 <filename>positioning.css</filename>.
722 <para>Left Navigation: This includes the table of contents and search tab. This
723 is customized using <ulink url="http://jqueryui.com/">jquery-ui</ulink> styling.</para>
726 <para>Tabbed Navigation: The navigation pane is organized in to two tabs.
727 Contents tab, and Search tab. Tabbed output is achieved using
728 <ulink url="http://docs.jquery.com/UI/Tabs">JQuery Tabs plugin</ulink>.
733 <para>Table of Contents (TOC) tree: When building the chunked html from the
734 docbook file, Table of Contents is generated as an Unordered List (a list
735 made from <code><ul> <li></code> tags). When page loads in the browser,
736 we apply styling to it to achieve the nice look that you see. Styling for TOC
737 tree is done by a JQuery UI plugin called
738 <ulink url="http://bassistance.de/jquery-plugins/jquery-plugin-treeview/">
739 TreeView</ulink>. We can generate the tree easily by following javascript code:
743 $("#tree").treeview({
746 control: "#sidetreecontrol",
754 <para>Search Tab: This includes the search feature.</para>
764 <title>Search</title>
765 <para role="summary">Overview design of Search mechanism.</para>
767 The searching is a fully client-side implementation of querying texts for
768 content searching, and no server is involved. That means when a user enters a query,
769 it is processed by JavaScript inside the browser, and displays the matching results by
770 comparing the query with a generated 'index', which too reside in the client-side web browser.
772 Mainly the search mechanism has two parts.
775 <para>Indexing: First we need to traverse the content in the docs/content folder and index
776 the words in it. This is done by <filename>nw-cms.jar</filename>. You can invoke it by
777 <code>ant index</code> command from the root of webhelp of directory. You can recompile it
778 again and build the jar file by <code>ant build-indexer</code>. Indexer has some extensive
779 support for such as stemming of words. Indexer has extensive support for English, German,
780 French languages. By extensive support, what I meant is that those texts are stemmed
781 first, to get the root word and then indexes them. For CJK (Chinese, Japanese, Korean)
782 languages, it uses bi-gram tokenizing to break up the words. (CJK languages does not have
783 spaces between words.)
786 When we run <code>ant index</code>, it generates five output files:
789 <para><filename>htmlFileList.js</filename> - This contains an array named <code>fl</code> which stores details
790 all the files indexed by the indexer.
794 <para><filename>htmlFileInfoList.js</filename> - This includes some meta data about the indexed files in an array
795 named <code>fil</code>. It includes details about file name, file (html) title, a summary
796 of the content.Format would look like,
797 <code>fil["4"]= "ch03.html@@@Developer Docs@@@This chapter provides an overview of how webhelp is implemented.";</code>
802 <para><filename>index-*.js</filename> (Three index files) - These three files actually stores the index of the content.
803 Index is added to an array named <code>w</code>.</para>
812 Querying: Query processing happens totally in client side. Following JavaScript files handles them.
815 <para><filename>nwSearchFnt.js</filename> - This handles the user query and returns the search results. It does query
816 word tokenizing, drop unnecessary punctuations and common words, do stemming if docbook language
817 supports it, etc.</para>
820 <para><filename>{$indexer-language-code}_stemmer.js</filename> - This includes the stemming library.
821 <filename>nwSearchFnt.js</filename> file calls <code>stemmer</code> method in this file for stemming.
822 ex: <code>var stem = stemmer(foobar);</code>
832 <title>New Stemmers</title>
833 <para role="summary">Adding new Stemmers is very simple.</para>
834 <para>Currently, only English, French, and German stemmers are integrated in to WebHelp. But the code is
835 extensible such that you can add new stemmers easily by few steps.</para>
839 <para>You'll need two versions of the stemmer; One written in JavaScript, and another in Java. But fortunately,
840 Snowball contains Java stemmers for number of popular languages, and are already included with the package.
841 You can see the full list in <ulink url="ch02s04.html">Adding support for other (non-CJKV) languages</ulink>.
842 If your language is listed there,
843 Then you have to find javascript version of the stemmer. Generally, new stemmers are getting added in to
844 <ulink url="http://snowball.tartarus.org/otherlangs/index.html">Snowball Stemmers in other languages</ulink> location.
845 If javascript stemmer for your language is available, then download it. Else, you can write a new stemmer in
846 JavaScript using SnowBall algorithm fairly easily. Algorithms are at
847 <ulink url="http://snowball.tartarus.org/">Snowball</ulink>.
851 <para>Then, name the JS stemmer exactly like this: <filename>{$language-code}_stemmer.js</filename>. For example,
852 for Italian(it), name it as, <filename>it_stemmer.js</filename>. Then, copy it to the
853 <filename>docbook-webhelp/template/content/search/stemmers/</filename> folder. (I assumed
854 <filename>docbook-webhelp</filename> is the root folder for webhelp.)
856 <para>Make sure you changed the <code>webhelp.indexer.language</code> property in <filename>build.properties</filename>
865 <para>Now two easy changes needed for the indexer.</para>
868 <para>Open <filename>docbook-webhelp/indexer/src/com/nexwave/nquindexer/IndexerTask.java</filename> in
869 a text editor and add your language code to the <code>supportedLanguages</code> String Array. </para>
871 <title>Add new language to supportedLanguages array</title>
873 change the Array from,
875 private String[] supportedLanguages= {"en", "de", "fr", "cn", "ja", "ko"};
876 //currently extended support available for
877 // English, German, French and CJK (Chinese, Japanese, Korean) languages only.
881 private String[] supportedLanguages= {"en", "de", "fr", "cn", "ja", "ko", <emphasis>"it"</emphasis>};
882 //currently extended support available for
883 // English, German, French, CJK (Chinese, Japanese, Korean), and Italian languages only.
890 Now, open <filename>docbook-webhelp/indexer/src/com/nexwave/nquindexer/SaxHTMLIndex.java</filename> and
891 add the following line to the code where it initializes the Stemmer (Search for
892 <code>SnowballStemmer stemmer;</code>). Then add code to initialize the stemmer Object in your language.
893 It's self understandable. See the example. The class names are at:
894 <filename>docbook-webhelp/indexer/src/com/nexwave/stemmer/snowball/ext/</filename>.
897 <title>initialize correct stemmer based on the <code>webhelp.indexer.language</code> specified</title>
899 SnowballStemmer stemmer;
900 if(indexerLanguage.equalsIgnoreCase("en")){
901 stemmer = new EnglishStemmer();
902 } else if (indexerLanguage.equalsIgnoreCase("de")){
903 stemmer= new GermanStemmer();
904 } else if (indexerLanguage.equalsIgnoreCase("fr")){
905 stemmer= new FrenchStemmer();
907 <emphasis>else if (indexerLanguage.equalsIgnoreCase("it")){ //If language code is "it" (Italian)
908 stemmer= new italianStemmer(); //Initialize the stemmer to <code>italianStemmer</code> object.
920 <para>That's all. Now run <code>ant build-indexer</code> to compile and build the java code.
921 Then, run <code>ant webhelp</code> to generate the output from your docbook file.
922 For any questions, contact us or email to the docbook mailing list
923 <email>docbook-apps@lists.oasis-open.org</email>.