locomotivecms 4.1.1 → 4.2.0.alpha2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (301) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +4 -3
  4. data/Rakefile +4 -0
  5. data/app/api/locomotive/api.rb +1 -1
  6. data/app/assets/config/locomotive_manifest.js +2 -0
  7. data/app/assets/javascripts/locomotive.js +2 -2
  8. data/app/assets/stylesheets/locomotive/account.scss +0 -1
  9. data/app/assets/stylesheets/locomotive/application.scss +0 -1
  10. data/app/assets/stylesheets/locomotive/live_editing_error.scss +0 -1
  11. data/app/assets/stylesheets/locomotive/live_editing_iframe.scss +0 -1
  12. data/app/controllers/locomotive/base_controller.rb +1 -1
  13. data/app/controllers/locomotive/concerns/authorization_controller.rb +1 -1
  14. data/app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb +1 -1
  15. data/app/controllers/locomotive/concerns/site_dispatcher_controller.rb +1 -1
  16. data/app/controllers/locomotive/errors_controller.rb +1 -1
  17. data/app/controllers/locomotive/my_account_controller.rb +1 -1
  18. data/app/controllers/locomotive/passwords_controller.rb +3 -1
  19. data/app/controllers/locomotive/registrations_controller.rb +3 -1
  20. data/app/controllers/locomotive/sessions_controller.rb +3 -1
  21. data/app/controllers/locomotive/sites_controller.rb +1 -1
  22. data/app/helpers/locomotive/base_helper.rb +2 -2
  23. data/app/helpers/locomotive/custom_fields_helper.rb +2 -2
  24. data/app/helpers/locomotive/shared/activities_helper.rb +1 -1
  25. data/app/inputs/locomotive/api_key_input.rb +1 -1
  26. data/app/mailers/locomotive/notifications.rb +1 -1
  27. data/app/models/locomotive/account.rb +1 -1
  28. data/app/models/locomotive/concerns/account/api_key.rb +1 -1
  29. data/app/models/locomotive/concerns/content_entry/csv.rb +1 -1
  30. data/app/models/locomotive/concerns/content_entry/slug.rb +5 -5
  31. data/app/models/locomotive/concerns/content_type/entry_template.rb +3 -3
  32. data/app/models/locomotive/concerns/page/templatized.rb +1 -1
  33. data/app/models/locomotive/concerns/shared/json_attribute.rb +21 -2
  34. data/app/models/locomotive/concerns/site/routes.rb +1 -1
  35. data/app/models/locomotive/content_entry.rb +2 -2
  36. data/app/models/locomotive/page.rb +3 -3
  37. data/app/models/locomotive/section.rb +1 -1
  38. data/app/models/locomotive/snippet.rb +1 -1
  39. data/app/models/locomotive/translation.rb +1 -1
  40. data/app/services/locomotive/content_entry_import_service.rb +1 -1
  41. data/app/services/locomotive/content_entry_service.rb +2 -2
  42. data/app/services/locomotive/content_type_service.rb +13 -3
  43. data/app/services/locomotive/custom_field_service.rb +2 -2
  44. data/app/services/locomotive/editor_service.rb +1 -1
  45. data/app/uploaders/locomotive/base_uploader.rb +0 -10
  46. data/app/views/locomotive/dashboard/_activity.html.slim +1 -1
  47. data/app/views/locomotive/page_content/_edit.json.jbuilder +50 -0
  48. data/app/views/locomotive/page_content/edit.html.erb +1 -1
  49. data/app/views/locomotive/page_content/edit.json.jbuilder +52 -50
  50. data/config/initializers/devise.rb +5 -2
  51. data/lib/generators/locomotive/install/templates/locomotive.rb +0 -5
  52. data/lib/locomotive/action_controller/responder.rb +1 -1
  53. data/lib/locomotive/configuration.rb +2 -2
  54. data/lib/locomotive/dependencies.rb +0 -2
  55. data/lib/locomotive/engine.rb +14 -2
  56. data/lib/locomotive/mongoid/patches.rb +47 -65
  57. data/lib/locomotive/steam/services/api_entry_submission_service.rb +1 -0
  58. data/lib/locomotive/version.rb +1 -1
  59. data/vendor/assets/javascripts/locomotive/codemirror/addons/comment/comment.js +203 -0
  60. data/vendor/assets/javascripts/locomotive/codemirror/addons/comment/continuecomment.js +85 -0
  61. data/vendor/assets/javascripts/locomotive/codemirror/addons/dialog/dialog.js +157 -0
  62. data/vendor/assets/javascripts/locomotive/codemirror/addons/display/autorefresh.js +47 -0
  63. data/vendor/assets/javascripts/locomotive/codemirror/addons/display/fullscreen.js +41 -0
  64. data/vendor/assets/javascripts/locomotive/codemirror/addons/display/panel.js +112 -0
  65. data/vendor/assets/javascripts/locomotive/codemirror/addons/display/placeholder.js +62 -0
  66. data/vendor/assets/javascripts/locomotive/codemirror/addons/display/rulers.js +51 -0
  67. data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/closebrackets.js +195 -0
  68. data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/closetag.js +169 -0
  69. data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/continuelist.js +51 -0
  70. data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/matchbrackets.js +120 -0
  71. data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/matchtags.js +66 -0
  72. data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/trailingspace.js +27 -0
  73. data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/brace-fold.js +105 -0
  74. data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/comment-fold.js +59 -0
  75. data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/foldcode.js +150 -0
  76. data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/foldgutter.js +146 -0
  77. data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/indent-fold.js +44 -0
  78. data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/markdown-fold.js +49 -0
  79. data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/xml-fold.js +182 -0
  80. data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/anyword-hint.js +41 -0
  81. data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/css-hint.js +60 -0
  82. data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/html-hint.js +348 -0
  83. data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/javascript-hint.js +146 -0
  84. data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/show-hint.js +437 -0
  85. data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/sql-hint.js +271 -0
  86. data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/xml-hint.js +110 -0
  87. data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/coffeescript-lint.js +41 -0
  88. data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/css-lint.js +35 -0
  89. data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/html-lint.js +46 -0
  90. data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/javascript-lint.js +136 -0
  91. data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/json-lint.js +31 -0
  92. data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/lint.js +239 -0
  93. data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/yaml-lint.js +28 -0
  94. data/vendor/assets/javascripts/locomotive/codemirror/addons/merge/merge.js +773 -0
  95. data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/loadmode.js +64 -0
  96. data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/multiplex.js +123 -0
  97. data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/overlay.js +85 -0
  98. data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/simple.js +213 -0
  99. data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/colorize.js +40 -0
  100. data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode-standalone.js +157 -0
  101. data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode.js +72 -0
  102. data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode.node.js +179 -0
  103. data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/annotatescrollbar.js +118 -0
  104. data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/scrollpastend.js +48 -0
  105. data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/simplescrollbars.js +152 -0
  106. data/vendor/assets/javascripts/locomotive/codemirror/addons/search/jump-to-line.js +49 -0
  107. data/vendor/assets/javascripts/locomotive/codemirror/addons/search/match-highlighter.js +146 -0
  108. data/vendor/assets/javascripts/locomotive/codemirror/addons/search/matchesonscrollbar.js +97 -0
  109. data/vendor/assets/javascripts/locomotive/codemirror/addons/search/search.js +249 -0
  110. data/vendor/assets/javascripts/locomotive/codemirror/addons/search/searchcursor.js +189 -0
  111. data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/active-line.js +74 -0
  112. data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/mark-selection.js +118 -0
  113. data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/selection-pointer.js +98 -0
  114. data/vendor/assets/javascripts/locomotive/codemirror/addons/tern/tern.js +701 -0
  115. data/vendor/assets/javascripts/locomotive/codemirror/addons/tern/worker.js +44 -0
  116. data/vendor/assets/javascripts/locomotive/codemirror/addons/wrap/hardwrap.js +144 -0
  117. data/vendor/assets/javascripts/locomotive/codemirror/keymaps/emacs.js +412 -0
  118. data/vendor/assets/javascripts/locomotive/codemirror/keymaps/sublime.js +580 -0
  119. data/vendor/assets/javascripts/locomotive/codemirror/keymaps/vim.js +5065 -0
  120. data/vendor/assets/javascripts/locomotive/codemirror/modes/apl.js +174 -0
  121. data/vendor/assets/javascripts/locomotive/codemirror/modes/asciiarmor.js +73 -0
  122. data/vendor/assets/javascripts/locomotive/codemirror/modes/asn.1.js +204 -0
  123. data/vendor/assets/javascripts/locomotive/codemirror/modes/asterisk.js +196 -0
  124. data/vendor/assets/javascripts/locomotive/codemirror/modes/brainfuck.js +85 -0
  125. data/vendor/assets/javascripts/locomotive/codemirror/modes/clike.js +786 -0
  126. data/vendor/assets/javascripts/locomotive/codemirror/modes/clojure.js +306 -0
  127. data/vendor/assets/javascripts/locomotive/codemirror/modes/cmake.js +97 -0
  128. data/vendor/assets/javascripts/locomotive/codemirror/modes/cobol.js +255 -0
  129. data/vendor/assets/javascripts/locomotive/codemirror/modes/coffeescript.js +355 -0
  130. data/vendor/assets/javascripts/locomotive/codemirror/modes/commonlisp.js +123 -0
  131. data/vendor/assets/javascripts/locomotive/codemirror/modes/crystal.js +391 -0
  132. data/vendor/assets/javascripts/locomotive/codemirror/modes/css.js +825 -0
  133. data/vendor/assets/javascripts/locomotive/codemirror/modes/cypher.js +146 -0
  134. data/vendor/assets/javascripts/locomotive/codemirror/modes/d.js +218 -0
  135. data/vendor/assets/javascripts/locomotive/codemirror/modes/dart.js +157 -0
  136. data/vendor/assets/javascripts/locomotive/codemirror/modes/diff.js +47 -0
  137. data/vendor/assets/javascripts/locomotive/codemirror/modes/django.js +356 -0
  138. data/vendor/assets/javascripts/locomotive/codemirror/modes/dockerfile.js +79 -0
  139. data/vendor/assets/javascripts/locomotive/codemirror/modes/dtd.js +142 -0
  140. data/vendor/assets/javascripts/locomotive/codemirror/modes/dylan.js +344 -0
  141. data/vendor/assets/javascripts/locomotive/codemirror/modes/ebnf.js +195 -0
  142. data/vendor/assets/javascripts/locomotive/codemirror/modes/ecl.js +206 -0
  143. data/vendor/assets/javascripts/locomotive/codemirror/modes/eiffel.js +160 -0
  144. data/vendor/assets/javascripts/locomotive/codemirror/modes/elm.js +205 -0
  145. data/vendor/assets/javascripts/locomotive/codemirror/modes/erlang.js +618 -0
  146. data/vendor/assets/javascripts/locomotive/codemirror/modes/factor.js +83 -0
  147. data/vendor/assets/javascripts/locomotive/codemirror/modes/fcl.js +173 -0
  148. data/vendor/assets/javascripts/locomotive/codemirror/modes/forth.js +180 -0
  149. data/vendor/assets/javascripts/locomotive/codemirror/modes/fortran.js +188 -0
  150. data/vendor/assets/javascripts/locomotive/codemirror/modes/gas.js +345 -0
  151. data/vendor/assets/javascripts/locomotive/codemirror/modes/gfm.js +130 -0
  152. data/vendor/assets/javascripts/locomotive/codemirror/modes/gherkin.js +178 -0
  153. data/vendor/assets/javascripts/locomotive/codemirror/modes/go.js +185 -0
  154. data/vendor/assets/javascripts/locomotive/codemirror/modes/groovy.js +230 -0
  155. data/vendor/assets/javascripts/locomotive/codemirror/modes/haml.js +161 -0
  156. data/vendor/assets/javascripts/locomotive/codemirror/modes/handlebars.js +62 -0
  157. data/vendor/assets/javascripts/locomotive/codemirror/modes/haskell-literate.js +43 -0
  158. data/vendor/assets/javascripts/locomotive/codemirror/modes/haskell.js +267 -0
  159. data/vendor/assets/javascripts/locomotive/codemirror/modes/haxe.js +515 -0
  160. data/vendor/assets/javascripts/locomotive/codemirror/modes/htmlembedded.js +28 -0
  161. data/vendor/assets/javascripts/locomotive/codemirror/modes/htmlmixed.js +152 -0
  162. data/vendor/assets/javascripts/locomotive/codemirror/modes/http.js +113 -0
  163. data/vendor/assets/javascripts/locomotive/codemirror/modes/idl.js +290 -0
  164. data/vendor/assets/javascripts/locomotive/codemirror/modes/jade.js +590 -0
  165. data/vendor/assets/javascripts/locomotive/codemirror/modes/javascript.js +748 -0
  166. data/vendor/assets/javascripts/locomotive/codemirror/modes/jinja2.js +142 -0
  167. data/vendor/assets/javascripts/locomotive/codemirror/modes/jsx.js +147 -0
  168. data/vendor/assets/javascripts/locomotive/codemirror/modes/julia.js +392 -0
  169. data/vendor/assets/javascripts/locomotive/codemirror/modes/livescript.js +280 -0
  170. data/vendor/assets/javascripts/locomotive/codemirror/modes/lua.js +159 -0
  171. data/vendor/assets/javascripts/locomotive/codemirror/modes/markdown.js +797 -0
  172. data/vendor/assets/javascripts/locomotive/codemirror/modes/mathematica.js +176 -0
  173. data/vendor/assets/javascripts/locomotive/codemirror/modes/mbox.js +129 -0
  174. data/vendor/assets/javascripts/locomotive/codemirror/modes/mirc.js +193 -0
  175. data/vendor/assets/javascripts/locomotive/codemirror/modes/mllike.js +205 -0
  176. data/vendor/assets/javascripts/locomotive/codemirror/modes/modelica.js +245 -0
  177. data/vendor/assets/javascripts/locomotive/codemirror/modes/mscgen.js +169 -0
  178. data/vendor/assets/javascripts/locomotive/codemirror/modes/mumps.js +148 -0
  179. data/vendor/assets/javascripts/locomotive/codemirror/modes/nginx.js +178 -0
  180. data/vendor/assets/javascripts/locomotive/codemirror/modes/nsis.js +95 -0
  181. data/vendor/assets/javascripts/locomotive/codemirror/modes/ntriples.js +186 -0
  182. data/vendor/assets/javascripts/locomotive/codemirror/modes/octave.js +135 -0
  183. data/vendor/assets/javascripts/locomotive/codemirror/modes/oz.js +252 -0
  184. data/vendor/assets/javascripts/locomotive/codemirror/modes/pascal.js +109 -0
  185. data/vendor/assets/javascripts/locomotive/codemirror/modes/pegjs.js +114 -0
  186. data/vendor/assets/javascripts/locomotive/codemirror/modes/perl.js +837 -0
  187. data/vendor/assets/javascripts/locomotive/codemirror/modes/php.js +234 -0
  188. data/vendor/assets/javascripts/locomotive/codemirror/modes/pig.js +178 -0
  189. data/vendor/assets/javascripts/locomotive/codemirror/modes/powershell.js +396 -0
  190. data/vendor/assets/javascripts/locomotive/codemirror/modes/properties.js +78 -0
  191. data/vendor/assets/javascripts/locomotive/codemirror/modes/protobuf.js +68 -0
  192. data/vendor/assets/javascripts/locomotive/codemirror/modes/puppet.js +220 -0
  193. data/vendor/assets/javascripts/locomotive/codemirror/modes/python.js +340 -0
  194. data/vendor/assets/javascripts/locomotive/codemirror/modes/q.js +139 -0
  195. data/vendor/assets/javascripts/locomotive/codemirror/modes/r.js +164 -0
  196. data/vendor/assets/javascripts/locomotive/codemirror/modes/rpm.js +109 -0
  197. data/vendor/assets/javascripts/locomotive/codemirror/modes/rst.js +557 -0
  198. data/vendor/assets/javascripts/locomotive/codemirror/modes/ruby.js +285 -0
  199. data/vendor/assets/javascripts/locomotive/codemirror/modes/rust.js +71 -0
  200. data/vendor/assets/javascripts/locomotive/codemirror/modes/sas.js +315 -0
  201. data/vendor/assets/javascripts/locomotive/codemirror/modes/sass.js +414 -0
  202. data/vendor/assets/javascripts/locomotive/codemirror/modes/scheme.js +249 -0
  203. data/vendor/assets/javascripts/locomotive/codemirror/modes/shell.js +139 -0
  204. data/vendor/assets/javascripts/locomotive/codemirror/modes/sieve.js +193 -0
  205. data/vendor/assets/javascripts/locomotive/codemirror/modes/slim.js +575 -0
  206. data/vendor/assets/javascripts/locomotive/codemirror/modes/smalltalk.js +168 -0
  207. data/vendor/assets/javascripts/locomotive/codemirror/modes/smarty.js +225 -0
  208. data/vendor/assets/javascripts/locomotive/codemirror/modes/solr.js +104 -0
  209. data/vendor/assets/javascripts/locomotive/codemirror/modes/soy.js +199 -0
  210. data/vendor/assets/javascripts/locomotive/codemirror/modes/sparql.js +180 -0
  211. data/vendor/assets/javascripts/locomotive/codemirror/modes/spreadsheet.js +112 -0
  212. data/vendor/assets/javascripts/locomotive/codemirror/modes/sql.js +413 -0
  213. data/vendor/assets/javascripts/locomotive/codemirror/modes/stex.js +251 -0
  214. data/vendor/assets/javascripts/locomotive/codemirror/modes/stylus.js +769 -0
  215. data/vendor/assets/javascripts/locomotive/codemirror/modes/swift.js +202 -0
  216. data/vendor/assets/javascripts/locomotive/codemirror/modes/tcl.js +139 -0
  217. data/vendor/assets/javascripts/locomotive/codemirror/modes/textile.js +469 -0
  218. data/vendor/assets/javascripts/locomotive/codemirror/modes/tiddlywiki.js +308 -0
  219. data/vendor/assets/javascripts/locomotive/codemirror/modes/tiki.js +312 -0
  220. data/vendor/assets/javascripts/locomotive/codemirror/modes/toml.js +88 -0
  221. data/vendor/assets/javascripts/locomotive/codemirror/modes/tornado.js +68 -0
  222. data/vendor/assets/javascripts/locomotive/codemirror/modes/troff.js +84 -0
  223. data/vendor/assets/javascripts/locomotive/codemirror/modes/ttcn-cfg.js +214 -0
  224. data/vendor/assets/javascripts/locomotive/codemirror/modes/ttcn.js +283 -0
  225. data/vendor/assets/javascripts/locomotive/codemirror/modes/turtle.js +162 -0
  226. data/vendor/assets/javascripts/locomotive/codemirror/modes/twig.js +141 -0
  227. data/vendor/assets/javascripts/locomotive/codemirror/modes/vb.js +276 -0
  228. data/vendor/assets/javascripts/locomotive/codemirror/modes/vbscript.js +350 -0
  229. data/vendor/assets/javascripts/locomotive/codemirror/modes/velocity.js +201 -0
  230. data/vendor/assets/javascripts/locomotive/codemirror/modes/verilog.js +537 -0
  231. data/vendor/assets/javascripts/locomotive/codemirror/modes/vhdl.js +189 -0
  232. data/vendor/assets/javascripts/locomotive/codemirror/modes/vue.js +69 -0
  233. data/vendor/assets/javascripts/locomotive/codemirror/modes/webidl.js +195 -0
  234. data/vendor/assets/javascripts/locomotive/codemirror/modes/xml.js +394 -0
  235. data/vendor/assets/javascripts/locomotive/codemirror/modes/xquery.js +437 -0
  236. data/vendor/assets/javascripts/locomotive/codemirror/modes/yacas.js +204 -0
  237. data/vendor/assets/javascripts/locomotive/codemirror/modes/yaml-frontmatter.js +68 -0
  238. data/vendor/assets/javascripts/locomotive/codemirror/modes/yaml.js +117 -0
  239. data/vendor/assets/javascripts/locomotive/codemirror/modes/z80.js +116 -0
  240. data/vendor/assets/javascripts/locomotive/codemirror.js +8922 -0
  241. data/vendor/assets/javascripts/locomotive/select2.js +436 -175
  242. data/vendor/assets/javascripts/locomotive/wysihtml5x-toolbar.js +1346 -564
  243. data/vendor/assets/stylesheets/locomotive/codemirror/addons/dialog/dialog.css +32 -0
  244. data/vendor/assets/stylesheets/locomotive/codemirror/addons/display/fullscreen.css +6 -0
  245. data/vendor/assets/stylesheets/locomotive/codemirror/addons/fold/foldgutter.css +20 -0
  246. data/vendor/assets/stylesheets/locomotive/codemirror/addons/hint/show-hint.css +37 -0
  247. data/vendor/assets/stylesheets/locomotive/codemirror/addons/lint/lint.css +73 -0
  248. data/vendor/assets/stylesheets/locomotive/codemirror/addons/merge/merge.css +113 -0
  249. data/vendor/assets/stylesheets/locomotive/codemirror/addons/scroll/simplescrollbars.css +66 -0
  250. data/vendor/assets/stylesheets/locomotive/codemirror/addons/search/matchesonscrollbar.css +8 -0
  251. data/vendor/assets/stylesheets/locomotive/codemirror/addons/tern/tern.css +87 -0
  252. data/vendor/assets/stylesheets/locomotive/codemirror/modes/tiddlywiki.css +14 -0
  253. data/vendor/assets/stylesheets/locomotive/codemirror/modes/tiki.css +26 -0
  254. data/vendor/assets/stylesheets/locomotive/codemirror/themes/3024-day.css +41 -0
  255. data/vendor/assets/stylesheets/locomotive/codemirror/themes/3024-night.css +39 -0
  256. data/vendor/assets/stylesheets/locomotive/codemirror/themes/abcdef.css +32 -0
  257. data/vendor/assets/stylesheets/locomotive/codemirror/themes/ambiance-mobile.css +5 -0
  258. data/vendor/assets/stylesheets/locomotive/codemirror/themes/ambiance.css +74 -0
  259. data/vendor/assets/stylesheets/locomotive/codemirror/themes/base16-dark.css +38 -0
  260. data/vendor/assets/stylesheets/locomotive/codemirror/themes/base16-light.css +38 -0
  261. data/vendor/assets/stylesheets/locomotive/codemirror/themes/bespin.css +34 -0
  262. data/vendor/assets/stylesheets/locomotive/codemirror/themes/blackboard.css +32 -0
  263. data/vendor/assets/stylesheets/locomotive/codemirror/themes/cobalt.css +25 -0
  264. data/vendor/assets/stylesheets/locomotive/codemirror/themes/colorforth.css +33 -0
  265. data/vendor/assets/stylesheets/locomotive/codemirror/themes/dracula.css +41 -0
  266. data/vendor/assets/stylesheets/locomotive/codemirror/themes/eclipse.css +23 -0
  267. data/vendor/assets/stylesheets/locomotive/codemirror/themes/elegant.css +13 -0
  268. data/vendor/assets/stylesheets/locomotive/codemirror/themes/erlang-dark.css +34 -0
  269. data/vendor/assets/stylesheets/locomotive/codemirror/themes/hopscotch.css +34 -0
  270. data/vendor/assets/stylesheets/locomotive/codemirror/themes/icecoder.css +43 -0
  271. data/vendor/assets/stylesheets/locomotive/codemirror/themes/isotope.css +34 -0
  272. data/vendor/assets/stylesheets/locomotive/codemirror/themes/lesser-dark.css +47 -0
  273. data/vendor/assets/stylesheets/locomotive/codemirror/themes/liquibyte.css +95 -0
  274. data/vendor/assets/stylesheets/locomotive/codemirror/themes/material.css +53 -0
  275. data/vendor/assets/stylesheets/locomotive/codemirror/themes/mbo.css +37 -0
  276. data/vendor/assets/stylesheets/locomotive/codemirror/themes/mdn-like.css +46 -0
  277. data/vendor/assets/stylesheets/locomotive/codemirror/themes/midnight.css +45 -0
  278. data/vendor/assets/stylesheets/locomotive/codemirror/themes/monokai.css +36 -0
  279. data/vendor/assets/stylesheets/locomotive/codemirror/themes/neat.css +12 -0
  280. data/vendor/assets/stylesheets/locomotive/codemirror/themes/neo.css +43 -0
  281. data/vendor/assets/stylesheets/locomotive/codemirror/themes/night.css +27 -0
  282. data/vendor/assets/stylesheets/locomotive/codemirror/themes/paraiso-dark.css +38 -0
  283. data/vendor/assets/stylesheets/locomotive/codemirror/themes/paraiso-light.css +38 -0
  284. data/vendor/assets/stylesheets/locomotive/codemirror/themes/pastel-on-dark.css +53 -0
  285. data/vendor/assets/stylesheets/locomotive/codemirror/themes/railscasts.css +34 -0
  286. data/vendor/assets/stylesheets/locomotive/codemirror/themes/rubyblue.css +25 -0
  287. data/vendor/assets/stylesheets/locomotive/codemirror/themes/seti.css +44 -0
  288. data/vendor/assets/stylesheets/locomotive/codemirror/themes/solarized.css +169 -0
  289. data/vendor/assets/stylesheets/locomotive/codemirror/themes/the-matrix.css +30 -0
  290. data/vendor/assets/stylesheets/locomotive/codemirror/themes/tomorrow-night-bright.css +35 -0
  291. data/vendor/assets/stylesheets/locomotive/codemirror/themes/tomorrow-night-eighties.css +38 -0
  292. data/vendor/assets/stylesheets/locomotive/codemirror/themes/ttcn.css +64 -0
  293. data/vendor/assets/stylesheets/locomotive/codemirror/themes/twilight.css +32 -0
  294. data/vendor/assets/stylesheets/locomotive/codemirror/themes/vibrant-ink.css +34 -0
  295. data/vendor/assets/stylesheets/locomotive/codemirror/themes/xq-dark.css +53 -0
  296. data/vendor/assets/stylesheets/locomotive/codemirror/themes/xq-light.css +43 -0
  297. data/vendor/assets/stylesheets/locomotive/codemirror/themes/yeti.css +44 -0
  298. data/vendor/assets/stylesheets/locomotive/codemirror/themes/zenburn.css +37 -0
  299. data/vendor/assets/stylesheets/locomotive/codemirror.css +347 -0
  300. data/vendor/assets/stylesheets/locomotive/select2.css +3 -6
  301. metadata +349 -128
