readme.xml 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030
  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"[
  4. <!ELEMENT xi:include (xi:fallback?) >
  5. <!ATTLIST xi:include
  6. xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude"
  7. href CDATA #IMPLIED
  8. parse (xml|text) "xml"
  9. xpointer CDATA #IMPLIED
  10. encoding CDATA #IMPLIED
  11. accept CDATA #IMPLIED
  12. accept-language CDATA #IMPLIED >
  13. <!ELEMENT xi:fallback ANY>
  14. <!ATTLIST xi:fallback
  15. xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude" >
  16. <!ENTITY % local.chapter.class "| xi:include">
  17. ]>
  18. <book>
  19. <title>README: Web-based Help from DocBook XML</title>
  20. <bookinfo>
  21. <legalnotice>
  22. <para>Permission is hereby granted, free of charge, to any person obtaining a copy of this
  23. software and associated documentation files (the <quote>Software</quote>), to deal in the
  24. Software without restriction, including without limitation the rights to use, copy, modify,
  25. merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
  26. persons to whom the Software is furnished to do so, subject to the following conditions: <itemizedlist>
  27. <listitem>
  28. <para>The above copyright notice and this permission notice shall be included in all
  29. copies or substantial portions of the Software.</para>
  30. </listitem>
  31. <listitem>
  32. <para>Except as contained in this notice, the names of individuals credited with
  33. contribution to this software shall not be used in advertising or otherwise to promote
  34. the sale, use or other dealings in this Software without prior written authorization
  35. from the individuals in question.</para>
  36. </listitem>
  37. <listitem>
  38. <para>Any stylesheet derived from this Software that is publicly distributed will be
  39. identified with a different name and the version strings in any derived Software will
  40. be changed so that no possibility of confusion between the derived package and this
  41. Software will exist.</para>
  42. </listitem>
  43. </itemizedlist></para>
  44. <formalpara>
  45. <title>Warranty:</title>
  46. <para>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  47. INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  48. PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DAVID CRAMER, KASUN GAJASINGHE, OR ANY
  49. OTHER CONTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  50. ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  51. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</para>
  52. </formalpara>
  53. <para>This package is maintained by Kasun Gajasinghe,
  54. <email>kasunbg AT gmail DOT com</email> and David Cramer,
  55. <email>david AT thingbag DOT net</email> and with
  56. contributions by Arun Bharadwaj and Visitha Baddegama. Please
  57. direct support questions to the <ulink
  58. url="http://wiki.docbook.org/DocBookDiscussion">DocBook-apps
  59. mailing list</ulink>. </para>
  60. <para>This package also includes the following software written and copyrighted by others:<itemizedlist>
  61. <listitem>
  62. <para>Files in <filename class="directory">template/common/jquery</filename> are
  63. copyrighted by <ulink url="http://jquery.com/">JQuery</ulink> under the MIT License.
  64. The file <filename>jquery.cookie.js</filename> Copyright (c) 2006 Klaus Hartl under
  65. the MIT license.</para>
  66. <indexterm>
  67. <primary>jquery</primary>
  68. </indexterm>
  69. </listitem>
  70. <listitem>
  71. <para>Some files in the <filename class="directory"
  72. >template/search</filename> and <filename
  73. class="directory">indexer</filename> directories were
  74. originally part of N. Quaine's htmlsearch DITA plugin.
  75. The htmlsearch DITA plugin is available from the <ulink
  76. url="http://tech.groups.yahoo.com/group/dita-users/files/Demos/"
  77. >files page</ulink> of the DITA-users yahoogroup. The
  78. htmlsearch plugin was released under a BSD-style
  79. license. See <filename>indexer/license.txt</filename>
  80. for details. <indexterm>
  81. <primary>htmlsearch</primary>
  82. </indexterm>
  83. <indexterm>
  84. <primary>DITA</primary>
  85. <secondary>htmlsearch plugin</secondary>
  86. </indexterm></para>
  87. </listitem>
  88. <listitem>
  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>
  92. </listitem>
  93. <listitem>
  94. <para>Code from the <ulink url="http://lucene.apache.org/">Apache Lucene</ulink> search
  95. engine provides support for tokenizing Chinese, Japanese, and Korean content released
  96. under the Apache 2.0 license. </para>
  97. </listitem>
  98. <listitem>
  99. <para>Code that provides weighted search results and some
  100. other improvements was graciously donated by <ulink
  101. url="http://www.oxygenxml.com">SyncRO Soft
  102. Ltd.</ulink>, the publishers of the oXygen XML
  103. Editor.</para>
  104. </listitem>
  105. <listitem>
  106. <para><ulink url="http://ccil.org/~cowan/XML/tagsoup/"
  107. >TagSoup</ulink>, released under the Apache 2.0
  108. license, makes it possible to index html instead of just
  109. xhtml output. </para>
  110. </listitem>
  111. <listitem>
  112. <para>Cosmetic improvements provided by <ulink
  113. url="http://docs.openstack.org"
  114. >OpenStack</ulink>.</para>
  115. </listitem>
  116. </itemizedlist> Webhelp for DocBook was first developed as a <ulink
  117. url="http://code.google.com/soc/">Google Summer of Code</ulink> project. </para>
  118. </legalnotice>
  119. <copyright>
  120. <year>2008-2012</year>
  121. <holder>Kasun Gajasinghe</holder>
  122. <holder>David Cramer</holder>
  123. </copyright>
  124. <author>
  125. <firstname>David</firstname>
  126. <surname>Cramer</surname>
  127. <email>david AT thingbag DOT net</email>
  128. </author>
  129. <author>
  130. <firstname>Kasun</firstname>
  131. <surname>Gajasinghe</surname>
  132. <email>kasunbg AT gmail DOT com</email>
  133. </author>
  134. <pubdate>January 2012</pubdate>
  135. </bookinfo>
  136. <chapter>
  137. <chapterinfo>
  138. <abstract>
  139. <!-- 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. -->
  140. <para>Overview of the package.</para>
  141. </abstract>
  142. </chapterinfo>
  143. <title>Introduction</title>
  144. <para>A common requirement for technical publications groups is to produce a Web-based help
  145. format that includes a table of contents pane, a search feature, and an index similar to what
  146. you get from the Microsoft HTML Help (.chm) format or Eclipse help. If the content is help for
  147. a Web application that is not exposed to the Internet or requires that the user be logged in,
  148. then it is impossible to use services like Google to add search. <indexterm class="singular">
  149. <primary>features</primary>
  150. </indexterm>
  151. <itemizedlist>
  152. <title>Features</title>
  153. <listitem>
  154. <para>Sophisticated CSS-based page layout</para>
  155. </listitem>
  156. <listitem>
  157. <para>Client-side search.<indexterm class="singular">
  158. <primary>search</primary>
  159. <secondary>features</secondary>
  160. </indexterm></para>
  161. <itemizedlist>
  162. <listitem>
  163. <para>Provides full content search of the documentation. Shows the search results with
  164. links to chunked pages, and a small description.</para>
  165. </listitem>
  166. <listitem>
  167. <para>Search results scoring/rating - The results are weighted according to how many
  168. times the words in search query appears in it, is it bold or not, is in index terms
  169. etc. The score out of 5 is shown by small colored boxes after each
  170. search-result.</para>
  171. </listitem>
  172. <listitem>
  173. <para>Search results can include brief descriptions of the target.<indexterm
  174. class="singular">
  175. <primary>search</primary>
  176. <secondary>description</secondary>
  177. </indexterm></para>
  178. </listitem>
  179. <listitem>
  180. <para>Stemming support for English, French, and German. Stemming support can be added
  181. for other languages by implementing a stemmer.<indexterm class="singular">
  182. <primary>search</primary>
  183. <secondary>stemming</secondary>
  184. </indexterm></para>
  185. </listitem>
  186. <listitem>
  187. <para>Support for Chinese, Japanese, and Korean languages using code from the Lucene search
  188. engine.</para>
  189. </listitem>
  190. <listitem>
  191. <para>Search highlighting shows where the searched term appears in the results.
  192. <indexterm class="singular">
  193. <primary>search</primary>
  194. <secondary>highlighting</secondary>
  195. </indexterm></para>
  196. </listitem>
  197. </itemizedlist>
  198. </listitem>
  199. <listitem>
  200. <para>Table of contents (TOC) pane with collapsible toc tree.</para>
  201. </listitem>
  202. <listitem>
  203. <para>Auto-synchronization of content pane and TOC.</para>
  204. </listitem>
  205. <listitem>
  206. <para>Nicely placed small forward, backward, top links</para>
  207. </listitem>
  208. <listitem>
  209. <para>TOC and search pane implemented without the use of a frameset.</para>
  210. </listitem>
  211. <listitem>
  212. <para>An Ant script and sample Makefile to generate output.
  213. You can use the ant build file by importing it into your
  214. own or use it as a model for integrating this output
  215. format into your own build system. Alternatively, you can
  216. use the build scripts as a template for creating your own
  217. script. You can also generate webhelp from DocBook using
  218. the <ulink
  219. url="http://docbkx-tools.sourceforge.net/docbkx-samples/manual.html"
  220. >Docbkx Maven plugin</ulink>.</para>
  221. </listitem>
  222. </itemizedlist></para>
  223. </chapter>
  224. <chapter>
  225. <title>Using the package</title>
  226. <para role="summary">The following sections describe how to
  227. install and use the package on Windows with the sample Ant build
  228. script. In an environment where unix shell command are
  229. available, you can also use the
  230. <filename>Makefile.sample</filename> as a starting point for
  231. creating your build script. To use
  232. <filename>Makefile.sample</filename> you must have
  233. <command>xsltproc</command> and <command>java</command>
  234. available in your <envar>PATH</envar>.</para>
  235. <section>
  236. <sectioninfo>
  237. <abstract>
  238. <para>Installation instructions</para>
  239. </abstract>
  240. </sectioninfo>
  241. <title>Generating webhelp output using the Ant build.xml
  242. file</title>
  243. <procedure>
  244. <title>To install the package</title>
  245. <note>
  246. <para>The examples in this procedure assume a Windows
  247. installation, but the process is the same in other
  248. environments, <foreignphrase>mutatis
  249. mutandis</foreignphrase>. In an environment where unix
  250. shell command are available, you can also use the
  251. <filename>Makefile.sample</filename> as a starting point
  252. for creating your build script. To use
  253. <filename>Makefile.sample</filename> you must have
  254. <command>xsltproc</command> and <command>java</command>
  255. available in your <envar>PATH</envar>. You can also use
  256. the <ulink
  257. url="http://docbkx-tools.sourceforge.net/docbkx-samples/manual.html"
  258. >Docbkx Maven plugin</ulink> to generate webhelp.</para>
  259. </note>
  260. <step>
  261. <para>If necessary, install <ulink url="http://www.java.com/en/download/manual.jsp">Java
  262. 1.6</ulink> or higher.</para>
  263. <substeps>
  264. <step>
  265. <para>Confirm that Java is installed and in your <envar>PATH</envar> by typing the
  266. following at a command prompt: <programlisting>java -version</programlisting></para>
  267. <note>
  268. <para>To build the indexer, you must have the JDK.</para>
  269. </note>
  270. </step>
  271. </substeps>
  272. </step>
  273. <step>
  274. <para>If necessary, install <ulink url="http://ant.apache.org/bindownload.cgi">Apache
  275. Ant</ulink> 1.8.0 or higher. See <ulink
  276. url="http://ant.apache.org/manual/install.html">Ant installation instructions</ulink>.</para>
  277. <substeps>
  278. <step>
  279. <para>Unzip the Ant binary distribution to a convenient location on your system. For
  280. example: <filename>c:\Program Files</filename>.</para>
  281. </step>
  282. <step>
  283. <para>Set the environment variable <envar>ANT_HOME</envar> to the top-level Ant
  284. directory. For example: <filename>c:\Program Files\apache-ant-1.8.0</filename>. <tip>
  285. <para>See <ulink url="http://support.microsoft.com/kb/310519">How To Manage
  286. Environment Variables in Windows XP</ulink> for information on setting
  287. environment variables.</para>
  288. </tip></para>
  289. </step>
  290. <step>
  291. <para>Add the Ant <filename>bin</filename> directory to your <envar>PATH</envar>. For
  292. example: <filename>c:\Program Files\apache-ant-1.8.0\bin</filename></para>
  293. </step>
  294. <step>
  295. <para>Confirm that Ant is installed by typing the following at a command prompt:
  296. <programlisting>ant -version</programlisting></para>
  297. <note>
  298. <para>If you see a message about the file <filename>tools.jar</filename> being
  299. missing, you can safely ignore it.</para>
  300. </note>
  301. </step>
  302. </substeps>
  303. </step>
  304. <step>
  305. <para>Download <ulink url="http://prdownloads.sourceforge.net/saxon/saxon6-5-5.zip">Saxon
  306. 6.5.x</ulink> and unzip the distribution to a convenient location on your file system.
  307. You will use the path to <filename>saxon.jar</filename> in <xref
  308. linkend="edit-build-properties"/> below.<note>
  309. <para>The <filename>build.xml</filename> has only been tested with Saxon 6.5, though
  310. it could be adapted to work with other XSLT processors. However, when you generate
  311. output, the Saxon jar must <emphasis role="bold">not</emphasis> be in your
  312. <envar>CLASSPATH</envar>.</para>
  313. </note></para>
  314. </step>
  315. <step>
  316. <para>Download <ulink
  317. url="https://xerces.apache.org/xerces2-j/">Xerces2
  318. Java</ulink> and extract it to a convenient location on
  319. your file system. You will need the
  320. <filename>xercesImpl.jar</filename> and
  321. <filename>xml-apis.jar</filename> from this distribution
  322. in in <xref linkend="edit-build-properties"/>. </para>
  323. </step>
  324. <step id="edit-build-properties">
  325. <para>In a text editor, edit the
  326. <filename>build.properties</filename> file in the
  327. webhelp directory and make the changes indicated by the comments.<important>
  328. <para>You must set appropriate values for
  329. <code>xslt-processor-classpath</code>,
  330. <code>xercesImpl.jar</code>, and
  331. <code>xml-apis.jar</code>.</para>
  332. </important>See the DocBook <ulink
  333. url="../../../doc/html/webhelp.html">reference
  334. documentation</ulink> for detailed information about the
  335. available webhelp and other parameters. Note that not all
  336. DocBook parameters are passed in to the xsls by the
  337. <filename>build.xml</filename> by default. You may need
  338. to modify the <filename>build.xml</filename> to pass in
  339. some DocBook
  340. parameters.<programlisting>
  341. # The path (relative to the build.xml file) to your input document.
  342. # To use your own input document, create a build.xml file of your own
  343. # and import this build.xml.
  344. input-xml=docsrc/readme.xml
  345. # The directory in which to put the output files.
  346. # This directory is created if it does not exist.
  347. output-dir=docs
  348. # If you are using a customization layer that imports webhelp.xsl, use
  349. # this property to point to it.
  350. stylesheet-path=${ant.file.dir}/xsl/webhelp.xsl
  351. # If your document has image directories that need to be copied
  352. # to the output directory, you can list patterns here.
  353. # See the Ant documentation for fileset for documentation
  354. # on patterns.
  355. #input-images-dirs=images/**,figures/**,graphics/**
  356. # By default, the ant script assumes your images are stored
  357. # in the same directory as the input-xml. If you store your
  358. # image directories in another directory, specify it here.
  359. # and uncomment this line.
  360. #input-images-basedir=/path/to/image/location
  361. <emphasis># Modify the follosing so that they point to your local
  362. # copy of the jars indicated:
  363. # * Saxon 6.5 jar
  364. # * Xerces 2: xercesImpl.jar
  365. # * xml-commons: xml-apis.jar
  366. xslt-processor-classpath=/usr/share/java/saxon-6.5.5.jar
  367. xercesImpl.jar=/usr/share/java/xercesImpl.jar
  368. xml-apis.jar=/usr/share/java/xml-apis.jar
  369. </emphasis>
  370. # For non-ns version only, this validates the document
  371. # against a dtd.
  372. validate-against-dtd=true
  373. # The extension for files to be indexed (html/htm/xhtml etc.)
  374. html.extension=html
  375. # Set this to false if you don't need a search tab.
  376. webhelp.include.search.tab=true
  377. # indexer-language is used to tell the search indexer which language
  378. # the docbook is written. This will be used to identify the correct
  379. # stemmer, and punctuations that differs from language to language.
  380. # see the documentation for details. en=English, fr=French, de=German,
  381. # zh=Chinese, ja=Japanese etc.
  382. webhelp.indexer.language=en
  383. # Enables/Disables stemming
  384. # Stemming allows better querying for the search
  385. enable.stemming=true
  386. # Set admon.graphics to 1 to user graphics for note, tip, etc.
  387. admon.graphics=0
  388. suppress.footer.navigation=0</programlisting></para>
  389. </step>
  390. <step>
  391. <para>Test the package by running the command <code>ant
  392. webhelp -Doutput-dir=test-ouput</code> at the command
  393. line in the webhelp directory. It should generate a copy
  394. of this documentation in the <filename class="directory"
  395. >doc</filename> directory. Type <code>start
  396. test-output\index.html</code> to open the output in a
  397. browser. Once you have confirmed that the process worked,
  398. you can delete the <filename class="directory"
  399. >test-output</filename> directory. </para>
  400. </step>
  401. <step>
  402. <para>To process your own document, simply refer to this package from another
  403. <filename>build.xml</filename> in arbitrary location on your system:</para>
  404. <substeps>
  405. <step>
  406. <para>Create a new <filename>build.xml</filename> file that defines the name of your
  407. source file, the desired output directory, and imports the
  408. <filename>build.xml</filename> from this package. For example:
  409. <programlisting>&lt;project&gt;
  410. &lt;property name="input-xml" value="<replaceable>path-to/yourfile.xml</replaceable>"/&gt;
  411. &lt;property name="input-images-dirs" value="<replaceable>images/** figures/** graphics/**</replaceable>"/&gt;
  412. &lt;property name="output-dir" value="<replaceable>path-to/desired-output-dir</replaceable>"/&gt;
  413. &lt;import file="<replaceable>path-to/docbook-webhelp/</replaceable>build.xml"/&gt;
  414. &lt;/project&gt;</programlisting></para>
  415. </step>
  416. <step>
  417. <para>From the directory containing your newly created <filename>build.xml</filename>
  418. file, type <code>ant webhelp</code> to build your document.</para>
  419. </step>
  420. </substeps>
  421. </step>
  422. </procedure>
  423. </section>
  424. <section>
  425. <title>Using and customizing the output</title>
  426. <para>To deep link to a topic inside the help set, simply link directly to the page. This help
  427. system uses no frameset, so nothing further is necessary. <tip>
  428. <para>See <ulink url="http://www.sagehill.net/docbookxsl/Chunking.html">Chunking into
  429. multiple HTML files</ulink> in Bob Stayton's <ulink
  430. url="http://www.sagehill.net/docbookxsl/index.html">DocBook XSL: The Complete
  431. Guide</ulink> for information on controlling output file names and which files are
  432. chunked in DocBook.</para>
  433. </tip></para>
  434. <para>When you perform a search, the results can include brief summaries. These are populated
  435. in one of two ways:<itemizedlist>
  436. <listitem>
  437. <para>By adding <sgmltag>role="summary"</sgmltag> to a <sgmltag>para</sgmltag> or
  438. <sgmltag>phrase</sgmltag> in the <sgmltag>chapter</sgmltag> or
  439. <sgmltag>section</sgmltag>.</para>
  440. </listitem>
  441. <listitem>
  442. <para>By adding an <sgmltag>abstract</sgmltag> to the <sgmltag>chapterinfo</sgmltag> or
  443. <sgmltag>sectioninfo</sgmltag> element.</para>
  444. </listitem>
  445. </itemizedlist></para>
  446. <para>To customize the look and feel of the help, study the following css files:<itemizedlist>
  447. <listitem>
  448. <para><filename>docs/common/css/positioning.css</filename>: This handles the Positioning
  449. of DIVs in appropriate positions. For example, it causes the
  450. <code>leftnavigation</code> div to appear on the left, the header on top, and so on.
  451. Use this if you need to change the relative positions or need to change the
  452. width/height etc.</para>
  453. </listitem>
  454. <listitem>
  455. <para><filename>docs/common/jquery/theme-redmond/jquery-ui-1.8.2.custom.css</filename>:
  456. This is the theming part which adds colors and stuff. This is a default theme comes
  457. with <ulink url="http://jqueryui.com/download">jqueryui</ulink> unchanged. You can get
  458. any theme based your interest from this. (Themes are on right navigation bar.) Then
  459. replace the css theme folder (theme-redmond) with it, and change the xsl to point to
  460. the new css.</para>
  461. </listitem>
  462. <listitem>
  463. <para><filename>docs/common/jquery/treeview/jquery.treeview.css</filename>: This styles
  464. the toc Tree. Generally, you don't have to edit this file.</para>
  465. </listitem>
  466. </itemizedlist></para>
  467. <section>
  468. <title>Recommended Apache configurations</title>
  469. <para>If you are serving a long document from an Apache web
  470. server, we recommend you make the following additions or
  471. changes to your <filename>httpd.conf</filename> or
  472. <filename>.htaccess</filename> file. <programlisting>AddDefaultCharSet UTF-8 # <co id="AddDefaultCharSet"/>
  473. # 480 weeks
  474. &lt;FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"&gt; # <co id="CachingSettings"/>
  475. Header set Cache-Control "max-age=290304000, public"
  476. &lt;/FilesMatch&gt;
  477. # 2 DAYS
  478. &lt;FilesMatch "\.(xml|txt)$"&gt;
  479. Header set Cache-Control "max-age=172800, public, must-revalidate"
  480. &lt;/FilesMatch&gt;
  481. # 2 HOURS
  482. &lt;FilesMatch "\.(html|htm)$"&gt;
  483. Header set Cache-Control "max-age=7200, must-revalidate"
  484. &lt;/FilesMatch&gt;
  485. # compress text, html, javascript, css, xml:
  486. AddOutputFilterByType DEFLATE text/plain # <co id="CompressSetting"/>
  487. AddOutputFilterByType DEFLATE text/html
  488. AddOutputFilterByType DEFLATE text/xml
  489. AddOutputFilterByType DEFLATE text/css
  490. AddOutputFilterByType DEFLATE application/xml
  491. AddOutputFilterByType DEFLATE application/xhtml+xml
  492. AddOutputFilterByType DEFLATE application/rss+xml
  493. AddOutputFilterByType DEFLATE application/javascript
  494. AddOutputFilterByType DEFLATE application/x-javascript
  495. # Or, compress certain file types by extension:
  496. &lt;Files *.html&gt;
  497. SetOutputFilter DEFLATE
  498. &lt;/Files&gt;
  499. </programlisting><calloutlist>
  500. <callout arearefs="AddDefaultCharSet">
  501. <para>See <ulink
  502. url="http://www.sagehill.net/docbookxsl/SpecialChars.html"
  503. >Odd characters in HTML output</ulink> in Bob
  504. Stayton's book <citetitle>DocBook XSL: The Complete
  505. Guide</citetitle> for more information about this
  506. setting.</para>
  507. </callout>
  508. <callout arearefs="CachingSettings">
  509. <para>These lines and those that follow cause the
  510. browser to cache various resources such as bitmaps and
  511. JavaScript files. Note that caching JavaScript files
  512. could cause your users to have stale search indexes if
  513. you update your document since the search index is
  514. stored in JavaScript files.</para>
  515. </callout>
  516. <callout arearefs="CompressSetting">
  517. <para>These lines cause the the server to compress html,
  518. css, and JavaScript files and the brower to uncompress
  519. them to improve download performance.</para>
  520. </callout>
  521. </calloutlist></para>
  522. </section>
  523. </section>
  524. <section>
  525. <title>Search indexing</title>
  526. <para>Run <command>ant index</command> in the webhelp directory to index the content. Running
  527. <command>ant webhelp</command> will do the indexing as part of the process as well.</para>
  528. <para>Here's some detailed information about invoking the indexer. The indexing process is
  529. pretty smooth, so probably you doesn't need to be concerned with following details. Webhelp
  530. Ant script does all the needed bits.</para>
  531. <itemizedlist>
  532. <listitem>
  533. <para>Following should be in the CLASSPATH.</para>
  534. <para>
  535. <itemizedlist>
  536. <listitem>
  537. <para><filename>webhelpindexer.jar</filename>,
  538. <filename>lucene-analyzers-3.0.0.jar</filename>,
  539. <filename>lucene-core-3.0.0.jar</filename> - These three are available in the
  540. extensions/ directory of docsbook-xsl-1.76.1, and is automatically fetched to the
  541. webhelp's Ant script. Go for a XSL snapshot if you can which contains the latest
  542. version http://docbook.sourceforge.net/snapshot/</para>
  543. </listitem>
  544. <listitem>
  545. <para><filename>xercesImpl.jar</filename>, <filename> xml-apis.jar</filename> -
  546. These two comes by default with Ant 1.8.0 or prior versions. These are available
  547. under /usr/share/java directory of Linux distributions as well. Else, you may have
  548. to download, and put them to <filename>jre/lib/endorsed</filename>.</para>
  549. </listitem>
  550. </itemizedlist>
  551. </para>
  552. </listitem>
  553. <listitem>
  554. <para>The main class is <classname>com.nexwave.nquindexer.IndexerMain</classname> for the
  555. version 1.76.1+. It's <classname>com.nexwave.nquindexer.IndexerTask</classname> for the
  556. versions 1.76.0 and 1.76.1.</para>
  557. <para>
  558. <itemizedlist>
  559. <listitem>
  560. <para>Needs two parameters as command-line arguments:</para>
  561. <para>
  562. <itemizedlist>
  563. <listitem>
  564. <para>The folder where the files to be indexed reside</para>
  565. </listitem>
  566. </itemizedlist>
  567. <itemizedlist>
  568. <listitem>
  569. <para>(Optional) language. defaults to "en". See build.properties for
  570. details</para>
  571. </listitem>
  572. </itemizedlist>
  573. </para>
  574. </listitem>
  575. </itemizedlist>
  576. <note>
  577. <para>We have changed the way we invoke the webhelp indexer from the Ant Task to
  578. <code>indexertask</code> to direct invocation. This seems to have remove the
  579. <envar>CLASSPATH</envar> issue some people were having.</para>
  580. </note>
  581. </para>
  582. </listitem>
  583. </itemizedlist>
  584. <indexterm>
  585. <primary>search</primary>
  586. <secondary>indexing</secondary>
  587. </indexterm>
  588. <indexterm>
  589. <primary>indexer</primary>
  590. <secondary>CLASSPATH</secondary>
  591. </indexterm>
  592. <para role="summary">To build the indexer, you must have installed the JDK version 1.5 or
  593. higher and set the <envar>ANT_HOME</envar> environment variable. </para>
  594. <indexterm>
  595. <primary>ANT_HOME</primary>
  596. </indexterm>
  597. <indexterm>
  598. <primary>indexer</primary>
  599. <secondary>building</secondary>
  600. </indexterm>
  601. </section>
  602. <section>
  603. <title>Adding support for other (non-CJKV) languages</title>
  604. <para>To support stemming for a language, the search mechanism requires a stemmer implemented
  605. in both Java and JavaScript. The Java version is used by the indexer and the JavaScript
  606. verison is used to stem the user's input on the search form. Currently the search mechanism
  607. supports stemming for English and German. In addition, Java stemmers are included for the
  608. following languages. Therefore, to support these languages, you only need to implement the
  609. stemmer in JavaScript and add it to the template. If you do undertake this task, please
  610. consider contributing the JavaScript version back to this project and to <ulink
  611. url="http://snowball.tartarus.org/texts/stemmersoverview.html">Martin Porter's
  612. project</ulink>.<itemizedlist>
  613. <listitem>
  614. <para>Danish</para>
  615. </listitem>
  616. <listitem>
  617. <para>Dutch</para>
  618. </listitem>
  619. <listitem>
  620. <para>Finnish</para>
  621. </listitem>
  622. <listitem>
  623. <para>Hungarian</para>
  624. </listitem>
  625. <listitem>
  626. <para>Italian</para>
  627. </listitem>
  628. <listitem>
  629. <para>Norwegian</para>
  630. </listitem>
  631. <listitem>
  632. <para>Portuguese</para>
  633. </listitem>
  634. <listitem>
  635. <para>Romanian</para>
  636. </listitem>
  637. <listitem>
  638. <para>Russian</para>
  639. </listitem>
  640. <listitem>
  641. <para>Spanish</para>
  642. </listitem>
  643. <listitem>
  644. <para>Swedish</para>
  645. </listitem>
  646. <listitem>
  647. <para>Turkish</para>
  648. </listitem>
  649. </itemizedlist><indexterm>
  650. <primary>stemming</primary>
  651. </indexterm></para>
  652. </section>
  653. <section>
  654. <title>Adding images</title>
  655. <para>This section shows how to add images to WebHelp. For that, follow the simple procedure given.<itemizedlist>
  656. <listitem>
  657. <para>Put the images in a subdirectory of your source file directory. For example
  658. <filename>docsrc/images</filename>.</para>
  659. </listitem>
  660. <listitem>
  661. <para>Then refer to those images from your docbook document.</para>
  662. <para>Following image is from <emphasis role="bold"
  663. >webhelp/docsrs/images/sample.jpg</emphasis>. The docbook code is shown
  664. below.</para>
  665. <para>
  666. <figure>
  667. <title>Sample Image</title>
  668. <mediaobject>
  669. <imageobject>
  670. <imagedata fileref="images/sample.jpg" format="JPG"/>
  671. </imageobject>
  672. </mediaobject>
  673. </figure>
  674. </para>
  675. <example>
  676. <title>Example code for adding images. Note down the relative path used</title>
  677. <programlisting>&lt;figure>
  678. &lt;title>Sample&lt;/title>
  679. &lt;mediaobject>
  680. &lt;imageobject>
  681. &lt;imagedata fileref="<emphasis role="bold">images/sample.jpg</emphasis>" format="JPG"/>
  682. &lt;/imageobject>
  683. &lt;/mediaobject>
  684. &lt;/figure></programlisting>
  685. </example>
  686. </listitem>
  687. <listitem>
  688. <para> The <filename>build.properties</filename> file controls what directories are copied
  689. over from the source tree to the output
  690. tree:<programlisting># If your document has image directories that need to be copied
  691. # to the output directory, you can list patterns here.
  692. # See the Ant documentation for fileset for documentation
  693. # on patterns.
  694. input-images-dirs=images/**,figures/**,graphics/**</programlisting></para>
  695. </listitem>
  696. </itemizedlist></para>
  697. </section>
  698. </chapter>
  699. <chapter>
  700. <title>Developer Docs</title>
  701. <para role="summary">This chapter provides an overview of how webhelp is implemented.</para>
  702. <para>The table of contents and search panes are implemented as divs and rendered as if they
  703. were the left pane in a frameset. As a result, the page must save the state of the table of
  704. contents and the search in cookies when you navigate away from a page. When you load a new
  705. page, the page reads these cookies and restores the state of the table of contents tree and
  706. search. The result is that the help system behaves exactly as if it were a frameset.</para>
  707. <section>
  708. <title>Design</title>
  709. <para role="summary">An overview of webhelp page structure.</para>
  710. <para>DocBook WebHelp page structure is fully built on css-based design abandoning frameset
  711. structure. Overall page structure can be divided in to three main sections <itemizedlist>
  712. <listitem>
  713. <para>Header: Header is a separate Div which include company logo, navigation
  714. button(prev, next etc.), page title and heading of parent topic.</para>
  715. </listitem>
  716. <listitem>
  717. <para>Content: This includes the content of the documentation. The processing of this
  718. part is done by <ulink
  719. url="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"> DocBook
  720. XSL Chunking customization</ulink>. Few further css-styling applied from
  721. <filename>positioning.css</filename>. </para>
  722. </listitem>
  723. <listitem>
  724. <para>Left Navigation: This includes the table of contents and search tab. This is
  725. customized using <ulink url="http://jqueryui.com/">jquery-ui</ulink> styling.</para>
  726. <itemizedlist>
  727. <listitem>
  728. <para>Tabbed Navigation: The navigation pane is organized in to two tabs. Contents
  729. tab, and Search tab. Tabbed output is achieved using <ulink
  730. url="http://docs.jquery.com/UI/Tabs">JQuery Tabs plugin</ulink>. </para>
  731. </listitem>
  732. <listitem>
  733. <para>Table of Contents (TOC) tree: When building the chunked html from the docbook
  734. file, Table of Contents is generated as an Unordered List (a list made from
  735. <code>&lt;ul> &lt;li></code> tags). When page loads in the browser, we apply
  736. styling to it to achieve the nice look that you see. Styling for TOC tree is done
  737. by a JQuery UI plugin called <ulink
  738. url="http://bassistance.de/jquery-plugins/jquery-plugin-treeview/">
  739. TreeView</ulink>. We can generate the tree easily by following javascript code:
  740. <programlisting>
  741. //Generate the tree
  742. $("#tree").treeview({
  743. collapsed: true,
  744. animated: "medium",
  745. control: "#sidetreecontrol",
  746. persist: "cookie"
  747. });
  748. </programlisting>
  749. </para>
  750. </listitem>
  751. <listitem>
  752. <para>Search Tab: This includes the search feature.</para>
  753. </listitem>
  754. </itemizedlist>
  755. </listitem>
  756. </itemizedlist>
  757. <indexterm>
  758. <primary>design</primary>
  759. </indexterm></para>
  760. </section>
  761. <section>
  762. <title>Search</title>
  763. <para role="summary">Overview design of Search mechanism.</para>
  764. <para>The serching is a fully client-side implementation of querying texts for content
  765. searching. There's no server involved. So, the search queries by the users are processed by
  766. JavaScript inside the browser, and displays the matching results by comparing the query with
  767. a simplified 'index' that too resides in JavaScript. Mainly the search mechanism has two
  768. parts. <itemizedlist>
  769. <listitem>
  770. <para>Indexing: First we need to traverse the content in
  771. the docs folder and index the words in it. This is done
  772. by <filename>webhelpindexer.jar</filename> in
  773. <filename>xsl/extentions/</filename> folder. You can
  774. invoke it by <code>ant index</code> command from the
  775. root of webhelp of directory. The source of
  776. webhelpindexer is now moved to it's own location at
  777. <filename>trunk/xsl-webhelpindexer/</filename>.
  778. Checkout the Docbook trunk svn directory to get this
  779. source. Then, do your changes and recompile it by simply
  780. running <code>ant</code> command. My assumption is that
  781. it can be opened by Netbeans IDE by one click. Or if you
  782. are using IntelliJ Idea, you can simply create a new
  783. project from existing sources. Indexer has extensive
  784. support for features such as word scoring, stemming of
  785. words, and support for languages English, German,
  786. French. For CJK (Chinese, Japanese, Korean) languages,
  787. it uses bi-gram tokenizing to break up the words (since
  788. CJK languages does not have spaces between
  789. words).</para>
  790. <para> When <code>ant index</code> is run, it generates five output files: <itemizedlist>
  791. <listitem>
  792. <para><filename>htmlFileList.js</filename> - This contains an array named
  793. <code>fl</code> which stores details all the files indexed by the indexer.
  794. Further, the doStem in it defines whether stemming should be used. It defaults
  795. to false.</para>
  796. </listitem>
  797. <listitem>
  798. <para><filename>htmlFileInfoList.js</filename> -
  799. This includes some meta data about the indexed
  800. files in an array named <code>fil</code>. It
  801. includes details about file name, file (html)
  802. title, a summary of the content. Format would look
  803. like, <code>fil["4"]= "ch03.html@@@Developer
  804. Docs@@@This chapter provides an overview of how
  805. webhelp is implemented.";</code>
  806. </para>
  807. </listitem>
  808. <listitem>
  809. <para><filename>index-*.js</filename> (Three index files) - These three files
  810. actually stores the index of the content. Index is added to an array named
  811. <code>w</code>.</para>
  812. </listitem>
  813. </itemizedlist></para>
  814. </listitem>
  815. <listitem>
  816. <para> Querying: Query processing happens totally in client side. Following JavaScript
  817. files handles them. <itemizedlist>
  818. <listitem>
  819. <para><filename>nwSearchFnt.js</filename> - This handles the user query and
  820. returns the search results. It does query word tokenizing, drop unnecessary
  821. punctuations and common words, do stemming if docbook language supports it,
  822. etc.</para>
  823. </listitem>
  824. <listitem>
  825. <para><filename>{$indexer-language-code}_stemmer.js</filename> - This includes the
  826. stemming library. <filename>nwSearchFnt.js</filename> file calls
  827. <code>stemmer</code> method in this file for stemming. ex: <code>var stem =
  828. stemmer(foobar);</code>
  829. </para>
  830. </listitem>
  831. </itemizedlist>
  832. </para>
  833. </listitem>
  834. </itemizedlist>
  835. <indexterm>
  836. <primary>search</primary>
  837. </indexterm></para>
  838. <section>
  839. <title>New Stemmers</title>
  840. <para role="summary">Adding new Stemmers is very simple.</para>
  841. <para>Currently, only English, French, and German stemmers are integrated in to WebHelp. But
  842. the code is extensible such that you can add new stemmers easily by few steps.</para>
  843. <para>What you need: <itemizedlist>
  844. <listitem>
  845. <para>You'll need two versions of the stemmer; One written in JavaScript, and another
  846. in Java. But fortunately, Snowball contains Java stemmers for number of popular
  847. languages, and are already included with the package. You can see the full list in
  848. <ulink url="ch02s04.html">Adding support for other (non-CJKV) languages</ulink>.
  849. If your language is listed there, Then you have to find javascript version of the
  850. stemmer. Generally, new stemmers are getting added in to <ulink
  851. url="http://snowball.tartarus.org/otherlangs/index.html">Snowball Stemmers in
  852. other languages</ulink> location. If javascript stemmer for your language is
  853. available, then download it. Else, you can write a new stemmer in JavaScript using
  854. SnowBall algorithm fairly easily. Algorithms are at <ulink
  855. url="http://snowball.tartarus.org/">Snowball</ulink>. </para>
  856. </listitem>
  857. <listitem>
  858. <para>Then, name the JS stemmer exactly like this:
  859. <filename>{$language-code}_stemmer.js</filename>.
  860. For example, for Italian(it), name it as,
  861. <filename>it_stemmer.js</filename>. Then, copy it to
  862. the
  863. <filename>docbook-webhelp/template/search/stemmers/</filename>
  864. folder. (I assumed
  865. <filename>docbook-webhelp</filename> is the root
  866. folder for webhelp.) <note>
  867. <para>Make sure you changed the
  868. <code>webhelp.indexer.language</code> property
  869. in <filename>build.properties</filename> to your
  870. language. </para>
  871. </note>
  872. </para>
  873. </listitem>
  874. <listitem>
  875. <para>Now two easy changes needed for the indexer.</para>
  876. <itemizedlist>
  877. <listitem>
  878. <para>Open
  879. <filename>docbook-webhelp/indexer/src/com/nexwave/nquindexer/IndexerTask.java</filename>
  880. in a text editor and add your language code to the
  881. <code>supportedLanguages</code> String Array. </para>
  882. <example>
  883. <title>Add new language to supportedLanguages array</title>
  884. <para> change the Array from,
  885. <programlisting>
  886. private String[] supportedLanguages= {"en", "de", "fr", "cn", "ja", "ko"};
  887. //currently extended support available for
  888. // English, German, French and CJK (Chinese, Japanese, Korean) languages only.
  889. </programlisting>
  890. To,</para>
  891. <programlisting>
  892. private String[] supportedLanguages= {"en", "de", "fr", "cn", "ja", "ko", <emphasis>"it"</emphasis>};
  893. //currently extended support available for
  894. // English, German, French, CJK (Chinese, Japanese, Korean), and Italian languages only.
  895. </programlisting>
  896. </example>
  897. </listitem>
  898. <listitem>
  899. <para> Now, open
  900. <filename>docbook-webhelp/indexer/src/com/nexwave/nquindexer/SaxHTMLIndex.java</filename>
  901. and add the following line to the code where it initializes the Stemmer (Search
  902. for <code>SnowballStemmer stemmer;</code>). Then add code to initialize the
  903. stemmer Object in your language. It's self understandable. See the example. The
  904. class names are at:
  905. <filename>docbook-webhelp/indexer/src/com/nexwave/stemmer/snowball/ext/</filename>. </para>
  906. <example>
  907. <title>Initialize correct stemmer based on the
  908. <code>webhelp.indexer.language</code> specified</title>
  909. <programlisting>
  910. SnowballStemmer stemmer;
  911. if(indexerLanguage.equalsIgnoreCase("en")){
  912. stemmer = new EnglishStemmer();
  913. } else if (indexerLanguage.equalsIgnoreCase("de")){
  914. stemmer= new GermanStemmer();
  915. } else if (indexerLanguage.equalsIgnoreCase("fr")){
  916. stemmer= new FrenchStemmer();
  917. }
  918. <emphasis>else if (indexerLanguage.equalsIgnoreCase("it")){ //If language code is "it" (Italian)
  919. stemmer= new italianStemmer(); //Initialize the stemmer to <code>italianStemmer</code> object.
  920. } </emphasis>
  921. else {
  922. stemmer = null;
  923. }
  924. </programlisting>
  925. </example>
  926. </listitem>
  927. </itemizedlist>
  928. </listitem>
  929. </itemizedlist>
  930. </para>
  931. <para>That's all. Now run <code>ant build-indexer</code> to compile and build the java code.
  932. Then, run <code>ant webhelp</code> to generate the output from your docbook file. For any
  933. questions, contact us or email to the docbook mailing list
  934. <email>docbook-apps@lists.oasis-open.org</email>.</para>
  935. <indexterm>
  936. <primary>stemmer</primary>
  937. </indexterm>
  938. </section>
  939. </section>
  940. </chapter>
  941. <chapter>
  942. <chapterinfo>
  943. <abstract>
  944. <para>Frequently Asked Questions</para>
  945. </abstract>
  946. </chapterinfo>
  947. <title>FAQ</title>
  948. <qandaset>
  949. <qandaentry>
  950. <question>
  951. <para>On what browsers and operating systems WebHelp has tested extensively?</para>
  952. </question>
  953. <answer>
  954. <para>We tested it with versions of most browsers including Firefox 3.x+, IE 7+, Chrome,
  955. Safari, and iPod/iPhone. The JavaScript codes are mostly jquery plugins, so you’d want
  956. to check the jquery support matrix for details.</para>
  957. </answer>
  958. </qandaentry>
  959. <qandaentry>
  960. <question>
  961. <para>Apart from this demo, where can I find other demos or production deployments of
  962. WebHelp?</para>
  963. </question>
  964. <answer>
  965. <para>There are four production deployments provided in <ulink
  966. url="http://wiki.docbook.org/WebHelp">WebHelp wiki</ulink> currently.</para>
  967. </answer>
  968. </qandaentry>
  969. <qandaentry>
  970. <question>
  971. <para>When building the webhelp output, I'm getting the following error. What's the reason
  972. for this?</para>
  973. <programlisting>[xslt] : Warning! file:/C:/Users/kasun/docbook-xsl-1.77.0/xhtml/autoidx.xsl:
  974. line 596: Attribute 'href' outside of element.
  975. [xslt] : Warning! file:/C:/Users/kasun/docbook-xsl-1.77.0/xhtml/autoidx.xsl:
  976. line 596: Attribute 'href' outside of element.</programlisting>
  977. <para>----</para>
  978. </question>
  979. <answer>
  980. <para>This happens if you haven't done the step 3 and 4 of webhelp build guide "Generating
  981. webhelp output" in the documentation. Basically, you need to correctly set the following
  982. folder
  983. paths.<programlisting>xslt-processor-classpath=/usr/share/java/saxon-6.5.5.jar
  984. xercesImpl.jar=/usr/share/java/xercesImpl.jar
  985. xml-apis.jar=/usr/share/java/xml-apis.jar</programlisting></para>
  986. </answer>
  987. </qandaentry>
  988. <qandaentry>
  989. <question>
  990. <para>Does WebHelp Indexer can index HTML transformation as well?</para>
  991. </question>
  992. <answer>
  993. <para>Yes, WebHelp supports HTML transformations as well in addition to XHTML.</para>
  994. </answer>
  995. </qandaentry>
  996. <qandaentry>
  997. <question>
  998. <para>I need more information about webhelp-indexer. Where can I find it?</para>
  999. </question>
  1000. <answer>
  1001. <para>The DocBook Webhelp Indexer is based on the HTMLSearch plugin for DITA. See <ulink
  1002. url="http://www.helpml.com:8088/help/index.jsp?topic=/org.sample.help.doc/htmlsearch/DHSC_BestPractices_htmlsearch.html"
  1003. >HTMLSearch documentation </ulink> for more information.</para>
  1004. </answer>
  1005. </qandaentry>
  1006. </qandaset>
  1007. <indexterm>
  1008. <primary>FAQ</primary>
  1009. </indexterm>
  1010. </chapter>
  1011. <xi:include href="xinclude-test.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
  1012. <index/>
  1013. </book>