docxtemplater
Version:
.docx generator working with templates and data (like Mustache)
195 lines (194 loc) • 5.7 kB
HTML
<html lang="en">
<head>
<title>Code coverage report for es6/render.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">all files</a> / <a href="index.html">es6/</a> render.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">96.43% </span>
<span class="quiet">Statements</span>
<span class='fraction'>27/28</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">92.86% </span>
<span class="quiet">Branches</span>
<span class='fraction'>13/14</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>3/3</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">96.43% </span>
<span class="quiet">Lines</span>
<span class='fraction'>27/28</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">5595×</span>
<span class="cline-any cline-yes">5595×</span>
<span class="cline-any cline-yes">27577×</span>
<span class="cline-any cline-yes">27577×</span>
<span class="cline-any cline-yes">27577×</span>
<span class="cline-any cline-yes">72×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">5523×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-yes">244×</span>
<span class="cline-any cline-yes">244×</span>
<span class="cline-any cline-yes">244×</span>
<span class="cline-any cline-yes">132×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">244×</span>
<span class="cline-any cline-yes">5595×</span>
<span class="cline-any cline-yes">5595×</span>
<span class="cline-any cline-yes">72×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">5523×</span>
<span class="cline-any cline-yes">253×</span>
<span class="cline-any cline-yes">252×</span>
<span class="cline-any cline-yes">17×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">252×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">5270×</span>
<span class="cline-any cline-yes">5270×</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-no"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">"use strict";
const ScopeManager = require("./scope-manager");
const DocUtils = require("./doc-utils");
function moduleRender(part, options) {
let moduleRendered;
for (let i = 0, l = options.modules.length; i < l; i++) {
const module = options.modules[i];
moduleRendered = module.render(part, options);
if (moduleRendered) {
return moduleRendered;
}
}
return false;
}
function render(options) {
options.render = render;
options.modules = options.modules;
if (!options.scopeManager) {
options.scopeManager = ScopeManager.createBaseScopeManager(options);
}
return options.compiled.map(function (part) {
const moduleRendered = moduleRender(part, options);
if (moduleRendered) {
return moduleRendered.value;
}
if (part.type === "placeholder") {
let value = options.scopeManager.getValue(part.value);
if (value == null) {
value = options.nullGetter(part);
}
return DocUtils.utf8ToWord(value);
}
<span class="missing-if-branch" title="else path not taken" >E</span>if (part.type === "content" || part.type === "tag") {
return part.value;
}
<span class="cstat-no" title="statement not covered" > throw new Error(`Unimplemented tag type "${part.type}"`);</span>
}).join("");
}
module.exports = render;
</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Mar 17 2017 11:22:16 GMT+0100 (CET)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>