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.
@readonly
@default
@type {string}
*/
this.kind = 'package';
json = JSON.parse(json);
/** The name of this package.
This value is found in the package.json file passed in as a command line option.
@type {string}
*/
this.name = json.name;
@ -43,8 +45,10 @@
*/
this.description = json.description;
/** The version of this package.
/**
The hash summary of the source file.
@type {string}
@since 3.2.0
*/
this.version = json.version;
@ -55,7 +59,7 @@
* "licenses": [
* {
* "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
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
if (newDoclet.name) { // there was a @name in comment
@ -92,7 +100,7 @@
addDoclet.call(this, newDoclet);
e.doclet = newDoclet;
});
}
//parser.on('fileBegin', function(e) { });

View File

@ -1,33 +1,36 @@
{
"name": "jsdoc",
"version": "3.0.0beta1",
"revision": "2011-02-05-2259",
"revision": "2011-02-06-0040",
"description": "An automatic documentation generator for javascript.",
"keywords": [ "documentation", "javascript" ],
"licenses": [
{
"type": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"repositories": [
{
"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" : [
{
"name": "Michael Mathews",
"email": "micmath@gmail.com",
"web": "http://micmath.ws"
"name": "Michael Mathews",
"email": "micmath@gmail.com"
}
],
"maintainers": [
{
"name": "Michael Mathews",
"email": "micmath@gmail.com",
"web": "http://micmath.ws"
"name": "Michael Mathews",
"email": "micmath@gmail.com"
}
]
}

View File

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

View File

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