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

Commit

Permalink
feat(): allow additional custom types
Browse files Browse the repository at this point in the history
`@name my.module.type:name` => name (type in module my.module)
  • Loading branch information
m7r committed Jun 27, 2013
1 parent 7b7404c commit df3103b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ngdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,11 @@ Doc.prototype = {

html_usage_function: function(dom){
var self = this;
var name = self.name.match(/^angular(\.mock)?\.(\w+)$/) ? self.name : self.name.split(/\./).pop()
var name = self.name.match(/^angular(\.mock)?\.(\w+)$/) ? self.name : self.name.split(/\./).pop();

dom.h('Usage', function() {
dom.code(function() {
dom.text(name);
dom.text(name.split(':').pop());
dom.text('(');
self.parameters(dom, ', ');
dom.text(');');
Expand Down Expand Up @@ -746,7 +746,7 @@ var GLOBALS = /^angular\.([^\.]+)$/,
MODULE_MOCK = /^angular\.mock\.([^\.]+)$/,
MODULE_DIRECTIVE = /^(.+)\.directive:([^\.]+)$/,
MODULE_DIRECTIVE_INPUT = /^(.+)\.directive:input\.([^\.]+)$/,
MODULE_FILTER = /^(.+)\.filter:([^\.]+)$/,
MODULE_CUSTOM = /^(.+)\.([^\.]+):([^\.]+)$/,
MODULE_SERVICE = /^(.+)\.([^\.]+?)(Provider)?$/,
MODULE_TYPE = /^([^\.]+)\..+\.([A-Z][^\.]+)$/;

Expand Down Expand Up @@ -781,10 +781,10 @@ function title(text, overview) {
module = match[1];
name = 'input [' + match[2] + ']';
type = 'directive';
} else if (match = text.match(MODULE_FILTER)) {
} else if (match = text.match(MODULE_CUSTOM)) {
module = match[1];
name = match[2];
type = 'filter';
name = match[3];
type = match[2];
} else if (match = text.match(MODULE_TYPE)) {
module = match[1];
name = match[2];
Expand Down
4 changes: 4 additions & 0 deletions src/templates/index.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@
<a class="code" href="{{module.url}}">{{module.name}}</a>
</li>

<li ng-repeat="page in module.others<%= trackBy('page.url', "'expand'") %>" ng-class="navClass(page)" class="api-list-item">
<a href="{{page.url}}" tabindex="2">{{page.shortName}}</a>
</li>

<li class="nav-header section" ng-show="module.directives">
<a class="guide">directive</a>
</li>
Expand Down
7 changes: 7 additions & 0 deletions src/templates/js/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ docsApp.controller.DocsController = function($scope, $location, $window, section
MODULE_DIRECTIVE = /^(.+)\.directive:([^\.]+)$/,
MODULE_DIRECTIVE_INPUT = /^(.+)\.directive:input\.([^\.]+)$/,
MODULE_FILTER = /^(.+)\.filter:([^\.]+)$/,
MODULE_CUSTOM = /^(.+)\.([^\.]+):([^\.]+)$/,
MODULE_SERVICE = /^(.+)\.([^\.]+?)(Provider)?$/,
MODULE_TYPE = /^([^\.]+)\..+\.([A-Z][^\.]+)$/;

Expand Down Expand Up @@ -367,6 +368,9 @@ docsApp.controller.DocsController = function($scope, $location, $window, section
breadcrumb.push({ name: match[1], url: sectionPath + '/' + match[1] });
breadcrumb.push({ name: 'input' });
breadcrumb.push({ name: match[2] });
} else if (match = partialId.match(MODULE_CUSTOM)) {
breadcrumb.push({ name: match[1], url: sectionPath + '/' + match[1] });
breadcrumb.push({ name: match[3] });
} else if (match = partialId.match(MODULE_TYPE)) {
breadcrumb.push({ name: match[1], url: sectionPath + '/' + match[1] });
breadcrumb.push({ name: match[2] });
Expand Down Expand Up @@ -453,6 +457,8 @@ docsApp.controller.DocsController = function($scope, $location, $window, section
module(match[1], section).directives.push(page);
} else if (match = id.match(MODULE_DIRECTIVE_INPUT)) {
module(match[1], section).directives.push(page);
} else if (match = id.match(MODULE_CUSTOM)) {
module(match[1], section).others.push(page);
} else if (match = id.match(MODULE_TYPE)) {
module(match[1], section).types.push(page);
} else if (match = id.match(MODULE_SERVICE)) {
Expand Down Expand Up @@ -480,6 +486,7 @@ docsApp.controller.DocsController = function($scope, $location, $window, section
globals: [],
directives: [],
services: [],
others: [],
service: function(name) {
var service = cache[this.name + ':' + name];
if (!service) {
Expand Down

0 comments on commit df3103b

Please sign in to comment.