vendor/assets/javascripts/ace/mode-rhtml.js in ace-rails-ap-4.0.0 vs vendor/assets/javascripts/ace/mode-rhtml.js in ace-rails-ap-4.0.1
- old
+ new
@@ -52,10 +52,11 @@
"use strict";
var oop = require("../lib/oop");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
var JavaScriptHighlightRules = function(options) {
var keywordMapper = this.createKeywordMapper({
"variable.language":
"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
@@ -81,11 +82,10 @@
"support.function":
"alert",
"constant.language.boolean": "true|false"
}, "identifier");
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
- var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
"u[0-9a-fA-F]{4}|" + // unicode
"[0-2][0-7]{0,2}|" + // oct
"3[0-6][0-7]?|" + // oct
@@ -170,30 +170,25 @@
}, {
token : "keyword",
regex : "(?:" + kwBeforeRe + ")\\b",
next : "start"
}, {
- token : ["punctuation.operator", "support.function"],
- regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
- }, {
- token : ["punctuation.operator", "support.function.dom"],
- regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
- }, {
- token : ["punctuation.operator", "support.constant"],
- regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
- }, {
token : ["support.constant"],
regex : /that\b/
}, {
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
}, {
token : keywordMapper,
regex : identifierRe
}, {
+ token : "punctuation.operator",
+ regex : /[.](?![.])/,
+ next : "property"
+ }, {
token : "keyword.operator",
- regex : /--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
+ regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
next : "start"
}, {
token : "punctuation.operator",
regex : /[?:,;.]/,
next : "start"
@@ -207,10 +202,42 @@
}, {
token: "comment",
regex: /^#!.*$/
}
],
+ property: [{
+ token : "text",
+ regex : "\\s+"
+ }, {
+ token : [
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
+ "keyword.operator", "text",
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
+ ],
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : "punctuation.operator",
+ regex : /[.](?![.])/
+ }, {
+ token : "support.function",
+ regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
+ }, {
+ token : "support.function.dom",
+ regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
+ }, {
+ token : "support.constant",
+ regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
+ }, {
+ token : "identifier",
+ regex : identifierRe
+ }, {
+ regex: "",
+ token: "empty",
+ next: "no_regex"
+ }
+ ],
"start": [
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment", // multi line comment
regex : "\\/\\*",
@@ -361,11 +388,11 @@
return "paren";
}
if (val == "}" && stack.length) {
stack.shift();
this.next = stack.shift();
- if (this.next.indexOf("string") != -1)
+ if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
return "paren.quasi.end";
}
return val == "{" ? "paren.lparen" : "paren.rparen";
},
nextState: "start"
@@ -385,20 +412,122 @@
next : "pop"
}, {
defaultToken: "string.quasi"
}]
});
+
+ if (!options || !options.noJSX)
+ JSX.call(this);
}
this.embedRules(DocCommentHighlightRules, "doc-",
[ DocCommentHighlightRules.getEndRule("no_regex") ]);
this.normalizeRules();
};
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
+function JSX() {
+ var tagRegex = identifierRe.replace("\\d", "\\d\\-");
+ var jsxTag = {
+ onMatch : function(val, state, stack) {
+ var offset = val.charAt(1) == "/" ? 2 : 1;
+ if (offset == 1) {
+ if (state != this.nextState)
+ stack.unshift(this.next, this.nextState, 0);
+ else
+ stack.unshift(this.next);
+ stack[2]++;
+ } else if (offset == 2) {
+ if (state == this.nextState) {
+ stack[1]--;
+ if (!stack[1] || stack[1] < 0) {
+ stack.shift();
+ stack.shift();
+ }
+ }
+ }
+ return [{
+ type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
+ value: val.slice(0, offset)
+ }, {
+ type: "meta.tag.tag-name.xml",
+ value: val.substr(offset)
+ }];
+ },
+ regex : "</?" + tagRegex + "",
+ next: "jsxAttributes",
+ nextState: "jsx"
+ };
+ this.$rules.start.unshift(jsxTag);
+ var jsxJsRule = {
+ regex: "{",
+ token: "paren.quasi.start",
+ push: "start"
+ };
+ this.$rules.jsx = [
+ jsxJsRule,
+ jsxTag,
+ {include : "reference"},
+ {defaultToken: "string"}
+ ];
+ this.$rules.jsxAttributes = [{
+ token : "meta.tag.punctuation.tag-close.xml",
+ regex : "/?>",
+ onMatch : function(value, currentState, stack) {
+ if (currentState == stack[0])
+ stack.shift();
+ if (value.length == 2) {
+ if (stack[0] == this.nextState)
+ stack[1]--;
+ if (!stack[1] || stack[1] < 0) {
+ stack.splice(0, 2);
+ }
+ }
+ this.next = stack[0] || "start";
+ return [{type: this.token, value: value}];
+ },
+ nextState: "jsx"
+ },
+ jsxJsRule,
+ {
+ token : "entity.other.attribute-name.xml",
+ regex : tagRegex
+ }, {
+ token : "keyword.operator.attribute-equals.xml",
+ regex : "="
+ }, {
+ token : "text.tag-whitespace.xml",
+ regex : "\\s+"
+ }, {
+ token : "string.attribute-value.xml",
+ regex : "'",
+ stateName : "jsx_attr_q",
+ push : [
+ {token : "string.attribute-value.xml", regex: "'", next: "pop"},
+ jsxJsRule,
+ {include : "reference"},
+ {defaultToken : "string.attribute-value.xml"}
+ ]
+ }, {
+ token : "string.attribute-value.xml",
+ regex : '"',
+ stateName : "jsx_attr_qq",
+ push : [
+ jsxJsRule,
+ {token : "string.attribute-value.xml", regex: '"', next: "pop"},
+ {include : "reference"},
+ {defaultToken : "string.attribute-value.xml"}
+ ]
+ }];
+ this.$rules.reference = [{
+ token : "constant.language.escape.reference.xml",
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
+ }];
+}
+
exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
});
define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
"use strict";
@@ -678,12 +807,12 @@
var token = session.getTokenAt(cursor.row, cursor.column);
var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
if (leftChar == "\\" && token && /escape/.test(token.type))
return null;
- var stringBefore = token && /string/.test(token.type);
- var stringAfter = !rightToken || /string/.test(rightToken.type);
+ var stringBefore = token && /string|escape/.test(token.type);
+ var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
var pair;
if (rightChar == quote) {
pair = stringBefore !== stringAfter;
} else {
@@ -820,11 +949,11 @@
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
- this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
this._getFoldWidgetBase = this.getFoldWidget;
this.getFoldWidget = function(session, foldStyle, row) {
var line = session.getLine(row);
if (this.singleLineBlockCommentRe.test(line)) {
@@ -908,17 +1037,16 @@
endRow = row;
}
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
};
-
this.getCommentRegionBlock = function(session, line, row) {
var startColumn = line.search(/\s*$/);
var maxRow = session.getLength();
var startRow = row;
- var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
var depth = 1;
while (++row < maxRow) {
line = session.getLine(row);
var m = re.exec(line);
if (!m) continue;
@@ -1167,10 +1295,184 @@
exports.CssHighlightRules = CssHighlightRules;
});
+define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) {
+"use strict";
+
+var propertyMap = {
+ "background": {"#$0": 1},
+ "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
+ "background-image": {"url('/$0')": 1},
+ "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
+ "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2,},
+ "background-attachment": {"scroll": 1, "fixed": 1},
+ "background-size": {"cover": 1, "contain": 1},
+ "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
+ "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
+ "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
+ "border-color": {"#$0": 1},
+ "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2,},
+ "border-collapse": {"collapse": 1, "separate": 1},
+ "bottom": {"px": 1, "em": 1, "%": 1},
+ "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
+ "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
+ "cursor": {"default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1},
+ "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
+ "empty-cells": {"show": 1, "hide": 1},
+ "float": {"left": 1, "right": 1, "none": 1},
+ "font-family": {"Arial":2,"Comic Sans MS":2,"Consolas":2,"Courier New":2,"Courier":2,"Georgia":2,"Monospace":2,"Sans-Serif":2, "Segoe UI":2,"Tahoma":2,"Times New Roman":2,"Trebuchet MS":2,"Verdana": 1},
+ "font-size": {"px": 1, "em": 1, "%": 1},
+ "font-weight": {"bold": 1, "normal": 1},
+ "font-style": {"italic": 1, "normal": 1},
+ "font-variant": {"normal": 1, "small-caps": 1},
+ "height": {"px": 1, "em": 1, "%": 1},
+ "left": {"px": 1, "em": 1, "%": 1},
+ "letter-spacing": {"normal": 1},
+ "line-height": {"normal": 1},
+ "list-style-type": {"none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1},
+ "margin": {"px": 1, "em": 1, "%": 1},
+ "margin-right": {"px": 1, "em": 1, "%": 1},
+ "margin-left": {"px": 1, "em": 1, "%": 1},
+ "margin-top": {"px": 1, "em": 1, "%": 1},
+ "margin-bottom": {"px": 1, "em": 1, "%": 1},
+ "max-height": {"px": 1, "em": 1, "%": 1},
+ "max-width": {"px": 1, "em": 1, "%": 1},
+ "min-height": {"px": 1, "em": 1, "%": 1},
+ "min-width": {"px": 1, "em": 1, "%": 1},
+ "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
+ "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
+ "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
+ "padding": {"px": 1, "em": 1, "%": 1},
+ "padding-top": {"px": 1, "em": 1, "%": 1},
+ "padding-right": {"px": 1, "em": 1, "%": 1},
+ "padding-bottom": {"px": 1, "em": 1, "%": 1},
+ "padding-left": {"px": 1, "em": 1, "%": 1},
+ "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
+ "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
+ "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
+ "right": {"px": 1, "em": 1, "%": 1},
+ "table-layout": {"fixed": 1, "auto": 1},
+ "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
+ "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
+ "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
+ "top": {"px": 1, "em": 1, "%": 1},
+ "vertical-align": {"top": 1, "bottom": 1},
+ "visibility": {"hidden": 1, "visible": 1},
+ "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
+ "width": {"px": 1, "em": 1, "%": 1},
+ "word-spacing": {"normal": 1},
+ "filter": {"alpha(opacity=$0100)": 1},
+
+ "text-shadow": {"$02px 2px 2px #777": 1},
+ "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
+ "-moz-border-radius": 1,
+ "-moz-border-radius-topright": 1,
+ "-moz-border-radius-bottomright": 1,
+ "-moz-border-radius-topleft": 1,
+ "-moz-border-radius-bottomleft": 1,
+ "-webkit-border-radius": 1,
+ "-webkit-border-top-right-radius": 1,
+ "-webkit-border-top-left-radius": 1,
+ "-webkit-border-bottom-right-radius": 1,
+ "-webkit-border-bottom-left-radius": 1,
+ "-moz-box-shadow": 1,
+ "-webkit-box-shadow": 1,
+ "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
+ "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
+ "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
+};
+
+var CssCompletions = function() {
+
+};
+
+(function() {
+
+ this.completionsDefined = false;
+
+ this.defineCompletions = function() {
+ if (document) {
+ var style = document.createElement('c').style;
+
+ for (var i in style) {
+ if (typeof style[i] !== 'string')
+ continue;
+
+ var name = i.replace(/[A-Z]/g, function(x) {
+ return '-' + x.toLowerCase();
+ });
+
+ if (!propertyMap.hasOwnProperty(name))
+ propertyMap[name] = 1;
+ }
+ }
+
+ this.completionsDefined = true;
+ }
+
+ this.getCompletions = function(state, session, pos, prefix) {
+ if (!this.completionsDefined) {
+ this.defineCompletions();
+ }
+
+ var token = session.getTokenAt(pos.row, pos.column);
+
+ if (!token)
+ return [];
+ if (state==='ruleset'){
+ var line = session.getLine(pos.row).substr(0, pos.column);
+ if (/:[^;]+$/.test(line)) {
+ /([\w\-]+):[^:]*$/.test(line);
+
+ return this.getPropertyValueCompletions(state, session, pos, prefix);
+ } else {
+ return this.getPropertyCompletions(state, session, pos, prefix);
+ }
+ }
+
+ return [];
+ };
+
+ this.getPropertyCompletions = function(state, session, pos, prefix) {
+ var properties = Object.keys(propertyMap);
+ return properties.map(function(property){
+ return {
+ caption: property,
+ snippet: property + ': $0',
+ meta: "property",
+ score: Number.MAX_VALUE
+ };
+ });
+ };
+
+ this.getPropertyValueCompletions = function(state, session, pos, prefix) {
+ var line = session.getLine(pos.row).substr(0, pos.column);
+ var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
+
+ if (!property)
+ return [];
+ var values = [];
+ if (property in propertyMap && typeof propertyMap[property] === "object") {
+ values = Object.keys(propertyMap[property]);
+ }
+ return values.map(function(value){
+ return {
+ caption: value,
+ snippet: value,
+ meta: "property value",
+ score: Number.MAX_VALUE
+ };
+ });
+ };
+
+}).call(CssCompletions.prototype);
+
+exports.CssCompletions = CssCompletions;
+});
+
define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module) {
"use strict";
var oop = require("../../lib/oop");
var Behaviour = require("../behaviour").Behaviour;
@@ -1246,25 +1548,27 @@
oop.inherits(CssBehaviour, CstyleBehaviour);
exports.CssBehaviour = CssBehaviour;
});
-define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
+define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var WorkerClient = require("../worker/worker_client").WorkerClient;
+var CssCompletions = require("./css_completions").CssCompletions;
var CssBehaviour = require("./behaviour/css").CssBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
this.HighlightRules = CssHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CssBehaviour();
+ this.$completer = new CssCompletions();
this.foldingRules = new CStyleFoldMode();
};
oop.inherits(Mode, TextMode);
(function() {
@@ -1293,10 +1597,14 @@
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
+ this.getCompletions = function(state, session, pos, prefix) {
+ return this.$completer.getCompletions(state, session, pos, prefix);
+ };
+
this.createWorker = function(session) {
var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
worker.attachToDocument(session.getDocument());
worker.on("annotate", function(e) {
@@ -1322,13 +1630,12 @@
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var XmlHighlightRules = function(normalize) {
+ var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
- var tagRegex = "[a-zA-Z][-_a-zA-Z0-9]*";
-
this.$rules = {
start : [
{token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
{
token : ["punctuation.xml-decl.xml", "keyword.xml-decl.xml"],
@@ -1565,11 +1872,11 @@
this.addRules({
attributes: [{
include : "tag_whitespace"
}, {
token : "entity.other.attribute-name.xml",
- regex : "[-_a-zA-Z0-9:]+"
+ regex : "[-_a-zA-Z0-9:.]+"
}, {
token : "keyword.operator.attribute-equals.xml",
regex : "=",
push : [{
include: "tag_whitespace"
@@ -1589,21 +1896,21 @@
token : function(start, tag) {
var group = tagMap[tag];
return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
"meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
},
- regex : "(</?)([-_a-zA-Z0-9:]+)",
+ regex : "(</?)([-_a-zA-Z0-9:.]+)",
next: "tag_stuff"
}],
tag_stuff: [
{include : "attributes"},
{token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
],
});
this.embedTagRules(CssHighlightRules, "css-", "style");
- this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
+ this.embedTagRules(new JavaScriptHighlightRules({noJSX: true}).getRules(), "js-", "script");
if (this.constructor === HtmlHighlightRules)
this.normalizeRules();
};
@@ -2177,122 +2484,124 @@
];
var globalAttributes = commonAttributes.concat(eventAttributes);
var attributeMap = {
- "html": ["manifest"],
- "head": [],
- "title": [],
- "base": ["href", "target"],
- "link": ["href", "hreflang", "rel", "media", "type", "sizes"],
- "meta": ["http-equiv", "name", "content", "charset"],
- "style": ["type", "media", "scoped"],
- "script": ["charset", "type", "src", "defer", "async"],
- "noscript": ["href"],
- "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"],
- "section": [],
- "nav": [],
- "article": ["pubdate"],
- "aside": [],
- "h1": [],
- "h2": [],
- "h3": [],
- "h4": [],
- "h5": [],
- "h6": [],
- "header": [],
- "footer": [],
- "address": [],
- "main": [],
- "p": [],
- "hr": [],
- "pre": [],
- "blockquote": ["cite"],
- "ol": ["start", "reversed"],
- "ul": [],
- "li": ["value"],
- "dl": [],
- "dt": [],
- "dd": [],
- "figure": [],
- "figcaption": [],
- "div": [],
- "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"],
- "em": [],
- "strong": [],
- "small": [],
- "s": [],
- "cite": [],
- "q": ["cite"],
- "dfn": [],
- "abbr": [],
- "data": [],
- "time": ["datetime"],
- "code": [],
- "var": [],
- "samp": [],
- "kbd": [],
- "sub": [],
- "sup": [],
- "i": [],
- "b": [],
- "u": [],
- "mark": [],
- "ruby": [],
- "rt": [],
- "rp": [],
- "bdi": [],
- "bdo": [],
- "span": [],
- "br": [],
- "wbr": [],
- "ins": ["cite", "datetime"],
- "del": ["cite", "datetime"],
- "img": ["alt", "src", "height", "width", "usemap", "ismap"],
- "iframe": ["name", "src", "height", "width", "sandbox", "seamless"],
- "embed": ["src", "height", "width", "type"],
- "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"],
- "param": ["name", "value"],
- "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"],
- "audio": ["src", "autobuffer", "autoplay", "loop", "controls"],
- "source": ["src", "type", "media"],
- "track": ["kind", "src", "srclang", "label", "default"],
- "canvas": ["width", "height"],
- "map": ["name"],
- "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"],
- "svg": [],
- "math": [],
- "table": ["summary"],
- "caption": [],
- "colgroup": ["span"],
- "col": ["span"],
- "tbody": [],
- "thead": [],
- "tfoot": [],
- "tr": [],
- "td": ["headers", "rowspan", "colspan"],
- "th": ["headers", "rowspan", "colspan", "scope"],
- "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"],
- "fieldset": ["disabled", "form", "name"],
- "legend": [],
- "label": ["form", "for"],
- "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"],
- "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"],
- "select": ["autofocus", "disabled", "form", "multiple", "name", "size"],
- "datalist": [],
- "optgroup": ["disabled", "label"],
- "option": ["disabled", "selected", "label", "value"],
- "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"],
- "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"],
- "output": ["for", "form", "name"],
- "progress": ["value", "max"],
- "meter": ["value", "min", "max", "low", "high", "optimum"],
- "details": ["open"],
- "summary": [],
- "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"],
- "menu": ["type", "label"],
- "dialog": ["open"]
+ "html": {"manifest": 1},
+ "head": {},
+ "title": {},
+ "base": {"href": 1, "target": 1},
+ "link": {"href": 1, "hreflang": 1, "rel": {"stylesheet": 1, "icon": 1}, "media": {"all": 1, "screen": 1, "print": 1}, "type": {"text/css": 1, "image/png": 1, "image/jpeg": 1, "image/gif": 1}, "sizes": 1},
+ "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
+ "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
+ "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
+ "noscript": {"href": 1},
+ "body": {"onafterprint": 1, "onbeforeprint": 1, "onbeforeunload": 1, "onhashchange": 1, "onmessage": 1, "onoffline": 1, "onpopstate": 1, "onredo": 1, "onresize": 1, "onstorage": 1, "onundo": 1, "onunload": 1},
+ "section": {},
+ "nav": {},
+ "article": {"pubdate": 1},
+ "aside": {},
+ "h1": {},
+ "h2": {},
+ "h3": {},
+ "h4": {},
+ "h5": {},
+ "h6": {},
+ "header": {},
+ "footer": {},
+ "address": {},
+ "main": {},
+ "p": {},
+ "hr": {},
+ "pre": {},
+ "blockquote": {"cite": 1},
+ "ol": {"start": 1, "reversed": 1},
+ "ul": {},
+ "li": {"value": 1},
+ "dl": {},
+ "dt": {},
+ "dd": {},
+ "figure": {},
+ "figcaption": {},
+ "div": {},
+ "a": {"href": 1, "target": {"_blank": 1, "top": 1}, "ping": 1, "rel": {"nofollow": 1, "alternate": 1, "author": 1, "bookmark": 1, "help": 1, "license": 1, "next": 1, "noreferrer": 1, "prefetch": 1, "prev": 1, "search": 1, "tag": 1}, "media": 1, "hreflang": 1, "type": 1},
+ "em": {},
+ "strong": {},
+ "small": {},
+ "s": {},
+ "cite": {},
+ "q": {"cite": 1},
+ "dfn": {},
+ "abbr": {},
+ "data": {},
+ "time": {"datetime": 1},
+ "code": {},
+ "var": {},
+ "samp": {},
+ "kbd": {},
+ "sub": {},
+ "sup": {},
+ "i": {},
+ "b": {},
+ "u": {},
+ "mark": {},
+ "ruby": {},
+ "rt": {},
+ "rp": {},
+ "bdi": {},
+ "bdo": {},
+ "span": {},
+ "br": {},
+ "wbr": {},
+ "ins": {"cite": 1, "datetime": 1},
+ "del": {"cite": 1, "datetime": 1},
+ "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
+ "iframe": {"name": 1, "src": 1, "height": 1, "width": 1, "sandbox": {"allow-same-origin": 1, "allow-top-navigation": 1, "allow-forms": 1, "allow-scripts": 1}, "seamless": {"seamless": 1}},
+ "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
+ "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
+ "param": {"name": 1, "value": 1},
+ "video": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "width": 1, "height": 1, "poster": 1, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1}},
+ "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
+ "source": {"src": 1, "type": 1, "media": 1},
+ "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
+ "canvas": {"width": 1, "height": 1},
+ "map": {"name": 1},
+ "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
+ "svg": {},
+ "math": {},
+ "table": {"summary": 1},
+ "caption": {},
+ "colgroup": {"span": 1},
+ "col": {"span": 1},
+ "tbody": {},
+ "thead": {},
+ "tfoot": {},
+ "tr": {},
+ "td": {"headers": 1, "rowspan": 1, "colspan": 1},
+ "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
+ "form": {"accept-charset": 1, "action": 1, "autocomplete": 1, "enctype": {"multipart/form-data": 1, "application/x-www-form-urlencoded": 1}, "method": {"get": 1, "post": 1}, "name": 1, "novalidate": 1, "target": {"_blank": 1, "top": 1}},
+ "fieldset": {"disabled": 1, "form": 1, "name": 1},
+ "legend": {},
+ "label": {"form": 1, "for": 1},
+ "input": {
+ "type": {"text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1},
+ "accept": 1, "alt": 1, "autocomplete": {"on": 1, "off": 1}, "autofocus": {"autofocus": 1}, "checked": {"checked": 1}, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": {"application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1}, "formmethod": {"get": 1, "post": 1}, "formnovalidate": {"formnovalidate": 1}, "formtarget": {"_blank": 1, "_self": 1, "_parent": 1, "_top": 1}, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": {"multiple": 1}, "pattern": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1},
+ "button": {"autofocus": 1, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": {"button": 1, "submit": 1}},
+ "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
+ "datalist": {},
+ "optgroup": {"disabled": 1, "label": 1},
+ "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
+ "textarea": {"autofocus": {"autofocus": 1}, "disabled": {"disabled": 1}, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "rows": 1, "cols": 1, "wrap": {"on": 1, "off": 1, "hard": 1, "soft": 1}},
+ "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
+ "output": {"for": 1, "form": 1, "name": 1},
+ "progress": {"value": 1, "max": 1},
+ "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
+ "details": {"open": 1},
+ "summary": {},
+ "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
+ "menu": {"type": 1, "label": 1},
+ "dialog": {"open": 1}
};
var elements = Object.keys(attributeMap);
function is(token, type) {
@@ -2307,10 +2616,20 @@
}
if (token)
return token.value;
}
+function findAttributeName(session, pos) {
+ var iterator = new TokenIterator(session, pos.row, pos.column);
+ var token = iterator.getCurrentToken();
+ while (token && !is(token, "attribute-name")){
+ token = iterator.stepBackward();
+ }
+ if (token)
+ return token.value;
+}
+
var HtmlCompletions = function() {
};
(function() {
@@ -2321,11 +2640,16 @@
if (!token)
return [];
if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
return this.getTagCompletions(state, session, pos, prefix);
if (is(token, "tag-whitespace") || is(token, "attribute-name"))
- return this.getAttributeCompetions(state, session, pos, prefix);
+ return this.getAttributeCompletions(state, session, pos, prefix);
+ if (is(token, "attribute-value"))
+ return this.getAttributeValueCompletions(state, session, pos, prefix);
+ var line = session.getLine(pos.row).substr(0, pos.column);
+ if (/&[A-z]*$/i.test(line))
+ return this.getHTMLEntityCompletions(state, session, pos, prefix);
return [];
};
this.getTagCompletions = function(state, session, pos, prefix) {
@@ -2336,22 +2660,55 @@
score: Number.MAX_VALUE
};
});
};
- this.getAttributeCompetions = function(state, session, pos, prefix) {
+ this.getAttributeCompletions = function(state, session, pos, prefix) {
var tagName = findTagName(session, pos);
if (!tagName)
return [];
var attributes = globalAttributes;
if (tagName in attributeMap) {
- attributes = attributes.concat(attributeMap[tagName]);
+ attributes = attributes.concat(Object.keys(attributeMap[tagName]));
}
return attributes.map(function(attribute){
return {
caption: attribute,
snippet: attribute + '="$0"',
meta: "attribute",
+ score: Number.MAX_VALUE
+ };
+ });
+ };
+
+ this.getAttributeValueCompletions = function(state, session, pos, prefix) {
+ var tagName = findTagName(session, pos);
+ var attributeName = findAttributeName(session, pos);
+
+ if (!tagName)
+ return [];
+ var values = [];
+ if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
+ values = Object.keys(attributeMap[tagName][attributeName]);
+ }
+ return values.map(function(value){
+ return {
+ caption: value,
+ snippet: value,
+ meta: "attribute value",
+ score: Number.MAX_VALUE
+ };
+ });
+ };
+
+ this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
+ var values = ['Á', 'á', 'Â', 'â', '´', 'Æ', 'æ', 'À', 'à', 'ℵ', 'Α', 'α', '&', '∧', '∠', 'Å', 'å', '≈', 'Ã', 'ã', 'Ä', 'ä', '„', 'Β', 'β', '¦', '•', '∩', 'Ç', 'ç', '¸', '¢', 'Χ', 'χ', 'ˆ', '♣', '≅', '©', '↵', '∪', '¤', '‡', '†', '⇓', '↓', '°', 'Δ', 'δ', '♦', '÷', 'É', 'é', 'Ê', 'ê', 'È', 'è', '∅', ' ', ' ', 'Ε', 'ε', '≡', 'Η', 'η', 'Ð', 'ð', 'Ë', 'ë', '€', '∃', 'ƒ', '∀', '½', '¼', '¾', '⁄', 'Γ', 'γ', '≥', '>', '⇔', '↔', '♥', '…', 'Í', 'í', 'Î', 'î', '¡', 'Ì', 'ì', 'ℑ', '∞', '∫', 'Ι', 'ι', '¿', '∈', 'Ï', 'ï', 'Κ', 'κ', 'Λ', 'λ', '⟨', '«', '⇐', '←', '⌈', '“', '≤', '⌊', '∗', '◊', '‎', '‹', '‘', '<', '¯', '—', 'µ', '·', '−', 'Μ', 'μ', '∇', ' ', '–', '≠', '∋', '¬', '∉', '⊄', 'Ñ', 'ñ', 'Ν', 'ν', 'Ó', 'ó', 'Ô', 'ô', 'Œ', 'œ', 'Ò', 'ò', '‾', 'Ω', 'ω', 'Ο', 'ο', '⊕', '∨', 'ª', 'º', 'Ø', 'ø', 'Õ', 'õ', '⊗', 'Ö', 'ö', '¶', '∂', '‰', '⊥', 'Φ', 'φ', 'Π', 'π', 'ϖ', '±', '£', '″', '′', '∏', '∝', 'Ψ', 'ψ', '"', '√', '⟩', '»', '⇒', '→', '⌉', '”', 'ℜ', '®', '⌋', 'Ρ', 'ρ', '‏', '›', '’', '‚', 'Š', 'š', '⋅', '§', '­', 'Σ', 'σ', 'ς', '∼', '♠', '⊂', '⊆', '∑', '⊃', '¹', '²', '³', '⊇', 'ß', 'Τ', 'τ', '∴', 'Θ', 'θ', 'ϑ', ' ', 'Þ', 'þ', '˜', '×', '™', 'Ú', 'ú', '⇑', '↑', 'Û', 'û', 'Ù', 'ù', '¨', 'ϒ', 'Υ', 'υ', 'Ü', 'ü', '℘', 'Ξ', 'ξ', 'Ý', 'ý', '¥', 'Ÿ', 'ÿ', 'Ζ', 'ζ', '‍', '‌'];
+
+ return values.map(function(value){
+ return {
+ caption: value,
+ snippet: value.substr(1),
+ meta: "html entity",
score: Number.MAX_VALUE
};
});
};