X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JsTemplate%2FLink.js;h=1eb9c34052959313fa84b0a10a81250332bf2c37;hp=9782aab51c4808715a18578c7be517678b118784;hb=14e21b79f7079d0ab2e206cb05bc7e8ac450089b;hpb=be6319b4fadb93379b8940da688c6cda2f0913f2
diff --git a/JsTemplate/Link.js b/JsTemplate/Link.js
index 9782aab..1eb9c34 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 : "",
@@ -47,7 +64,6 @@ Link = XObject.define(
toSrc : function(filename) {
if (typeof(filename) != 'undefined') this.src = filename;
-
return this;
},
toSymbol : function(alias) {
@@ -66,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 = [];
@@ -82,14 +98,16 @@ Link = XObject.define(
}
);
}
- else if (this.src) {
- linkString = thisLink._makeSrcLink(this.src);
+ if (this.url) {
+ return thisLink._makeLink(this.url);
}
- else if (this.file) {
- linkString = thisLink._makeFileLink(this.file);
+ if (this.src) {
+ return thisLink._makeSrcLink(this.src);
+ }
+ if (this.file) {
+ return thisLink._makeFileLink(this.file);
}
- return linkString;
},
@@ -99,8 +117,9 @@ Link = XObject.define(
/** Create a link to a snother symbol. */
- _makeSymbolLink : function(alias) {
-
+ _makeSymbolLink : function(alias)
+ {
+ //print(JSON.stringify(alias));
// look for '/' in alias..
if (/\//.test(alias)) {
var bits = alias.split('/');
@@ -117,8 +136,9 @@ Link = XObject.define(
- var linkBase = Link.base+ imports.JSDOC.BuildDocs.BuildDocs.symbolsDir;
+ var linkBase = './';
var linkTo = Link.symbolSet.getSymbol(alias);
+
var linkPath;
var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
@@ -142,11 +162,11 @@ Link = XObject.define(
if (!linkTo.is("CONSTRUCTOR") && !linkTo.isNamespace) { // it's a method or property
linkPath = escape(linkTo.memberOf) || "_global_";
- linkPath += imports.JSDOC.Options.Options.ext + "#" + Link.symbolNameToLinkName(linkTo);
+ linkPath += '.html#' + Link.symbolNameToLinkName(linkTo);
}
else {
linkPath = escape(linkTo.alias);
- linkPath += imports.JSDOC.Options.Options.ext + (this.classLink? "":"#" + Link.hashPrefix + "constructor");
+ linkPath += '.html' + (this.classLink? "":"#" + Link.hashPrefix + "constructor");
}
//linkPath = linkBase + linkPath;
fullLinkPath = linkBase + linkPath;
@@ -186,7 +206,16 @@ Link = XObject.define(
if (!this.text) this.text = filePath;
return ""+this.text+"";
+ },
+
+ /** very basic link... */
+ _makeLink : function(url) {
+ var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
+
+ if (!this.text) this.text = url;
+ return ""+this.text+"";
}
+
});