UNPKG

gulp-jsdoc

Version:
133 lines (100 loc) 3 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Source: parser.js</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Source: parser.js</h1> <section> <article> <pre class="prettyprint source linenums"><code>/** * @file Parser * * @summary This is a wrapper around jsdoc parsing infrastructure that generates doc description * * @version ${ pkg.version } * @author ${ pkg.author.name } * * @license ${ pkg.license }. * @copyright ${ pkg.author.name } * @name parser.js * @unknownTag tag */ (function(){ 'use strict'; // Dependencies var augment = require('jsdoc/lib/jsdoc/augment'); var borrow = require('jsdoc/lib/jsdoc/borrow'); var parser = require('jsdoc/lib/jsdoc/src/parser'); var handlers = require('jsdoc/lib/jsdoc/src/handlers'); var Parser = function(infs){ // Start by resolving defaults for the infos object infs = infs || {}; var informations = { name: '', kind: 'package', longname: '', description: '', version: '', licenses: [] }; Object.keys(informations).forEach(function(key){ if(key in infs) informations[key] = infs[key]; }); if(!informations.longname) informations.longname = informations.kind + ':' + informations.name; // Create actual jsdoc parser var innerParser = new parser.Parser(); // Attach handles handlers.attachTo(innerParser); // Set file list up var parsedFiles = informations.files = []; // Do parse this.parse = function(vinyl){ var data = vinyl.contents.toString('utf8'); // Don't treat empty files if (data.length) { innerParser._parseSourceCode(data, vinyl.path); parsedFiles.push(vinyl.path); } }; this.complete = function(){ // Get buffer var buf = innerParser._resultBuffer; // Push generic package infos buf.push(informations); // Borrow and augment shit borrow.indexAll(buf); augment.addInherited(buf); borrow.resolveBorrows(buf); // Return buf return buf; }; }; module.exports = Parser; }()); </code></pre> </article> </section> </div> <nav> <h2><a href="index.html">Index</a></h2> </nav> <br clear="both"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha4</a> on Wed Feb 05 2014 18:14:36 GMT+0100 (CET) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>