Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e4003b4

Browse files
committed
Crossplatform work. Fixes svg#538
1 parent 815f5cf commit e4003b4

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
language: node_js
22

33
node_js:
4-
- 0.10
54
- 0.12
5+
- 4
6+
- 6
67

78
branches:
89
only:

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
test:
2-
@NODE_ENV=test ./node_modules/.bin/mocha
2+
@npm run test
33

44
lib-cov:
55
@./node_modules/.bin/istanbul instrument --output lib-cov --no-compact --variable global.__coverage__ lib
@@ -16,6 +16,6 @@ coveralls: lib-cov
1616
travis: jshint test coveralls
1717

1818
jshint:
19-
@jshint --show-non-errors .
19+
@npm run jshint
2020

2121
.PHONY: test

lib/svgo/js2svg.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

3-
var EXTEND = require('whet.extend'),
3+
var EOL = require('os').EOL,
4+
EXTEND = require('whet.extend'),
45
textElem = require('../../plugins/_collections.js').elemsGroups.textContent.concat('title');
56

67
var defaults = {
@@ -69,14 +70,14 @@ function JS2SVG(config) {
6970
}
7071

7172
if (this.config.pretty) {
72-
this.config.doctypeEnd += '\n';
73-
this.config.procInstEnd += '\n';
74-
this.config.commentEnd += '\n';
75-
this.config.cdataEnd += '\n';
76-
this.config.tagShortEnd += '\n';
77-
this.config.tagOpenEnd += '\n';
78-
this.config.tagCloseEnd += '\n';
79-
this.config.textEnd += '\n';
73+
this.config.doctypeEnd += EOL;
74+
this.config.procInstEnd += EOL;
75+
this.config.commentEnd += EOL;
76+
this.config.cdataEnd += EOL;
77+
this.config.tagShortEnd += EOL;
78+
this.config.tagOpenEnd += EOL;
79+
this.config.tagCloseEnd += EOL;
80+
this.config.textEnd += EOL;
8081
}
8182

8283
this.indentLevel = 0;
@@ -282,7 +283,7 @@ JS2SVG.prototype.createElem = function(data) {
282283

283284
if (this.textContext == data) {
284285
this.textContext = null;
285-
if (this.config.pretty) dataEnd = '\n';
286+
if (this.config.pretty) dataEnd = EOL;
286287
}
287288

288289
return openIndent +

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
"example": "./examples"
4545
},
4646
"scripts": {
47-
"test": "make test"
47+
"test": "set NODE_ENV=test && mocha",
48+
"jshint": "jshint --show-non-errors ."
4849
},
4950
"dependencies": {
5051
"sax": "~1.2.1",

plugins/cleanupAttrs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ exports.params = {
1212
spaces: true
1313
};
1414

15-
var regNewlinesNeedSpace = /(\S)\n(\S)/g,
16-
regNewlines = /\n/g,
15+
var regNewlinesNeedSpace = /(\S)\r?\n(\S)/g,
16+
regNewlines = /\r?\n/g,
1717
regSpaces = /\s{2,}/g;
1818

1919
/**

0 commit comments

Comments
 (0)