mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Added support for @example in haruki. Added Readme with informations about haruki.
This commit is contained in:
parent
69e90109ce
commit
6580e17629
26
templates/haruki/README.md
Normal file
26
templates/haruki/README.md
Normal file
@ -0,0 +1,26 @@
|
||||
OVERVIEW
|
||||
========
|
||||
|
||||
JSDoc 3 Haruki is an experimental template optimised for use with publishing processes that consume either JSON or XML. Whereas the default JSDoc template outputs an HTML representation of your docs, Haruki will output a JSON, or optionally an XML, representation.
|
||||
|
||||
Currently Haruki only supports a subset of the tags supported by the default template. Those are:
|
||||
|
||||
* @name
|
||||
* @desc
|
||||
* @type
|
||||
* @namespace
|
||||
* @function (or @method)
|
||||
* @var (or @member)
|
||||
* @class
|
||||
* @event
|
||||
* @param
|
||||
* @returns
|
||||
* @throws
|
||||
* @example
|
||||
* @access (like @private or @public)
|
||||
|
||||
|
||||
USAGE
|
||||
=====
|
||||
|
||||
./jsdoc myscript.js -t templates/haruki -d console -q format=xml
|
||||
@ -1,8 +1,11 @@
|
||||
/**
|
||||
@overview Builds a tree-like JSON string from the doclet data.
|
||||
@version 0.0.1
|
||||
@example
|
||||
./jsdoc scratch/jsdoc_test.js -t templates/haruki -d console -q format=xml
|
||||
*/
|
||||
|
||||
//var dumper = require('jsdoc/util/dumper');
|
||||
(function() {
|
||||
|
||||
/**
|
||||
@ -81,7 +84,8 @@
|
||||
'access': element.access || '',
|
||||
'virtual': !!element.virtual,
|
||||
'description': element.description || '',
|
||||
'parameters': [ ]
|
||||
'parameters': [ ],
|
||||
'examples': []
|
||||
};
|
||||
|
||||
if (element.returns) {
|
||||
@ -91,6 +95,12 @@
|
||||
};
|
||||
}
|
||||
|
||||
if (element.examples) {
|
||||
for (var i = 0, len = element.examples.length; i < len; i++) {
|
||||
parentNode.functions[element.name].examples.push(element.examples[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (element.params) {
|
||||
for (var i = 0, len = element.params.length; i < len; i++) {
|
||||
thisFunction.parameters.push({
|
||||
@ -127,8 +137,8 @@
|
||||
'access': element.access || '',
|
||||
'virtual': !!element.virtual,
|
||||
'description': element.description || '',
|
||||
'parameters': [
|
||||
]
|
||||
'parameters': [],
|
||||
'examples': []
|
||||
};
|
||||
|
||||
if (element.returns) {
|
||||
@ -138,6 +148,12 @@
|
||||
};
|
||||
}
|
||||
|
||||
if (element.examples) {
|
||||
for (var i = 0, len = element.examples.length; i < len; i++) {
|
||||
thisEvent.examples.push(element.examples[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (element.params) {
|
||||
for (var i = 0, len = element.params.length; i < len; i++) {
|
||||
thisEvent.parameters.push({
|
||||
@ -167,10 +183,17 @@
|
||||
'name': element.name,
|
||||
'description': element.description || '',
|
||||
'parameters': [
|
||||
]
|
||||
],
|
||||
'examples': []
|
||||
}
|
||||
};
|
||||
|
||||
if (element.examples) {
|
||||
for (var i = 0, len = element.examples.length; i < len; i++) {
|
||||
thisClass.constructor.examples.push(element.examples[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (element.params) {
|
||||
for (var i = 0, len = element.params.length; i < len; i++) {
|
||||
thisClass.constructor.parameters.push({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user