.htaccess editor: code highlighting fixed

This commit is contained in:
Ruslan Keba 2013-03-25 17:44:25 +02:00
parent 09f9a7943d
commit 19b52f025c
3 changed files with 13 additions and 20 deletions

View file

@ -34,7 +34,7 @@
border: 1px solid #444;
padding: 2px;
font-family: Consolas, monospace;
font-size: 12px;
font-size: 13px;
}
</style>
<div class="FormBody">

View file

@ -35,8 +35,12 @@ CodeMirror.defineMode('htaccess', function() {
return 'comment';
}
if (ch === '$') {
state.tokens.unshift(tokenDollar);
return tokenize(stream, state);
stream.eatWhile(/[\w\$_]/);
return 'def';
}
if (ch === '%') {
stream.eatWhile(/[\w\_{}]/);
return 'tag';
}
if (ch === '+' || ch === '=') {
return 'operator';
@ -65,7 +69,6 @@ CodeMirror.defineMode('htaccess', function() {
}
stream.eatWhile(/\w/);
var cur = stream.current();
if (stream.peek() === '=' && /\w+/.test(cur)) return 'def';
return words.hasOwnProperty(cur) ? words[cur] : null;
}
@ -92,22 +95,6 @@ CodeMirror.defineMode('htaccess', function() {
};
};
var tokenDollar = function(stream, state) {
if (state.tokens.length > 1) stream.eat('$');
var ch = stream.next(), hungry = /\w/;
if (ch === '{') hungry = /[^}]/;
if (ch === '(') {
state.tokens[0] = tokenString(')');
return tokenize(stream, state);
}
if (!/\d/.test(ch)) {
stream.eatWhile(hungry);
stream.eat('}');
}
state.tokens.shift();
return 'def';
};
function tokenize(stream, state) {
return (state.tokens[0] || tokenBase) (stream, state);
};

View file

@ -17,6 +17,12 @@ RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [NC,L]
RewriteRule .*\.png$ crm.png [L]
Header set CacheControl max-age=13,public
RewriteRule (.*)\.png$ $1.png [L]
&lt;Location index.php&gt;
ExpiresByType "text/html; charset=UTF-8" A30
CacheEnable mem