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;
}
this.CDataSection = function(node)
{
var value = this.getNodeValue(node);
this.addTokens(value, "support.type");
return true;
};
this.Comment = function(node)
{
return true;

View file

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