ace-rails-ap 0.0.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. data/lib/ace/rails/version.rb +1 -1
  2. data/vendor/assets/javascripts/ace.js +15680 -1
  3. data/vendor/assets/javascripts/keybinding-emacs.js +367 -1
  4. data/vendor/assets/javascripts/keybinding-vim.js +1635 -1
  5. data/vendor/assets/javascripts/mode-c9search.js +275 -0
  6. data/vendor/assets/javascripts/mode-c_cpp.js +744 -1
  7. data/vendor/assets/javascripts/mode-clojure.js +364 -1
  8. data/vendor/assets/javascripts/mode-coffee.js +527 -1
  9. data/vendor/assets/javascripts/mode-coldfusion.js +1966 -1
  10. data/vendor/assets/javascripts/mode-csharp.js +633 -1
  11. data/vendor/assets/javascripts/mode-css.js +499 -1
  12. data/vendor/assets/javascripts/mode-diff.js +250 -0
  13. data/vendor/assets/javascripts/{mode-c_cpp-uncompressed.js → mode-glsl.js} +147 -244
  14. data/vendor/assets/javascripts/mode-golang.js +681 -1
  15. data/vendor/assets/javascripts/mode-groovy.js +1240 -1
  16. data/vendor/assets/javascripts/mode-haxe.js +633 -1
  17. data/vendor/assets/javascripts/mode-html.js +2064 -1
  18. data/vendor/assets/javascripts/mode-java.js +1202 -1
  19. data/vendor/assets/javascripts/mode-javascript.js +1069 -1
  20. data/vendor/assets/javascripts/mode-json.js +588 -1
  21. data/vendor/assets/javascripts/{mode-haxe-uncompressed.js → mode-jsx.js} +189 -312
  22. data/vendor/assets/javascripts/mode-latex.js +95 -1
  23. data/vendor/assets/javascripts/mode-less.js +512 -1
  24. data/vendor/assets/javascripts/mode-liquid.js +1125 -1
  25. data/vendor/assets/javascripts/mode-lua.js +551 -1
  26. data/vendor/assets/javascripts/{mode-html-uncompressed.js → mode-luahtml.js} +544 -604
  27. data/vendor/assets/javascripts/{mode-coldfusion-uncompressed.js → mode-luapage.js} +2326 -2180
  28. data/vendor/assets/javascripts/mode-markdown.js +2369 -1
  29. data/vendor/assets/javascripts/mode-ocaml.js +464 -1
  30. data/vendor/assets/javascripts/mode-perl.js +432 -1
  31. data/vendor/assets/javascripts/mode-pgsql.js +970 -1
  32. data/vendor/assets/javascripts/mode-php.js +1718 -1
  33. data/vendor/assets/javascripts/mode-powershell.js +610 -1
  34. data/vendor/assets/javascripts/mode-python.js +397 -1
  35. data/vendor/assets/javascripts/mode-ruby.js +318 -1
  36. data/vendor/assets/javascripts/mode-scad.js +732 -1
  37. data/vendor/assets/javascripts/mode-scala.js +1237 -1
  38. data/vendor/assets/javascripts/mode-scss.js +537 -1
  39. data/vendor/assets/javascripts/mode-sh.js +250 -1
  40. data/vendor/assets/javascripts/mode-sql.js +140 -1
  41. data/vendor/assets/javascripts/mode-svg.js +1681 -1
  42. data/vendor/assets/javascripts/mode-tcl.js +320 -0
  43. data/vendor/assets/javascripts/mode-textile.js +182 -1
  44. data/vendor/assets/javascripts/mode-xml.js +829 -1
  45. data/vendor/assets/javascripts/mode-xquery.js +605 -1
  46. data/vendor/assets/javascripts/mode-yaml.js +189 -0
  47. data/vendor/assets/javascripts/theme-chrome.js +213 -1
  48. data/vendor/assets/javascripts/theme-clouds.js +167 -1
  49. data/vendor/assets/javascripts/theme-clouds_midnight.js +168 -1
  50. data/vendor/assets/javascripts/theme-cobalt.js +194 -1
  51. data/vendor/assets/javascripts/theme-crimson_editor.js +200 -1
  52. data/vendor/assets/javascripts/theme-dawn.js +198 -1
  53. data/vendor/assets/javascripts/theme-dreamweaver.js +230 -1
  54. data/vendor/assets/javascripts/theme-eclipse.js +157 -1
  55. data/vendor/assets/javascripts/theme-github.js +182 -0
  56. data/vendor/assets/javascripts/theme-idle_fingers.js +186 -1
  57. data/vendor/assets/javascripts/theme-kr_theme.js +189 -1
  58. data/vendor/assets/javascripts/theme-merbivore.js +189 -1
  59. data/vendor/assets/javascripts/theme-merbivore_soft.js +195 -1
  60. data/vendor/assets/javascripts/theme-mono_industrial.js +197 -1
  61. data/vendor/assets/javascripts/theme-monokai.js +194 -1
  62. data/vendor/assets/javascripts/theme-pastel_on_dark.js +199 -1
  63. data/vendor/assets/javascripts/theme-solarized_dark.js +180 -1
  64. data/vendor/assets/javascripts/theme-solarized_light.js +179 -1
  65. data/vendor/assets/javascripts/theme-textmate.js +216 -0
  66. data/vendor/assets/javascripts/theme-tomorrow.js +213 -1
  67. data/vendor/assets/javascripts/theme-tomorrow_night.js +213 -1
  68. data/vendor/assets/javascripts/theme-tomorrow_night_blue.js +213 -1
  69. data/vendor/assets/javascripts/theme-tomorrow_night_bright.js +213 -1
  70. data/vendor/assets/javascripts/theme-tomorrow_night_eighties.js +209 -1
  71. data/vendor/assets/javascripts/theme-twilight.js +211 -1
  72. data/vendor/assets/javascripts/theme-vibrant_ink.js +190 -1
  73. data/vendor/assets/javascripts/worker-coffee.js +83 -893
  74. data/vendor/assets/javascripts/worker-css.js +88 -1402
  75. data/vendor/assets/javascripts/worker-javascript.js +97 -812
  76. data/vendor/assets/javascripts/worker-json.js +84 -761
  77. data/vendor/assets/javascripts/worker-xquery.js +66464 -0
  78. metadata +12 -195
  79. data/vendor/assets/javascripts/ace-compat-noconflict.js +0 -1
  80. data/vendor/assets/javascripts/ace-compat-uncompressed-noconflict.js +0 -480
  81. data/vendor/assets/javascripts/ace-compat-uncompressed.js +0 -480
  82. data/vendor/assets/javascripts/ace-compat.js +0 -1
  83. data/vendor/assets/javascripts/ace-noconflict.js +0 -10
  84. data/vendor/assets/javascripts/ace-uncompressed-noconflict.js +0 -19976
  85. data/vendor/assets/javascripts/ace-uncompressed.js +0 -19976
  86. data/vendor/assets/javascripts/keybinding-emacs-noconflict.js +0 -1
  87. data/vendor/assets/javascripts/keybinding-emacs-uncompressed-noconflict.js +0 -150
  88. data/vendor/assets/javascripts/keybinding-emacs-uncompressed.js +0 -150
  89. data/vendor/assets/javascripts/keybinding-vim-noconflict.js +0 -1
  90. data/vendor/assets/javascripts/keybinding-vim-uncompressed-noconflict.js +0 -138
  91. data/vendor/assets/javascripts/keybinding-vim-uncompressed.js +0 -138
  92. data/vendor/assets/javascripts/mode-c_cpp-noconflict.js +0 -1
  93. data/vendor/assets/javascripts/mode-c_cpp-uncompressed-noconflict.js +0 -919
  94. data/vendor/assets/javascripts/mode-clojure-noconflict.js +0 -1
  95. data/vendor/assets/javascripts/mode-clojure-uncompressed-noconflict.js +0 -422
  96. data/vendor/assets/javascripts/mode-clojure-uncompressed.js +0 -422
  97. data/vendor/assets/javascripts/mode-coffee-noconflict.js +0 -1
  98. data/vendor/assets/javascripts/mode-coffee-uncompressed-noconflict.js +0 -607
  99. data/vendor/assets/javascripts/mode-coffee-uncompressed.js +0 -607
  100. data/vendor/assets/javascripts/mode-coldfusion-noconflict.js +0 -1
  101. data/vendor/assets/javascripts/mode-coldfusion-uncompressed-noconflict.js +0 -2458
  102. data/vendor/assets/javascripts/mode-csharp-noconflict.js +0 -1
  103. data/vendor/assets/javascripts/mode-csharp-uncompressed-noconflict.js +0 -769
  104. data/vendor/assets/javascripts/mode-csharp-uncompressed.js +0 -769
  105. data/vendor/assets/javascripts/mode-css-noconflict.js +0 -1
  106. data/vendor/assets/javascripts/mode-css-uncompressed-noconflict.js +0 -641
  107. data/vendor/assets/javascripts/mode-css-uncompressed.js +0 -641
  108. data/vendor/assets/javascripts/mode-golang-noconflict.js +0 -1
  109. data/vendor/assets/javascripts/mode-golang-uncompressed-noconflict.js +0 -378
  110. data/vendor/assets/javascripts/mode-golang-uncompressed.js +0 -378
  111. data/vendor/assets/javascripts/mode-groovy-noconflict.js +0 -1
  112. data/vendor/assets/javascripts/mode-groovy-uncompressed-noconflict.js +0 -1393
  113. data/vendor/assets/javascripts/mode-groovy-uncompressed.js +0 -1393
  114. data/vendor/assets/javascripts/mode-haxe-noconflict.js +0 -1
  115. data/vendor/assets/javascripts/mode-haxe-uncompressed-noconflict.js +0 -769
  116. data/vendor/assets/javascripts/mode-html-noconflict.js +0 -1
  117. data/vendor/assets/javascripts/mode-html-uncompressed-noconflict.js +0 -2475
  118. data/vendor/assets/javascripts/mode-java-noconflict.js +0 -1
  119. data/vendor/assets/javascripts/mode-java-uncompressed-noconflict.js +0 -1395
  120. data/vendor/assets/javascripts/mode-java-uncompressed.js +0 -1395
  121. data/vendor/assets/javascripts/mode-javascript-noconflict.js +0 -1
  122. data/vendor/assets/javascripts/mode-javascript-uncompressed-noconflict.js +0 -1226
  123. data/vendor/assets/javascripts/mode-javascript-uncompressed.js +0 -1226
  124. data/vendor/assets/javascripts/mode-json-noconflict.js +0 -1
  125. data/vendor/assets/javascripts/mode-json-uncompressed-noconflict.js +0 -701
  126. data/vendor/assets/javascripts/mode-json-uncompressed.js +0 -701
  127. data/vendor/assets/javascripts/mode-latex-noconflict.js +0 -1
  128. data/vendor/assets/javascripts/mode-latex-uncompressed-noconflict.js +0 -95
  129. data/vendor/assets/javascripts/mode-latex-uncompressed.js +0 -95
  130. data/vendor/assets/javascripts/mode-less-noconflict.js +0 -1
  131. data/vendor/assets/javascripts/mode-less-uncompressed-noconflict.js +0 -655
  132. data/vendor/assets/javascripts/mode-less-uncompressed.js +0 -655
  133. data/vendor/assets/javascripts/mode-liquid-noconflict.js +0 -1
  134. data/vendor/assets/javascripts/mode-liquid-uncompressed-noconflict.js +0 -1353
  135. data/vendor/assets/javascripts/mode-liquid-uncompressed.js +0 -1353
  136. data/vendor/assets/javascripts/mode-lua-noconflict.js +0 -1
  137. data/vendor/assets/javascripts/mode-lua-uncompressed-noconflict.js +0 -523
  138. data/vendor/assets/javascripts/mode-lua-uncompressed.js +0 -523
  139. data/vendor/assets/javascripts/mode-markdown-noconflict.js +0 -1
  140. data/vendor/assets/javascripts/mode-markdown-uncompressed-noconflict.js +0 -2925
  141. data/vendor/assets/javascripts/mode-markdown-uncompressed.js +0 -2925
  142. data/vendor/assets/javascripts/mode-ocaml-noconflict.js +0 -1
  143. data/vendor/assets/javascripts/mode-ocaml-uncompressed-noconflict.js +0 -539
  144. data/vendor/assets/javascripts/mode-ocaml-uncompressed.js +0 -539
  145. data/vendor/assets/javascripts/mode-perl-noconflict.js +0 -1
  146. data/vendor/assets/javascripts/mode-perl-uncompressed-noconflict.js +0 -574
  147. data/vendor/assets/javascripts/mode-perl-uncompressed.js +0 -574
  148. data/vendor/assets/javascripts/mode-pgsql-noconflict.js +0 -1
  149. data/vendor/assets/javascripts/mode-pgsql-uncompressed-noconflict.js +0 -1104
  150. data/vendor/assets/javascripts/mode-pgsql-uncompressed.js +0 -1104
  151. data/vendor/assets/javascripts/mode-php-noconflict.js +0 -1
  152. data/vendor/assets/javascripts/mode-php-uncompressed-noconflict.js +0 -1885
  153. data/vendor/assets/javascripts/mode-php-uncompressed.js +0 -1885
  154. data/vendor/assets/javascripts/mode-powershell-noconflict.js +0 -1
  155. data/vendor/assets/javascripts/mode-powershell-uncompressed-noconflict.js +0 -710
  156. data/vendor/assets/javascripts/mode-powershell-uncompressed.js +0 -710
  157. data/vendor/assets/javascripts/mode-python-noconflict.js +0 -1
  158. data/vendor/assets/javascripts/mode-python-uncompressed-noconflict.js +0 -507
  159. data/vendor/assets/javascripts/mode-python-uncompressed.js +0 -507
  160. data/vendor/assets/javascripts/mode-ruby-noconflict.js +0 -1
  161. data/vendor/assets/javascripts/mode-ruby-uncompressed-noconflict.js +0 -391
  162. data/vendor/assets/javascripts/mode-ruby-uncompressed.js +0 -391
  163. data/vendor/assets/javascripts/mode-scad-noconflict.js +0 -1
  164. data/vendor/assets/javascripts/mode-scad-uncompressed-noconflict.js +0 -907
  165. data/vendor/assets/javascripts/mode-scad-uncompressed.js +0 -907
  166. data/vendor/assets/javascripts/mode-scala-noconflict.js +0 -1
  167. data/vendor/assets/javascripts/mode-scala-uncompressed-noconflict.js +0 -1395
  168. data/vendor/assets/javascripts/mode-scala-uncompressed.js +0 -1395
  169. data/vendor/assets/javascripts/mode-scss-noconflict.js +0 -1
  170. data/vendor/assets/javascripts/mode-scss-uncompressed-noconflict.js +0 -679
  171. data/vendor/assets/javascripts/mode-scss-uncompressed.js +0 -679
  172. data/vendor/assets/javascripts/mode-sh-noconflict.js +0 -1
  173. data/vendor/assets/javascripts/mode-sh-uncompressed-noconflict.js +0 -289
  174. data/vendor/assets/javascripts/mode-sh-uncompressed.js +0 -289
  175. data/vendor/assets/javascripts/mode-sql-noconflict.js +0 -1
  176. data/vendor/assets/javascripts/mode-sql-uncompressed-noconflict.js +0 -159
  177. data/vendor/assets/javascripts/mode-sql-uncompressed.js +0 -159
  178. data/vendor/assets/javascripts/mode-svg-noconflict.js +0 -1
  179. data/vendor/assets/javascripts/mode-svg-uncompressed-noconflict.js +0 -2137
  180. data/vendor/assets/javascripts/mode-svg-uncompressed.js +0 -2137
  181. data/vendor/assets/javascripts/mode-text-noconflict.js +0 -0
  182. data/vendor/assets/javascripts/mode-text-uncompressed-noconflict.js +0 -0
  183. data/vendor/assets/javascripts/mode-text-uncompressed.js +0 -0
  184. data/vendor/assets/javascripts/mode-textile-noconflict.js +0 -1
  185. data/vendor/assets/javascripts/mode-textile-uncompressed-noconflict.js +0 -254
  186. data/vendor/assets/javascripts/mode-textile-uncompressed.js +0 -254
  187. data/vendor/assets/javascripts/mode-xml-noconflict.js +0 -1
  188. data/vendor/assets/javascripts/mode-xml-uncompressed-noconflict.js +0 -1012
  189. data/vendor/assets/javascripts/mode-xml-uncompressed.js +0 -1012
  190. data/vendor/assets/javascripts/mode-xquery-noconflict.js +0 -1
  191. data/vendor/assets/javascripts/mode-xquery-uncompressed-noconflict.js +0 -540
  192. data/vendor/assets/javascripts/mode-xquery-uncompressed.js +0 -540
  193. data/vendor/assets/javascripts/theme-chrome-noconflict.js +0 -1
  194. data/vendor/assets/javascripts/theme-chrome-uncompressed-noconflict.js +0 -207
  195. data/vendor/assets/javascripts/theme-chrome-uncompressed.js +0 -207
  196. data/vendor/assets/javascripts/theme-clouds-noconflict.js +0 -1
  197. data/vendor/assets/javascripts/theme-clouds-uncompressed-noconflict.js +0 -160
  198. data/vendor/assets/javascripts/theme-clouds-uncompressed.js +0 -160
  199. data/vendor/assets/javascripts/theme-clouds_midnight-noconflict.js +0 -1
  200. data/vendor/assets/javascripts/theme-clouds_midnight-uncompressed-noconflict.js +0 -161
  201. data/vendor/assets/javascripts/theme-clouds_midnight-uncompressed.js +0 -161
  202. data/vendor/assets/javascripts/theme-cobalt-noconflict.js +0 -1
  203. data/vendor/assets/javascripts/theme-cobalt-uncompressed-noconflict.js +0 -187
  204. data/vendor/assets/javascripts/theme-cobalt-uncompressed.js +0 -187
  205. data/vendor/assets/javascripts/theme-crimson_editor-noconflict.js +0 -1
  206. data/vendor/assets/javascripts/theme-crimson_editor-uncompressed-noconflict.js +0 -198
  207. data/vendor/assets/javascripts/theme-crimson_editor-uncompressed.js +0 -198
  208. data/vendor/assets/javascripts/theme-dawn-noconflict.js +0 -1
  209. data/vendor/assets/javascripts/theme-dawn-uncompressed-noconflict.js +0 -191
  210. data/vendor/assets/javascripts/theme-dawn-uncompressed.js +0 -191
  211. data/vendor/assets/javascripts/theme-dreamweaver-noconflict.js +0 -1
  212. data/vendor/assets/javascripts/theme-dreamweaver-uncompressed-noconflict.js +0 -227
  213. data/vendor/assets/javascripts/theme-dreamweaver-uncompressed.js +0 -227
  214. data/vendor/assets/javascripts/theme-eclipse-noconflict.js +0 -1
  215. data/vendor/assets/javascripts/theme-eclipse-uncompressed-noconflict.js +0 -147
  216. data/vendor/assets/javascripts/theme-eclipse-uncompressed.js +0 -147
  217. data/vendor/assets/javascripts/theme-idle_fingers-noconflict.js +0 -1
  218. data/vendor/assets/javascripts/theme-idle_fingers-uncompressed-noconflict.js +0 -179
  219. data/vendor/assets/javascripts/theme-idle_fingers-uncompressed.js +0 -179
  220. data/vendor/assets/javascripts/theme-kr_theme-noconflict.js +0 -1
  221. data/vendor/assets/javascripts/theme-kr_theme-uncompressed-noconflict.js +0 -182
  222. data/vendor/assets/javascripts/theme-kr_theme-uncompressed.js +0 -182
  223. data/vendor/assets/javascripts/theme-merbivore-noconflict.js +0 -1
  224. data/vendor/assets/javascripts/theme-merbivore-uncompressed-noconflict.js +0 -182
  225. data/vendor/assets/javascripts/theme-merbivore-uncompressed.js +0 -182
  226. data/vendor/assets/javascripts/theme-merbivore_soft-noconflict.js +0 -1
  227. data/vendor/assets/javascripts/theme-merbivore_soft-uncompressed-noconflict.js +0 -188
  228. data/vendor/assets/javascripts/theme-merbivore_soft-uncompressed.js +0 -188
  229. data/vendor/assets/javascripts/theme-mono_industrial-noconflict.js +0 -1
  230. data/vendor/assets/javascripts/theme-mono_industrial-uncompressed-noconflict.js +0 -190
  231. data/vendor/assets/javascripts/theme-mono_industrial-uncompressed.js +0 -190
  232. data/vendor/assets/javascripts/theme-monokai-noconflict.js +0 -1
  233. data/vendor/assets/javascripts/theme-monokai-uncompressed-noconflict.js +0 -191
  234. data/vendor/assets/javascripts/theme-monokai-uncompressed.js +0 -191
  235. data/vendor/assets/javascripts/theme-pastel_on_dark-noconflict.js +0 -1
  236. data/vendor/assets/javascripts/theme-pastel_on_dark-uncompressed-noconflict.js +0 -192
  237. data/vendor/assets/javascripts/theme-pastel_on_dark-uncompressed.js +0 -192
  238. data/vendor/assets/javascripts/theme-solarized_dark-noconflict.js +0 -1
  239. data/vendor/assets/javascripts/theme-solarized_dark-uncompressed-noconflict.js +0 -176
  240. data/vendor/assets/javascripts/theme-solarized_dark-uncompressed.js +0 -176
  241. data/vendor/assets/javascripts/theme-solarized_light-noconflict.js +0 -1
  242. data/vendor/assets/javascripts/theme-solarized_light-uncompressed-noconflict.js +0 -172
  243. data/vendor/assets/javascripts/theme-solarized_light-uncompressed.js +0 -172
  244. data/vendor/assets/javascripts/theme-textmate-noconflict.js +0 -0
  245. data/vendor/assets/javascripts/theme-textmate-uncompressed-noconflict.js +0 -0
  246. data/vendor/assets/javascripts/theme-textmate-uncompressed.js +0 -0
  247. data/vendor/assets/javascripts/theme-tomorrow-noconflict.js +0 -1
  248. data/vendor/assets/javascripts/theme-tomorrow-uncompressed-noconflict.js +0 -206
  249. data/vendor/assets/javascripts/theme-tomorrow-uncompressed.js +0 -206
  250. data/vendor/assets/javascripts/theme-tomorrow_night-noconflict.js +0 -1
  251. data/vendor/assets/javascripts/theme-tomorrow_night-uncompressed-noconflict.js +0 -206
  252. data/vendor/assets/javascripts/theme-tomorrow_night-uncompressed.js +0 -206
  253. data/vendor/assets/javascripts/theme-tomorrow_night_blue-noconflict.js +0 -1
  254. data/vendor/assets/javascripts/theme-tomorrow_night_blue-uncompressed-noconflict.js +0 -209
  255. data/vendor/assets/javascripts/theme-tomorrow_night_blue-uncompressed.js +0 -209
  256. data/vendor/assets/javascripts/theme-tomorrow_night_bright-noconflict.js +0 -1
  257. data/vendor/assets/javascripts/theme-tomorrow_night_bright-uncompressed-noconflict.js +0 -206
  258. data/vendor/assets/javascripts/theme-tomorrow_night_bright-uncompressed.js +0 -206
  259. data/vendor/assets/javascripts/theme-tomorrow_night_eighties-noconflict.js +0 -1
  260. data/vendor/assets/javascripts/theme-tomorrow_night_eighties-uncompressed-noconflict.js +0 -202
  261. data/vendor/assets/javascripts/theme-tomorrow_night_eighties-uncompressed.js +0 -202
  262. data/vendor/assets/javascripts/theme-twilight-noconflict.js +0 -1
  263. data/vendor/assets/javascripts/theme-twilight-uncompressed-noconflict.js +0 -204
  264. data/vendor/assets/javascripts/theme-twilight-uncompressed.js +0 -204
  265. data/vendor/assets/javascripts/theme-vibrant_ink-noconflict.js +0 -1
  266. data/vendor/assets/javascripts/theme-vibrant_ink-uncompressed-noconflict.js +0 -183
  267. data/vendor/assets/javascripts/theme-vibrant_ink-uncompressed.js +0 -183
