Skip to content

Commit

Permalink
Fixes yui#58, crossLink method now accepts :type to get events or att…
Browse files Browse the repository at this point in the history
…ributes
  • Loading branch information
davglass committed Aug 30, 2012
1 parent 444e6b5 commit fff271e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
20 changes: 17 additions & 3 deletions lib/builder.js
Expand Up @@ -194,15 +194,29 @@ YUI.add('doc-builder', function(Y) {
//We have a class + method to parse
var parts = item.split('/'),
cls = parts[0],
method = parts[1];
method = parts[1],
type = 'method';

if (method.indexOf(':') > -1) {
parts = method.split(':');
method = parts[0],
type = parts[1];
if (type.indexOf('attr') === 0) {
type = 'attribute';
}
}

if (cls && method) {
if (self.data.classes[cls]) {
self.data.classitems.forEach(function(i) {
if (i.itemtype === 'method' && i.name === method && i.class === cls) {
if (i.itemtype === type && i.name === method && i.class === cls) {
link = true;
baseItem = method;
href = path.join(base, 'classes', cls + '.html#method_' + method);
var t = type;
if (t === 'attribute') {
t = 'attr';
}
href = path.join(base, 'classes', cls + '.html#' + t + '_' + method);
}
});
}
Expand Down
18 changes: 18 additions & 0 deletions tests/input/test/test.js
Expand Up @@ -168,3 +168,21 @@ crash test method
* @param ev {EventFacade} containing:
* @param [ev.name] {String} Name of the field changed
*/



/**
This method fires {{#crossLink "OtherClass2/changeWithOptional:event"}}{{/crossLink}}
@method crossedEvent
*/

/**
This method has attr {{#crossLink "OtherClass2/requiredAttr:attribute"}}{{/crossLink}}
@method crossedAttr
*/

/**
This method has attr {{#crossLink "OtherClass2/optionalAttr:attr"}}{{/crossLink}}
@method crossOptAttr
*/

0 comments on commit fff271e

Please sign in to comment.