forked from jsdoc/jsdoc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
2,075 additions
and
3,499 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
License | ||
======= | ||
|
||
JSDoc 3 is free software. | ||
JSDoc is free software. | ||
|
||
Copyright (c) 2010 Michael Mathews <[email protected]> | ||
|
||
|
@@ -35,16 +35,7 @@ https://developer.mozilla.org/en/Rhino_License | |
You can obtain the source code for Rhino from the Mozilla web site at | ||
http://www.mozilla.org/rhino/download.html | ||
|
||
|
||
jsDump | ||
------ | ||
|
||
jsDump is copyright (c) 2008 Ariel Flesler, aflesler(at)gmail(dot)com | ||
|
||
Licensed under the BSD license | ||
http://www.opensource.org/licenses/bsd-license.php | ||
|
||
json2xml | ||
json2xml (modules/goessner/json2xml) | ||
-------- | ||
|
||
json2xml is copyright (c) Stefan Goessner 2006 | ||
|
@@ -55,35 +46,31 @@ http://creativecommons.org/licenses/LGPL/2.1/ | |
http://goessner.net/ | ||
http://goessner.net/download/prj/jsonxml/ | ||
|
||
JSpec | ||
Node (modules/common/assert, modules/common/util) | ||
------- | ||
|
||
JSpec is copyright (c) 2008 - 2010 TJ Holowaychuk [email protected] | ||
|
||
http://github.com/visionmedia/jspec | ||
|
||
Licensed under the MIT license. | ||
Node is Copyright 2009, 2010 Ryan Lienhart Dahl. All rights reserved. | ||
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: | ||
|
||
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 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. | ||
|
||
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. | ||
https://github.com/ry/node | ||
|
||
JSONSchema Validator | ||
JSONSchema Validator (modules/sitepen/jsonschema) | ||
-------------------- | ||
|
||
JSONSchema is copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com) | ||
|
@@ -93,12 +80,30 @@ http://www.sitepen.com/blog/2010/03/02/commonjs-utilities/ | |
|
||
Licensed under the MIT license. | ||
|
||
Simple JavaScript Templating | ||
Mustache (templates/lib/janl/mustache.js) | ||
------------------- | ||
|
||
Simple JavaScript Templating is | ||
Copyright (c) John Resig - http://ejohn.org/ | ||
Mustache is | ||
Copyright (c) 2009 Chris Wanstrath (Ruby) | ||
Copyright (c) 2010 Jan Lehnardt (JavaScript) | ||
|
||
Licensed under the MIT license. | ||
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. | ||
|
||
http://ejohn.org/blog/javascript-micro-templating/ | ||
https://github.com/janl/mustache.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"permitUnknownTags": false | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,156 @@ | ||
/** | ||
* @overview JSDoc 3 | ||
* @project JSDoc | ||
* @copyright 2010 (c) Michael Mathews <[email protected]> | ||
* @license See LICENSE.md file included in this distribution. | ||
*/ | ||
|
||
//// bootstrap | ||
|
||
/** @global */ | ||
const BASEDIR = arguments[0].replace(/([\/\\])main\.js$/, '$1'); // jsdoc.jar sets argument[0] to the abspath to main.js | ||
var args = arguments.slice(1); | ||
|
||
/** Follow the commonjs modules convention. */ | ||
function require(id) { | ||
/** @global */ | ||
function require(id) { // like commonjs | ||
var path = require.base + id + '.js', | ||
source = ''; | ||
fileContent = ''; | ||
|
||
try { | ||
var file = new java.io.File(path), | ||
scanner = new java.util.Scanner(file).useDelimiter("\\Z"), | ||
source = String( scanner.next() ); | ||
fileContent = String( scanner.next() ); | ||
} | ||
catch(e) { | ||
print(e); | ||
} | ||
catch(e) { print(e); } | ||
|
||
try { | ||
var f = new Function('require', 'exports', 'module', source), | ||
var f = new Function('require', 'exports', 'module', fileContent), | ||
exports = require.cache[path] || {}, | ||
module = { id: id, uri: path }; | ||
|
||
require.cache[path] = exports; | ||
require.cache[id] = exports; | ||
f.call({}, require, exports, module); | ||
} | ||
catch(e) { | ||
print('Unable to require source code from '+source+': '+e); | ||
print('Unable to require source code from "' + path + '": ' + e); | ||
} | ||
return exports; | ||
} | ||
require.base = BASEDIR + '/modules/'; | ||
require.cache = {}; | ||
require.base = BASEDIR + '/modules/'; // assume all module paths are relative to here | ||
require.cache = {}; // cache module exports. Like: {id: exported} | ||
|
||
function print(msg) { | ||
java.lang.System.out.println(msg); | ||
} | ||
//// | ||
|
||
//// main | ||
var app = { }; // global settings for this app | ||
(function() { | ||
var jsdoc = { | ||
parser: require('jsdoc/parser'), | ||
opts: require('jsdoc/opts'), | ||
src: require('jsdoc/src') | ||
}, | ||
opts, | ||
sourceFiles; | ||
|
||
app.opts = opts = jsdoc.opts.set(args); | ||
|
||
if (opts.help) { | ||
print( jsdoc.opts.help() ); | ||
java.lang.System.exit(0); | ||
} | ||
else if (opts.test) { | ||
load(BASEDIR+'/test/lib/jspec.js'); | ||
load(BASEDIR + '/test/runall.js'); | ||
java.lang.System.exit(0); | ||
} | ||
|
||
if (opts._.length > 0) { | ||
sourceFiles = jsdoc.src.getFilePaths(opts._, (opts.recurse? 10 : undefined)); | ||
|
||
/** @global */ | ||
env = { | ||
run: { | ||
start: new Date(), | ||
finish: null | ||
}, | ||
args: arguments.slice(1), // jsdoc.jar sets argument[0] to the abspath to main.js, user args follow | ||
conf: {}, // TODO: populate from file BASEDIR+'/conf.json' | ||
opts: {} | ||
}; | ||
|
||
jsdoc.parser.parseFiles(sourceFiles, opts.encoding); | ||
|
||
if (opts.validate) { | ||
var jsonSchema = require('sitepen/jsonSchema'); | ||
var jsdocSchema = require('jsdoc/schema').jsdocSchema; | ||
var validation = jsonSchema.validate(jsdoc.parser.result.toObject(), jsdocSchema); | ||
print('Validation: ' + validation.toSource()); | ||
} | ||
|
||
if (!opts.destination || opts.destination.indexOf('stdout') === 0) { | ||
print( jsdoc.parser.result.toString(opts.destination) ); | ||
} | ||
else if (opts.template) { | ||
try { | ||
load(BASEDIR+'/templates/'+opts.template+'/publish.js'); | ||
} | ||
catch (e) { | ||
print('Cannot load the specified template: templates/'+opts.template+'/publish.js: '+e); | ||
} | ||
|
||
publish(jsdoc.parser.result.toObject(), {}); | ||
} | ||
try { main(); } | ||
finally { env.run.finish = new Date(); } | ||
|
||
/** @global */ | ||
function print(/*...*/) { | ||
for (var i = 0, leni = arguments.length; i < leni; i++) { | ||
java.lang.System.out.println('' + arguments[i]); | ||
} | ||
} | ||
|
||
/** @global */ | ||
function dump(/*...*/) { | ||
for (var i = 0, leni = arguments.length; i < leni; i++) { | ||
print( require('common/dumper').dump(arguments[i]) ); | ||
} | ||
|
||
} | ||
|
||
/** @global */ | ||
function include(filepath) { | ||
try { | ||
load(BASEDIR + filepath); | ||
} | ||
catch (e) { | ||
print('Cannot include "' + BASEDIR + filepath + '": '+e); | ||
} | ||
} | ||
|
||
/** @global */ | ||
function exit(v) { | ||
java.lang.System.exit(v); | ||
} | ||
|
||
function main() { | ||
var sourceFiles, | ||
docs, | ||
jsdoc = { | ||
opts: { | ||
parser: require('jsdoc/opts/parser') | ||
}, | ||
src: { | ||
scanner: require('jsdoc/src/scanner'), | ||
parser: require('jsdoc/src/parser') | ||
} | ||
}; | ||
|
||
try { | ||
env.conf = JSON.parse( require('common/fs').read(BASEDIR+'conf.json') ); | ||
} | ||
catch (e) { | ||
throw('Configuration file cannot be evaluated. '+e); | ||
} | ||
|
||
env.opts = jsdoc.opts.parser.parse(env.args); | ||
|
||
|
||
})(); | ||
if (env.opts.help) { | ||
print( jsdoc.optParser.help() ); | ||
exit(0); | ||
} | ||
else if (env.opts.test) { | ||
include('test/runall.js'); | ||
exit(0); | ||
} | ||
|
||
if (env.opts._.length > 0) { // are there any source files to scan? | ||
sourceFiles = jsdoc.src.scanner.scan(env.opts._, (env.opts.recurse? 10 : undefined)); | ||
//dump('sourceFiles...', sourceFiles); | ||
docs = jsdoc.src.parser.parse(sourceFiles, env.opts.encoding); | ||
//dump('jsdoc.docs...', docs); | ||
if (env.opts.template) { | ||
include('templates/'+env.opts.template+'/publish.js'); | ||
if (typeof publish === 'function') { | ||
publish(docs, {}); | ||
} | ||
} | ||
// | ||
// if (env.opts.validate) { | ||
// var jsonSchema = require('sitepen/jsonSchema'); | ||
// var jsdocSchema = require('jsdoc/schema').jsdocSchema; | ||
// var validation = jsonSchema.validate(jsdoc.srcParser.result.toObject(), jsdocSchema); | ||
// print('Validation: ' + validation.toSource()); | ||
// } | ||
// | ||
// if (!env.opts.destination || env.opts.destination.indexOf('stdout') === 0) { | ||
// print( jsdoc.srcParser.result.toString(env.opts.destination) ); | ||
// } | ||
// else if (env.opts.template) { | ||
// try { | ||
// load(BASEDIR+'/templates/'+env.opts.template+'/publish.js'); | ||
// } | ||
// catch (e) { | ||
// print('Cannot load the specified template: templates/'+env.opts.template+'/publish.js: '+e); | ||
// } | ||
// | ||
// publish(jsdoc.srcParser.result.toObject(), {}); | ||
// } | ||
} | ||
} | ||
|
||
//// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
/** | ||
@overview Parse command line options. | ||
@module common/args | ||
@author Michael Mathews <[email protected]> | ||
@license Apache License 2.0 - See file 'LICENSE.md' in this project. | ||
*/ | ||
|
||
/** | ||
@module common/args | ||
*/ | ||
(function() { | ||
|
||
/** | ||
|
Oops, something went wrong.