JSDOC/BuildDocs.js
[gnome.introspection-doc-generator] / JSDOC / BuildDocs.js
index 6499225..fac451d 100644 (file)
@@ -10,7 +10,7 @@ File = imports.File.File;
 
 Template = imports.JsTemplate.Template.Template;
 
-Options = imports.Options.Options;
+
 Parser   = imports.Parser.Parser;
 
 TokenReader = imports.TokenReader.TokenReader;
@@ -21,7 +21,7 @@ Symbol = imports.Symbol.Symbol;
 // should not realy be here -- or anywhere...??
 
 
-
+Options = false; // refer to this everywhere!
 
 
 BuildDocs = {
@@ -31,20 +31,16 @@ BuildDocs = {
     
     srcFiles : [],
     
+    
     build : function (opts)
     {
-        
-        XObject.extend(Options, opts);
-         
+        Options = opts; 
         Options.init();
         
-    
-         
-        
         Options.LOG.inform("JsDoc Toolkit main() running at "+new Date()+".");
-        Options.LOG.inform("With options: ");
+        //Options.LOG.inform("With options: ");
         
-        if (!File.isDirectory(Options.cacheDirectory)) {   
+        if (Options.cacheDirectory.length && !File.isDirectory(Options.cacheDirectory)) {   
             File.mkdir(Options.cacheDirectory)
         }
         
@@ -151,7 +147,7 @@ BuildDocs = {
         
         
         Parser.finish();
-    }
+    },
     
      
         
@@ -281,7 +277,7 @@ BuildDocs = {
         
     },
 
-    publishJSON = function(file, data)
+    publishJSON : function(file, data)
     {
         // what we need to output to be usefull...
         // a) props..
@@ -341,18 +337,23 @@ BuildDocs = {
         
         
     },
-    makeSrcFile: function(path, srcDir, name) 
+    makeSrcFile: function(sourceFile) 
     {
-        if (Options.outputSource) return;
         
-      
-        if (!name) {
-            name = path.replace(/\.\.?[\\\/]/g, "").replace(/[\\\/]/g, "_");
-            name = name.replace(/\:/g, "_");
-        }
         
-         var pretty = PrettyPrint.toPretty(str);
+        name = sourceFile.substring(Options.baseDir.length);
+        name = name.replace(/\.\.?[\\\/]/g, "").replace(/[\\\/]/g, "_");
+        name = name.replace(/\:/g, "_"); //??
+        
         
+        var pretty = imports.PrettyPrint.toPretty(File.read(sourceFile));
+        File.write(Options.target+"/symbols/src/" + name, 
+            '<html><head>' +
+            '<title>' + sourceFile + '</title>' +
+            '<link rel="stylesheet" type="text/css" href="../../../highlight-js.css"/>' + 
+            '</head><body class="highlightpage">' +
+            pretty +
+            '</body></html>');
     }