1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-28 09:22:00 +03:00

Crossplatform work. Fixes #538

This commit is contained in:
GreLI
2016-08-20 20:39:55 +03:00
parent 815f5cf40c
commit e4003b4dd2
5 changed files with 19 additions and 16 deletions

View File

@ -1,8 +1,9 @@
language: node_js
node_js:
- 0.10
- 0.12
- 4
- 6
branches:
only:

View File

@ -1,5 +1,5 @@
test:
@NODE_ENV=test ./node_modules/.bin/mocha
@npm run test
lib-cov:
@./node_modules/.bin/istanbul instrument --output lib-cov --no-compact --variable global.__coverage__ lib
@ -16,6 +16,6 @@ coveralls: lib-cov
travis: jshint test coveralls
jshint:
@jshint --show-non-errors .
@npm run jshint
.PHONY: test

View File

@ -1,6 +1,7 @@
'use strict';
var EXTEND = require('whet.extend'),
var EOL = require('os').EOL,
EXTEND = require('whet.extend'),
textElem = require('../../plugins/_collections.js').elemsGroups.textContent.concat('title');
var defaults = {
@ -69,14 +70,14 @@ function JS2SVG(config) {
}
if (this.config.pretty) {
this.config.doctypeEnd += '\n';
this.config.procInstEnd += '\n';
this.config.commentEnd += '\n';
this.config.cdataEnd += '\n';
this.config.tagShortEnd += '\n';
this.config.tagOpenEnd += '\n';
this.config.tagCloseEnd += '\n';
this.config.textEnd += '\n';
this.config.doctypeEnd += EOL;
this.config.procInstEnd += EOL;
this.config.commentEnd += EOL;
this.config.cdataEnd += EOL;
this.config.tagShortEnd += EOL;
this.config.tagOpenEnd += EOL;
this.config.tagCloseEnd += EOL;
this.config.textEnd += EOL;
}
this.indentLevel = 0;
@ -282,7 +283,7 @@ JS2SVG.prototype.createElem = function(data) {
if (this.textContext == data) {
this.textContext = null;
if (this.config.pretty) dataEnd = '\n';
if (this.config.pretty) dataEnd = EOL;
}
return openIndent +

View File

@ -44,7 +44,8 @@
"example": "./examples"
},
"scripts": {
"test": "make test"
"test": "set NODE_ENV=test && mocha",
"jshint": "jshint --show-non-errors ."
},
"dependencies": {
"sax": "~1.2.1",

View File

@ -12,8 +12,8 @@ exports.params = {
spaces: true
};
var regNewlinesNeedSpace = /(\S)\n(\S)/g,
regNewlines = /\n/g,
var regNewlinesNeedSpace = /(\S)\r?\n(\S)/g,
regNewlines = /\r?\n/g,
regSpaces = /\s{2,}/g;
/**