Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
passim: update jsdoc local plugin
Browse files Browse the repository at this point in the history
Mostly this allows reduction of `{@link Foo|Foo}` to `{@link Foo}`.  It
doesn't seem to work for values that are defined as properties on
`exports`.

Also remove some old `@constructor` annotations left over from the
pre-ES6 version.  Apparently `@augments` is still necessary.
  • Loading branch information
pabigot committed Mar 14, 2018
1 parent 5b4eb92 commit 149ed6d
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 133 deletions.
17 changes: 14 additions & 3 deletions jsdoc/custom/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,20 @@ function buildRE(prefix, tag) {
exports.handlers = {
jsdocCommentFound: function(e) {
if (thisModule) for (var local in registry) {
var sv = '$1'+thisModule+'~'+'$2';
e.comment = e.comment.replace(buildRE('{', local), sv);
e.comment = e.comment.replace(buildRE('{@link\\s*\\*?\\s*', local), sv);
/* Handle {@link local} => {@link module~local|local} (across EOL) */
var re = new RegExp('({@link\\s*\\*?\\s*)\\b(' + local + '\\b[^|}]*)}', 'g');
e.comment = e.comment.replace(re,
'$1' + thisModule + '~$2\|$2}');

/* Handle {local} => {thisModule~local}. Brace reference
* doesn't support providing alternative text. */
e.comment = e.comment.replace(buildRE('{', local),
'$1' + thisModule + '~$2');

/* Handle `@cmd local` => `@cmd thisModule~local` for
* certain commands (across EOL) */
e.comment = e.comment.replace(buildRE('@(event|link|memberof|name)\\s*\\*?\\s*', local),
'$1' + thisModule + '~$3');
}
},

Expand Down
Loading

0 comments on commit 149ed6d

Please sign in to comment.