`@alias` tag generates malformed signature
- Dominant language
- JavaScript
- Stars
- 598
- Forks
- 371
- PR merge metrics
- No merged PRs in 30d
Description
When using the `@alias` tag to swap the presented name for a type, the generator fails to add a period in the aliased portion of the display name generated for `@signature`.
E.g.
``` js
/** @alias Buggy */
var foo = {
/** @signature */
bar : function() { }
}
```
will generate a signature `buggyname()` instead of `buggy.name()`.
---
The problem originates from [lines 788-794 of make_default_helpers](https://github.com/bitovi/documentjs/blob/master/lib/generators/html/build/make_default_helpers.js#L788-L794), where a trailing period is appended to the original name as part of the `lastPartOfName` fix-up. That fix-up is erroneously skipped in its entirety for document objects that carry an alias:
``` js
if(parent.type == "prototype"){
var parentParent = docMap[parent.parent];
sig += (parentParent.alias || (lastPartOfName( parentParent.name) +".") ).toLowerCase();
} else {
sig += (parent.alias || lastPartOfName( parent.name)+"." );
}
```
That code should, I am almost sure, read:
``` js
if(parent.type == "prototype"){
var parentParent = docMap[parent.parent];
sig += ( lastPartOfName( parentParent.alias || parentParent.name ) + "." ).toLowerCase();
} else {
sig += lastPartOfName( parent.alias || parent.name ) + ".";
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in lib/generators/html/build/make_default_helpers.js at lines 788-794 and trace how @alias values are assembled into @signature names. Use the JavaScript example in the issue to verify the generated signature, and consider the work done when aliased names include the separating period, such as buggy.name().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100