/* Copyright 2012-2015, Yahoo Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ const fs = require('fs'); const path = require('path'); const handlebars = require('handlebars').create(); const annotator = require('./annotator'); const helpers = require('./helpers'); const templateFor = function(name) { return handlebars.compile( fs.readFileSync( path.resolve(__dirname, 'templates', name + '.txt'), 'utf8' ) ); }; const headerTemplate = templateFor('head'); const footerTemplate = templateFor('foot'); const detailTemplate = handlebars.compile( [ '
{{#show_code annotatedCode}}{{/show_code}}| File', ' | ', ' | Statements', ' | ', ' | Branches', ' | ', ' | Functions', ' | ', ' | Lines', ' | ', ' | 
|---|---|---|---|---|---|---|---|---|---|
| {{file}}', ' | ',
        '{{#show_picture}}{{metrics.statements.pct}}{{/show_picture}} | {{metrics.statements.pct}}%', ' | {{metrics.statements.covered}}/{{metrics.statements.total}}', ' | {{metrics.branches.pct}}%', ' | {{metrics.branches.covered}}/{{metrics.branches.total}}', ' | {{metrics.functions.pct}}%', ' | {{metrics.functions.covered}}/{{metrics.functions.total}}', ' | {{metrics.lines.pct}}%', ' | {{metrics.lines.covered}}/{{metrics.lines.total}}', ' |