erb support!

This commit is contained in:
Heigh Tech LLC 2011-03-16 08:14:47 +08:00 committed by Fabian Jakobs
commit 13bda087e8
2 changed files with 10 additions and 2 deletions

View file

@ -41,6 +41,7 @@ var oop = require("pilot/oop");
var TextMode = require("ace/mode/text").Mode;
var JavaScriptMode = require("ace/mode/javascript").Mode;
var CssMode = require("ace/mode/css").Mode;
var RubyMode = require("ace/mode/ruby").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var HtmlHighlightRules = require("ace/mode/html_highlight_rules").HtmlHighlightRules;
@ -49,6 +50,7 @@ var Mode = function() {
this.$js = new JavaScriptMode();
this.$css = new CssMode();
this.$ruby = new RubyMode();
};
oop.inherits(Mode, TextMode);
@ -91,6 +93,12 @@ oop.inherits(Mode, TextMode);
args[0] = split[1];
return this.$css[method].apply(this.$css, args);
}
var split = state.split("ruby-");
if (!split[0] && split[1]) {
args[0] = split[1];
return this.$ruby[method].apply(this.$ruby, args);
}
return defaultHandler ? defaultHandler() : undefined;
};

View file

@ -122,7 +122,7 @@ var HtmlHighlightRules = function() {
ruby : [ {
token : "text",
regex : ">",
regex : ".",
next : "ruby-start"
}, {
token : "keyword",
@ -202,7 +202,7 @@ var HtmlHighlightRules = function() {
this.addRules(rubyRules, "ruby-");
this.$rules["ruby-start"].unshift({
token: "text",
regex: "<\\/(?=%)",
regex: "%>",
next: "tag"
});
};