chr 0.3.5 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +2 -0
  3. data/.gitignore +6 -1
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +18 -0
  6. data/README.md +4 -0
  7. data/Rakefile +17 -2
  8. data/app/assets/javascripts/chr.coffee +13 -26
  9. data/app/assets/javascripts/chr/{core/chr.coffee → chr.coffee} +4 -1
  10. data/app/assets/javascripts/chr/{core/chr_router.coffee → chr_router.coffee} +0 -0
  11. data/app/assets/javascripts/chr/{core/item.coffee → item.coffee} +2 -1
  12. data/app/assets/javascripts/chr/{core/list.coffee → list.coffee} +1 -1
  13. data/app/assets/javascripts/chr/{core/list_config.coffee → list_config.coffee} +0 -0
  14. data/app/assets/javascripts/chr/{core/list_pagination.coffee → list_pagination.coffee} +15 -4
  15. data/app/assets/javascripts/chr/{core/list_reorder.coffee → list_reorder.coffee} +0 -0
  16. data/app/assets/javascripts/chr/{core/list_search.coffee → list_search.coffee} +1 -1
  17. data/app/assets/javascripts/chr/{core/module.coffee → module.coffee} +0 -0
  18. data/app/assets/javascripts/chr/{core/utils.coffee → utils.coffee} +0 -0
  19. data/app/assets/javascripts/chr/{core/view.coffee → view.coffee} +21 -9
  20. data/app/assets/javascripts/chr/{core/view_local-storage.coffee → view_local-storage.coffee} +0 -0
  21. data/app/assets/javascripts/{chr/store/array-store.coffee → stores/array.coffee} +0 -0
  22. data/app/assets/javascripts/{chr/store/object-store.coffee → stores/object.coffee} +0 -0
  23. data/app/assets/javascripts/{chr/store/rails-array-store.coffee → stores/rails-array.coffee} +0 -0
  24. data/app/assets/javascripts/{chr/store → stores}/rails-form-object-parser.coffee +4 -1
  25. data/app/assets/javascripts/{chr/store/rails-object-store.coffee → stores/rails-object.coffee} +0 -0
  26. data/app/assets/javascripts/{chr/store/rest-array-store.coffee → stores/rest-array.coffee} +5 -2
  27. data/app/assets/javascripts/{chr/store/rest-object-store.coffee → stores/rest-object.coffee} +0 -0
  28. data/app/assets/stylesheets/{_chr.scss → chr.scss} +2 -7
  29. data/app/assets/stylesheets/chr/{_icons.scss → icons.scss} +0 -0
  30. data/app/assets/stylesheets/chr/{_main.scss → main.scss} +10 -3
  31. data/app/assets/stylesheets/chr/{_mixins.scss → mixins.scss} +0 -77
  32. data/app/assets/stylesheets/chr/{_settings.scss → settings.scss} +1 -1
  33. data/bin/chr +13 -0
  34. data/bin/rake +16 -0
  35. data/bin/setup +13 -0
  36. data/chr.gemspec +41 -21
  37. data/docs/tests.md +64 -0
  38. data/lib/chr.rb +10 -2
  39. data/lib/chr/app_builder.rb +385 -0
  40. data/lib/chr/generators/app_generator.rb +213 -0
  41. data/lib/chr/version.rb +3 -1
  42. data/lib/generators/chr/controller_generator.rb +18 -0
  43. data/templates/Gemfile.erb +38 -0
  44. data/templates/Procfile +1 -0
  45. data/templates/README.md.erb +45 -0
  46. data/templates/_analytics.html.erb +9 -0
  47. data/templates/_flashes.html.erb +7 -0
  48. data/templates/_javascript.html.erb +12 -0
  49. data/templates/application.coffee +2 -0
  50. data/templates/application.scss +1 -0
  51. data/templates/application.yml +6 -0
  52. data/templates/application_gitignore +14 -0
  53. data/templates/application_layout.html.erb.erb +29 -0
  54. data/templates/asset_sync.rb +28 -0
  55. data/templates/bin_setup.erb +36 -0
  56. data/templates/body_class_helper.rb +19 -0
  57. data/templates/bundler_audit.rake +12 -0
  58. data/templates/carrierwave.rb +23 -0
  59. data/templates/character_admin.coffee.erb +28 -0
  60. data/templates/character_admin.scss +3 -0
  61. data/templates/character_admin_index.html.erb +2 -0
  62. data/templates/character_admin_layout.html.erb +21 -0
  63. data/templates/character_base_controller.rb +16 -0
  64. data/templates/development_seeds.rb +12 -0
  65. data/templates/devise_overrides_passwords_controller.rb +10 -0
  66. data/templates/devise_overrides_passwords_edit.html.erb +30 -0
  67. data/templates/devise_overrides_passwords_new.html.erb +21 -0
  68. data/templates/devise_overrides_sessions_controller.rb +12 -0
  69. data/templates/devise_overrides_sessions_new.html.erb +31 -0
  70. data/templates/errors.rb +34 -0
  71. data/templates/json_encoding.rb +1 -0
  72. data/templates/newrelic.yml.erb +34 -0
  73. data/templates/puma.rb +18 -0
  74. data/templates/routes.rb +90 -0
  75. data/templates/sample.env +6 -0
  76. data/templates/secrets.yml +14 -0
  77. data/templates/smtp.rb +9 -0
  78. data/templates/staging.rb +5 -0
  79. data/test/factories/article_factory.rb +19 -0
  80. data/test/files/test.jpg +0 -0
  81. data/test/integration/article_fullsize_test.rb +33 -0
  82. data/test/integration/article_test.rb +33 -0
  83. data/test/integration/magazine_article_test.rb +33 -0
  84. data/test/integration/restricted_article_test.rb +33 -0
  85. data/test/integration/sport_article_test.rb +34 -0
  86. data/test/rails_app/Rakefile +6 -0
  87. data/test/rails_app/app/assets/javascripts/admin.coffee +137 -0
  88. data/test/rails_app/app/assets/javascripts/application.js +1 -0
  89. data/test/rails_app/app/assets/stylesheets/admin.scss +1 -0
  90. data/test/rails_app/app/assets/stylesheets/application.css +1 -0
  91. data/test/rails_app/app/controllers/admin/articles_controller.rb +7 -0
  92. data/test/rails_app/app/controllers/admin/base_controller.rb +8 -0
  93. data/test/rails_app/app/controllers/application_controller.rb +5 -0
  94. data/test/rails_app/app/helpers/application_helper.rb +2 -0
  95. data/test/rails_app/app/models/article.rb +46 -0
  96. data/test/rails_app/app/uploaders/article_image_uploader.rb +16 -0
  97. data/test/rails_app/app/views/admin/index.html.erb +4 -0
  98. data/test/rails_app/app/views/layouts/admin.html.erb +17 -0
  99. data/test/rails_app/app/views/layouts/application.html.erb +14 -0
  100. data/test/rails_app/bin/bundle +3 -0
  101. data/test/rails_app/bin/rails +8 -0
  102. data/test/rails_app/bin/rake +8 -0
  103. data/test/rails_app/bin/setup +29 -0
  104. data/test/rails_app/bin/spring +15 -0
  105. data/test/rails_app/config.ru +4 -0
  106. data/test/rails_app/config/application.rb +36 -0
  107. data/test/rails_app/config/boot.rb +3 -0
  108. data/test/rails_app/config/environment.rb +5 -0
  109. data/test/rails_app/config/environments/development.rb +38 -0
  110. data/test/rails_app/config/environments/production.rb +76 -0
  111. data/test/rails_app/config/environments/test.rb +46 -0
  112. data/test/rails_app/config/initializers/assets.rb +12 -0
  113. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  114. data/test/rails_app/config/initializers/carrierwave.rb +5 -0
  115. data/test/rails_app/config/initializers/cookies_serializer.rb +3 -0
  116. data/test/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
  117. data/test/rails_app/config/initializers/inflections.rb +16 -0
  118. data/test/rails_app/config/initializers/mime_types.rb +4 -0
  119. data/test/rails_app/config/initializers/session_store.rb +3 -0
  120. data/test/rails_app/config/initializers/wrap_parameters.rb +9 -0
  121. data/test/rails_app/config/locales/en.yml +23 -0
  122. data/test/rails_app/config/mongoid.yml +9 -0
  123. data/test/rails_app/config/routes.rb +8 -0
  124. data/test/rails_app/config/secrets.yml +22 -0
  125. data/test/rails_app/db/seeds.rb +7 -0
  126. data/test/rails_app/public/404.html +67 -0
  127. data/test/rails_app/public/422.html +67 -0
  128. data/test/rails_app/public/500.html +66 -0
  129. data/{app/assets/javascripts/form/input-date.coffee → test/rails_app/public/favicon.ico} +0 -0
  130. data/test/rails_app/public/robots.txt +5 -0
  131. data/test/support/character_front_end.rb +196 -0
  132. data/test/support/chr/item.rb +32 -0
  133. data/test/support/chr/list.rb +31 -0
  134. data/test/support/chr/list_pagination.rb +163 -0
  135. data/test/support/chr/list_reorder.rb +46 -0
  136. data/test/support/chr/list_search.rb +41 -0
  137. data/test/support/chr/view.rb +112 -0
  138. data/test/support/stores/array.rb +20 -0
  139. data/test/support/stores/rest-array.rb +34 -0
  140. data/test/test_helper.rb +68 -0
  141. metadata +373 -80
  142. data/Gruntfile.coffee +0 -101
  143. data/app/assets/javascripts/form/expandable-group.coffee +0 -30
  144. data/app/assets/javascripts/form/form.coffee +0 -221
  145. data/app/assets/javascripts/form/input-checkbox.coffee +0 -83
  146. data/app/assets/javascripts/form/input-color.coffee +0 -55
  147. data/app/assets/javascripts/form/input-file.coffee +0 -144
  148. data/app/assets/javascripts/form/input-form.coffee +0 -171
  149. data/app/assets/javascripts/form/input-form_reorder.coffee +0 -67
  150. data/app/assets/javascripts/form/input-hidden.coffee +0 -57
  151. data/app/assets/javascripts/form/input-list.coffee +0 -154
  152. data/app/assets/javascripts/form/input-list_reorder.coffee +0 -39
  153. data/app/assets/javascripts/form/input-list_typeahead.coffee +0 -55
  154. data/app/assets/javascripts/form/input-password.coffee +0 -32
  155. data/app/assets/javascripts/form/input-select.coffee +0 -84
  156. data/app/assets/javascripts/form/input-select2.coffee +0 -33
  157. data/app/assets/javascripts/form/input-string.coffee +0 -160
  158. data/app/assets/javascripts/form/input-text.coffee +0 -43
  159. data/app/assets/javascripts/input-html.coffee +0 -81
  160. data/app/assets/javascripts/input-markdown.coffee +0 -93
  161. data/app/assets/javascripts/input-redactor.coffee +0 -1
  162. data/app/assets/javascripts/redactor/input-redactor.coffee +0 -53
  163. data/app/assets/javascripts/redactor/input-redactor_character.coffee +0 -83
  164. data/app/assets/javascripts/redactor/input-redactor_images.coffee +0 -166
  165. data/app/assets/javascripts/vendor/ace.js +0 -18280
  166. data/app/assets/javascripts/vendor/jquery.scrollparent.js +0 -14
  167. data/app/assets/javascripts/vendor/jquery.textarea_autosize.js +0 -55
  168. data/app/assets/javascripts/vendor/jquery.typeahead.js +0 -1782
  169. data/app/assets/javascripts/vendor/marked.js +0 -1272
  170. data/app/assets/javascripts/vendor/mode-html.js +0 -2436
  171. data/app/assets/javascripts/vendor/mode-markdown.js +0 -2820
  172. data/app/assets/javascripts/vendor/redactor.fixedtoolbar.js +0 -107
  173. data/app/assets/javascripts/vendor/select2.js +0 -5274
  174. data/app/assets/stylesheets/_input-redactor.scss +0 -35
  175. data/app/assets/stylesheets/form/_expandable-group.scss +0 -16
  176. data/app/assets/stylesheets/form/_input-select2.scss +0 -94
  177. data/app/assets/stylesheets/form/_main.scss +0 -180
  178. data/app/assets/stylesheets/vendor/select2.css +0 -258
  179. data/bower.json +0 -38
  180. data/dist/chr.js +0 -5949
  181. data/dist/input-ace.js +0 -24946
  182. data/dist/input-redactor.js +0 -1
  183. data/lib/mongoid/character.rb +0 -30
  184. data/package.json +0 -10