@@ -0,0 +1,142 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ CodeMirror.defineMode("jinja2", function() {
15
+ var keywords = ["and", "as", "block", "endblock", "by", "cycle", "debug", "else", "elif",
16
+ "extends", "filter", "endfilter", "firstof", "for",
17
+ "endfor", "if", "endif", "ifchanged", "endifchanged",
18
+ "ifequal", "endifequal", "ifnotequal",
19
+ "endifnotequal", "in", "include", "load", "not", "now", "or",
20
+ "parsed", "regroup", "reversed", "spaceless",
21
+ "endspaceless", "ssi", "templatetag", "openblock",
22
+ "closeblock", "openvariable", "closevariable",
23
+ "openbrace", "closebrace", "opencomment",
24
+ "closecomment", "widthratio", "url", "with", "endwith",
25
+ "get_current_language", "trans", "endtrans", "noop", "blocktrans",
26
+ "endblocktrans", "get_available_languages",
27
+ "get_current_language_bidi", "plural"],
28
+ operator = /^[+\-*&%=<>!?|~^]/,
29
+ sign = /^[:\[\(\{]/,
30
+ atom = ["true", "false"],
31
+ number = /^(\d[+\-\*\/])?\d+(\.\d+)?/;
32
+
33
+ keywords = new RegExp("((" + keywords.join(")|(") + "))\\b");
34
+ atom = new RegExp("((" + atom.join(")|(") + "))\\b");
35
+
36
+ function tokenBase (stream, state) {
37
+ var ch = stream.peek();
38
+
39
+ //Comment
40
+ if (state.incomment) {
41
+ if(!stream.skipTo("#}")) {
42
+ stream.skipToEnd();
43
+ } else {
44
+ stream.eatWhile(/\#|}/);
45
+ state.incomment = false;
46
+ }
47
+ return "comment";
48
+ //Tag
49
+ } else if (state.intag) {
50
+ //After operator
51
+ if(state.operator) {
52
+ state.operator = false;
53
+ if(stream.match(atom)) {
54
+ return "atom";
55
+ }
56
+ if(stream.match(number)) {
57
+ return "number";
58
+ }
59
+ }
60
+ //After sign
61
+ if(state.sign) {
62
+ state.sign = false;
63
+ if(stream.match(atom)) {
64
+ return "atom";
65
+ }
66
+ if(stream.match(number)) {
67
+ return "number";
68
+ }
69
+ }
70
+
71
+ if(state.instring) {
72
+ if(ch == state.instring) {
73
+ state.instring = false;
74
+ }
75
+ stream.next();
76
+ return "string";
77
+ } else if(ch == "'" || ch == '"') {
78
+ state.instring = ch;
79
+ stream.next();
80
+ return "string";
81
+ } else if(stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}")) {
82
+ state.intag = false;
83
+ return "tag";
84
+ } else if(stream.match(operator)) {
85
+ state.operator = true;
86
+ return "operator";
87
+ } else if(stream.match(sign)) {
88
+ state.sign = true;
89
+ } else {
90
+ if(stream.eat(" ") || stream.sol()) {
91
+ if(stream.match(keywords)) {
92
+ return "keyword";
93
+ }
94
+ if(stream.match(atom)) {
95
+ return "atom";
96
+ }
97
+ if(stream.match(number)) {
98
+ return "number";
99
+ }
100
+ if(stream.sol()) {
101
+ stream.next();
102
+ }
103
+ } else {
104
+ stream.next();
105
+ }
106
+
107
+ }
108
+ return "variable";
109
+ } else if (stream.eat("{")) {
110
+ if (ch = stream.eat("#")) {
111
+ state.incomment = true;
112
+ if(!stream.skipTo("#}")) {
113
+ stream.skipToEnd();
114
+ } else {
115
+ stream.eatWhile(/\#|}/);
116
+ state.incomment = false;
117
+ }
118
+ return "comment";
119
+ //Open tag
120
+ } else if (ch = stream.eat(/\{|%/)) {
121
+ //Cache close tag
122
+ state.intag = ch;
123
+ if(ch == "{") {
124
+ state.intag = "}";
125
+ }
126
+ stream.eat("-");
127
+ return "tag";
128
+ }
129
+ }
130
+ stream.next();
131
+ };
132
+
133
+ return {
134
+ startState: function () {
135
+ return {tokenize: tokenBase};
136
+ },
137
+ token: function (stream, state) {
138
+ return state.tokenize(stream, state);
139
+ }
140
+ };
141
+ });
142
+ });
@@ -0,0 +1,147 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"), require("../xml/xml"), require("../javascript/javascript"))
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript"], mod)
9
+ else // Plain browser env
10
+ mod(CodeMirror)
11
+ })(function(CodeMirror) {
12
+ "use strict"
13
+
14
+ // Depth means the amount of open braces in JS context, in XML
15
+ // context 0 means not in tag, 1 means in tag, and 2 means in tag
16
+ // and js block comment.
17
+ function Context(state, mode, depth, prev) {
18
+ this.state = state; this.mode = mode; this.depth = depth; this.prev = prev
19
+ }
20
+
21
+ function copyContext(context) {
22
+ return new Context(CodeMirror.copyState(context.mode, context.state),
23
+ context.mode,
24
+ context.depth,
25
+ context.prev && copyContext(context.prev))
26
+ }
27
+
28
+ CodeMirror.defineMode("jsx", function(config, modeConfig) {
29
+ var xmlMode = CodeMirror.getMode(config, {name: "xml", allowMissing: true, multilineTagIndentPastTag: false})
30
+ var jsMode = CodeMirror.getMode(config, modeConfig && modeConfig.base || "javascript")
31
+
32
+ function flatXMLIndent(state) {
33
+ var tagName = state.tagName
34
+ state.tagName = null
35
+ var result = xmlMode.indent(state, "")
36
+ state.tagName = tagName
37
+ return result
38
+ }
39
+
40
+ function token(stream, state) {
41
+ if (state.context.mode == xmlMode)
42
+ return xmlToken(stream, state, state.context)
43
+ else
44
+ return jsToken(stream, state, state.context)
45
+ }
46
+
47
+ function xmlToken(stream, state, cx) {
48
+ if (cx.depth == 2) { // Inside a JS /* */ comment
49
+ if (stream.match(/^.*?\*\//)) cx.depth = 1
50
+ else stream.skipToEnd()
51
+ return "comment"
52
+ }
53
+
54
+ if (stream.peek() == "{") {
55
+ xmlMode.skipAttribute(cx.state)
56
+
57
+ var indent = flatXMLIndent(cx.state), xmlContext = cx.state.context
58
+ // If JS starts on same line as tag
59
+ if (xmlContext && stream.match(/^[^>]*>\s*$/, false)) {
60
+ while (xmlContext.prev && !xmlContext.startOfLine)
61
+ xmlContext = xmlContext.prev
62
+ // If tag starts the line, use XML indentation level
63
+ if (xmlContext.startOfLine) indent -= config.indentUnit
64
+ // Else use JS indentation level
65
+ else if (cx.prev.state.lexical) indent = cx.prev.state.lexical.indented
66
+ // Else if inside of tag
67
+ } else if (cx.depth == 1) {
68
+ indent += config.indentUnit
69
+ }
70
+
71
+ state.context = new Context(CodeMirror.startState(jsMode, indent),
72
+ jsMode, 0, state.context)
73
+ return null
74
+ }
75
+
76
+ if (cx.depth == 1) { // Inside of tag
77
+ if (stream.peek() == "<") { // Tag inside of tag
78
+ xmlMode.skipAttribute(cx.state)
79
+ state.context = new Context(CodeMirror.startState(xmlMode, flatXMLIndent(cx.state)),
80
+ xmlMode, 0, state.context)
81
+ return null
82
+ } else if (stream.match("//")) {
83
+ stream.skipToEnd()
84
+ return "comment"
85
+ } else if (stream.match("/*")) {
86
+ cx.depth = 2
87
+ return token(stream, state)
88
+ }
89
+ }
90
+
91
+ var style = xmlMode.token(stream, cx.state), cur = stream.current(), stop
92
+ if (/\btag\b/.test(style)) {
93
+ if (/>$/.test(cur)) {
94
+ if (cx.state.context) cx.depth = 0
95
+ else state.context = state.context.prev
96
+ } else if (/^</.test(cur)) {
97
+ cx.depth = 1
98
+ }
99
+ } else if (!style && (stop = cur.indexOf("{")) > -1) {
100
+ stream.backUp(cur.length - stop)
101
+ }
102
+ return style
103
+ }
104
+
105
+ function jsToken(stream, state, cx) {
106
+ if (stream.peek() == "<" && jsMode.expressionAllowed(stream, cx.state)) {
107
+ jsMode.skipExpression(cx.state)
108
+ state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, "")),
109
+ xmlMode, 0, state.context)
110
+ return null
111
+ }
112
+
113
+ var style = jsMode.token(stream, cx.state)
114
+ if (!style && cx.depth != null) {
115
+ var cur = stream.current()
116
+ if (cur == "{") {
117
+ cx.depth++
118
+ } else if (cur == "}") {
119
+ if (--cx.depth == 0) state.context = state.context.prev
120
+ }
121
+ }
122
+ return style
123
+ }
124
+
125
+ return {
126
+ startState: function() {
127
+ return {context: new Context(CodeMirror.startState(jsMode), jsMode)}
128
+ },
129
+
130
+ copyState: function(state) {
131
+ return {context: copyContext(state.context)}
132
+ },
133
+
134
+ token: token,
135
+
136
+ indent: function(state, textAfter, fullLine) {
137
+ return state.context.mode.indent(state.context.state, textAfter, fullLine)
138
+ },
139
+
140
+ innerMode: function(state) {
141
+ return state.context
142
+ }
143
+ }
144
+ }, "xml", "javascript")
145
+
146
+ CodeMirror.defineMIME("text/jsx", "jsx")
147
+ });
@@ -0,0 +1,392 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ CodeMirror.defineMode("julia", function(_conf, parserConf) {
15
+ var ERRORCLASS = 'error';
16
+
17
+ function wordRegexp(words, end) {
18
+ if (typeof end === 'undefined') { end = "\\b"; }
19
+ return new RegExp("^((" + words.join(")|(") + "))" + end);
20
+ }
21
+
22
+ var octChar = "\\\\[0-7]{1,3}";
23
+ var hexChar = "\\\\x[A-Fa-f0-9]{1,2}";
24
+ var specialChar = "\\\\[abfnrtv0%?'\"\\\\]";
25
+ var singleChar = "([^\\u0027\\u005C\\uD800-\\uDFFF]|[\\uD800-\\uDFFF][\\uDC00-\\uDFFF])";
26
+ var operators = parserConf.operators || /^\.?[|&^\\%*+\-<>!=\/]=?|\?|~|:|\$|\.[<>]|<<=?|>>>?=?|\.[<>=]=|->?|\/\/|\bin\b(?!\()|[\u2208\u2209](?!\()/;
27
+ var delimiters = parserConf.delimiters || /^[;,()[\]{}]/;
28
+ var identifiers = parserConf.identifiers || /^[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/;
29
+ var charsList = [octChar, hexChar, specialChar, singleChar];
30
+ var blockOpeners = ["begin", "function", "type", "immutable", "let", "macro", "for", "while", "quote", "if", "else", "elseif", "try", "finally", "catch", "do"];
31
+ var blockClosers = ["end", "else", "elseif", "catch", "finally"];
32
+ var keywordList = ['if', 'else', 'elseif', 'while', 'for', 'begin', 'let', 'end', 'do', 'try', 'catch', 'finally', 'return', 'break', 'continue', 'global', 'local', 'const', 'export', 'import', 'importall', 'using', 'function', 'macro', 'module', 'baremodule', 'type', 'immutable', 'quote', 'typealias', 'abstract', 'bitstype'];
33
+ var builtinList = ['true', 'false', 'nothing', 'NaN', 'Inf'];
34
+
35
+ //var stringPrefixes = new RegExp("^[br]?('|\")")
36
+ var stringPrefixes = /^(`|"{3}|([brv]?"))/;
37
+ var chars = wordRegexp(charsList, "'");
38
+ var keywords = wordRegexp(keywordList);
39
+ var builtins = wordRegexp(builtinList);
40
+ var openers = wordRegexp(blockOpeners);
41
+ var closers = wordRegexp(blockClosers);
42
+ var macro = /^@[_A-Za-z][\w]*/;
43
+ var symbol = /^:[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/;
44
+ var typeAnnotation = /^::[^,;"{()=$\s]+({[^}]*}+)*/;
45
+
46
+ function inArray(state) {
47
+ var ch = currentScope(state);
48
+ if (ch == '[') {
49
+ return true;
50
+ }
51
+ return false;
52
+ }
53
+
54
+ function currentScope(state) {
55
+ if (state.scopes.length == 0) {
56
+ return null;
57
+ }
58
+ return state.scopes[state.scopes.length - 1];
59
+ }
60
+
61
+ // tokenizers
62
+ function tokenBase(stream, state) {
63
+ // Handle multiline comments
64
+ if (stream.match(/^#=/, false)) {
65
+ state.tokenize = tokenComment;
66
+ return state.tokenize(stream, state);
67
+ }
68
+
69
+ // Handle scope changes
70
+ var leavingExpr = state.leavingExpr;
71
+ if (stream.sol()) {
72
+ leavingExpr = false;
73
+ }
74
+ state.leavingExpr = false;
75
+ if (leavingExpr) {
76
+ if (stream.match(/^'+/)) {
77
+ return 'operator';
78
+ }
79
+ }
80
+
81
+ if (stream.match(/^\.{2,3}/)) {
82
+ return 'operator';
83
+ }
84
+
85
+ if (stream.eatSpace()) {
86
+ return null;
87
+ }
88
+
89
+ var ch = stream.peek();
90
+
91
+ // Handle single line comments
92
+ if (ch === '#') {
93
+ stream.skipToEnd();
94
+ return 'comment';
95
+ }
96
+
97
+ if (ch === '[') {
98
+ state.scopes.push('[');
99
+ }
100
+
101
+ if (ch === '(') {
102
+ state.scopes.push('(');
103
+ }
104
+
105
+ var scope = currentScope(state);
106
+
107
+ if (scope == '[' && ch === ']') {
108
+ state.scopes.pop();
109
+ state.leavingExpr = true;
110
+ }
111
+
112
+ if (scope == '(' && ch === ')') {
113
+ state.scopes.pop();
114
+ state.leavingExpr = true;
115
+ }
116
+
117
+ var match;
118
+ if (!inArray(state) && (match=stream.match(openers, false))) {
119
+ state.scopes.push(match);
120
+ }
121
+
122
+ if (!inArray(state) && stream.match(closers, false)) {
123
+ state.scopes.pop();
124
+ }
125
+
126
+ if (inArray(state)) {
127
+ if (state.lastToken == 'end' && stream.match(/^:/)) {
128
+ return 'operator';
129
+ }
130
+ if (stream.match(/^end/)) {
131
+ return 'number';
132
+ }
133
+ }
134
+
135
+ if (stream.match(/^=>/)) {
136
+ return 'operator';
137
+ }
138
+
139
+ // Handle Number Literals
140
+ if (stream.match(/^[0-9\.]/, false)) {
141
+ var imMatcher = RegExp(/^im\b/);
142
+ var numberLiteral = false;
143
+ // Floats
144
+ if (stream.match(/^\d*\.(?!\.)\d*([Eef][\+\-]?\d+)?/i)) { numberLiteral = true; }
145
+ if (stream.match(/^\d+\.(?!\.)\d*/)) { numberLiteral = true; }
146
+ if (stream.match(/^\.\d+/)) { numberLiteral = true; }
147
+ if (stream.match(/^0x\.[0-9a-f]+p[\+\-]?\d+/i)) { numberLiteral = true; }
148
+ // Integers
149
+ if (stream.match(/^0x[0-9a-f]+/i)) { numberLiteral = true; } // Hex
150
+ if (stream.match(/^0b[01]+/i)) { numberLiteral = true; } // Binary
151
+ if (stream.match(/^0o[0-7]+/i)) { numberLiteral = true; } // Octal
152
+ if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) { numberLiteral = true; } // Decimal
153
+ // Zero by itself with no other piece of number.
154
+ if (stream.match(/^0(?![\dx])/i)) { numberLiteral = true; }
155
+ if (numberLiteral) {
156
+ // Integer literals may be "long"
157
+ stream.match(imMatcher);
158
+ state.leavingExpr = true;
159
+ return 'number';
160
+ }
161
+ }
162
+
163
+ if (stream.match(/^<:/)) {
164
+ return 'operator';
165
+ }
166
+
167
+ if (stream.match(typeAnnotation)) {
168
+ return 'builtin';
169
+ }
170
+
171
+ // Handle symbols
172
+ if (!leavingExpr && stream.match(symbol) || stream.match(/:\./)) {
173
+ return 'builtin';
174
+ }
175
+
176
+ // Handle parametric types
177
+ if (stream.match(/^{[^}]*}(?=\()/)) {
178
+ return 'builtin';
179
+ }
180
+
181
+ // Handle operators and Delimiters
182
+ if (stream.match(operators)) {
183
+ return 'operator';
184
+ }
185
+
186
+ // Handle Chars
187
+ if (stream.match(/^'/)) {
188
+ state.tokenize = tokenChar;
189
+ return state.tokenize(stream, state);
190
+ }
191
+
192
+ // Handle Strings
193
+ if (stream.match(stringPrefixes)) {
194
+ state.tokenize = tokenStringFactory(stream.current());
195
+ return state.tokenize(stream, state);
196
+ }
197
+
198
+ if (stream.match(macro)) {
199
+ return 'meta';
200
+ }
201
+
202
+ if (stream.match(delimiters)) {
203
+ return null;
204
+ }
205
+
206
+ if (stream.match(keywords)) {
207
+ return 'keyword';
208
+ }
209
+
210
+ if (stream.match(builtins)) {
211
+ return 'builtin';
212
+ }
213
+
214
+ var isDefinition = state.isDefinition ||
215
+ state.lastToken == 'function' ||
216
+ state.lastToken == 'macro' ||
217
+ state.lastToken == 'type' ||
218
+ state.lastToken == 'immutable';
219
+
220
+ if (stream.match(identifiers)) {
221
+ if (isDefinition) {
222
+ if (stream.peek() === '.') {
223
+ state.isDefinition = true;
224
+ return 'variable';
225
+ }
226
+ state.isDefinition = false;
227
+ return 'def';
228
+ }
229
+ if (stream.match(/^({[^}]*})*\(/, false)) {
230
+ return callOrDef(stream, state);
231
+ }
232
+ state.leavingExpr = true;
233
+ return 'variable';
234
+ }
235
+
236
+ // Handle non-detected items
237
+ stream.next();
238
+ return ERRORCLASS;
239
+ }
240
+
241
+ function callOrDef(stream, state) {
242
+ var match = stream.match(/^(\(\s*)/);
243
+ if (match) {
244
+ if (state.firstParenPos < 0)
245
+ state.firstParenPos = state.scopes.length;
246
+ state.scopes.push('(');
247
+ state.charsAdvanced += match[1].length;
248
+ }
249
+ if (currentScope(state) == '(' && stream.match(/^\)/)) {
250
+ state.scopes.pop();
251
+ state.charsAdvanced += 1;
252
+ if (state.scopes.length <= state.firstParenPos) {
253
+ var isDefinition = stream.match(/^\s*?=(?!=)/, false);
254
+ stream.backUp(state.charsAdvanced);
255
+ state.firstParenPos = -1;
256
+ state.charsAdvanced = 0;
257
+ if (isDefinition)
258
+ return 'def';
259
+ return 'builtin';
260
+ }
261
+ }
262
+ // Unfortunately javascript does not support multiline strings, so we have
263
+ // to undo anything done upto here if a function call or definition splits
264
+ // over two or more lines.
265
+ if (stream.match(/^$/g, false)) {
266
+ stream.backUp(state.charsAdvanced);
267
+ while (state.scopes.length > state.firstParenPos)
268
+ state.scopes.pop();
269
+ state.firstParenPos = -1;
270
+ state.charsAdvanced = 0;
271
+ return 'builtin';
272
+ }
273
+ state.charsAdvanced += stream.match(/^([^()]*)/)[1].length;
274
+ return callOrDef(stream, state);
275
+ }
276
+
277
+ function tokenComment(stream, state) {
278
+ if (stream.match(/^#=/)) {
279
+ state.weakScopes++;
280
+ }
281
+ if (!stream.match(/.*?(?=(#=|=#))/)) {
282
+ stream.skipToEnd();
283
+ }
284
+ if (stream.match(/^=#/)) {
285
+ state.weakScopes--;
286
+ if (state.weakScopes == 0)
287
+ state.tokenize = tokenBase;
288
+ }
289
+ return 'comment';
290
+ }
291
+
292
+ function tokenChar(stream, state) {
293
+ var isChar = false, match;
294
+ if (stream.match(chars)) {
295
+ isChar = true;
296
+ } else if (match = stream.match(/\\u([a-f0-9]{1,4})(?=')/i)) {
297
+ var value = parseInt(match[1], 16);
298
+ if (value <= 55295 || value >= 57344) { // (U+0,U+D7FF), (U+E000,U+FFFF)
299
+ isChar = true;
300
+ stream.next();
301
+ }
302
+ } else if (match = stream.match(/\\U([A-Fa-f0-9]{5,8})(?=')/)) {
303
+ var value = parseInt(match[1], 16);
304
+ if (value <= 1114111) { // U+10FFFF
305
+ isChar = true;
306
+ stream.next();
307
+ }
308
+ }
309
+ if (isChar) {
310
+ state.leavingExpr = true;
311
+ state.tokenize = tokenBase;
312
+ return 'string';
313
+ }
314
+ if (!stream.match(/^[^']+(?=')/)) { stream.skipToEnd(); }
315
+ if (stream.match(/^'/)) { state.tokenize = tokenBase; }
316
+ return ERRORCLASS;
317
+ }
318
+
319
+ function tokenStringFactory(delimiter) {
320
+ while ('bruv'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
321
+ delimiter = delimiter.substr(1);
322
+ }
323
+ var OUTCLASS = 'string';
324
+
325
+ function tokenString(stream, state) {
326
+ while (!stream.eol()) {
327
+ stream.eatWhile(/[^"\\]/);
328
+ if (stream.eat('\\')) {
329
+ stream.next();
330
+ } else if (stream.match(delimiter)) {
331
+ state.tokenize = tokenBase;
332
+ state.leavingExpr = true;
333
+ return OUTCLASS;
334
+ } else {
335
+ stream.eat(/["]/);
336
+ }
337
+ }
338
+ return OUTCLASS;
339
+ }
340
+ tokenString.isString = true;
341
+ return tokenString;
342
+ }
343
+
344
+ var external = {
345
+ startState: function() {
346
+ return {
347
+ tokenize: tokenBase,
348
+ scopes: [],
349
+ weakScopes: 0,
350
+ lastToken: null,
351
+ leavingExpr: false,
352
+ isDefinition: false,
353
+ charsAdvanced: 0,
354
+ firstParenPos: -1
355
+ };
356
+ },
357
+
358
+ token: function(stream, state) {
359
+ var style = state.tokenize(stream, state);
360
+ var current = stream.current();
361
+
362
+ if (current && style) {
363
+ state.lastToken = current;
364
+ }
365
+
366
+ // Handle '.' connected identifiers
367
+ if (current === '.') {
368
+ style = stream.match(identifiers, false) || stream.match(macro, false) ||
369
+ stream.match(/\(/, false) ? 'operator' : ERRORCLASS;
370
+ }
371
+ return style;
372
+ },
373
+
374
+ indent: function(state, textAfter) {
375
+ var delta = 0;
376
+ if (textAfter == "]" || textAfter == ")" || textAfter == "end" || textAfter == "else" || textAfter == "elseif" || textAfter == "catch" || textAfter == "finally") {
377
+ delta = -1;
378
+ }
379
+ return (state.scopes.length + delta) * _conf.indentUnit;
380
+ },
381
+
382
+ electricInput: /(end|else(if)?|catch|finally)$/,
383
+ lineComment: "#",
384
+ fold: "indent"
385
+ };
386
+ return external;
387
+ });
388
+
389
+
390
+ CodeMirror.defineMIME("text/x-julia", "julia");
391
+
392
+ });