add ruby symbol and erb
This commit is contained in:
parent
8d8ac9ead6
commit
ae8e262395
2 changed files with 34 additions and 0 deletions
|
|
@ -40,6 +40,7 @@ define(function(require, exports, module) {
|
||||||
var oop = require("pilot/oop");
|
var oop = require("pilot/oop");
|
||||||
var CssHighlightRules = require("ace/mode/css_highlight_rules").CssHighlightRules;
|
var CssHighlightRules = require("ace/mode/css_highlight_rules").CssHighlightRules;
|
||||||
var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
|
var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
|
||||||
|
var RubyHighlightRules = require("ace/mode/ruby_highlight_rules").RubyHighlightRules;
|
||||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
var HtmlHighlightRules = function() {
|
var HtmlHighlightRules = function() {
|
||||||
|
|
@ -67,6 +68,10 @@ var HtmlHighlightRules = function() {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "<(?=\s*style)",
|
regex : "<(?=\s*style)",
|
||||||
next : "css"
|
next : "css"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "<(?=\s*%)",
|
||||||
|
next : "ruby"
|
||||||
}, {
|
}, {
|
||||||
token : "text", // opening tag
|
token : "text", // opening tag
|
||||||
regex : "<\\/?",
|
regex : "<\\/?",
|
||||||
|
|
@ -115,6 +120,24 @@ var HtmlHighlightRules = function() {
|
||||||
regex : "'.*?'"
|
regex : "'.*?'"
|
||||||
} ],
|
} ],
|
||||||
|
|
||||||
|
ruby : [ {
|
||||||
|
token : "text",
|
||||||
|
regex : ">",
|
||||||
|
next : "ruby-start"
|
||||||
|
}, {
|
||||||
|
token : "keyword",
|
||||||
|
regex : "[-_a-zA-Z0-9:]+"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : '".*?"'
|
||||||
|
}, {
|
||||||
|
token : "string",
|
||||||
|
regex : "'.*?'"
|
||||||
|
} ],
|
||||||
|
|
||||||
tag : [ {
|
tag : [ {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : ">",
|
regex : ">",
|
||||||
|
|
@ -174,6 +197,14 @@ var HtmlHighlightRules = function() {
|
||||||
regex: "<\\/(?=style)",
|
regex: "<\\/(?=style)",
|
||||||
next: "tag"
|
next: "tag"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var rubyRules = new RubyHighlightRules().getRules();
|
||||||
|
this.addRules(rubyRules, "ruby-");
|
||||||
|
this.$rules["ruby-start"].unshift({
|
||||||
|
token: "text",
|
||||||
|
regex: "<\\/(?=%)",
|
||||||
|
next: "tag"
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
oop.inherits(HtmlHighlightRules, TextHighlightRules);
|
oop.inherits(HtmlHighlightRules, TextHighlightRules);
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,9 @@ var RubyHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "string", // single line
|
token : "string", // single line
|
||||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
}, {
|
||||||
|
token: "string", // symbol
|
||||||
|
regex: "[:](?:[a-zA-Z]|\d)+"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue