feat(ngdocs): support for interface documentation

This commit is contained in:
Misko Hevery 2012-01-10 13:46:49 -08:00
parent 3c3e6980b3
commit afd25446d2
4 changed files with 21 additions and 10 deletions

View file

@ -20,7 +20,9 @@ writer.makeDir('build/docs/syntaxhighlighter').then(function() {
ngdoc.merge(docs); ngdoc.merge(docs);
var fileFutures = []; var fileFutures = [];
docs.forEach(function(doc){ docs.forEach(function(doc){
fileFutures.push(writer.output('partials/' + doc.section + '/' + doc.id + '.html', doc.html())); // this hack is here bocause on OSX angular.module and angular.Module map to the same file.
var id = doc.id.replace('angular.Module', 'angular.IModule');
fileFutures.push(writer.output('partials/' + doc.section + '/' + id + '.html', doc.html()));
}); });
writeTheRest(fileFutures); writeTheRest(fileFutures);

View file

@ -456,7 +456,7 @@ Doc.prototype = {
dom.html(this.description); dom.html(this.description);
}, },
html_usage_object: function(dom){ html_usage_interface: function(dom){
var self = this; var self = this;
if (this.param.length) { if (this.param.length) {
@ -477,7 +477,11 @@ Doc.prototype = {
}, },
html_usage_service: function(dom) { html_usage_service: function(dom) {
this.html_usage_object(dom) this.html_usage_interface(dom)
},
html_usage_object: function(dom) {
this.html_usage_interface(dom)
}, },
method_properties_events: function(dom) { method_properties_events: function(dom) {
@ -619,15 +623,18 @@ var KEYWORD_PRIORITY = {
'.index': 1, '.index': 1,
'.guide': 2, '.guide': 2,
'.angular': 7, '.angular': 7,
'.angular.Module': 7,
'.angular.module': 8,
'.angular.mock': 9,
'.angular.module.ng.$filter': 7, '.angular.module.ng.$filter': 7,
'.angular.Object': 7,
'.angular.directive': 7,
'.angular.module.ng.$filter': 7, '.angular.module.ng.$filter': 7,
'.angular.module.ng.$rootScope.Scope': 7, '.angular.module.ng.$rootScope.Scope': 7,
'.angular.module.ng': 7, '.angular.module.ng': 7,
'.angular.inputType': 7,
'.angular.widget': 7,
'.angular.mock': 8, '.angular.mock': 8,
'.angular.directive': 6,
'.angular.inputType': 6,
'.angular.widget': 6,
'.angular.module.ngMock': 8,
'.dev_guide.overview': 1, '.dev_guide.overview': 1,
'.dev_guide.bootstrap': 2, '.dev_guide.bootstrap': 2,
'.dev_guide.mvc': 3, '.dev_guide.mvc': 3,
@ -648,7 +655,7 @@ function keywordSort(a, b){
mangled.push(KEYWORD_PRIORITY[partialName] || 5); mangled.push(KEYWORD_PRIORITY[partialName] || 5);
mangled.push(name); mangled.push(name);
}); });
return doc.section + '/' + mangled.join('.'); return (doc.section + '/' + mangled.join('.')).toLowerCase();
} }
var nameA = mangleName(a); var nameA = mangleName(a);
var nameB = mangleName(b); var nameB = mangleName(b);

View file

@ -49,7 +49,9 @@ function DocsController($location, $window, $cookies, $filter) {
}; };
scope.getCurrentPartial = function() { scope.getCurrentPartial = function() {
return this.partialId ? ('./partials/' + this.sectionId + '/' + this.partialId + '.html') : ''; return this.partialId
? ('./partials/' + this.sectionId + '/' + this.partialId.replace('angular.Module', 'angular.IModule') + '.html')
: '';
}; };
scope.getClass = function(page) { scope.getClass = function(page) {

View file

@ -11,7 +11,7 @@ exports.output = function(file, content) {
var fullPath = OUTPUT_DIR + file; var fullPath = OUTPUT_DIR + file;
var dir = parent(fullPath); var dir = parent(fullPath);
return Q.when(exports.makeDir(dir), function(error) { return Q.when(exports.makeDir(dir), function(error) {
qfs.write(fullPath,exports.toString(content)); qfs.write(fullPath, exports.toString(content));
}); });
}; };