mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Merge pull request #156 from llaxsll/master
@partial Possibly this should be a core tag, but I think some time in the plugin incubator will be very useful, as a way to test it out and see how suitable it is for core. Thank you for contributing.
This commit is contained in:
commit
dcafed5d0c
30
plugins/partial.js
Normal file
30
plugins/partial.js
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
@overview Adds support for reusable partial jsdoc files.
|
||||
@module plugins/partial
|
||||
@author Ludo Antonov <ludo@hulu.com>
|
||||
*/
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
exports.handlers = {
|
||||
///
|
||||
/// Include a partial jsdoc
|
||||
/// @param e
|
||||
/// @param e.filename
|
||||
/// @param e.source
|
||||
///
|
||||
/// @example
|
||||
/// @partial "partial_doc.jsdoc"
|
||||
///
|
||||
beforeParse: function(e) {
|
||||
e.source = e.source.replace(/(@partial \".*\")+/g, function($) {
|
||||
var pathArg = $.match(/\".*\"/)[0].replace(/"/g,'');
|
||||
var fullPath = path.join(e.filename , '..', pathArg);
|
||||
|
||||
var partialData = fs.readFileSync(fullPath);
|
||||
|
||||
return partialData;
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user