var verb = require('verb'); verb.data({nickname: 'apidocs'}); /** * This helper is already included in verb, * it's used here for example purposes. */ verb.task('default', function () { verb.src('.verb.md') .pipe(verb.dest('.')); });
var heading = lines[0].trim(); lines = lines.slice(1); section = '\n' + lines.join('\n').trim(); sections[heading] = {path: heading, content: section}; } } return sections; } verb.create('method', 'methods', {isPartial: true}, [toSections]); verb.methods('docs.md'); /* deps:jshint-stylish */ verb.task('lint', function () { verb.src(['index.js']) .pipe(jshint('.jshintrc')) .pipe(jshint.reporter('jshint-stylish')); }); verb.task('test', ['lint'], function (cb) { verb.src('index.js') .pipe(istanbul({includeUntested: true})) .pipe(istanbul.hookRequire()) .on('finish', function () { verb.src(['test.js']) .pipe(mocha()) .on('error', gutil.log) .pipe(istanbul.writeReports({ reporters: [ 'text' ], reportOpts: {dir: 'coverage', file: 'summary.txt'} }))
verb.helper('results', function (name) { console.log(this.context.partials) // var template = this.app.views.partials[name]; // var res = this.app.renderTemplate(template); console.log(verb.cache.data) console.log(verb.views.partials) }); function format(str, delims) { str = str.split(delims[0]).join('{%='); str = str.split(delims[1]).join('%}'); return str; } verb.helper('data', function () { verb.data.apply(verb, arguments); }); verb.helper('format', function (str) { str = str.replace(/([{\[]) /g, '$1'); str = str.replace(/ ([}\]])/g, '$1'); return str.slice(1, str.length -1); }); verb.task('readme', function() { verb.src('.verb*.md') .pipe(verb.dest('.')); }); verb.task('default', ['readme']);