Skip to content

Commit

Permalink
Improved layout and css of params in the default template.
Browse files Browse the repository at this point in the history
  • Loading branch information
micmath committed Jan 23, 2011
1 parent 6b25e91 commit aef2663
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 32 deletions.
73 changes: 58 additions & 15 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @project JSDoc
* @project jsdoc
* @author Michael Mathews <[email protected]>
* @license See LICENSE.md file included in this distribution.
*/
Expand All @@ -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 = '';

Expand Down Expand Up @@ -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)(),
Expand All @@ -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);
Expand All @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions modules/common/dumper.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
function walk(object) {
var value;



if ( value = getValue(object) ) {
output += value + ',\n';
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"repositories": [
{
"type": "git",
"url": "http://github.com/micmath/JSDoc"
"url": "http://github.com/micmath/jsdoc"
}
],
"contributors" : [
Expand Down
132 changes: 126 additions & 6 deletions templates/default/tmpl/index.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
.function { color: #666; }
.access { color: #666; }
/*
.symbol-head
{
margin-top: 8px;
Expand All @@ -27,9 +27,7 @@
background-color: #B8B9CB;
}
.detail-list {
list-style-type:none;
}
.symbol-head .summary {
font-style: italic;
Expand All @@ -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;
}
</style>
</head>

Expand Down Expand Up @@ -73,9 +193,9 @@

{{#hasParams}}
<h3>Parameters:</h3>
<ol class="params detail-list">
<dl class="params detail-list">
{{#params}} {{>param}} {{/params}}
</ol>
</dl>
{{/hasParams}}

{{#returns}}
Expand Down
27 changes: 19 additions & 8 deletions templates/default/tmpl/param.mustache
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
<li>
{{#type}}
{
{{#names}}<span class="param-type">{{last}}{{#linkTo}}{{.}}{{/linkTo}}</span>{{^last?}} | {{/last?}}{{#last?}} {{/last?}}{{/names}}
}
{{/type}}
<span class="param-name">{{name}}</span>
</li>
<dt{{#first?}} class="first"{{/first?}}><span class="param-name">{{name}}</span></dt>
<dd>
<dl class="param-properties">
{{#type}}
<dt><span>Type</span></dt>
<dd>{{#names}}<span class="param-type">{{#linkTo}}{{.}}{{/linkTo}}</span>{{^last?}} | {{/last?}}{{#last?}} {{/last?}}{{/names}}</dd>
{{/type}}
{{#defaultvalue}}
<dt><span>Default</span></dt>
<dd>{{defaultvalue}}</dd>
{{/defaultvalue}}
{{#optional}}
<dt><span>Optional</span></dt>
<dd class="optionalDef">Yes</dd>
{{/optional}}
</dl>

<div class="param-desc">{{description}}</div>
</dd>
Empty file added test/cases/src/dir1/three.js
Empty file.
Empty file added test/cases/src/ignored.txt
Empty file.
Empty file added test/cases/src/one.js
Empty file.
Empty file added test/cases/src/two.js
Empty file.

0 comments on commit aef2663

Please sign in to comment.