formagic 0.3.9 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/app/assets/javascripts/formagic.coffee +5 -2
  4. data/app/assets/javascripts/formagic/form.coffee +4 -1
  5. data/app/assets/javascripts/formagic/inputs/ace-css.coffee +25 -0
  6. data/app/assets/javascripts/formagic/inputs/ace-html.coffee +25 -0
  7. data/app/assets/javascripts/formagic/inputs/ace-js.coffee +25 -0
  8. data/app/assets/javascripts/formagic/inputs/ace-markdown.coffee +51 -0
  9. data/app/assets/javascripts/formagic/inputs/{markdown_toolbar.coffee → ace-markdown_toolbar.coffee} +27 -7
  10. data/app/assets/javascripts/formagic/inputs/{html.coffee → ace.coffee} +27 -29
  11. data/app/assets/javascripts/formagic/inputs/documents_reorder.coffee +3 -0
  12. data/app/assets/javascripts/formagic/inputs/list_reorder.coffee +2 -0
  13. data/app/assets/javascripts/formagic/inputs/url.coffee +1 -1
  14. data/app/assets/javascripts/vendor/ace.js +264 -123
  15. data/app/assets/javascripts/vendor/mode-css.js +1008 -0
  16. data/app/assets/javascripts/vendor/mode-html.js +488 -129
  17. data/app/assets/javascripts/vendor/mode-javascript.js +1154 -0
  18. data/app/assets/javascripts/vendor/mode-markdown.js +489 -129
  19. data/app/assets/javascripts/vendor/slip.js +792 -0
  20. data/app/assets/stylesheets/formagic.scss +9 -1
  21. data/app/assets/stylesheets/formagic/{nested-form.scss → documents.scss} +0 -0
  22. data/app/assets/stylesheets/formagic/markdown.scss +4 -1
  23. data/app/assets/stylesheets/formagic/switch.scss +1 -1
  24. data/lib/formagic/version.rb +1 -1
  25. metadata +12 -6
  26. data/app/assets/javascripts/formagic/inputs/markdown.coffee +0 -94
@@ -54,6 +54,7 @@ define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/
54
54
  var oop = require("../lib/oop");
55
55
  var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
56
56
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
57
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
57
58
 
