improve CSS mode
This commit is contained in:
parent
3378043072
commit
117e1ad7aa
2 changed files with 61 additions and 49 deletions
|
|
@ -32,6 +32,15 @@
|
|||
return copy;
|
||||
};
|
||||
|
||||
this.arrayToMap = function(arr) {
|
||||
var map = {};
|
||||
for (var i=0; i<arr.length; i++) {
|
||||
map[arr[i]] = 1;
|
||||
}
|
||||
return map;
|
||||
|
||||
};
|
||||
|
||||
this.escapeRegExp = function(str) {
|
||||
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,57 +2,60 @@ ace.provide("ace.mode.CssHighlightRules");
|
|||
|
||||
ace.mode.CssHighlightRules = function() {
|
||||
|
||||
var properties = {
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"top": 1,
|
||||
"left": 1,
|
||||
"right": 1,
|
||||
"bottom": 1,
|
||||
"overflow": 1,
|
||||
"overflow-x": 1,
|
||||
"overflow-y": 1,
|
||||
"background": 1,
|
||||
"font": 1,
|
||||
"font-style": 1,
|
||||
"font-family": 1,
|
||||
"font-size": 1,
|
||||
"text-align": 1,
|
||||
"white-space": 1,
|
||||
"color": 1,
|
||||
"z-index": 1,
|
||||
"position": 1,
|
||||
"cursor": 1,
|
||||
"box-sizing": 1,
|
||||
"-webkit-box-sizing": 1,
|
||||
"-moz-box-sizing": 1,
|
||||
"margin": 1,
|
||||
"padding": 1,
|
||||
"padding-top": 1,
|
||||
"padding-right": 1,
|
||||
"padding-bottom": 1,
|
||||
"padding-left": 1,
|
||||
"border": 1,
|
||||
"border-top": 1,
|
||||
"border-right": 1,
|
||||
"border-left": 1,
|
||||
"border-bottom": 1
|
||||
};
|
||||
var properties = ace.arrayToMap(
|
||||
("azimuth|background-attachment|background-color|background-image|" +
|
||||
"background-position|background-repeat|background|border-bottom-color|" +
|
||||
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
|
||||
"border-color|border-left-color|border-left-style|border-left-width|" +
|
||||
"border-left|border-right-color|border-right-style|border-right-width|" +
|
||||
"border-right|border-spacing|border-style|border-top-color|" +
|
||||
"border-top-style|border-top-width|border-top|border-width|border|" +
|
||||
"bottom|caption-side|clear|clip|color|content|counter-increment|" +
|
||||
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
|
||||
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
|
||||
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
|
||||
"letter-spacing|line-height|list-style-image|list-style-position|" +
|
||||
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
|
||||
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
|
||||
"min-width|-moz-border-radius|opacity|orphans|outline-color|" +
|
||||
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
|
||||
"padding-left|padding-right|padding-top|padding|page-break-after|" +
|
||||
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
|
||||
"pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
|
||||
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
|
||||
"stress|table-layout|text-align|text-decoration|text-indent|" +
|
||||
"text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
|
||||
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
|
||||
"z-index").split("|")
|
||||
);
|
||||
|
||||
var functions = {
|
||||
"rgb": 1,
|
||||
"rgba": 1
|
||||
};
|
||||
var functions = ace.arrayToMap(
|
||||
("rgb|rgba|url|attr|counter|counters").split("|")
|
||||
);
|
||||
|
||||
var constants = {
|
||||
"absolute": 1,
|
||||
"relative": 1,
|
||||
"fixed": 1,
|
||||
"solid": 1,
|
||||
"hidden": 1,
|
||||
"scroll": 1,
|
||||
"no-wrap": 1
|
||||
};
|
||||
var constants = ace.arrayToMap(
|
||||
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
|
||||
"block|bold|bolder|both|bottom|break-all|break-word|capitalize|center|" +
|
||||
"char|circle|cjk-ideographic|col-resize|collapse|crosshair|dashed|" +
|
||||
"decimal-leading-zero|decimal|default|disabled|disc|" +
|
||||
"distribute-all-lines|distribute-letter|distribute-space|" +
|
||||
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
|
||||
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
|
||||
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
|
||||
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
|
||||
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
|
||||
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
|
||||
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
|
||||
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
|
||||
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
|
||||
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
|
||||
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
|
||||
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
|
||||
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
|
||||
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
|
||||
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
|
||||
"zero").split("|")
|
||||
);
|
||||
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue