forked from ajaxorg/ace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathejs.js
64 lines (49 loc) · 1.54 KB
/
ejs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"use strict";
var oop = require("../lib/oop");
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
var EjsHighlightRules = function(start, end) {
HtmlHighlightRules.call(this);
if (!start)
start = "(?:<%|<\\?|{{)";
if (!end)
end = "(?:%>|\\?>|}})";
for (var i in this.$rules) {
this.$rules[i].unshift({
token : "markup.list.meta.tag",
regex : start + "(?![>}])[-=]?",
push : "ejs-start"
});
}
this.embedRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "ejs-", [{
token : "markup.list.meta.tag",
regex : "-?" + end,
next : "pop"
}, {
token: "comment",
regex: "//.*?" + end,
next: "pop"
}]);
this.normalizeRules();
};
oop.inherits(EjsHighlightRules, HtmlHighlightRules);
exports.EjsHighlightRules = EjsHighlightRules;
var oop = require("../lib/oop");
var HtmlMode = require("./html").Mode;
var JavaScriptMode = require("./javascript").Mode;
var CssMode = require("./css").Mode;
var RubyMode = require("./ruby").Mode;
var Mode = function() {
HtmlMode.call(this);
this.HighlightRules = EjsHighlightRules;
this.createModeDelegates({
"js-": JavaScriptMode,
"css-": CssMode,
"ejs-": JavaScriptMode
});
};
oop.inherits(Mode, HtmlMode);
(function() {
this.$id = "ace/mode/ejs";
}).call(Mode.prototype);
exports.Mode = Mode;