You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2865 lines
111 KiB

12 months ago
  1. ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  2. "use strict";
  3. var oop = acequire("../lib/oop");
  4. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  5. var DocCommentHighlightRules = function() {
  6. this.$rules = {
  7. "start" : [ {
  8. token : "comment.doc.tag",
  9. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  10. },
  11. DocCommentHighlightRules.getTagRule(),
  12. {
  13. defaultToken : "comment.doc",
  14. caseInsensitive: true
  15. }]
  16. };
  17. };
  18. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  19. DocCommentHighlightRules.getTagRule = function(start) {
  20. return {
  21. token : "comment.doc.tag.storage.type",
  22. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  23. };
  24. };
  25. DocCommentHighlightRules.getStartRule = function(start) {
  26. return {
  27. token : "comment.doc", // doc comment
  28. regex : "\\/\\*(?=\\*)",
  29. next : start
  30. };
  31. };
  32. DocCommentHighlightRules.getEndRule = function (start) {
  33. return {
  34. token : "comment.doc", // closing comment
  35. regex : "\\*\\/",
  36. next : start
  37. };
  38. };
  39. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  40. });
  41. ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  42. "use strict";
  43. var oop = acequire("../lib/oop");
  44. var DocCommentHighlightRules = acequire("./doc_comment_highlight_rules").DocCommentHighlightRules;
  45. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  46. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  47. var JavaScriptHighlightRules = function(options) {
  48. var keywordMapper = this.createKeywordMapper({
  49. "variable.language":
  50. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  51. "Namespace|QName|XML|XMLList|" + // E4X
  52. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  53. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  54. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  55. "SyntaxError|TypeError|URIError|" +
  56. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  57. "isNaN|parseFloat|parseInt|" +
  58. "JSON|Math|" + // Other
  59. "this|arguments|prototype|window|document" , // Pseudo
  60. "keyword":
  61. "const|yield|import|get|set|async|await|" +
  62. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  63. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  64. "__parent__|__count__|escape|unescape|with|__proto__|" +
  65. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  66. "storage.type":
  67. "const|let|var|function",
  68. "constant.language":
  69. "null|Infinity|NaN|undefined",
  70. "support.function":
  71. "alert",
  72. "constant.language.boolean": "true|false"
  73. }, "identifier");
  74. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  75. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  76. "u[0-9a-fA-F]{4}|" + // unicode
  77. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  78. "[0-2][0-7]{0,2}|" + // oct
  79. "3[0-7][0-7]?|" + // oct
  80. "[4-7][0-7]?|" + //oct
  81. ".)";
  82. this.$rules = {
  83. "no_regex" : [
  84. DocCommentHighlightRules.getStartRule("doc-start"),
  85. comments("no_regex"),
  86. {
  87. token : "string",
  88. regex : "'(?=.)",
  89. next : "qstring"
  90. }, {
  91. token : "string",
  92. regex : '"(?=.)',
  93. next : "qqstring"
  94. }, {
  95. token : "constant.numeric", // hexadecimal, octal and binary
  96. regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  97. }, {
  98. token : "constant.numeric", // decimal integers and floats
  99. regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  100. }, {
  101. token : [
  102. "storage.type", "punctuation.operator", "support.function",
  103. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  104. ],
  105. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  106. next: "function_arguments"
  107. }, {
  108. token : [
  109. "storage.type", "punctuation.operator", "entity.name.function", "text",
  110. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  111. ],
  112. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  113. next: "function_arguments"
  114. }, {
  115. token : [
  116. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  117. "text", "paren.lparen"
  118. ],
  119. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  120. next: "function_arguments"
  121. }, {
  122. token : [
  123. "storage.type", "punctuation.operator", "entity.name.function", "text",
  124. "keyword.operator", "text",
  125. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  126. ],
  127. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  128. next: "function_arguments"
  129. }, {
  130. token : [
  131. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  132. ],
  133. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  134. next: "function_arguments"
  135. }, {
  136. token : [
  137. "entity.name.function", "text", "punctuation.operator",
  138. "text", "storage.type", "text", "paren.lparen"
  139. ],
  140. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  141. next: "function_arguments"
  142. }, {
  143. token : [
  144. "text", "text", "storage.type", "text", "paren.lparen"
  145. ],
  146. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  147. next: "function_arguments"
  148. }, {
  149. token : "keyword",
  150. regex : "from(?=\\s*('|\"))"
  151. }, {
  152. token : "keyword",
  153. regex : "(?:" + kwBeforeRe + ")\\b",
  154. next : "start"
  155. }, {
  156. token : ["support.constant"],
  157. regex : /that\b/
  158. }, {
  159. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  160. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  161. }, {
  162. token : keywordMapper,
  163. regex : identifierRe
  164. }, {
  165. token : "punctuation.operator",
  166. regex : /[.](?![.])/,
  167. next : "property"
  168. }, {
  169. token : "storage.type",
  170. regex : /=>/
  171. }, {
  172. token : "keyword.operator",
  173. regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  174. next : "start"
  175. }, {
  176. token : "punctuation.operator",
  177. regex : /[?:,;.]/,
  178. next : "start"
  179. }, {
  180. token : "paren.lparen",
  181. regex : /[\[({]/,
  182. next : "start"
  183. }, {
  184. token : "paren.rparen",
  185. regex : /[\])}]/
  186. }, {
  187. token: "comment",
  188. regex: /^#!.*$/
  189. }
  190. ],
  191. property: [{
  192. token : "text",
  193. regex : "\\s+"
  194. }, {
  195. token : [
  196. "storage.type", "punctuation.operator", "entity.name.function", "text",
  197. "keyword.operator", "text",
  198. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  199. ],
  200. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  201. next: "function_arguments"
  202. }, {
  203. token : "punctuation.operator",
  204. regex : /[.](?![.])/
  205. }, {
  206. token : "support.function",
  207. 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(?=\()/
  208. }, {
  209. token : "support.function.dom",
  210. 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(?=\()/
  211. }, {
  212. token : "support.constant",
  213. 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/
  214. }, {
  215. token : "identifier",
  216. regex : identifierRe
  217. }, {
  218. regex: "",
  219. token: "empty",
  220. next: "no_regex"
  221. }
  222. ],
  223. "start": [
  224. DocCommentHighlightRules.getStartRule("doc-start"),
  225. comments("start"),
  226. {
  227. token: "string.regexp",
  228. regex: "\\/",
  229. next: "regex"
  230. }, {
  231. token : "text",
  232. regex : "\\s+|^$",
  233. next : "start"
  234. }, {
  235. token: "empty",
  236. regex: "",
  237. next: "no_regex"
  238. }
  239. ],
  240. "regex": [
  241. {
  242. token: "regexp.keyword.operator",
  243. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  244. }, {
  245. token: "string.regexp",
  246. regex: "/[sxngimy]*",
  247. next: "no_regex"
  248. }, {
  249. token : "invalid",
  250. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  251. }, {
  252. token : "constant.language.escape",
  253. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  254. }, {
  255. token : "constant.language.delimiter",
  256. regex: /\|/
  257. }, {
  258. token: "constant.language.escape",
  259. regex: /\[\^?/,
  260. next: "regex_character_class"
  261. }, {
  262. token: "empty",
  263. regex: "$",
  264. next: "no_regex"
  265. }, {
  266. defaultToken: "string.regexp"
  267. }
  268. ],
  269. "regex_character_class": [
  270. {
  271. token: "regexp.charclass.keyword.operator",
  272. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  273. }, {
  274. token: "constant.language.escape",
  275. regex: "]",
  276. next: "regex"
  277. }, {
  278. token: "constant.language.escape",
  279. regex: "-"
  280. }, {
  281. token: "empty",
  282. regex: "$",
  283. next: "no_regex"
  284. }, {
  285. defaultToken: "string.regexp.charachterclass"
  286. }
  287. ],
  288. "function_arguments": [
  289. {
  290. token: "variable.parameter",
  291. regex: identifierRe
  292. }, {
  293. token: "punctuation.operator",
  294. regex: "[, ]+"
  295. }, {
  296. token: "punctuation.operator",
  297. regex: "$"
  298. }, {
  299. token: "empty",
  300. regex: "",
  301. next: "no_regex"
  302. }
  303. ],
  304. "qqstring" : [
  305. {
  306. token : "constant.language.escape",
  307. regex : escapedRe
  308. }, {
  309. token : "string",
  310. regex : "\\\\$",
  311. consumeLineEnd : true
  312. }, {
  313. token : "string",
  314. regex : '"|$',
  315. next : "no_regex"
  316. }, {
  317. defaultToken: "string"
  318. }
  319. ],
  320. "qstring" : [
  321. {
  322. token : "constant.language.escape",
  323. regex : escapedRe
  324. }, {
  325. token : "string",
  326. regex : "\\\\$",
  327. consumeLineEnd : true
  328. }, {
  329. token : "string",
  330. regex : "'|$",
  331. next : "no_regex"
  332. }, {
  333. defaultToken: "string"
  334. }
  335. ]
  336. };
  337. if (!options || !options.noES6) {
  338. this.$rules.no_regex.unshift({
  339. regex: "[{}]", onMatch: function(val, state, stack) {
  340. this.next = val == "{" ? this.nextState : "";
  341. if (val == "{" && stack.length) {
  342. stack.unshift("start", state);
  343. }
  344. else if (val == "}" && stack.length) {
  345. stack.shift();
  346. this.next = stack.shift();
  347. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  348. return "paren.quasi.end";
  349. }
  350. return val == "{" ? "paren.lparen" : "paren.rparen";
  351. },
  352. nextState: "start"
  353. }, {
  354. token : "string.quasi.start",
  355. regex : /`/,
  356. push : [{
  357. token : "constant.language.escape",
  358. regex : escapedRe
  359. }, {
  360. token : "paren.quasi.start",
  361. regex : /\${/,
  362. push : "start"
  363. }, {
  364. token : "string.quasi.end",
  365. regex : /`/,
  366. next : "pop"
  367. }, {
  368. defaultToken: "string.quasi"
  369. }]
  370. });
  371. if (!options || options.jsx != false)
  372. JSX.call(this);
  373. }
  374. this.embedRules(DocCommentHighlightRules, "doc-",
  375. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  376. this.normalizeRules();
  377. };
  378. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  379. function JSX() {
  380. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  381. var jsxTag = {
  382. onMatch : function(val, state, stack) {
  383. var offset = val.charAt(1) == "/" ? 2 : 1;
  384. if (offset == 1) {
  385. if (state != this.nextState)
  386. stack.unshift(this.next, this.nextState, 0);
  387. else
  388. stack.unshift(this.next);
  389. stack[2]++;
  390. } else if (offset == 2) {
  391. if (state == this.nextState) {
  392. stack[1]--;
  393. if (!stack[1] || stack[1] < 0) {
  394. stack.shift();
  395. stack.shift();
  396. }
  397. }
  398. }
  399. return [{
  400. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  401. value: val.slice(0, offset)
  402. }, {
  403. type: "meta.tag.tag-name.xml",
  404. value: val.substr(offset)
  405. }];
  406. },
  407. regex : "</?" + tagRegex + "",
  408. next: "jsxAttributes",
  409. nextState: "jsx"
  410. };
  411. this.$rules.start.unshift(jsxTag);
  412. var jsxJsRule = {
  413. regex: "{",
  414. token: "paren.quasi.start",
  415. push: "start"
  416. };
  417. this.$rules.jsx = [
  418. jsxJsRule,
  419. jsxTag,
  420. {include : "reference"},
  421. {defaultToken: "string"}
  422. ];
  423. this.$rules.jsxAttributes = [{
  424. token : "meta.tag.punctuation.tag-close.xml",
  425. regex : "/?>",
  426. onMatch : function(value, currentState, stack) {
  427. if (currentState == stack[0])
  428. stack.shift();
  429. if (value.length == 2) {
  430. if (stack[0] == this.nextState)
  431. stack[1]--;
  432. if (!stack[1] || stack[1] < 0) {
  433. stack.splice(0, 2);
  434. }
  435. }
  436. this.next = stack[0] || "start";
  437. return [{type: this.token, value: value}];
  438. },
  439. nextState: "jsx"
  440. },
  441. jsxJsRule,
  442. comments("jsxAttributes"),
  443. {
  444. token : "entity.other.attribute-name.xml",
  445. regex : tagRegex
  446. }, {
  447. token : "keyword.operator.attribute-equals.xml",
  448. regex : "="
  449. }, {
  450. token : "text.tag-whitespace.xml",
  451. regex : "\\s+"
  452. }, {
  453. token : "string.attribute-value.xml",
  454. regex : "'",
  455. stateName : "jsx_attr_q",
  456. push : [
  457. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  458. {include : "reference"},
  459. {defaultToken : "string.attribute-value.xml"}
  460. ]
  461. }, {
  462. token : "string.attribute-value.xml",
  463. regex : '"',
  464. stateName : "jsx_attr_qq",
  465. push : [
  466. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  467. {include : "reference"},
  468. {defaultToken : "string.attribute-value.xml"}
  469. ]
  470. },
  471. jsxTag
  472. ];
  473. this.$rules.reference = [{
  474. token : "constant.language.escape.reference.xml",
  475. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  476. }];
  477. }
  478. function comments(next) {
  479. return [
  480. {
  481. token : "comment", // multi line comment
  482. regex : /\/\*/,
  483. next: [
  484. DocCommentHighlightRules.getTagRule(),
  485. {token : "comment", regex : "\\*\\/", next : next || "pop"},
  486. {defaultToken : "comment", caseInsensitive: true}
  487. ]
  488. }, {
  489. token : "comment",
  490. regex : "\\/\\/",
  491. next: [
  492. DocCommentHighlightRules.getTagRule(),
  493. {token : "comment", regex : "$|^", next : next || "pop"},
  494. {defaultToken : "comment", caseInsensitive: true}
  495. ]
  496. }
  497. ];
  498. }
  499. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  500. });
  501. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(acequire, exports, module) {
  502. "use strict";
  503. var Range = acequire("../range").Range;
  504. var MatchingBraceOutdent = function() {};
  505. (function() {
  506. this.checkOutdent = function(line, input) {
  507. if (! /^\s+$/.test(line))
  508. return false;
  509. return /^\s*\}/.test(input);
  510. };
  511. this.autoOutdent = function(doc, row) {
  512. var line = doc.getLine(row);
  513. var match = line.match(/^(\s*\})/);
  514. if (!match) return 0;
  515. var column = match[1].length;
  516. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  517. if (!openBracePos || openBracePos.row == row) return 0;
  518. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  519. doc.replace(new Range(row, 0, row, column-1), indent);
  520. };
  521. this.$getIndent = function(line) {
  522. return line.match(/^\s*/)[0];
  523. };
  524. }).call(MatchingBraceOutdent.prototype);
  525. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  526. });
  527. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
  528. "use strict";
  529. var oop = acequire("../../lib/oop");
  530. var Range = acequire("../../range").Range;
  531. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  532. var FoldMode = exports.FoldMode = function(commentRegex) {
  533. if (commentRegex) {
  534. this.foldingStartMarker = new RegExp(
  535. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  536. );
  537. this.foldingStopMarker = new RegExp(
  538. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  539. );
  540. }
  541. };
  542. oop.inherits(FoldMode, BaseFoldMode);
  543. (function() {
  544. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  545. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  546. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  547. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  548. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  549. this._getFoldWidgetBase = this.getFoldWidget;
  550. this.getFoldWidget = function(session, foldStyle, row) {
  551. var line = session.getLine(row);
  552. if (this.singleLineBlockCommentRe.test(line)) {
  553. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  554. return "";
  555. }
  556. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  557. if (!fw && this.startRegionRe.test(line))
  558. return "start"; // lineCommentRegionStart
  559. return fw;
  560. };
  561. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  562. var line = session.getLine(row);
  563. if (this.startRegionRe.test(line))
  564. return this.getCommentRegionBlock(session, line, row);
  565. var match = line.match(this.foldingStartMarker);
  566. if (match) {
  567. var i = match.index;
  568. if (match[1])
  569. return this.openingBracketBlock(session, match[1], row, i);
  570. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  571. if (range && !range.isMultiLine()) {
  572. if (forceMultiline) {
  573. range = this.getSectionRange(session, row);
  574. } else if (foldStyle != "all")
  575. range = null;
  576. }
  577. return range;
  578. }
  579. if (foldStyle === "markbegin")
  580. return;
  581. var match = line.match(this.foldingStopMarker);
  582. if (match) {
  583. var i = match.index + match[0].length;
  584. if (match[1])
  585. return this.closingBracketBlock(session, match[1], row, i);
  586. return session.getCommentFoldRange(row, i, -1);
  587. }
  588. };
  589. this.getSectionRange = function(session, row) {
  590. var line = session.getLine(row);
  591. var startIndent = line.search(/\S/);
  592. var startRow = row;
  593. var startColumn = line.length;
  594. row = row + 1;
  595. var endRow = row;
  596. var maxRow = session.getLength();
  597. while (++row < maxRow) {
  598. line = session.getLine(row);
  599. var indent = line.search(/\S/);
  600. if (indent === -1)
  601. continue;
  602. if (startIndent > indent)
  603. break;
  604. var subRange = this.getFoldWidgetRange(session, "all", row);
  605. if (subRange) {
  606. if (subRange.start.row <= startRow) {
  607. break;
  608. } else if (subRange.isMultiLine()) {
  609. row = subRange.end.row;
  610. } else if (startIndent == indent) {
  611. break;
  612. }
  613. }
  614. endRow = row;
  615. }
  616. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  617. };
  618. this.getCommentRegionBlock = function(session, line, row) {
  619. var startColumn = line.search(/\s*$/);
  620. var maxRow = session.getLength();
  621. var startRow = row;
  622. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  623. var depth = 1;
  624. while (++row < maxRow) {
  625. line = session.getLine(row);
  626. var m = re.exec(line);
  627. if (!m) continue;
  628. if (m[1]) depth--;
  629. else depth++;
  630. if (!depth) break;
  631. }
  632. var endRow = row;
  633. if (endRow > startRow) {
  634. return new Range(startRow, startColumn, endRow, line.length);
  635. }
  636. };
  637. }).call(FoldMode.prototype);
  638. });
  639. ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(acequire, exports, module) {
  640. "use strict";
  641. var oop = acequire("../lib/oop");
  642. var TextMode = acequire("./text").Mode;
  643. var JavaScriptHighlightRules = acequire("./javascript_highlight_rules").JavaScriptHighlightRules;
  644. var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
  645. var WorkerClient = acequire("../worker/worker_client").WorkerClient;
  646. var CstyleBehaviour = acequire("./behaviour/cstyle").CstyleBehaviour;
  647. var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
  648. var Mode = function() {
  649. this.HighlightRules = JavaScriptHighlightRules;
  650. this.$outdent = new MatchingBraceOutdent();
  651. this.$behaviour = new CstyleBehaviour();
  652. this.foldingRules = new CStyleFoldMode();
  653. };
  654. oop.inherits(Mode, TextMode);
  655. (function() {
  656. this.lineCommentStart = "//";
  657. this.blockComment = {start: "/*", end: "*/"};
  658. this.$quotes = {'"': '"', "'": "'", "`": "`"};
  659. this.getNextLineIndent = function(state, line, tab) {
  660. var indent = this.$getIndent(line);
  661. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  662. var tokens = tokenizedLine.tokens;
  663. var endState = tokenizedLine.state;
  664. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  665. return indent;
  666. }
  667. if (state == "start" || state == "no_regex") {
  668. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  669. if (match) {
  670. indent += tab;
  671. }
  672. } else if (state == "doc-start") {
  673. if (endState == "start" || endState == "no_regex") {
  674. return "";
  675. }
  676. var match = line.match(/^\s*(\/?)\*/);
  677. if (match) {
  678. if (match[1]) {
  679. indent += " ";
  680. }
  681. indent += "* ";
  682. }
  683. }
  684. return indent;
  685. };
  686. this.checkOutdent = function(state, line, input) {
  687. return this.$outdent.checkOutdent(line, input);
  688. };
  689. this.autoOutdent = function(state, doc, row) {
  690. this.$outdent.autoOutdent(doc, row);
  691. };
  692. this.createWorker = function(session) {
  693. var worker = new WorkerClient(["ace"], require("../worker/javascript"), "JavaScriptWorker");
  694. worker.attachToDocument(session.getDocument());
  695. worker.on("annotate", function(results) {
  696. session.setAnnotations(results.data);
  697. });
  698. worker.on("terminate", function() {
  699. session.clearAnnotations();
  700. });
  701. return worker;
  702. };
  703. this.$id = "ace/mode/javascript";
  704. }).call(Mode.prototype);
  705. exports.Mode = Mode;
  706. });
  707. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  708. "use strict";
  709. var oop = acequire("../lib/oop");
  710. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  711. var XmlHighlightRules = function(normalize) {
  712. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  713. this.$rules = {
  714. start : [
  715. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  716. {
  717. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  718. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  719. },
  720. {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
  721. {
  722. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  723. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  724. },
  725. {include : "tag"},
  726. {token : "text.end-tag-open.xml", regex: "</"},
  727. {token : "text.tag-open.xml", regex: "<"},
  728. {include : "reference"},
  729. {defaultToken : "text.xml"}
  730. ],
  731. processing_instruction : [{
  732. token : "entity.other.attribute-name.decl-attribute-name.xml",
  733. regex : tagRegex
  734. }, {
  735. token : "keyword.operator.decl-attribute-equals.xml",
  736. regex : "="
  737. }, {
  738. include: "whitespace"
  739. }, {
  740. include: "string"
  741. }, {
  742. token : "punctuation.xml-decl.xml",
  743. regex : "\\?>",
  744. next : "start"
  745. }],
  746. doctype : [
  747. {include : "whitespace"},
  748. {include : "string"},
  749. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  750. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  751. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  752. ],
  753. int_subset : [{
  754. token : "text.xml",
  755. regex : "\\s+"
  756. }, {
  757. token: "punctuation.int-subset.xml",
  758. regex: "]",
  759. next: "pop"
  760. }, {
  761. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  762. regex : "(<\\!)(" + tagRegex + ")",
  763. push : [{
  764. token : "text",
  765. regex : "\\s+"
  766. },
  767. {
  768. token : "punctuation.markup-decl.xml",
  769. regex : ">",
  770. next : "pop"
  771. },
  772. {include : "string"}]
  773. }],
  774. cdata : [
  775. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  776. {token : "text.xml", regex : "\\s+"},
  777. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  778. ],
  779. comment : [
  780. {token : "comment.end.xml", regex : "-->", next : "start"},
  781. {defaultToken : "comment.xml"}
  782. ],
  783. reference : [{
  784. token : "constant.language.escape.reference.xml",
  785. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  786. }],
  787. attr_reference : [{
  788. token : "constant.language.escape.reference.attribute-value.xml",
  789. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  790. }],
  791. tag : [{
  792. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  793. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  794. next: [
  795. {include : "attributes"},
  796. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  797. ]
  798. }],
  799. tag_whitespace : [
  800. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  801. ],
  802. whitespace : [
  803. {token : "text.whitespace.xml", regex : "\\s+"}
  804. ],
  805. string: [{
  806. token : "string.xml",
  807. regex : "'",
  808. push : [
  809. {token : "string.xml", regex: "'", next: "pop"},
  810. {defaultToken : "string.xml"}
  811. ]
  812. }, {
  813. token : "string.xml",
  814. regex : '"',
  815. push : [
  816. {token : "string.xml", regex: '"', next: "pop"},
  817. {defaultToken : "string.xml"}
  818. ]
  819. }],
  820. attributes: [{
  821. token : "entity.other.attribute-name.xml",
  822. regex : tagRegex
  823. }, {
  824. token : "keyword.operator.attribute-equals.xml",
  825. regex : "="
  826. }, {
  827. include: "tag_whitespace"
  828. }, {
  829. include: "attribute_value"
  830. }],
  831. attribute_value: [{
  832. token : "string.attribute-value.xml",
  833. regex : "'",
  834. push : [
  835. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  836. {include : "attr_reference"},
  837. {defaultToken : "string.attribute-value.xml"}
  838. ]
  839. }, {
  840. token : "string.attribute-value.xml",
  841. regex : '"',
  842. push : [
  843. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  844. {include : "attr_reference"},
  845. {defaultToken : "string.attribute-value.xml"}
  846. ]
  847. }]
  848. };
  849. if (this.constructor === XmlHighlightRules)
  850. this.normalizeRules();
  851. };
  852. (function() {
  853. this.embedTagRules = function(HighlightRules, prefix, tag){
  854. this.$rules.tag.unshift({
  855. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  856. regex : "(<)(" + tag + "(?=\\s|>|$))",
  857. next: [
  858. {include : "attributes"},
  859. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  860. ]
  861. });
  862. this.$rules[tag + "-end"] = [
  863. {include : "attributes"},
  864. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  865. onMatch : function(value, currentState, stack) {
  866. stack.splice(0);
  867. return this.token;
  868. }}
  869. ];
  870. this.embedRules(HighlightRules, prefix, [{
  871. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  872. regex : "(</)(" + tag + "(?=\\s|>|$))",
  873. next: tag + "-end"
  874. }, {
  875. token: "string.cdata.xml",
  876. regex : "<\\!\\[CDATA\\["
  877. }, {
  878. token: "string.cdata.xml",
  879. regex : "\\]\\]>"
  880. }]);
  881. };
  882. }).call(TextHighlightRules.prototype);
  883. oop.inherits(XmlHighlightRules, TextHighlightRules);
  884. exports.XmlHighlightRules = XmlHighlightRules;
  885. });
  886. ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(acequire, exports, module) {
  887. "use strict";
  888. var oop = acequire("../../lib/oop");
  889. var Behaviour = acequire("../behaviour").Behaviour;
  890. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  891. var lang = acequire("../../lib/lang");
  892. function is(token, type) {
  893. return token.type.lastIndexOf(type + ".xml") > -1;
  894. }
  895. var XmlBehaviour = function () {
  896. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  897. if (text == '"' || text == "'") {
  898. var quote = text;
  899. var selected = session.doc.getTextRange(editor.getSelectionRange());
  900. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  901. return {
  902. text: quote + selected + quote,
  903. selection: false
  904. };
  905. }
  906. var cursor = editor.getCursorPosition();
  907. var line = session.doc.getLine(cursor.row);
  908. var rightChar = line.substring(cursor.column, cursor.column + 1);
  909. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  910. var token = iterator.getCurrentToken();
  911. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  912. return {
  913. text: "",
  914. selection: [1, 1]
  915. };
  916. }
  917. if (!token)
  918. token = iterator.stepBackward();
  919. if (!token)
  920. return;
  921. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  922. token = iterator.stepBackward();
  923. }
  924. var rightSpace = !rightChar || rightChar.match(/\s/);
  925. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  926. return {
  927. text: quote + quote,
  928. selection: [1, 1]
  929. };
  930. }
  931. }
  932. });
  933. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  934. var selected = session.doc.getTextRange(range);
  935. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  936. var line = session.doc.getLine(range.start.row);
  937. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  938. if (rightChar == selected) {
  939. range.end.column++;
  940. return range;
  941. }
  942. }
  943. });
  944. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  945. if (text == '>') {
  946. var position = editor.getSelectionRange().start;
  947. var iterator = new TokenIterator(session, position.row, position.column);
  948. var token = iterator.getCurrentToken() || iterator.stepBackward();
  949. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  950. return;
  951. if (is(token, "reference.attribute-value"))
  952. return;
  953. if (is(token, "attribute-value")) {
  954. var firstChar = token.value.charAt(0);
  955. if (firstChar == '"' || firstChar == "'") {
  956. var lastChar = token.value.charAt(token.value.length - 1);
  957. var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length;
  958. if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar)
  959. return;
  960. }
  961. }
  962. while (!is(token, "tag-name")) {
  963. token = iterator.stepBackward();
  964. if (token.value == "<") {
  965. token = iterator.stepForward();
  966. break;
  967. }
  968. }
  969. var tokenRow = iterator.getCurrentTokenRow();
  970. var tokenColumn = iterator.getCurrentTokenColumn();
  971. if (is(iterator.stepBackward(), "end-tag-open"))
  972. return;
  973. var element = token.value;
  974. if (tokenRow == position.row)
  975. element = element.substring(0, position.column - tokenColumn);
  976. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  977. return;
  978. return {
  979. text: ">" + "</" + element + ">",
  980. selection: [1, 1]
  981. };
  982. }
  983. });
  984. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  985. if (text == "\n") {
  986. var cursor = editor.getCursorPosition();
  987. var line = session.getLine(cursor.row);
  988. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  989. var token = iterator.getCurrentToken();
  990. if (token && token.type.indexOf("tag-close") !== -1) {
  991. if (token.value == "/>")
  992. return;
  993. while (token && token.type.indexOf("tag-name") === -1) {
  994. token = iterator.stepBackward();
  995. }
  996. if (!token) {
  997. return;
  998. }
  999. var tag = token.value;
  1000. var row = iterator.getCurrentTokenRow();
  1001. token = iterator.stepBackward();
  1002. if (!token || token.type.indexOf("end-tag") !== -1) {
  1003. return;
  1004. }
  1005. if (this.voidElements && !this.voidElements[tag]) {
  1006. var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
  1007. var line = session.getLine(row);
  1008. var nextIndent = this.$getIndent(line);
  1009. var indent = nextIndent + session.getTabString();
  1010. if (nextToken && nextToken.value === "</") {
  1011. return {
  1012. text: "\n" + indent + "\n" + nextIndent,
  1013. selection: [1, indent.length, 1, indent.length]
  1014. };
  1015. } else {
  1016. return {
  1017. text: "\n" + indent
  1018. };
  1019. }
  1020. }
  1021. }
  1022. }
  1023. });
  1024. };
  1025. oop.inherits(XmlBehaviour, Behaviour);
  1026. exports.XmlBehaviour = XmlBehaviour;
  1027. });
  1028. ace.define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/range","ace/mode/folding/fold_mode","ace/token_iterator"], function(acequire, exports, module) {
  1029. "use strict";
  1030. var oop = acequire("../../lib/oop");
  1031. var lang = acequire("../../lib/lang");
  1032. var Range = acequire("../../range").Range;
  1033. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  1034. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  1035. var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
  1036. BaseFoldMode.call(this);
  1037. this.voidElements = voidElements || {};
  1038. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1039. if (optionalEndTags)
  1040. oop.mixin(this.optionalEndTags, optionalEndTags);
  1041. };
  1042. oop.inherits(FoldMode, BaseFoldMode);
  1043. var Tag = function() {
  1044. this.tagName = "";
  1045. this.closing = false;
  1046. this.selfClosing = false;
  1047. this.start = {row: 0, column: 0};
  1048. this.end = {row: 0, column: 0};
  1049. };
  1050. function is(token, type) {
  1051. return token.type.lastIndexOf(type + ".xml") > -1;
  1052. }
  1053. (function() {
  1054. this.getFoldWidget = function(session, foldStyle, row) {
  1055. var tag = this._getFirstTagInLine(session, row);
  1056. if (!tag)
  1057. return this.getCommentFoldWidget(session, row);
  1058. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1059. return foldStyle == "markbeginend" ? "end" : "";
  1060. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1061. return "";
  1062. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1063. return "";
  1064. return "start";
  1065. };
  1066. this.getCommentFoldWidget = function(session, row) {
  1067. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  1068. return "start";
  1069. return "";
  1070. };
  1071. this._getFirstTagInLine = function(session, row) {
  1072. var tokens = session.getTokens(row);
  1073. var tag = new Tag();
  1074. for (var i = 0; i < tokens.length; i++) {
  1075. var token = tokens[i];
  1076. if (is(token, "tag-open")) {
  1077. tag.end.column = tag.start.column + token.value.length;
  1078. tag.closing = is(token, "end-tag-open");
  1079. token = tokens[++i];
  1080. if (!token)
  1081. return null;
  1082. tag.tagName = token.value;
  1083. tag.end.column += token.value.length;
  1084. for (i++; i < tokens.length; i++) {
  1085. token = tokens[i];
  1086. tag.end.column += token.value.length;
  1087. if (is(token, "tag-close")) {
  1088. tag.selfClosing = token.value == '/>';
  1089. break;
  1090. }
  1091. }
  1092. return tag;
  1093. } else if (is(token, "tag-close")) {
  1094. tag.selfClosing = token.value == '/>';
  1095. return tag;
  1096. }
  1097. tag.start.column += token.value.length;
  1098. }
  1099. return null;
  1100. };
  1101. this._findEndTagInLine = function(session, row, tagName, startColumn) {
  1102. var tokens = session.getTokens(row);
  1103. var column = 0;
  1104. for (var i = 0; i < tokens.length; i++) {
  1105. var token = tokens[i];
  1106. column += token.value.length;
  1107. if (column < startColumn)
  1108. continue;
  1109. if (is(token, "end-tag-open")) {
  1110. token = tokens[i + 1];
  1111. if (token && token.value == tagName)
  1112. return true;
  1113. }
  1114. }
  1115. return false;
  1116. };
  1117. this._readTagForward = function(iterator) {
  1118. var token = iterator.getCurrentToken();
  1119. if (!token)
  1120. return null;
  1121. var tag = new Tag();
  1122. do {
  1123. if (is(token, "tag-open")) {
  1124. tag.closing = is(token, "end-tag-open");
  1125. tag.start.row = iterator.getCurrentTokenRow();
  1126. tag.start.column = iterator.getCurrentTokenColumn();
  1127. } else if (is(token, "tag-name")) {
  1128. tag.tagName = token.value;
  1129. } else if (is(token, "tag-close")) {
  1130. tag.selfClosing = token.value == "/>";
  1131. tag.end.row = iterator.getCurrentTokenRow();
  1132. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1133. iterator.stepForward();
  1134. return tag;
  1135. }
  1136. } while(token = iterator.stepForward());
  1137. return null;
  1138. };
  1139. this._readTagBackward = function(iterator) {
  1140. var token = iterator.getCurrentToken();
  1141. if (!token)
  1142. return null;
  1143. var tag = new Tag();
  1144. do {
  1145. if (is(token, "tag-open")) {
  1146. tag.closing = is(token, "end-tag-open");
  1147. tag.start.row = iterator.getCurrentTokenRow();
  1148. tag.start.column = iterator.getCurrentTokenColumn();
  1149. iterator.stepBackward();
  1150. return tag;
  1151. } else if (is(token, "tag-name")) {
  1152. tag.tagName = token.value;
  1153. } else if (is(token, "tag-close")) {
  1154. tag.selfClosing = token.value == "/>";
  1155. tag.end.row = iterator.getCurrentTokenRow();
  1156. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1157. }
  1158. } while(token = iterator.stepBackward());
  1159. return null;
  1160. };
  1161. this._pop = function(stack, tag) {
  1162. while (stack.length) {
  1163. var top = stack[stack.length-1];
  1164. if (!tag || top.tagName == tag.tagName) {
  1165. return stack.pop();
  1166. }
  1167. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  1168. stack.pop();
  1169. continue;
  1170. } else {
  1171. return null;
  1172. }
  1173. }
  1174. };
  1175. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1176. var firstTag = this._getFirstTagInLine(session, row);
  1177. if (!firstTag) {
  1178. return this.getCommentFoldWidget(session, row)
  1179. && session.getCommentFoldRange(row, session.getLine(row).length);
  1180. }
  1181. var isBackward = firstTag.closing || firstTag.selfClosing;
  1182. var stack = [];
  1183. var tag;
  1184. if (!isBackward) {
  1185. var iterator = new TokenIterator(session, row, firstTag.start.column);
  1186. var start = {
  1187. row: row,
  1188. column: firstTag.start.column + firstTag.tagName.length + 2
  1189. };
  1190. if (firstTag.start.row == firstTag.end.row)
  1191. start.column = firstTag.end.column;
  1192. while (tag = this._readTagForward(iterator)) {
  1193. if (tag.selfClosing) {
  1194. if (!stack.length) {
  1195. tag.start.column += tag.tagName.length + 2;
  1196. tag.end.column -= 2;
  1197. return Range.fromPoints(tag.start, tag.end);
  1198. } else
  1199. continue;
  1200. }
  1201. if (tag.closing) {
  1202. this._pop(stack, tag);
  1203. if (stack.length == 0)
  1204. return Range.fromPoints(start, tag.start);
  1205. }
  1206. else {
  1207. stack.push(tag);
  1208. }
  1209. }
  1210. }
  1211. else {
  1212. var iterator = new TokenIterator(session, row, firstTag.end.column);
  1213. var end = {
  1214. row: row,
  1215. column: firstTag.start.column
  1216. };
  1217. while (tag = this._readTagBackward(iterator)) {
  1218. if (tag.selfClosing) {
  1219. if (!stack.length) {
  1220. tag.start.column += tag.tagName.length + 2;
  1221. tag.end.column -= 2;
  1222. return Range.fromPoints(tag.start, tag.end);
  1223. } else
  1224. continue;
  1225. }
  1226. if (!tag.closing) {
  1227. this._pop(stack, tag);
  1228. if (stack.length == 0) {
  1229. tag.start.column += tag.tagName.length + 2;
  1230. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  1231. tag.start.column = tag.end.column;
  1232. return Range.fromPoints(tag.start, end);
  1233. }
  1234. }
  1235. else {
  1236. stack.push(tag);
  1237. }
  1238. }
  1239. }
  1240. };
  1241. }).call(FoldMode.prototype);
  1242. });
  1243. ace.define("ace/mode/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/xml_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/xml","ace/worker/worker_client"], function(acequire, exports, module) {
  1244. "use strict";
  1245. var oop = acequire("../lib/oop");
  1246. var lang = acequire("../lib/lang");
  1247. var TextMode = acequire("./text").Mode;
  1248. var XmlHighlightRules = acequire("./xml_highlight_rules").XmlHighlightRules;
  1249. var XmlBehaviour = acequire("./behaviour/xml").XmlBehaviour;
  1250. var XmlFoldMode = acequire("./folding/xml").FoldMode;
  1251. var WorkerClient = acequire("../worker/worker_client").WorkerClient;
  1252. var Mode = function() {
  1253. this.HighlightRules = XmlHighlightRules;
  1254. this.$behaviour = new XmlBehaviour();
  1255. this.foldingRules = new XmlFoldMode();
  1256. };
  1257. oop.inherits(Mode, TextMode);
  1258. (function() {
  1259. this.voidElements = lang.arrayToMap([]);
  1260. this.blockComment = {start: "<!--", end: "-->"};
  1261. this.createWorker = function(session) {
  1262. var worker = new WorkerClient(["ace"], require("../worker/xml"), "Worker");
  1263. worker.attachToDocument(session.getDocument());
  1264. worker.on("error", function(e) {
  1265. session.setAnnotations(e.data);
  1266. });
  1267. worker.on("terminate", function() {
  1268. session.clearAnnotations();
  1269. });
  1270. return worker;
  1271. };
  1272. this.$id = "ace/mode/xml";
  1273. }).call(Mode.prototype);
  1274. exports.Mode = Mode;
  1275. });
  1276. ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
  1277. "use strict";
  1278. var oop = acequire("../lib/oop");
  1279. var lang = acequire("../lib/lang");
  1280. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  1281. var supportType = exports.supportType = "align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|min-height|min-width|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index";
  1282. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  1283. var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
  1284. var supportConstantColor = exports.supportConstantColor = "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen";
  1285. var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
  1286. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  1287. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  1288. var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|acequired|root|target|valid|visited)\\b";
  1289. var CssHighlightRules = function() {
  1290. var keywordMapper = this.createKeywordMapper({
  1291. "support.function": supportFunction,
  1292. "support.constant": supportConstant,
  1293. "support.type": supportType,
  1294. "support.constant.color": supportConstantColor,
  1295. "support.constant.fonts": supportConstantFonts
  1296. }, "text", true);
  1297. this.$rules = {
  1298. "start" : [{
  1299. include : ["strings", "url", "comments"]
  1300. }, {
  1301. token: "paren.lparen",
  1302. regex: "\\{",
  1303. next: "ruleset"
  1304. }, {
  1305. token: "paren.rparen",
  1306. regex: "\\}"
  1307. }, {
  1308. token: "string",
  1309. regex: "@",
  1310. next: "media"
  1311. }, {
  1312. token: "keyword",
  1313. regex: "#[a-z0-9-_]+"
  1314. }, {
  1315. token: "keyword",
  1316. regex: "%"
  1317. }, {
  1318. token: "variable",
  1319. regex: "\\.[a-z0-9-_]+"
  1320. }, {
  1321. token: "string",
  1322. regex: ":[a-z0-9-_]+"
  1323. }, {
  1324. token : "constant.numeric",
  1325. regex : numRe
  1326. }, {
  1327. token: "constant",
  1328. regex: "[a-z0-9-_]+"
  1329. }, {
  1330. caseInsensitive: true
  1331. }],
  1332. "media": [{
  1333. include : ["strings", "url", "comments"]
  1334. }, {
  1335. token: "paren.lparen",
  1336. regex: "\\{",
  1337. next: "start"
  1338. }, {
  1339. token: "paren.rparen",
  1340. regex: "\\}",
  1341. next: "start"
  1342. }, {
  1343. token: "string",
  1344. regex: ";",
  1345. next: "start"
  1346. }, {
  1347. token: "keyword",
  1348. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  1349. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  1350. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  1351. }],
  1352. "comments" : [{
  1353. token: "comment", // multi line comment
  1354. regex: "\\/\\*",
  1355. push: [{
  1356. token : "comment",
  1357. regex : "\\*\\/",
  1358. next : "pop"
  1359. }, {
  1360. defaultToken : "comment"
  1361. }]
  1362. }],
  1363. "ruleset" : [{
  1364. regex : "-(webkit|ms|moz|o)-",
  1365. token : "text"
  1366. }, {
  1367. token : "paren.rparen",
  1368. regex : "\\}",
  1369. next : "start"
  1370. }, {
  1371. include : ["strings", "url", "comments"]
  1372. }, {
  1373. token : ["constant.numeric", "keyword"],
  1374. regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
  1375. }, {
  1376. token : "constant.numeric",
  1377. regex : numRe
  1378. }, {
  1379. token : "constant.numeric", // hex6 color
  1380. regex : "#[a-f0-9]{6}"
  1381. }, {
  1382. token : "constant.numeric", // hex3 color
  1383. regex : "#[a-f0-9]{3}"
  1384. }, {
  1385. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  1386. regex : pseudoElements
  1387. }, {
  1388. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  1389. regex : pseudoClasses
  1390. }, {
  1391. include: "url"
  1392. }, {
  1393. token : keywordMapper,
  1394. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  1395. }, {
  1396. caseInsensitive: true
  1397. }],
  1398. url: [{
  1399. token : "support.function",
  1400. regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
  1401. push: [{
  1402. token : "support.function",
  1403. regex : "\\)",
  1404. next : "pop"
  1405. }, {
  1406. defaultToken: "string"
  1407. }]
  1408. }],
  1409. strings: [{
  1410. token : "string.start",
  1411. regex : "'",
  1412. push : [{
  1413. token : "string.end",
  1414. regex : "'|$",
  1415. next: "pop"
  1416. }, {
  1417. include : "escapes"
  1418. }, {
  1419. token : "constant.language.escape",
  1420. regex : /\\$/,
  1421. consumeLineEnd: true
  1422. }, {
  1423. defaultToken: "string"
  1424. }]
  1425. }, {
  1426. token : "string.start",
  1427. regex : '"',
  1428. push : [{
  1429. token : "string.end",
  1430. regex : '"|$',
  1431. next: "pop"
  1432. }, {
  1433. include : "escapes"
  1434. }, {
  1435. token : "constant.language.escape",
  1436. regex : /\\$/,
  1437. consumeLineEnd: true
  1438. }, {
  1439. defaultToken: "string"
  1440. }]
  1441. }],
  1442. escapes: [{
  1443. token : "constant.language.escape",
  1444. regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  1445. }]
  1446. };
  1447. this.normalizeRules();
  1448. };
  1449. oop.inherits(CssHighlightRules, TextHighlightRules);
  1450. exports.CssHighlightRules = CssHighlightRules;
  1451. });
  1452. ace.define("ace/mode/css_completions",["require","exports","module"], function(acequire, exports, module) {
  1453. "use strict";
  1454. var propertyMap = {
  1455. "background": {"#$0": 1},
  1456. "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
  1457. "background-image": {"url('/$0')": 1},
  1458. "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
  1459. "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
  1460. "background-attachment": {"scroll": 1, "fixed": 1},
  1461. "background-size": {"cover": 1, "contain": 1},
  1462. "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1463. "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1464. "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
  1465. "border-color": {"#$0": 1},
  1466. "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
  1467. "border-collapse": {"collapse": 1, "separate": 1},
  1468. "bottom": {"px": 1, "em": 1, "%": 1},
  1469. "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
  1470. "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
  1471. "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},
  1472. "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
  1473. "empty-cells": {"show": 1, "hide": 1},
  1474. "float": {"left": 1, "right": 1, "none": 1},
  1475. "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},
  1476. "font-size": {"px": 1, "em": 1, "%": 1},
  1477. "font-weight": {"bold": 1, "normal": 1},
  1478. "font-style": {"italic": 1, "normal": 1},
  1479. "font-variant": {"normal": 1, "small-caps": 1},
  1480. "height": {"px": 1, "em": 1, "%": 1},
  1481. "left": {"px": 1, "em": 1, "%": 1},
  1482. "letter-spacing": {"normal": 1},
  1483. "line-height": {"normal": 1},
  1484. "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},
  1485. "margin": {"px": 1, "em": 1, "%": 1},
  1486. "margin-right": {"px": 1, "em": 1, "%": 1},
  1487. "margin-left": {"px": 1, "em": 1, "%": 1},
  1488. "margin-top": {"px": 1, "em": 1, "%": 1},
  1489. "margin-bottom": {"px": 1, "em": 1, "%": 1},
  1490. "max-height": {"px": 1, "em": 1, "%": 1},
  1491. "max-width": {"px": 1, "em": 1, "%": 1},
  1492. "min-height": {"px": 1, "em": 1, "%": 1},
  1493. "min-width": {"px": 1, "em": 1, "%": 1},
  1494. "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1495. "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1496. "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1497. "padding": {"px": 1, "em": 1, "%": 1},
  1498. "padding-top": {"px": 1, "em": 1, "%": 1},
  1499. "padding-right": {"px": 1, "em": 1, "%": 1},
  1500. "padding-bottom": {"px": 1, "em": 1, "%": 1},
  1501. "padding-left": {"px": 1, "em": 1, "%": 1},
  1502. "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1503. "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1504. "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
  1505. "right": {"px": 1, "em": 1, "%": 1},
  1506. "table-layout": {"fixed": 1, "auto": 1},
  1507. "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
  1508. "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
  1509. "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
  1510. "top": {"px": 1, "em": 1, "%": 1},
  1511. "vertical-align": {"top": 1, "bottom": 1},
  1512. "visibility": {"hidden": 1, "visible": 1},
  1513. "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
  1514. "width": {"px": 1, "em": 1, "%": 1},
  1515. "word-spacing": {"normal": 1},
  1516. "filter": {"alpha(opacity=$0100)": 1},
  1517. "text-shadow": {"$02px 2px 2px #777": 1},
  1518. "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
  1519. "-moz-border-radius": 1,
  1520. "-moz-border-radius-topright": 1,
  1521. "-moz-border-radius-bottomright": 1,
  1522. "-moz-border-radius-topleft": 1,
  1523. "-moz-border-radius-bottomleft": 1,
  1524. "-webkit-border-radius": 1,
  1525. "-webkit-border-top-right-radius": 1,
  1526. "-webkit-border-top-left-radius": 1,
  1527. "-webkit-border-bottom-right-radius": 1,
  1528. "-webkit-border-bottom-left-radius": 1,
  1529. "-moz-box-shadow": 1,
  1530. "-webkit-box-shadow": 1,
  1531. "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1532. "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1533. "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
  1534. };
  1535. var CssCompletions = function() {
  1536. };
  1537. (function() {
  1538. this.completionsDefined = false;
  1539. this.defineCompletions = function() {
  1540. if (document) {
  1541. var style = document.createElement('c').style;
  1542. for (var i in style) {
  1543. if (typeof style[i] !== 'string')
  1544. continue;
  1545. var name = i.replace(/[A-Z]/g, function(x) {
  1546. return '-' + x.toLowerCase();
  1547. });
  1548. if (!propertyMap.hasOwnProperty(name))
  1549. propertyMap[name] = 1;
  1550. }
  1551. }
  1552. this.completionsDefined = true;
  1553. };
  1554. this.getCompletions = function(state, session, pos, prefix) {
  1555. if (!this.completionsDefined) {
  1556. this.defineCompletions();
  1557. }
  1558. var token = session.getTokenAt(pos.row, pos.column);
  1559. if (!token)
  1560. return [];
  1561. if (state==='ruleset'){
  1562. var line = session.getLine(pos.row).substr(0, pos.column);
  1563. if (/:[^;]+$/.test(line)) {
  1564. /([\w\-]+):[^:]*$/.test(line);
  1565. return this.getPropertyValueCompletions(state, session, pos, prefix);
  1566. } else {
  1567. return this.getPropertyCompletions(state, session, pos, prefix);
  1568. }
  1569. }
  1570. return [];
  1571. };
  1572. this.getPropertyCompletions = function(state, session, pos, prefix) {
  1573. var properties = Object.keys(propertyMap);
  1574. return properties.map(function(property){
  1575. return {
  1576. caption: property,
  1577. snippet: property + ': $0;',
  1578. meta: "property",
  1579. score: Number.MAX_VALUE
  1580. };
  1581. });
  1582. };
  1583. this.getPropertyValueCompletions = function(state, session, pos, prefix) {
  1584. var line = session.getLine(pos.row).substr(0, pos.column);
  1585. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1586. if (!property)
  1587. return [];
  1588. var values = [];
  1589. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1590. values = Object.keys(propertyMap[property]);
  1591. }
  1592. return values.map(function(value){
  1593. return {
  1594. caption: value,
  1595. snippet: value,
  1596. meta: "property value",
  1597. score: Number.MAX_VALUE
  1598. };
  1599. });
  1600. };
  1601. }).call(CssCompletions.prototype);
  1602. exports.CssCompletions = CssCompletions;
  1603. });
  1604. ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(acequire, exports, module) {
  1605. "use strict";
  1606. var oop = acequire("../../lib/oop");
  1607. var Behaviour = acequire("../behaviour").Behaviour;
  1608. var CstyleBehaviour = acequire("./cstyle").CstyleBehaviour;
  1609. var TokenIterator = acequire("../../token_iterator").TokenIterator;
  1610. var CssBehaviour = function () {
  1611. this.inherit(CstyleBehaviour);
  1612. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1613. if (text === ':') {
  1614. var cursor = editor.getCursorPosition();
  1615. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1616. var token = iterator.getCurrentToken();
  1617. if (token && token.value.match(/\s+/)) {
  1618. token = iterator.stepBackward();
  1619. }
  1620. if (token && token.type === 'support.type') {
  1621. var line = session.doc.getLine(cursor.row);
  1622. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1623. if (rightChar === ':') {
  1624. return {
  1625. text: '',
  1626. selection: [1, 1]
  1627. };
  1628. }
  1629. if (!line.substring(cursor.column).match(/^\s*;/)) {
  1630. return {
  1631. text: ':;',
  1632. selection: [1, 1]
  1633. };
  1634. }
  1635. }
  1636. }
  1637. });
  1638. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1639. var selected = session.doc.getTextRange(range);
  1640. if (!range.isMultiLine() && selected === ':') {
  1641. var cursor = editor.getCursorPosition();
  1642. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1643. var token = iterator.getCurrentToken();
  1644. if (token && token.value.match(/\s+/)) {
  1645. token = iterator.stepBackward();
  1646. }
  1647. if (token && token.type === 'support.type') {
  1648. var line = session.doc.getLine(range.start.row);
  1649. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1650. if (rightChar === ';') {
  1651. range.end.column ++;
  1652. return range;
  1653. }
  1654. }
  1655. }
  1656. });
  1657. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1658. if (text === ';') {
  1659. var cursor = editor.getCursorPosition();
  1660. var line = session.doc.getLine(cursor.row);
  1661. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1662. if (rightChar === ';') {
  1663. return {
  1664. text: '',
  1665. selection: [1, 1]
  1666. };
  1667. }
  1668. }
  1669. });
  1670. };
  1671. oop.inherits(CssBehaviour, CstyleBehaviour);
  1672. exports.CssBehaviour = CssBehaviour;
  1673. });
  1674. ace.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(acequire, exports, module) {
  1675. "use strict";
  1676. var oop = acequire("../lib/oop");
  1677. var TextMode = acequire("./text").Mode;
  1678. var CssHighlightRules = acequire("./css_highlight_rules").CssHighlightRules;
  1679. var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent;
  1680. var WorkerClient = acequire("../worker/worker_client").WorkerClient;
  1681. var CssCompletions = acequire("./css_completions").CssCompletions;
  1682. var CssBehaviour = acequire("./behaviour/css").CssBehaviour;
  1683. var CStyleFoldMode = acequire("./folding/cstyle").FoldMode;
  1684. var Mode = function() {
  1685. this.HighlightRules = CssHighlightRules;
  1686. this.$outdent = new MatchingBraceOutdent();
  1687. this.$behaviour = new CssBehaviour();
  1688. this.$completer = new CssCompletions();
  1689. this.foldingRules = new CStyleFoldMode();
  1690. };
  1691. oop.inherits(Mode, TextMode);
  1692. (function() {
  1693. this.foldingRules = "cStyle";
  1694. this.blockComment = {start: "/*", end: "*/"};
  1695. this.getNextLineIndent = function(state, line, tab) {
  1696. var indent = this.$getIndent(line);
  1697. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1698. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1699. return indent;
  1700. }
  1701. var match = line.match(/^.*\{\s*$/);
  1702. if (match) {
  1703. indent += tab;
  1704. }
  1705. return indent;
  1706. };
  1707. this.checkOutdent = function(state, line, input) {
  1708. return this.$outdent.checkOutdent(line, input);
  1709. };
  1710. this.autoOutdent = function(state, doc, row) {
  1711. this.$outdent.autoOutdent(doc, row);
  1712. };
  1713. this.getCompletions = function(state, session, pos, prefix) {
  1714. return this.$completer.getCompletions(state, session, pos, prefix);
  1715. };
  1716. this.createWorker = function(session) {
  1717. var worker = new WorkerClient(["ace"], require("../worker/css"), "Worker");
  1718. worker.attachToDocument(session.getDocument());
  1719. worker.on("annotate", function(e) {
  1720. session.setAnnotations(e.data);
  1721. });
  1722. worker.on("terminate", function() {
  1723. session.clearAnnotations();
  1724. });
  1725. return worker;
  1726. };
  1727. this.$id = "ace/mode/css";
  1728. }).call(Mode.prototype);
  1729. exports.Mode = Mode;
  1730. });
  1731. ace.define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(acequire, exports, module) {
  1732. "use strict";
  1733. var oop = acequire("../lib/oop");
  1734. var lang = acequire("../lib/lang");
  1735. var CssHighlightRules = acequire("./css_highlight_rules").CssHighlightRules;
  1736. var JavaScriptHighlightRules = acequire("./javascript_highlight_rules").JavaScriptHighlightRules;
  1737. var XmlHighlightRules = acequire("./xml_highlight_rules").XmlHighlightRules;
  1738. var tagMap = lang.createMap({
  1739. a : 'anchor',
  1740. button : 'form',
  1741. form : 'form',
  1742. img : 'image',
  1743. input : 'form',
  1744. label : 'form',
  1745. option : 'form',
  1746. script : 'script',
  1747. select : 'form',
  1748. textarea : 'form',
  1749. style : 'style',
  1750. table : 'table',
  1751. tbody : 'table',
  1752. td : 'table',
  1753. tfoot : 'table',
  1754. th : 'table',
  1755. tr : 'table'
  1756. });
  1757. var HtmlHighlightRules = function() {
  1758. XmlHighlightRules.call(this);
  1759. this.addRules({
  1760. attributes: [{
  1761. include : "tag_whitespace"
  1762. }, {
  1763. token : "entity.other.attribute-name.xml",
  1764. regex : "[-_a-zA-Z0-9:.]+"
  1765. }, {
  1766. token : "keyword.operator.attribute-equals.xml",
  1767. regex : "=",
  1768. push : [{
  1769. include: "tag_whitespace"
  1770. }, {
  1771. token : "string.unquoted.attribute-value.html",
  1772. regex : "[^<>='\"`\\s]+",
  1773. next : "pop"
  1774. }, {
  1775. token : "empty",
  1776. regex : "",
  1777. next : "pop"
  1778. }]
  1779. }, {
  1780. include : "attribute_value"
  1781. }],
  1782. tag: [{
  1783. token : function(start, tag) {
  1784. var group = tagMap[tag];
  1785. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  1786. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  1787. },
  1788. regex : "(</?)([-_a-zA-Z0-9:.]+)",
  1789. next: "tag_stuff"
  1790. }],
  1791. tag_stuff: [
  1792. {include : "attributes"},
  1793. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  1794. ]
  1795. });
  1796. this.embedTagRules(CssHighlightRules, "css-", "style");
  1797. this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
  1798. if (this.constructor === HtmlHighlightRules)
  1799. this.normalizeRules();
  1800. };
  1801. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  1802. exports.HtmlHighlightRules = HtmlHighlightRules;
  1803. });
  1804. ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(acequire, exports, module) {
  1805. "use strict";
  1806. var oop = acequire("../../lib/oop");
  1807. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  1808. var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
  1809. this.defaultMode = defaultMode;
  1810. this.subModes = subModes;
  1811. };
  1812. oop.inherits(FoldMode, BaseFoldMode);
  1813. (function() {
  1814. this.$getMode = function(state) {
  1815. if (typeof state != "string")
  1816. state = state[0];
  1817. for (var key in this.subModes) {
  1818. if (state.indexOf(key) === 0)
  1819. return this.subModes[key];
  1820. }
  1821. return null;
  1822. };
  1823. this.$tryMode = function(state, session, foldStyle, row) {
  1824. var mode = this.$getMode(state);
  1825. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1826. };
  1827. this.getFoldWidget = function(session, foldStyle, row) {
  1828. return (
  1829. this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
  1830. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1831. this.defaultMode.getFoldWidget(session, foldStyle, row)
  1832. );
  1833. };
  1834. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1835. var mode = this.$getMode(session.getState(row-1));
  1836. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1837. mode = this.$getMode(session.getState(row));
  1838. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1839. mode = this.defaultMode;
  1840. return mode.getFoldWidgetRange(session, foldStyle, row);
  1841. };
  1842. }).call(FoldMode.prototype);
  1843. });
  1844. ace.define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(acequire, exports, module) {
  1845. "use strict";
  1846. var oop = acequire("../../lib/oop");
  1847. var MixedFoldMode = acequire("./mixed").FoldMode;
  1848. var XmlFoldMode = acequire("./xml").FoldMode;
  1849. var CStyleFoldMode = acequire("./cstyle").FoldMode;
  1850. var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
  1851. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  1852. "js-": new CStyleFoldMode(),
  1853. "css-": new CStyleFoldMode()
  1854. });
  1855. };
  1856. oop.inherits(FoldMode, MixedFoldMode);
  1857. });
  1858. ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(acequire, exports, module) {
  1859. "use strict";
  1860. var TokenIterator = acequire("../token_iterator").TokenIterator;
  1861. var commonAttributes = [
  1862. "accesskey",
  1863. "class",
  1864. "contenteditable",
  1865. "contextmenu",
  1866. "dir",
  1867. "draggable",
  1868. "dropzone",
  1869. "hidden",
  1870. "id",
  1871. "inert",
  1872. "itemid",
  1873. "itemprop",
  1874. "itemref",
  1875. "itemscope",
  1876. "itemtype",
  1877. "lang",
  1878. "spellcheck",
  1879. "style",
  1880. "tabindex",
  1881. "title",
  1882. "translate"
  1883. ];
  1884. var eventAttributes = [
  1885. "onabort",
  1886. "onblur",
  1887. "oncancel",
  1888. "oncanplay",
  1889. "oncanplaythrough",
  1890. "onchange",
  1891. "onclick",
  1892. "onclose",
  1893. "oncontextmenu",
  1894. "oncuechange",
  1895. "ondblclick",
  1896. "ondrag",
  1897. "ondragend",
  1898. "ondragenter",
  1899. "ondragleave",
  1900. "ondragover",
  1901. "ondragstart",
  1902. "ondrop",
  1903. "ondurationchange",
  1904. "onemptied",
  1905. "onended",
  1906. "onerror",
  1907. "onfocus",
  1908. "oninput",
  1909. "oninvalid",
  1910. "onkeydown",
  1911. "onkeypress",
  1912. "onkeyup",
  1913. "onload",
  1914. "onloadeddata",
  1915. "onloadedmetadata",
  1916. "onloadstart",
  1917. "onmousedown",
  1918. "onmousemove",
  1919. "onmouseout",
  1920. "onmouseover",
  1921. "onmouseup",
  1922. "onmousewheel",
  1923. "onpause",
  1924. "onplay",
  1925. "onplaying",
  1926. "onprogress",
  1927. "onratechange",
  1928. "onreset",
  1929. "onscroll",
  1930. "onseeked",
  1931. "onseeking",
  1932. "onselect",
  1933. "onshow",
  1934. "onstalled",
  1935. "onsubmit",
  1936. "onsuspend",
  1937. "ontimeupdate",
  1938. "onvolumechange",
  1939. "onwaiting"
  1940. ];
  1941. var globalAttributes = commonAttributes.concat(eventAttributes);
  1942. var attributeMap = {
  1943. "html": {"manifest": 1},
  1944. "head": {},
  1945. "title": {},
  1946. "base": {"href": 1, "target": 1},
  1947. "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},
  1948. "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
  1949. "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
  1950. "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
  1951. "noscript": {"href": 1},
  1952. "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},
  1953. "section": {},
  1954. "nav": {},
  1955. "article": {"pubdate": 1},
  1956. "aside": {},
  1957. "h1": {},
  1958. "h2": {},
  1959. "h3": {},
  1960. "h4": {},
  1961. "h5": {},
  1962. "h6": {},
  1963. "header": {},
  1964. "footer": {},
  1965. "address": {},
  1966. "main": {},
  1967. "p": {},
  1968. "hr": {},
  1969. "pre": {},
  1970. "blockquote": {"cite": 1},
  1971. "ol": {"start": 1, "reversed": 1},
  1972. "ul": {},
  1973. "li": {"value": 1},
  1974. "dl": {},
  1975. "dt": {},
  1976. "dd": {},
  1977. "figure": {},
  1978. "figcaption": {},
  1979. "div": {},
  1980. "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},
  1981. "em": {},
  1982. "strong": {},
  1983. "small": {},
  1984. "s": {},
  1985. "cite": {},
  1986. "q": {"cite": 1},
  1987. "dfn": {},
  1988. "abbr": {},
  1989. "data": {},
  1990. "time": {"datetime": 1},
  1991. "code": {},
  1992. "var": {},
  1993. "samp": {},
  1994. "kbd": {},
  1995. "sub": {},
  1996. "sup": {},
  1997. "i": {},
  1998. "b": {},
  1999. "u": {},
  2000. "mark": {},
  2001. "ruby": {},
  2002. "rt": {},
  2003. "rp": {},
  2004. "bdi": {},
  2005. "bdo": {},
  2006. "span": {},
  2007. "br": {},
  2008. "wbr": {},
  2009. "ins": {"cite": 1, "datetime": 1},
  2010. "del": {"cite": 1, "datetime": 1},
  2011. "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
  2012. "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}},
  2013. "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
  2014. "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
  2015. "param": {"name": 1, "value": 1},
  2016. "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}},
  2017. "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
  2018. "source": {"src": 1, "type": 1, "media": 1},
  2019. "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
  2020. "canvas": {"width": 1, "height": 1},
  2021. "map": {"name": 1},
  2022. "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
  2023. "svg": {},
  2024. "math": {},
  2025. "table": {"summary": 1},
  2026. "caption": {},
  2027. "colgroup": {"span": 1},
  2028. "col": {"span": 1},
  2029. "tbody": {},
  2030. "thead": {},
  2031. "tfoot": {},
  2032. "tr": {},
  2033. "td": {"headers": 1, "rowspan": 1, "colspan": 1},
  2034. "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
  2035. "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}},
  2036. "fieldset": {"disabled": 1, "form": 1, "name": 1},
  2037. "legend": {},
  2038. "label": {"form": 1, "for": 1},
  2039. "input": {
  2040. "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},
  2041. "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}, "name": 1, "pattern": 1, "placeholder": 1, "readonly": {"readonly": 1}, "acequired": {"acequired": 1}, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1},
  2042. "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}},
  2043. "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
  2044. "datalist": {},
  2045. "optgroup": {"disabled": 1, "label": 1},
  2046. "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
  2047. "textarea": {"autofocus": {"autofocus": 1}, "disabled": {"disabled": 1}, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": {"readonly": 1}, "acequired": {"acequired": 1}, "rows": 1, "cols": 1, "wrap": {"on": 1, "off": 1, "hard": 1, "soft": 1}},
  2048. "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
  2049. "output": {"for": 1, "form": 1, "name": 1},
  2050. "progress": {"value": 1, "max": 1},
  2051. "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
  2052. "details": {"open": 1},
  2053. "summary": {},
  2054. "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
  2055. "menu": {"type": 1, "label": 1},
  2056. "dialog": {"open": 1}
  2057. };
  2058. var elements = Object.keys(attributeMap);
  2059. function is(token, type) {
  2060. return token.type.lastIndexOf(type + ".xml") > -1;
  2061. }
  2062. function findTagName(session, pos) {
  2063. var iterator = new TokenIterator(session, pos.row, pos.column);
  2064. var token = iterator.getCurrentToken();
  2065. while (token && !is(token, "tag-name")){
  2066. token = iterator.stepBackward();
  2067. }
  2068. if (token)
  2069. return token.value;
  2070. }
  2071. function findAttributeName(session, pos) {
  2072. var iterator = new TokenIterator(session, pos.row, pos.column);
  2073. var token = iterator.getCurrentToken();
  2074. while (token && !is(token, "attribute-name")){
  2075. token = iterator.stepBackward();
  2076. }
  2077. if (token)
  2078. return token.value;
  2079. }
  2080. var HtmlCompletions = function() {
  2081. };
  2082. (function() {
  2083. this.getCompletions = function(state, session, pos, prefix) {
  2084. var token = session.getTokenAt(pos.row, pos.column);
  2085. if (!token)
  2086. return [];
  2087. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2088. return this.getTagCompletions(state, session, pos, prefix);
  2089. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2090. return this.getAttributeCompletions(state, session, pos, prefix);
  2091. if (is(token, "attribute-value"))
  2092. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2093. var line = session.getLine(pos.row).substr(0, pos.column);
  2094. if (/&[a-z]*$/i.test(line))
  2095. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2096. return [];
  2097. };
  2098. this.getTagCompletions = function(state, session, pos, prefix) {
  2099. return elements.map(function(element){
  2100. return {
  2101. value: element,
  2102. meta: "tag",
  2103. score: Number.MAX_VALUE
  2104. };
  2105. });
  2106. };
  2107. this.getAttributeCompletions = function(state, session, pos, prefix) {
  2108. var tagName = findTagName(session, pos);
  2109. if (!tagName)
  2110. return [];
  2111. var attributes = globalAttributes;
  2112. if (tagName in attributeMap) {
  2113. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2114. }
  2115. return attributes.map(function(attribute){
  2116. return {
  2117. caption: attribute,
  2118. snippet: attribute + '="$0"',
  2119. meta: "attribute",
  2120. score: Number.MAX_VALUE
  2121. };
  2122. });
  2123. };
  2124. this.getAttributeValueCompletions = function(state, session, pos, prefix) {
  2125. var tagName = findTagName(session, pos);
  2126. var attributeName = findAttributeName(session, pos);
  2127. if (!tagName)
  2128. return [];
  2129. var values = [];
  2130. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2131. values = Object.keys(attributeMap[tagName][attributeName]);
  2132. }
  2133. return values.map(function(value){
  2134. return {
  2135. caption: value,
  2136. snippet: value,
  2137. meta: "attribute value",
  2138. score: Number.MAX_VALUE
  2139. };
  2140. });
  2141. };
  2142. this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
  2143. 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;'];
  2144. return values.map(function(value){
  2145. return {
  2146. caption: value,
  2147. snippet: value,
  2148. meta: "html entity",
  2149. score: Number.MAX_VALUE
  2150. };
  2151. });
  2152. };
  2153. }).call(HtmlCompletions.prototype);
  2154. exports.HtmlCompletions = HtmlCompletions;
  2155. });
  2156. ace.define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(acequire, exports, module) {
  2157. "use strict";
  2158. var oop = acequire("../lib/oop");
  2159. var lang = acequire("../lib/lang");
  2160. var TextMode = acequire("./text").Mode;
  2161. var JavaScriptMode = acequire("./javascript").Mode;
  2162. var CssMode = acequire("./css").Mode;
  2163. var HtmlHighlightRules = acequire("./html_highlight_rules").HtmlHighlightRules;
  2164. var XmlBehaviour = acequire("./behaviour/xml").XmlBehaviour;
  2165. var HtmlFoldMode = acequire("./folding/html").FoldMode;
  2166. var HtmlCompletions = acequire("./html_completions").HtmlCompletions;
  2167. var WorkerClient = acequire("../worker/worker_client").WorkerClient;
  2168. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2169. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2170. var Mode = function(options) {
  2171. this.fragmentContext = options && options.fragmentContext;
  2172. this.HighlightRules = HtmlHighlightRules;
  2173. this.$behaviour = new XmlBehaviour();
  2174. this.$completer = new HtmlCompletions();
  2175. this.createModeDelegates({
  2176. "js-": JavaScriptMode,
  2177. "css-": CssMode
  2178. });
  2179. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2180. };
  2181. oop.inherits(Mode, TextMode);
  2182. (function() {
  2183. this.blockComment = {start: "<!--", end: "-->"};
  2184. this.voidElements = lang.arrayToMap(voidElements);
  2185. this.getNextLineIndent = function(state, line, tab) {
  2186. return this.$getIndent(line);
  2187. };
  2188. this.checkOutdent = function(state, line, input) {
  2189. return false;
  2190. };
  2191. this.getCompletions = function(state, session, pos, prefix) {
  2192. return this.$completer.getCompletions(state, session, pos, prefix);
  2193. };
  2194. this.createWorker = function(session) {
  2195. if (this.constructor != Mode)
  2196. return;
  2197. var worker = new WorkerClient(["ace"], require("../worker/html"), "Worker");
  2198. worker.attachToDocument(session.getDocument());
  2199. if (this.fragmentContext)
  2200. worker.call("setOptions", [{context: this.fragmentContext}]);
  2201. worker.on("error", function(e) {
  2202. session.setAnnotations(e.data);
  2203. });
  2204. worker.on("terminate", function() {
  2205. session.clearAnnotations();
  2206. });
  2207. return worker;
  2208. };
  2209. this.$id = "ace/mode/html";
  2210. }).call(Mode.prototype);
  2211. exports.Mode = Mode;
  2212. });
  2213. ace.define("ace/mode/markdown_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules","ace/mode/html_highlight_rules","ace/mode/css_highlight_rules"], function(acequire, exports, module) {
  2214. "use strict";
  2215. var oop = acequire("../lib/oop");
  2216. var lang = acequire("../lib/lang");
  2217. var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
  2218. var JavaScriptHighlightRules = acequire("./javascript_highlight_rules").JavaScriptHighlightRules;
  2219. var XmlHighlightRules = acequire("./xml_highlight_rules").XmlHighlightRules;
  2220. var HtmlHighlightRules = acequire("./html_highlight_rules").HtmlHighlightRules;
  2221. var CssHighlightRules = acequire("./css_highlight_rules").CssHighlightRules;
  2222. var escaped = function(ch) {
  2223. return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
  2224. };
  2225. function github_embed(tag, prefix) {
  2226. return { // Github style block
  2227. token : "support.function",
  2228. regex : "^\\s*```" + tag + "\\s*$",
  2229. push : prefix + "start"
  2230. };
  2231. }
  2232. var MarkdownHighlightRules = function() {
  2233. HtmlHighlightRules.call(this);
  2234. this.$rules["start"].unshift({
  2235. token : "empty_line",
  2236. regex : '^$',
  2237. next: "allowBlock"
  2238. }, { // h1
  2239. token: "markup.heading.1",
  2240. regex: "^=+(?=\\s*$)"
  2241. }, { // h2
  2242. token: "markup.heading.2",
  2243. regex: "^\\-+(?=\\s*$)"
  2244. }, {
  2245. token : function(value) {
  2246. return "markup.heading." + value.length;
  2247. },
  2248. regex : /^#{1,6}(?=\s*[^ #]|\s+#.)/,
  2249. next : "header"
  2250. },
  2251. github_embed("(?:javascript|js)", "jscode-"),
  2252. github_embed("xml", "xmlcode-"),
  2253. github_embed("html", "htmlcode-"),
  2254. github_embed("css", "csscode-"),
  2255. { // Github style block
  2256. token : "support.function",
  2257. regex : "^\\s*```\\s*\\S*(?:{.*?\\})?\\s*$",
  2258. next : "githubblock"
  2259. }, { // block quote
  2260. token : "string.blockquote",
  2261. regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  2262. next : "blockquote"
  2263. }, { // HR * - _
  2264. token : "constant",
  2265. regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$",
  2266. next: "allowBlock"
  2267. }, { // list
  2268. token : "markup.list",
  2269. regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  2270. next : "listblock-start"
  2271. }, {
  2272. include : "basic"
  2273. });
  2274. this.addRules({
  2275. "basic" : [{
  2276. token : "constant.language.escape",
  2277. regex : /\\[\\`*_{}\[\]()#+\-.!]/
  2278. }, { // code span `
  2279. token : "support.function",
  2280. regex : "(`+)(.*?[^`])(\\1)"
  2281. }, { // reference
  2282. token : ["text", "constant", "text", "url", "string", "text"],
  2283. regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
  2284. }, { // link by reference
  2285. token : ["text", "string", "text", "constant", "text"],
  2286. regex : "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)("+ escaped("]") + ")(\\])"
  2287. }, { // link by url
  2288. token : ["text", "string", "text", "markup.underline", "string", "text"],
  2289. regex : "(\\[)(" + // [
  2290. escaped("]") + // link text
  2291. ")(\\]\\()"+ // ](
  2292. '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href
  2293. '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
  2294. "(\\))" // )
  2295. }, { // strong ** __
  2296. token : "string.strong",
  2297. regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
  2298. }, { // emphasis * _
  2299. token : "string.emphasis",
  2300. regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
  2301. }, { //
  2302. token : ["text", "url", "text"],
  2303. regex : "(<)("+
  2304. "(?:https?|ftp|dict):[^'\">\\s]+"+
  2305. "|"+
  2306. "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+
  2307. ")(>)"
  2308. }],
  2309. "allowBlock": [
  2310. {token : "support.function", regex : "^ {4}.+", next : "allowBlock"},
  2311. {token : "empty_line", regex : '^$', next: "allowBlock"},
  2312. {token : "empty", regex : "", next : "start"}
  2313. ],
  2314. "header" : [{
  2315. regex: "$",
  2316. next : "start"
  2317. }, {
  2318. include: "basic"
  2319. }, {
  2320. defaultToken : "heading"
  2321. } ],
  2322. "listblock-start" : [{
  2323. token : "support.variable",
  2324. regex : /(?:\[[ x]\])?/,
  2325. next : "listblock"
  2326. }],
  2327. "listblock" : [ { // Lists only escape on completely blank lines.
  2328. token : "empty_line",
  2329. regex : "^$",
  2330. next : "start"
  2331. }, { // list
  2332. token : "markup.list",
  2333. regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  2334. next : "listblock-start"
  2335. }, {
  2336. include : "basic", noEscape: true
  2337. }, { // Github style block
  2338. token : "support.function",
  2339. regex : "^\\s*```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$",
  2340. next : "githubblock"
  2341. }, {
  2342. defaultToken : "list" //do not use markup.list to allow stling leading `*` differntly
  2343. } ],
  2344. "blockquote" : [ { // Blockquotes only escape on blank lines.
  2345. token : "empty_line",
  2346. regex : "^\\s*$",
  2347. next : "start"
  2348. }, { // block quote
  2349. token : "string.blockquote",
  2350. regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  2351. next : "blockquote"
  2352. }, {
  2353. include : "basic", noEscape: true
  2354. }, {
  2355. defaultToken : "string.blockquote"
  2356. } ],
  2357. "githubblock" : [ {
  2358. token : "support.function",
  2359. regex : "^\\s*```",
  2360. next : "start"
  2361. }, {
  2362. defaultToken : "support.function"
  2363. } ]
  2364. });
  2365. this.embedRules(JavaScriptHighlightRules, "jscode-", [{
  2366. token : "support.function",
  2367. regex : "^\\s*```",
  2368. next : "pop"
  2369. }]);
  2370. this.embedRules(HtmlHighlightRules, "htmlcode-", [{
  2371. token : "support.function",
  2372. regex : "^\\s*```",
  2373. next : "pop"
  2374. }]);
  2375. this.embedRules(CssHighlightRules, "csscode-", [{
  2376. token : "support.function",
  2377. regex : "^\\s*```",
  2378. next : "pop"
  2379. }]);
  2380. this.embedRules(XmlHighlightRules, "xmlcode-", [{
  2381. token : "support.function",
  2382. regex : "^\\s*```",
  2383. next : "pop"
  2384. }]);
  2385. this.normalizeRules();
  2386. };
  2387. oop.inherits(MarkdownHighlightRules, TextHighlightRules);
  2388. exports.MarkdownHighlightRules = MarkdownHighlightRules;
  2389. });
  2390. ace.define("ace/mode/folding/markdown",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(acequire, exports, module) {
  2391. "use strict";
  2392. var oop = acequire("../../lib/oop");
  2393. var BaseFoldMode = acequire("./fold_mode").FoldMode;
  2394. var Range = acequire("../../range").Range;
  2395. var FoldMode = exports.FoldMode = function() {};
  2396. oop.inherits(FoldMode, BaseFoldMode);
  2397. (function() {
  2398. this.foldingStartMarker = /^(?:[=-]+\s*$|#{1,6} |`{3})/;
  2399. this.getFoldWidget = function(session, foldStyle, row) {
  2400. var line = session.getLine(row);
  2401. if (!this.foldingStartMarker.test(line))
  2402. return "";
  2403. if (line[0] == "`") {
  2404. if (session.bgTokenizer.getState(row) == "start")
  2405. return "end";
  2406. return "start";
  2407. }
  2408. return "start";
  2409. };
  2410. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2411. var line = session.getLine(row);
  2412. var startColumn = line.length;
  2413. var maxRow = session.getLength();
  2414. var startRow = row;
  2415. var endRow = row;
  2416. if (!line.match(this.foldingStartMarker))
  2417. return;
  2418. if (line[0] == "`") {
  2419. if (session.bgTokenizer.getState(row) !== "start") {
  2420. while (++row < maxRow) {
  2421. line = session.getLine(row);
  2422. if (line[0] == "`" & line.substring(0, 3) == "```")
  2423. break;
  2424. }
  2425. return new Range(startRow, startColumn, row, 0);
  2426. } else {
  2427. while (row -- > 0) {
  2428. line = session.getLine(row);
  2429. if (line[0] == "`" & line.substring(0, 3) == "```")
  2430. break;
  2431. }
  2432. return new Range(row, line.length, startRow, 0);
  2433. }
  2434. }
  2435. var token;
  2436. function isHeading(row) {
  2437. token = session.getTokens(row)[0];
  2438. return token && token.type.lastIndexOf(heading, 0) === 0;
  2439. }
  2440. var heading = "markup.heading";
  2441. function getLevel() {
  2442. var ch = token.value[0];
  2443. if (ch == "=") return 6;
  2444. if (ch == "-") return 5;
  2445. return 7 - token.value.search(/[^#]/);
  2446. }
  2447. if (isHeading(row)) {
  2448. var startHeadingLevel = getLevel();
  2449. while (++row < maxRow) {
  2450. if (!isHeading(row))
  2451. continue;
  2452. var level = getLevel();
  2453. if (level >= startHeadingLevel)
  2454. break;
  2455. }
  2456. endRow = row - (!token || ["=", "-"].indexOf(token.value[0]) == -1 ? 1 : 2);
  2457. if (endRow > startRow) {
  2458. while (endRow > startRow && /^\s*$/.test(session.getLine(endRow)))
  2459. endRow--;
  2460. }
  2461. if (endRow > startRow) {
  2462. var endColumn = session.getLine(endRow).length;
  2463. return new Range(startRow, startColumn, endRow, endColumn);
  2464. }
  2465. }
  2466. };
  2467. }).call(FoldMode.prototype);
  2468. });
  2469. ace.define("ace/mode/markdown",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript","ace/mode/xml","ace/mode/html","ace/mode/markdown_highlight_rules","ace/mode/folding/markdown"], function(acequire, exports, module) {
  2470. "use strict";
  2471. var oop = acequire("../lib/oop");
  2472. var TextMode = acequire("./text").Mode;
  2473. var JavaScriptMode = acequire("./javascript").Mode;
  2474. var XmlMode = acequire("./xml").Mode;
  2475. var HtmlMode = acequire("./html").Mode;
  2476. var MarkdownHighlightRules = acequire("./markdown_highlight_rules").MarkdownHighlightRules;
  2477. var MarkdownFoldMode = acequire("./folding/markdown").FoldMode;
  2478. var Mode = function() {
  2479. this.HighlightRules = MarkdownHighlightRules;
  2480. this.createModeDelegates({
  2481. "js-": JavaScriptMode,
  2482. "xml-": XmlMode,
  2483. "html-": HtmlMode
  2484. });
  2485. this.foldingRules = new MarkdownFoldMode();
  2486. this.$behaviour = this.$defaultBehaviour;
  2487. };
  2488. oop.inherits(Mode, TextMode);
  2489. (function() {
  2490. this.type = "text";
  2491. this.blockComment = {start: "<!--", end: "-->"};
  2492. this.getNextLineIndent = function(state, line, tab) {
  2493. if (state == "listblock") {
  2494. var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line);
  2495. if (!match)
  2496. return "";
  2497. var marker = match[2];
  2498. if (!marker)
  2499. marker = parseInt(match[3], 10) + 1 + ".";
  2500. return match[1] + marker + match[4];
  2501. } else {
  2502. return this.$getIndent(line);
  2503. }
  2504. };
  2505. this.$id = "ace/mode/markdown";
  2506. }).call(Mode.prototype);
  2507. exports.Mode = Mode;
  2508. });