diff --git a/main.js b/main.js index a0173862..2eebe449 100644 --- a/main.js +++ b/main.js @@ -1,5 +1,5 @@ /** - * @project JSDoc + * @project jsdoc * @author Michael Mathews * @license See LICENSE.md file included in this distribution. */ @@ -8,11 +8,17 @@ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// -/** @global */ +/** The absolute path to the base directory of the jsdoc application. + @type string + @global + */ const BASEDIR = arguments[0].replace(/([\/\\])main\.js$/, '$1'); // jsdoc.jar sets argument[0] to the abspath to main.js -/** @global */ -function require(id) { // like commonjs +/** Include a JavaScript module, defined in the CommonJS way. + @global + @param {string} id The identifier of the module you require. + */ +function require(id, encoding) { // like commonjs var path = require.base + id + '.js', fileContent = ''; @@ -47,18 +53,41 @@ require.cache = {}; // cache module exports. Like: {id: exported} //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// -/** @global */ +/** Data representing the environment in which this app is running. + @namespace +*/ env = { + /** Running start and finish times. */ run: { start: new Date(), finish: null }, + + /** + The command line arguments passed into jsdoc. + @type Array + */ args: Array.prototype.slice.call(arguments, 1), // jsdoc.jar adds argument[0], the abspath to main.js, user args follow + + + /** + The parsed JSON data from the configuration file. + @type Object + */ conf: {}, + + /** + The command line arguments, parsed into a key/value hash. + @type Object + @example if (env.opts.help) { print 'Helpful message.'; } + */ opts: {} }; -/** @global */ +/** + Data that must be shared across the entire application. + @namespace +*/ app = { jsdoc: { scanner: new (require('jsdoc/src/scanner').Scanner)(), @@ -70,21 +99,29 @@ app = { try { main(); } finally { env.run.finish = new Date(); } -/** @global */ -function print(/*...*/) { +/** Print string/s out to the console. + @param {string} ... String/s to print out to console. + */ +function print() { for (var i = 0, leni = arguments.length; i < leni; i++) { java.lang.System.out.println('' + arguments[i]); } } -/** @global */ -function dump(/*...*/) { +/** + Try to recursively print out all key/values in an object. + @global + @param {Object} ... Object/s to dump out to console. + */ +function dump() { for (var i = 0, leni = arguments.length; i < leni; i++) { print( require('common/dumper').dump(arguments[i]) ); } } -/** @global */ +/** @global + @param {string} filepath The path to the script file to include (read and execute). +*/ function include(filepath) { try { load(BASEDIR + filepath); @@ -94,16 +131,22 @@ function include(filepath) { } } -/** @global */ -function exit(v) { - java.lang.System.exit(v); +/** + Cause the VM running jsdoc to exit running. + @param {number} [n = 0] The exit status. + */ +function exit(n) { + n = n || 0; + java.lang.System.exit(n); } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// -/** @global */ +/** + Run the jsoc application. + */ function main() { var sourceFiles, docs, diff --git a/modules/common/dumper.js b/modules/common/dumper.js index c10e38e5..4224bfd7 100644 --- a/modules/common/dumper.js +++ b/modules/common/dumper.js @@ -52,8 +52,6 @@ function walk(object) { var value; - - if ( value = getValue(object) ) { output += value + ',\n'; } diff --git a/package.json b/package.json index 96941e63..3db97a24 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "repositories": [ { "type": "git", - "url": "http://github.com/micmath/JSDoc" + "url": "http://github.com/micmath/jsdoc" } ], "contributors" : [ diff --git a/templates/default/tmpl/index.mustache b/templates/default/tmpl/index.mustache index 1c9f6452..1f109418 100644 --- a/templates/default/tmpl/index.mustache +++ b/templates/default/tmpl/index.mustache @@ -16,7 +16,7 @@ .function { color: #666; } .access { color: #666; } - +/* .symbol-head { margin-top: 8px; @@ -27,9 +27,7 @@ background-color: #B8B9CB; } - .detail-list { - list-style-type:none; - } + .symbol-head .summary { font-style: italic; @@ -40,6 +38,128 @@ margin-top: 12px; } + */ + + + .detail-list { + list-style-type:none; + } + + html { + /* stops IE resizing fonts by a massive amount */ + font-size: 100% + } + body { + /* pixes monospace font sizes in webkit */ + font-size: 10px; + /* following line is picked up by IE6 & 7, which cannot resize pixel-based font sizes */ + *font-size: 62.5%; + } + + body { + font-size: 0.8em; + font-family: verdana, sans-serif; + /*overflow: hidden;*/ + zoom: 1; + background: url(images/pagebg.png) 0 73px repeat-x; + color: #333333; + } + a:link, a:visited { + color: #356a8b; + text-decoration: none; + border-bottom: 1px dotted #356a8b; + } + a:hover, a:active { + color: #3B607B; + border-color: #3B607B; + border-bottom-style: solid; + } + a.image { + border: 0; + } + h1 { + font-size: 2em; + font-family: arial, sans-serif; + } + h2 { + font-size: 1.7em; + margin: 0 0 1em 0; + font-family: arial, sans-serif; + } + h3 { + font-size: 1.4em; + margin: 0.4em 0; + font-family: arial, sans-serif; + color: #4e4e4e; + } + h4 { + margin: 1em 0; + color: #3B607B; + } + h5 { + margin: 1em 0; + } + p { + margin: 0 0 1em 0; + line-height: 1.5; + } + + dl.params dt { + border-top: 1px solid #b2b1b1; + color: #3B607B; + font-weight: bold; + padding-top: 8px; + margin-bottom: 5px; + font-size: 1.1em; + float: none; + overflow: visible; + zoom: 0; + } + + dl.params dt.first { + border-top: none; + } + + dl.params dd { + border-width: 0; + margin-bottom: 16px; + } + + dl.param-properties { + font-style: italic; + overflow: hidden; + zoom: 1; + font-size: 0.9em; + margin: 1em 0; + } + dl.param-properties dt span, + dl.param-properties dd { + color: #555; + float: left; + margin: 0; + padding: 0; + display: inline; + margin-bottom: 5px; + font-size: 1em; + border: none; + } + dl.param-properties dt { + clear: both; + display: inline; + font-size: 1em; + padding: 0; + float: none; + overflow: visible; + zoom: 0; + } + dl.param-properties dt span { + width: 85px; + clear: both; + } + dl.param-properties dd.optionalDef { + text-indent: -5000px; + } + @@ -73,9 +193,9 @@ {{#hasParams}}

