Skip to content
Browse files

Use relative paths, print the line source correctly

  • Loading branch information...
1 parent 3ad5685 commit e8f9454cc29731565773ac2ddc742a2477fc3eb7 @beaugunderson beaugunderson committed Jan 22, 2013
Showing with 9 additions and 6 deletions.
  1. +8 −5 lib/format/html/index.js
  2. +1 −1 lib/format/html/src.ejs
View
13 lib/format/html/index.js
@@ -25,10 +25,12 @@ function writeSource(outputDir, data, callback) {
try {
var outFile = path.join(outputDir, 'src', data.filename + '.html');
var template = path.join(__dirname, 'src.ejs');
+ var relativePath = path.relative(path.dirname(outFile), outputDir);
+
+ data.pathToCSS = path.join(relativePath, 'css');
+ data.pathToScripts = path.join(relativePath, 'scripts');
+ data.pathToRoot = relativePath;
- data.pathToCSS = path.resolve(path.join(outputDir, 'css'));
- data.pathToScripts = path.resolve(path.join(outputDir, 'scripts'));
- data.pathToRoot = path.resolve(outputDir);
data.green = getColoredLines(data, function (c) {return c >= 1; });
data.red = getColoredLines(data, function (c) {return c === 0; });
data.generated = new Date().toString();
@@ -92,7 +94,8 @@ function copyResources(outputDir) {
}
exports.report = function (coverageMap, outputDir, callback) {
- var outputDir = outputDir || 'covershot';
+ outputDir = outputDir || 'covershot';
+
coverageMap.generated = new Date().toString();
coverageMap.files = sortFiles(coverageMap.files);
@@ -160,4 +163,4 @@ function renderPieChart(percent) {
}
html += '</svg>';
return html;
-}
+}
View
2 lib/format/html/src.ejs
@@ -56,7 +56,7 @@
<section id="bod">
<section id="mainContent">
<script type="syntaxhighlighter" class="brush: js; class-name: 'rounded'"><![CDATA[<% for (var i in source) { %>
-<%- source[i].line %><% } %> ]]></script>
+<%- (source[i].line || source[i].source) %><% } %> ]]></script>
</section>
</section>
</div>

0 comments on commit e8f9454

Please sign in to comment.
Something went wrong with that request. Please try again.