X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JsTemplate%2FLink.js;h=87f3cf60d286d789d326730618abce54ed8cb771;hp=fbed0b2a94f4857af2ccc6de35d897c01e32164f;hb=878ce7ce54e19ea4de3b67389401eea4b4ee3dea;hpb=602613f9dcb0bbf371ebc7de8c38c2afcff85498 diff --git a/JsTemplate/Link.js b/JsTemplate/Link.js index fbed0b2..87f3cf6 100644 --- a/JsTemplate/Link.js +++ b/JsTemplate/Link.js @@ -16,25 +16,37 @@ Link = XObject.define( /* * constructor */ - function () { + function (opts) { + XObject.extend(this,opts); }, 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 : "", - text : "", + innerName : "", classLink : false, targetName : "", - /** - * source Replacement - * eg. '/var/www/xxx:symbol' - */ - srcReplace : false, - + target : function(targetName) { @@ -51,8 +63,6 @@ Link = XObject.define( }, toSrc : function(filename) { if (typeof(filename) != 'undefined') this.src = filename; - if (this.srcReplace( - return this; }, @@ -72,11 +82,11 @@ Link = XObject.define( }, toString : function() { - var linkString; + var thisLink = this; if (this.alias) { - linkString = this.alias.replace(/(^|[^a-z$0-9_#.:-])([|a-z$0-9_#.:-]+)($|[^a-z$0-9_#.:-])/i, + return this.alias.replace(/(^|[^a-z$0-9_#.:-])([|a-z$0-9_#.:-]+)($|[^a-z$0-9_#.:-])/i, function(match, prematch, symbolName, postmatch) { var symbolNames = symbolName.split("|"); var links = []; @@ -88,14 +98,16 @@ Link = XObject.define( } ); } - else if (this.src) { - linkString = thisLink._makeSrcLink(this.src); + if (this.url) { + return thisLink._makeLink(this.url); + } + if (this.src) { + return thisLink._makeSrcLink(this.src); } - else if (this.file) { - linkString = thisLink._makeFileLink(this.file); + if (this.file) { + return thisLink._makeFileLink(this.file); } - return linkString; },