Skip to content

Commit

Permalink
Make sure closing tags in comments are seen by mixed HTML mode
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Apr 9, 2011
1 parent d5805c8 commit 608ae6a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions mode/htmlmixed/htmlmixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,29 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
}
return style;
}
function maybeBackup(stream, pat, style) {
var cur = stream.current();
var close = cur.search(pat);
if (close > -1) stream.backUp(cur.length - close);
return style;
}
function javascript(stream, state) {
if (stream.match(/^<\/\s*script\s*>/i, false)) {
state.token = html;
state.curState = null;
return html(stream, state);
}
return jsMode.token(stream, state.localState);
return maybeBackup(stream, /<\/\s*script\s*>/,
jsMode.token(stream, state.localState));
}
function css(stream, state) {
if (stream.match(/^<\/\s*style\s*>/i, false)) {
state.token = html;
state.localState = null;
return html(stream, state);
}
return cssMode.token(stream, state.localState);
return maybeBackup(stream, /<\/\s*style\s*>/,
cssMode.token(stream, state.localState));
}

return {
Expand Down

0 comments on commit 608ae6a

Please sign in to comment.