Revert "FEATURE/FIX: jsdoc/util/templateHelper.getAncestorLinks: direct parents punctuation should be part of the link text. <a href="">Parent~</a> vs <a href="">Parent</a>~"

This reverts commit dad08be08a3cc92df3a73f58959c8847b7733a6c.
This commit is contained in:
mathematicalcoffee 2013-02-22 12:46:21 +10:00
parent 32fe768ea7
commit 2a8166cf3b
2 changed files with 6 additions and 7 deletions

View File

@ -285,21 +285,18 @@ exports.getSignatureReturns = function(d, cssClass) {
*/
exports.getAncestorLinks = function(data, doclet, cssClass) {
var ancestors = [],
doc = doclet.memberof,
directParent = false;
doc = doclet.memberof;
while (doc) {
doc = find( data, {longname: doc}, false );
if (doc) { doc = doc[0]; }
if (!doc) { break; }
if (!directParent) { directParent = doc; }
ancestors.unshift( linkto(doc.longname, (exports.scopeToPunc[doc.scope] || '') + doc.name,
cssClass) );
doc = doc.memberof;
}
if (ancestors.length) {
var last = ancestors[ancestors.length - 1];
ancestors[ancestors.length - 1] = last.replace(directParent.name, directParent.name + (exports.scopeToPunc[doclet.scope] || ''));
ancestors[ancestors.length - 1] += (exports.scopeToPunc[doclet.scope] || '');
}
return ancestors;
};

View File

@ -712,7 +712,9 @@ describe("jsdoc/util/templateHelper", function() {
var links = helper.getAncestorLinks(data, lackeys);
expect(links.length).toBe(3);
expect(links).toContain('<a href="henchman.html">~Henchman#</a>');
// BUG: the link text is ~Henchman and there is a '#' on the end.
// should probably have link text ~Henchman#.
//expect(links).toContain('<a href="henchman.html">~Henchman#</a>');
expect(links).toContain('.Sharks');
expect(links).toContain('<a href="mafia_gangs.html">mafia/gangs</a>');
@ -727,7 +729,7 @@ describe("jsdoc/util/templateHelper", function() {
var links = helper.getAncestorLinks(data, lackeys, 'myClass');
expect(links.length).toBe(3);
expect(links).toContain('<a href="henchman.html" class="myClass">~Henchman#</a>');
//expect(links).toContain('<a href="henchman.html" class="myClass">~Henchman#</a>');
expect(links).toContain('.Sharks');
expect(links).toContain('<a href="mafia_gangs.html" class="myClass">mafia/gangs</a>');