X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JsTemplate%2FLink.js;h=87f3cf60d286d789d326730618abce54ed8cb771;hp=3868933bf4030410bde9155a86569a2d417e52e3;hb=878ce7ce54e19ea4de3b67389401eea4b4ee3dea;hpb=5ed395123e95393728b4e27329e743e2c18bff10 diff --git a/JsTemplate/Link.js b/JsTemplate/Link.js index 3868933..87f3cf6 100644 --- a/JsTemplate/Link.js +++ b/JsTemplate/Link.js @@ -16,16 +16,33 @@ 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 : "", @@ -65,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 = []; @@ -81,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; },