diff --git a/lib/ace/mode/html_highlight_rules.js b/lib/ace/mode/html_highlight_rules.js
index 24165fc2..4f51df77 100644
--- a/lib/ace/mode/html_highlight_rules.js
+++ b/lib/ace/mode/html_highlight_rules.js
@@ -44,6 +44,25 @@ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScrip
var xmlUtil = require("./xml_util");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var tagMap = {
+ a : 'anchor',
+ button : 'form',
+ form : 'form',
+ img : 'image',
+ input : 'form',
+ label : 'form',
+ script : 'script',
+ select : 'form',
+ textarea : 'form',
+ style : 'style',
+ table : 'table',
+ tbody : 'table',
+ td : 'table',
+ tfoot : 'table',
+ th : 'table',
+ tr : 'table'
+};
+
var HtmlHighlightRules = function() {
// regexp must not have capturing parentheses
@@ -113,9 +132,9 @@ var HtmlHighlightRules = function() {
} ]
};
- xmlUtil.tag(this.$rules, "tag", "start");
- xmlUtil.tag(this.$rules, "style", "css-start");
- xmlUtil.tag(this.$rules, "script", "js-start");
+ xmlUtil.tag(this.$rules, "tag", "start", tagMap);
+ xmlUtil.tag(this.$rules, "style", "css-start", tagMap);
+ xmlUtil.tag(this.$rules, "script", "js-start", tagMap);
this.embedRules(JavaScriptHighlightRules, "js-", [{
token: "comment",
diff --git a/lib/ace/mode/xml_util.js b/lib/ace/mode/xml_util.js
index b58df44f..d76e7c1f 100644
--- a/lib/ace/mode/xml_util.js
+++ b/lib/ace/mode/xml_util.js
@@ -38,16 +38,6 @@
define(function(require, exports, module) {
"use strict";
-var lang = require("../lib/lang");
-
-var formTags = lang.arrayToMap(
- ("button|form|input|label|select|textarea").split("|")
-);
-
-var tableTags = lang.arrayToMap(
- ("table|tbody|td|tfoot|th|tr").split("|")
-);
-
function string(state) {
return [{
token : "string",
@@ -81,7 +71,7 @@ function multiLineString(quote, state) {
}];
}
-exports.tag = function(states, name, nextState) {
+exports.tag = function(states, name, nextState, tagMap) {
states[name] = [{
token : "text",
regex : "\\s+"
@@ -89,25 +79,9 @@ exports.tag = function(states, name, nextState) {
//token : "meta.tag",
token : function(value) {
- if ( value==='a' ) {
- return "meta.tag.anchor";
- }
- else if ( value==='img' ) {
- return "meta.tag.image";
- }
- else if ( value==='script' ) {
- return "meta.tag.script";
- }
- else if ( value==='style' ) {
- return "meta.tag.style";
- }
- else if (formTags.hasOwnProperty(value.toLowerCase())) {
- return "meta.tag.form";
- }
- else if (tableTags.hasOwnProperty(value.toLowerCase())) {
- return "meta.tag.table";
- }
- else {
+ if (tagMap && tagMap[value]) {
+ return "meta.tag" + '.' + tagMap[value];
+ } else {
return "meta.tag";
}
},