Permalink
Browse files

erb support!

  • Loading branch information...
1 parent 20b6652 commit 13bda087e89a5145d68ad93c0511b8d561d2b15b Heigh Tech LLC committed with fjakobs Mar 16, 2011
Showing with 10 additions and 2 deletions.
  1. +8 −0 lib/ace/mode/html.js
  2. +2 −2 lib/ace/mode/html_highlight_rules.js
@@ -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;
};
@@ -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"
});
};

0 comments on commit 13bda08

Please sign in to comment.