aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src/reader.js
diff options
context:
space:
mode:
authorMisko Hevery2011-04-29 15:18:27 -0700
committerIgor Minar2011-06-06 22:28:38 -0700
commit11e9572b952e49b01035e956c412d6095533031a (patch)
tree04dbf96802f552693d44c541c0d825a2769e3d57 /docs/src/reader.js
parentb6bc6c2ddf1ae1523ec7e4cb92db209cd6501181 (diff)
downloadangular.js-11e9572b952e49b01035e956c412d6095533031a.tar.bz2
Move documentation under individual headings
Diffstat (limited to 'docs/src/reader.js')
-rw-r--r--docs/src/reader.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/docs/src/reader.js b/docs/src/reader.js
index 300b17f0..f20bc06e 100644
--- a/docs/src/reader.js
+++ b/docs/src/reader.js
@@ -9,15 +9,13 @@ var fs = require('fs'),
var NEW_LINE = /\n\r?/;
function collect(callback){
-/*
findJsFiles('src', callback.waitMany(function(file) {
- //console.log('reading', file, '...');
+ console.log('reading', file, '...');
findNgDocInJsFile(file, callback.waitMany(function(doc, line) {
- callback(doc, file, line);
+ callback('@section api\n' + doc, file, line);
}));
}));
-*/
- findNgDocInDir('docs/', callback.waitMany(callback));
+ findNgDocInDir('docs/content', callback.waitMany(callback));
callback.done();
}
@@ -42,11 +40,18 @@ function findNgDocInDir(directory, docNotify) {
fs.readdir(directory, docNotify.waitFor(function(err, files){
if (err) return this.error(err);
files.forEach(function(file){
- //console.log('reading', directory + file, '...');
- if (!file.match(/tutorial.*\.ngdoc$/)) return;
- fs.readFile(directory + file, docNotify.waitFor(function(err, content){
+ fs.stat(directory + '/' + file, docNotify.waitFor(function(err, stats){
if (err) return this.error(err);
- docNotify(content.toString(), directory + file, 1);
+ if (stats.isFile()) {
+ console.log('reading', directory + '/' + file, '...');
+ fs.readFile(directory + '/' + file, docNotify.waitFor(function(err, content){
+ if (err) return this.error(err);
+ var section = '@section ' + directory.split('/').pop() + '\n';
+ docNotify(section + content.toString(), directory + '/' +file, 1);
+ }));
+ } else if(stats.isDirectory()) {
+ findNgDocInDir(directory + '/' + file, docNotify.waitFor(docNotify));
+ }
}));
});
docNotify.done();