X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JsTemplate%2FLink.js;h=3f1b39172b2e595032f3029b51312b14dc2f0bdb;hp=913d72de3da386619b6076036803c83057736004;hb=d31e045238842d9bb620f65d05c1c246808928fd;hpb=ddf9b16d2638ea4f90b11cd1ac1793e4968fc5fe diff --git a/JsTemplate/Link.js b/JsTemplate/Link.js index 913d72d..3f1b391 100644 --- a/JsTemplate/Link.js +++ b/JsTemplate/Link.js @@ -16,21 +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 : "", - srcReplace : false, - + target : function(targetName) { @@ -47,8 +63,6 @@ Link = XObject.define( }, toSrc : function(filename) { if (typeof(filename) != 'undefined') this.src = filename; - if (this.srcReplace( - return this; }, @@ -72,7 +86,7 @@ Link = XObject.define( 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 = []; @@ -84,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; },