Improve syntax highlighting of cdata sections.

This commit is contained in:
William Candillon 2013-01-01 20:03:31 +01:00 • committed by nightwing
commit e0c36db7a5
2 changed files with 12 additions and 5 deletions

View file

@ -267,7 +267,14 @@ var SyntaxHighlighter = exports.SyntaxHighlighter = function(tree)
} }
}return true; }return true;
} }
this.CDataSection = function(node)
{
var value = this.getNodeValue(node);
this.addTokens(value, "support.type");
return true;
};
this.Comment = function(node) this.Comment = function(node)
{ {
return true; return true;

View file

@ -43,7 +43,7 @@ var XQueryHighlightRules = function() {
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
this.$rules = { this.$rules = {
start: [{ start: [{
token: "text", token: "support.type",
regex: "<\\!\\[CDATA\\[", regex: "<\\!\\[CDATA\\[",
next: "cdata" next: "cdata"
}, { }, {
@ -126,14 +126,14 @@ var XQueryHighlightRules = function() {
}], }],
cdata: [{ cdata: [{
token: "comment", token: "support.type",
regex: "\\]\\]>", regex: "\\]\\]>",
next: "start" next: "start"
}, { }, {
token: "comment", token: "support.type",
regex: "\\s+" regex: "\\s+"
}, { }, {
token: "comment", token: "support.type",
regex: "(?:[^\\]]|\\](?!\\]>))+" regex: "(?:[^\\]]|\\](?!\\]>))+"
}], }],