Edit File by line
/home/barbar84/www/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/pug
File: pug.js
// CodeMirror, copyright (c) by Marijn Haverbeke and others
[0] Fix | Delete
// Distributed under an MIT license: http://codemirror.net/LICENSE
[1] Fix | Delete
[2] Fix | Delete
(function(mod) {
[3] Fix | Delete
if (typeof exports == "object" && typeof module == "object") // CommonJS
[4] Fix | Delete
mod(require("../../lib/codemirror"), require("../javascript/javascript"), require("../css/css"), require("../htmlmixed/htmlmixed"));
[5] Fix | Delete
else if (typeof define == "function" && define.amd) // AMD
[6] Fix | Delete
define(["../../lib/codemirror", "../javascript/javascript", "../css/css", "../htmlmixed/htmlmixed"], mod);
[7] Fix | Delete
else // Plain browser env
[8] Fix | Delete
mod(CodeMirror);
[9] Fix | Delete
})(function(CodeMirror) {
[10] Fix | Delete
"use strict";
[11] Fix | Delete
[12] Fix | Delete
CodeMirror.defineMode("pug", function (config) {
[13] Fix | Delete
// token types
[14] Fix | Delete
var KEYWORD = 'keyword';
[15] Fix | Delete
var DOCTYPE = 'meta';
[16] Fix | Delete
var ID = 'builtin';
[17] Fix | Delete
var CLASS = 'qualifier';
[18] Fix | Delete
[19] Fix | Delete
var ATTRS_NEST = {
[20] Fix | Delete
'{': '}',
[21] Fix | Delete
'(': ')',
[22] Fix | Delete
'[': ']'
[23] Fix | Delete
};
[24] Fix | Delete
[25] Fix | Delete
var jsMode = CodeMirror.getMode(config, 'javascript');
[26] Fix | Delete
[27] Fix | Delete
function State() {
[28] Fix | Delete
this.javaScriptLine = false;
[29] Fix | Delete
this.javaScriptLineExcludesColon = false;
[30] Fix | Delete
[31] Fix | Delete
this.javaScriptArguments = false;
[32] Fix | Delete
this.javaScriptArgumentsDepth = 0;
[33] Fix | Delete
[34] Fix | Delete
this.isInterpolating = false;
[35] Fix | Delete
this.interpolationNesting = 0;
[36] Fix | Delete
[37] Fix | Delete
this.jsState = CodeMirror.startState(jsMode);
[38] Fix | Delete
[39] Fix | Delete
this.restOfLine = '';
[40] Fix | Delete
[41] Fix | Delete
this.isIncludeFiltered = false;
[42] Fix | Delete
this.isEach = false;
[43] Fix | Delete
[44] Fix | Delete
this.lastTag = '';
[45] Fix | Delete
this.scriptType = '';
[46] Fix | Delete
[47] Fix | Delete
// Attributes Mode
[48] Fix | Delete
this.isAttrs = false;
[49] Fix | Delete
this.attrsNest = [];
[50] Fix | Delete
this.inAttributeName = true;
[51] Fix | Delete
this.attributeIsType = false;
[52] Fix | Delete
this.attrValue = '';
[53] Fix | Delete
[54] Fix | Delete
// Indented Mode
[55] Fix | Delete
this.indentOf = Infinity;
[56] Fix | Delete
this.indentToken = '';
[57] Fix | Delete
[58] Fix | Delete
this.innerMode = null;
[59] Fix | Delete
this.innerState = null;
[60] Fix | Delete
[61] Fix | Delete
this.innerModeForLine = false;
[62] Fix | Delete
}
[63] Fix | Delete
/**
[64] Fix | Delete
* Safely copy a state
[65] Fix | Delete
*
[66] Fix | Delete
* @return {State}
[67] Fix | Delete
*/
[68] Fix | Delete
State.prototype.copy = function () {
[69] Fix | Delete
var res = new State();
[70] Fix | Delete
res.javaScriptLine = this.javaScriptLine;
[71] Fix | Delete
res.javaScriptLineExcludesColon = this.javaScriptLineExcludesColon;
[72] Fix | Delete
res.javaScriptArguments = this.javaScriptArguments;
[73] Fix | Delete
res.javaScriptArgumentsDepth = this.javaScriptArgumentsDepth;
[74] Fix | Delete
res.isInterpolating = this.isInterpolating;
[75] Fix | Delete
res.interpolationNesting = this.interpolationNesting;
[76] Fix | Delete
[77] Fix | Delete
res.jsState = CodeMirror.copyState(jsMode, this.jsState);
[78] Fix | Delete
[79] Fix | Delete
res.innerMode = this.innerMode;
[80] Fix | Delete
if (this.innerMode && this.innerState) {
[81] Fix | Delete
res.innerState = CodeMirror.copyState(this.innerMode, this.innerState);
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
res.restOfLine = this.restOfLine;
[85] Fix | Delete
[86] Fix | Delete
res.isIncludeFiltered = this.isIncludeFiltered;
[87] Fix | Delete
res.isEach = this.isEach;
[88] Fix | Delete
res.lastTag = this.lastTag;
[89] Fix | Delete
res.scriptType = this.scriptType;
[90] Fix | Delete
res.isAttrs = this.isAttrs;
[91] Fix | Delete
res.attrsNest = this.attrsNest.slice();
[92] Fix | Delete
res.inAttributeName = this.inAttributeName;
[93] Fix | Delete
res.attributeIsType = this.attributeIsType;
[94] Fix | Delete
res.attrValue = this.attrValue;
[95] Fix | Delete
res.indentOf = this.indentOf;
[96] Fix | Delete
res.indentToken = this.indentToken;
[97] Fix | Delete
[98] Fix | Delete
res.innerModeForLine = this.innerModeForLine;
[99] Fix | Delete
[100] Fix | Delete
return res;
[101] Fix | Delete
};
[102] Fix | Delete
[103] Fix | Delete
function javaScript(stream, state) {
[104] Fix | Delete
if (stream.sol()) {
[105] Fix | Delete
// if javaScriptLine was set at end of line, ignore it
[106] Fix | Delete
state.javaScriptLine = false;
[107] Fix | Delete
state.javaScriptLineExcludesColon = false;
[108] Fix | Delete
}
[109] Fix | Delete
if (state.javaScriptLine) {
[110] Fix | Delete
if (state.javaScriptLineExcludesColon && stream.peek() === ':') {
[111] Fix | Delete
state.javaScriptLine = false;
[112] Fix | Delete
state.javaScriptLineExcludesColon = false;
[113] Fix | Delete
return;
[114] Fix | Delete
}
[115] Fix | Delete
var tok = jsMode.token(stream, state.jsState);
[116] Fix | Delete
if (stream.eol()) state.javaScriptLine = false;
[117] Fix | Delete
return tok || true;
[118] Fix | Delete
}
[119] Fix | Delete
}
[120] Fix | Delete
function javaScriptArguments(stream, state) {
[121] Fix | Delete
if (state.javaScriptArguments) {
[122] Fix | Delete
if (state.javaScriptArgumentsDepth === 0 && stream.peek() !== '(') {
[123] Fix | Delete
state.javaScriptArguments = false;
[124] Fix | Delete
return;
[125] Fix | Delete
}
[126] Fix | Delete
if (stream.peek() === '(') {
[127] Fix | Delete
state.javaScriptArgumentsDepth++;
[128] Fix | Delete
} else if (stream.peek() === ')') {
[129] Fix | Delete
state.javaScriptArgumentsDepth--;
[130] Fix | Delete
}
[131] Fix | Delete
if (state.javaScriptArgumentsDepth === 0) {
[132] Fix | Delete
state.javaScriptArguments = false;
[133] Fix | Delete
return;
[134] Fix | Delete
}
[135] Fix | Delete
[136] Fix | Delete
var tok = jsMode.token(stream, state.jsState);
[137] Fix | Delete
return tok || true;
[138] Fix | Delete
}
[139] Fix | Delete
}
[140] Fix | Delete
[141] Fix | Delete
function yieldStatement(stream) {
[142] Fix | Delete
if (stream.match(/^yield\b/)) {
[143] Fix | Delete
return 'keyword';
[144] Fix | Delete
}
[145] Fix | Delete
}
[146] Fix | Delete
[147] Fix | Delete
function doctype(stream) {
[148] Fix | Delete
if (stream.match(/^(?:doctype) *([^\n]+)?/)) {
[149] Fix | Delete
return DOCTYPE;
[150] Fix | Delete
}
[151] Fix | Delete
}
[152] Fix | Delete
[153] Fix | Delete
function interpolation(stream, state) {
[154] Fix | Delete
if (stream.match('#{')) {
[155] Fix | Delete
state.isInterpolating = true;
[156] Fix | Delete
state.interpolationNesting = 0;
[157] Fix | Delete
return 'punctuation';
[158] Fix | Delete
}
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
function interpolationContinued(stream, state) {
[162] Fix | Delete
if (state.isInterpolating) {
[163] Fix | Delete
if (stream.peek() === '}') {
[164] Fix | Delete
state.interpolationNesting--;
[165] Fix | Delete
if (state.interpolationNesting < 0) {
[166] Fix | Delete
stream.next();
[167] Fix | Delete
state.isInterpolating = false;
[168] Fix | Delete
return 'punctuation';
[169] Fix | Delete
}
[170] Fix | Delete
} else if (stream.peek() === '{') {
[171] Fix | Delete
state.interpolationNesting++;
[172] Fix | Delete
}
[173] Fix | Delete
return jsMode.token(stream, state.jsState) || true;
[174] Fix | Delete
}
[175] Fix | Delete
}
[176] Fix | Delete
[177] Fix | Delete
function caseStatement(stream, state) {
[178] Fix | Delete
if (stream.match(/^case\b/)) {
[179] Fix | Delete
state.javaScriptLine = true;
[180] Fix | Delete
return KEYWORD;
[181] Fix | Delete
}
[182] Fix | Delete
}
[183] Fix | Delete
[184] Fix | Delete
function when(stream, state) {
[185] Fix | Delete
if (stream.match(/^when\b/)) {
[186] Fix | Delete
state.javaScriptLine = true;
[187] Fix | Delete
state.javaScriptLineExcludesColon = true;
[188] Fix | Delete
return KEYWORD;
[189] Fix | Delete
}
[190] Fix | Delete
}
[191] Fix | Delete
[192] Fix | Delete
function defaultStatement(stream) {
[193] Fix | Delete
if (stream.match(/^default\b/)) {
[194] Fix | Delete
return KEYWORD;
[195] Fix | Delete
}
[196] Fix | Delete
}
[197] Fix | Delete
[198] Fix | Delete
function extendsStatement(stream, state) {
[199] Fix | Delete
if (stream.match(/^extends?\b/)) {
[200] Fix | Delete
state.restOfLine = 'string';
[201] Fix | Delete
return KEYWORD;
[202] Fix | Delete
}
[203] Fix | Delete
}
[204] Fix | Delete
[205] Fix | Delete
function append(stream, state) {
[206] Fix | Delete
if (stream.match(/^append\b/)) {
[207] Fix | Delete
state.restOfLine = 'variable';
[208] Fix | Delete
return KEYWORD;
[209] Fix | Delete
}
[210] Fix | Delete
}
[211] Fix | Delete
function prepend(stream, state) {
[212] Fix | Delete
if (stream.match(/^prepend\b/)) {
[213] Fix | Delete
state.restOfLine = 'variable';
[214] Fix | Delete
return KEYWORD;
[215] Fix | Delete
}
[216] Fix | Delete
}
[217] Fix | Delete
function block(stream, state) {
[218] Fix | Delete
if (stream.match(/^block\b *(?:(prepend|append)\b)?/)) {
[219] Fix | Delete
state.restOfLine = 'variable';
[220] Fix | Delete
return KEYWORD;
[221] Fix | Delete
}
[222] Fix | Delete
}
[223] Fix | Delete
[224] Fix | Delete
function include(stream, state) {
[225] Fix | Delete
if (stream.match(/^include\b/)) {
[226] Fix | Delete
state.restOfLine = 'string';
[227] Fix | Delete
return KEYWORD;
[228] Fix | Delete
}
[229] Fix | Delete
}
[230] Fix | Delete
[231] Fix | Delete
function includeFiltered(stream, state) {
[232] Fix | Delete
if (stream.match(/^include:([a-zA-Z0-9\-]+)/, false) && stream.match('include')) {
[233] Fix | Delete
state.isIncludeFiltered = true;
[234] Fix | Delete
return KEYWORD;
[235] Fix | Delete
}
[236] Fix | Delete
}
[237] Fix | Delete
[238] Fix | Delete
function includeFilteredContinued(stream, state) {
[239] Fix | Delete
if (state.isIncludeFiltered) {
[240] Fix | Delete
var tok = filter(stream, state);
[241] Fix | Delete
state.isIncludeFiltered = false;
[242] Fix | Delete
state.restOfLine = 'string';
[243] Fix | Delete
return tok;
[244] Fix | Delete
}
[245] Fix | Delete
}
[246] Fix | Delete
[247] Fix | Delete
function mixin(stream, state) {
[248] Fix | Delete
if (stream.match(/^mixin\b/)) {
[249] Fix | Delete
state.javaScriptLine = true;
[250] Fix | Delete
return KEYWORD;
[251] Fix | Delete
}
[252] Fix | Delete
}
[253] Fix | Delete
[254] Fix | Delete
function call(stream, state) {
[255] Fix | Delete
if (stream.match(/^\+([-\w]+)/)) {
[256] Fix | Delete
if (!stream.match(/^\( *[-\w]+ *=/, false)) {
[257] Fix | Delete
state.javaScriptArguments = true;
[258] Fix | Delete
state.javaScriptArgumentsDepth = 0;
[259] Fix | Delete
}
[260] Fix | Delete
return 'variable';
[261] Fix | Delete
}
[262] Fix | Delete
if (stream.match(/^\+#{/, false)) {
[263] Fix | Delete
stream.next();
[264] Fix | Delete
state.mixinCallAfter = true;
[265] Fix | Delete
return interpolation(stream, state);
[266] Fix | Delete
}
[267] Fix | Delete
}
[268] Fix | Delete
function callArguments(stream, state) {
[269] Fix | Delete
if (state.mixinCallAfter) {
[270] Fix | Delete
state.mixinCallAfter = false;
[271] Fix | Delete
if (!stream.match(/^\( *[-\w]+ *=/, false)) {
[272] Fix | Delete
state.javaScriptArguments = true;
[273] Fix | Delete
state.javaScriptArgumentsDepth = 0;
[274] Fix | Delete
}
[275] Fix | Delete
return true;
[276] Fix | Delete
}
[277] Fix | Delete
}
[278] Fix | Delete
[279] Fix | Delete
function conditional(stream, state) {
[280] Fix | Delete
if (stream.match(/^(if|unless|else if|else)\b/)) {
[281] Fix | Delete
state.javaScriptLine = true;
[282] Fix | Delete
return KEYWORD;
[283] Fix | Delete
}
[284] Fix | Delete
}
[285] Fix | Delete
[286] Fix | Delete
function each(stream, state) {
[287] Fix | Delete
if (stream.match(/^(- *)?(each|for)\b/)) {
[288] Fix | Delete
state.isEach = true;
[289] Fix | Delete
return KEYWORD;
[290] Fix | Delete
}
[291] Fix | Delete
}
[292] Fix | Delete
function eachContinued(stream, state) {
[293] Fix | Delete
if (state.isEach) {
[294] Fix | Delete
if (stream.match(/^ in\b/)) {
[295] Fix | Delete
state.javaScriptLine = true;
[296] Fix | Delete
state.isEach = false;
[297] Fix | Delete
return KEYWORD;
[298] Fix | Delete
} else if (stream.sol() || stream.eol()) {
[299] Fix | Delete
state.isEach = false;
[300] Fix | Delete
} else if (stream.next()) {
[301] Fix | Delete
while (!stream.match(/^ in\b/, false) && stream.next());
[302] Fix | Delete
return 'variable';
[303] Fix | Delete
}
[304] Fix | Delete
}
[305] Fix | Delete
}
[306] Fix | Delete
[307] Fix | Delete
function whileStatement(stream, state) {
[308] Fix | Delete
if (stream.match(/^while\b/)) {
[309] Fix | Delete
state.javaScriptLine = true;
[310] Fix | Delete
return KEYWORD;
[311] Fix | Delete
}
[312] Fix | Delete
}
[313] Fix | Delete
[314] Fix | Delete
function tag(stream, state) {
[315] Fix | Delete
var captures;
[316] Fix | Delete
if (captures = stream.match(/^(\w(?:[-:\w]*\w)?)\/?/)) {
[317] Fix | Delete
state.lastTag = captures[1].toLowerCase();
[318] Fix | Delete
if (state.lastTag === 'script') {
[319] Fix | Delete
state.scriptType = 'application/javascript';
[320] Fix | Delete
}
[321] Fix | Delete
return 'tag';
[322] Fix | Delete
}
[323] Fix | Delete
}
[324] Fix | Delete
[325] Fix | Delete
function filter(stream, state) {
[326] Fix | Delete
if (stream.match(/^:([\w\-]+)/)) {
[327] Fix | Delete
var innerMode;
[328] Fix | Delete
if (config && config.innerModes) {
[329] Fix | Delete
innerMode = config.innerModes(stream.current().substring(1));
[330] Fix | Delete
}
[331] Fix | Delete
if (!innerMode) {
[332] Fix | Delete
innerMode = stream.current().substring(1);
[333] Fix | Delete
}
[334] Fix | Delete
if (typeof innerMode === 'string') {
[335] Fix | Delete
innerMode = CodeMirror.getMode(config, innerMode);
[336] Fix | Delete
}
[337] Fix | Delete
setInnerMode(stream, state, innerMode);
[338] Fix | Delete
return 'atom';
[339] Fix | Delete
}
[340] Fix | Delete
}
[341] Fix | Delete
[342] Fix | Delete
function code(stream, state) {
[343] Fix | Delete
if (stream.match(/^(!?=|-)/)) {
[344] Fix | Delete
state.javaScriptLine = true;
[345] Fix | Delete
return 'punctuation';
[346] Fix | Delete
}
[347] Fix | Delete
}
[348] Fix | Delete
[349] Fix | Delete
function id(stream) {
[350] Fix | Delete
if (stream.match(/^#([\w-]+)/)) {
[351] Fix | Delete
return ID;
[352] Fix | Delete
}
[353] Fix | Delete
}
[354] Fix | Delete
[355] Fix | Delete
function className(stream) {
[356] Fix | Delete
if (stream.match(/^\.([\w-]+)/)) {
[357] Fix | Delete
return CLASS;
[358] Fix | Delete
}
[359] Fix | Delete
}
[360] Fix | Delete
[361] Fix | Delete
function attrs(stream, state) {
[362] Fix | Delete
if (stream.peek() == '(') {
[363] Fix | Delete
stream.next();
[364] Fix | Delete
state.isAttrs = true;
[365] Fix | Delete
state.attrsNest = [];
[366] Fix | Delete
state.inAttributeName = true;
[367] Fix | Delete
state.attrValue = '';
[368] Fix | Delete
state.attributeIsType = false;
[369] Fix | Delete
return 'punctuation';
[370] Fix | Delete
}
[371] Fix | Delete
}
[372] Fix | Delete
[373] Fix | Delete
function attrsContinued(stream, state) {
[374] Fix | Delete
if (state.isAttrs) {
[375] Fix | Delete
if (ATTRS_NEST[stream.peek()]) {
[376] Fix | Delete
state.attrsNest.push(ATTRS_NEST[stream.peek()]);
[377] Fix | Delete
}
[378] Fix | Delete
if (state.attrsNest[state.attrsNest.length - 1] === stream.peek()) {
[379] Fix | Delete
state.attrsNest.pop();
[380] Fix | Delete
} else if (stream.eat(')')) {
[381] Fix | Delete
state.isAttrs = false;
[382] Fix | Delete
return 'punctuation';
[383] Fix | Delete
}
[384] Fix | Delete
if (state.inAttributeName && stream.match(/^[^=,\)!]+/)) {
[385] Fix | Delete
if (stream.peek() === '=' || stream.peek() === '!') {
[386] Fix | Delete
state.inAttributeName = false;
[387] Fix | Delete
state.jsState = CodeMirror.startState(jsMode);
[388] Fix | Delete
if (state.lastTag === 'script' && stream.current().trim().toLowerCase() === 'type') {
[389] Fix | Delete
state.attributeIsType = true;
[390] Fix | Delete
} else {
[391] Fix | Delete
state.attributeIsType = false;
[392] Fix | Delete
}
[393] Fix | Delete
}
[394] Fix | Delete
return 'attribute';
[395] Fix | Delete
}
[396] Fix | Delete
[397] Fix | Delete
var tok = jsMode.token(stream, state.jsState);
[398] Fix | Delete
if (state.attributeIsType && tok === 'string') {
[399] Fix | Delete
state.scriptType = stream.current().toString();
[400] Fix | Delete
}
[401] Fix | Delete
if (state.attrsNest.length === 0 && (tok === 'string' || tok === 'variable' || tok === 'keyword')) {
[402] Fix | Delete
try {
[403] Fix | Delete
Function('', 'var x ' + state.attrValue.replace(/,\s*$/, '').replace(/^!/, ''));
[404] Fix | Delete
state.inAttributeName = true;
[405] Fix | Delete
state.attrValue = '';
[406] Fix | Delete
stream.backUp(stream.current().length);
[407] Fix | Delete
return attrsContinued(stream, state);
[408] Fix | Delete
} catch (ex) {
[409] Fix | Delete
//not the end of an attribute
[410] Fix | Delete
}
[411] Fix | Delete
}
[412] Fix | Delete
state.attrValue += stream.current();
[413] Fix | Delete
return tok || true;
[414] Fix | Delete
}
[415] Fix | Delete
}
[416] Fix | Delete
[417] Fix | Delete
function attributesBlock(stream, state) {
[418] Fix | Delete
if (stream.match(/^&attributes\b/)) {
[419] Fix | Delete
state.javaScriptArguments = true;
[420] Fix | Delete
state.javaScriptArgumentsDepth = 0;
[421] Fix | Delete
return 'keyword';
[422] Fix | Delete
}
[423] Fix | Delete
}
[424] Fix | Delete
[425] Fix | Delete
function indent(stream) {
[426] Fix | Delete
if (stream.sol() && stream.eatSpace()) {
[427] Fix | Delete
return 'indent';
[428] Fix | Delete
}
[429] Fix | Delete
}
[430] Fix | Delete
[431] Fix | Delete
function comment(stream, state) {
[432] Fix | Delete
if (stream.match(/^ *\/\/(-)?([^\n]*)/)) {
[433] Fix | Delete
state.indentOf = stream.indentation();
[434] Fix | Delete
state.indentToken = 'comment';
[435] Fix | Delete
return 'comment';
[436] Fix | Delete
}
[437] Fix | Delete
}
[438] Fix | Delete
[439] Fix | Delete
function colon(stream) {
[440] Fix | Delete
if (stream.match(/^: */)) {
[441] Fix | Delete
return 'colon';
[442] Fix | Delete
}
[443] Fix | Delete
}
[444] Fix | Delete
[445] Fix | Delete
function text(stream, state) {
[446] Fix | Delete
if (stream.match(/^(?:\| ?| )([^\n]+)/)) {
[447] Fix | Delete
return 'string';
[448] Fix | Delete
}
[449] Fix | Delete
if (stream.match(/^(<[^\n]*)/, false)) {
[450] Fix | Delete
// html string
[451] Fix | Delete
setInnerMode(stream, state, 'htmlmixed');
[452] Fix | Delete
state.innerModeForLine = true;
[453] Fix | Delete
return innerMode(stream, state, true);
[454] Fix | Delete
}
[455] Fix | Delete
}
[456] Fix | Delete
[457] Fix | Delete
function dot(stream, state) {
[458] Fix | Delete
if (stream.eat('.')) {
[459] Fix | Delete
var innerMode = null;
[460] Fix | Delete
if (state.lastTag === 'script' && state.scriptType.toLowerCase().indexOf('javascript') != -1) {
[461] Fix | Delete
innerMode = state.scriptType.toLowerCase().replace(/"|'/g, '');
[462] Fix | Delete
} else if (state.lastTag === 'style') {
[463] Fix | Delete
innerMode = 'css';
[464] Fix | Delete
}
[465] Fix | Delete
setInnerMode(stream, state, innerMode);
[466] Fix | Delete
return 'dot';
[467] Fix | Delete
}
[468] Fix | Delete
}
[469] Fix | Delete
[470] Fix | Delete
function fail(stream) {
[471] Fix | Delete
stream.next();
[472] Fix | Delete
return null;
[473] Fix | Delete
}
[474] Fix | Delete
[475] Fix | Delete
[476] Fix | Delete
function setInnerMode(stream, state, mode) {
[477] Fix | Delete
mode = CodeMirror.mimeModes[mode] || mode;
[478] Fix | Delete
mode = config.innerModes ? config.innerModes(mode) || mode : mode;
[479] Fix | Delete
mode = CodeMirror.mimeModes[mode] || mode;
[480] Fix | Delete
mode = CodeMirror.getMode(config, mode);
[481] Fix | Delete
state.indentOf = stream.indentation();
[482] Fix | Delete
[483] Fix | Delete
if (mode && mode.name !== 'null') {
[484] Fix | Delete
state.innerMode = mode;
[485] Fix | Delete
} else {
[486] Fix | Delete
state.indentToken = 'string';
[487] Fix | Delete
}
[488] Fix | Delete
}
[489] Fix | Delete
function innerMode(stream, state, force) {
[490] Fix | Delete
if (stream.indentation() > state.indentOf || (state.innerModeForLine && !stream.sol()) || force) {
[491] Fix | Delete
if (state.innerMode) {
[492] Fix | Delete
if (!state.innerState) {
[493] Fix | Delete
state.innerState = state.innerMode.startState ? CodeMirror.startState(state.innerMode, stream.indentation()) : {};
[494] Fix | Delete
}
[495] Fix | Delete
return stream.hideFirstChars(state.indentOf + 2, function () {
[496] Fix | Delete
return state.innerMode.token(stream, state.innerState) || true;
[497] Fix | Delete
});
[498] Fix | Delete
} else {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function