Kaynağa Gözat

fix code styling issues

pull/703/head
Yotam Madem 6 yıl önce
ebeveyn
işleme
395a24df42
1 değiştirilmiş dosya ile 6 ekleme ve 9 silme
  1. +6
    -9
      mustache.js

+ 6
- 9
mustache.js Dosyayı Görüntüle

@@ -132,7 +132,7 @@
function stripSpace () { function stripSpace () {
if (hasTag && !nonSpace) { if (hasTag && !nonSpace) {
while (spaces.length) while (spaces.length)
delete tokens[spaces.pop()];
delete tokens[spaces.pop()];
} else { } else {
spaces = []; spaces = [];
} }
@@ -182,7 +182,7 @@
start += 1; start += 1;


// Check for whitespace on the current line. // Check for whitespace on the current line.
if (chr === '\n'){
if (chr === '\n') {
stripSpace(); stripSpace();
indentation = ''; indentation = '';
tagIndex = 0; tagIndex = 0;
@@ -193,12 +193,11 @@
// Match the opening tag. // Match the opening tag.
if (!scanner.scan(openingTagRe)) if (!scanner.scan(openingTagRe))
break; break;
hasTag = true; hasTag = true;


// Get the tag type. // Get the tag type.
type = scanner.scan(tagRe) || 'name'; type = scanner.scan(tagRe) || 'name';

scanner.scan(whiteRe); scanner.scan(whiteRe);


// Get the tag value. // Get the tag value.
@@ -224,9 +223,7 @@
if (type == '>' && tagIndex == 0) { if (type == '>' && tagIndex == 0) {
token.push(indentation); token.push(indentation);
} }

tagIndex ++; tagIndex ++;

tokens.push(token); tokens.push(token);


if (type === '#' || type === '^') { if (type === '#' || type === '^') {
@@ -256,7 +253,7 @@
if (openSection) if (openSection)
throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos); throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);


return nestTokens(squashTokens(tokens));
return nestTokens(squashTokens(tokens));
} }


/** /**
@@ -560,10 +557,10 @@
else if (symbol === 'name') value = this.escapedValue(token, context); else if (symbol === 'name') value = this.escapedValue(token, context);
else if (symbol === 'text') value = this.rawValue(token); else if (symbol === 'text') value = this.rawValue(token);


if (value !== undefined) {
if (value !== undefined)
buffer += value; buffer += value;
}
} }

return buffer; return buffer;
}; };




Yükleniyor…
İptal
Kaydet