X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JsTemplate%2FLink.js;h=2e2d6f1f57f28f1af60e16483a294c8e5a3c0c2e;hp=a84e96f6eef063a8dc3ad228cafd0b0403a5e815;hb=3af26e7f7a33e18cb4f756df6da99966731753c2;hpb=d56985f1898989ac6236528f762e69837f185914 diff --git a/JsTemplate/Link.js b/JsTemplate/Link.js index a84e96f..2e2d6f1 100644 --- a/JsTemplate/Link.js +++ b/JsTemplate/Link.js @@ -13,47 +13,75 @@ XObject = imports.XObject.XObject; @constructor */ Link = XObject.define( - function () { - this.alias = ""; - this.src = ""; - this.file = ""; - this.text = ""; - this.innerName = ""; - this.classLink = false; - this.targetName = ""; + /* + * constructor + */ + function (opts) { + XObject.extend(this,opts); - this.target = function(targetName) { + }, + Object, + { + + /** + * url {String} url for link.. + */ + url: "", + /** + * text {String} text to show on link. + */ + + text : "", + + /** + * alias {String} not sure? + */ + alias : "", + /** + * src {String} not sure? + */ + src : "", + file : "", + + 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; @@ -70,6 +98,9 @@ Link = XObject.define( } ); } + else if (this.url) { + linkString = thisLink._makeLink(this.url); + } else if (this.src) { linkString = thisLink._makeSrcLink(this.src); } @@ -78,10 +109,13 @@ Link = XObject.define( } return linkString; - } - }, - Object, - { + }, + + + + + + /** Create a link to a snother symbol. */ _makeSymbolLink : function(alias) { @@ -127,11 +161,11 @@ Link = XObject.define( if (!linkTo.is("CONSTRUCTOR") && !linkTo.isNamespace) { // it's a method or property linkPath = escape(linkTo.memberOf) || "_global_"; - linkPath += import.JSDOC.Options.Options.ext + "#" + Link.symbolNameToLinkName(linkTo); + linkPath += imports.JSDOC.Options.Options.ext + "#" + Link.symbolNameToLinkName(linkTo); } else { linkPath = escape(linkTo.alias); - linkPath += import.JSDOC.Options.Options.ext + (this.classLink? "":"#" + Link.hashPrefix + "constructor"); + linkPath += imports.JSDOC.Options.Options.ext + (this.classLink? "":"#" + Link.hashPrefix + "constructor"); } //linkPath = linkBase + linkPath; fullLinkPath = linkBase + linkPath; @@ -157,9 +191,9 @@ Link = XObject.define( var srcFile = srcFilePath.replace(/\.\.?[\\\/]/g, "").replace(/[:\\\/]/g, "."); // was _ var lsrcFile = srcFilePath.replace(/\.\.?[\\\/]/g, "").replace(/[:\\\/]/g, "."); var outFilePath = Link.base + '/symbols/' + srcFile.replace(/.js$/, '') + - import.JSDOC.Options.Options.publishExt; + imports.JSDOC.Options.Options.publishExt; - if (!this.text) this.text = FilePath.fileName(srcFilePath); + if (!this.text) this.text = srcFilePath; //FilePath.fileName(srcFilePath); return ""+this.text+""; },