Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dvv committed Nov 20, 2011
1 parent 9f1cc62 commit 6510d4b
Show file tree
Hide file tree
Showing 61 changed files with 8,461 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
node_modules
docs
3 changes: 3 additions & 0 deletions .npmignore
@@ -0,0 +1,3 @@
node_modules
Makefile
make.js
4 changes: 4 additions & 0 deletions HISTORY.md
@@ -0,0 +1,4 @@
0.0.1 / 2011-11-20
---------

* First public release
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
(The MIT License)

Copyright (C) 2011 by Vitaly Puzrin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
1 change: 0 additions & 1 deletion README

This file was deleted.

19 changes: 19 additions & 0 deletions README.md
@@ -0,0 +1,19 @@

# JavaScript PDoc parser

An attempt to parse [PDoc](http://pdoc.org/syntax.html) with [node.js](http://nodejs.org)

## How to Install

Clone and have fun

## How to use

Go to your project's root directory and run

ndoc
open file://./docs/index.html

## License

[MIT](https://github.com/nodeca/ndoc/blob/master/LICENSE)
2 changes: 2 additions & 0 deletions TODO
@@ -0,0 +1,2 @@
* get rid of prototype.js et al., jquery will do
* elaborate robuster highlighter
78 changes: 78 additions & 0 deletions bin/ndoc
@@ -0,0 +1,78 @@
#!/usr/bin/env node
'use strict';

var program = require('commander');
var exec = require('child_process').exec;
var Util = require('../lib/util');
var NDoc = require('../lib');

//
// parse options
//
program
// .version('0.0.1')
.option('-s, --source <source>', 'find-compatible pattern to find source files', 'lib')
.option('-o, --output <destination>', 'Where to put resulting file(s)', 'docs')
.option('-f, --format <format>', 'Output format [html]', 'html')
.option('--src_code_text <link>', 'Text for "View source"', 'View source on GitHub &rarr;')
.option('-a, --src_code_href <src_code_href>', 'URL of source files root', 'http://localhost/')
.option('-i, --index_page <index>', 'Index file name', 'README.md')
.option('-t, --title <title>', 'Project title', '')
.option('-n, --name <name>', 'Project name')
.option('-v, --version <version>', 'Project version')
.option('--template <template_root>', 'Root of custom templates', __dirname + '/../templates')
.parse(process.argv);
//console.log(program); process.exit(0);

//
// collect sources
//
var files = [];
Util.walk(program.source, '\.js$', function(filename, stat, cb) {
//console.log('Processing', filename);
files.push(filename);
cb();
}, function(err) {
if (err) {
console.error(err);
process.exit(1);
}
// build tree
var ndoc = new NDoc(files, {
root: program.source,
href: program.src_code_href
});
//console.log(ndoc.toJSON());

// output tree
var output = program.output;
switch (program.format) {

case 'json':
write(output, ndoc.toJSON());
break;

case 'html':
Util.remove(output, function(err) {
if (err) {
console.error(err);
process.exit(1);
}
exec('cp -a "' + __dirname + '/../skeleton" ' + output, function(err, stdout, stderr) {
//Util.copy(__dirname + '/../skeleton', output, function(err) {
if (err) {
console.error(err);
process.exit(1);
}
var html = ndoc.toHTML(program);
Util.write(output + '/index.html', html);
});
});
break;

default:
console.error(program.format + ': not supported')
process.exit(1);

}
});

0 comments on commit 6510d4b

Please sign in to comment.