JsTemplate/Link.js
[gnome.introspection-doc-generator] / JsTemplate / Link.js
index 9a3089d..3868933 100644 (file)
@@ -13,47 +13,58 @@ XObject  = imports.XObject.XObject;
        @constructor
 */
 Link = XObject.define(
+    /*
+    * constructor
+    */ 
     function () {
-        this.alias = "";
-        this.src = "";
-        this.file = "";
-        this.text = "";
-        this.innerName = "";
-        this.classLink = false;
-        this.targetName = "";
         
-        this.target = function(targetName) {
+    }, 
+    Object,
+    {
+        
+        alias : "",
+        src : "",
+        file : "",
+        text : "",
+        innerName : "",
+        classLink : false,
+        targetName : "",
+    
+        
+        
+        target : function(targetName) {
             if (typeof(targetName) != 'undefined') this.targetName = targetName;
             return this;
-        }
-        this.inner = function(inner) {
+        },
+        inner : function(inner) {
             if (typeof(inner) != 'undefined') this.innerName = inner;
             return this;
-        }
-        this.withText = function(text) {
+        },
+        withText : function(text) {
             if (typeof(text) != 'undefined') this.text = text;
             return this;
-        }
-        this.toSrc = function(filename) {
+        },
+        toSrc : function(filename) {
             if (typeof(filename) != 'undefined') this.src = filename;
+            
             return this;
-        }
-        this.toSymbol = function(alias) {
+        },
+        toSymbol : function(alias) {
             if (typeof(alias) != 'undefined') {
                 this.alias = new String(alias);
             }
             return this;
-        }
-        this.toClass = function(alias) {
+        },
+        toClass : function(alias) {
             this.classLink = true;
             return this.toSymbol(alias);
-        }
-        this.toFile = function(file) {
+        },
+        toFile : function(file) {
             if (typeof(file) != 'undefined') this.file = file;
             return this;
-        }
+        },
         
-        this.toString = function() {
+        toString : function() {
             var linkString;
             var thisLink = this;
 
@@ -78,10 +89,13 @@ Link = XObject.define(
             }
 
             return linkString;
-        }
-    }, 
-    Object,
-    {
+        },
+        
+        
+        
+        
+        
+        
         
         /** Create a link to a snother symbol. */
         _makeSymbolLink : function(alias) {
@@ -102,7 +116,7 @@ Link = XObject.define(
             
             
             
-            var linkBase = Link.base+JSDOC.publish.conf.symbolsDir;
+            var linkBase = Link.base+  imports.JSDOC.BuildDocs.BuildDocs.symbolsDir;
             var linkTo = Link.symbolSet.getSymbol(alias);
             var linkPath;
             var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
@@ -127,11 +141,11 @@ Link = XObject.define(
 
                 if (!linkTo.is("CONSTRUCTOR") && !linkTo.isNamespace) { // it's a method or property
                     linkPath = escape(linkTo.memberOf) || "_global_";
-                    linkPath += JSDOC.publish.conf.ext + "#" + Link.symbolNameToLinkName(linkTo);
+                    linkPath += imports.JSDOC.Options.Options.ext + "#" + Link.symbolNameToLinkName(linkTo);
                 }
                 else {
                     linkPath = escape(linkTo.alias);
-                    linkPath += JSDOC.publish.conf.ext + (this.classLink? "":"#" + Link.hashPrefix + "constructor");
+                    linkPath += imports.JSDOC.Options.Options.ext + (this.classLink? "":"#" + Link.hashPrefix + "constructor");
                 }
                 //linkPath = linkBase + linkPath;
                 fullLinkPath = linkBase + linkPath;
@@ -141,9 +155,9 @@ Link = XObject.define(
             
             var link = {linkPath: linkPath, linkText: linkText, fullLinkPath: fullLinkPath};
             
-            if (typeof JSDOC.PluginManager != "undefined") {
-                JSDOC.PluginManager.run("onSymbolLink", link);
-            }
+            //if (typeof JSDOC.PluginManager != "undefined") {
+            //    JSDOC.PluginManager.run("onSymbolLink", link);
+            //}
             
             return "<a href=\""+link.fullLinkPath+"\""+target+" roo:cls=\""+link.linkPath+"\">"+link.linkText+"</a>";
         },
@@ -156,9 +170,10 @@ Link = XObject.define(
             // transform filepath into a filename
             var srcFile = srcFilePath.replace(/\.\.?[\\\/]/g, "").replace(/[:\\\/]/g, "."); // was _
             var lsrcFile = srcFilePath.replace(/\.\.?[\\\/]/g, "").replace(/[:\\\/]/g, ".");
-            var outFilePath = Link.base + JSDOC.publish.conf.srcDir + srcFile.replace(/.js$/, '') + JSDOC.publish.conf.ext;
+            var outFilePath = Link.base + '/symbols/' +  srcFile.replace(/.js$/, '') + 
+                imports.JSDOC.Options.Options.publishExt;
             
-            if (!this.text) this.text = FilePath.fileName(srcFilePath);
+            if (!this.text) this.text = srcFilePath; //FilePath.fileName(srcFilePath);
             return "<a href=\""+outFilePath+"\""+target+" roo:cls=\"src/"+lsrcFile+"\">"+this.text+"</a>";
         },