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

Commit

Permalink
Allow service names to be capitalized
Browse files Browse the repository at this point in the history
Angular doesn't prohibit this, and neither should the documentation
system.

This change does require capitalized `Type`s to be explicitly declared,
although I can't find any instances of end-users relying on ngdocs to
implicitly sniff out Types based on capitalization alone...
  • Loading branch information
Andrew Schmadel committed Mar 7, 2014
1 parent 504c4a2 commit a477f22
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions spec/ngdocSpec.js
Expand Up @@ -106,6 +106,13 @@ describe('ngdoc', function() {
expect(doc.links).toContain('api/angular.link');
});

it('should correctly parse capitalized service names', function(){
var doc = new Doc('@ngdoc service\n@name my.module.Service');
doc.parse();
expect(ngdoc.metadata([doc])[0].shortName).toEqual('my.module.Service');
expect(ngdoc.metadata([doc])[0].moduleName).toEqual('my.module');
});

describe('convertUrlToAbsolute', function() {
var doc;

Expand Down
2 changes: 1 addition & 1 deletion src/ngdoc.js
Expand Up @@ -983,7 +983,7 @@ function title(doc) {
return makeTitle('input [' + match[2] + ']', 'directive', 'module', match[1]);
} else if (match = text.match(MODULE_CUSTOM)) {
return makeTitle(match[3], match[2], 'module', match[1]);
} else if (match = text.match(MODULE_TYPE)) {
} else if (match = text.match(MODULE_TYPE) && doc.ngdoc === 'type') {
return makeTitle(match[2], 'type', 'module', module || match[1]);
} else if (match = text.match(MODULE_SERVICE)) {
if (overview) {
Expand Down
2 changes: 1 addition & 1 deletion src/templates/js/docs.js
Expand Up @@ -462,7 +462,7 @@ docsApp.controller.DocsController = function($scope, $location, $window, section
module(page.moduleName || match[1], section).directives.push(page);
} else if (match = id.match(MODULE_CUSTOM)) {
module(page.moduleName || match[1], section).others.push(page);
} else if (match = id.match(MODULE_TYPE)) {
} else if (match = id.match(MODULE_TYPE) && page.type === 'type') {
module(page.moduleName || match[1], section).types.push(page);
} else if (match = id.match(MODULE_SERVICE)) {
if (page.type === 'overview') {
Expand Down

0 comments on commit a477f22

Please sign in to comment.