Skip to content

Commit afd2544

Browse files
committed
feat(ngdocs): support for interface documentation
1 parent 3c3e698 commit afd2544

4 files changed

Lines changed: 21 additions & 10 deletions

File tree

docs/src/gen-docs.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ writer.makeDir('build/docs/syntaxhighlighter').then(function() {
2020
ngdoc.merge(docs);
2121
var fileFutures = [];
2222
docs.forEach(function(doc){
23-
fileFutures.push(writer.output('partials/' + doc.section + '/' + doc.id + '.html', doc.html()));
23+
// this hack is here bocause on OSX angular.module and angular.Module map to the same file.
24+
var id = doc.id.replace('angular.Module', 'angular.IModule');
25+
fileFutures.push(writer.output('partials/' + doc.section + '/' + id + '.html', doc.html()));
2426
});
2527

2628
writeTheRest(fileFutures);

docs/src/ngdoc.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ Doc.prototype = {
456456
dom.html(this.description);
457457
},
458458

459-
html_usage_object: function(dom){
459+
html_usage_interface: function(dom){
460460
var self = this;
461461

462462
if (this.param.length) {
@@ -477,7 +477,11 @@ Doc.prototype = {
477477
},
478478

479479
html_usage_service: function(dom) {
480-
this.html_usage_object(dom)
480+
this.html_usage_interface(dom)
481+
},
482+
483+
html_usage_object: function(dom) {
484+
this.html_usage_interface(dom)
481485
},
482486

483487
method_properties_events: function(dom) {
@@ -619,15 +623,18 @@ var KEYWORD_PRIORITY = {
619623
'.index': 1,
620624
'.guide': 2,
621625
'.angular': 7,
626+
'.angular.Module': 7,
627+
'.angular.module': 8,
628+
'.angular.mock': 9,
622629
'.angular.module.ng.$filter': 7,
623-
'.angular.Object': 7,
624-
'.angular.directive': 7,
625630
'.angular.module.ng.$filter': 7,
626631
'.angular.module.ng.$rootScope.Scope': 7,
627632
'.angular.module.ng': 7,
628-
'.angular.inputType': 7,
629-
'.angular.widget': 7,
630633
'.angular.mock': 8,
634+
'.angular.directive': 6,
635+
'.angular.inputType': 6,
636+
'.angular.widget': 6,
637+
'.angular.module.ngMock': 8,
631638
'.dev_guide.overview': 1,
632639
'.dev_guide.bootstrap': 2,
633640
'.dev_guide.mvc': 3,
@@ -648,7 +655,7 @@ function keywordSort(a, b){
648655
mangled.push(KEYWORD_PRIORITY[partialName] || 5);
649656
mangled.push(name);
650657
});
651-
return doc.section + '/' + mangled.join('.');
658+
return (doc.section + '/' + mangled.join('.')).toLowerCase();
652659
}
653660
var nameA = mangleName(a);
654661
var nameB = mangleName(b);

docs/src/templates/docs.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ function DocsController($location, $window, $cookies, $filter) {
4949
};
5050

5151
scope.getCurrentPartial = function() {
52-
return this.partialId ? ('./partials/' + this.sectionId + '/' + this.partialId + '.html') : '';
52+
return this.partialId
53+
? ('./partials/' + this.sectionId + '/' + this.partialId.replace('angular.Module', 'angular.IModule') + '.html')
54+
: '';
5355
};
5456

5557
scope.getClass = function(page) {

docs/src/writer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exports.output = function(file, content) {
1111
var fullPath = OUTPUT_DIR + file;
1212
var dir = parent(fullPath);
1313
return Q.when(exports.makeDir(dir), function(error) {
14-
qfs.write(fullPath,exports.toString(content));
14+
qfs.write(fullPath, exports.toString(content));
1515
});
1616
};
1717

0 commit comments

Comments
 (0)