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

Commit

Permalink
feat(ngdocs): support custom items with @requires
Browse files Browse the repository at this point in the history
  - `@requires $cookie` => `$cookie` href = currentsection/ng.$cookie
  - `@requires module.directive:tabs` => `tabs` href = currentsection/module.directive:tabs
  - `@requires /section2/module.directive:tabs` => `tabs` href = section2/module.directive:tabs
  • Loading branch information
m7r committed Jul 9, 2013
1 parent 468904a commit d0f488c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ngdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Doc.prototype = {
convertUrlToAbsolute: function(url) {
var prefix = this.options.html5Mode ? '' : '#/';
if (url.substr(-1) == '/') return url + 'index';
if (url.match(/\//)) return url;
if (url.match(/\//)) return prefix + url;
return prefix + this.section + '/' + url;
},

Expand Down Expand Up @@ -323,7 +323,9 @@ Doc.prototype = {
}
dom.h('Dependencies', self.requires, function(require){
dom.tag('code', function() {
dom.tag('a', {href: 'api/ng.' + require.name}, require.name);
var id = /[\.\/]/.test(require.name) ? require.name : 'ng.' + require.name,
name = require.name.split(/[\.:#\/]/).pop();
dom.tag('a', {href: self.convertUrlToAbsolute(id)}, name);
});
dom.html(require.text);
});
Expand Down

0 comments on commit d0f488c

Please sign in to comment.