From a642fffac70ca24f8e7ad713cab9f27b7de1e882 Mon Sep 17 00:00:00 2001 From: danyaPostfactum Date: Sat, 7 Apr 2012 05:05:36 +1000 Subject: [PATCH 1/6] Entity support, doctype is not a tag --- lib/ace/mode/xml_highlight_rules.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/ace/mode/xml_highlight_rules.js b/lib/ace/mode/xml_highlight_rules.js index 12cfd7b3..15be383b 100644 --- a/lib/ace/mode/xml_highlight_rules.js +++ b/lib/ace/mode/xml_highlight_rules.js @@ -59,13 +59,22 @@ var XmlHighlightRules = function() { merge : true, regex : "<\\!--", next : "comment" + }, { + token : "xml_pe", + regex : "<\\!.*?>" }, { token : "meta.tag", // opening tag regex : "<\\/?", next : "tag" + }, { + token : "entity", + regex : "&.*;" }, { token : "text", regex : "\\s+" + }, { + token : "entity.reference", + regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" }, { token : "text", regex : "[^<]+" From 26582ef38638c4b250afcce01b9b25e00830812e Mon Sep 17 00:00:00 2001 From: danyaPostfactum Date: Sat, 7 Apr 2012 05:08:51 +1000 Subject: [PATCH 2/6] Update lib/ace/mode/xml_highlight_rules.js --- lib/ace/mode/xml_highlight_rules.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/ace/mode/xml_highlight_rules.js b/lib/ace/mode/xml_highlight_rules.js index 15be383b..752844c7 100644 --- a/lib/ace/mode/xml_highlight_rules.js +++ b/lib/ace/mode/xml_highlight_rules.js @@ -66,9 +66,6 @@ var XmlHighlightRules = function() { token : "meta.tag", // opening tag regex : "<\\/?", next : "tag" - }, { - token : "entity", - regex : "&.*;" }, { token : "text", regex : "\\s+" From a71ebcb29a2c8277d613cbba4d2341f3b8de8334 Mon Sep 17 00:00:00 2001 From: danyaPostfactum Date: Sat, 7 Apr 2012 05:13:01 +1000 Subject: [PATCH 3/6] entity support, doctype is not a tag --- lib/ace/mode/html_highlight_rules.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ace/mode/html_highlight_rules.js b/lib/ace/mode/html_highlight_rules.js index 6d2221e3..1c445fe3 100644 --- a/lib/ace/mode/html_highlight_rules.js +++ b/lib/ace/mode/html_highlight_rules.js @@ -62,6 +62,9 @@ var HtmlHighlightRules = function() { merge : true, regex : "<\\!--", next : "comment" + }, { + token : "xml_pe", + regex : "<\\!.*?>" }, { token : "meta.tag", regex : "<(?=\s*script\\b)", @@ -77,6 +80,9 @@ var HtmlHighlightRules = function() { }, { token : "text", regex : "\\s+" + }, { + token : "entity.reference", + regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" }, { token : "text", regex : "[^<]+" From 401e6bdba8a7318366e6fabe3aba2a8475f6e6b4 Mon Sep 17 00:00:00 2001 From: danyaPostfactum Date: Sat, 7 Apr 2012 05:26:26 +1000 Subject: [PATCH 4/6] remove ! from meta.tag regex --- lib/ace/mode/xml_util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ace/mode/xml_util.js b/lib/ace/mode/xml_util.js index 63e6b1b7..b58df44f 100644 --- a/lib/ace/mode/xml_util.js +++ b/lib/ace/mode/xml_util.js @@ -112,7 +112,7 @@ exports.tag = function(states, name, nextState) { } }, merge : true, - regex : "[-_a-zA-Z0-9:!]+", + regex : "[-_a-zA-Z0-9:]+", next : name + "_embed_attribute_list" }, { token: "empty", From a7025742a45fe6ce336eccde47e98cf316617c45 Mon Sep 17 00:00:00 2001 From: danyaPostfactum Date: Tue, 10 Apr 2012 04:50:33 +1000 Subject: [PATCH 5/6] Change entity.reference to constant.character.entity --- lib/ace/mode/xml_highlight_rules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ace/mode/xml_highlight_rules.js b/lib/ace/mode/xml_highlight_rules.js index 752844c7..42938b90 100644 --- a/lib/ace/mode/xml_highlight_rules.js +++ b/lib/ace/mode/xml_highlight_rules.js @@ -70,7 +70,7 @@ var XmlHighlightRules = function() { token : "text", regex : "\\s+" }, { - token : "entity.reference", + token : "constant.character.entity", regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" }, { token : "text", From a4826b938a355416fc52e083552d7dd858779d20 Mon Sep 17 00:00:00 2001 From: danyaPostfactum Date: Tue, 10 Apr 2012 04:52:13 +1000 Subject: [PATCH 6/6] Change entity.reference to constant.character.entity --- lib/ace/mode/html_highlight_rules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ace/mode/html_highlight_rules.js b/lib/ace/mode/html_highlight_rules.js index 1c445fe3..24165fc2 100644 --- a/lib/ace/mode/html_highlight_rules.js +++ b/lib/ace/mode/html_highlight_rules.js @@ -81,7 +81,7 @@ var HtmlHighlightRules = function() { token : "text", regex : "\\s+" }, { - token : "entity.reference", + token : "constant.character.entity", regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" }, { token : "text",