Parameters:

-
    +
    {{#params}} {{>param}} {{/params}} -
+ {{/hasParams}} {{#returns}} diff --git a/templates/default/tmpl/param.mustache b/templates/default/tmpl/param.mustache index 6c3ebba2..2d32da25 100644 --- a/templates/default/tmpl/param.mustache +++ b/templates/default/tmpl/param.mustache @@ -1,8 +1,19 @@ -
  • - {{#type}} - { - {{#names}}{{last}}{{#linkTo}}{{.}}{{/linkTo}}{{^last?}} | {{/last?}}{{#last?}} {{/last?}}{{/names}} - } - {{/type}} - {{name}} -
  • \ No newline at end of file +{{name}} +
    +
    + {{#type}} +
    Type
    +
    {{#names}}{{#linkTo}}{{.}}{{/linkTo}}{{^last?}} | {{/last?}}{{#last?}} {{/last?}}{{/names}}
    + {{/type}} + {{#defaultvalue}} +
    Default
    +
    {{defaultvalue}}
    + {{/defaultvalue}} + {{#optional}} +
    Optional
    +
    Yes
    + {{/optional}} +
    + +
    {{description}}
    +
    \ No newline at end of file diff --git a/test/cases/src/dir1/three.js b/test/cases/src/dir1/three.js new file mode 100644 index 00000000..e69de29b diff --git a/test/cases/src/ignored.txt b/test/cases/src/ignored.txt new file mode 100644 index 00000000..e69de29b diff --git a/test/cases/src/one.js b/test/cases/src/one.js new file mode 100644 index 00000000..e69de29b diff --git a/test/cases/src/two.js b/test/cases/src/two.js new file mode 100644 index 00000000..e69de29b