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,414 @@
|
|
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("sass", function(config) {
|
15
|
+
function tokenRegexp(words) {
|
16
|
+
return new RegExp("^" + words.join("|"));
|
17
|
+
}
|
18
|
+
|
19
|
+
var keywords = ["true", "false", "null", "auto"];
|
20
|
+
var keywordsRegexp = new RegExp("^" + keywords.join("|"));
|
21
|
+
|
22
|
+
var operators = ["\\(", "\\)", "=", ">", "<", "==", ">=", "<=", "\\+", "-",
|
23
|
+
"\\!=", "/", "\\*", "%", "and", "or", "not", ";","\\{","\\}",":"];
|
24
|
+
var opRegexp = tokenRegexp(operators);
|
25
|
+
|
26
|
+
var pseudoElementsRegexp = /^::?[a-zA-Z_][\w\-]*/;
|
27
|
+
|
28
|
+
function urlTokens(stream, state) {
|
29
|
+
var ch = stream.peek();
|
30
|
+
|
31
|
+
if (ch === ")") {
|
32
|
+
stream.next();
|
33
|
+
state.tokenizer = tokenBase;
|
34
|
+
return "operator";
|
35
|
+
} else if (ch === "(") {
|
36
|
+
stream.next();
|
37
|
+
stream.eatSpace();
|
38
|
+
|
39
|
+
return "operator";
|
40
|
+
} else if (ch === "'" || ch === '"') {
|
41
|
+
state.tokenizer = buildStringTokenizer(stream.next());
|
42
|
+
return "string";
|
43
|
+
} else {
|
44
|
+
state.tokenizer = buildStringTokenizer(")", false);
|
45
|
+
return "string";
|
46
|
+
}
|
47
|
+
}
|
48
|
+
function comment(indentation, multiLine) {
|
49
|
+
return function(stream, state) {
|
50
|
+
if (stream.sol() && stream.indentation() <= indentation) {
|
51
|
+
state.tokenizer = tokenBase;
|
52
|
+
return tokenBase(stream, state);
|
53
|
+
}
|
54
|
+
|
55
|
+
if (multiLine && stream.skipTo("*/")) {
|
56
|
+
stream.next();
|
57
|
+
stream.next();
|
58
|
+
state.tokenizer = tokenBase;
|
59
|
+
} else {
|
60
|
+
stream.skipToEnd();
|
61
|
+
}
|
62
|
+
|
63
|
+
return "comment";
|
64
|
+
};
|
65
|
+
}
|
66
|
+
|
67
|
+
function buildStringTokenizer(quote, greedy) {
|
68
|
+
if (greedy == null) { greedy = true; }
|
69
|
+
|
70
|
+
function stringTokenizer(stream, state) {
|
71
|
+
var nextChar = stream.next();
|
72
|
+
var peekChar = stream.peek();
|
73
|
+
var previousChar = stream.string.charAt(stream.pos-2);
|
74
|
+
|
75
|
+
var endingString = ((nextChar !== "\\" && peekChar === quote) || (nextChar === quote && previousChar !== "\\"));
|
76
|
+
|
77
|
+
if (endingString) {
|
78
|
+
if (nextChar !== quote && greedy) { stream.next(); }
|
79
|
+
state.tokenizer = tokenBase;
|
80
|
+
return "string";
|
81
|
+
} else if (nextChar === "#" && peekChar === "{") {
|
82
|
+
state.tokenizer = buildInterpolationTokenizer(stringTokenizer);
|
83
|
+
stream.next();
|
84
|
+
return "operator";
|
85
|
+
} else {
|
86
|
+
return "string";
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
return stringTokenizer;
|
91
|
+
}
|
92
|
+
|
93
|
+
function buildInterpolationTokenizer(currentTokenizer) {
|
94
|
+
return function(stream, state) {
|
95
|
+
if (stream.peek() === "}") {
|
96
|
+
stream.next();
|
97
|
+
state.tokenizer = currentTokenizer;
|
98
|
+
return "operator";
|
99
|
+
} else {
|
100
|
+
return tokenBase(stream, state);
|
101
|
+
}
|
102
|
+
};
|
103
|
+
}
|
104
|
+
|
105
|
+
function indent(state) {
|
106
|
+
if (state.indentCount == 0) {
|
107
|
+
state.indentCount++;
|
108
|
+
var lastScopeOffset = state.scopes[0].offset;
|
109
|
+
var currentOffset = lastScopeOffset + config.indentUnit;
|
110
|
+
state.scopes.unshift({ offset:currentOffset });
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
function dedent(state) {
|
115
|
+
if (state.scopes.length == 1) return;
|
116
|
+
|
117
|
+
state.scopes.shift();
|
118
|
+
}
|
119
|
+
|
120
|
+
function tokenBase(stream, state) {
|
121
|
+
var ch = stream.peek();
|
122
|
+
|
123
|
+
// Comment
|
124
|
+
if (stream.match("/*")) {
|
125
|
+
state.tokenizer = comment(stream.indentation(), true);
|
126
|
+
return state.tokenizer(stream, state);
|
127
|
+
}
|
128
|
+
if (stream.match("//")) {
|
129
|
+
state.tokenizer = comment(stream.indentation(), false);
|
130
|
+
return state.tokenizer(stream, state);
|
131
|
+
}
|
132
|
+
|
133
|
+
// Interpolation
|
134
|
+
if (stream.match("#{")) {
|
135
|
+
state.tokenizer = buildInterpolationTokenizer(tokenBase);
|
136
|
+
return "operator";
|
137
|
+
}
|
138
|
+
|
139
|
+
// Strings
|
140
|
+
if (ch === '"' || ch === "'") {
|
141
|
+
stream.next();
|
142
|
+
state.tokenizer = buildStringTokenizer(ch);
|
143
|
+
return "string";
|
144
|
+
}
|
145
|
+
|
146
|
+
if(!state.cursorHalf){// state.cursorHalf === 0
|
147
|
+
// first half i.e. before : for key-value pairs
|
148
|
+
// including selectors
|
149
|
+
|
150
|
+
if (ch === ".") {
|
151
|
+
stream.next();
|
152
|
+
if (stream.match(/^[\w-]+/)) {
|
153
|
+
indent(state);
|
154
|
+
return "atom";
|
155
|
+
} else if (stream.peek() === "#") {
|
156
|
+
indent(state);
|
157
|
+
return "atom";
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
if (ch === "#") {
|
162
|
+
stream.next();
|
163
|
+
// ID selectors
|
164
|
+
if (stream.match(/^[\w-]+/)) {
|
165
|
+
indent(state);
|
166
|
+
return "atom";
|
167
|
+
}
|
168
|
+
if (stream.peek() === "#") {
|
169
|
+
indent(state);
|
170
|
+
return "atom";
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
// Variables
|
175
|
+
if (ch === "$") {
|
176
|
+
stream.next();
|
177
|
+
stream.eatWhile(/[\w-]/);
|
178
|
+
return "variable-2";
|
179
|
+
}
|
180
|
+
|
181
|
+
// Numbers
|
182
|
+
if (stream.match(/^-?[0-9\.]+/))
|
183
|
+
return "number";
|
184
|
+
|
185
|
+
// Units
|
186
|
+
if (stream.match(/^(px|em|in)\b/))
|
187
|
+
return "unit";
|
188
|
+
|
189
|
+
if (stream.match(keywordsRegexp))
|
190
|
+
return "keyword";
|
191
|
+
|
192
|
+
if (stream.match(/^url/) && stream.peek() === "(") {
|
193
|
+
state.tokenizer = urlTokens;
|
194
|
+
return "atom";
|
195
|
+
}
|
196
|
+
|
197
|
+
if (ch === "=") {
|
198
|
+
// Match shortcut mixin definition
|
199
|
+
if (stream.match(/^=[\w-]+/)) {
|
200
|
+
indent(state);
|
201
|
+
return "meta";
|
202
|
+
}
|
203
|
+
}
|
204
|
+
|
205
|
+
if (ch === "+") {
|
206
|
+
// Match shortcut mixin definition
|
207
|
+
if (stream.match(/^\+[\w-]+/)){
|
208
|
+
return "variable-3";
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
if(ch === "@"){
|
213
|
+
if(stream.match(/@extend/)){
|
214
|
+
if(!stream.match(/\s*[\w]/))
|
215
|
+
dedent(state);
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
|
220
|
+
// Indent Directives
|
221
|
+
if (stream.match(/^@(else if|if|media|else|for|each|while|mixin|function)/)) {
|
222
|
+
indent(state);
|
223
|
+
return "meta";
|
224
|
+
}
|
225
|
+
|
226
|
+
// Other Directives
|
227
|
+
if (ch === "@") {
|
228
|
+
stream.next();
|
229
|
+
stream.eatWhile(/[\w-]/);
|
230
|
+
return "meta";
|
231
|
+
}
|
232
|
+
|
233
|
+
if (stream.eatWhile(/[\w-]/)){
|
234
|
+
if(stream.match(/ *: *[\w-\+\$#!\("']/,false)){
|
235
|
+
return "property";
|
236
|
+
}
|
237
|
+
else if(stream.match(/ *:/,false)){
|
238
|
+
indent(state);
|
239
|
+
state.cursorHalf = 1;
|
240
|
+
return "atom";
|
241
|
+
}
|
242
|
+
else if(stream.match(/ *,/,false)){
|
243
|
+
return "atom";
|
244
|
+
}
|
245
|
+
else{
|
246
|
+
indent(state);
|
247
|
+
return "atom";
|
248
|
+
}
|
249
|
+
}
|
250
|
+
|
251
|
+
if(ch === ":"){
|
252
|
+
if (stream.match(pseudoElementsRegexp)){ // could be a pseudo-element
|
253
|
+
return "keyword";
|
254
|
+
}
|
255
|
+
stream.next();
|
256
|
+
state.cursorHalf=1;
|
257
|
+
return "operator";
|
258
|
+
}
|
259
|
+
|
260
|
+
} // cursorHalf===0 ends here
|
261
|
+
else{
|
262
|
+
|
263
|
+
if (ch === "#") {
|
264
|
+
stream.next();
|
265
|
+
// Hex numbers
|
266
|
+
if (stream.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)){
|
267
|
+
if(!stream.peek()){
|
268
|
+
state.cursorHalf = 0;
|
269
|
+
}
|
270
|
+
return "number";
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
// Numbers
|
275
|
+
if (stream.match(/^-?[0-9\.]+/)){
|
276
|
+
if(!stream.peek()){
|
277
|
+
state.cursorHalf = 0;
|
278
|
+
}
|
279
|
+
return "number";
|
280
|
+
}
|
281
|
+
|
282
|
+
// Units
|
283
|
+
if (stream.match(/^(px|em|in)\b/)){
|
284
|
+
if(!stream.peek()){
|
285
|
+
state.cursorHalf = 0;
|
286
|
+
}
|
287
|
+
return "unit";
|
288
|
+
}
|
289
|
+
|
290
|
+
if (stream.match(keywordsRegexp)){
|
291
|
+
if(!stream.peek()){
|
292
|
+
state.cursorHalf = 0;
|
293
|
+
}
|
294
|
+
return "keyword";
|
295
|
+
}
|
296
|
+
|
297
|
+
if (stream.match(/^url/) && stream.peek() === "(") {
|
298
|
+
state.tokenizer = urlTokens;
|
299
|
+
if(!stream.peek()){
|
300
|
+
state.cursorHalf = 0;
|
301
|
+
}
|
302
|
+
return "atom";
|
303
|
+
}
|
304
|
+
|
305
|
+
// Variables
|
306
|
+
if (ch === "$") {
|
307
|
+
stream.next();
|
308
|
+
stream.eatWhile(/[\w-]/);
|
309
|
+
if(!stream.peek()){
|
310
|
+
state.cursorHalf = 0;
|
311
|
+
}
|
312
|
+
return "variable-3";
|
313
|
+
}
|
314
|
+
|
315
|
+
// bang character for !important, !default, etc.
|
316
|
+
if (ch === "!") {
|
317
|
+
stream.next();
|
318
|
+
if(!stream.peek()){
|
319
|
+
state.cursorHalf = 0;
|
320
|
+
}
|
321
|
+
return stream.match(/^[\w]+/) ? "keyword": "operator";
|
322
|
+
}
|
323
|
+
|
324
|
+
if (stream.match(opRegexp)){
|
325
|
+
if(!stream.peek()){
|
326
|
+
state.cursorHalf = 0;
|
327
|
+
}
|
328
|
+
return "operator";
|
329
|
+
}
|
330
|
+
|
331
|
+
// attributes
|
332
|
+
if (stream.eatWhile(/[\w-]/)) {
|
333
|
+
if(!stream.peek()){
|
334
|
+
state.cursorHalf = 0;
|
335
|
+
}
|
336
|
+
return "attribute";
|
337
|
+
}
|
338
|
+
|
339
|
+
//stream.eatSpace();
|
340
|
+
if(!stream.peek()){
|
341
|
+
state.cursorHalf = 0;
|
342
|
+
return null;
|
343
|
+
}
|
344
|
+
|
345
|
+
} // else ends here
|
346
|
+
|
347
|
+
if (stream.match(opRegexp))
|
348
|
+
return "operator";
|
349
|
+
|
350
|
+
// If we haven't returned by now, we move 1 character
|
351
|
+
// and return an error
|
352
|
+
stream.next();
|
353
|
+
return null;
|
354
|
+
}
|
355
|
+
|
356
|
+
function tokenLexer(stream, state) {
|
357
|
+
if (stream.sol()) state.indentCount = 0;
|
358
|
+
var style = state.tokenizer(stream, state);
|
359
|
+
var current = stream.current();
|
360
|
+
|
361
|
+
if (current === "@return" || current === "}"){
|
362
|
+
dedent(state);
|
363
|
+
}
|
364
|
+
|
365
|
+
if (style !== null) {
|
366
|
+
var startOfToken = stream.pos - current.length;
|
367
|
+
|
368
|
+
var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount);
|
369
|
+
|
370
|
+
var newScopes = [];
|
371
|
+
|
372
|
+
for (var i = 0; i < state.scopes.length; i++) {
|
373
|
+
var scope = state.scopes[i];
|
374
|
+
|
375
|
+
if (scope.offset <= withCurrentIndent)
|
376
|
+
newScopes.push(scope);
|
377
|
+
}
|
378
|
+
|
379
|
+
state.scopes = newScopes;
|
380
|
+
}
|
381
|
+
|
382
|
+
|
383
|
+
return style;
|
384
|
+
}
|
385
|
+
|
386
|
+
return {
|
387
|
+
startState: function() {
|
388
|
+
return {
|
389
|
+
tokenizer: tokenBase,
|
390
|
+
scopes: [{offset: 0, type: "sass"}],
|
391
|
+
indentCount: 0,
|
392
|
+
cursorHalf: 0, // cursor half tells us if cursor lies after (1)
|
393
|
+
// or before (0) colon (well... more or less)
|
394
|
+
definedVars: [],
|
395
|
+
definedMixins: []
|
396
|
+
};
|
397
|
+
},
|
398
|
+
token: function(stream, state) {
|
399
|
+
var style = tokenLexer(stream, state);
|
400
|
+
|
401
|
+
state.lastToken = { style: style, content: stream.current() };
|
402
|
+
|
403
|
+
return style;
|
404
|
+
},
|
405
|
+
|
406
|
+
indent: function(state) {
|
407
|
+
return state.scopes[0].offset;
|
408
|
+
}
|
409
|
+
};
|
410
|
+
});
|
411
|
+
|
412
|
+
CodeMirror.defineMIME("text/x-sass", "sass");
|
413
|
+
|
414
|
+
});
|
@@ -0,0 +1,249 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Author: Koh Zi Han, based on implementation by Koh Zi Chun
|
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("scheme", function () {
|
19
|
+
var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
|
20
|
+
ATOM = "atom", NUMBER = "number", BRACKET = "bracket";
|
21
|
+
var INDENT_WORD_SKIP = 2;
|
22
|
+
|
23
|
+
function makeKeywords(str) {
|
24
|
+
var obj = {}, words = str.split(" ");
|
25
|
+
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
26
|
+
return obj;
|
27
|
+
}
|
28
|
+
|
29
|
+
var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char<? char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string<? string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
|
30
|
+
var indentKeys = makeKeywords("define let letrec let* lambda");
|
31
|
+
|
32
|
+
function stateStack(indent, type, prev) { // represents a state stack object
|
33
|
+
this.indent = indent;
|
34
|
+
this.type = type;
|
35
|
+
this.prev = prev;
|
36
|
+
}
|
37
|
+
|
38
|
+
function pushStack(state, indent, type) {
|
39
|
+
state.indentStack = new stateStack(indent, type, state.indentStack);
|
40
|
+
}
|
41
|
+
|
42
|
+
function popStack(state) {
|
43
|
+
state.indentStack = state.indentStack.prev;
|
44
|
+
}
|
45
|
+
|
46
|
+
var binaryMatcher = new RegExp(/^(?:[-+]i|[-+][01]+#*(?:\/[01]+#*)?i|[-+]?[01]+#*(?:\/[01]+#*)?@[-+]?[01]+#*(?:\/[01]+#*)?|[-+]?[01]+#*(?:\/[01]+#*)?[-+](?:[01]+#*(?:\/[01]+#*)?)?i|[-+]?[01]+#*(?:\/[01]+#*)?)(?=[()\s;"]|$)/i);
|
47
|
+
var octalMatcher = new RegExp(/^(?:[-+]i|[-+][0-7]+#*(?:\/[0-7]+#*)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?@[-+]?[0-7]+#*(?:\/[0-7]+#*)?|[-+]?[0-7]+#*(?:\/[0-7]+#*)?[-+](?:[0-7]+#*(?:\/[0-7]+#*)?)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?)(?=[()\s;"]|$)/i);
|
48
|
+
var hexMatcher = new RegExp(/^(?:[-+]i|[-+][\da-f]+#*(?:\/[\da-f]+#*)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?@[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?[-+](?:[\da-f]+#*(?:\/[\da-f]+#*)?)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?)(?=[()\s;"]|$)/i);
|
49
|
+
var decimalMatcher = new RegExp(/^(?:[-+]i|[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)i|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)@[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)?i|(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*))(?=[()\s;"]|$)/i);
|
50
|
+
|
51
|
+
function isBinaryNumber (stream) {
|
52
|
+
return stream.match(binaryMatcher);
|
53
|
+
}
|
54
|
+
|
55
|
+
function isOctalNumber (stream) {
|
56
|
+
return stream.match(octalMatcher);
|
57
|
+
}
|
58
|
+
|
59
|
+
function isDecimalNumber (stream, backup) {
|
60
|
+
if (backup === true) {
|
61
|
+
stream.backUp(1);
|
62
|
+
}
|
63
|
+
return stream.match(decimalMatcher);
|
64
|
+
}
|
65
|
+
|
66
|
+
function isHexNumber (stream) {
|
67
|
+
return stream.match(hexMatcher);
|
68
|
+
}
|
69
|
+
|
70
|
+
return {
|
71
|
+
startState: function () {
|
72
|
+
return {
|
73
|
+
indentStack: null,
|
74
|
+
indentation: 0,
|
75
|
+
mode: false,
|
76
|
+
sExprComment: false
|
77
|
+
};
|
78
|
+
},
|
79
|
+
|
80
|
+
token: function (stream, state) {
|
81
|
+
if (state.indentStack == null && stream.sol()) {
|
82
|
+
// update indentation, but only if indentStack is empty
|
83
|
+
state.indentation = stream.indentation();
|
84
|
+
}
|
85
|
+
|
86
|
+
// skip spaces
|
87
|
+
if (stream.eatSpace()) {
|
88
|
+
return null;
|
89
|
+
}
|
90
|
+
var returnType = null;
|
91
|
+
|
92
|
+
switch(state.mode){
|
93
|
+
case "string": // multi-line string parsing mode
|
94
|
+
var next, escaped = false;
|
95
|
+
while ((next = stream.next()) != null) {
|
96
|
+
if (next == "\"" && !escaped) {
|
97
|
+
|
98
|
+
state.mode = false;
|
99
|
+
break;
|
100
|
+
}
|
101
|
+
escaped = !escaped && next == "\\";
|
102
|
+
}
|
103
|
+
returnType = STRING; // continue on in scheme-string mode
|
104
|
+
break;
|
105
|
+
case "comment": // comment parsing mode
|
106
|
+
var next, maybeEnd = false;
|
107
|
+
while ((next = stream.next()) != null) {
|
108
|
+
if (next == "#" && maybeEnd) {
|
109
|
+
|
110
|
+
state.mode = false;
|
111
|
+
break;
|
112
|
+
}
|
113
|
+
maybeEnd = (next == "|");
|
114
|
+
}
|
115
|
+
returnType = COMMENT;
|
116
|
+
break;
|
117
|
+
case "s-expr-comment": // s-expr commenting mode
|
118
|
+
state.mode = false;
|
119
|
+
if(stream.peek() == "(" || stream.peek() == "["){
|
120
|
+
// actually start scheme s-expr commenting mode
|
121
|
+
state.sExprComment = 0;
|
122
|
+
}else{
|
123
|
+
// if not we just comment the entire of the next token
|
124
|
+
stream.eatWhile(/[^/s]/); // eat non spaces
|
125
|
+
returnType = COMMENT;
|
126
|
+
break;
|
127
|
+
}
|
128
|
+
default: // default parsing mode
|
129
|
+
var ch = stream.next();
|
130
|
+
|
131
|
+
if (ch == "\"") {
|
132
|
+
state.mode = "string";
|
133
|
+
returnType = STRING;
|
134
|
+
|
135
|
+
} else if (ch == "'") {
|
136
|
+
returnType = ATOM;
|
137
|
+
} else if (ch == '#') {
|
138
|
+
if (stream.eat("|")) { // Multi-line comment
|
139
|
+
state.mode = "comment"; // toggle to comment mode
|
140
|
+
returnType = COMMENT;
|
141
|
+
} else if (stream.eat(/[tf]/i)) { // #t/#f (atom)
|
142
|
+
returnType = ATOM;
|
143
|
+
} else if (stream.eat(';')) { // S-Expr comment
|
144
|
+
state.mode = "s-expr-comment";
|
145
|
+
returnType = COMMENT;
|
146
|
+
} else {
|
147
|
+
var numTest = null, hasExactness = false, hasRadix = true;
|
148
|
+
if (stream.eat(/[ei]/i)) {
|
149
|
+
hasExactness = true;
|
150
|
+
} else {
|
151
|
+
stream.backUp(1); // must be radix specifier
|
152
|
+
}
|
153
|
+
if (stream.match(/^#b/i)) {
|
154
|
+
numTest = isBinaryNumber;
|
155
|
+
} else if (stream.match(/^#o/i)) {
|
156
|
+
numTest = isOctalNumber;
|
157
|
+
} else if (stream.match(/^#x/i)) {
|
158
|
+
numTest = isHexNumber;
|
159
|
+
} else if (stream.match(/^#d/i)) {
|
160
|
+
numTest = isDecimalNumber;
|
161
|
+
} else if (stream.match(/^[-+0-9.]/, false)) {
|
162
|
+
hasRadix = false;
|
163
|
+
numTest = isDecimalNumber;
|
164
|
+
// re-consume the intial # if all matches failed
|
165
|
+
} else if (!hasExactness) {
|
166
|
+
stream.eat('#');
|
167
|
+
}
|
168
|
+
if (numTest != null) {
|
169
|
+
if (hasRadix && !hasExactness) {
|
170
|
+
// consume optional exactness after radix
|
171
|
+
stream.match(/^#[ei]/i);
|
172
|
+
}
|
173
|
+
if (numTest(stream))
|
174
|
+
returnType = NUMBER;
|
175
|
+
}
|
176
|
+
}
|
177
|
+
} else if (/^[-+0-9.]/.test(ch) && isDecimalNumber(stream, true)) { // match non-prefixed number, must be decimal
|
178
|
+
returnType = NUMBER;
|
179
|
+
} else if (ch == ";") { // comment
|
180
|
+
stream.skipToEnd(); // rest of the line is a comment
|
181
|
+
returnType = COMMENT;
|
182
|
+
} else if (ch == "(" || ch == "[") {
|
183
|
+
var keyWord = ''; var indentTemp = stream.column(), letter;
|
184
|
+
/**
|
185
|
+
Either
|
186
|
+
(indent-word ..
|
187
|
+
(non-indent-word ..
|
188
|
+
(;something else, bracket, etc.
|
189
|
+
*/
|
190
|
+
|
191
|
+
while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) {
|
192
|
+
keyWord += letter;
|
193
|
+
}
|
194
|
+
|
195
|
+
if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word
|
196
|
+
|
197
|
+
pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
|
198
|
+
} else { // non-indent word
|
199
|
+
// we continue eating the spaces
|
200
|
+
stream.eatSpace();
|
201
|
+
if (stream.eol() || stream.peek() == ";") {
|
202
|
+
// nothing significant after
|
203
|
+
// we restart indentation 1 space after
|
204
|
+
pushStack(state, indentTemp + 1, ch);
|
205
|
+
} else {
|
206
|
+
pushStack(state, indentTemp + stream.current().length, ch); // else we match
|
207
|
+
}
|
208
|
+
}
|
209
|
+
stream.backUp(stream.current().length - 1); // undo all the eating
|
210
|
+
|
211
|
+
if(typeof state.sExprComment == "number") state.sExprComment++;
|
212
|
+
|
213
|
+
returnType = BRACKET;
|
214
|
+
} else if (ch == ")" || ch == "]") {
|
215
|
+
returnType = BRACKET;
|
216
|
+
if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
|
217
|
+
popStack(state);
|
218
|
+
|
219
|
+
if(typeof state.sExprComment == "number"){
|
220
|
+
if(--state.sExprComment == 0){
|
221
|
+
returnType = COMMENT; // final closing bracket
|
222
|
+
state.sExprComment = false; // turn off s-expr commenting mode
|
223
|
+
}
|
224
|
+
}
|
225
|
+
}
|
226
|
+
} else {
|
227
|
+
stream.eatWhile(/[\w\$_\-!$%&*+\.\/:<=>?@\^~]/);
|
228
|
+
|
229
|
+
if (keywords && keywords.propertyIsEnumerable(stream.current())) {
|
230
|
+
returnType = BUILTIN;
|
231
|
+
} else returnType = "variable";
|
232
|
+
}
|
233
|
+
}
|
234
|
+
return (typeof state.sExprComment == "number") ? COMMENT : returnType;
|
235
|
+
},
|
236
|
+
|
237
|
+
indent: function (state) {
|
238
|
+
if (state.indentStack == null) return state.indentation;
|
239
|
+
return state.indentStack.indent;
|
240
|
+
},
|
241
|
+
|
242
|
+
closeBrackets: {pairs: "()[]{}\"\""},
|
243
|
+
lineComment: ";;"
|
244
|
+
};
|
245
|
+
});
|
246
|
+
|
247
|
+
CodeMirror.defineMIME("text/x-scheme", "scheme");
|
248
|
+
|
249
|
+
});
|