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.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +4 -3
- data/Rakefile +4 -0
- data/app/api/locomotive/api.rb +1 -1
- data/app/assets/config/locomotive_manifest.js +2 -0
- data/app/assets/javascripts/locomotive.js +2 -2
- data/app/assets/stylesheets/locomotive/account.scss +0 -1
- data/app/assets/stylesheets/locomotive/application.scss +0 -1
- data/app/assets/stylesheets/locomotive/live_editing_error.scss +0 -1
- data/app/assets/stylesheets/locomotive/live_editing_iframe.scss +0 -1
- data/app/controllers/locomotive/base_controller.rb +1 -1
- data/app/controllers/locomotive/concerns/authorization_controller.rb +1 -1
- data/app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb +1 -1
- data/app/controllers/locomotive/concerns/site_dispatcher_controller.rb +1 -1
- data/app/controllers/locomotive/errors_controller.rb +1 -1
- data/app/controllers/locomotive/my_account_controller.rb +1 -1
- data/app/controllers/locomotive/passwords_controller.rb +3 -1
- data/app/controllers/locomotive/registrations_controller.rb +3 -1
- data/app/controllers/locomotive/sessions_controller.rb +3 -1
- data/app/controllers/locomotive/sites_controller.rb +1 -1
- data/app/helpers/locomotive/base_helper.rb +2 -2
- data/app/helpers/locomotive/custom_fields_helper.rb +2 -2
- data/app/helpers/locomotive/shared/activities_helper.rb +1 -1
- data/app/inputs/locomotive/api_key_input.rb +1 -1
- data/app/mailers/locomotive/notifications.rb +1 -1
- data/app/models/locomotive/account.rb +1 -1
- data/app/models/locomotive/concerns/account/api_key.rb +1 -1
- data/app/models/locomotive/concerns/content_entry/csv.rb +1 -1
- data/app/models/locomotive/concerns/content_entry/slug.rb +5 -5
- data/app/models/locomotive/concerns/content_type/entry_template.rb +3 -3
- data/app/models/locomotive/concerns/page/templatized.rb +1 -1
- data/app/models/locomotive/concerns/shared/json_attribute.rb +21 -2
- data/app/models/locomotive/concerns/site/routes.rb +1 -1
- data/app/models/locomotive/content_entry.rb +2 -2
- data/app/models/locomotive/page.rb +3 -3
- data/app/models/locomotive/section.rb +1 -1
- data/app/models/locomotive/snippet.rb +1 -1
- data/app/models/locomotive/translation.rb +1 -1
- data/app/services/locomotive/content_entry_import_service.rb +1 -1
- data/app/services/locomotive/content_entry_service.rb +2 -2
- data/app/services/locomotive/content_type_service.rb +13 -3
- data/app/services/locomotive/custom_field_service.rb +2 -2
- data/app/services/locomotive/editor_service.rb +1 -1
- data/app/uploaders/locomotive/base_uploader.rb +0 -10
- data/app/views/locomotive/dashboard/_activity.html.slim +1 -1
- data/app/views/locomotive/page_content/_edit.json.jbuilder +50 -0
- data/app/views/locomotive/page_content/edit.html.erb +1 -1
- data/app/views/locomotive/page_content/edit.json.jbuilder +52 -50
- data/config/initializers/devise.rb +5 -2
- data/lib/generators/locomotive/install/templates/locomotive.rb +0 -5
- data/lib/locomotive/action_controller/responder.rb +1 -1
- data/lib/locomotive/configuration.rb +2 -2
- data/lib/locomotive/dependencies.rb +0 -2
- data/lib/locomotive/engine.rb +14 -2
- data/lib/locomotive/mongoid/patches.rb +25 -65
- data/lib/locomotive/steam/services/api_entry_submission_service.rb +1 -0
- data/lib/locomotive/version.rb +1 -1
- data/vendor/assets/javascripts/locomotive/codemirror/addons/comment/comment.js +203 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/comment/continuecomment.js +85 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/dialog/dialog.js +157 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/autorefresh.js +47 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/fullscreen.js +41 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/panel.js +112 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/placeholder.js +62 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/rulers.js +51 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/closebrackets.js +195 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/closetag.js +169 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/continuelist.js +51 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/matchbrackets.js +120 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/matchtags.js +66 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/trailingspace.js +27 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/brace-fold.js +105 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/comment-fold.js +59 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/foldcode.js +150 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/foldgutter.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/indent-fold.js +44 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/markdown-fold.js +49 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/xml-fold.js +182 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/anyword-hint.js +41 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/css-hint.js +60 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/html-hint.js +348 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/javascript-hint.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/show-hint.js +437 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/sql-hint.js +271 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/xml-hint.js +110 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/coffeescript-lint.js +41 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/css-lint.js +35 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/html-lint.js +46 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/javascript-lint.js +136 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/json-lint.js +31 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/lint.js +239 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/yaml-lint.js +28 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/merge/merge.js +773 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/loadmode.js +64 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/multiplex.js +123 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/overlay.js +85 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/simple.js +213 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/colorize.js +40 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode-standalone.js +157 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode.js +72 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode.node.js +179 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/annotatescrollbar.js +118 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/scrollpastend.js +48 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/simplescrollbars.js +152 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/jump-to-line.js +49 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/match-highlighter.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/matchesonscrollbar.js +97 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/search.js +249 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/searchcursor.js +189 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/active-line.js +74 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/mark-selection.js +118 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/selection-pointer.js +98 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/tern/tern.js +701 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/tern/worker.js +44 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/wrap/hardwrap.js +144 -0
- data/vendor/assets/javascripts/locomotive/codemirror/keymaps/emacs.js +412 -0
- data/vendor/assets/javascripts/locomotive/codemirror/keymaps/sublime.js +580 -0
- data/vendor/assets/javascripts/locomotive/codemirror/keymaps/vim.js +5065 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/apl.js +174 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/asciiarmor.js +73 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/asn.1.js +204 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/asterisk.js +196 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/brainfuck.js +85 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/clike.js +786 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/clojure.js +306 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/cmake.js +97 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/cobol.js +255 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/coffeescript.js +355 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/commonlisp.js +123 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/crystal.js +391 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/css.js +825 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/cypher.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/d.js +218 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dart.js +157 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/diff.js +47 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/django.js +356 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dockerfile.js +79 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dtd.js +142 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dylan.js +344 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ebnf.js +195 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ecl.js +206 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/eiffel.js +160 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/elm.js +205 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/erlang.js +618 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/factor.js +83 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/fcl.js +173 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/forth.js +180 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/fortran.js +188 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/gas.js +345 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/gfm.js +130 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/gherkin.js +178 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/go.js +185 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/groovy.js +230 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haml.js +161 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/handlebars.js +62 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haskell-literate.js +43 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haskell.js +267 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haxe.js +515 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/htmlembedded.js +28 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/htmlmixed.js +152 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/http.js +113 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/idl.js +290 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/jade.js +590 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/javascript.js +748 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/jinja2.js +142 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/jsx.js +147 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/julia.js +392 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/livescript.js +280 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/lua.js +159 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/markdown.js +797 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mathematica.js +176 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mbox.js +129 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mirc.js +193 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mllike.js +205 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/modelica.js +245 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mscgen.js +169 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mumps.js +148 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/nginx.js +178 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/nsis.js +95 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ntriples.js +186 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/octave.js +135 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/oz.js +252 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/pascal.js +109 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/pegjs.js +114 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/perl.js +837 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/php.js +234 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/pig.js +178 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/powershell.js +396 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/properties.js +78 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/protobuf.js +68 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/puppet.js +220 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/python.js +340 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/q.js +139 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/r.js +164 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/rpm.js +109 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/rst.js +557 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ruby.js +285 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/rust.js +71 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sas.js +315 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sass.js +414 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/scheme.js +249 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/shell.js +139 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sieve.js +193 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/slim.js +575 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/smalltalk.js +168 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/smarty.js +225 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/solr.js +104 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/soy.js +199 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sparql.js +180 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/spreadsheet.js +112 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sql.js +413 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/stex.js +251 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/stylus.js +769 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/swift.js +202 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tcl.js +139 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/textile.js +469 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tiddlywiki.js +308 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tiki.js +312 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/toml.js +88 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tornado.js +68 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/troff.js +84 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ttcn-cfg.js +214 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ttcn.js +283 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/turtle.js +162 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/twig.js +141 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vb.js +276 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vbscript.js +350 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/velocity.js +201 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/verilog.js +537 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vhdl.js +189 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vue.js +69 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/webidl.js +195 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/xml.js +394 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/xquery.js +437 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/yacas.js +204 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/yaml-frontmatter.js +68 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/yaml.js +117 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/z80.js +116 -0
- data/vendor/assets/javascripts/locomotive/codemirror.js +8922 -0
- data/vendor/assets/javascripts/locomotive/select2.js +436 -175
- data/vendor/assets/javascripts/locomotive/wysihtml5x-toolbar.js +1346 -564
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/dialog/dialog.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/display/fullscreen.css +6 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/fold/foldgutter.css +20 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/hint/show-hint.css +37 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/lint/lint.css +73 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/merge/merge.css +113 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/scroll/simplescrollbars.css +66 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/search/matchesonscrollbar.css +8 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/tern/tern.css +87 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/modes/tiddlywiki.css +14 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/modes/tiki.css +26 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/3024-day.css +41 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/3024-night.css +39 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/abcdef.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/ambiance-mobile.css +5 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/ambiance.css +74 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/base16-dark.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/base16-light.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/bespin.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/blackboard.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/cobalt.css +25 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/colorforth.css +33 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/dracula.css +41 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/eclipse.css +23 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/elegant.css +13 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/erlang-dark.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/hopscotch.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/icecoder.css +43 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/isotope.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/lesser-dark.css +47 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/liquibyte.css +95 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/material.css +53 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/mbo.css +37 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/mdn-like.css +46 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/midnight.css +45 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/monokai.css +36 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/neat.css +12 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/neo.css +43 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/night.css +27 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/paraiso-dark.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/paraiso-light.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/pastel-on-dark.css +53 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/railscasts.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/rubyblue.css +25 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/seti.css +44 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/solarized.css +169 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/the-matrix.css +30 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/tomorrow-night-bright.css +35 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/tomorrow-night-eighties.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/ttcn.css +64 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/twilight.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/vibrant-ink.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/xq-dark.css +53 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/xq-light.css +43 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/yeti.css +44 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/zenburn.css +37 -0
- data/vendor/assets/stylesheets/locomotive/codemirror.css +347 -0
- data/vendor/assets/stylesheets/locomotive/select2.css +3 -6
- metadata +349 -128
@@ -0,0 +1,185 @@
|
|
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("go", function(config) {
|
15
|
+
var indentUnit = config.indentUnit;
|
16
|
+
|
17
|
+
var keywords = {
|
18
|
+
"break":true, "case":true, "chan":true, "const":true, "continue":true,
|
19
|
+
"default":true, "defer":true, "else":true, "fallthrough":true, "for":true,
|
20
|
+
"func":true, "go":true, "goto":true, "if":true, "import":true,
|
21
|
+
"interface":true, "map":true, "package":true, "range":true, "return":true,
|
22
|
+
"select":true, "struct":true, "switch":true, "type":true, "var":true,
|
23
|
+
"bool":true, "byte":true, "complex64":true, "complex128":true,
|
24
|
+
"float32":true, "float64":true, "int8":true, "int16":true, "int32":true,
|
25
|
+
"int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true,
|
26
|
+
"uint64":true, "int":true, "uint":true, "uintptr":true, "error": true
|
27
|
+
};
|
28
|
+
|
29
|
+
var atoms = {
|
30
|
+
"true":true, "false":true, "iota":true, "nil":true, "append":true,
|
31
|
+
"cap":true, "close":true, "complex":true, "copy":true, "imag":true,
|
32
|
+
"len":true, "make":true, "new":true, "panic":true, "print":true,
|
33
|
+
"println":true, "real":true, "recover":true
|
34
|
+
};
|
35
|
+
|
36
|
+
var isOperatorChar = /[+\-*&^%:=<>!|\/]/;
|
37
|
+
|
38
|
+
var curPunc;
|
39
|
+
|
40
|
+
function tokenBase(stream, state) {
|
41
|
+
var ch = stream.next();
|
42
|
+
if (ch == '"' || ch == "'" || ch == "`") {
|
43
|
+
state.tokenize = tokenString(ch);
|
44
|
+
return state.tokenize(stream, state);
|
45
|
+
}
|
46
|
+
if (/[\d\.]/.test(ch)) {
|
47
|
+
if (ch == ".") {
|
48
|
+
stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
|
49
|
+
} else if (ch == "0") {
|
50
|
+
stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
|
51
|
+
} else {
|
52
|
+
stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
|
53
|
+
}
|
54
|
+
return "number";
|
55
|
+
}
|
56
|
+
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
57
|
+
curPunc = ch;
|
58
|
+
return null;
|
59
|
+
}
|
60
|
+
if (ch == "/") {
|
61
|
+
if (stream.eat("*")) {
|
62
|
+
state.tokenize = tokenComment;
|
63
|
+
return tokenComment(stream, state);
|
64
|
+
}
|
65
|
+
if (stream.eat("/")) {
|
66
|
+
stream.skipToEnd();
|
67
|
+
return "comment";
|
68
|
+
}
|
69
|
+
}
|
70
|
+
if (isOperatorChar.test(ch)) {
|
71
|
+
stream.eatWhile(isOperatorChar);
|
72
|
+
return "operator";
|
73
|
+
}
|
74
|
+
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
75
|
+
var cur = stream.current();
|
76
|
+
if (keywords.propertyIsEnumerable(cur)) {
|
77
|
+
if (cur == "case" || cur == "default") curPunc = "case";
|
78
|
+
return "keyword";
|
79
|
+
}
|
80
|
+
if (atoms.propertyIsEnumerable(cur)) return "atom";
|
81
|
+
return "variable";
|
82
|
+
}
|
83
|
+
|
84
|
+
function tokenString(quote) {
|
85
|
+
return function(stream, state) {
|
86
|
+
var escaped = false, next, end = false;
|
87
|
+
while ((next = stream.next()) != null) {
|
88
|
+
if (next == quote && !escaped) {end = true; break;}
|
89
|
+
escaped = !escaped && quote != "`" && next == "\\";
|
90
|
+
}
|
91
|
+
if (end || !(escaped || quote == "`"))
|
92
|
+
state.tokenize = tokenBase;
|
93
|
+
return "string";
|
94
|
+
};
|
95
|
+
}
|
96
|
+
|
97
|
+
function tokenComment(stream, state) {
|
98
|
+
var maybeEnd = false, ch;
|
99
|
+
while (ch = stream.next()) {
|
100
|
+
if (ch == "/" && maybeEnd) {
|
101
|
+
state.tokenize = tokenBase;
|
102
|
+
break;
|
103
|
+
}
|
104
|
+
maybeEnd = (ch == "*");
|
105
|
+
}
|
106
|
+
return "comment";
|
107
|
+
}
|
108
|
+
|
109
|
+
function Context(indented, column, type, align, prev) {
|
110
|
+
this.indented = indented;
|
111
|
+
this.column = column;
|
112
|
+
this.type = type;
|
113
|
+
this.align = align;
|
114
|
+
this.prev = prev;
|
115
|
+
}
|
116
|
+
function pushContext(state, col, type) {
|
117
|
+
return state.context = new Context(state.indented, col, type, null, state.context);
|
118
|
+
}
|
119
|
+
function popContext(state) {
|
120
|
+
if (!state.context.prev) return;
|
121
|
+
var t = state.context.type;
|
122
|
+
if (t == ")" || t == "]" || t == "}")
|
123
|
+
state.indented = state.context.indented;
|
124
|
+
return state.context = state.context.prev;
|
125
|
+
}
|
126
|
+
|
127
|
+
// Interface
|
128
|
+
|
129
|
+
return {
|
130
|
+
startState: function(basecolumn) {
|
131
|
+
return {
|
132
|
+
tokenize: null,
|
133
|
+
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
134
|
+
indented: 0,
|
135
|
+
startOfLine: true
|
136
|
+
};
|
137
|
+
},
|
138
|
+
|
139
|
+
token: function(stream, state) {
|
140
|
+
var ctx = state.context;
|
141
|
+
if (stream.sol()) {
|
142
|
+
if (ctx.align == null) ctx.align = false;
|
143
|
+
state.indented = stream.indentation();
|
144
|
+
state.startOfLine = true;
|
145
|
+
if (ctx.type == "case") ctx.type = "}";
|
146
|
+
}
|
147
|
+
if (stream.eatSpace()) return null;
|
148
|
+
curPunc = null;
|
149
|
+
var style = (state.tokenize || tokenBase)(stream, state);
|
150
|
+
if (style == "comment") return style;
|
151
|
+
if (ctx.align == null) ctx.align = true;
|
152
|
+
|
153
|
+
if (curPunc == "{") pushContext(state, stream.column(), "}");
|
154
|
+
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
155
|
+
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
156
|
+
else if (curPunc == "case") ctx.type = "case";
|
157
|
+
else if (curPunc == "}" && ctx.type == "}") ctx = popContext(state);
|
158
|
+
else if (curPunc == ctx.type) popContext(state);
|
159
|
+
state.startOfLine = false;
|
160
|
+
return style;
|
161
|
+
},
|
162
|
+
|
163
|
+
indent: function(state, textAfter) {
|
164
|
+
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
|
165
|
+
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
|
166
|
+
if (ctx.type == "case" && /^(?:case|default)\b/.test(textAfter)) {
|
167
|
+
state.context.type = "}";
|
168
|
+
return ctx.indented;
|
169
|
+
}
|
170
|
+
var closing = firstChar == ctx.type;
|
171
|
+
if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
172
|
+
else return ctx.indented + (closing ? 0 : indentUnit);
|
173
|
+
},
|
174
|
+
|
175
|
+
electricChars: "{}):",
|
176
|
+
fold: "brace",
|
177
|
+
blockCommentStart: "/*",
|
178
|
+
blockCommentEnd: "*/",
|
179
|
+
lineComment: "//"
|
180
|
+
};
|
181
|
+
});
|
182
|
+
|
183
|
+
CodeMirror.defineMIME("text/x-go", "go");
|
184
|
+
|
185
|
+
});
|
@@ -0,0 +1,230 @@
|
|
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("groovy", function(config) {
|
15
|
+
function words(str) {
|
16
|
+
var obj = {}, words = str.split(" ");
|
17
|
+
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
18
|
+
return obj;
|
19
|
+
}
|
20
|
+
var keywords = words(
|
21
|
+
"abstract as assert boolean break byte case catch char class const continue def default " +
|
22
|
+
"do double else enum extends final finally float for goto if implements import in " +
|
23
|
+
"instanceof int interface long native new package private protected public return " +
|
24
|
+
"short static strictfp super switch synchronized threadsafe throw throws transient " +
|
25
|
+
"try void volatile while");
|
26
|
+
var blockKeywords = words("catch class do else finally for if switch try while enum interface def");
|
27
|
+
var standaloneKeywords = words("return break continue");
|
28
|
+
var atoms = words("null true false this");
|
29
|
+
|
30
|
+
var curPunc;
|
31
|
+
function tokenBase(stream, state) {
|
32
|
+
var ch = stream.next();
|
33
|
+
if (ch == '"' || ch == "'") {
|
34
|
+
return startString(ch, stream, state);
|
35
|
+
}
|
36
|
+
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
37
|
+
curPunc = ch;
|
38
|
+
return null;
|
39
|
+
}
|
40
|
+
if (/\d/.test(ch)) {
|
41
|
+
stream.eatWhile(/[\w\.]/);
|
42
|
+
if (stream.eat(/eE/)) { stream.eat(/\+\-/); stream.eatWhile(/\d/); }
|
43
|
+
return "number";
|
44
|
+
}
|
45
|
+
if (ch == "/") {
|
46
|
+
if (stream.eat("*")) {
|
47
|
+
state.tokenize.push(tokenComment);
|
48
|
+
return tokenComment(stream, state);
|
49
|
+
}
|
50
|
+
if (stream.eat("/")) {
|
51
|
+
stream.skipToEnd();
|
52
|
+
return "comment";
|
53
|
+
}
|
54
|
+
if (expectExpression(state.lastToken, false)) {
|
55
|
+
return startString(ch, stream, state);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
if (ch == "-" && stream.eat(">")) {
|
59
|
+
curPunc = "->";
|
60
|
+
return null;
|
61
|
+
}
|
62
|
+
if (/[+\-*&%=<>!?|\/~]/.test(ch)) {
|
63
|
+
stream.eatWhile(/[+\-*&%=<>|~]/);
|
64
|
+
return "operator";
|
65
|
+
}
|
66
|
+
stream.eatWhile(/[\w\$_]/);
|
67
|
+
if (ch == "@") { stream.eatWhile(/[\w\$_\.]/); return "meta"; }
|
68
|
+
if (state.lastToken == ".") return "property";
|
69
|
+
if (stream.eat(":")) { curPunc = "proplabel"; return "property"; }
|
70
|
+
var cur = stream.current();
|
71
|
+
if (atoms.propertyIsEnumerable(cur)) { return "atom"; }
|
72
|
+
if (keywords.propertyIsEnumerable(cur)) {
|
73
|
+
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
74
|
+
else if (standaloneKeywords.propertyIsEnumerable(cur)) curPunc = "standalone";
|
75
|
+
return "keyword";
|
76
|
+
}
|
77
|
+
return "variable";
|
78
|
+
}
|
79
|
+
tokenBase.isBase = true;
|
80
|
+
|
81
|
+
function startString(quote, stream, state) {
|
82
|
+
var tripleQuoted = false;
|
83
|
+
if (quote != "/" && stream.eat(quote)) {
|
84
|
+
if (stream.eat(quote)) tripleQuoted = true;
|
85
|
+
else return "string";
|
86
|
+
}
|
87
|
+
function t(stream, state) {
|
88
|
+
var escaped = false, next, end = !tripleQuoted;
|
89
|
+
while ((next = stream.next()) != null) {
|
90
|
+
if (next == quote && !escaped) {
|
91
|
+
if (!tripleQuoted) { break; }
|
92
|
+
if (stream.match(quote + quote)) { end = true; break; }
|
93
|
+
}
|
94
|
+
if (quote == '"' && next == "$" && !escaped && stream.eat("{")) {
|
95
|
+
state.tokenize.push(tokenBaseUntilBrace());
|
96
|
+
return "string";
|
97
|
+
}
|
98
|
+
escaped = !escaped && next == "\\";
|
99
|
+
}
|
100
|
+
if (end) state.tokenize.pop();
|
101
|
+
return "string";
|
102
|
+
}
|
103
|
+
state.tokenize.push(t);
|
104
|
+
return t(stream, state);
|
105
|
+
}
|
106
|
+
|
107
|
+
function tokenBaseUntilBrace() {
|
108
|
+
var depth = 1;
|
109
|
+
function t(stream, state) {
|
110
|
+
if (stream.peek() == "}") {
|
111
|
+
depth--;
|
112
|
+
if (depth == 0) {
|
113
|
+
state.tokenize.pop();
|
114
|
+
return state.tokenize[state.tokenize.length-1](stream, state);
|
115
|
+
}
|
116
|
+
} else if (stream.peek() == "{") {
|
117
|
+
depth++;
|
118
|
+
}
|
119
|
+
return tokenBase(stream, state);
|
120
|
+
}
|
121
|
+
t.isBase = true;
|
122
|
+
return t;
|
123
|
+
}
|
124
|
+
|
125
|
+
function tokenComment(stream, state) {
|
126
|
+
var maybeEnd = false, ch;
|
127
|
+
while (ch = stream.next()) {
|
128
|
+
if (ch == "/" && maybeEnd) {
|
129
|
+
state.tokenize.pop();
|
130
|
+
break;
|
131
|
+
}
|
132
|
+
maybeEnd = (ch == "*");
|
133
|
+
}
|
134
|
+
return "comment";
|
135
|
+
}
|
136
|
+
|
137
|
+
function expectExpression(last, newline) {
|
138
|
+
return !last || last == "operator" || last == "->" || /[\.\[\{\(,;:]/.test(last) ||
|
139
|
+
last == "newstatement" || last == "keyword" || last == "proplabel" ||
|
140
|
+
(last == "standalone" && !newline);
|
141
|
+
}
|
142
|
+
|
143
|
+
function Context(indented, column, type, align, prev) {
|
144
|
+
this.indented = indented;
|
145
|
+
this.column = column;
|
146
|
+
this.type = type;
|
147
|
+
this.align = align;
|
148
|
+
this.prev = prev;
|
149
|
+
}
|
150
|
+
function pushContext(state, col, type) {
|
151
|
+
return state.context = new Context(state.indented, col, type, null, state.context);
|
152
|
+
}
|
153
|
+
function popContext(state) {
|
154
|
+
var t = state.context.type;
|
155
|
+
if (t == ")" || t == "]" || t == "}")
|
156
|
+
state.indented = state.context.indented;
|
157
|
+
return state.context = state.context.prev;
|
158
|
+
}
|
159
|
+
|
160
|
+
// Interface
|
161
|
+
|
162
|
+
return {
|
163
|
+
startState: function(basecolumn) {
|
164
|
+
return {
|
165
|
+
tokenize: [tokenBase],
|
166
|
+
context: new Context((basecolumn || 0) - config.indentUnit, 0, "top", false),
|
167
|
+
indented: 0,
|
168
|
+
startOfLine: true,
|
169
|
+
lastToken: null
|
170
|
+
};
|
171
|
+
},
|
172
|
+
|
173
|
+
token: function(stream, state) {
|
174
|
+
var ctx = state.context;
|
175
|
+
if (stream.sol()) {
|
176
|
+
if (ctx.align == null) ctx.align = false;
|
177
|
+
state.indented = stream.indentation();
|
178
|
+
state.startOfLine = true;
|
179
|
+
// Automatic semicolon insertion
|
180
|
+
if (ctx.type == "statement" && !expectExpression(state.lastToken, true)) {
|
181
|
+
popContext(state); ctx = state.context;
|
182
|
+
}
|
183
|
+
}
|
184
|
+
if (stream.eatSpace()) return null;
|
185
|
+
curPunc = null;
|
186
|
+
var style = state.tokenize[state.tokenize.length-1](stream, state);
|
187
|
+
if (style == "comment") return style;
|
188
|
+
if (ctx.align == null) ctx.align = true;
|
189
|
+
|
190
|
+
if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
|
191
|
+
// Handle indentation for {x -> \n ... }
|
192
|
+
else if (curPunc == "->" && ctx.type == "statement" && ctx.prev.type == "}") {
|
193
|
+
popContext(state);
|
194
|
+
state.context.align = false;
|
195
|
+
}
|
196
|
+
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
197
|
+
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
198
|
+
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
199
|
+
else if (curPunc == "}") {
|
200
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
201
|
+
if (ctx.type == "}") ctx = popContext(state);
|
202
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
203
|
+
}
|
204
|
+
else if (curPunc == ctx.type) popContext(state);
|
205
|
+
else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
|
206
|
+
pushContext(state, stream.column(), "statement");
|
207
|
+
state.startOfLine = false;
|
208
|
+
state.lastToken = curPunc || style;
|
209
|
+
return style;
|
210
|
+
},
|
211
|
+
|
212
|
+
indent: function(state, textAfter) {
|
213
|
+
if (!state.tokenize[state.tokenize.length-1].isBase) return 0;
|
214
|
+
var firstChar = textAfter && textAfter.charAt(0), ctx = state.context;
|
215
|
+
if (ctx.type == "statement" && !expectExpression(state.lastToken, true)) ctx = ctx.prev;
|
216
|
+
var closing = firstChar == ctx.type;
|
217
|
+
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : config.indentUnit);
|
218
|
+
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
219
|
+
else return ctx.indented + (closing ? 0 : config.indentUnit);
|
220
|
+
},
|
221
|
+
|
222
|
+
electricChars: "{}",
|
223
|
+
closeBrackets: {triples: "'\""},
|
224
|
+
fold: "brace"
|
225
|
+
};
|
226
|
+
});
|
227
|
+
|
228
|
+
CodeMirror.defineMIME("text/x-groovy", "groovy");
|
229
|
+
|
230
|
+
});
|
@@ -0,0 +1,161 @@
|
|
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"), require("../ruby/ruby"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../ruby/ruby"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
// full haml mode. This handled embedded ruby and html fragments too
|
15
|
+
CodeMirror.defineMode("haml", function(config) {
|
16
|
+
var htmlMode = CodeMirror.getMode(config, {name: "htmlmixed"});
|
17
|
+
var rubyMode = CodeMirror.getMode(config, "ruby");
|
18
|
+
|
19
|
+
function rubyInQuote(endQuote) {
|
20
|
+
return function(stream, state) {
|
21
|
+
var ch = stream.peek();
|
22
|
+
if (ch == endQuote && state.rubyState.tokenize.length == 1) {
|
23
|
+
// step out of ruby context as it seems to complete processing all the braces
|
24
|
+
stream.next();
|
25
|
+
state.tokenize = html;
|
26
|
+
return "closeAttributeTag";
|
27
|
+
} else {
|
28
|
+
return ruby(stream, state);
|
29
|
+
}
|
30
|
+
};
|
31
|
+
}
|
32
|
+
|
33
|
+
function ruby(stream, state) {
|
34
|
+
if (stream.match("-#")) {
|
35
|
+
stream.skipToEnd();
|
36
|
+
return "comment";
|
37
|
+
}
|
38
|
+
return rubyMode.token(stream, state.rubyState);
|
39
|
+
}
|
40
|
+
|
41
|
+
function html(stream, state) {
|
42
|
+
var ch = stream.peek();
|
43
|
+
|
44
|
+
// handle haml declarations. All declarations that cant be handled here
|
45
|
+
// will be passed to html mode
|
46
|
+
if (state.previousToken.style == "comment" ) {
|
47
|
+
if (state.indented > state.previousToken.indented) {
|
48
|
+
stream.skipToEnd();
|
49
|
+
return "commentLine";
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
if (state.startOfLine) {
|
54
|
+
if (ch == "!" && stream.match("!!")) {
|
55
|
+
stream.skipToEnd();
|
56
|
+
return "tag";
|
57
|
+
} else if (stream.match(/^%[\w:#\.]+=/)) {
|
58
|
+
state.tokenize = ruby;
|
59
|
+
return "hamlTag";
|
60
|
+
} else if (stream.match(/^%[\w:]+/)) {
|
61
|
+
return "hamlTag";
|
62
|
+
} else if (ch == "/" ) {
|
63
|
+
stream.skipToEnd();
|
64
|
+
return "comment";
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
if (state.startOfLine || state.previousToken.style == "hamlTag") {
|
69
|
+
if ( ch == "#" || ch == ".") {
|
70
|
+
stream.match(/[\w-#\.]*/);
|
71
|
+
return "hamlAttribute";
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
// donot handle --> as valid ruby, make it HTML close comment instead
|
76
|
+
if (state.startOfLine && !stream.match("-->", false) && (ch == "=" || ch == "-" )) {
|
77
|
+
state.tokenize = ruby;
|
78
|
+
return state.tokenize(stream, state);
|
79
|
+
}
|
80
|
+
|
81
|
+
if (state.previousToken.style == "hamlTag" ||
|
82
|
+
state.previousToken.style == "closeAttributeTag" ||
|
83
|
+
state.previousToken.style == "hamlAttribute") {
|
84
|
+
if (ch == "(") {
|
85
|
+
state.tokenize = rubyInQuote(")");
|
86
|
+
return state.tokenize(stream, state);
|
87
|
+
} else if (ch == "{") {
|
88
|
+
if (!stream.match(/^\{%.*/)) {
|
89
|
+
state.tokenize = rubyInQuote("}");
|
90
|
+
return state.tokenize(stream, state);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
return htmlMode.token(stream, state.htmlState);
|
96
|
+
}
|
97
|
+
|
98
|
+
return {
|
99
|
+
// default to html mode
|
100
|
+
startState: function() {
|
101
|
+
var htmlState = CodeMirror.startState(htmlMode);
|
102
|
+
var rubyState = CodeMirror.startState(rubyMode);
|
103
|
+
return {
|
104
|
+
htmlState: htmlState,
|
105
|
+
rubyState: rubyState,
|
106
|
+
indented: 0,
|
107
|
+
previousToken: { style: null, indented: 0},
|
108
|
+
tokenize: html
|
109
|
+
};
|
110
|
+
},
|
111
|
+
|
112
|
+
copyState: function(state) {
|
113
|
+
return {
|
114
|
+
htmlState : CodeMirror.copyState(htmlMode, state.htmlState),
|
115
|
+
rubyState: CodeMirror.copyState(rubyMode, state.rubyState),
|
116
|
+
indented: state.indented,
|
117
|
+
previousToken: state.previousToken,
|
118
|
+
tokenize: state.tokenize
|
119
|
+
};
|
120
|
+
},
|
121
|
+
|
122
|
+
token: function(stream, state) {
|
123
|
+
if (stream.sol()) {
|
124
|
+
state.indented = stream.indentation();
|
125
|
+
state.startOfLine = true;
|
126
|
+
}
|
127
|
+
if (stream.eatSpace()) return null;
|
128
|
+
var style = state.tokenize(stream, state);
|
129
|
+
state.startOfLine = false;
|
130
|
+
// dont record comment line as we only want to measure comment line with
|
131
|
+
// the opening comment block
|
132
|
+
if (style && style != "commentLine") {
|
133
|
+
state.previousToken = { style: style, indented: state.indented };
|
134
|
+
}
|
135
|
+
// if current state is ruby and the previous token is not `,` reset the
|
136
|
+
// tokenize to html
|
137
|
+
if (stream.eol() && state.tokenize == ruby) {
|
138
|
+
stream.backUp(1);
|
139
|
+
var ch = stream.peek();
|
140
|
+
stream.next();
|
141
|
+
if (ch && ch != ",") {
|
142
|
+
state.tokenize = html;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
// reprocess some of the specific style tag when finish setting previousToken
|
146
|
+
if (style == "hamlTag") {
|
147
|
+
style = "tag";
|
148
|
+
} else if (style == "commentLine") {
|
149
|
+
style = "comment";
|
150
|
+
} else if (style == "hamlAttribute") {
|
151
|
+
style = "attribute";
|
152
|
+
} else if (style == "closeAttributeTag") {
|
153
|
+
style = null;
|
154
|
+
}
|
155
|
+
return style;
|
156
|
+
}
|
157
|
+
};
|
158
|
+
}, "htmlmixed", "ruby");
|
159
|
+
|
160
|
+
CodeMirror.defineMIME("text/x-haml", "haml");
|
161
|
+
});
|
@@ -0,0 +1,62 @@
|
|
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("../../addon/mode/simple"), require("../../addon/mode/multiplex"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror", "../../addon/mode/simple", "../../addon/mode/multiplex"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
CodeMirror.defineSimpleMode("handlebars-tags", {
|
15
|
+
start: [
|
16
|
+
{ regex: /\{\{!--/, push: "dash_comment", token: "comment" },
|
17
|
+
{ regex: /\{\{!/, push: "comment", token: "comment" },
|
18
|
+
{ regex: /\{\{/, push: "handlebars", token: "tag" }
|
19
|
+
],
|
20
|
+
handlebars: [
|
21
|
+
{ regex: /\}\}/, pop: true, token: "tag" },
|
22
|
+
|
23
|
+
// Double and single quotes
|
24
|
+
{ regex: /"(?:[^\\"]|\\.)*"?/, token: "string" },
|
25
|
+
{ regex: /'(?:[^\\']|\\.)*'?/, token: "string" },
|
26
|
+
|
27
|
+
// Handlebars keywords
|
28
|
+
{ regex: />|[#\/]([A-Za-z_]\w*)/, token: "keyword" },
|
29
|
+
{ regex: /(?:else|this)\b/, token: "keyword" },
|
30
|
+
|
31
|
+
// Numeral
|
32
|
+
{ regex: /\d+/i, token: "number" },
|
33
|
+
|
34
|
+
// Atoms like = and .
|
35
|
+
{ regex: /=|~|@|true|false/, token: "atom" },
|
36
|
+
|
37
|
+
// Paths
|
38
|
+
{ regex: /(?:\.\.\/)*(?:[A-Za-z_][\w\.]*)+/, token: "variable-2" }
|
39
|
+
],
|
40
|
+
dash_comment: [
|
41
|
+
{ regex: /--\}\}/, pop: true, token: "comment" },
|
42
|
+
|
43
|
+
// Commented code
|
44
|
+
{ regex: /./, token: "comment"}
|
45
|
+
],
|
46
|
+
comment: [
|
47
|
+
{ regex: /\}\}/, pop: true, token: "comment" },
|
48
|
+
{ regex: /./, token: "comment" }
|
49
|
+
]
|
50
|
+
});
|
51
|
+
|
52
|
+
CodeMirror.defineMode("handlebars", function(config, parserConfig) {
|
53
|
+
var handlebars = CodeMirror.getMode(config, "handlebars-tags");
|
54
|
+
if (!parserConfig || !parserConfig.base) return handlebars;
|
55
|
+
return CodeMirror.multiplexingMode(
|
56
|
+
CodeMirror.getMode(config, parserConfig.base),
|
57
|
+
{open: "{{", close: "}}", mode: handlebars, parseDelimiters: true}
|
58
|
+
);
|
59
|
+
});
|
60
|
+
|
61
|
+
CodeMirror.defineMIME("text/x-handlebars-template", "handlebars");
|
62
|
+
});
|
@@ -0,0 +1,43 @@
|
|
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("../haskell/haskell"))
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror", "../haskell/haskell"], mod)
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror)
|
11
|
+
})(function (CodeMirror) {
|
12
|
+
"use strict"
|
13
|
+
|
14
|
+
CodeMirror.defineMode("haskell-literate", function (config, parserConfig) {
|
15
|
+
var baseMode = CodeMirror.getMode(config, (parserConfig && parserConfig.base) || "haskell")
|
16
|
+
|
17
|
+
return {
|
18
|
+
startState: function () {
|
19
|
+
return {
|
20
|
+
inCode: false,
|
21
|
+
baseState: CodeMirror.startState(baseMode)
|
22
|
+
}
|
23
|
+
},
|
24
|
+
token: function (stream, state) {
|
25
|
+
if (stream.sol()) {
|
26
|
+
if (state.inCode = stream.eat(">"))
|
27
|
+
return "meta"
|
28
|
+
}
|
29
|
+
if (state.inCode) {
|
30
|
+
return baseMode.token(stream, state.baseState)
|
31
|
+
} else {
|
32
|
+
stream.skipToEnd()
|
33
|
+
return "comment"
|
34
|
+
}
|
35
|
+
},
|
36
|
+
innerMode: function (state) {
|
37
|
+
return state.inCode ? {state: state.baseState, mode: baseMode} : null
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}, "haskell")
|
41
|
+
|
42
|
+
CodeMirror.defineMIME("text/x-literate-haskell", "haskell-literate")
|
43
|
+
});
|