Added support for the @also pragma, to allow multiple doclets to be associated with the same line of source code. Tweaks to the default template.

This commit is contained in:
Michael Mathews 2011-02-06 00:41:40 +00:00
parent 6917abcc4f
commit 602c41680d
5 changed files with 74 additions and 24 deletions

View File

@ -23,12 +23,14 @@
/** The kind of this package. /** The kind of this package.
@readonly @readonly
@default @default
@type {string}
*/ */
this.kind = 'package'; this.kind = 'package';
json = JSON.parse(json); json = JSON.parse(json);
/** The name of this package. /** The name of this package.
This value is found in the package.json file passed in as a command line option.
@type {string} @type {string}
*/ */
this.name = json.name; this.name = json.name;
@ -43,8 +45,10 @@
*/ */
this.description = json.description; this.description = json.description;
/** The version of this package. /**
The hash summary of the source file.
@type {string} @type {string}
@since 3.2.0
*/ */
this.version = json.version; this.version = json.version;
@ -55,7 +59,7 @@
* "licenses": [ * "licenses": [
* { * {
* "type": "GPLv2", * "type": "GPLv2",
* "url": "http://www.example.com/licenses/gpl.html", * "url": "http://www.example.com/licenses/gpl.html"
* } * }
* ] * ]
*/ */

View File

@ -27,7 +27,15 @@
// handles named symbols in the code, may or may not have a JSDoc comment attached // handles named symbols in the code, may or may not have a JSDoc comment attached
parser.on('symbolFound', function(e) { parser.on('symbolFound', function(e) {
var newDoclet = new jsdoc.doclet.Doclet(e.comment, e); var subDoclets = e.comment.split(/@also\b/g);
for (var i = 0, l = subDoclets.length; i < l; i++) {
newSymbolDoclet.call(this, subDoclets[i], e);
}
});
function newSymbolDoclet(docletSrc, e) {
var newDoclet = new jsdoc.doclet.Doclet(docletSrc, e);
// an undocumented symbol right after a virtual comment? rhino mistakenly connected the two // an undocumented symbol right after a virtual comment? rhino mistakenly connected the two
if (newDoclet.name) { // there was a @name in comment if (newDoclet.name) { // there was a @name in comment
@ -92,7 +100,7 @@
addDoclet.call(this, newDoclet); addDoclet.call(this, newDoclet);
e.doclet = newDoclet; e.doclet = newDoclet;
}); }
//parser.on('fileBegin', function(e) { }); //parser.on('fileBegin', function(e) { });

View File

@ -1,7 +1,7 @@
{ {
"name": "jsdoc", "name": "jsdoc",
"version": "3.0.0beta1", "version": "3.0.0beta1",
"revision": "2011-02-05-2259", "revision": "2011-02-06-0040",
"description": "An automatic documentation generator for javascript.", "description": "An automatic documentation generator for javascript.",
"keywords": [ "documentation", "javascript" ], "keywords": [ "documentation", "javascript" ],
"licenses": [ "licenses": [
@ -13,21 +13,24 @@
"repositories": [ "repositories": [
{ {
"type": "git", "type": "git",
"url": "http://github.com/micmath/JSDoc" "url": "git://github.com/micmath/jsdoc.git"
},
{
"type": "svn",
"url": "https://jsdoc.googlecode.com/svn/trunk"
} }
], ],
"bugs": "http://code.google.com/p/jsdoc/issues/list",
"contributors" : [ "contributors" : [
{ {
"name": "Michael Mathews", "name": "Michael Mathews",
"email": "micmath@gmail.com", "email": "micmath@gmail.com"
"web": "http://micmath.ws"
} }
], ],
"maintainers": [ "maintainers": [
{ {
"name": "Michael Mathews", "name": "Michael Mathews",
"email": "micmath@gmail.com", "email": "micmath@gmail.com"
"web": "http://micmath.ws"
} }
] ]
} }

View File

@ -194,19 +194,19 @@
margin-left: 30px; margin-left: 30px;
} }
.property-head { .property-head {
margin-left: -30px; margin-left: -20px;
display: block; display: block;
line-height: 1.2em; line-height: 1.2em;
} }
.property-head h4 { .property-name {
color: #4782B5;
}
.property-title {
float: left; float: left;
margin: 0; margin: 0;
padding: 0 20px 0 0; padding: 0 10px 0 0;
font-style: italic; font-style: italic;
font-weight: bold;
font-size: 1.2em; font-size: 1.2em;
color: #4782B5;
} }
.property-summary { .property-summary {
color: #999; color: #999;
@ -219,8 +219,16 @@
.property-details dt { .property-details dt {
font-weight: bold; font-weight: bold;
margin-bottom: 4px; margin-bottom: 4px;
padding-left: 10px;
clear: left;
float: left;
}
.property-details dd {
padding-left: 60px;
}
.property-deprecated {
text-decoration: line-through;
} }
.example-code { .example-code {
border: 1px solid #999; border: 1px solid #999;

View File

@ -1,8 +1,8 @@
<div class="property"> <div class="property">
<dl class="property-head" id="property:{{name}}"> <dl class="property-head{{#deprecated}} property-deprecated{{/deprecated}}" id="{{longname}}">
<dt class="property-name"> <dt class="property-name">
<h4 class="property-title">{{name}}</h4> {{name}}
</dt> </dt>
<dd class="property-summary"> <dd class="property-summary">
{{{summary}}} {{{summary}}}
@ -15,9 +15,30 @@
</dt> </dt>
<dd> <dd>
{{{description}}} {{{description}}}
<br clear="both">
</dd> </dd>
{{/description}} {{/description}}
{{#deprecated}}
<dt>
Deprecated
</dt>
<dd>
{{{deprecated}}}
<br clear="both">
</dd>
{{/deprecated}}
{{#since}}
<dt>
Since
</dt>
<dd>
{{{since}}}
<br clear="both">
</dd>
{{/since}}
{{#type}} {{#type}}
<dt> <dt>
Type Type
@ -26,6 +47,7 @@
{{#names}} {{#names}}
<span class="type-name">{{#linkTo}}{{.}}{{/linkTo}}</span>{{^last?}} | {{/last?}}{{#last?}} {{/last?}} <span class="type-name">{{#linkTo}}{{.}}{{/linkTo}}</span>{{^last?}} | {{/last?}}{{#last?}} {{/last?}}
{{/names}} {{/names}}
<br clear="both">
</dd> </dd>
{{/type}} {{/type}}
@ -35,6 +57,7 @@
</dt> </dt>
<dd class="yesDef"> <dd class="yesDef">
Yes Yes
<br clear="both">
</dd> </dd>
{{/readonly}} {{/readonly}}
@ -44,15 +67,17 @@
</dt> </dt>
<dd class="yesDef"> <dd class="yesDef">
Yes Yes
<br clear="both">
</dd> </dd>
{{/nullable}} {{/nullable}}
{{#defaultvalue}} {{#defaultvalue}}
<dt> <dt>
Default Value Default
</dt> </dt>
<dd> <dd>
{{defaultvalue}} {{defaultvalue}}
<br clear="both">
</dd> </dd>
{{/defaultvalue}} {{/defaultvalue}}
@ -61,9 +86,11 @@
Example Example
</dt> </dt>
<dd> <dd>
<br clear="both">
<div class="example-code"> <div class="example-code">
<pre class="prettyprint lang-js"><code>{{.}}</code></pre> <pre class="prettyprint lang-js"><code>{{.}}</code></pre>
</div> </div>
<br clear="both">
</dd> </dd>
{{/examples}} {{/examples}}
</dl> </dl>