2.6 KiB
{%= name %} {%= badge("fury") %} {%= badge("travis") %} {%= badge("coverage") %}
{%= description %}
Overview
multilang-extract-comments is a package for extracting comments from source-code. It is compatible with the
extract-comments
-package by Jon Schlinkert:
It provides an extended API, which allows you to extract comments not only from JavaScript files, but also from Python, C, Handlebars etc.
The module was originally forked from extract-comments,
with the purpose to allow verb to extract jsdoc-like comments from file
other than JavaScript-files. In the end, the module was a complete rewrite of the original module. Now the only
common file is spec/javascript-spec.js
which is more or less equal to Jon Schlinkert's
extract-comments/test.js
.
The primary targets are Handlebars-files, for documenting bootprint template-modules.
Example (JavaScript)
For the following string:
{%= embed("./examples/javascript.js") %}
and the following code
var comments = require('multilang-extract-comments')(string);
The variable comments
now contains:
{%= stringifyPretty(extract(read("./examples/javascript.js"))) %}
Also have a look at the usage example of extract-comments
Example (Handlebars)
For the following string:
{%= embed("./examples/handlebars.hbs") %}
and the following code
var comments = require('multilang-extract-comments')(string, { filename: 'handlebars.hbs'});
The variable comments
now contains:
{%= stringifyPretty(extractHbs(read("./examples/handlebars.hbs"))) %}
Example (Custom)
For the following string:
{%= embed("./examples/powershell.ps1") %}
and the following code
var options = {
pattern: {
name: 'Powershell',
nameMatchers: ['.ps1'],
singleLineComment: [{ start: '#' }],
multiLineComment: [{ start: '<#', middle: '', end: '#>'}]
}
}
var comments = require('multilang-extract-comments')(string,options);
The variable comments
now contains:
{%= stringifyPretty(extractCustom(read("./examples/powershell.ps1"))) %}
Also have a look at the usage example of extract-comments
API
{%= apidocs("index.js") %}
TODO
Running tests
{%= include("tests") %}
Contributing
{%= include("contributing") %}
see CONTRIBUTING.md
Changelog
see CHANGELOG.md
Author
{%= include("author", {github: 'nknapp', twitter: 'knappi79'}) %}
Related
{%= related(['extract-comments','comment-patterns']) %}
License
{%= copyright({start: 2015}) %} {%= license() %}