58
59
  var JavaScriptHighlightRules = function(options) {
59
60
  var keywordMapper = this.createKeywordMapper({
@@ -83,7 +84,6 @@ var JavaScriptHighlightRules = function(options) {
83
84
  "constant.language.boolean": "true|false"
84
85
  }, "identifier");
85
86
  var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
86
- var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
87
87
 
88
88
  var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
89
89
  "u[0-9a-fA-F]{4}|" + // unicode
@@ -171,15 +171,6 @@ var JavaScriptHighlightRules = function(options) {
171
171
  token : "keyword",
172
172
  regex : "(?:" + kwBeforeRe + ")\\b",
173
173
  next : "start"
174
- }, {
175
- token : ["punctuation.operator", "support.function"],
176
- 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(?=\()/
177
- }, {
178
- token : ["punctuation.operator", "support.function.dom"],
179
- 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(?=\()/
180
- }, {
181
- token : ["punctuation.operator", "support.constant"],
182
- 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/
183
174
  }, {
184
175
  token : ["support.constant"],
185
176
  regex : /that\b/
@@ -189,9 +180,13 @@ var JavaScriptHighlightRules = function(options) {
189
180
  }, {
190
181
  token : keywordMapper,
191
182
  regex : identifierRe
183
+ }, {
184
+ token : "punctuation.operator",
185
+ regex : /[.](?![.])/,
186
+ next : "property"
192
187
  }, {
193
188
  token : "keyword.operator",
194
- regex : /--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
189
+ regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
195
190
  next : "start"
196
191
  }, {
197
192
  token : "punctuation.operator",
@@ -209,6 +204,38 @@ var JavaScriptHighlightRules = function(options) {
209
204
  regex: /^#!.*$/
210
205
  }
211
206
  ],
207
+ property: [{
208
+ token : "text",
209
+ regex : "\\s+"
210
+ }, {
211
+ token : [
212
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
213
+ "keyword.operator", "text",
214
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
215
+ ],
216
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
217
+ next: "function_arguments"
218
+ }, {
219
+ token : "punctuation.operator",
220
+ regex : /[.](?![.])/
221
+ }, {
222
+ token : "support.function",
223
+ 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(?=\()/
224
+ }, {
225
+ token : "support.function.dom",
226
+ 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(?=\()/
227
+ }, {
228
+ token : "support.constant",
229
+ 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/
230
+ }, {
231
+ token : "identifier",
232
+ regex : identifierRe
233
+ }, {
234
+ regex: "",
235
+ token: "empty",
236
+ next: "no_regex"
237
+ }
238
+ ],
212
239
  "start": [
213
240
  DocCommentHighlightRules.getStartRule("doc-start"),
214
241
  {
@@ -363,7 +390,7 @@ var JavaScriptHighlightRules = function(options) {
363
390
  if (val == "}" && stack.length) {
364
391
  stack.shift();
365
392
  this.next = stack.shift();
366
- if (this.next.indexOf("string") != -1)
393
+ if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
367
394
  return "paren.quasi.end";
368
395
  }
369
396
  return val == "{" ? "paren.lparen" : "paren.rparen";
@@ -387,6 +414,9 @@ var JavaScriptHighlightRules = function(options) {
387
414
  defaultToken: "string.quasi"
388
415
  }]
389
416
  });
417
+
418
+ if (!options || !options.noJSX)
419
+ JSX.call(this);
390
420
  }
391
421
 
392
422
  this.embedRules(DocCommentHighlightRules, "doc-",
@@ -397,6 +427,105 @@ var JavaScriptHighlightRules = function(options) {
397
427
 
398
428
  oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
399
429
 
430
+ function JSX() {
431
+ var tagRegex = identifierRe.replace("\\d", "\\d\\-");
432
+ var jsxTag = {
433
+ onMatch : function(val, state, stack) {
434
+ var offset = val.charAt(1) == "/" ? 2 : 1;
435
+ if (offset == 1) {
436
+ if (state != this.nextState)
437
+ stack.unshift(this.next, this.nextState, 0);
438
+ else
439
+ stack.unshift(this.next);
440
+ stack[2]++;
441
+ } else if (offset == 2) {
442
+ if (state == this.nextState) {
443
+ stack[1]--;
444
+ if (!stack[1] || stack[1] < 0) {
445
+ stack.shift();
446
+ stack.shift();
447
+ }
448
+ }
449
+ }
450
+ return [{
451
+ type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
452
+ value: val.slice(0, offset)
453
+ }, {
454
+ type: "meta.tag.tag-name.xml",
455
+ value: val.substr(offset)
456
+ }];
457
+ },
458
+ regex : "</?" + tagRegex + "",
459
+ next: "jsxAttributes",
460
+ nextState: "jsx"
461
+ };
462
+ this.$rules.start.unshift(jsxTag);
463
+ var jsxJsRule = {
464
+ regex: "{",
465
+ token: "paren.quasi.start",
466
+ push: "start"
467
+ };
468
+ this.$rules.jsx = [
469
+ jsxJsRule,
470
+ jsxTag,
471
+ {include : "reference"},
472
+ {defaultToken: "string"}
473
+ ];
474
+ this.$rules.jsxAttributes = [{
475
+ token : "meta.tag.punctuation.tag-close.xml",
476
+ regex : "/?>",
477
+ onMatch : function(value, currentState, stack) {
478
+ if (currentState == stack[0])
479
+ stack.shift();
480
+ if (value.length == 2) {
481
+ if (stack[0] == this.nextState)
482
+ stack[1]--;
483
+ if (!stack[1] || stack[1] < 0) {
484
+ stack.splice(0, 2);
485
+ }
486
+ }
487
+ this.next = stack[0] || "start";
488
+ return [{type: this.token, value: value}];
489
+ },
490
+ nextState: "jsx"
491
+ },
492
+ jsxJsRule,
493
+ {
494
+ token : "entity.other.attribute-name.xml",
495
+ regex : tagRegex
496
+ }, {
497
+ token : "keyword.operator.attribute-equals.xml",
498
+ regex : "="
499
+ }, {
500
+ token : "text.tag-whitespace.xml",
501
+ regex : "\\s+"
502
+ }, {
503
+ token : "string.attribute-value.xml",
504
+ regex : "'",
505
+ stateName : "jsx_attr_q",
506
+ push : [
507
+ {token : "string.attribute-value.xml", regex: "'", next: "pop"},
508
+ jsxJsRule,
509
+ {include : "reference"},
510
+ {defaultToken : "string.attribute-value.xml"}
511
+ ]
512
+ }, {
513
+ token : "string.attribute-value.xml",
514
+ regex : '"',
515
+ stateName : "jsx_attr_qq",
516
+ push : [
517
+ jsxJsRule,
518
+ {token : "string.attribute-value.xml", regex: '"', next: "pop"},
519
+ {include : "reference"},
520
+ {defaultToken : "string.attribute-value.xml"}
521
+ ]
522
+ }];
523
+ this.$rules.reference = [{
524
+ token : "constant.language.escape.reference.xml",
525
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
526
+ }];
527
+ }
528
+
400
529
  exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
401
530
  });
402
531
 
@@ -1168,6 +1297,180 @@ exports.CssHighlightRules = CssHighlightRules;
1168
1297
 
1169
1298
  });
1170
1299
 
1300
+ define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) {
1301
+ "use strict";
1302
+
1303
+ var propertyMap = {
1304
+ "background": {"#$0": 1},
1305
+ "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
1306
+ "background-image": {"url('/$0')": 1},
1307
+ "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
1308
+ "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2,},
1309
+ "background-attachment": {"scroll": 1, "fixed": 1},
1310
+ "background-size": {"cover": 1, "contain": 1},
1311
+ "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
1312
+ "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
1313
+ "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
1314
+ "border-color": {"#$0": 1},
1315
+ "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2,},
1316
+ "border-collapse": {"collapse": 1, "separate": 1},
1317
+ "bottom": {"px": 1, "em": 1, "%": 1},
1318
+ "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
1319
+ "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
1320
+ "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},
1321
+ "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
1322
+ "empty-cells": {"show": 1, "hide": 1},
1323
+ "float": {"left": 1, "right": 1, "none": 1},
1324
+ "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},
1325
+ "font-size": {"px": 1, "em": 1, "%": 1},
1326
+ "font-weight": {"bold": 1, "normal": 1},
1327
+ "font-style": {"italic": 1, "normal": 1},
1328
+ "font-variant": {"normal": 1, "small-caps": 1},
1329
+ "height": {"px": 1, "em": 1, "%": 1},
1330
+ "left": {"px": 1, "em": 1, "%": 1},
1331
+ "letter-spacing": {"normal": 1},
1332
+ "line-height": {"normal": 1},
1333
+ "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},
1334
+ "margin": {"px": 1, "em": 1, "%": 1},
1335
+ "margin-right": {"px": 1, "em": 1, "%": 1},
1336
+ "margin-left": {"px": 1, "em": 1, "%": 1},
1337
+ "margin-top": {"px": 1, "em": 1, "%": 1},
1338
+ "margin-bottom": {"px": 1, "em": 1, "%": 1},
1339
+ "max-height": {"px": 1, "em": 1, "%": 1},
1340
+ "max-width": {"px": 1, "em": 1, "%": 1},
1341
+ "min-height": {"px": 1, "em": 1, "%": 1},
1342
+ "min-width": {"px": 1, "em": 1, "%": 1},
1343
+ "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
1344
+ "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
1345
+ "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
1346
+ "padding": {"px": 1, "em": 1, "%": 1},
1347
+ "padding-top": {"px": 1, "em": 1, "%": 1},
1348
+ "padding-right": {"px": 1, "em": 1, "%": 1},
1349
+ "padding-bottom": {"px": 1, "em": 1, "%": 1},
1350
+ "padding-left": {"px": 1, "em": 1, "%": 1},
1351
+ "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
1352
+ "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
1353
+ "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
1354
+ "right": {"px": 1, "em": 1, "%": 1},
1355
+ "table-layout": {"fixed": 1, "auto": 1},
1356
+ "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
1357
+ "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
1358
+ "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
1359
+ "top": {"px": 1, "em": 1, "%": 1},
1360
+ "vertical-align": {"top": 1, "bottom": 1},
1361
+ "visibility": {"hidden": 1, "visible": 1},
1362
+ "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
1363
+ "width": {"px": 1, "em": 1, "%": 1},
1364
+ "word-spacing": {"normal": 1},
1365
+ "filter": {"alpha(opacity=$0100)": 1},
1366
+
1367
+ "text-shadow": {"$02px 2px 2px #777": 1},
1368
+ "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
1369
+ "-moz-border-radius": 1,
1370
+ "-moz-border-radius-topright": 1,
1371
+ "-moz-border-radius-bottomright": 1,
1372
+ "-moz-border-radius-topleft": 1,
1373
+ "-moz-border-radius-bottomleft": 1,
1374
+ "-webkit-border-radius": 1,
1375
+ "-webkit-border-top-right-radius": 1,
1376
+ "-webkit-border-top-left-radius": 1,
1377
+ "-webkit-border-bottom-right-radius": 1,
1378
+ "-webkit-border-bottom-left-radius": 1,
1379
+ "-moz-box-shadow": 1,
1380
+ "-webkit-box-shadow": 1,
1381
+ "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
1382
+ "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
1383
+ "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
1384
+ };
1385
+
1386
+ var CssCompletions = function() {
1387
+
1388
+ };
1389
+
1390
+ (function() {
1391
+
1392
+ this.completionsDefined = false;
1393
+
1394
+ this.defineCompletions = function() {
1395
+ if (document) {
1396
+ var style = document.createElement('c').style;
1397
+
1398
+ for (var i in style) {
1399
+ if (typeof style[i] !== 'string')
1400
+ continue;
1401
+
1402
+ var name = i.replace(/[A-Z]/g, function(x) {
1403
+ return '-' + x.toLowerCase();
1404
+ });
1405
+
1406
+ if (!propertyMap.hasOwnProperty(name))
1407
+ propertyMap[name] = 1;
1408
+ }
1409
+ }
1410
+
1411
+ this.completionsDefined = true;
1412
+ }
1413
+
1414
+ this.getCompletions = function(state, session, pos, prefix) {
1415
+ if (!this.completionsDefined) {
1416
+ this.defineCompletions();
1417
+ }
1418
+
1419
+ var token = session.getTokenAt(pos.row, pos.column);
1420
+
1421
+ if (!token)
1422
+ return [];
1423
+ if (state==='ruleset'){
1424
+ var line = session.getLine(pos.row).substr(0, pos.column);
1425
+ if (/:[^;]+$/.test(line)) {
1426
+ /([\w\-]+):[^:]*$/.test(line);
1427
+
1428
+ return this.getPropertyValueCompletions(state, session, pos, prefix);
1429
+ } else {
1430
+ return this.getPropertyCompletions(state, session, pos, prefix);
1431
+ }
1432
+ }
1433
+
1434
+ return [];
1435
+ };
1436
+
1437
+ this.getPropertyCompletions = function(state, session, pos, prefix) {
1438
+ var properties = Object.keys(propertyMap);
1439
+ return properties.map(function(property){
1440
+ return {
1441
+ caption: property,
1442
+ snippet: property + ': $0',
1443
+ meta: "property",
1444
+ score: Number.MAX_VALUE
1445
+ };
1446
+ });
1447
+ };
1448
+
1449
+ this.getPropertyValueCompletions = function(state, session, pos, prefix) {
1450
+ var line = session.getLine(pos.row).substr(0, pos.column);
1451
+ var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
1452
+
1453
+ if (!property)
1454
+ return [];
1455
+ var values = [];
1456
+ if (property in propertyMap && typeof propertyMap[property] === "object") {
1457
+ values = Object.keys(propertyMap[property]);
1458
+ }
1459
+ return values.map(function(value){
1460
+ return {
1461
+ caption: value,
1462
+ snippet: value,
1463
+ meta: "property value",
1464
+ score: Number.MAX_VALUE
1465
+ };
1466
+ });
1467
+ };
1468
+
1469
+ }).call(CssCompletions.prototype);
1470
+
1471
+ exports.CssCompletions = CssCompletions;
1472
+ });
1473
+
1171
1474
  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) {
1172
1475
  "use strict";
1173
1476
 
@@ -1247,7 +1550,7 @@ oop.inherits(CssBehaviour, CstyleBehaviour);
1247
1550
  exports.CssBehaviour = CssBehaviour;
1248
1551
  });
