var lineBreak = require('os').EOL;
-var CommentsProcessor = function CommentsProcessor(context, keepSpecialComments, keepBreaks, saveWaypoints) {
+function CommentsProcessor(context, keepSpecialComments, keepBreaks, saveWaypoints) {
this.comments = new EscapeStore('COMMENT');
this.specialComments = new EscapeStore('COMMENT_SPECIAL');
this.keepOne = keepSpecialComments == '1' || keepSpecialComments === 1;
this.keepBreaks = keepBreaks;
this.saveWaypoints = saveWaypoints;
-};
+}
function quoteScannerFor(data) {
var quoteMap = [];
var placeholderBrace = '__';
-var EscapeStore = function EscapeStore(placeholderRoot) {
+function EscapeStore(placeholderRoot) {
this.placeholderRoot = 'ESCAPED_' + placeholderRoot + '_CLEAN_CSS';
this.placeholderToData = {};
this.dataToPlaceholder = {};
this.count = 0;
this.restoreMatcher = new RegExp(this.placeholderRoot + '(\\d+)');
-};
+}
EscapeStore.prototype._nextPlaceholder = function (metadata) {
return {
return end;
}
-var ExpressionsProcessor = function ExpressionsProcessor(saveWaypoints) {
+function ExpressionsProcessor(saveWaypoints) {
this.expressions = new EscapeStore('EXPRESSION');
this.saveWaypoints = saveWaypoints;
-};
+}
ExpressionsProcessor.prototype.escape = function (data) {
var nextStart = 0;
var lineBreak = require('os').EOL;
-var FreeTextProcessor = function FreeTextProcessor(saveWaypoints) {
+function FreeTextProcessor(saveWaypoints) {
this.matches = new EscapeStore('FREE_TEXT');
this.saveWaypoints = saveWaypoints;
-};
+}
// Strip content tags by replacing them by the a special
// marker for further restoring. It's done via string scanning
var URL_SUFFIX = ')';
var lineBreak = require('os').EOL;
-var UrlsProcessor = function UrlsProcessor(context, saveWaypoints) {
+function UrlsProcessor(context, saveWaypoints) {
this.urls = new EscapeStore('URL');
this.context = context;
this.saveWaypoints = saveWaypoints;
-};
+}
// Strip urls by replacing them by a special
// marker for further restoring. It's done via string scanning
// Divides `data` into chunks of `chunkSize` for faster processing
-var Chunker = function Chunker(data, breakString, chunkSize) {
+function Chunker(data, breakString, chunkSize) {
this.chunks = [];
for (var cursor = 0, dataSize = data.length; cursor < dataSize;) {
this.chunks.push(data.substring(cursor, nextCursor + breakString.length));
cursor = nextCursor + breakString.length;
}
-};
+}
Chunker.prototype.isEmpty = function () {
return this.chunks.length === 0;
-var QuoteScanner = function QuoteScanner(data) {
+function QuoteScanner(data) {
this.data = data;
-};
+}
var findQuoteEnd = function (data, matched, cursor, oldCursor) {
var commentStartMark = '/*';
-var Splitter = function Splitter(separator) {
+function Splitter(separator) {
this.separator = separator;
-};
+}
Splitter.prototype.split = function (value) {
if (value.indexOf(this.separator) === -1)