jsdoc: Handle renaming of _global_ scope more consistently, also in links.

This commit is contained in:
Jürg Lehni 2011-06-08 13:52:37 +01:00
parent a62b28a6b9
commit 2ed323a73a
3 changed files with 8 additions and 7 deletions

View file

@ -132,10 +132,13 @@ Link.prototype._makeSymbolLink = function(alias, parameters) {
if (parameters) {
parameters = parameters.replace(/\,([^\s])/, ', $1')
}
var linkText = (this.text || (alias == '_global_' && publish.conf.globalName
|| alias)) + (parameters || '');
// if there is no symbol by that name just return the name unaltered
if (!linkTo) {
return this.text || alias + (parameters || '');
return linkText;
} else {
// it's a symbol in another file
if (!linkTo.is("CONSTRUCTOR") && !linkTo.isNamespace) { // it's a method or property
@ -151,8 +154,6 @@ Link.prototype._makeSymbolLink = function(alias, parameters) {
}
linkPath = linkBase + linkPath
}
var linkText= (this.text || alias) + (parameters || '');
var link = {
linkPath: linkPath,

View file

@ -157,8 +157,8 @@ var Render = new function() {
param.operators[name].push(operator);
}
}
var name = param.name == '_global_'
? publish.conf.globalName : param.name;
var name = param.name == '_global_' && publish.conf.globalName
|| param.name;
publish.curClass = {
name: name,
index: {

View file

@ -1,5 +1,5 @@
<div class="reference-class">
<if test="publish.conf.renderMode == 'docs'"><h1>{+ data.name == '_global_' ? publish.conf.globalName : data.name +}</h1></if>
<if test="publish.conf.renderMode == 'docs'"><h1>{+ data.name == '_global_' && publish.conf.globalName || data.name +}</h1></if>
<if test="data.inheritedLinks">
<p> Extends {+ data.inheritedLinks +}</p>
</if>