1249
1552
 
1250
- 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) {
1553
+ 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) {
1251
1554
  "use strict";
1252
1555
 
1253
1556
  var oop = require("../lib/oop");
@@ -1255,6 +1558,7 @@ var TextMode = require("./text").Mode;
1255
1558
  var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1256
1559
  var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1257
1560
  var WorkerClient = require("../worker/worker_client").WorkerClient;
1561
+ var CssCompletions = require("./css_completions").CssCompletions;
1258
1562
  var CssBehaviour = require("./behaviour/css").CssBehaviour;
1259
1563
  var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1260
1564
 
@@ -1262,6 +1566,7 @@ var Mode = function() {
1262
1566
  this.HighlightRules = CssHighlightRules;
1263
1567
  this.$outdent = new MatchingBraceOutdent();
1264
1568
  this.$behaviour = new CssBehaviour();
1569
+ this.$completer = new CssCompletions();
1265
1570
  this.foldingRules = new CStyleFoldMode();
1266
1571
  };
1267
1572
  oop.inherits(Mode, TextMode);
@@ -1294,6 +1599,10 @@ oop.inherits(Mode, TextMode);
1294
1599
  this.$outdent.autoOutdent(doc, row);
1295
1600
  };
1296
1601
 
1602
+ this.getCompletions = function(state, session, pos, prefix) {
1603
+ return this.$completer.getCompletions(state, session, pos, prefix);
1604
+ };
1605
+
1297
1606
  this.createWorker = function(session) {
1298
1607
  var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1299
1608
  worker.attachToDocument(session.getDocument());
@@ -1599,7 +1908,7 @@ var HtmlHighlightRules = function() {
1599
1908
  });
