locomotivecms 4.1.1 → 4.2.0.alpha1

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 +25 -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,168 @@
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('smalltalk', function(config) {
15
+
16
+ var specialChars = /[+\-\/\\*~<>=@%|&?!.,:;^]/;
17
+ var keywords = /true|false|nil|self|super|thisContext/;
18
+
19
+ var Context = function(tokenizer, parent) {
20
+ this.next = tokenizer;
21
+ this.parent = parent;
22
+ };
23
+
24
+ var Token = function(name, context, eos) {
25
+ this.name = name;
26
+ this.context = context;
27
+ this.eos = eos;
28
+ };
29
+
30
+ var State = function() {
31
+ this.context = new Context(next, null);
32
+ this.expectVariable = true;
33
+ this.indentation = 0;
34
+ this.userIndentationDelta = 0;
35
+ };
36
+
37
+ State.prototype.userIndent = function(indentation) {
38
+ this.userIndentationDelta = indentation > 0 ? (indentation / config.indentUnit - this.indentation) : 0;
39
+ };
40
+
41
+ var next = function(stream, context, state) {
42
+ var token = new Token(null, context, false);
43
+ var aChar = stream.next();
44
+
45
+ if (aChar === '"') {
46
+ token = nextComment(stream, new Context(nextComment, context));
47
+
48
+ } else if (aChar === '\'') {
49
+ token = nextString(stream, new Context(nextString, context));
50
+
51
+ } else if (aChar === '#') {
52
+ if (stream.peek() === '\'') {
53
+ stream.next();
54
+ token = nextSymbol(stream, new Context(nextSymbol, context));
55
+ } else {
56
+ if (stream.eatWhile(/[^\s.{}\[\]()]/))
57
+ token.name = 'string-2';
58
+ else
59
+ token.name = 'meta';
60
+ }
61
+
62
+ } else if (aChar === '$') {
63
+ if (stream.next() === '<') {
64
+ stream.eatWhile(/[^\s>]/);
65
+ stream.next();
66
+ }
67
+ token.name = 'string-2';
68
+
69
+ } else if (aChar === '|' && state.expectVariable) {
70
+ token.context = new Context(nextTemporaries, context);
71
+
72
+ } else if (/[\[\]{}()]/.test(aChar)) {
73
+ token.name = 'bracket';
74
+ token.eos = /[\[{(]/.test(aChar);
75
+
76
+ if (aChar === '[') {
77
+ state.indentation++;
78
+ } else if (aChar === ']') {
79
+ state.indentation = Math.max(0, state.indentation - 1);
80
+ }
81
+
82
+ } else if (specialChars.test(aChar)) {
83
+ stream.eatWhile(specialChars);
84
+ token.name = 'operator';
85
+ token.eos = aChar !== ';'; // ; cascaded message expression
86
+
87
+ } else if (/\d/.test(aChar)) {
88
+ stream.eatWhile(/[\w\d]/);
89
+ token.name = 'number';
90
+
91
+ } else if (/[\w_]/.test(aChar)) {
92
+ stream.eatWhile(/[\w\d_]/);
93
+ token.name = state.expectVariable ? (keywords.test(stream.current()) ? 'keyword' : 'variable') : null;
94
+
95
+ } else {
96
+ token.eos = state.expectVariable;
97
+ }
98
+
99
+ return token;
100
+ };
101
+
102
+ var nextComment = function(stream, context) {
103
+ stream.eatWhile(/[^"]/);
104
+ return new Token('comment', stream.eat('"') ? context.parent : context, true);
105
+ };
106
+
107
+ var nextString = function(stream, context) {
108
+ stream.eatWhile(/[^']/);
109
+ return new Token('string', stream.eat('\'') ? context.parent : context, false);
110
+ };
111
+
112
+ var nextSymbol = function(stream, context) {
113
+ stream.eatWhile(/[^']/);
114
+ return new Token('string-2', stream.eat('\'') ? context.parent : context, false);
115
+ };
116
+
117
+ var nextTemporaries = function(stream, context) {
118
+ var token = new Token(null, context, false);
119
+ var aChar = stream.next();
120
+
121
+ if (aChar === '|') {
122
+ token.context = context.parent;
123
+ token.eos = true;
124
+
125
+ } else {
126
+ stream.eatWhile(/[^|]/);
127
+ token.name = 'variable';
128
+ }
129
+
130
+ return token;
131
+ };
132
+
133
+ return {
134
+ startState: function() {
135
+ return new State;
136
+ },
137
+
138
+ token: function(stream, state) {
139
+ state.userIndent(stream.indentation());
140
+
141
+ if (stream.eatSpace()) {
142
+ return null;
143
+ }
144
+
145
+ var token = state.context.next(stream, state.context, state);
146
+ state.context = token.context;
147
+ state.expectVariable = token.eos;
148
+
149
+ return token.name;
150
+ },
151
+
152
+ blankLine: function(state) {
153
+ state.userIndent(0);
154
+ },
155
+
156
+ indent: function(state, textAfter) {
157
+ var i = state.context.next === next && textAfter && textAfter.charAt(0) === ']' ? -1 : state.userIndentationDelta;
158
+ return (state.indentation + i) * config.indentUnit;
159
+ },
160
+
161
+ electricChars: ']'
162
+ };
163
+
164
+ });
165
+
166
+ CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'});
167
+
168
+ });
@@ -0,0 +1,225 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ /**
5
+ * Smarty 2 and 3 mode.
6
+ */
7
+
8
+ (function(mod) {
9
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
10
+ mod(require("../../lib/codemirror"));
11
+ else if (typeof define == "function" && define.amd) // AMD
12
+ define(["../../lib/codemirror"], mod);
13
+ else // Plain browser env
14
+ mod(CodeMirror);
15
+ })(function(CodeMirror) {
16
+ "use strict";
17
+
18
+ CodeMirror.defineMode("smarty", function(config, parserConf) {
19
+ var rightDelimiter = parserConf.rightDelimiter || "}";
20
+ var leftDelimiter = parserConf.leftDelimiter || "{";
21
+ var version = parserConf.version || 2;
22
+ var baseMode = CodeMirror.getMode(config, parserConf.baseMode || "null");
23
+
24
+ var keyFunctions = ["debug", "extends", "function", "include", "literal"];
25
+ var regs = {
26
+ operatorChars: /[+\-*&%=<>!?]/,
27
+ validIdentifier: /[a-zA-Z0-9_]/,
28
+ stringChar: /['"]/
29
+ };
30
+
31
+ var last;
32
+ function cont(style, lastType) {
33
+ last = lastType;
34
+ return style;
35
+ }
36
+
37
+ function chain(stream, state, parser) {
38
+ state.tokenize = parser;
39
+ return parser(stream, state);
40
+ }
41
+
42
+ // Smarty 3 allows { and } surrounded by whitespace to NOT slip into Smarty mode
43
+ function doesNotCount(stream, pos) {
44
+ if (pos == null) pos = stream.pos;
45
+ return version === 3 && leftDelimiter == "{" &&
46
+ (pos == stream.string.length || /\s/.test(stream.string.charAt(pos)));
47
+ }
48
+
49
+ function tokenTop(stream, state) {
50
+ var string = stream.string;
51
+ for (var scan = stream.pos;;) {
52
+ var nextMatch = string.indexOf(leftDelimiter, scan);
53
+ scan = nextMatch + leftDelimiter.length;
54
+ if (nextMatch == -1 || !doesNotCount(stream, nextMatch + leftDelimiter.length)) break;
55
+ }
56
+ if (nextMatch == stream.pos) {
57
+ stream.match(leftDelimiter);
58
+ if (stream.eat("*")) {
59
+ return chain(stream, state, tokenBlock("comment", "*" + rightDelimiter));
60
+ } else {
61
+ state.depth++;
62
+ state.tokenize = tokenSmarty;
63
+ last = "startTag";
64
+ return "tag";
65
+ }
66
+ }
67
+
68
+ if (nextMatch > -1) stream.string = string.slice(0, nextMatch);
69
+ var token = baseMode.token(stream, state.base);
70
+ if (nextMatch > -1) stream.string = string;
71
+ return token;
72
+ }
73
+
74
+ // parsing Smarty content
75
+ function tokenSmarty(stream, state) {
76
+ if (stream.match(rightDelimiter, true)) {
77
+ if (version === 3) {
78
+ state.depth--;
79
+ if (state.depth <= 0) {
80
+ state.tokenize = tokenTop;
81
+ }
82
+ } else {
83
+ state.tokenize = tokenTop;
84
+ }
85
+ return cont("tag", null);
86
+ }
87
+
88
+ if (stream.match(leftDelimiter, true)) {
89
+ state.depth++;
90
+ return cont("tag", "startTag");
91
+ }
92
+
93
+ var ch = stream.next();
94
+ if (ch == "$") {
95
+ stream.eatWhile(regs.validIdentifier);
96
+ return cont("variable-2", "variable");
97
+ } else if (ch == "|") {
98
+ return cont("operator", "pipe");
99
+ } else if (ch == ".") {
100
+ return cont("operator", "property");
101
+ } else if (regs.stringChar.test(ch)) {
102
+ state.tokenize = tokenAttribute(ch);
103
+ return cont("string", "string");
104
+ } else if (regs.operatorChars.test(ch)) {
105
+ stream.eatWhile(regs.operatorChars);
106
+ return cont("operator", "operator");
107
+ } else if (ch == "[" || ch == "]") {
108
+ return cont("bracket", "bracket");
109
+ } else if (ch == "(" || ch == ")") {
110
+ return cont("bracket", "operator");
111
+ } else if (/\d/.test(ch)) {
112
+ stream.eatWhile(/\d/);
113
+ return cont("number", "number");
114
+ } else {
115
+
116
+ if (state.last == "variable") {
117
+ if (ch == "@") {
118
+ stream.eatWhile(regs.validIdentifier);
119
+ return cont("property", "property");
120
+ } else if (ch == "|") {
121
+ stream.eatWhile(regs.validIdentifier);
122
+ return cont("qualifier", "modifier");
123
+ }
124
+ } else if (state.last == "pipe") {
125
+ stream.eatWhile(regs.validIdentifier);
126
+ return cont("qualifier", "modifier");
127
+ } else if (state.last == "whitespace") {
128
+ stream.eatWhile(regs.validIdentifier);
129
+ return cont("attribute", "modifier");
130
+ } if (state.last == "property") {
131
+ stream.eatWhile(regs.validIdentifier);
132
+ return cont("property", null);
133
+ } else if (/\s/.test(ch)) {
134
+ last = "whitespace";
135
+ return null;
136
+ }
137
+
138
+ var str = "";
139
+ if (ch != "/") {
140
+ str += ch;
141
+ }
142
+ var c = null;
143
+ while (c = stream.eat(regs.validIdentifier)) {
144
+ str += c;
145
+ }
146
+ for (var i=0, j=keyFunctions.length; i<j; i++) {
147
+ if (keyFunctions[i] == str) {
148
+ return cont("keyword", "keyword");
149
+ }
150
+ }
151
+ if (/\s/.test(ch)) {
152
+ return null;
153
+ }
154
+ return cont("tag", "tag");
155
+ }
156
+ }
157
+
158
+ function tokenAttribute(quote) {
159
+ return function(stream, state) {
160
+ var prevChar = null;
161
+ var currChar = null;
162
+ while (!stream.eol()) {
163
+ currChar = stream.peek();
164
+ if (stream.next() == quote && prevChar !== '\\') {
165
+ state.tokenize = tokenSmarty;
166
+ break;
167
+ }
168
+ prevChar = currChar;
169
+ }
170
+ return "string";
171
+ };
172
+ }
173
+
174
+ function tokenBlock(style, terminator) {
175
+ return function(stream, state) {
176
+ while (!stream.eol()) {
177
+ if (stream.match(terminator)) {
178
+ state.tokenize = tokenTop;
179
+ break;
180
+ }
181
+ stream.next();
182
+ }
183
+ return style;
184
+ };
185
+ }
186
+
187
+ return {
188
+ startState: function() {
189
+ return {
190
+ base: CodeMirror.startState(baseMode),
191
+ tokenize: tokenTop,
192
+ last: null,
193
+ depth: 0
194
+ };
195
+ },
196
+ copyState: function(state) {
197
+ return {
198
+ base: CodeMirror.copyState(baseMode, state.base),
199
+ tokenize: state.tokenize,
200
+ last: state.last,
201
+ depth: state.depth
202
+ };
203
+ },
204
+ innerMode: function(state) {
205
+ if (state.tokenize == tokenTop)
206
+ return {mode: baseMode, state: state.base};
207
+ },
208
+ token: function(stream, state) {
209
+ var style = state.tokenize(stream, state);
210
+ state.last = last;
211
+ return style;
212
+ },
213
+ indent: function(state, text) {
214
+ if (state.tokenize == tokenTop && baseMode.indent)
215
+ return baseMode.indent(state.base, text);
216
+ else
217
+ return CodeMirror.Pass;
218
+ },
219
+ blockCommentStart: leftDelimiter + "*",
220
+ blockCommentEnd: "*" + rightDelimiter
221
+ };
222
+ });
223
+
224
+ CodeMirror.defineMIME("text/x-smarty", "smarty");
225
+ });
@@ -0,0 +1,104 @@
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("solr", function() {
15
+ "use strict";
16
+
17
+ var isStringChar = /[^\s\|\!\+\-\*\?\~\^\&\:\(\)\[\]\{\}\^\"\\]/;
18
+ var isOperatorChar = /[\|\!\+\-\*\?\~\^\&]/;
19
+ var isOperatorString = /^(OR|AND|NOT|TO)$/i;
20
+
21
+ function isNumber(word) {
22
+ return parseFloat(word, 10).toString() === word;
23
+ }
24
+
25
+ function tokenString(quote) {
26
+ return function(stream, state) {
27
+ var escaped = false, next;
28
+ while ((next = stream.next()) != null) {
29
+ if (next == quote && !escaped) break;
30
+ escaped = !escaped && next == "\\";
31
+ }
32
+
33
+ if (!escaped) state.tokenize = tokenBase;
34
+ return "string";
35
+ };
36
+ }
37
+
38
+ function tokenOperator(operator) {
39
+ return function(stream, state) {
40
+ var style = "operator";
41
+ if (operator == "+")
42
+ style += " positive";
43
+ else if (operator == "-")
44
+ style += " negative";
45
+ else if (operator == "|")
46
+ stream.eat(/\|/);
47
+ else if (operator == "&")
48
+ stream.eat(/\&/);
49
+ else if (operator == "^")
50
+ style += " boost";
51
+
52
+ state.tokenize = tokenBase;
53
+ return style;
54
+ };
55
+ }
56
+
57
+ function tokenWord(ch) {
58
+ return function(stream, state) {
59
+ var word = ch;
60
+ while ((ch = stream.peek()) && ch.match(isStringChar) != null) {
61
+ word += stream.next();
62
+ }
63
+
64
+ state.tokenize = tokenBase;
65
+ if (isOperatorString.test(word))
66
+ return "operator";
67
+ else if (isNumber(word))
68
+ return "number";
69
+ else if (stream.peek() == ":")
70
+ return "field";
71
+ else
72
+ return "string";
73
+ };
74
+ }
75
+
76
+ function tokenBase(stream, state) {
77
+ var ch = stream.next();
78
+ if (ch == '"')
79
+ state.tokenize = tokenString(ch);
80
+ else if (isOperatorChar.test(ch))
81
+ state.tokenize = tokenOperator(ch);
82
+ else if (isStringChar.test(ch))
83
+ state.tokenize = tokenWord(ch);
84
+
85
+ return (state.tokenize != tokenBase) ? state.tokenize(stream, state) : null;
86
+ }
87
+
88
+ return {
89
+ startState: function() {
90
+ return {
91
+ tokenize: tokenBase
92
+ };
93
+ },
94
+
95
+ token: function(stream, state) {
96
+ if (stream.eatSpace()) return null;
97
+ return state.tokenize(stream, state);
98
+ }
99
+ };
100
+ });
101
+
102
+ CodeMirror.defineMIME("text/x-solr", "solr");
103
+
104
+ });
@@ -0,0 +1,199 @@
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("../htmlmixed/htmlmixed"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror", "../htmlmixed/htmlmixed"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ var indentingTags = ["template", "literal", "msg", "fallbackmsg", "let", "if", "elseif",
15
+ "else", "switch", "case", "default", "foreach", "ifempty", "for",
16
+ "call", "param", "deltemplate", "delcall", "log"];
17
+
18
+ CodeMirror.defineMode("soy", function(config) {
19
+ var textMode = CodeMirror.getMode(config, "text/plain");
20
+ var modes = {
21
+ html: CodeMirror.getMode(config, {name: "text/html", multilineTagIndentFactor: 2, multilineTagIndentPastTag: false}),
22
+ attributes: textMode,
23
+ text: textMode,
24
+ uri: textMode,
25
+ css: CodeMirror.getMode(config, "text/css"),
26
+ js: CodeMirror.getMode(config, {name: "text/javascript", statementIndent: 2 * config.indentUnit})
27
+ };
28
+
29
+ function last(array) {
30
+ return array[array.length - 1];
31
+ }
32
+
33
+ function tokenUntil(stream, state, untilRegExp) {
34
+ var oldString = stream.string;
35
+ var match = untilRegExp.exec(oldString.substr(stream.pos));
36
+ if (match) {
37
+ // We don't use backUp because it backs up just the position, not the state.
38
+ // This uses an undocumented API.
39
+ stream.string = oldString.substr(0, stream.pos + match.index);
40
+ }
41
+ var result = stream.hideFirstChars(state.indent, function() {
42
+ return state.localMode.token(stream, state.localState);
43
+ });
44
+ stream.string = oldString;
45
+ return result;
46
+ }
47
+
48
+ return {
49
+ startState: function() {
50
+ return {
51
+ kind: [],
52
+ kindTag: [],
53
+ soyState: [],
54
+ indent: 0,
55
+ localMode: modes.html,
56
+ localState: CodeMirror.startState(modes.html)
57
+ };
58
+ },
59
+
60
+ copyState: function(state) {
61
+ return {
62
+ tag: state.tag, // Last seen Soy tag.
63
+ kind: state.kind.concat([]), // Values of kind="" attributes.
64
+ kindTag: state.kindTag.concat([]), // Opened tags with kind="" attributes.
65
+ soyState: state.soyState.concat([]),
66
+ indent: state.indent, // Indentation of the following line.
67
+ localMode: state.localMode,
68
+ localState: CodeMirror.copyState(state.localMode, state.localState)
69
+ };
70
+ },
71
+
72
+ token: function(stream, state) {
73
+ var match;
74
+
75
+ switch (last(state.soyState)) {
76
+ case "comment":
77
+ if (stream.match(/^.*?\*\//)) {
78
+ state.soyState.pop();
79
+ } else {
80
+ stream.skipToEnd();
81
+ }
82
+ return "comment";
83
+
84
+ case "variable":
85
+ if (stream.match(/^}/)) {
86
+ state.indent -= 2 * config.indentUnit;
87
+ state.soyState.pop();
88
+ return "variable-2";
89
+ }
90
+ stream.next();
91
+ return null;
92
+
93
+ case "tag":
94
+ if (stream.match(/^\/?}/)) {
95
+ if (state.tag == "/template" || state.tag == "/deltemplate") state.indent = 0;
96
+ else state.indent -= (stream.current() == "/}" || indentingTags.indexOf(state.tag) == -1 ? 2 : 1) * config.indentUnit;
97
+ state.soyState.pop();
98
+ return "keyword";
99
+ } else if (stream.match(/^([\w?]+)(?==)/)) {
100
+ if (stream.current() == "kind" && (match = stream.match(/^="([^"]+)/, false))) {
101
+ var kind = match[1];
102
+ state.kind.push(kind);
103
+ state.kindTag.push(state.tag);
104
+ state.localMode = modes[kind] || modes.html;
105
+ state.localState = CodeMirror.startState(state.localMode);
106
+ }
107
+ return "attribute";
108
+ } else if (stream.match(/^"/)) {
109
+ state.soyState.push("string");
110
+ return "string";
111
+ }
112
+ stream.next();
113
+ return null;
114
+
115
+ case "literal":
116
+ if (stream.match(/^(?=\{\/literal})/)) {
117
+ state.indent -= config.indentUnit;
118
+ state.soyState.pop();
119
+ return this.token(stream, state);
120
+ }
121
+ return tokenUntil(stream, state, /\{\/literal}/);
122
+
123
+ case "string":
124
+ var match = stream.match(/^.*?("|\\[\s\S])/);
125
+ if (!match) {
126
+ stream.skipToEnd();
127
+ } else if (match[1] == "\"") {
128
+ state.soyState.pop();
129
+ }
130
+ return "string";
131
+ }
132
+
133
+ if (stream.match(/^\/\*/)) {
134
+ state.soyState.push("comment");
135
+ return "comment";
136
+ } else if (stream.match(stream.sol() ? /^\s*\/\/.*/ : /^\s+\/\/.*/)) {
137
+ return "comment";
138
+ } else if (stream.match(/^\{\$[\w?]*/)) {
139
+ state.indent += 2 * config.indentUnit;
140
+ state.soyState.push("variable");
141
+ return "variable-2";
142
+ } else if (stream.match(/^\{literal}/)) {
143
+ state.indent += config.indentUnit;
144
+ state.soyState.push("literal");
145
+ return "keyword";
146
+ } else if (match = stream.match(/^\{([\/@\\]?[\w?]*)/)) {
147
+ if (match[1] != "/switch")
148
+ state.indent += (/^(\/|(else|elseif|case|default)$)/.test(match[1]) && state.tag != "switch" ? 1 : 2) * config.indentUnit;
149
+ state.tag = match[1];
150
+ if (state.tag == "/" + last(state.kindTag)) {
151
+ // We found the tag that opened the current kind="".
152
+ state.kind.pop();
153
+ state.kindTag.pop();
154
+ state.localMode = modes[last(state.kind)] || modes.html;
155
+ state.localState = CodeMirror.startState(state.localMode);
156
+ }
157
+ state.soyState.push("tag");
158
+ return "keyword";
159
+ }
160
+
161
+ return tokenUntil(stream, state, /\{|\s+\/\/|\/\*/);
162
+ },
163
+
164
+ indent: function(state, textAfter) {
165
+ var indent = state.indent, top = last(state.soyState);
166
+ if (top == "comment") return CodeMirror.Pass;
167
+
168
+ if (top == "literal") {
169
+ if (/^\{\/literal}/.test(textAfter)) indent -= config.indentUnit;
170
+ } else {
171
+ if (/^\s*\{\/(template|deltemplate)\b/.test(textAfter)) return 0;
172
+ if (/^\{(\/|(fallbackmsg|elseif|else|ifempty)\b)/.test(textAfter)) indent -= config.indentUnit;
173
+ if (state.tag != "switch" && /^\{(case|default)\b/.test(textAfter)) indent -= config.indentUnit;
174
+ if (/^\{\/switch\b/.test(textAfter)) indent -= config.indentUnit;
175
+ }
176
+ if (indent && state.localMode.indent)
177
+ indent += state.localMode.indent(state.localState, textAfter);
178
+ return indent;
179
+ },
180
+
181
+ innerMode: function(state) {
182
+ if (state.soyState.length && last(state.soyState) != "literal") return null;
183
+ else return {state: state.localState, mode: state.localMode};
184
+ },
185
+
186
+ electricInput: /^\s*\{(\/|\/template|\/deltemplate|\/switch|fallbackmsg|elseif|else|case|default|ifempty|\/literal\})$/,
187
+ lineComment: "//",
188
+ blockCommentStart: "/*",
189
+ blockCommentEnd: "*/",
190
+ blockCommentContinue: " * ",
191
+ fold: "indent"
192
+ };
193
+ }, "htmlmixed");
194
+
195
+ CodeMirror.registerHelper("hintWords", "soy", indentingTags.concat(
196
+ ["delpackage", "namespace", "alias", "print", "css", "debugger"]));
197
+
198
+ CodeMirror.defineMIME("text/x-soy", "soy");
199
+ });