]> granicus.if.org Git - docbook-dsssl/commitdiff
Appended the contents of htmlFileList.js to htmlFileInfoList.js
authorKasun Gajasinghe <kasunbg@gmail.com>
Fri, 25 May 2012 17:01:43 +0000 (17:01 +0000)
committerKasun Gajasinghe <kasunbg@gmail.com>
Fri, 25 May 2012 17:01:43 +0000 (17:01 +0000)
xsl-webhelpindexer/src/com/nexwave/nquindexer/IndexerMain.java
xsl-webhelpindexer/src/com/nexwave/nquindexer/WriteJSFiles.java

index d22e7213855a08f584b161e46756fd55bf3ea879..2fdce5fae93f9747f07097ac9bf4afa4e83441a5 100644 (file)
@@ -162,6 +162,7 @@ public class IndexerMain {
      * The main class without Ant dependencies.
      * This can be used as a standalone jar.
      *
+     * @param args
      */
     public static void main(String[] args) {
 
@@ -222,7 +223,7 @@ public class IndexerMain {
         Iterator it;
 
         //File name initialization
-        String htmlList = "htmlFileList.js";
+        String htmlList = "htmlFileInfoList.js";
         String htmlInfoList = "htmlFileInfoList.js";
         String indexName = ".js";
 
@@ -258,7 +259,7 @@ public class IndexerMain {
         // check if outputdir exists
         File tempfile = new File(outputDir);
         if (!tempfile.exists()) {
-            boolean b = (new File(outputDir)).mkdir();
+            boolean b = tempfile.mkdirs();
             if (!b) {
                 System.out.println(txt_cannot_create_outputdir + " " + outputDir + ".");
                 return;
@@ -271,7 +272,6 @@ public class IndexerMain {
         }
         //end of init
 
-
         // Get the list of all html files but the tocs, covers and indexes
         DirList nsiDoc = new DirList(inputDir, "^.*\\." + htmlExtension + "?$", 1);
         htmlFiles = nsiDoc.getListFiles();
@@ -374,9 +374,9 @@ public class IndexerMain {
             Date dateEnd = new Date();
             long diff = dateEnd.getTime() - dateStart.getTime();
             if (diff < 1000)
-                System.out.println("Delay = " + diff + " milliseconds");
+                System.out.println("Indexed the contents in " + diff + " milliseconds");
             else
-                System.out.println("Delay = " + diff / 1000 + " seconds");
+                System.out.println("Indexed the contents in " + diff / 1000 + " seconds");
         } else {
             System.out.println(txt_wrong_dita_basedir);
         }
index f0fd3eaa25c4ce4e5277f19086162cc52f1f48bb..c3b148db38bff79c77d3c96475fd118cd8463c65 100755 (executable)
@@ -1,13 +1,19 @@
 package com.nexwave.nquindexer;
 
-import java.io.*;
+import com.nexwave.nsidita.DocFileInfo;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.TreeSet;
 
-import com.nexwave.nsidita.DocFileInfo;
-
 /**
  * Outputs the js files with:
  * - the list of html files and their description
@@ -44,13 +50,14 @@ public class WriteJSFiles {
         it = list.iterator();
 
         try {
-            // open a outputstream, here a file
+            // open an outputStream, here a file. File is replaced rather than appending
             OutputStream fOut = new FileOutputStream(fileO);
             OutputStream bout = new BufferedOutputStream(fOut);
             OutputStreamWriter out = new OutputStreamWriter(bout, "UTF-8");
 
             /*fl : file list*/
-            out.write("//List of files which are indexed.\n");
+            out.write("var doStem = " + doStem + ";\n");
+            out.write("//List of indexed files.\n");
             out.write("fl = new Array();\n");
             String temp;
             while (it.hasNext()) {
@@ -60,7 +67,6 @@ public class WriteJSFiles {
                 i++;
             }
 
-            out.write("var doStem = " + doStem + "");
             out.flush();  // Don't forget to flush!
             out.close();
 //             System.out.println("the array of html is in " + fileO);
@@ -94,8 +100,8 @@ public class WriteJSFiles {
         }
         it = list.iterator();
         try {
-            // open a outputstream, here a file
-            OutputStream fOut = new FileOutputStream(fileO);
+            // open a outputstream, here a file. The file get appended
+            OutputStream fOut = new FileOutputStream(fileO, true);
             // open a buffer output stream
             OutputStream bout = new BufferedOutputStream(fOut);
             OutputStreamWriter out