1600
1909
 
1601
1910
  this.embedTagRules(CssHighlightRules, "css-", "style");
1602
- this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
1911
+ this.embedTagRules(new JavaScriptHighlightRules({noJSX: true}).getRules(), "js-", "script");
1603
1912
 
1604
1913
  if (this.constructor === HtmlHighlightRules)
1605
1914
  this.normalizeRules();
@@ -2177,118 +2486,120 @@ var eventAttributes = [
2177
2486
  var globalAttributes = commonAttributes.concat(eventAttributes);
2178
2487
 
2179
2488
  var attributeMap = {
2180
- "html": ["manifest"],
2181
- "head": [],
2182
- "title": [],
2183
- "base": ["href", "target"],
2184
- "link": ["href", "hreflang", "rel", "media", "type", "sizes"],
2185
- "meta": ["http-equiv", "name", "content", "charset"],
2186
- "style": ["type", "media", "scoped"],
2187
- "script": ["charset", "type", "src", "defer", "async"],
2188
- "noscript": ["href"],
2189
- "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"],
2190
- "section": [],
2191
- "nav": [],
2192
- "article": ["pubdate"],
2193
- "aside": [],
2194
- "h1": [],
2195
- "h2": [],
2196
- "h3": [],
2197
- "h4": [],
2198
- "h5": [],
2199
- "h6": [],
2200
- "header": [],
2201
- "footer": [],
2202
- "address": [],
2203
- "main": [],
2204
- "p": [],
2205
- "hr": [],
2206
- "pre": [],
2207
- "blockquote": ["cite"],
2208
- "ol": ["start", "reversed"],
2209
- "ul": [],
2210
- "li": ["value"],
2211
- "dl": [],
2212
- "dt": [],
2213
- "dd": [],
2214
- "figure": [],
2215
- "figcaption": [],
2216
- "div": [],
2217
- "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"],
2218
- "em": [],
2219
- "strong": [],
2220
- "small": [],
2221
- "s": [],
2222
- "cite": [],
2223
- "q": ["cite"],
2224
- "dfn": [],
2225
- "abbr": [],
2226
- "data": [],
2227
- "time": ["datetime"],
2228
- "code": [],
2229
- "var": [],
2230
- "samp": [],
2231
- "kbd": [],
2232
- "sub": [],
2233
- "sup": [],
2234
- "i": [],
2235
- "b": [],
2236
- "u": [],
2237
- "mark": [],
2238
- "ruby": [],
2239
- "rt": [],
2240
- "rp": [],
2241
- "bdi": [],
2242
- "bdo": [],
2243
- "span": [],
2244
- "br": [],
2245
- "wbr": [],
2246
- "ins": ["cite", "datetime"],
2247
- "del": ["cite", "datetime"],
2248
- "img": ["alt", "src", "height", "width", "usemap", "ismap"],
2249
- "iframe": ["name", "src", "height", "width", "sandbox", "seamless"],
2250
- "embed": ["src", "height", "width", "type"],
2251
- "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"],
2252
- "param": ["name", "value"],
2253
- "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"],
2254
- "audio": ["src", "autobuffer", "autoplay", "loop", "controls"],
2255
- "source": ["src", "type", "media"],
2256
- "track": ["kind", "src", "srclang", "label", "default"],
2257
- "canvas": ["width", "height"],
2258
- "map": ["name"],
2259
- "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"],
2260
- "svg": [],
2261
- "math": [],
2262
- "table": ["summary"],
2263
- "caption": [],
2264
- "colgroup": ["span"],
2265
- "col": ["span"],
2266
- "tbody": [],
2267
- "thead": [],
2268
- "tfoot": [],
2269
- "tr": [],
2270
- "td": ["headers", "rowspan", "colspan"],
2271
- "th": ["headers", "rowspan", "colspan", "scope"],
2272
- "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"],
2273
- "fieldset": ["disabled", "form", "name"],
2274
- "legend": [],
2275
- "label": ["form", "for"],
2276
- "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"],
2277
- "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"],
2278
- "select": ["autofocus", "disabled", "form", "multiple", "name", "size"],
2279
- "datalist": [],
2280
- "optgroup": ["disabled", "label"],
2281
- "option": ["disabled", "selected", "label", "value"],
2282
- "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"],
2283
- "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"],
2284
- "output": ["for", "form", "name"],
2285
- "progress": ["value", "max"],
2286
- "meter": ["value", "min", "max", "low", "high", "optimum"],
2287
- "details": ["open"],
2288
- "summary": [],
2289
- "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"],
2290
- "menu": ["type", "label"],
2291
- "dialog": ["open"]
2489
+ "html": {"manifest": 1},
2490
+ "head": {},
2491
+ "title": {},
2492
+ "base": {"href": 1, "target": 1},
2493
+ "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},
2494
+ "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
2495
+ "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
2496
+ "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
2497
+ "noscript": {"href": 1},
2498
+ "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},
2499
+ "section": {},
2500
+ "nav": {},
2501
+ "article": {"pubdate": 1},
2502
+ "aside": {},
2503
+ "h1": {},
2504
+ "h2": {},
2505
+ "h3": {},
2506
+ "h4": {},
2507
+ "h5": {},
2508
+ "h6": {},
2509
+ "header": {},
2510
+ "footer": {},
2511
+ "address": {},
2512
+ "main": {},
2513
+ "p": {},
2514
+ "hr": {},
2515
+ "pre": {},
2516
+ "blockquote": {"cite": 1},
2517
+ "ol": {"start": 1, "reversed": 1},
2518
+ "ul": {},
2519
+ "li": {"value": 1},
2520
+ "dl": {},
2521
+ "dt": {},
2522
+ "dd": {},
2523
+ "figure": {},
2524
+ "figcaption": {},
2525
+ "div": {},
2526
+ "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},
2527
+ "em": {},
2528
+ "strong": {},
2529
+ "small": {},
2530
+ "s": {},
2531
+ "cite": {},
2532
+ "q": {"cite": 1},
2533
+ "dfn": {},
2534
+ "abbr": {},
2535
+ "data": {},
2536
+ "time": {"datetime": 1},
2537
+ "code": {},
2538
+ "var": {},
2539
+ "samp": {},
2540
+ "kbd": {},
2541
+ "sub": {},
2542
+ "sup": {},
2543
+ "i": {},
2544
+ "b": {},
2545
+ "u": {},
2546
+ "mark": {},
2547
+ "ruby": {},
2548
+ "rt": {},
2549
+ "rp": {},
2550
+ "bdi": {},
2551
+ "bdo": {},
2552
+ "span": {},
2553
+ "br": {},
2554
+ "wbr": {},
2555
+ "ins": {"cite": 1, "datetime": 1},
2556
+ "del": {"cite": 1, "datetime": 1},
2557
+ "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
2558
+ "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}},
2559
+ "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
2560
+ "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
2561
+ "param": {"name": 1, "value": 1},
2562
+ "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}},
2563
+ "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
2564
+ "source": {"src": 1, "type": 1, "media": 1},
2565
+ "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
2566
+ "canvas": {"width": 1, "height": 1},
2567
+ "map": {"name": 1},
2568
+ "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
2569
+ "svg": {},
2570
+ "math": {},
2571
+ "table": {"summary": 1},
2572
+ "caption": {},
2573
+ "colgroup": {"span": 1},
2574
+ "col": {"span": 1},
2575
+ "tbody": {},
2576
+ "thead": {},
2577
+ "tfoot": {},
2578
+ "tr": {},
2579
+ "td": {"headers": 1, "rowspan": 1, "colspan": 1},
2580
+ "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
2581
+ "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}},
2582
+ "fieldset": {"disabled": 1, "form": 1, "name": 1},
2583
+ "legend": {},
2584
+ "label": {"form": 1, "for": 1},
2585
+ "input": {
2586
+ "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},
2587
+ "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},
2588
+ "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}},
2589
+ "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
2590
+ "datalist": {},
2591
+ "optgroup": {"disabled": 1, "label": 1},
2592
+ "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
2593
+ "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}},
2594
+ "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
2595
+ "output": {"for": 1, "form": 1, "name": 1},
2596
+ "progress": {"value": 1, "max": 1},
2597
+ "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
2598
+ "details": {"open": 1},
2599
+ "summary": {},
2600
+ "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
2601
+ "menu": {"type": 1, "label": 1},
2602
+ "dialog": {"open": 1}
2292
2603
  };