@@ -1,1012 +0,0 @@
1
- /* ***** BEGIN LICENSE BLOCK *****
2
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3
- *
4
- * The contents of this file are subject to the Mozilla Public License Version
5
- * 1.1 (the "License"); you may not use this file except in compliance with
6
- * the License. You may obtain a copy of the License at
7
- * http://www.mozilla.org/MPL/
8
- *
9
- * Software distributed under the License is distributed on an "AS IS" basis,
10
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
- * for the specific language governing rights and limitations under the
12
- * License.
13
- *
14
- * The Original Code is Ajax.org Code Editor (ACE).
15
- *
16
- * The Initial Developer of the Original Code is
17
- * Ajax.org B.V.
18
- * Portions created by the Initial Developer are Copyright (C) 2010
19
- * the Initial Developer. All Rights Reserved.
20
- *
21
- * Contributor(s):
22
- * Fabian Jakobs <fabian AT ajax DOT org>
23
- *
24
- * Alternatively, the contents of this file may be used under the terms of
25
- * either the GNU General Public License Version 2 or later (the "GPL"), or
26
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
- * in which case the provisions of the GPL or the LGPL are applicable instead
28
- * of those above. If you wish to allow use of your version of this file only
29
- * under the terms of either the GPL or the LGPL, and not to allow others to
30
- * use your version of this file under the terms of the MPL, indicate your
31
- * decision by deleting the provisions above and replace them with the notice
32
- * and other provisions required by the GPL or the LGPL. If you do not delete
33
- * the provisions above, a recipient may use your version of this file under
34
- * the terms of any one of the MPL, the GPL or the LGPL.
35
- *
36
- * ***** END LICENSE BLOCK ***** */
37
-
38
- define('ace/mode/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xml_highlight_rules', 'ace/mode/behaviour/xml', 'ace/mode/folding/xml'], function(require, exports, module) {
39
- "use strict";
40
-
41
- var oop = require("../lib/oop");
42
- var TextMode = require("./text").Mode;
43
- var Tokenizer = require("../tokenizer").Tokenizer;
44
- var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
45
- var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
46
- var XmlFoldMode = require("./folding/xml").FoldMode;
47
-
48
- var Mode = function() {
49
- this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules());
50
- this.$behaviour = new XmlBehaviour();
51
- this.foldingRules = new XmlFoldMode();
52
- };
53
-
54
- oop.inherits(Mode, TextMode);
55
-
56
- (function() {
57
-
58
- this.getNextLineIndent = function(state, line, tab) {
59
- return this.$getIndent(line);
60
- };
61
-
62
- }).call(Mode.prototype);
63
-
64
- exports.Mode = Mode;
65
- });
66
- /* ***** BEGIN LICENSE BLOCK *****
67
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
68
- *
69
- * The contents of this file are subject to the Mozilla Public License Version
70
- * 1.1 (the "License"); you may not use this file except in compliance with
71
- * the License. You may obtain a copy of the License at
72
- * http://www.mozilla.org/MPL/
73
- *
74
- * Software distributed under the License is distributed on an "AS IS" basis,
75
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
76
- * for the specific language governing rights and limitations under the
77
- * License.
78
- *
79
- * The Original Code is Ajax.org Code Editor (ACE).
80
- *
81
- * The Initial Developer of the Original Code is
82
- * Ajax.org B.V.
83
- * Portions created by the Initial Developer are Copyright (C) 2010
84
- * the Initial Developer. All Rights Reserved.
85
- *
86
- * Contributor(s):
87
- * Fabian Jakobs <fabian AT ajax DOT org>
88
- *
89
- * Alternatively, the contents of this file may be used under the terms of
90
- * either the GNU General Public License Version 2 or later (the "GPL"), or
91
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
92
- * in which case the provisions of the GPL or the LGPL are applicable instead
93
- * of those above. If you wish to allow use of your version of this file only
94
- * under the terms of either the GPL or the LGPL, and not to allow others to
95
- * use your version of this file under the terms of the MPL, indicate your
96
- * decision by deleting the provisions above and replace them with the notice
97
- * and other provisions required by the GPL or the LGPL. If you do not delete
98
- * the provisions above, a recipient may use your version of this file under
99
- * the terms of any one of the MPL, the GPL or the LGPL.
100
- *
101
- * ***** END LICENSE BLOCK ***** */
102
-
103
- define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
104
- "use strict";
105
-
106
- var oop = require("../lib/oop");
107
- var xmlUtil = require("./xml_util");
108
- var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
109
-
110
- var XmlHighlightRules = function() {
111
-
112
- // regexp must not have capturing parentheses
113
- // regexps are ordered -> the first match is used
114
- this.$rules = {
115
- start : [{
116
- token : "text",
117
- regex : "<\\!\\[CDATA\\[",
118
- next : "cdata"
119
- }, {
120
- token : "xml_pe",
121
- regex : "<\\?.*?\\?>"
122
- }, {
123
- token : "comment",
124
- merge : true,
125
- regex : "<\\!--",
126
- next : "comment"
127
- }, {
128
- token : "xml_pe",
129
- regex : "<\\!.*?>"
130
- }, {
131
- token : "meta.tag", // opening tag
132
- regex : "<\\/?",
133
- next : "tag"
134
- }, {
135
- token : "text",
136
- regex : "\\s+"
137
- }, {
138
- token : "constant.character.entity",
139
- regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
140
- }, {
141
- token : "text",
142
- regex : "[^<]+"
143
- }],
144
-
145
- cdata : [{
146
- token : "text",
147
- regex : "\\]\\]>",
148
- next : "start"
149
- }, {
150
- token : "text",
151
- regex : "\\s+"
152
- }, {
153
- token : "text",
154
- regex : "(?:[^\\]]|\\](?!\\]>))+"
155
- }],
156
-
157
- comment : [{
158
- token : "comment",
159
- regex : ".*?-->",
160
- next : "start"
161
- }, {
162
- token : "comment",
163
- merge : true,
164
- regex : ".+"
165
- }]
166
- };
167
-
168
- xmlUtil.tag(this.$rules, "tag", "start");
169
- };
170
-
171
- oop.inherits(XmlHighlightRules, TextHighlightRules);
172
-
173
- exports.XmlHighlightRules = XmlHighlightRules;
174
- });
175
- /* ***** BEGIN LICENSE BLOCK *****
176
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
177
- *
178
- * The contents of this file are subject to the Mozilla Public License Version
179
- * 1.1 (the "License"); you may not use this file except in compliance with
180
- * the License. You may obtain a copy of the License at
181
- * http://www.mozilla.org/MPL/
182
- *
183
- * Software distributed under the License is distributed on an "AS IS" basis,
184
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
185
- * for the specific language governing rights and limitations under the
186
- * License.
187
- *
188
- * The Original Code is Ajax.org Code Editor (ACE).
189
- *
190
- * The Initial Developer of the Original Code is
191
- * Ajax.org B.V.
192
- * Portions created by the Initial Developer are Copyright (C) 2010
193
- * the Initial Developer. All Rights Reserved.
194
- *
195
- * Contributor(s):
196
- * Fabian Jakobs <fabian AT ajax DOT org>
197
- *
198
- * Alternatively, the contents of this file may be used under the terms of
199
- * either the GNU General Public License Version 2 or later (the "GPL"), or
200
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
201
- * in which case the provisions of the GPL or the LGPL are applicable instead
202
- * of those above. If you wish to allow use of your version of this file only
203
- * under the terms of either the GPL or the LGPL, and not to allow others to
204
- * use your version of this file under the terms of the MPL, indicate your
205
- * decision by deleting the provisions above and replace them with the notice
206
- * and other provisions required by the GPL or the LGPL. If you do not delete
207
- * the provisions above, a recipient may use your version of this file under
208
- * the terms of any one of the MPL, the GPL or the LGPL.
209
- *
210
- * ***** END LICENSE BLOCK ***** */
211
-
212
- define('ace/mode/xml_util', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) {
213
- "use strict";
214
-
215
- var lang = require("../lib/lang");
216
-
217
- var formTags = lang.arrayToMap(
218
- ("button|form|input|label|select|textarea").split("|")
219
- );
220
-
221
- var tableTags = lang.arrayToMap(
222
- ("table|tbody|td|tfoot|th|tr").split("|")
223
- );
224
-
225
- function string(state) {
226
- return [{
227
- token : "string",
228
- regex : '".*?"'
229
- }, {
230
- token : "string", // multi line string start
231
- merge : true,
232
- regex : '["].*',
233
- next : state + "_qqstring"
234
- }, {
235
- token : "string",
236
- regex : "'.*?'"
237
- }, {
238
- token : "string", // multi line string start
239
- merge : true,
240
- regex : "['].*",
241
- next : state + "_qstring"
242
- }];
243
- }
244
-
245
- function multiLineString(quote, state) {
246
- return [{
247
- token : "string",
248
- merge : true,
249
- regex : ".*?" + quote,
250
- next : state
251
- }, {
252
- token : "string",
253
- merge : true,
254
- regex : '.+'
255
- }];
256
- }
257
-
258
- exports.tag = function(states, name, nextState) {
259
- states[name] = [{
260
- token : "text",
261
- regex : "\\s+"
262
- }, {
263
- //token : "meta.tag",
264
-
265
- token : function(value) {
266
- if ( value==='a' ) {
267
- return "meta.tag.anchor";
268
- }
269
- else if ( value==='img' ) {
270
- return "meta.tag.image";
271
- }
272
- else if ( value==='script' ) {
273
- return "meta.tag.script";
274
- }
275
- else if ( value==='style' ) {
276
- return "meta.tag.style";
277
- }
278
- else if (formTags.hasOwnProperty(value.toLowerCase())) {
279
- return "meta.tag.form";
280
- }
281
- else if (tableTags.hasOwnProperty(value.toLowerCase())) {
282
- return "meta.tag.table";
283
- }
284
- else {
285
- return "meta.tag";
286
- }
287
- },
288
- merge : true,
289
- regex : "[-_a-zA-Z0-9:]+",
290
- next : name + "_embed_attribute_list"
291
- }, {
292
- token: "empty",
293
- regex: "",
294
- next : name + "_embed_attribute_list"
295
- }];
296
-
297
- states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
298
- states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
299
-
300
- states[name + "_embed_attribute_list"] = [{
301
- token : "meta.tag",
302
- merge : true,
303
- regex : "\/?>",
304
- next : nextState
305
- }, {
306
- token : "keyword.operator",
307
- regex : "="
308
- }, {
309
- token : "entity.other.attribute-name",
310
- regex : "[-_a-zA-Z0-9:]+"
311
- }, {
312
- token : "constant.numeric", // float
313
- regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
314
- }, {
315
- token : "text",
316
- regex : "\\s+"
317
- }].concat(string(name));
318
- };
319
-
320
- });
321
- /* vim:ts=4:sts=4:sw=4:
322
- * ***** BEGIN LICENSE BLOCK *****
323
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
324
- *
325
- * The contents of this file are subject to the Mozilla Public License Version
326
- * 1.1 (the "License"); you may not use this file except in compliance with
327
- * the License. You may obtain a copy of the License at
328
- * http://www.mozilla.org/MPL/
329
- *
330
- * Software distributed under the License is distributed on an "AS IS" basis,
331
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
332
- * for the specific language governing rights and limitations under the
333
- * License.
334
- *
335
- * The Original Code is Ajax.org Code Editor (ACE).
336
- *
337
- * The Initial Developer of the Original Code is
338
- * Ajax.org B.V.
339
- * Portions created by the Initial Developer are Copyright (C) 2010
340
- * the Initial Developer. All Rights Reserved.
341
- *
342
- * Contributor(s):
343
- * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
344
- *
345
- * Alternatively, the contents of this file may be used under the terms of
346
- * either the GNU General Public License Version 2 or later (the "GPL"), or
347
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
348
- * in which case the provisions of the GPL or the LGPL are applicable instead
349
- * of those above. If you wish to allow use of your version of this file only
350
- * under the terms of either the GPL or the LGPL, and not to allow others to
351
- * use your version of this file under the terms of the MPL, indicate your
352
- * decision by deleting the provisions above and replace them with the notice
353
- * and other provisions required by the GPL or the LGPL. If you do not delete
354
- * the provisions above, a recipient may use your version of this file under
355
- * the terms of any one of the MPL, the GPL or the LGPL.
356
- *
357
- * ***** END LICENSE BLOCK ***** */
358
-
359
- define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle'], function(require, exports, module) {
360
- "use strict";
361
-
362
- var oop = require("../../lib/oop");
363
- var Behaviour = require("../behaviour").Behaviour;
364
- var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
365
-
366
- var XmlBehaviour = function () {
367
-
368
- this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
369
-
370
- this.add("brackets", "insertion", function (state, action, editor, session, text) {
371
- if (text == '<') {
372
- var selection = editor.getSelectionRange();
373
- var selected = session.doc.getTextRange(selection);
374
- if (selected !== "") {
375
- return false;
376
- } else {
377
- return {
378
- text: '<>',
379
- selection: [1, 1]
380
- }
381
- }
382
- } else if (text == '>') {
383
- var cursor = editor.getCursorPosition();
384
- var line = session.doc.getLine(cursor.row);
385
- var rightChar = line.substring(cursor.column, cursor.column + 1);
386
- if (rightChar == '>') { // need some kind of matching check here
387
- return {
388
- text: '',
389
- selection: [1, 1]
390
- }
391
- }
392
- } else if (text == "\n") {
393
- var cursor = editor.getCursorPosition();
394
- var line = session.doc.getLine(cursor.row);
395
- var rightChars = line.substring(cursor.column, cursor.column + 2);
396
- if (rightChars == '</') {
397
- var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
398
- var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
399
-
400
- return {
401
- text: '\n' + indent + '\n' + next_indent,
402
- selection: [1, indent.length, 1, indent.length]
403
- }
404
- }
405
- }
406
- });
407
-
408
- }
409
- oop.inherits(XmlBehaviour, Behaviour);
410
-
411
- exports.XmlBehaviour = XmlBehaviour;
412
- });
413
- /* vim:ts=4:sts=4:sw=4:
414
- * ***** BEGIN LICENSE BLOCK *****
415
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
416
- *
417
- * The contents of this file are subject to the Mozilla Public License Version
418
- * 1.1 (the "License"); you may not use this file except in compliance with
419
- * the License. You may obtain a copy of the License at
420
- * http://www.mozilla.org/MPL/
421
- *
422
- * Software distributed under the License is distributed on an "AS IS" basis,
423
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
424
- * for the specific language governing rights and limitations under the
425
- * License.
426
- *
427
- * The Original Code is Ajax.org Code Editor (ACE).
428
- *
429
- * The Initial Developer of the Original Code is
430
- * Ajax.org B.V.
431
- * Portions created by the Initial Developer are Copyright (C) 2010
432
- * the Initial Developer. All Rights Reserved.
433
- *
434
- * Contributor(s):
435
- * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
436
- *
437
- * Alternatively, the contents of this file may be used under the terms of
438
- * either the GNU General Public License Version 2 or later (the "GPL"), or
439
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
440
- * in which case the provisions of the GPL or the LGPL are applicable instead
441
- * of those above. If you wish to allow use of your version of this file only
442
- * under the terms of either the GPL or the LGPL, and not to allow others to
443
- * use your version of this file under the terms of the MPL, indicate your
444
- * decision by deleting the provisions above and replace them with the notice
445
- * and other provisions required by the GPL or the LGPL. If you do not delete
446
- * the provisions above, a recipient may use your version of this file under
447
- * the terms of any one of the MPL, the GPL or the LGPL.
448
- *
449
- * ***** END LICENSE BLOCK ***** */
450
-
451
- define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour'], function(require, exports, module) {
452
- "use strict";
453
-
454
- var oop = require("../../lib/oop");
455
- var Behaviour = require('../behaviour').Behaviour;
456
-
457
- var CstyleBehaviour = function () {
458
-
459
- this.add("braces", "insertion", function (state, action, editor, session, text) {
460
- if (text == '{') {
461
- var selection = editor.getSelectionRange();
462
- var selected = session.doc.getTextRange(selection);
463
- if (selected !== "") {
464
- return {
465
- text: '{' + selected + '}',
466
- selection: false
467
- };
468
- } else {
469
- return {
470
- text: '{}',
471
- selection: [1, 1]
472
- };
473
- }
474
- } else if (text == '}') {
475
- var cursor = editor.getCursorPosition();
476
- var line = session.doc.getLine(cursor.row);
477
- var rightChar = line.substring(cursor.column, cursor.column + 1);
478
- if (rightChar == '}') {
479
- var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
480
- if (matching !== null) {
481
- return {
482
- text: '',
483
- selection: [1, 1]
484
- };
485
- }
486
- }
487
- } else if (text == "\n") {
488
- var cursor = editor.getCursorPosition();
489
- var line = session.doc.getLine(cursor.row);
490
- var rightChar = line.substring(cursor.column, cursor.column + 1);
491
- if (rightChar == '}') {
492
- var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column + 1});
493
- if (!openBracePos)
494
- return null;
495
-
496
- var indent = this.getNextLineIndent(state, line.substring(0, line.length - 1), session.getTabString());
497
- var next_indent = this.$getIndent(session.doc.getLine(openBracePos.row));
498
-
499
- return {
500
- text: '\n' + indent + '\n' + next_indent,
501
- selection: [1, indent.length, 1, indent.length]
502
- };
503
- }
504
- }
505
- });
506
-
507
- this.add("braces", "deletion", function (state, action, editor, session, range) {
508
- var selected = session.doc.getTextRange(range);
509
- if (!range.isMultiLine() && selected == '{') {
510
- var line = session.doc.getLine(range.start.row);
511
- var rightChar = line.substring(range.end.column, range.end.column + 1);
512
- if (rightChar == '}') {
513
- range.end.column++;
514
- return range;
515
- }
516
- }
517
- });
518
-
519
- this.add("parens", "insertion", function (state, action, editor, session, text) {
520
- if (text == '(') {
521
- var selection = editor.getSelectionRange();
522
- var selected = session.doc.getTextRange(selection);
523
- if (selected !== "") {
524
- return {
525
- text: '(' + selected + ')',
526
- selection: false
527
- };
528
- } else {
529
- return {
530
- text: '()',
531
- selection: [1, 1]
532
- };
533
- }
534
- } else if (text == ')') {
535
- var cursor = editor.getCursorPosition();
536
- var line = session.doc.getLine(cursor.row);
537
- var rightChar = line.substring(cursor.column, cursor.column + 1);
538
- if (rightChar == ')') {
539
- var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
540
- if (matching !== null) {
541
- return {
542
- text: '',
543
- selection: [1, 1]
544
- };
545
- }
546
- }
547
- }
548
- });
549
-
550
- this.add("parens", "deletion", function (state, action, editor, session, range) {
551
- var selected = session.doc.getTextRange(range);
552
- if (!range.isMultiLine() && selected == '(') {
553
- var line = session.doc.getLine(range.start.row);
554
- var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
555
- if (rightChar == ')') {
556
- range.end.column++;
557
- return range;
558
- }
559
- }
560
- });
561
-
562
- this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
563
- if (text == '"' || text == "'") {
564
- var quote = text;
565
- var selection = editor.getSelectionRange();
566
- var selected = session.doc.getTextRange(selection);
567
- if (selected !== "") {
568
- return {
569
- text: quote + selected + quote,
570
- selection: false
571
- };
572
- } else {
573
- var cursor = editor.getCursorPosition();
574
- var line = session.doc.getLine(cursor.row);
575
- var leftChar = line.substring(cursor.column-1, cursor.column);
576
-
577
- // We're escaped.
578
- if (leftChar == '\\') {
579
- return null;
580
- }
581
-
582
- // Find what token we're inside.
583
- var tokens = session.getTokens(selection.start.row, selection.start.row)[0].tokens;
584
- var col = 0, token;
585
- var quotepos = -1; // Track whether we're inside an open quote.
586
-
587
- for (var x = 0; x < tokens.length; x++) {
588
- token = tokens[x];
589
- if (token.type == "string") {
590
- quotepos = -1;
591
- } else if (quotepos < 0) {
592
- quotepos = token.value.indexOf(quote);
593
- }
594
- if ((token.value.length + col) > selection.start.column) {
595
- break;
596
- }
597
- col += tokens[x].value.length;
598
- }
599
-
600
- // Try and be smart about when we auto insert.
601
- if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
602
- return {
603
- text: quote + quote,
604
- selection: [1,1]
605
- };
606
- } else if (token && token.type === "string") {
607
- // Ignore input and move right one if we're typing over the closing quote.
608
- var rightChar = line.substring(cursor.column, cursor.column + 1);
609
- if (rightChar == quote) {
610
- return {
611
- text: '',
612
- selection: [1, 1]
613
- };
614
- }
615
- }
616
- }
617
- }
618
- });
619
-
620
- this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
621
- var selected = session.doc.getTextRange(range);
622
- if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
623
- var line = session.doc.getLine(range.start.row);
624
- var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
625
- if (rightChar == '"') {
626
- range.end.column++;
627
- return range;
628
- }
629
- }
630
- });
631
-
632
- };
633
-
634
- oop.inherits(CstyleBehaviour, Behaviour);
635
-
636
- exports.CstyleBehaviour = CstyleBehaviour;
637
- });
638
- /* ***** BEGIN LICENSE BLOCK *****
639
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
640
- *
641
- * The contents of this file are subject to the Mozilla Public License Version
642
- * 1.1 (the "License"); you may not use this file except in compliance with
643
- * the License. You may obtain a copy of the License at
644
- * http://www.mozilla.org/MPL/
645
- *
646
- * Software distributed under the License is distributed on an "AS IS" basis,
647
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
648
- * for the specific language governing rights and limitations under the
649
- * License.
650
- *
651
- * The Original Code is Ajax.org Code Editor (ACE).
652
- *
653
- * The Initial Developer of the Original Code is
654
- * Ajax.org B.V.
655
- * Portions created by the Initial Developer are Copyright (C) 2010
656
- * the Initial Developer. All Rights Reserved.
657
- *
658
- * Contributor(s):
659
- * Fabian Jakobs <fabian AT ajax DOT org>
660
- *
661
- * Alternatively, the contents of this file may be used under the terms of
662
- * either the GNU General Public License Version 2 or later (the "GPL"), or
663
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
664
- * in which case the provisions of the GPL or the LGPL are applicable instead
665
- * of those above. If you wish to allow use of your version of this file only
666
- * under the terms of either the GPL or the LGPL, and not to allow others to
667
- * use your version of this file under the terms of the MPL, indicate your
668
- * decision by deleting the provisions above and replace them with the notice
669
- * and other provisions required by the GPL or the LGPL. If you do not delete
670
- * the provisions above, a recipient may use your version of this file under
671
- * the terms of any one of the MPL, the GPL or the LGPL.
672
- *
673
- * ***** END LICENSE BLOCK ***** */
674
-
675
- 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) {
676
- "use strict";
677
-
678
- var oop = require("../../lib/oop");
679
- var lang = require("../../lib/lang");
680
- var Range = require("../../range").Range;
681
- var BaseFoldMode = require("./fold_mode").FoldMode;
682
- var TokenIterator = require("../../token_iterator").TokenIterator;
683
-
684
- var FoldMode = exports.FoldMode = function(voidElements) {
685
- BaseFoldMode.call(this);
686
- this.voidElements = voidElements || {};
687
- };
688
- oop.inherits(FoldMode, BaseFoldMode);
689
-
690
- (function() {
691
-
692
- this.getFoldWidget = function(session, foldStyle, row) {
693
- var tag = this._getFirstTagInLine(session, row);
694
-
695
- if (tag.closing)
696
- return foldStyle == "markbeginend" ? "end" : "";
697
-
698
- if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
699
- return "";
700
-
701
- if (tag.selfClosing)
702
- return "";
703
-
704
- if (tag.value.indexOf("/" + tag.tagName) !== -1)
705
- return "";
706
-
707
- return "start";
708
- };
709
-
710
- this._getFirstTagInLine = function(session, row) {
711
- var tokens = session.getTokens(row, row)[0].tokens;
712
- var value = "";
713
- for (var i = 0; i < tokens.length; i++) {
714
- var token = tokens[i];
715
- if (token.type.indexOf("meta.tag") === 0)
716
- value += token.value;
717
- else
718
- value += lang.stringRepeat(" ", token.value.length);
719
- }
720
-
721
- return this._parseTag(value);
722
- };
723
-
724
- this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
725
- this._parseTag = function(tag) {
726
-
727
- var match = this.tagRe.exec(tag);
728
- var column = this.tagRe.lastIndex || 0;
729
- this.tagRe.lastIndex = 0;
730
-
731
- return {
732
- value: tag,
733
- match: match ? match[2] : "",
734
- closing: match ? !!match[3] : false,
735
- selfClosing: match ? !!match[5] || match[2] == "/>" : false,
736
- tagName: match ? match[4] : "",
737
- column: match[1] ? column + match[1].length : column
738
- };
739
- };
740
-
741
- /*
742
- * reads a full tag and places the iterator after the tag
743
- */
744
- this._readTagForward = function(iterator) {
745
- var token = iterator.getCurrentToken();
746
- if (!token)
747
- return null;
748
-
749
- var value = "";
750
- var start;
751
-
752
- do {
753
- if (token.type.indexOf("meta.tag") === 0) {
754
- if (!start) {
755
- var start = {
756
- row: iterator.getCurrentTokenRow(),
757
- column: iterator.getCurrentTokenColumn()
758
- };
759
- }
760
- value += token.value;
761
- if (value.indexOf(">") !== -1) {
762
- var tag = this._parseTag(value);
763
- tag.start = start;
764
- tag.end = {
765
- row: iterator.getCurrentTokenRow(),
766
- column: iterator.getCurrentTokenColumn() + token.value.length
767
- };
768
- iterator.stepForward();
769
- return tag;
770
- }
771
- }
772
- } while(token = iterator.stepForward());
773
-
774
- return null;
775
- };
776
-
777
- this._readTagBackward = function(iterator) {
778
- var token = iterator.getCurrentToken();
779
- if (!token)
780
- return null;
781
-
782
- var value = "";
783
- var end;
784
-
785
- do {
786
- if (token.type.indexOf("meta.tag") === 0) {
787
- if (!end) {
788
- end = {
789
- row: iterator.getCurrentTokenRow(),
790
- column: iterator.getCurrentTokenColumn() + token.value.length
791
- };
792
- }
793
- value = token.value + value;
794
- if (value.indexOf("<") !== -1) {
795
- var tag = this._parseTag(value);
796
- tag.end = end;
797
- tag.start = {
798
- row: iterator.getCurrentTokenRow(),
799
- column: iterator.getCurrentTokenColumn()
800
- };
801
- iterator.stepBackward();
802
- return tag;
803
- }
804
- }
805
- } while(token = iterator.stepBackward());
806
-
807
- return null;
808
- };
809
-
810
- this._pop = function(stack, tag) {
811
- while (stack.length) {
812
-
813
- var top = stack[stack.length-1];
814
- if (!tag || top.tagName == tag.tagName) {
815
- return stack.pop();
816
- }
817
- else if (this.voidElements[tag.tagName]) {
818
- return;
819
- }
820
- else if (this.voidElements[top.tagName]) {
821
- stack.pop();
822
- continue;
823
- } else {
824
- return null;
825
- }
826
- }
827
- };
828
-
829
- this.getFoldWidgetRange = function(session, foldStyle, row) {
830
- var firstTag = this._getFirstTagInLine(session, row);
831
-
832
- if (!firstTag.match)
833
- return null;
834
-
835
- var isBackward = firstTag.closing || firstTag.selfClosing;
836
- var stack = [];
837
- var tag;
838
-
839
- if (!isBackward) {
840
- var iterator = new TokenIterator(session, row, firstTag.column);
841
- var start = {
842
- row: row,
843
- column: firstTag.column + firstTag.tagName.length + 2
844
- };
845
- while (tag = this._readTagForward(iterator)) {
846
- if (tag.selfClosing) {
847
- if (!stack.length) {
848
- tag.start.column += tag.tagName.length + 2;
849
- tag.end.column -= 2;
850
- return Range.fromPoints(tag.start, tag.end);
851
- } else
852
- continue;
853
- }
854
-
855
- if (tag.closing) {
856
- this._pop(stack, tag);
857
- if (stack.length == 0)
858
- return Range.fromPoints(start, tag.start);
859
- }
860
- else {
861
- stack.push(tag)
862
- }
863
- }
864
- }
865
- else {
866
- var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
867
- var end = {
868
- row: row,
869
- column: firstTag.column
870
- };
871
-
872
- while (tag = this._readTagBackward(iterator)) {
873
- if (tag.selfClosing) {
874
- if (!stack.length) {
875
- tag.start.column += tag.tagName.length + 2;
876
- tag.end.column -= 2;
877
- return Range.fromPoints(tag.start, tag.end);
878
- } else
879
- continue;
880
- }
881
-
882
- if (!tag.closing) {
883
- this._pop(stack, tag);
884
- if (stack.length == 0) {
885
- tag.start.column += tag.tagName.length + 2;
886
- return Range.fromPoints(tag.start, end);
887
- }
888
- }
889
- else {
890
- stack.push(tag)
891
- }
892
- }
893
- }
894
-
895
- };
896
-
897
- }).call(FoldMode.prototype);
898
-
899
- });
900
- /* ***** BEGIN LICENSE BLOCK *****
901
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
902
- *
903
- * The contents of this file are subject to the Mozilla Public License Version
904
- * 1.1 (the "License"); you may not use this file except in compliance with
905
- * the License. You may obtain a copy of the License at
906
- * http://www.mozilla.org/MPL/
907
- *
908
- * Software distributed under the License is distributed on an "AS IS" basis,
909
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
910
- * for the specific language governing rights and limitations under the
911
- * License.
912
- *
913
- * The Original Code is Ajax.org Code Editor (ACE).
914
- *
915
- * The Initial Developer of the Original Code is
916
- * Ajax.org B.V.
917
- * Portions created by the Initial Developer are Copyright (C) 2010
918
- * the Initial Developer. All Rights Reserved.
919
- *
920
- * Contributor(s):
921
- * Fabian Jakobs <fabian AT ajax DOT org>
922
- *
923
- * Alternatively, the contents of this file may be used under the terms of
924
- * either the GNU General Public License Version 2 or later (the "GPL"), or
925
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
926
- * in which case the provisions of the GPL or the LGPL are applicable instead
927
- * of those above. If you wish to allow use of your version of this file only
928
- * under the terms of either the GPL or the LGPL, and not to allow others to
929
- * use your version of this file under the terms of the MPL, indicate your
930
- * decision by deleting the provisions above and replace them with the notice
931
- * and other provisions required by the GPL or the LGPL. If you do not delete
932
- * the provisions above, a recipient may use your version of this file under
933
- * the terms of any one of the MPL, the GPL or the LGPL.
934
- *
935
- * ***** END LICENSE BLOCK ***** */
936
-
937
- define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
938
- "use strict";
939
-
940
- var Range = require("../../range").Range;
941
-
942
- var FoldMode = exports.FoldMode = function() {};
943
-
944
- (function() {
945
-
946
- this.foldingStartMarker = null;
947
- this.foldingStopMarker = null;
948
-
949
- // must return "" if there's no fold, to enable caching
950
- this.getFoldWidget = function(session, foldStyle, row) {
951
- var line = session.getLine(row);
952
- if (this.foldingStartMarker.test(line))
953
- return "start";
954
- if (foldStyle == "markbeginend"
955
- && this.foldingStopMarker
956
- && this.foldingStopMarker.test(line))
957
- return "end";
958
- return "";
959
- };
960
-
961
- this.getFoldWidgetRange = function(session, foldStyle, row) {
962
- return null;
963
- };
964
-
965
- this.indentationBlock = function(session, row, column) {
966
- var re = /^\s*/;
967
- var startRow = row;
968
- var endRow = row;
969
- var line = session.getLine(row);
970
- var startColumn = column || line.length;
971
- var startLevel = line.match(re)[0].length;
972
- var maxRow = session.getLength()
973
-
974
- while (++row < maxRow) {
975
- line = session.getLine(row);
976
- var level = line.match(re)[0].length;
977
-
978
- if (level == line.length)
979
- continue;
980
-
981
- if (level <= startLevel)
982
- break;
983
-
984
- endRow = row;
985
- }
986
-
987
- if (endRow > startRow) {
988
- var endColumn = session.getLine(endRow).length;
989
- return new Range(startRow, startColumn, endRow, endColumn);
990
- }
991
- };
992
-
993
- this.openingBracketBlock = function(session, bracket, row, column) {
994
- var start = {row: row, column: column + 1};
995
- var end = session.$findClosingBracket(bracket, start);
996
- if (!end)
997
- return;
998
-
999
- var fw = session.foldWidgets[end.row];
1000
- if (fw == null)
1001
- fw = this.getFoldWidget(session, end.row);
1002
-
1003
- if (fw == "start") {
1004
- end.row --;
1005
- end.column = session.getLine(end.row).length;
1006
- }
1007
- return Range.fromPoints(start, end);
1008
- };
1009
-
1010
- }).call(FoldMode.prototype);
1011
-
1012
- });