input-xml=docsrc/readme.xml
-frameset.base.dir=doc
+stylesheet-path=xsl/webhelp.xsl
+
+# Output directory
+base-dir=doc
# Modify this so that it points to your copy of the Saxon 6.5 jar.
xslt-processor-classpath=c:/workhead/export/saxon/6.5/lib/saxon.jar
<target name="chunk" depends="clean">
- <mkdir dir="${frameset.base.dir}"/>
+ <mkdir dir="${base-dir}"/>
<xslt
in="${input-xml}"
- out="${frameset.base.dir}/dummy.html"
+ out="${base-dir}/dummy.html"
style="${ant.file.dir}/xsl/webhelp.xsl"
scanincludeddirectories="false"
classpath="${xslt-processor-classpath}">
<param name="exclude.search.from.chunked.html" expression="${exclude.search.from.chunked.html}"
if="exclude.search.from.chunked.html"/>
<param name="output_file_name" expression="${output_file_name}"/>
- <param name="frameset.base.dir" expression="${frameset.base.dir}" if="frameset.base.dir"/>
+ <param name="webhelp.base.dir" expression="${base-dir}" if="base-dir"/>
<param name="indexer.language" expression="${indexer-language}" if="indexer-language"/>
<param name="chunk.frameset.start.filename" expression="${chunk.frameset.start.filename}"
if="chunk.frameset.start.filename"/>
</xslt>
- <delete file="${frameset.base.dir}/dummy.html"/>
+ <delete file="${base-dir}/dummy.html"/>
<!-- Copy common content such as js files of tree, css etc. to template folder. They will be copied to doc folder. They are NOT page specific! -->
- <copy todir="${frameset.base.dir}">
+ <copy todir="${base-dir}">
<fileset dir="${ant.file.dir}/template">
<include name="**/*"/>
<exclude name="**/content/search/*.props"/>
</fileset>
</copy>
<!-- We separate this out so we only copy the stopwords list for the indexer language -->
- <copy todir="${frameset.base.dir}">
+ <copy todir="${base-dir}">
<fileset dir="${ant.file.dir}/template">
<include name="**/content/search/default.props"/>
<include name="**/content/search/punctuation.props"/>
</copy>
<!--Deletes all the stemmers that are copied to doc/ folder. Then, adds only the needed stemmer-->
- <delete dir="${frameset.base.dir}/content/search/stemmers"/>
+ <delete dir="${base-dir}/content/search/stemmers"/>
<copy todir="doc/content/search/stemmers/"
file="template/content/search/stemmers/${indexer-language}_stemmer.js"/>
<!-- Very simple-minded copy to handle the source document's images -->
<!-- TODO: Look at html help code that produces a manifest file...list of images -->
<!-- Customize webhelp.xsl to produce ant file to copy images used? -->
- <copy todir="${frameset.base.dir}/content" failonerror="false">
+ <copy todir="${base-dir}/content" failonerror="false">
<fileset dir="${input-images-dir}"/>
</copy>
<classpath refid="nw-cms.jar.path"/>
</taskdef>
- <echo>Indexing html files in ${frameset.base.dir}/content</echo>
+ <echo>Indexing html files in ${base-dir}/content</echo>
- <indexertask htmldir="${frameset.base.dir}/content" indexerLanguage="${indexer-language}"/>
+ <indexertask htmldir="${base-dir}/content" indexerLanguage="${indexer-language}"/>
<delete>
- <fileset dir="${frameset.base.dir}/content/search" includes="*.props"/>
+ <fileset dir="${base-dir}/content/search" includes="*.props"/>
</delete>
<delete file="xx.html"/>
</target>
<target name="clean">
- <delete dir="${frameset.base.dir}"/>
+ <delete dir="${base-dir}"/>
</target>
<target name="help">
\r
// specific dita ot\r
import com.nexwave.nsidita.DocFileInfo;\r
+\r
+//Stemmers\r
import com.nexwave.stemmer.snowball.SnowballStemmer;\r
import com.nexwave.stemmer.snowball.ext.EnglishStemmer;\r
import com.nexwave.stemmer.snowball.ext.GermanStemmer;\r
* @author Kasun Gajasinghe <http://kasunbg.blogspot.com>\r
*/\r
public class SaxHTMLIndex extends SaxDocFileParser{\r
- \r
- //members\r
+\r
//KasunBG: apparently tempDico stores all the keywords and a pointer to the files containing the index in a Map\r
//example: ("keyword1", "0,2,4"), ("docbook", "1,2,5") \r
private Map<String,String> tempDico;\r
tstr = (String)keyIt.next();\r
\r
File fileOut= new File(fileOutStr);\r
- \r
- /* if the key is not a letter, \r
- * create an index file called 0.js in the output directory\r
- */\r
- if (tstr.matches("^[^a-z]{1}.*$")) {\r
- \r
- try {\r
- // open a outputstream, here a file\r
- fOut= new FileOutputStream(fileOut.getParent()+ File.separator + "0" + fileOut.getName());\r
- // open a buffer output stream\r
- bout= new BufferedOutputStream(fOut);\r
- // open a streamwriter\r
- out = new OutputStreamWriter(bout, "UTF-8");\r
- \r
- /* Populate a javascript hashmap: \r
- The key is a word to look for in the index,\r
- The value is the numbers of the files in which the word exists.\r
- Example: w["key"]="file1,file2,file3";*/\r
- out.write("\n");\r
- while ((keyIt.hasNext()) && (tstr.matches("^[^a-z]{1}.*$"))) {\r
- out.write("w[\""+tstr+"\"]"+"= \""+indexMap.get(tstr)+"\";\n");\r
- tstr = (String) keyIt.next();\r
- }\r
-\r
- out.write("\n");\r
- out.flush(); // Don't forget to flush!\r
- out.close();\r
- }\r
\r
- catch (UnsupportedEncodingException e) {\r
- System.out.println(txt_VM_encoding_not_supported);\r
- }\r
- catch (IOException e) {\r
- System.out.println(e.getMessage()); \r
- }\r
- }\r
- \r
- \r
- /* If the key is a letter, \r
- * create an index file called letter.js in the output directory\r
+ /* Writes the index to Three JS files, namely: index-1.js, index-2.js, index-3.js\r
+ * Index will be distributed evenly in these three files. \r
* tstr is the current key\r
- * keyIt is the iterator of the key set*/\r
- \r
- char tempLetter = tstr.charAt(0);\r
- while (keyIt.hasNext() && (tstr.matches("^[a-z]{1}.*$")) ) {\r
- \r
- try {\r
- // open a outputstream, here a file\r
- fOut= new FileOutputStream(fileOut.getParent()+ File.separator + tempLetter + fileOut.getName());\r
- bout= new BufferedOutputStream(fOut);\r
- out = new OutputStreamWriter(bout, "UTF-8");\r
- \r
- /* Populate a javascript hashmap: \r
- The key is a word to look for in the index,\r
- The value is the numbers of the files in which the word exists.\r
- Example: w["key"]="file1,file2,file3";*/\r
- out.write("\n");\r
- while ((keyIt.hasNext()) && (tempLetter == tstr.charAt(0))) {\r
- \r
- out.write("w[\""+tstr+"\"]"+"= \""+indexMap.get(tstr)+"\";\n");\r
- tstr = (String) keyIt.next();\r
- }\r
- tempLetter = tstr.charAt(0);\r
- out.write("\n");\r
- out.flush(); // Don't forget to flush!\r
- out.close();\r
- }\r
- catch (UnsupportedEncodingException e) {\r
- System.out.println(txt_VM_encoding_not_supported);\r
- }\r
- catch (IOException e) {\r
- System.out.println(e.getMessage()); \r
- }\r
- }\r
- \r
- /* After processing the keys starting with a letter, \r
- * do a last pass for other remaining char.\r
- */\r
- \r
- try {\r
- // open a outputstream, here a file\r
- fOut= new FileOutputStream(fileOut.getParent()+ File.separator + "1" + fileOut.getName());\r
- bout= new BufferedOutputStream(fOut);\r
- out = new OutputStreamWriter(bout, "UTF-8");\r
- \r
- /* Populate a javascript hashmap: \r
- The key is a word to look for in the index,\r
- The value is the numbers of the files in which the word exists.\r
- Example: w["key"]="file1,file2,file3";*/\r
- out.write("\n");\r
- while ((keyIt.hasNext())) {\r
- out.write("w[\""+tstr+"\"]"+"= \""+indexMap.get(tstr)+"\";\n");\r
- tstr = (String) keyIt.next();\r
- }\r
- out.write("w[\""+tstr+"\"]"+"= \""+indexMap.get(tstr)+"\";\n");\r
- tempLetter = tstr.charAt(0);\r
- out.write("\n");\r
- out.flush(); // Don't forget to flush!\r
- out.close();\r
- }\r
- catch (UnsupportedEncodingException e) {\r
- System.out.println(txt_VM_encoding_not_supported);\r
- }\r
- catch (IOException e) {\r
- System.out.println(e.getMessage()); \r
- }\r
+ * keyIt is the iterator of the key set\r
+ * */\r
+ int indexSize = sortedKeys.size(); \r
+ for (int i = 1; i <= 3; i++) {\r
+ try {\r
+ // open a outputstream, here a file\r
+ fOut = new FileOutputStream(fileOut.getParent() + File.separator + "index-" + i + fileOut.getName());\r
+ bout = new BufferedOutputStream(fOut);\r
+ out = new OutputStreamWriter(bout, "UTF-8");\r
\r
+ try {\r
+ /* Populate a javascript hashmap:\r
+ The key is a word to look for in the index,\r
+ The value is the numbers of the files in which the word exists.\r
+ Example: w["key"]="file1,file2,file3";*/\r
+ int count = 0;\r
+ out.write("//Auto generated index for searching.\n");\r
+ while (keyIt.hasNext()) { //&& (tempLetter == tstr.charAt(0)) \r
+ out.write("w[\"" + tstr + "\"]" + "=\"" + indexMap.get(tstr) + "\";\n");\r
+ tstr = (String) keyIt.next();\r
+ count++;\r
+ if (indexSize / count < 3){\r
+ break;\r
+ }\r
+ } \r
+ out.write("\n");\r
+ out.flush(); // Don't forget to flush!\r
+ out.close();\r
+ }\r
+ catch (UnsupportedEncodingException e) {\r
+ System.out.println(txt_VM_encoding_not_supported);\r
+ }\r
+ }\r
+ catch (IOException e) {\r
+ System.out.println(e.getMessage());\r
+ }\r
+ } \r
System.out.println(txt_indices_location + fileOutStr);\r
}\r
}\r
-body {
- font: 12px Verdana, Geneva, sans-serif;
-}
-
-p, ul, ol, li {
- font: 10pt Verdana, Geneva, sans-serif;
-}
-
-h1 {
- font: bold 15pt Arial, Helvetica, geneva;
-}
-
-h2 {
- font: bold 14pt Arial, Helvetica, geneva;
-}
+body { font: 12px Verdana, Geneva, sans-serif; }
+p, ul, ol, li { font: 10pt Verdana, Geneva, sans-serif; }
+h1 { font: bold 15pt Arial, Helvetica, geneva; }
+h2 { font: bold 14pt Arial, Helvetica, geneva; }
#header {
background: white url(../images/gov-header-bg.gif) repeat-x;
z-index: 1000;
}
-#content h1, #content h2 {
- color: #cc0000;
-}
+#content h1, #content h2 { color: #cc0000; }
-.navfooter {
- bottom: 2%;
-}
+.navfooter { bottom: 2%; }
+
+/* Show Hide TOC tree */
.pointLeft {
background: url("../images/showHideTreeIcons.png") 0 0 no-repeat;
width: 15px;
display: block;
font-size: 0;
+ cursor: pointer;
}
.pointRight {
height: 28px;
display: block;
font-size: 0;
-}
+ cursor: pointer;
+}
-/* Search results */
+/* Search results Styling */
.searchExpression {
color: #0050A0;
background-color: #EBEFF8;
font-size: 12pt;
-
}
-ul.searchresult li a {
+.searchresult li a {
text-decoration: none;
color: #0050A0;
-
}
-ul.searchresult li {
+.searchresult li {
color: #0050A0;
}
-
-.shortdesc {
- color: #0053AC;
- margin-bottom: 30px;
- margin-left: 20px;
-}
-
.shortdesclink {
color: gray;
font-size: 9pt;
}
-
.searchText {
border: #BFCEE9 solid 1pt;
width: 11em
}
-
.searchButton {
background: #EBEFF8;
color: #0050A0;
border: #BFCEE9 solid 1pt;
font-weight: bold;
font-size: 10pt
-}
-
+}
\ No newline at end of file
+++ /dev/null
-/*----------------------------------------------------------------------------\r
- * NexWave javascript for NSI search\r
- *----------------------------------------------------------------------------\r
- This file is part of the htmlsearch plugin for the DITA-OT\r
- adapted for NSI documentation.\r
- Copyright (c) 2007-2008 NexWave Solutions All Rights Reserved. \r
- www.nexwave.biz Nadege Quaine\r
-*/\r
-var w = new Object();\r
-\r
-var mzBrowser;\r
-var IEBrowser;\r
-\r
-if (navigator.appName.indexOf("Netscape") >= 0) {\r
- mzBrowser = true;\r
- IEBrowser = false;\r
-\r
-}else if (navigator.appName.indexOf("Internet Explorer") >=0) {\r
- mzBrowser = false;\r
- IEBrowser = true;\r
-}else if (navigator.appName.indexOf("Opera") >=0) {\r
- operaBrowser = true;\r
-}else{\r
- alert(txt_browser_not_supported)\r
-}\r
-\r
+++ /dev/null
-/*----------------------------------------------------------------------------\r
- * NexWave javascript for NSI search\r
- *----------------------------------------------------------------------------\r
- This file is part of the htmlsearch plugin for the DITA-OT\r
- adapted for NSI documentation.\r
- Copyright (c) 2007-2008 NexWave Solutions All Rights Reserved. \r
- www.nexwave.biz Nadege Quaine\r
-*/\r
-if (true) {\r
- var tab = new Array("htmlFileList","htmlFileInfoList","0","1","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");\r
- \r
- var headEl = document.getElementsByTagName('head').item(0);\r
- for (el in tab) {\r
- script = document.createElement('script');\r
- \r
- var scriptTag = document.getElementById('loadScript' + tab[el]);\r
- if(scriptTag) headEl.removeChild(scriptTag);\r
- \r
- script.src = "search/" + tab[el]+ ".js";\r
- script.id = 'loadScript'+tab[el];\r
- script.type = 'text/javascript';\r
- script.defer = true;\r
- headEl.appendChild(script);\r
- } \r
-}\r
-\r
-\r
<xsl:param name="chunk.frameset.start.filename">index.html</xsl:param>
<xsl:param name="output_file_name">readme</xsl:param>
<xsl:param name="chunked.toc.all.open">1</xsl:param>
- <xsl:param name="frameset.base.dir">doc</xsl:param>
+ <xsl:param name="webhelp.base.dir">doc</xsl:param>
<xsl:param name="generate.web.xml">0</xsl:param>
<xsl:param name="direction.align.start">left</xsl:param>
<xsl:param name="direction.align.end">right</xsl:param>
<xsl:param name="navig.showtitles">0</xsl:param>
<xsl:param name="manifest.in.base.dir" select="0"/>
- <xsl:param name="base.dir" select="concat($frameset.base.dir,'/content/')"/>
+ <xsl:param name="base.dir" select="concat($webhelp.base.dir,'/content/')"/>
<xsl:param name="suppress.navigation">0</xsl:param>
<xsl:param name="generate.index" select="1"/>
<xsl:param name="inherit.keywords" select="'0'"/>
//The id for tree cookie
var treeCookieId = "<xsl:value-of select="$tree.cookie.id"/>";
var language = "<xsl:value-of select="$indexer.language"/>";
-
+ var w = new Object();
//Localization
txt_filesfound = '<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'txt_filesfound'"/>
<link rel="stylesheet" type="text/css" href="../common/jquery/treeview/jquery.treeview.css"/>
<script type="text/javascript" src="../common/jquery/jquery-1.4.2.min.js">
- <xsl:comment></xsl:comment>
+ <xsl:comment> </xsl:comment>
</script>
<script type="text/javascript" src="../common/jquery/jquery-ui-1.8.2.custom.min.js">
- <xsl:comment></xsl:comment>
+ <xsl:comment> </xsl:comment>
</script>
<script type="text/javascript" src="../common/jquery/jquery.cookie.js">
- <xsl:comment></xsl:comment>
+ <xsl:comment> </xsl:comment>
</script>
<script type="text/javascript" src="../common/jquery/treeview/jquery.treeview.min.js">
- <xsl:comment></xsl:comment>
+ <xsl:comment> </xsl:comment>
</script>
<!--Scripts/css stylesheets for Search-->
- <script type="text/javascript" src="search/addition.js">
- <xsl:comment></xsl:comment>
+ <script type="text/javascript" src="search/htmlFileList.js">
+ <xsl:comment> </xsl:comment>
</script>
-
- <script type="text/javascript" src="search/indexLoader.js">
- <xsl:comment></xsl:comment>
+ <script type="text/javascript" src="search/htmlFileInfoList.js">
+ <xsl:comment> </xsl:comment>
</script>
-
<script type="text/javascript" src="search/nwSearchFnt.js">
+ <xsl:comment> </xsl:comment>
+ </script>
+
+ <!--script type="text/javascript" src="search/addition.js">
<xsl:comment></xsl:comment>
</script>
+ <script type="text/javascript" src="search/indexLoader.js">
+ <xsl:comment></xsl:comment>
+ </script-->
+
<!--
NOTE: Stemmer javascript files should be in format <language>_stemmer.js.
<script type="text/javascript" src="{concat('search/stemmers/',$indexer.language,'_stemmer.js')}">
<xsl:comment>//make this scalable to other languages as well.</xsl:comment>
</script>
+
+ <!--Index Files:
+ Index is broken in to three equal sized(number of index items) files. This is to help parallel downloading
+ of files to make it faster.-->
+ <script type="text/javascript" src="search/index-1.js">
+ <xsl:comment> </xsl:comment>
+ </script>
+ <script type="text/javascript" src="search/index-2.js">
+ <xsl:comment> </xsl:comment>
+ </script>
+ <script type="text/javascript" src="search/index-3.js">
+ <xsl:comment> </xsl:comment>
+ </script>
+ <!--End of index files -->
</xsl:template>
<xsl:template name="user.header.navigation">
</xsl:template>
<xsl:template name="user.header.content">
- <div>
- <a id="showHideButton" onclick="showHideToc();" class="pointLeft" title="Hide TOC tree">.</a>
- </div>
+ <a id="showHideButton" onclick="showHideToc();"
+ class="pointLeft" title="Hide TOC tree" style="padding-top:3px; padding-bottom:3px;">.</a>
</xsl:template>
<xsl:template name="user.footer.navigation">
<xsl:attribute name="id">webhelp-currentid</xsl:attribute>
</xsl:if>
<span class="file">
- <a href="{substring-after($href,concat($frameset.base.dir,'/content/'))}">
+ <a href="{substring-after($href,concat($webhelp.base.dir,'/content/'))}">
<xsl:value-of select="$title"/>
</a>
</span>
<!-- </xsl:if> -->
<xsl:choose>
<xsl:when test="$chunk.frameset.start.filename">
- <xsl:value-of select="concat($frameset.base.dir,'/',$chunk.frameset.start.filename)"/>
+ <xsl:value-of select="concat($webhelp.base.dir,'/',$chunk.frameset.start.filename)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'index.html'"/>
<xsl:template name="web.xml">
<xsl:call-template name="write.chunk">
<xsl:with-param name="filename">
- <xsl:value-of select="concat($frameset.base.dir,'/web.xml')"/>
+ <xsl:value-of select="concat($webhelp.base.dir,'/web.xml')"/>
</xsl:with-param>
<xsl:with-param name="method" select="'xml'"/>
<xsl:with-param name="encoding" select="'utf-8'"/>