2293
2604
 
2294
2605
  var elements = Object.keys(attributeMap);
@@ -2307,6 +2618,16 @@ function findTagName(session, pos) {
2307
2618
  return token.value;
2308
2619
  }
2309
2620
 
2621
+ function findAttributeName(session, pos) {
2622
+ var iterator = new TokenIterator(session, pos.row, pos.column);
2623
+ var token = iterator.getCurrentToken();
2624
+ while (token && !is(token, "attribute-name")){
2625
+ token = iterator.stepBackward();
2626
+ }
2627
+ if (token)
2628
+ return token.value;
2629
+ }
2630
+
2310
2631
  var HtmlCompletions = function() {
2311
2632
 
2312
2633
  };
@@ -2321,7 +2642,12 @@ var HtmlCompletions = function() {
2321
2642
  if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
2322
2643
  return this.getTagCompletions(state, session, pos, prefix);
2323
2644
  if (is(token, "tag-whitespace") || is(token, "attribute-name"))
2324
- return this.getAttributeCompetions(state, session, pos, prefix);
2645
+ return this.getAttributeCompletions(state, session, pos, prefix);
2646
+ if (is(token, "attribute-value"))
2647
+ return this.getAttributeValueCompletions(state, session, pos, prefix);
2648
+ var line = session.getLine(pos.row).substr(0, pos.column);
2649
+ if (/&[A-z]*$/i.test(line))
2650
+ return this.getHTMLEntityCompletions(state, session, pos, prefix);
2325
2651
 
2326
2652
  return [];
2327
2653
  };
