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:
@ -1,8 +1,9 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
|
|
||||||
node_js:
|
node_js:
|
||||||
- 0.10
|
|
||||||
- 0.12
|
- 0.12
|
||||||
|
- 4
|
||||||
|
- 6
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
|
4
Makefile
4
Makefile
@ -1,5 +1,5 @@
|
|||||||
test:
|
test:
|
||||||
@NODE_ENV=test ./node_modules/.bin/mocha
|
@npm run test
|
||||||
|
|
||||||
lib-cov:
|
lib-cov:
|
||||||
@./node_modules/.bin/istanbul instrument --output lib-cov --no-compact --variable global.__coverage__ lib
|
@./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
|
travis: jshint test coveralls
|
||||||
|
|
||||||
jshint:
|
jshint:
|
||||||
@jshint --show-non-errors .
|
@npm run jshint
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'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');
|
textElem = require('../../plugins/_collections.js').elemsGroups.textContent.concat('title');
|
||||||
|
|
||||||
var defaults = {
|
var defaults = {
|
||||||
@ -69,14 +70,14 @@ function JS2SVG(config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.pretty) {
|
if (this.config.pretty) {
|
||||||
this.config.doctypeEnd += '\n';
|
this.config.doctypeEnd += EOL;
|
||||||
this.config.procInstEnd += '\n';
|
this.config.procInstEnd += EOL;
|
||||||
this.config.commentEnd += '\n';
|
this.config.commentEnd += EOL;
|
||||||
this.config.cdataEnd += '\n';
|
this.config.cdataEnd += EOL;
|
||||||
this.config.tagShortEnd += '\n';
|
this.config.tagShortEnd += EOL;
|
||||||
this.config.tagOpenEnd += '\n';
|
this.config.tagOpenEnd += EOL;
|
||||||
this.config.tagCloseEnd += '\n';
|
this.config.tagCloseEnd += EOL;
|
||||||
this.config.textEnd += '\n';
|
this.config.textEnd += EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.indentLevel = 0;
|
this.indentLevel = 0;
|
||||||
@ -282,7 +283,7 @@ JS2SVG.prototype.createElem = function(data) {
|
|||||||
|
|
||||||
if (this.textContext == data) {
|
if (this.textContext == data) {
|
||||||
this.textContext = null;
|
this.textContext = null;
|
||||||
if (this.config.pretty) dataEnd = '\n';
|
if (this.config.pretty) dataEnd = EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return openIndent +
|
return openIndent +
|
||||||
|
@ -44,7 +44,8 @@
|
|||||||
"example": "./examples"
|
"example": "./examples"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "make test"
|
"test": "set NODE_ENV=test && mocha",
|
||||||
|
"jshint": "jshint --show-non-errors ."
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"sax": "~1.2.1",
|
"sax": "~1.2.1",
|
||||||
|
@ -12,8 +12,8 @@ exports.params = {
|
|||||||
spaces: true
|
spaces: true
|
||||||
};
|
};
|
||||||
|
|
||||||
var regNewlinesNeedSpace = /(\S)\n(\S)/g,
|
var regNewlinesNeedSpace = /(\S)\r?\n(\S)/g,
|
||||||
regNewlines = /\n/g,
|
regNewlines = /\r?\n/g,
|
||||||
regSpaces = /\s{2,}/g;
|
regSpaces = /\s{2,}/g;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user