aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src/gen-docs.js
diff options
context:
space:
mode:
authorMisko Hevery2010-12-23 00:44:27 +0100
committerMisko Hevery2011-01-10 11:50:11 -0800
commit4f22d6866c052fb5b770ce4f377cecacacd9e6d8 (patch)
tree6bdb1c5eb70cfd7e6bcf143c121c53025a0489a4 /docs/src/gen-docs.js
parentaab3df7aeaf79908e8b6212288b283adb42b1ce6 (diff)
downloadangular.js-4f22d6866c052fb5b770ce4f377cecacacd9e6d8.tar.bz2
complete rewrite of documentation generation
- romeved mustache.js - unified templates - improved testability of the code
Diffstat (limited to 'docs/src/gen-docs.js')
-rw-r--r--docs/src/gen-docs.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/docs/src/gen-docs.js b/docs/src/gen-docs.js
new file mode 100644
index 00000000..b4e30a53
--- /dev/null
+++ b/docs/src/gen-docs.js
@@ -0,0 +1,42 @@
+require.paths.push(__dirname);
+require.paths.push('lib');
+var reader = require('reader.js'),
+ ngdoc = require('ngdoc.js'),
+ writer = require('writer.js'),
+ callback = require('callback.js');
+
+var docs = [];
+var start;
+var work = callback.chain(function(){
+ start = now();
+ console.log('Generating Angular Reference Documentation...');
+ reader.collect(work.waitMany(function(text, file, line){
+ var doc = new ngdoc.Doc(text, file, line);
+ docs.push(doc);
+ doc.parse();
+ }));
+});
+var writes = callback.chain(function(){
+ ngdoc.merge(docs);
+ docs.forEach(function(doc){
+ writer.output(doc.name + '.html', doc.html(), writes.waitFor());
+ });
+ var metadata = ngdoc.metadata(docs);
+ writer.output('docs-keywords.js', ['NG_PAGES=', JSON.stringify(metadata), ';'], writes.waitFor());
+ writer.copy('index.html', writes.waitFor());
+ writer.copy('docs.js', writes.waitFor());
+ writer.copy('docs.css', writes.waitFor());
+ writer.copy('doc_widgets.js', writes.waitFor());
+ writer.copy('doc_widgets.css', writes.waitFor());
+ writer.copy('docs-scenario.html', writes.waitFor());
+ writer.output('docs-scenario.js', ngdoc.scenarios(docs), writes.waitFor());
+});
+writes.onDone(function(){
+ console.log('DONE. Generated ' + docs.length + ' pages in ' +
+ (now()-start) + 'ms.' );
+});
+work.onDone(writes);
+writer.makeDir('build/docs', work);
+
+///////////////////////////////////
+function now(){ return new Date().getTime(); }