@@ -2336,13 +2662,13 @@ var HtmlCompletions = function() {
2336
2662
  });
2337
2663
  };
2338
2664
 
2339
- this.getAttributeCompetions = function(state, session, pos, prefix) {
2665
+ this.getAttributeCompletions = function(state, session, pos, prefix) {
2340
2666
  var tagName = findTagName(session, pos);
2341
2667
  if (!tagName)
2342
2668
  return [];
2343
2669
  var attributes = globalAttributes;
2344
2670
  if (tagName in attributeMap) {
2345
- attributes = attributes.concat(attributeMap[tagName]);
2671
+ attributes = attributes.concat(Object.keys(attributeMap[tagName]));
2346
2672
  }
2347
2673
  return attributes.map(function(attribute){
2348
2674
  return {
@@ -2354,6 +2680,39 @@ var HtmlCompletions = function() {
2354
2680
  });
2355
2681
  };
2356
2682
 
2683
+ this.getAttributeValueCompletions = function(state, session, pos, prefix) {
2684
+ var tagName = findTagName(session, pos);
2685
+ var attributeName = findAttributeName(session, pos);
2686
+
2687
+ if (!tagName)
2688
+ return [];
2689
+ var values = [];
2690
+ if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
2691
+ values = Object.keys(attributeMap[tagName][attributeName]);
2692
+ }
2693
+ return values.map(function(value){
2694
+ return {
2695
+ caption: value,
2696
+ snippet: value,
2697
+ meta: "attribute value",
2698
+ score: Number.MAX_VALUE
2699
+ };
2700
+ });
2701
+ };
2702
+
2703
+ this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
2704
+ var values = ['&Aacute;', '&aacute;', '&Acirc;', '&acirc;', '&acute;', '&AElig;', '&aelig;', '&Agrave;', '&agrave;', '&alefsym;', '&Alpha;', '&alpha;', '&amp;', '&and;', '&ang;', '&Aring;', '&aring;', '&asymp;', '&Atilde;', '&atilde;', '&Auml;', '&auml;', '&bdquo;', '&Beta;', '&beta;', '&brvbar;', '&bull;', '&cap;', '&Ccedil;', '&ccedil;', '&cedil;', '&cent;', '&Chi;', '&chi;', '&circ;', '&clubs;', '&cong;', '&copy;', '&crarr;', '&cup;', '&curren;', '&Dagger;', '&dagger;', '&dArr;', '&darr;', '&deg;', '&Delta;', '&delta;', '&diams;', '&divide;', '&Eacute;', '&eacute;', '&Ecirc;', '&ecirc;', '&Egrave;', '&egrave;', '&empty;', '&emsp;', '&ensp;', '&Epsilon;', '&epsilon;', '&equiv;', '&Eta;', '&eta;', '&ETH;', '&eth;', '&Euml;', '&euml;', '&euro;', '&exist;', '&fnof;', '&forall;', '&frac12;', '&frac14;', '&frac34;', '&frasl;', '&Gamma;', '&gamma;', '&ge;', '&gt;', '&hArr;', '&harr;', '&hearts;', '&hellip;', '&Iacute;', '&iacute;', '&Icirc;', '&icirc;', '&iexcl;', '&Igrave;', '&igrave;', '&image;', '&infin;', '&int;', '&Iota;', '&iota;', '&iquest;', '&isin;', '&Iuml;', '&iuml;', '&Kappa;', '&kappa;', '&Lambda;', '&lambda;', '&lang;', '&laquo;', '&lArr;', '&larr;', '&lceil;', '&ldquo;', '&le;', '&lfloor;', '&lowast;', '&loz;', '&lrm;', '&lsaquo;', '&lsquo;', '&lt;', '&macr;', '&mdash;', '&micro;', '&middot;', '&minus;', '&Mu;', '&mu;', '&nabla;', '&nbsp;', '&ndash;', '&ne;', '&ni;', '&not;', '&notin;', '&nsub;', '&Ntilde;', '&ntilde;', '&Nu;', '&nu;', '&Oacute;', '&oacute;', '&Ocirc;', '&ocirc;', '&OElig;', '&oelig;', '&Ograve;', '&ograve;', '&oline;', '&Omega;', '&omega;', '&Omicron;', '&omicron;', '&oplus;', '&or;', '&ordf;', '&ordm;', '&Oslash;', '&oslash;', '&Otilde;', '&otilde;', '&otimes;', '&Ouml;', '&ouml;', '&para;', '&part;', '&permil;', '&perp;', '&Phi;', '&phi;', '&Pi;', '&pi;', '&piv;', '&plusmn;', '&pound;', '&Prime;', '&prime;', '&prod;', '&prop;', '&Psi;', '&psi;', '&quot;', '&radic;', '&rang;', '&raquo;', '&rArr;', '&rarr;', '&rceil;', '&rdquo;', '&real;', '&reg;', '&rfloor;', '&Rho;', '&rho;', '&rlm;', '&rsaquo;', '&rsquo;', '&sbquo;', '&Scaron;', '&scaron;', '&sdot;', '&sect;', '&shy;', '&Sigma;', '&sigma;', '&sigmaf;', '&sim;', '&spades;', '&sub;', '&sube;', '&sum;', '&sup;', '&sup1;', '&sup2;', '&sup3;', '&supe;', '&szlig;', '&Tau;', '&tau;', '&there4;', '&Theta;', '&theta;', '&thetasym;', '&thinsp;', '&THORN;', '&thorn;', '&tilde;', '&times;', '&trade;', '&Uacute;', '&uacute;', '&uArr;', '&uarr;', '&Ucirc;', '&ucirc;', '&Ugrave;', '&ugrave;', '&uml;', '&upsih;', '&Upsilon;', '&upsilon;', '&Uuml;', '&uuml;', '&weierp;', '&Xi;', '&xi;', '&Yacute;', '&yacute;', '&yen;', '&Yuml;', '&yuml;', '&Zeta;', '&zeta;', '&zwj;', '&zwnj;'];
2705
+
2706
+ return values.map(function(value){
2707
+ return {
2708
+ caption: value,
2709
+ snippet: value.substr(1),
2710
+ meta: "html entity",
2711
+ score: Number.MAX_VALUE
2712
+ };
2713
+ });
2714
+ };
2715
+
2357
2716
  }).call(HtmlCompletions.prototype);
2358
2717
 
2359
2718
  exports.HtmlCompletions = HtmlCompletions;