dgeni-packages
Advanced tools
Comparing version 0.10.8 to 0.10.9
@@ -17,17 +17,21 @@ var _ = require('lodash'); | ||
// ignore first line if it has no indentation and there is more than one line | ||
// this is because sometimes our text starts in the middle of a line of other | ||
// text that is indented and so doesn't appear to have an indent when it really does. | ||
var ignoreLine = (lines[0][0] != ' ' && lines.length > 1); | ||
if ( ignoreLine && !emptyLinesRemoved ) { | ||
lines.shift(); | ||
} | ||
if(lines.length) { | ||
lines.forEach(function(line){ | ||
if ( !isEmpty(line) ) { | ||
var indent = line.match(/^\s*/)[0].length; | ||
minIndent = Math.min(minIndent, indent); | ||
// ignore first line if it has no indentation and there is more than one line | ||
// this is because sometimes our text starts in the middle of a line of other | ||
// text that is indented and so doesn't appear to have an indent when it really does. | ||
var ignoreLine = (lines[0][0] != ' ' && lines.length > 1); | ||
if ( ignoreLine && !emptyLinesRemoved ) { | ||
lines.shift(); | ||
} | ||
}); | ||
lines.forEach(function(line){ | ||
if ( !isEmpty(line) ) { | ||
var indent = line.match(/^\s*/)[0].length; | ||
minIndent = Math.min(minIndent, indent); | ||
} | ||
}); | ||
} | ||
return minIndent; | ||
@@ -34,0 +38,0 @@ } |
@@ -45,2 +45,6 @@ var mockPackage = require('../mocks/mockPackage'); | ||
it("should cope with an empty code block", function() { | ||
expect(trimIndentation('\n\n')).toEqual(''); | ||
}); | ||
describe("calcIndent", function() { | ||
@@ -55,2 +59,5 @@ it("should calculate simple leading white-space from a single line of text", function() { | ||
}); | ||
it("should cope with an empty code block", function() { | ||
expect(trimIndentation.calcIndent('\n\n')).toEqual(9999); | ||
}); | ||
}); | ||
@@ -57,0 +64,0 @@ |
# Changelog | ||
## v0.10.9 15th Februrary 2015 | ||
* fix(base/trimIndentation): cope with empty text blocks 8cb1bcb8 | ||
## v0.10.8 15th December 2014 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "dgeni-packages", | ||
"version": "0.10.8", | ||
"version": "0.10.9", | ||
"description": "A collection of dgeni packages for generating documentation from source code", | ||
@@ -5,0 +5,0 @@ "scripts": { |
327851
6226