@@ -1,2820 +0,0 @@
1
- define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
2
- "use strict";
3
-
4
- var oop = require("../lib/oop");
5
- var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
6
-
7
- var DocCommentHighlightRules = function() {
8
- this.$rules = {
9
- "start" : [ {
10
- token : "comment.doc.tag",
11
- regex : "@[\\w\\d_]+" // TODO: fix email addresses
12
- },
13
- DocCommentHighlightRules.getTagRule(),
14
- {
15
- defaultToken : "comment.doc",
16
- caseInsensitive: true
17
- }]
18
- };
19
- };
20
-
21
- oop.inherits(DocCommentHighlightRules, TextHighlightRules);
22
-
23
- DocCommentHighlightRules.getTagRule = function(start) {
24
- return {
25
- token : "comment.doc.tag.storage.type",
26
- regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
- };
28
- }
29
-
30
- DocCommentHighlightRules.getStartRule = function(start) {
31
- return {
32
- token : "comment.doc", // doc comment
33
- regex : "\\/\\*(?=\\*)",
34
- next : start
35
- };
36
- };
37
-
38
- DocCommentHighlightRules.getEndRule = function (start) {
39
- return {
40
- token : "comment.doc", // closing comment
41
- regex : "\\*\\/",
42
- next : start
43
- };
44
- };
45
-
46
-
47
- exports.DocCommentHighlightRules = DocCommentHighlightRules;
48
-
49
- });
50
-
51
- define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
52
- "use strict";
53
-
54
- var oop = require("../lib/oop");
55
- var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
56
- var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
57
-
58
- var JavaScriptHighlightRules = function(options) {
59
- var keywordMapper = this.createKeywordMapper({
60
- "variable.language":
61
- "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
62
- "Namespace|QName|XML|XMLList|" + // E4X
63
- "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
64
- "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
65
- "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
66
- "SyntaxError|TypeError|URIError|" +
67
- "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
68
- "isNaN|parseFloat|parseInt|" +
69
- "JSON|Math|" + // Other
70
- "this|arguments|prototype|window|document" , // Pseudo
71
- "keyword":
72
- "const|yield|import|get|set|" +
73
- "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
74
- "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
75
- "__parent__|__count__|escape|unescape|with|__proto__|" +
76
- "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
77
- "storage.type":
78
- "const|let|var|function",
79
- "constant.language":
80
- "null|Infinity|NaN|undefined",
81
- "support.function":
82
- "alert",
83
- "constant.language.boolean": "true|false"
84
- }, "identifier");
85
- var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
86
- var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
87
-
88
- var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
89
- "u[0-9a-fA-F]{4}|" + // unicode
90
- "[0-2][0-7]{0,2}|" + // oct
91
- "3[0-6][0-7]?|" + // oct
92
- "37[0-7]?|" + // oct
93
- "[4-7][0-7]?|" + //oct
94
- ".)";
95
-
96
- this.$rules = {
97
- "no_regex" : [
98
- {
99
- token : "comment",
100
- regex : "\\/\\/",
101
- next : "line_comment"
102
- },
103
- DocCommentHighlightRules.getStartRule("doc-start"),
104
- {
105
- token : "comment", // multi line comment
106
- regex : /\/\*/,
107
- next : "comment"
108
- }, {
109
- token : "string",
110
- regex : "'(?=.)",
111
- next : "qstring"
112
- }, {
113
- token : "string",
114
- regex : '"(?=.)',
115
- next : "qqstring"
116
- }, {
117
- token : "constant.numeric", // hex
118
- regex : /0[xX][0-9a-fA-F]+\b/
119
- }, {
120
- token : "constant.numeric", // float
121
- regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
122
- }, {
123
- token : [
124
- "storage.type", "punctuation.operator", "support.function",
125
- "punctuation.operator", "entity.name.function", "text","keyword.operator"
126
- ],
127
- regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
128
- next: "function_arguments"
129
- }, {
130
- token : [
131
- "storage.type", "punctuation.operator", "entity.name.function", "text",
132
- "keyword.operator", "text", "storage.type", "text", "paren.lparen"
133
- ],
134
- regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
135
- next: "function_arguments"
136
- }, {
137
- token : [
138
- "entity.name.function", "text", "keyword.operator", "text", "storage.type",
139
- "text", "paren.lparen"
140
- ],
141
- regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
142
- next: "function_arguments"
143
- }, {
144
- token : [
145
- "storage.type", "punctuation.operator", "entity.name.function", "text",
146
- "keyword.operator", "text",
147
- "storage.type", "text", "entity.name.function", "text", "paren.lparen"
148
- ],
149
- regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
150
- next: "function_arguments"
151
- }, {
152
- token : [
153
- "storage.type", "text", "entity.name.function", "text", "paren.lparen"
154
- ],
155
- regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
156
- next: "function_arguments"
157
- }, {
158
- token : [
159
- "entity.name.function", "text", "punctuation.operator",
160
- "text", "storage.type", "text", "paren.lparen"
161
- ],
162
- regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
163
- next: "function_arguments"
164
- }, {
165
- token : [
166
- "text", "text", "storage.type", "text", "paren.lparen"
167
- ],
168
- regex : "(:)(\\s*)(function)(\\s*)(\\()",
169
- next: "function_arguments"
170
- }, {
171
- token : "keyword",
172
- regex : "(?:" + kwBeforeRe + ")\\b",
173
- next : "start"
174
- }, {
175
- token : ["punctuation.operator", "support.function"],
176
- regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
177
- }, {
178
- token : ["punctuation.operator", "support.function.dom"],
179
- regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
180
- }, {
181
- token : ["punctuation.operator", "support.constant"],
182
- regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
183
- }, {
184
- token : ["support.constant"],
185
- regex : /that\b/
186
- }, {
187
- token : ["storage.type", "punctuation.operator", "support.function.firebug"],
188
- regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
189
- }, {
190
- token : keywordMapper,
191
- regex : identifierRe
192
- }, {
193
- token : "keyword.operator",
194
- regex : /--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
195
- next : "start"
196
- }, {
197
- token : "punctuation.operator",
198
- regex : /[?:,;.]/,
199
- next : "start"
200
- }, {
201
- token : "paren.lparen",
202
- regex : /[\[({]/,
203
- next : "start"
204
- }, {
205
- token : "paren.rparen",
206
- regex : /[\])}]/
207
- }, {
208
- token: "comment",
209
- regex: /^#!.*$/
210
- }
211
- ],
212
- "start": [
213
- DocCommentHighlightRules.getStartRule("doc-start"),
214
- {
215
- token : "comment", // multi line comment
216
- regex : "\\/\\*",
217
- next : "comment_regex_allowed"
218
- }, {
219
- token : "comment",
220
- regex : "\\/\\/",
221
- next : "line_comment_regex_allowed"
222
- }, {
223
- token: "string.regexp",
224
- regex: "\\/",
225
- next: "regex"
226
- }, {
227
- token : "text",
228
- regex : "\\s+|^$",
229
- next : "start"
230
- }, {
231
- token: "empty",
232
- regex: "",
233
- next: "no_regex"
234
- }
235
- ],
236
- "regex": [
237
- {
238
- token: "regexp.keyword.operator",
239
- regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
240
- }, {
241
- token: "string.regexp",
242
- regex: "/[sxngimy]*",
243
- next: "no_regex"
244
- }, {
245
- token : "invalid",
246
- regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
247
- }, {
248
- token : "constant.language.escape",
249
- regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
250
- }, {
251
- token : "constant.language.delimiter",
252
- regex: /\|/
253
- }, {
254
- token: "constant.language.escape",
255
- regex: /\[\^?/,
256
- next: "regex_character_class"
257
- }, {
258
- token: "empty",
259
- regex: "$",
260
- next: "no_regex"
261
- }, {
262
- defaultToken: "string.regexp"
263
- }
264
- ],
265
- "regex_character_class": [
266
- {
267
- token: "regexp.charclass.keyword.operator",
268
- regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
269
- }, {
270
- token: "constant.language.escape",
271
- regex: "]",
272
- next: "regex"
273
- }, {
274
- token: "constant.language.escape",
275
- regex: "-"
276
- }, {
277
- token: "empty",
278
- regex: "$",
279
- next: "no_regex"
280
- }, {
281
- defaultToken: "string.regexp.charachterclass"
282
- }
283
- ],
284
- "function_arguments": [
285
- {
286
- token: "variable.parameter",
287
- regex: identifierRe
288
- }, {
289
- token: "punctuation.operator",
290
- regex: "[, ]+"
291
- }, {
292
- token: "punctuation.operator",
293
- regex: "$"
294
- }, {
295
- token: "empty",
296
- regex: "",
297
- next: "no_regex"
298
- }
299
- ],
300
- "comment_regex_allowed" : [
301
- DocCommentHighlightRules.getTagRule(),
302
- {token : "comment", regex : "\\*\\/", next : "start"},
303
- {defaultToken : "comment", caseInsensitive: true}
304
- ],
305
- "comment" : [
306
- DocCommentHighlightRules.getTagRule(),
307
- {token : "comment", regex : "\\*\\/", next : "no_regex"},
308
- {defaultToken : "comment", caseInsensitive: true}
309
- ],
310
- "line_comment_regex_allowed" : [
311
- DocCommentHighlightRules.getTagRule(),
312
- {token : "comment", regex : "$|^", next : "start"},
313
- {defaultToken : "comment", caseInsensitive: true}
314
- ],
315
- "line_comment" : [
316
- DocCommentHighlightRules.getTagRule(),
317
- {token : "comment", regex : "$|^", next : "no_regex"},
318
- {defaultToken : "comment", caseInsensitive: true}
319
- ],
320
- "qqstring" : [
321
- {
322
- token : "constant.language.escape",
323
- regex : escapedRe
324
- }, {
325
- token : "string",
326
- regex : "\\\\$",
327
- next : "qqstring"
328
- }, {
329
- token : "string",
330
- regex : '"|$',
331
- next : "no_regex"
332
- }, {
333
- defaultToken: "string"
334
- }
335
- ],
336
- "qstring" : [
337
- {
338
- token : "constant.language.escape",
339
- regex : escapedRe
340
- }, {
341
- token : "string",
342
- regex : "\\\\$",
343
- next : "qstring"
344
- }, {
345
- token : "string",
346
- regex : "'|$",
347
- next : "no_regex"
348
- }, {
349
- defaultToken: "string"
350
- }
351
- ]
352
- };
353
-
354
-
355
- if (!options || !options.noES6) {
356
- this.$rules.no_regex.unshift({
357
- regex: "[{}]", onMatch: function(val, state, stack) {
358
- this.next = val == "{" ? this.nextState : "";
359
- if (val == "{" && stack.length) {
360
- stack.unshift("start", state);
361
- return "paren";
362
- }
363
- if (val == "}" && stack.length) {
364
- stack.shift();
365
- this.next = stack.shift();
366
- if (this.next.indexOf("string") != -1)
367
- return "paren.quasi.end";
368
- }
369
- return val == "{" ? "paren.lparen" : "paren.rparen";
370
- },
371
- nextState: "start"
372
- }, {
373
- token : "string.quasi.start",
374
- regex : /`/,
375
- push : [{
376
- token : "constant.language.escape",
377
- regex : escapedRe
378
- }, {
379
- token : "paren.quasi.start",
380
- regex : /\${/,
381
- push : "start"
382
- }, {
383
- token : "string.quasi.end",
384
- regex : /`/,
385
- next : "pop"
386
- }, {
387
- defaultToken: "string.quasi"
388
- }]
389
- });
390
- }
391
-
392
- this.embedRules(DocCommentHighlightRules, "doc-",
393
- [ DocCommentHighlightRules.getEndRule("no_regex") ]);
394
-
395
- this.normalizeRules();
396
- };
397
-
398
- oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
399
-
400
- exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
401
- });
402
-
403
- define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
404
- "use strict";
405
-
406
- var Range = require("../range").Range;
407
-
408
- var MatchingBraceOutdent = function() {};
409
-
410
- (function() {
411
-
412
- this.checkOutdent = function(line, input) {
413
- if (! /^\s+$/.test(line))
414
- return false;
415
-
416
- return /^\s*\}/.test(input);
417
- };
418
-
419
- this.autoOutdent = function(doc, row) {
420
- var line = doc.getLine(row);
421
- var match = line.match(/^(\s*\})/);
422
-
423
- if (!match) return 0;
424
-
425
- var column = match[1].length;
426
- var openBracePos = doc.findMatchingBracket({row: row, column: column});
427
-
428
- if (!openBracePos || openBracePos.row == row) return 0;
429
-
430
- var indent = this.$getIndent(doc.getLine(openBracePos.row));
431
- doc.replace(new Range(row, 0, row, column-1), indent);
432
- };
433
-
434
- this.$getIndent = function(line) {
435
- return line.match(/^\s*/)[0];
436
- };
437
-
438
- }).call(MatchingBraceOutdent.prototype);
439
-
440
- exports.MatchingBraceOutdent = MatchingBraceOutdent;
441
- });
442
-
443
- define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
444
- "use strict";
445
-
446
- var oop = require("../../lib/oop");
447
- var Behaviour = require("../behaviour").Behaviour;
448
- var TokenIterator = require("../../token_iterator").TokenIterator;
449
- var lang = require("../../lib/lang");
450
-
451
- var SAFE_INSERT_IN_TOKENS =
452
- ["text", "paren.rparen", "punctuation.operator"];
453
- var SAFE_INSERT_BEFORE_TOKENS =
454
- ["text", "paren.rparen", "punctuation.operator", "comment"];
455
-
456
- var context;
457
- var contextCache = {};
458
- var initContext = function(editor) {
459
- var id = -1;
460
- if (editor.multiSelect) {
461
- id = editor.selection.index;
462
- if (contextCache.rangeCount != editor.multiSelect.rangeCount)
463
- contextCache = {rangeCount: editor.multiSelect.rangeCount};
464
- }
465
- if (contextCache[id])
466
- return context = contextCache[id];
467
- context = contextCache[id] = {
468
- autoInsertedBrackets: 0,
469
- autoInsertedRow: -1,
470
- autoInsertedLineEnd: "",
471
- maybeInsertedBrackets: 0,
472
- maybeInsertedRow: -1,
473
- maybeInsertedLineStart: "",
474
- maybeInsertedLineEnd: ""
475
- };
476
- };
477
-
478
- var CstyleBehaviour = function() {
479
- this.add("braces", "insertion", function(state, action, editor, session, text) {
480
- var cursor = editor.getCursorPosition();
481
- var line = session.doc.getLine(cursor.row);
482
- if (text == '{') {
483
- initContext(editor);
484
- var selection = editor.getSelectionRange();
485
- var selected = session.doc.getTextRange(selection);
486
- if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
487
- return {
488
- text: '{' + selected + '}',
489
- selection: false
490
- };
491
- } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
492
- if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
493
- CstyleBehaviour.recordAutoInsert(editor, session, "}");
494
- return {
495
- text: '{}',
496
- selection: [1, 1]
497
- };
498
- } else {
499
- CstyleBehaviour.recordMaybeInsert(editor, session, "{");
500
- return {
501
- text: '{',
502
- selection: [1, 1]
503
- };
504
- }
505
- }
506
- } else if (text == '}') {
507
- initContext(editor);
508
- var rightChar = line.substring(cursor.column, cursor.column + 1);
509
- if (rightChar == '}') {
510
- var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
511
- if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
512
- CstyleBehaviour.popAutoInsertedClosing();
513
- return {
514
- text: '',
515
- selection: [1, 1]
516
- };
517
- }
518
- }
519
- } else if (text == "\n" || text == "\r\n") {
520
- initContext(editor);
521
- var closing = "";
522
- if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
523
- closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
524
- CstyleBehaviour.clearMaybeInsertedClosing();
525
- }
526
- var rightChar = line.substring(cursor.column, cursor.column + 1);
527
- if (rightChar === '}') {
528
- var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
529
- if (!openBracePos)
530
- return null;
531
- var next_indent = this.$getIndent(session.getLine(openBracePos.row));
532
- } else if (closing) {
533
- var next_indent = this.$getIndent(line);
534
- } else {
535
- CstyleBehaviour.clearMaybeInsertedClosing();
536
- return;
537
- }
538
- var indent = next_indent + session.getTabString();
539
-
540
- return {
541
- text: '\n' + indent + '\n' + next_indent + closing,
542
- selection: [1, indent.length, 1, indent.length]
543
- };
544
- } else {
545
- CstyleBehaviour.clearMaybeInsertedClosing();
546
- }
547
- });
548
-
549
- this.add("braces", "deletion", function(state, action, editor, session, range) {
550
- var selected = session.doc.getTextRange(range);
551
- if (!range.isMultiLine() && selected == '{') {
552
- initContext(editor);
553
- var line = session.doc.getLine(range.start.row);
554
- var rightChar = line.substring(range.end.column, range.end.column + 1);
555
- if (rightChar == '}') {
556
- range.end.column++;
557
- return range;
558
- } else {
559
- context.maybeInsertedBrackets--;
560
- }
561
- }
562
- });
563
-
564
- this.add("parens", "insertion", function(state, action, editor, session, text) {
565
- if (text == '(') {
566
- initContext(editor);
567
- var selection = editor.getSelectionRange();
568
- var selected = session.doc.getTextRange(selection);
569
- if (selected !== "" && editor.getWrapBehavioursEnabled()) {
570
- return {
571
- text: '(' + selected + ')',
572
- selection: false
573
- };
574
- } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
575
- CstyleBehaviour.recordAutoInsert(editor, session, ")");
576
- return {
577
- text: '()',
578
- selection: [1, 1]
579
- };
580
- }
581
- } else if (text == ')') {
582
- initContext(editor);
583
- var cursor = editor.getCursorPosition();
584
- var line = session.doc.getLine(cursor.row);
585
- var rightChar = line.substring(cursor.column, cursor.column + 1);
586
- if (rightChar == ')') {
587
- var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
588
- if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
589
- CstyleBehaviour.popAutoInsertedClosing();
590
- return {
591
- text: '',
592
- selection: [1, 1]
593
- };
594
- }
595
- }
596
- }
597
- });
598
-
599
- this.add("parens", "deletion", function(state, action, editor, session, range) {
600
- var selected = session.doc.getTextRange(range);
601
- if (!range.isMultiLine() && selected == '(') {
602
- initContext(editor);
603
- var line = session.doc.getLine(range.start.row);
604
- var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
605
- if (rightChar == ')') {
606
- range.end.column++;
607
- return range;
608
- }
609
- }
610
- });
611
-
612
- this.add("brackets", "insertion", function(state, action, editor, session, text) {
613
- if (text == '[') {
614
- initContext(editor);
615
- var selection = editor.getSelectionRange();
616
- var selected = session.doc.getTextRange(selection);
617
- if (selected !== "" && editor.getWrapBehavioursEnabled()) {
618
- return {
619
- text: '[' + selected + ']',
620
- selection: false
621
- };
622
- } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
623
- CstyleBehaviour.recordAutoInsert(editor, session, "]");
624
- return {
625
- text: '[]',
626
- selection: [1, 1]
627
- };
628
- }
629
- } else if (text == ']') {
630
- initContext(editor);
631
- var cursor = editor.getCursorPosition();
632
- var line = session.doc.getLine(cursor.row);
633
- var rightChar = line.substring(cursor.column, cursor.column + 1);
634
- if (rightChar == ']') {
635
- var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
636
- if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
637
- CstyleBehaviour.popAutoInsertedClosing();
638
- return {
639
- text: '',
640
- selection: [1, 1]
641
- };
642
- }
643
- }
644
- }
645
- });
646
-
647
- this.add("brackets", "deletion", function(state, action, editor, session, range) {
648
- var selected = session.doc.getTextRange(range);
649
- if (!range.isMultiLine() && selected == '[') {
650
- initContext(editor);
651
- var line = session.doc.getLine(range.start.row);
652
- var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
653
- if (rightChar == ']') {
654
- range.end.column++;
655
- return range;
656
- }
657
- }
658
- });
659
-
660
- this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
661
- if (text == '"' || text == "'") {
662
- initContext(editor);
663
- var quote = text;
664
- var selection = editor.getSelectionRange();
665
- var selected = session.doc.getTextRange(selection);
666
- if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
667
- return {
668
- text: quote + selected + quote,
669
- selection: false
670
- };
671
- } else if (!selected) {
672
- var cursor = editor.getCursorPosition();
673
- var line = session.doc.getLine(cursor.row);
674
- var leftChar = line.substring(cursor.column-1, cursor.column);
675
- var rightChar = line.substring(cursor.column, cursor.column + 1);
676
-
677
- var token = session.getTokenAt(cursor.row, cursor.column);
678
- var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
679
- if (leftChar == "\\" && token && /escape/.test(token.type))
680
- return null;
681
-
682
- var stringBefore = token && /string/.test(token.type);
683
- var stringAfter = !rightToken || /string/.test(rightToken.type);
684
-
685
- var pair;
686
- if (rightChar == quote) {
687
- pair = stringBefore !== stringAfter;
688
- } else {
689
- if (stringBefore && !stringAfter)
690
- return null; // wrap string with different quote
691
- if (stringBefore && stringAfter)
692
- return null; // do not pair quotes inside strings
693
- var wordRe = session.$mode.tokenRe;
694
- wordRe.lastIndex = 0;
695
- var isWordBefore = wordRe.test(leftChar);
696
- wordRe.lastIndex = 0;
697
- var isWordAfter = wordRe.test(leftChar);
698
- if (isWordBefore || isWordAfter)
699
- return null; // before or after alphanumeric
700
- if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
701
- return null; // there is rightChar and it isn't closing
702
- pair = true;
703
- }
704
- return {
705
- text: pair ? quote + quote : "",
706
- selection: [1,1]
707
- };
708
- }
709
- }
710
- });
711
-
712
- this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
713
- var selected = session.doc.getTextRange(range);
714
- if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
715
- initContext(editor);
716
- var line = session.doc.getLine(range.start.row);
717
- var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
718
- if (rightChar == selected) {
719
- range.end.column++;
720
- return range;
721
- }
722
- }
723
- });
724
-
725
- };
726
-
727
-
728
- CstyleBehaviour.isSaneInsertion = function(editor, session) {
729
- var cursor = editor.getCursorPosition();
730
- var iterator = new TokenIterator(session, cursor.row, cursor.column);
731
- if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
732
- var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
733
- if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
734
- return false;
735
- }
736
- iterator.stepForward();
737
- return iterator.getCurrentTokenRow() !== cursor.row ||
738
- this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
739
- };
740
-
741
- CstyleBehaviour.$matchTokenType = function(token, types) {
742
- return types.indexOf(token.type || token) > -1;
743
- };
744
-
745
- CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
746
- var cursor = editor.getCursorPosition();
747
- var line = session.doc.getLine(cursor.row);
748
- if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
749
- context.autoInsertedBrackets = 0;
750
- context.autoInsertedRow = cursor.row;
751
- context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
752
- context.autoInsertedBrackets++;
753
- };
754
-
755
- CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
756
- var cursor = editor.getCursorPosition();
757
- var line = session.doc.getLine(cursor.row);
758
- if (!this.isMaybeInsertedClosing(cursor, line))
759
- context.maybeInsertedBrackets = 0;
760
- context.maybeInsertedRow = cursor.row;
761
- context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
762
- context.maybeInsertedLineEnd = line.substr(cursor.column);
763
- context.maybeInsertedBrackets++;
764
- };
765
-
766
- CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
767
- return context.autoInsertedBrackets > 0 &&
768
- cursor.row === context.autoInsertedRow &&
769
- bracket === context.autoInsertedLineEnd[0] &&
770
- line.substr(cursor.column) === context.autoInsertedLineEnd;
771
- };
772
-
773
- CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
774
- return context.maybeInsertedBrackets > 0 &&
775
- cursor.row === context.maybeInsertedRow &&
776
- line.substr(cursor.column) === context.maybeInsertedLineEnd &&
777
- line.substr(0, cursor.column) == context.maybeInsertedLineStart;
778
- };
779
-
780
- CstyleBehaviour.popAutoInsertedClosing = function() {
781
- context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
782
- context.autoInsertedBrackets--;
783
- };
784
-
785
- CstyleBehaviour.clearMaybeInsertedClosing = function() {
786
- if (context) {
787
- context.maybeInsertedBrackets = 0;
788
- context.maybeInsertedRow = -1;
789
- }
790
- };
791
-
792
-
793
-
794
- oop.inherits(CstyleBehaviour, Behaviour);
795
-
796
- exports.CstyleBehaviour = CstyleBehaviour;
797
- });
798
-
799
- define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
800
- "use strict";
801
-
802
- var oop = require("../../lib/oop");
803
- var Range = require("../../range").Range;
804
- var BaseFoldMode = require("./fold_mode").FoldMode;
805
-
806
- var FoldMode = exports.FoldMode = function(commentRegex) {
807
- if (commentRegex) {
808
- this.foldingStartMarker = new RegExp(
809
- this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
810
- );
811
- this.foldingStopMarker = new RegExp(
812
- this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
813
- );
814
- }
815
- };
816
- oop.inherits(FoldMode, BaseFoldMode);
817
-
818
- (function() {
819
-
820
- this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
821
- this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
822
- this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
823
- this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
824
- this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
825
- this._getFoldWidgetBase = this.getFoldWidget;
826
- this.getFoldWidget = function(session, foldStyle, row) {
827
- var line = session.getLine(row);
828
-
829
- if (this.singleLineBlockCommentRe.test(line)) {
830
- if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
831
- return "";
832
- }
833
-
834
- var fw = this._getFoldWidgetBase(session, foldStyle, row);
835
-
836
- if (!fw && this.startRegionRe.test(line))
837
- return "start"; // lineCommentRegionStart
838
-
839
- return fw;
840
- };
841
-
842
- this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
843
- var line = session.getLine(row);
844
-
845
- if (this.startRegionRe.test(line))
846
- return this.getCommentRegionBlock(session, line, row);
847
-
848
- var match = line.match(this.foldingStartMarker);
849
- if (match) {
850
- var i = match.index;
851
-
852
- if (match[1])
853
- return this.openingBracketBlock(session, match[1], row, i);
854
-
855
- var range = session.getCommentFoldRange(row, i + match[0].length, 1);
856
-
857
- if (range && !range.isMultiLine()) {
858
- if (forceMultiline) {
859
- range = this.getSectionRange(session, row);
860
- } else if (foldStyle != "all")
861
- range = null;
862
- }
863
-
864
- return range;
865
- }
866
-
867
- if (foldStyle === "markbegin")
868
- return;
869
-
870
- var match = line.match(this.foldingStopMarker);
871
- if (match) {
872
- var i = match.index + match[0].length;
873
-
874
- if (match[1])
875
- return this.closingBracketBlock(session, match[1], row, i);
876
-
877
- return session.getCommentFoldRange(row, i, -1);
878
- }
879
- };
880
-
881
- this.getSectionRange = function(session, row) {
882
- var line = session.getLine(row);
883
- var startIndent = line.search(/\S/);
884
- var startRow = row;
885
- var startColumn = line.length;
886
- row = row + 1;
887
- var endRow = row;
888
- var maxRow = session.getLength();
889
- while (++row < maxRow) {
890
- line = session.getLine(row);
891
- var indent = line.search(/\S/);
892
- if (indent === -1)
893
- continue;
894
- if (startIndent > indent)
895
- break;
896
- var subRange = this.getFoldWidgetRange(session, "all", row);
897
-
898
- if (subRange) {
899
- if (subRange.start.row <= startRow) {
900
- break;
901
- } else if (subRange.isMultiLine()) {
902
- row = subRange.end.row;
903
- } else if (startIndent == indent) {
904
- break;
905
- }
906
- }
907
- endRow = row;
908
- }
909
-
910
- return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
911
- };
912
-
913
- this.getCommentRegionBlock = function(session, line, row) {
914
- var startColumn = line.search(/\s*$/);
915
- var maxRow = session.getLength();
916
- var startRow = row;
917
-
918
- var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
919
- var depth = 1;
920
- while (++row < maxRow) {
921
- line = session.getLine(row);
922
- var m = re.exec(line);
923
- if (!m) continue;
924
- if (m[1]) depth--;
925
- else depth++;
926
-
927
- if (!depth) break;
928
- }
929
-
930
- var endRow = row;
931
- if (endRow > startRow) {
932
- return new Range(startRow, startColumn, endRow, line.length);
933
- }
934
- };
935
-
936
- }).call(FoldMode.prototype);
937
-
938
- });
939
-
940
- define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
941
- "use strict";
942
-
943
- var oop = require("../lib/oop");
944
- var TextMode = require("./text").Mode;
945
- var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
946
- var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
947
- var Range = require("../range").Range;
948
- var WorkerClient = require("../worker/worker_client").WorkerClient;
949
- var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
950
- var CStyleFoldMode = require("./folding/cstyle").FoldMode;
951
-
952
- var Mode = function() {
953
- this.HighlightRules = JavaScriptHighlightRules;
954
-
955
- this.$outdent = new MatchingBraceOutdent();
956
- this.$behaviour = new CstyleBehaviour();
957
- this.foldingRules = new CStyleFoldMode();
958
- };
959
- oop.inherits(Mode, TextMode);
960
-
961
- (function() {
962
-
963
- this.lineCommentStart = "//";
964
- this.blockComment = {start: "/*", end: "*/"};
965
-
966
- this.getNextLineIndent = function(state, line, tab) {
967
- var indent = this.$getIndent(line);
968
-
969
- var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
970
- var tokens = tokenizedLine.tokens;
971
- var endState = tokenizedLine.state;
972
-
973
- if (tokens.length && tokens[tokens.length-1].type == "comment") {
974
- return indent;
975
- }
976
-
977
- if (state == "start" || state == "no_regex") {
978
- var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
979
- if (match) {
980
- indent += tab;
981
- }
982
- } else if (state == "doc-start") {
983
- if (endState == "start" || endState == "no_regex") {
984
- return "";
985
- }
986
- var match = line.match(/^\s*(\/?)\*/);
987
- if (match) {
988
- if (match[1]) {
989
- indent += " ";
990
- }
991
- indent += "* ";
992
- }
993
- }
994
-
995
- return indent;
996
- };
997
-
998
- this.checkOutdent = function(state, line, input) {
999
- return this.$outdent.checkOutdent(line, input);
1000
- };
1001
-
1002
- this.autoOutdent = function(state, doc, row) {
1003
- this.$outdent.autoOutdent(doc, row);
1004
- };
1005
-
1006
- this.createWorker = function(session) {
1007
- var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
1008
- worker.attachToDocument(session.getDocument());
1009
-
1010
- worker.on("annotate", function(results) {
1011
- session.setAnnotations(results.data);
1012
- });
1013
-
1014
- worker.on("terminate", function() {
1015
- session.clearAnnotations();
1016
- });
1017
-
1018
- return worker;
1019
- };
1020
-
1021
- this.$id = "ace/mode/javascript";
1022
- }).call(Mode.prototype);
1023
-
1024
- exports.Mode = Mode;
1025
- });
1026
-
1027
- define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
1028
- "use strict";
1029
-
1030
- var oop = require("../lib/oop");
1031
- var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1032
-
1033
- var XmlHighlightRules = function(normalize) {
1034
-
1035
- var tagRegex = "[a-zA-Z][-_a-zA-Z0-9]*";
1036
-
1037
- this.$rules = {
1038
- start : [
1039
- {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
1040
- {
1041
- token : ["punctuation.xml-decl.xml", "keyword.xml-decl.xml"],
1042
- regex : "(<\\?)(xml)(?=[\\s])", next : "xml_decl", caseInsensitive: true
1043
- },
1044
- {
1045
- token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
1046
- regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction",
1047
- },
1048
- {token : "comment.xml", regex : "<\\!--", next : "comment"},
1049
- {
1050
- token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
1051
- regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
1052
- },
1053
- {include : "tag"},
1054
- {token : "text.end-tag-open.xml", regex: "</"},
1055
- {token : "text.tag-open.xml", regex: "<"},
1056
- {include : "reference"},
1057
- {defaultToken : "text.xml"}
1058
- ],
1059
-
1060
- xml_decl : [{
1061
- token : "entity.other.attribute-name.decl-attribute-name.xml",
1062
- regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
1063
- }, {
1064
- token : "keyword.operator.decl-attribute-equals.xml",
1065
- regex : "="
1066
- }, {
1067
- include: "whitespace"
1068
- }, {
1069
- include: "string"
1070
- }, {
1071
- token : "punctuation.xml-decl.xml",
1072
- regex : "\\?>",
1073
- next : "start"
1074
- }],
1075
-
1076
- processing_instruction : [
1077
- {token : "punctuation.instruction.xml", regex : "\\?>", next : "start"},
1078
- {defaultToken : "instruction.xml"}
1079
- ],
1080
-
1081
- doctype : [
1082
- {include : "whitespace"},
1083
- {include : "string"},
1084
- {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
1085
- {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
1086
- {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
1087
- ],
1088
-
1089
- int_subset : [{
1090
- token : "text.xml",
1091
- regex : "\\s+"
1092
- }, {
1093
- token: "punctuation.int-subset.xml",
1094
- regex: "]",
1095
- next: "pop"
1096
- }, {
1097
- token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
1098
- regex : "(<\\!)(" + tagRegex + ")",
1099
- push : [{
1100
- token : "text",
1101
- regex : "\\s+"
1102
- },
1103
- {
1104
- token : "punctuation.markup-decl.xml",
1105
- regex : ">",
1106
- next : "pop"
1107
- },
1108
- {include : "string"}]
1109
- }],
1110
-
1111
- cdata : [
1112
- {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
1113
- {token : "text.xml", regex : "\\s+"},
1114
- {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
1115
- ],
1116
-
1117
- comment : [
1118
- {token : "comment.xml", regex : "-->", next : "start"},
1119
- {defaultToken : "comment.xml"}
1120
- ],
1121
-
1122
- reference : [{
1123
- token : "constant.language.escape.reference.xml",
1124
- regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1125
- }],
1126
-
1127
- attr_reference : [{
1128
- token : "constant.language.escape.reference.attribute-value.xml",
1129
- regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1130
- }],
1131
-
1132
- tag : [{
1133
- token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
1134
- regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
1135
- next: [
1136
- {include : "attributes"},
1137
- {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
1138
- ]
1139
- }],
1140
-
1141
- tag_whitespace : [
1142
- {token : "text.tag-whitespace.xml", regex : "\\s+"}
1143
- ],
1144
- whitespace : [
1145
- {token : "text.whitespace.xml", regex : "\\s+"}
1146
- ],
1147
- string: [{
1148
- token : "string.xml",
1149
- regex : "'",
1150
- push : [
1151
- {token : "string.xml", regex: "'", next: "pop"},
1152
- {defaultToken : "string.xml"}
1153
- ]
1154
- }, {
1155
- token : "string.xml",
1156
- regex : '"',
1157
- push : [
1158
- {token : "string.xml", regex: '"', next: "pop"},
1159
- {defaultToken : "string.xml"}
1160
- ]
1161
- }],
1162
-
1163
- attributes: [{
1164
- token : "entity.other.attribute-name.xml",
1165
- regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
1166
- }, {
1167
- token : "keyword.operator.attribute-equals.xml",
1168
- regex : "="
1169
- }, {
1170
- include: "tag_whitespace"
1171
- }, {
1172
- include: "attribute_value"
1173
- }],
1174
-
1175
- attribute_value: [{
1176
- token : "string.attribute-value.xml",
1177
- regex : "'",
1178
- push : [
1179
- {token : "string.attribute-value.xml", regex: "'", next: "pop"},
1180
- {include : "attr_reference"},
1181
- {defaultToken : "string.attribute-value.xml"}
1182
- ]
1183
- }, {
1184
- token : "string.attribute-value.xml",
1185
- regex : '"',
1186
- push : [
1187
- {token : "string.attribute-value.xml", regex: '"', next: "pop"},
1188
- {include : "attr_reference"},
1189
- {defaultToken : "string.attribute-value.xml"}
1190
- ]
1191
- }]
1192
- };
1193
-
1194
- if (this.constructor === XmlHighlightRules)
1195
- this.normalizeRules();
1196
- };
1197
-
1198
-
1199
- (function() {
1200
-
1201
- this.embedTagRules = function(HighlightRules, prefix, tag){
1202
- this.$rules.tag.unshift({
1203
- token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
1204
- regex : "(<)(" + tag + "(?=\\s|>|$))",
1205
- next: [
1206
- {include : "attributes"},
1207
- {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
1208
- ]
1209
- });
1210
-
1211
- this.$rules[tag + "-end"] = [
1212
- {include : "attributes"},
1213
- {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
1214
- onMatch : function(value, currentState, stack) {
1215
- stack.splice(0);
1216
- return this.token;
1217
- }}
1218
- ]
1219
-
1220
- this.embedRules(HighlightRules, prefix, [{
1221
- token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
1222
- regex : "(</)(" + tag + "(?=\\s|>|$))",
1223
- next: tag + "-end"
1224
- }, {
1225
- token: "string.cdata.xml",
1226
- regex : "<\\!\\[CDATA\\["
1227
- }, {
1228
- token: "string.cdata.xml",
1229
- regex : "\\]\\]>"
1230
- }]);
1231
- };
1232
-
1233
- }).call(TextHighlightRules.prototype);
1234
-
1235
- oop.inherits(XmlHighlightRules, TextHighlightRules);
1236
-
1237
- exports.XmlHighlightRules = XmlHighlightRules;
1238
- });
1239
-
1240
- define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
1241
- "use strict";
1242
-
1243
- var oop = require("../../lib/oop");
1244
- var Behaviour = require("../behaviour").Behaviour;
1245
- var TokenIterator = require("../../token_iterator").TokenIterator;
1246
- var lang = require("../../lib/lang");
1247
-
1248
- function is(token, type) {
1249
- return token.type.lastIndexOf(type + ".xml") > -1;
1250
- }
1251
-
1252
- var XmlBehaviour = function () {
1253
-
1254
- this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
1255
- if (text == '"' || text == "'") {
1256
- var quote = text;
1257
- var selected = session.doc.getTextRange(editor.getSelectionRange());
1258
- if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
1259
- return {
1260
- text: quote + selected + quote,
1261
- selection: false
1262
- };
1263
- }
1264
-
1265
- var cursor = editor.getCursorPosition();
1266
- var line = session.doc.getLine(cursor.row);
1267
- var rightChar = line.substring(cursor.column, cursor.column + 1);
1268
- var iterator = new TokenIterator(session, cursor.row, cursor.column);
1269
- var token = iterator.getCurrentToken();
1270
-
1271
- if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
1272
- return {
1273
- text: "",
1274
- selection: [1, 1]
1275
- };
1276
- }
1277
-
1278
- if (!token)
1279
- token = iterator.stepBackward();
1280
-
1281
- if (!token)
1282
- return;
1283
-
1284
- while (is(token, "tag-whitespace") || is(token, "whitespace")) {
1285
- token = iterator.stepBackward();
1286
- }
1287
- var rightSpace = !rightChar || rightChar.match(/\s/);
1288
- if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
1289
- return {
1290
- text: quote + quote,
1291
- selection: [1, 1]
1292
- };
1293
- }
1294
- }
1295
- });
1296
-
1297
- this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
1298
- var selected = session.doc.getTextRange(range);
1299
- if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
1300
- var line = session.doc.getLine(range.start.row);
1301
- var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1302
- if (rightChar == selected) {
1303
- range.end.column++;
1304
- return range;
1305
- }
1306
- }
1307
- });
1308
-
1309
- this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
1310
- if (text == '>') {
1311
- var position = editor.getCursorPosition();
1312
- var iterator = new TokenIterator(session, position.row, position.column);
1313
- var token = iterator.getCurrentToken() || iterator.stepBackward();
1314
- if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
1315
- return;
1316
- if (is(token, "reference.attribute-value"))
1317
- return;
1318
- if (is(token, "attribute-value")) {
1319
- var firstChar = token.value.charAt(0);
1320
- if (firstChar == '"' || firstChar == "'") {
1321
- var lastChar = token.value.charAt(token.value.length - 1);
1322
- var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length;
1323
- if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar)
1324
- return;
1325
- }
1326
- }
1327
- while (!is(token, "tag-name")) {
1328
- token = iterator.stepBackward();
1329
- }
1330
-
1331
- var tokenRow = iterator.getCurrentTokenRow();
1332
- var tokenColumn = iterator.getCurrentTokenColumn();
1333
- if (is(iterator.stepBackward(), "end-tag-open"))
1334
- return;
1335
-
1336
- var element = token.value;
1337
- if (tokenRow == position.row)
1338
- element = element.substring(0, position.column - tokenColumn);
1339
-
1340
- if (this.voidElements.hasOwnProperty(element.toLowerCase()))
1341
- return;
1342
-
1343
- return {
1344
- text: ">" + "</" + element + ">",
1345
- selection: [1, 1]
1346
- };
1347
- }
1348
- });
1349
-
1350
- this.add("autoindent", "insertion", function (state, action, editor, session, text) {
1351
- if (text == "\n") {
1352
- var cursor = editor.getCursorPosition();
1353
- var line = session.getLine(cursor.row);
1354
- var iterator = new TokenIterator(session, cursor.row, cursor.column);
1355
- var token = iterator.getCurrentToken();
1356
-
1357
- if (token && token.type.indexOf("tag-close") !== -1) {
1358
- if (token.value == "/>")
1359
- return;
1360
- while (token && token.type.indexOf("tag-name") === -1) {
1361
- token = iterator.stepBackward();
1362
- }
1363
-
1364
- if (!token) {
1365
- return;
1366
- }
1367
-
1368
- var tag = token.value;
1369
- var row = iterator.getCurrentTokenRow();
1370
- token = iterator.stepBackward();
1371
- if (!token || token.type.indexOf("end-tag") !== -1) {
1372
- return;
1373
- }
1374
-
1375
- if (this.voidElements && !this.voidElements[tag]) {
1376
- var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
1377
- var line = session.getLine(row);
1378
- var nextIndent = this.$getIndent(line);
1379
- var indent = nextIndent + session.getTabString();
1380
-
1381
- if (nextToken && nextToken.value === "</") {
1382
- return {
1383
- text: "\n" + indent + "\n" + nextIndent,
1384
- selection: [1, indent.length, 1, indent.length]
1385
- };
1386
- } else {
1387
- return {
1388
- text: "\n" + indent
1389
- };
1390
- }
1391
- }
1392
- }
1393
- }
1394
- });
1395
-
1396
- };
1397
-
1398
- oop.inherits(XmlBehaviour, Behaviour);
1399
-
1400
- exports.XmlBehaviour = XmlBehaviour;
1401
- });
1402
-
1403
- 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(require, exports, module) {
1404
- "use strict";
1405
-
1406
- var oop = require("../../lib/oop");
1407
- var lang = require("../../lib/lang");
1408
- var Range = require("../../range").Range;
1409
- var BaseFoldMode = require("./fold_mode").FoldMode;
1410
- var TokenIterator = require("../../token_iterator").TokenIterator;
1411
-
1412
- var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
1413
- BaseFoldMode.call(this);
1414
- this.voidElements = voidElements || {};
1415
- this.optionalEndTags = oop.mixin({}, this.voidElements);
1416
- if (optionalEndTags)
1417
- oop.mixin(this.optionalEndTags, optionalEndTags);
1418
-
1419
- };
1420
- oop.inherits(FoldMode, BaseFoldMode);
1421
-
1422
- var Tag = function() {
1423
- this.tagName = "";
1424
- this.closing = false;
1425
- this.selfClosing = false;
1426
- this.start = {row: 0, column: 0};
1427
- this.end = {row: 0, column: 0};
1428
- };
1429
-
1430
- function is(token, type) {
1431
- return token.type.lastIndexOf(type + ".xml") > -1;
1432
- }
1433
-
1434
- (function() {
1435
-
1436
- this.getFoldWidget = function(session, foldStyle, row) {
1437
- var tag = this._getFirstTagInLine(session, row);
1438
-
1439
- if (!tag)
1440
- return "";
1441
-
1442
- if (tag.closing || (!tag.tagName && tag.selfClosing))
1443
- return foldStyle == "markbeginend" ? "end" : "";
1444
-
1445
- if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
1446
- return "";
1447
-
1448
- if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
1449
- return "";
1450
-
1451
- return "start";
1452
- };
1453
- this._getFirstTagInLine = function(session, row) {
1454
- var tokens = session.getTokens(row);
1455
- var tag = new Tag();
1456
-
1457
- for (var i = 0; i < tokens.length; i++) {
1458
- var token = tokens[i];
1459
- if (is(token, "tag-open")) {
1460
- tag.end.column = tag.start.column + token.value.length;
1461
- tag.closing = is(token, "end-tag-open");
1462
- token = tokens[++i];
1463
- if (!token)
1464
- return null;
1465
- tag.tagName = token.value;
1466
- tag.end.column += token.value.length;
1467
- for (i++; i < tokens.length; i++) {
1468
- token = tokens[i];
1469
- tag.end.column += token.value.length;
1470
- if (is(token, "tag-close")) {
1471
- tag.selfClosing = token.value == '/>';
1472
- break;
1473
- }
1474
- }
1475
- return tag;
1476
- } else if (is(token, "tag-close")) {
1477
- tag.selfClosing = token.value == '/>';
1478
- return tag;
1479
- }
1480
- tag.start.column += token.value.length;
1481
- }
1482
-
1483
- return null;
1484
- };
1485
-
1486
- this._findEndTagInLine = function(session, row, tagName, startColumn) {
1487
- var tokens = session.getTokens(row);
1488
- var column = 0;
1489
- for (var i = 0; i < tokens.length; i++) {
1490
- var token = tokens[i];
1491
- column += token.value.length;
1492
- if (column < startColumn)
1493
- continue;
1494
- if (is(token, "end-tag-open")) {
1495
- token = tokens[i + 1];
1496
- if (token && token.value == tagName)
1497
- return true;
1498
- }
1499
- }
1500
- return false;
1501
- };
1502
- this._readTagForward = function(iterator) {
1503
- var token = iterator.getCurrentToken();
1504
- if (!token)
1505
- return null;
1506
-
1507
- var tag = new Tag();
1508
- do {
1509
- if (is(token, "tag-open")) {
1510
- tag.closing = is(token, "end-tag-open");
1511
- tag.start.row = iterator.getCurrentTokenRow();
1512
- tag.start.column = iterator.getCurrentTokenColumn();
1513
- } else if (is(token, "tag-name")) {
1514
- tag.tagName = token.value;
1515
- } else if (is(token, "tag-close")) {
1516
- tag.selfClosing = token.value == "/>";
1517
- tag.end.row = iterator.getCurrentTokenRow();
1518
- tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
1519
- iterator.stepForward();
1520
- return tag;
1521
- }
1522
- } while(token = iterator.stepForward());
1523
-
1524
- return null;
1525
- };
1526
-
1527
- this._readTagBackward = function(iterator) {
1528
- var token = iterator.getCurrentToken();
1529
- if (!token)
1530
- return null;
1531
-
1532
- var tag = new Tag();
1533
- do {
1534
- if (is(token, "tag-open")) {
1535
- tag.closing = is(token, "end-tag-open");
1536
- tag.start.row = iterator.getCurrentTokenRow();
1537
- tag.start.column = iterator.getCurrentTokenColumn();
1538
- iterator.stepBackward();
1539
- return tag;
1540
- } else if (is(token, "tag-name")) {
1541
- tag.tagName = token.value;
1542
- } else if (is(token, "tag-close")) {
1543
- tag.selfClosing = token.value == "/>";
1544
- tag.end.row = iterator.getCurrentTokenRow();
1545
- tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
1546
- }
1547
- } while(token = iterator.stepBackward());
1548
-
1549
- return null;
1550
- };
1551
-
1552
- this._pop = function(stack, tag) {
1553
- while (stack.length) {
1554
-
1555
- var top = stack[stack.length-1];
1556
- if (!tag || top.tagName == tag.tagName) {
1557
- return stack.pop();
1558
- }
1559
- else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
1560
- stack.pop();
1561
- continue;
1562
- } else {
1563
- return null;
1564
- }
1565
- }
1566
- };
1567
-
1568
- this.getFoldWidgetRange = function(session, foldStyle, row) {
1569
- var firstTag = this._getFirstTagInLine(session, row);
1570
-
1571
- if (!firstTag)
1572
- return null;
1573
-
1574
- var isBackward = firstTag.closing || firstTag.selfClosing;
1575
- var stack = [];
1576
- var tag;
1577
-
1578
- if (!isBackward) {
1579
- var iterator = new TokenIterator(session, row, firstTag.start.column);
1580
- var start = {
1581
- row: row,
1582
- column: firstTag.start.column + firstTag.tagName.length + 2
1583
- };
1584
- if (firstTag.start.row == firstTag.end.row)
1585
- start.column = firstTag.end.column;
1586
- while (tag = this._readTagForward(iterator)) {
1587
- if (tag.selfClosing) {
1588
- if (!stack.length) {
1589
- tag.start.column += tag.tagName.length + 2;
1590
- tag.end.column -= 2;
1591
- return Range.fromPoints(tag.start, tag.end);
1592
- } else
1593
- continue;
1594
- }
1595
-
1596
- if (tag.closing) {
1597
- this._pop(stack, tag);
1598
- if (stack.length == 0)
1599
- return Range.fromPoints(start, tag.start);
1600
- }
1601
- else {
1602
- stack.push(tag);
1603
- }
1604
- }
1605
- }
1606
- else {
1607
- var iterator = new TokenIterator(session, row, firstTag.end.column);
1608
- var end = {
1609
- row: row,
1610
- column: firstTag.start.column
1611
- };
1612
-
1613
- while (tag = this._readTagBackward(iterator)) {
1614
- if (tag.selfClosing) {
1615
- if (!stack.length) {
1616
- tag.start.column += tag.tagName.length + 2;
1617
- tag.end.column -= 2;
1618
- return Range.fromPoints(tag.start, tag.end);
1619
- } else
1620
- continue;
1621
- }
1622
-
1623
- if (!tag.closing) {
1624
- this._pop(stack, tag);
1625
- if (stack.length == 0) {
1626
- tag.start.column += tag.tagName.length + 2;
1627
- if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
1628
- tag.start.column = tag.end.column;
1629
- return Range.fromPoints(tag.start, end);
1630
- }
1631
- }
1632
- else {
1633
- stack.push(tag);
1634
- }
1635
- }
1636
- }
1637
-
1638
- };
1639
-
1640
- }).call(FoldMode.prototype);
1641
-
1642
- });
1643
-
1644
- 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(require, exports, module) {
1645
- "use strict";
1646
-
1647
- var oop = require("../lib/oop");
1648
- var lang = require("../lib/lang");
1649
- var TextMode = require("./text").Mode;
1650
- var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1651
- var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
1652
- var XmlFoldMode = require("./folding/xml").FoldMode;
1653
- var WorkerClient = require("../worker/worker_client").WorkerClient;
1654
-
1655
- var Mode = function() {
1656
- this.HighlightRules = XmlHighlightRules;
1657
- this.$behaviour = new XmlBehaviour();
1658
- this.foldingRules = new XmlFoldMode();
1659
- };
1660
-
1661
- oop.inherits(Mode, TextMode);
1662
-
1663
- (function() {
1664
-
1665
- this.voidElements = lang.arrayToMap([]);
1666
-
1667
- this.blockComment = {start: "<!--", end: "-->"};
1668
-
1669
- this.createWorker = function(session) {
1670
- var worker = new WorkerClient(["ace"], "ace/mode/xml_worker", "Worker");
1671
- worker.attachToDocument(session.getDocument());
1672
-
1673
- worker.on("error", function(e) {
1674
- session.setAnnotations(e.data);
1675
- });
1676
-
1677
- worker.on("terminate", function() {
1678
- session.clearAnnotations();
1679
- });
1680
-
1681
- return worker;
1682
- };
1683
-
1684
- this.$id = "ace/mode/xml";
1685
- }).call(Mode.prototype);
1686
-
1687
- exports.Mode = Mode;
1688
- });
1689
-
1690
- define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
1691
- "use strict";
1692
-
1693
- var oop = require("../lib/oop");
1694
- var lang = require("../lib/lang");
1695
- var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1696
- var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|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|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|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|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
1697
- var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
1698
- 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";
1699
- var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
1700
- 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";
1701
-
1702
- var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
1703
- var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
1704
- 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|required|root|target|valid|visited)\\b";
1705
-
1706
- var CssHighlightRules = function() {
1707
-
1708
- var keywordMapper = this.createKeywordMapper({
1709
- "support.function": supportFunction,
1710
- "support.constant": supportConstant,
1711
- "support.type": supportType,
1712
- "support.constant.color": supportConstantColor,
1713
- "support.constant.fonts": supportConstantFonts
1714
- }, "text", true);
1715
-
1716
- this.$rules = {
1717
- "start" : [{
1718
- token : "comment", // multi line comment
1719
- regex : "\\/\\*",
1720
- push : "comment"
1721
- }, {
1722
- token: "paren.lparen",
1723
- regex: "\\{",
1724
- push: "ruleset"
1725
- }, {
1726
- token: "string",
1727
- regex: "@.*?{",
1728
- push: "media"
1729
- }, {
1730
- token: "keyword",
1731
- regex: "#[a-z0-9-_]+"
1732
- }, {
1733
- token: "variable",
1734
- regex: "\\.[a-z0-9-_]+"
1735
- }, {
1736
- token: "string",
1737
- regex: ":[a-z0-9-_]+"
1738
- }, {
1739
- token: "constant",
1740
- regex: "[a-z0-9-_]+"
1741
- }, {
1742
- caseInsensitive: true
1743
- }],
1744
-
1745
- "media" : [{
1746
- token : "comment", // multi line comment
1747
- regex : "\\/\\*",
1748
- push : "comment"
1749
- }, {
1750
- token: "paren.lparen",
1751
- regex: "\\{",
1752
- push: "ruleset"
1753
- }, {
1754
- token: "string",
1755
- regex: "\\}",
1756
- next: "pop"
1757
- }, {
1758
- token: "keyword",
1759
- regex: "#[a-z0-9-_]+"
1760
- }, {
1761
- token: "variable",
1762
- regex: "\\.[a-z0-9-_]+"
1763
- }, {
1764
- token: "string",
1765
- regex: ":[a-z0-9-_]+"
1766
- }, {
1767
- token: "constant",
1768
- regex: "[a-z0-9-_]+"
1769
- }, {
1770
- caseInsensitive: true
1771
- }],
1772
-
1773
- "comment" : [{
1774
- token : "comment",
1775
- regex : "\\*\\/",
1776
- next : "pop"
1777
- }, {
1778
- defaultToken : "comment"
1779
- }],
1780
-
1781
- "ruleset" : [
1782
- {
1783
- token : "paren.rparen",
1784
- regex : "\\}",
1785
- next: "pop"
1786
- }, {
1787
- token : "comment", // multi line comment
1788
- regex : "\\/\\*",
1789
- push : "comment"
1790
- }, {
1791
- token : "string", // single line
1792
- regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1793
- }, {
1794
- token : "string", // single line
1795
- regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
1796
- }, {
1797
- token : ["constant.numeric", "keyword"],
1798
- 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|%)"
1799
- }, {
1800
- token : "constant.numeric",
1801
- regex : numRe
1802
- }, {
1803
- token : "constant.numeric", // hex6 color
1804
- regex : "#[a-f0-9]{6}"
1805
- }, {
1806
- token : "constant.numeric", // hex3 color
1807
- regex : "#[a-f0-9]{3}"
1808
- }, {
1809
- token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
1810
- regex : pseudoElements
1811
- }, {
1812
- token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
1813
- regex : pseudoClasses
1814
- }, {
1815
- token : ["support.function", "string", "support.function"],
1816
- regex : "(url\\()(.*)(\\))"
1817
- }, {
1818
- token : keywordMapper,
1819
- regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
1820
- }, {
1821
- caseInsensitive: true
1822
- }]
1823
- };
1824
-
1825
- this.normalizeRules();
1826
- };
1827
-
1828
- oop.inherits(CssHighlightRules, TextHighlightRules);
1829
-
1830
- exports.CssHighlightRules = CssHighlightRules;
1831
-
1832
- });
1833
-
1834
- define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module) {
1835
- "use strict";
1836
-
1837
- var oop = require("../../lib/oop");
1838
- var Behaviour = require("../behaviour").Behaviour;
1839
- var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1840
- var TokenIterator = require("../../token_iterator").TokenIterator;
1841
-
1842
- var CssBehaviour = function () {
1843
-
1844
- this.inherit(CstyleBehaviour);
1845
-
1846
- this.add("colon", "insertion", function (state, action, editor, session, text) {
1847
- if (text === ':') {
1848
- var cursor = editor.getCursorPosition();
1849
- var iterator = new TokenIterator(session, cursor.row, cursor.column);
1850
- var token = iterator.getCurrentToken();
1851
- if (token && token.value.match(/\s+/)) {
1852
- token = iterator.stepBackward();
1853
- }
1854
- if (token && token.type === 'support.type') {
1855
- var line = session.doc.getLine(cursor.row);
1856
- var rightChar = line.substring(cursor.column, cursor.column + 1);
1857
- if (rightChar === ':') {
1858
- return {
1859
- text: '',
1860
- selection: [1, 1]
1861
- }
1862
- }
1863
- if (!line.substring(cursor.column).match(/^\s*;/)) {
1864
- return {
1865
- text: ':;',
1866
- selection: [1, 1]
1867
- }
1868
- }
1869
- }
1870
- }
1871
- });
1872
-
1873
- this.add("colon", "deletion", function (state, action, editor, session, range) {
1874
- var selected = session.doc.getTextRange(range);
1875
- if (!range.isMultiLine() && selected === ':') {
1876
- var cursor = editor.getCursorPosition();
1877
- var iterator = new TokenIterator(session, cursor.row, cursor.column);
1878
- var token = iterator.getCurrentToken();
1879
- if (token && token.value.match(/\s+/)) {
1880
- token = iterator.stepBackward();
1881
- }
1882
- if (token && token.type === 'support.type') {
1883
- var line = session.doc.getLine(range.start.row);
1884
- var rightChar = line.substring(range.end.column, range.end.column + 1);
1885
- if (rightChar === ';') {
1886
- range.end.column ++;
1887
- return range;
1888
- }
1889
- }
1890
- }
1891
- });
1892
-
1893
- this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1894
- if (text === ';') {
1895
- var cursor = editor.getCursorPosition();
1896
- var line = session.doc.getLine(cursor.row);
1897
- var rightChar = line.substring(cursor.column, cursor.column + 1);
1898
- if (rightChar === ';') {
1899
- return {
1900
- text: '',
1901
- selection: [1, 1]
1902
- }
1903
- }
1904
- }
1905
- });
1906
-
1907
- }
1908
- oop.inherits(CssBehaviour, CstyleBehaviour);
1909
-
1910
- exports.CssBehaviour = CssBehaviour;
1911
- });
1912
-
1913
- define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
1914
- "use strict";
1915
-
1916
- var oop = require("../lib/oop");
1917
- var TextMode = require("./text").Mode;
1918
- var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1919
- var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1920
- var WorkerClient = require("../worker/worker_client").WorkerClient;
1921
- var CssBehaviour = require("./behaviour/css").CssBehaviour;
1922
- var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1923
-
1924
- var Mode = function() {
1925
- this.HighlightRules = CssHighlightRules;
1926
- this.$outdent = new MatchingBraceOutdent();
1927
- this.$behaviour = new CssBehaviour();
1928
- this.foldingRules = new CStyleFoldMode();
1929
- };
1930
- oop.inherits(Mode, TextMode);
1931
-
1932
- (function() {
1933
-
1934
- this.foldingRules = "cStyle";
1935
- this.blockComment = {start: "/*", end: "*/"};
1936
-
1937
- this.getNextLineIndent = function(state, line, tab) {
1938
- var indent = this.$getIndent(line);
1939
- var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
1940
- if (tokens.length && tokens[tokens.length-1].type == "comment") {
1941
- return indent;
1942
- }
1943
-
1944
- var match = line.match(/^.*\{\s*$/);
1945
- if (match) {
1946
- indent += tab;
1947
- }
1948
-
1949
- return indent;
1950
- };
1951
-
1952
- this.checkOutdent = function(state, line, input) {
1953
- return this.$outdent.checkOutdent(line, input);
1954
- };
1955
-
1956
- this.autoOutdent = function(state, doc, row) {
1957
- this.$outdent.autoOutdent(doc, row);
1958
- };
1959
-
1960
- this.createWorker = function(session) {
1961
- var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1962
- worker.attachToDocument(session.getDocument());
1963
-
1964
- worker.on("annotate", function(e) {
1965
- session.setAnnotations(e.data);
1966
- });
1967
-
1968
- worker.on("terminate", function() {
1969
- session.clearAnnotations();
1970
- });
1971
-
1972
- return worker;
1973
- };
1974
-
1975
- this.$id = "ace/mode/css";
1976
- }).call(Mode.prototype);
1977
-
1978
- exports.Mode = Mode;
1979
-
1980
- });
1981
-
1982
- 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(require, exports, module) {
1983
- "use strict";
1984
-
1985
- var oop = require("../lib/oop");
1986
- var lang = require("../lib/lang");
1987
- var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1988
- var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1989
- var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1990
-
1991
- var tagMap = lang.createMap({
1992
- a : 'anchor',
1993
- button : 'form',
1994
- form : 'form',
1995
- img : 'image',
1996
- input : 'form',
1997
- label : 'form',
1998
- option : 'form',
1999
- script : 'script',
2000
- select : 'form',
2001
- textarea : 'form',
2002
- style : 'style',
2003
- table : 'table',
2004
- tbody : 'table',
2005
- td : 'table',
2006
- tfoot : 'table',
2007
- th : 'table',
2008
- tr : 'table'
2009
- });
2010
-
2011
- var HtmlHighlightRules = function() {
2012
- XmlHighlightRules.call(this);
2013
-
2014
- this.addRules({
2015
- attributes: [{
2016
- include : "tag_whitespace"
2017
- }, {
2018
- token : "entity.other.attribute-name.xml",
2019
- regex : "[-_a-zA-Z0-9:]+"
2020
- }, {
2021
- token : "keyword.operator.attribute-equals.xml",
2022
- regex : "=",
2023
- push : [{
2024
- include: "tag_whitespace"
2025
- }, {
2026
- token : "string.unquoted.attribute-value.html",
2027
- regex : "[^<>='\"`\\s]+",
2028
- next : "pop"
2029
- }, {
2030
- token : "empty",
2031
- regex : "",
2032
- next : "pop"
2033
- }]
2034
- }, {
2035
- include : "attribute_value"
2036
- }],
2037
- tag: [{
2038
- token : function(start, tag) {
2039
- var group = tagMap[tag];
2040
- return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
2041
- "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
2042
- },
2043
- regex : "(</?)([-_a-zA-Z0-9:]+)",
2044
- next: "tag_stuff"
2045
- }],
2046
- tag_stuff: [
2047
- {include : "attributes"},
2048
- {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
2049
- ],
2050
- });
2051
-
2052
- this.embedTagRules(CssHighlightRules, "css-", "style");
2053
- this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
2054
-
2055
- if (this.constructor === HtmlHighlightRules)
2056
- this.normalizeRules();
2057
- };
2058
-
2059
- oop.inherits(HtmlHighlightRules, XmlHighlightRules);
2060
-
2061
- exports.HtmlHighlightRules = HtmlHighlightRules;
2062
- });
2063
-
2064
- define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
2065
- "use strict";
2066
-
2067
- var oop = require("../../lib/oop");
2068
- var BaseFoldMode = require("./fold_mode").FoldMode;
2069
-
2070
- var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
2071
- this.defaultMode = defaultMode;
2072
- this.subModes = subModes;
2073
- };
2074
- oop.inherits(FoldMode, BaseFoldMode);
2075
-
2076
- (function() {
2077
-
2078
-
2079
- this.$getMode = function(state) {
2080
- if (typeof state != "string")
2081
- state = state[0];
2082
- for (var key in this.subModes) {
2083
- if (state.indexOf(key) === 0)
2084
- return this.subModes[key];
2085
- }
2086
- return null;
2087
- };
2088
-
2089
- this.$tryMode = function(state, session, foldStyle, row) {
2090
- var mode = this.$getMode(state);
2091
- return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
2092
- };
2093
-
2094
- this.getFoldWidget = function(session, foldStyle, row) {
2095
- return (
2096
- this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
2097
- this.$tryMode(session.getState(row), session, foldStyle, row) ||
2098
- this.defaultMode.getFoldWidget(session, foldStyle, row)
2099
- );
2100
- };
2101
-
2102
- this.getFoldWidgetRange = function(session, foldStyle, row) {
2103
- var mode = this.$getMode(session.getState(row-1));
2104
-
2105
- if (!mode || !mode.getFoldWidget(session, foldStyle, row))
2106
- mode = this.$getMode(session.getState(row));
2107
-
2108
- if (!mode || !mode.getFoldWidget(session, foldStyle, row))
2109
- mode = this.defaultMode;
2110
-
2111
- return mode.getFoldWidgetRange(session, foldStyle, row);
2112
- };
2113
-
2114
- }).call(FoldMode.prototype);
2115
-
2116
- });
2117
-
2118
- define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(require, exports, module) {
2119
- "use strict";
2120
-
2121
- var oop = require("../../lib/oop");
2122
- var MixedFoldMode = require("./mixed").FoldMode;
2123
- var XmlFoldMode = require("./xml").FoldMode;
2124
- var CStyleFoldMode = require("./cstyle").FoldMode;
2125
-
2126
- var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
2127
- MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
2128
- "js-": new CStyleFoldMode(),
2129
- "css-": new CStyleFoldMode()
2130
- });
2131
- };
2132
-
2133
- oop.inherits(FoldMode, MixedFoldMode);
2134
-
2135
- });
2136
-
2137
- define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
2138
- "use strict";
2139
-
2140
- var TokenIterator = require("../token_iterator").TokenIterator;
2141
-
2142
- var commonAttributes = [
2143
- "accesskey",
2144
- "class",
2145
- "contenteditable",
2146
- "contextmenu",
2147
- "dir",
2148
- "draggable",
2149
- "dropzone",
2150
- "hidden",
2151
- "id",
2152
- "inert",
2153
- "itemid",
2154
- "itemprop",
2155
- "itemref",
2156
- "itemscope",
2157
- "itemtype",
2158
- "lang",
2159
- "spellcheck",
2160
- "style",
2161
- "tabindex",
2162
- "title",
2163
- "translate"
2164
- ];
2165
-
2166
- var eventAttributes = [
2167
- "onabort",
2168
- "onblur",
2169
- "oncancel",
2170
- "oncanplay",
2171
- "oncanplaythrough",
2172
- "onchange",
2173
- "onclick",
2174
- "onclose",
2175
- "oncontextmenu",
2176
- "oncuechange",
2177
- "ondblclick",
2178
- "ondrag",
2179
- "ondragend",
2180
- "ondragenter",
2181
- "ondragleave",
2182
- "ondragover",
2183
- "ondragstart",
2184
- "ondrop",
2185
- "ondurationchange",
2186
- "onemptied",
2187
- "onended",
2188
- "onerror",
2189
- "onfocus",
2190
- "oninput",
2191
- "oninvalid",
2192
- "onkeydown",
2193
- "onkeypress",
2194
- "onkeyup",
2195
- "onload",
2196
- "onloadeddata",
2197
- "onloadedmetadata",
2198
- "onloadstart",
2199
- "onmousedown",
2200
- "onmousemove",
2201
- "onmouseout",
2202
- "onmouseover",
2203
- "onmouseup",
2204
- "onmousewheel",
2205
- "onpause",
2206
- "onplay",
2207
- "onplaying",
2208
- "onprogress",
2209
- "onratechange",
2210
- "onreset",
2211
- "onscroll",
2212
- "onseeked",
2213
- "onseeking",
2214
- "onselect",
2215
- "onshow",
2216
- "onstalled",
2217
- "onsubmit",
2218
- "onsuspend",
2219
- "ontimeupdate",
2220
- "onvolumechange",
2221
- "onwaiting"
2222
- ];
2223
-
2224
- var globalAttributes = commonAttributes.concat(eventAttributes);
2225
-
2226
- var attributeMap = {
2227
- "html": ["manifest"],
2228
- "head": [],
2229
- "title": [],
2230
- "base": ["href", "target"],
2231
- "link": ["href", "hreflang", "rel", "media", "type", "sizes"],
2232
- "meta": ["http-equiv", "name", "content", "charset"],
2233
- "style": ["type", "media", "scoped"],
2234
- "script": ["charset", "type", "src", "defer", "async"],
2235
- "noscript": ["href"],
2236
- "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"],
2237
- "section": [],
2238
- "nav": [],
2239
- "article": ["pubdate"],
2240
- "aside": [],
2241
- "h1": [],
2242
- "h2": [],
2243
- "h3": [],
2244
- "h4": [],
2245
- "h5": [],
2246
- "h6": [],
2247
- "header": [],
2248
- "footer": [],
2249
- "address": [],
2250
- "main": [],
2251
- "p": [],
2252
- "hr": [],
2253
- "pre": [],
2254
- "blockquote": ["cite"],
2255
- "ol": ["start", "reversed"],
2256
- "ul": [],
2257
- "li": ["value"],
2258
- "dl": [],
2259
- "dt": [],
2260
- "dd": [],
2261
- "figure": [],
2262
- "figcaption": [],
2263
- "div": [],
2264
- "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"],
2265
- "em": [],
2266
- "strong": [],
2267
- "small": [],
2268
- "s": [],
2269
- "cite": [],
2270
- "q": ["cite"],
2271
- "dfn": [],
2272
- "abbr": [],
2273
- "data": [],
2274
- "time": ["datetime"],
2275
- "code": [],
2276
- "var": [],
2277
- "samp": [],
2278
- "kbd": [],
2279
- "sub": [],
2280
- "sup": [],
2281
- "i": [],
2282
- "b": [],
2283
- "u": [],
2284
- "mark": [],
2285
- "ruby": [],
2286
- "rt": [],
2287
- "rp": [],
2288
- "bdi": [],
2289
- "bdo": [],
2290
- "span": [],
2291
- "br": [],
2292
- "wbr": [],
2293
- "ins": ["cite", "datetime"],
2294
- "del": ["cite", "datetime"],
2295
- "img": ["alt", "src", "height", "width", "usemap", "ismap"],
2296
- "iframe": ["name", "src", "height", "width", "sandbox", "seamless"],
2297
- "embed": ["src", "height", "width", "type"],
2298
- "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"],
2299
- "param": ["name", "value"],
2300
- "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"],
2301
- "audio": ["src", "autobuffer", "autoplay", "loop", "controls"],
2302
- "source": ["src", "type", "media"],
2303
- "track": ["kind", "src", "srclang", "label", "default"],
2304
- "canvas": ["width", "height"],
2305
- "map": ["name"],
2306
- "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"],
2307
- "svg": [],
2308
- "math": [],
2309
- "table": ["summary"],
2310
- "caption": [],
2311
- "colgroup": ["span"],
2312
- "col": ["span"],
2313
- "tbody": [],
2314
- "thead": [],
2315
- "tfoot": [],
2316
- "tr": [],
2317
- "td": ["headers", "rowspan", "colspan"],
2318
- "th": ["headers", "rowspan", "colspan", "scope"],
2319
- "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"],
2320
- "fieldset": ["disabled", "form", "name"],
2321
- "legend": [],
2322
- "label": ["form", "for"],
2323
- "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"],
2324
- "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"],
2325
- "select": ["autofocus", "disabled", "form", "multiple", "name", "size"],
2326
- "datalist": [],
2327
- "optgroup": ["disabled", "label"],
2328
- "option": ["disabled", "selected", "label", "value"],
2329
- "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"],
2330
- "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"],
2331
- "output": ["for", "form", "name"],
2332
- "progress": ["value", "max"],
2333
- "meter": ["value", "min", "max", "low", "high", "optimum"],
2334
- "details": ["open"],
2335
- "summary": [],
2336
- "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"],
2337
- "menu": ["type", "label"],
2338
- "dialog": ["open"]
2339
- };
2340
-
2341
- var elements = Object.keys(attributeMap);
2342
-
2343
- function is(token, type) {
2344
- return token.type.lastIndexOf(type + ".xml") > -1;
2345
- }
2346
-
2347
- function findTagName(session, pos) {
2348
- var iterator = new TokenIterator(session, pos.row, pos.column);
2349
- var token = iterator.getCurrentToken();
2350
- while (token && !is(token, "tag-name")){
2351
- token = iterator.stepBackward();
2352
- }
2353
- if (token)
2354
- return token.value;
2355
- }
2356
-
2357
- var HtmlCompletions = function() {
2358
-
2359
- };
2360
-
2361
- (function() {
2362
-
2363
- this.getCompletions = function(state, session, pos, prefix) {
2364
- var token = session.getTokenAt(pos.row, pos.column);
2365
-
2366
- if (!token)
2367
- return [];
2368
- if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
2369
- return this.getTagCompletions(state, session, pos, prefix);
2370
- if (is(token, "tag-whitespace") || is(token, "attribute-name"))
2371
- return this.getAttributeCompetions(state, session, pos, prefix);
2372
-
2373
- return [];
2374
- };
2375
-
2376
- this.getTagCompletions = function(state, session, pos, prefix) {
2377
- return elements.map(function(element){
2378
- return {
2379
- value: element,
2380
- meta: "tag",
2381
- score: Number.MAX_VALUE
2382
- };
2383
- });
2384
- };
2385
-
2386
- this.getAttributeCompetions = function(state, session, pos, prefix) {
2387
- var tagName = findTagName(session, pos);
2388
- if (!tagName)
2389
- return [];
2390
- var attributes = globalAttributes;
2391
- if (tagName in attributeMap) {
2392
- attributes = attributes.concat(attributeMap[tagName]);
2393
- }
2394
- return attributes.map(function(attribute){
2395
- return {
2396
- caption: attribute,
2397
- snippet: attribute + '="$0"',
2398
- meta: "attribute",
2399
- score: Number.MAX_VALUE
2400
- };
2401
- });
2402
- };
2403
-
2404
- }).call(HtmlCompletions.prototype);
2405
-
2406
- exports.HtmlCompletions = HtmlCompletions;
2407
- });
2408
-
2409
- 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(require, exports, module) {
2410
- "use strict";
2411
-
2412
- var oop = require("../lib/oop");
2413
- var lang = require("../lib/lang");
2414
- var TextMode = require("./text").Mode;
2415
- var JavaScriptMode = require("./javascript").Mode;
2416
- var CssMode = require("./css").Mode;
2417
- var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2418
- var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
2419
- var HtmlFoldMode = require("./folding/html").FoldMode;
2420
- var HtmlCompletions = require("./html_completions").HtmlCompletions;
2421
- var WorkerClient = require("../worker/worker_client").WorkerClient;
2422
- var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
2423
- var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
2424
-
2425
- var Mode = function(options) {
2426
- this.fragmentContext = options && options.fragmentContext;
2427
- this.HighlightRules = HtmlHighlightRules;
2428
- this.$behaviour = new XmlBehaviour();
2429
- this.$completer = new HtmlCompletions();
2430
-
2431
- this.createModeDelegates({
2432
- "js-": JavaScriptMode,
2433
- "css-": CssMode
2434
- });
2435
-
2436
- this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
2437
- };
2438
- oop.inherits(Mode, TextMode);
2439
-
2440
- (function() {
2441
-
2442
- this.blockComment = {start: "<!--", end: "-->"};
2443
-
2444
- this.voidElements = lang.arrayToMap(voidElements);
2445
-
2446
- this.getNextLineIndent = function(state, line, tab) {
2447
- return this.$getIndent(line);
2448
- };
2449
-
2450
- this.checkOutdent = function(state, line, input) {
2451
- return false;
2452
- };
2453
-
2454
- this.getCompletions = function(state, session, pos, prefix) {
2455
- return this.$completer.getCompletions(state, session, pos, prefix);
2456
- };
2457
-
2458
- this.createWorker = function(session) {
2459
- if (this.constructor != Mode)
2460
- return;
2461
- var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
2462
- worker.attachToDocument(session.getDocument());
2463
-
2464
- if (this.fragmentContext)
2465
- worker.call("setOptions", [{context: this.fragmentContext}]);
2466
-
2467
- worker.on("error", function(e) {
2468
- session.setAnnotations(e.data);
2469
- });
2470
-
2471
- worker.on("terminate", function() {
2472
- session.clearAnnotations();
2473
- });
2474
-
2475
- return worker;
2476
- };
2477
-
2478
- this.$id = "ace/mode/html";
2479
- }).call(Mode.prototype);
2480
-
2481
- exports.Mode = Mode;
2482
- });
2483
-
2484
- 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(require, exports, module) {
2485
- "use strict";
2486
-
2487
- var oop = require("../lib/oop");
2488
- var lang = require("../lib/lang");
2489
- var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
2490
- var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
2491
- var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
2492
- var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2493
- var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
2494
-
2495
- var escaped = function(ch) {
2496
- return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
2497
- }
2498
-
2499
- function github_embed(tag, prefix) {
2500
- return { // Github style block
2501
- token : "support.function",
2502
- regex : "^\\s*```" + tag + "\\s*$",
2503
- push : prefix + "start"
2504
- };
2505
- }
2506
-
2507
- var MarkdownHighlightRules = function() {
2508
- HtmlHighlightRules.call(this);
2509
-
2510
- this.$rules["start"].unshift({
2511
- token : "empty_line",
2512
- regex : '^$',
2513
- next: "allowBlock"
2514
- }, { // h1
2515
- token: "markup.heading.1",
2516
- regex: "^=+(?=\\s*$)"
2517
- }, { // h2
2518
- token: "markup.heading.2",
2519
- regex: "^\\-+(?=\\s*$)"
2520
- }, {
2521
- token : function(value) {
2522
- return "markup.heading." + value.length;
2523
- },
2524
- regex : /^#{1,6}(?=\s*[^ #]|\s+#.)/,
2525
- next : "header"
2526
- },
2527
- github_embed("(?:javascript|js)", "jscode-"),
2528
- github_embed("xml", "xmlcode-"),
2529
- github_embed("html", "htmlcode-"),
2530
- github_embed("css", "csscode-"),
2531
- { // Github style block
2532
- token : "support.function",
2533
- regex : "^\\s*```\\s*\\S*(?:{.*?\\})?\\s*$",
2534
- next : "githubblock"
2535
- }, { // block quote
2536
- token : "string.blockquote",
2537
- regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
2538
- next : "blockquote"
2539
- }, { // HR * - _
2540
- token : "constant",
2541
- regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$",
2542
- next: "allowBlock"
2543
- }, { // list
2544
- token : "markup.list",
2545
- regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
2546
- next : "listblock-start"
2547
- }, {
2548
- include : "basic"
2549
- });
2550
-
2551
- this.addRules({
2552
- "basic" : [{
2553
- token : "constant.language.escape",
2554
- regex : /\\[\\`*_{}\[\]()#+\-.!]/
2555
- }, { // code span `
2556
- token : "support.function",
2557
- regex : "(`+)(.*?[^`])(\\1)"
2558
- }, { // reference
2559
- token : ["text", "constant", "text", "url", "string", "text"],
2560
- regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
2561
- }, { // link by reference
2562
- token : ["text", "string", "text", "constant", "text"],
2563
- regex : "(\\[)(" + escaped("]") + ")(\\]\s*\\[)("+ escaped("]") + ")(\\])"
2564
- }, { // link by url
2565
- token : ["text", "string", "text", "markup.underline", "string", "text"],
2566
- regex : "(\\[)(" + // [
2567
- escaped("]") + // link text
2568
- ")(\\]\\()"+ // ](
2569
- '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href
2570
- '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
2571
- "(\\))" // )
2572
- }, { // strong ** __
2573
- token : "string.strong",
2574
- regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
2575
- }, { // emphasis * _
2576
- token : "string.emphasis",
2577
- regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
2578
- }, { //
2579
- token : ["text", "url", "text"],
2580
- regex : "(<)("+
2581
- "(?:https?|ftp|dict):[^'\">\\s]+"+
2582
- "|"+
2583
- "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+
2584
- ")(>)"
2585
- }],
2586
- "allowBlock": [
2587
- {token : "support.function", regex : "^ {4}.+", next : "allowBlock"},
2588
- {token : "empty", regex : "", next : "start"}
2589
- ],
2590
-
2591
- "header" : [{
2592
- regex: "$",
2593
- next : "start"
2594
- }, {
2595
- include: "basic"
2596
- }, {
2597
- defaultToken : "heading"
2598
- } ],
2599
-
2600
- "listblock-start" : [{
2601
- token : "support.variable",
2602
- regex : /(?:\[[ x]\])?/,
2603
- next : "listblock"
2604
- }],
2605
-
2606
- "listblock" : [ { // Lists only escape on completely blank lines.
2607
- token : "empty_line",
2608
- regex : "^$",
2609
- next : "start"
2610
- }, { // list
2611
- token : "markup.list",
2612
- regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
2613
- next : "listblock-start"
2614
- }, {
2615
- include : "basic", noEscape: true
2616
- }, { // Github style block
2617
- token : "support.function",
2618
- regex : "^\\s*```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$",
2619
- next : "githubblock"
2620
- }, {
2621
- defaultToken : "list" //do not use markup.list to allow stling leading `*` differntly
2622
- } ],
2623
-
2624
- "blockquote" : [ { // Blockquotes only escape on blank lines.
2625
- token : "empty_line",
2626
- regex : "^\\s*$",
2627
- next : "start"
2628
- }, { // block quote
2629
- token : "string.blockquote",
2630
- regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
2631
- next : "blockquote"
2632
- }, {
2633
- include : "basic", noEscape: true
2634
- }, {
2635
- defaultToken : "string.blockquote"
2636
- } ],
2637
-
2638
- "githubblock" : [ {
2639
- token : "support.function",
2640
- regex : "^\\s*```",
2641
- next : "start"
2642
- }, {
2643
- token : "support.function",
2644
- regex : ".+"
2645
- } ]
2646
- });
2647
-
2648
- this.embedRules(JavaScriptHighlightRules, "jscode-", [{
2649
- token : "support.function",
2650
- regex : "^\\s*```",
2651
- next : "pop"
2652
- }]);
2653
-
2654
- this.embedRules(HtmlHighlightRules, "htmlcode-", [{
2655
- token : "support.function",
2656
- regex : "^\\s*```",
2657
- next : "pop"
2658
- }]);
2659
-
2660
- this.embedRules(CssHighlightRules, "csscode-", [{
2661
- token : "support.function",
2662
- regex : "^\\s*```",
2663
- next : "pop"
2664
- }]);
2665
-
2666
- this.embedRules(XmlHighlightRules, "xmlcode-", [{
2667
- token : "support.function",
2668
- regex : "^\\s*```",
2669
- next : "pop"
2670
- }]);
2671
-
2672
- this.normalizeRules();
2673
- };
2674
- oop.inherits(MarkdownHighlightRules, TextHighlightRules);
2675
-
2676
- exports.MarkdownHighlightRules = MarkdownHighlightRules;
2677
- });
2678
-
2679
- define("ace/mode/folding/markdown",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
2680
- "use strict";
2681
-
2682
- var oop = require("../../lib/oop");
2683
- var BaseFoldMode = require("./fold_mode").FoldMode;
2684
- var Range = require("../../range").Range;
2685
-
2686
- var FoldMode = exports.FoldMode = function() {};
2687
- oop.inherits(FoldMode, BaseFoldMode);
2688
-
2689
- (function() {
2690
- this.foldingStartMarker = /^(?:[=-]+\s*$|#{1,6} |`{3})/;
2691
-
2692
- this.getFoldWidget = function(session, foldStyle, row) {
2693
- var line = session.getLine(row);
2694
- if (!this.foldingStartMarker.test(line))
2695
- return "";
2696
-
2697
- if (line[0] == "`") {
2698
- if (session.bgTokenizer.getState(row) == "start")
2699
- return "end";
2700
- return "start";
2701
- }
2702
-
2703
- return "start";
2704
- };
2705
-
2706
- this.getFoldWidgetRange = function(session, foldStyle, row) {
2707
- var line = session.getLine(row);
2708
- var startColumn = line.length;
2709
- var maxRow = session.getLength();
2710
- var startRow = row;
2711
- var endRow = row;
2712
- if (!line.match(this.foldingStartMarker))
2713
- return;
2714
-
2715
- if (line[0] == "`") {
2716
- if (session.bgTokenizer.getState(row) !== "start") {
2717
- while (++row < maxRow) {
2718
- line = session.getLine(row);
2719
- if (line[0] == "`" & line.substring(0, 3) == "```")
2720
- break;
2721
- }
2722
- return new Range(startRow, startColumn, row, 0);
2723
- } else {
2724
- while (row -- > 0) {
2725
- line = session.getLine(row);
2726
- if (line[0] == "`" & line.substring(0, 3) == "```")
2727
- break;
2728
- }
2729
- return new Range(row, line.length, startRow, 0);
2730
- }
2731
- }
2732
-
2733
- var token;
2734
- function isHeading(row) {
2735
- token = session.getTokens(row)[0];
2736
- return token && token.type.lastIndexOf(heading, 0) === 0;
2737
- }
2738
-
2739
- var heading = "markup.heading";
2740
- function getLevel() {
2741
- var ch = token.value[0];
2742
- if (ch == "=") return 6;
2743
- if (ch == "-") return 5;
2744
- return 7 - token.value.search(/[^#]/);
2745
- }
2746
-
2747
- if (isHeading(row)) {
2748
- var startHeadingLevel = getLevel();
2749
- while (++row < maxRow) {
2750
- if (!isHeading(row))
2751
- continue;
2752
- var level = getLevel();
2753
- if (level >= startHeadingLevel)
2754
- break;
2755
- }
2756
-
2757
- endRow = row - (!token || ["=", "-"].indexOf(token.value[0]) == -1 ? 1 : 2);
2758
-
2759
- if (endRow > startRow) {
2760
- while (endRow > startRow && /^\s*$/.test(session.getLine(endRow)))
2761
- endRow--;
2762
- }
2763
-
2764
- if (endRow > startRow) {
2765
- var endColumn = session.getLine(endRow).length;
2766
- return new Range(startRow, startColumn, endRow, endColumn);
2767
- }
2768
- }
2769
- };
2770
-
2771
- }).call(FoldMode.prototype);
2772
-
2773
- });
2774
-
2775
- 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(require, exports, module) {
2776
- "use strict";
2777
-
2778
- var oop = require("../lib/oop");
2779
- var TextMode = require("./text").Mode;
2780
- var JavaScriptMode = require("./javascript").Mode;
2781
- var XmlMode = require("./xml").Mode;
2782
- var HtmlMode = require("./html").Mode;
2783
- var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
2784
- var MarkdownFoldMode = require("./folding/markdown").FoldMode;
2785
-
2786
- var Mode = function() {
2787
- this.HighlightRules = MarkdownHighlightRules;
2788
-
2789
- this.createModeDelegates({
2790
- "js-": JavaScriptMode,
2791
- "xml-": XmlMode,
2792
- "html-": HtmlMode
2793
- });
2794
-
2795
- this.foldingRules = new MarkdownFoldMode();
2796
- };
2797
- oop.inherits(Mode, TextMode);
2798
-
2799
- (function() {
2800
- this.type = "text";
2801
- this.blockComment = {start: "<!--", end: "-->"};
2802
-
2803
- this.getNextLineIndent = function(state, line, tab) {
2804
- if (state == "listblock") {
2805
- var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line);
2806
- if (!match)
2807
- return "";
2808
- var marker = match[2];
2809
- if (!marker)
2810
- marker = parseInt(match[3], 10) + 1 + ".";
2811
- return match[1] + marker + match[4];
2812
- } else {
2813
- return this.$getIndent(line);
2814
- }
2815
- };
2816
- this.$id = "ace/mode/markdown";
2817
- }).call(Mode.prototype);
2818
-
2819
- exports.Mode = Mode;
2820
- });