locomotivecms 4.1.1 → 4.2.0.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- 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 +47 -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,285 @@
|
|
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("ruby", function(config) {
|
15
|
+
function wordObj(words) {
|
16
|
+
var o = {};
|
17
|
+
for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
|
18
|
+
return o;
|
19
|
+
}
|
20
|
+
var keywords = wordObj([
|
21
|
+
"alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else",
|
22
|
+
"elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or",
|
23
|
+
"redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless",
|
24
|
+
"until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc",
|
25
|
+
"caller", "lambda", "proc", "public", "protected", "private", "require", "load",
|
26
|
+
"require_relative", "extend", "autoload", "__END__", "__FILE__", "__LINE__", "__dir__"
|
27
|
+
]);
|
28
|
+
var indentWords = wordObj(["def", "class", "case", "for", "while", "until", "module", "then",
|
29
|
+
"catch", "loop", "proc", "begin"]);
|
30
|
+
var dedentWords = wordObj(["end", "until"]);
|
31
|
+
var matching = {"[": "]", "{": "}", "(": ")"};
|
32
|
+
var curPunc;
|
33
|
+
|
34
|
+
function chain(newtok, stream, state) {
|
35
|
+
state.tokenize.push(newtok);
|
36
|
+
return newtok(stream, state);
|
37
|
+
}
|
38
|
+
|
39
|
+
function tokenBase(stream, state) {
|
40
|
+
if (stream.sol() && stream.match("=begin") && stream.eol()) {
|
41
|
+
state.tokenize.push(readBlockComment);
|
42
|
+
return "comment";
|
43
|
+
}
|
44
|
+
if (stream.eatSpace()) return null;
|
45
|
+
var ch = stream.next(), m;
|
46
|
+
if (ch == "`" || ch == "'" || ch == '"') {
|
47
|
+
return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state);
|
48
|
+
} else if (ch == "/") {
|
49
|
+
var currentIndex = stream.current().length;
|
50
|
+
if (stream.skipTo("/")) {
|
51
|
+
var search_till = stream.current().length;
|
52
|
+
stream.backUp(stream.current().length - currentIndex);
|
53
|
+
var balance = 0; // balance brackets
|
54
|
+
while (stream.current().length < search_till) {
|
55
|
+
var chchr = stream.next();
|
56
|
+
if (chchr == "(") balance += 1;
|
57
|
+
else if (chchr == ")") balance -= 1;
|
58
|
+
if (balance < 0) break;
|
59
|
+
}
|
60
|
+
stream.backUp(stream.current().length - currentIndex);
|
61
|
+
if (balance == 0)
|
62
|
+
return chain(readQuoted(ch, "string-2", true), stream, state);
|
63
|
+
}
|
64
|
+
return "operator";
|
65
|
+
} else if (ch == "%") {
|
66
|
+
var style = "string", embed = true;
|
67
|
+
if (stream.eat("s")) style = "atom";
|
68
|
+
else if (stream.eat(/[WQ]/)) style = "string";
|
69
|
+
else if (stream.eat(/[r]/)) style = "string-2";
|
70
|
+
else if (stream.eat(/[wxq]/)) { style = "string"; embed = false; }
|
71
|
+
var delim = stream.eat(/[^\w\s=]/);
|
72
|
+
if (!delim) return "operator";
|
73
|
+
if (matching.propertyIsEnumerable(delim)) delim = matching[delim];
|
74
|
+
return chain(readQuoted(delim, style, embed, true), stream, state);
|
75
|
+
} else if (ch == "#") {
|
76
|
+
stream.skipToEnd();
|
77
|
+
return "comment";
|
78
|
+
} else if (ch == "<" && (m = stream.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/))) {
|
79
|
+
return chain(readHereDoc(m[1]), stream, state);
|
80
|
+
} else if (ch == "0") {
|
81
|
+
if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/);
|
82
|
+
else if (stream.eat("b")) stream.eatWhile(/[01]/);
|
83
|
+
else stream.eatWhile(/[0-7]/);
|
84
|
+
return "number";
|
85
|
+
} else if (/\d/.test(ch)) {
|
86
|
+
stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/);
|
87
|
+
return "number";
|
88
|
+
} else if (ch == "?") {
|
89
|
+
while (stream.match(/^\\[CM]-/)) {}
|
90
|
+
if (stream.eat("\\")) stream.eatWhile(/\w/);
|
91
|
+
else stream.next();
|
92
|
+
return "string";
|
93
|
+
} else if (ch == ":") {
|
94
|
+
if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state);
|
95
|
+
if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state);
|
96
|
+
|
97
|
+
// :> :>> :< :<< are valid symbols
|
98
|
+
if (stream.eat(/[\<\>]/)) {
|
99
|
+
stream.eat(/[\<\>]/);
|
100
|
+
return "atom";
|
101
|
+
}
|
102
|
+
|
103
|
+
// :+ :- :/ :* :| :& :! are valid symbols
|
104
|
+
if (stream.eat(/[\+\-\*\/\&\|\:\!]/)) {
|
105
|
+
return "atom";
|
106
|
+
}
|
107
|
+
|
108
|
+
// Symbols can't start by a digit
|
109
|
+
if (stream.eat(/[a-zA-Z$@_\xa1-\uffff]/)) {
|
110
|
+
stream.eatWhile(/[\w$\xa1-\uffff]/);
|
111
|
+
// Only one ? ! = is allowed and only as the last character
|
112
|
+
stream.eat(/[\?\!\=]/);
|
113
|
+
return "atom";
|
114
|
+
}
|
115
|
+
return "operator";
|
116
|
+
} else if (ch == "@" && stream.match(/^@?[a-zA-Z_\xa1-\uffff]/)) {
|
117
|
+
stream.eat("@");
|
118
|
+
stream.eatWhile(/[\w\xa1-\uffff]/);
|
119
|
+
return "variable-2";
|
120
|
+
} else if (ch == "$") {
|
121
|
+
if (stream.eat(/[a-zA-Z_]/)) {
|
122
|
+
stream.eatWhile(/[\w]/);
|
123
|
+
} else if (stream.eat(/\d/)) {
|
124
|
+
stream.eat(/\d/);
|
125
|
+
} else {
|
126
|
+
stream.next(); // Must be a special global like $: or $!
|
127
|
+
}
|
128
|
+
return "variable-3";
|
129
|
+
} else if (/[a-zA-Z_\xa1-\uffff]/.test(ch)) {
|
130
|
+
stream.eatWhile(/[\w\xa1-\uffff]/);
|
131
|
+
stream.eat(/[\?\!]/);
|
132
|
+
if (stream.eat(":")) return "atom";
|
133
|
+
return "ident";
|
134
|
+
} else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) {
|
135
|
+
curPunc = "|";
|
136
|
+
return null;
|
137
|
+
} else if (/[\(\)\[\]{}\\;]/.test(ch)) {
|
138
|
+
curPunc = ch;
|
139
|
+
return null;
|
140
|
+
} else if (ch == "-" && stream.eat(">")) {
|
141
|
+
return "arrow";
|
142
|
+
} else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) {
|
143
|
+
var more = stream.eatWhile(/[=+\-\/*:\.^%<>~|]/);
|
144
|
+
if (ch == "." && !more) curPunc = ".";
|
145
|
+
return "operator";
|
146
|
+
} else {
|
147
|
+
return null;
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
function tokenBaseUntilBrace(depth) {
|
152
|
+
if (!depth) depth = 1;
|
153
|
+
return function(stream, state) {
|
154
|
+
if (stream.peek() == "}") {
|
155
|
+
if (depth == 1) {
|
156
|
+
state.tokenize.pop();
|
157
|
+
return state.tokenize[state.tokenize.length-1](stream, state);
|
158
|
+
} else {
|
159
|
+
state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth - 1);
|
160
|
+
}
|
161
|
+
} else if (stream.peek() == "{") {
|
162
|
+
state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth + 1);
|
163
|
+
}
|
164
|
+
return tokenBase(stream, state);
|
165
|
+
};
|
166
|
+
}
|
167
|
+
function tokenBaseOnce() {
|
168
|
+
var alreadyCalled = false;
|
169
|
+
return function(stream, state) {
|
170
|
+
if (alreadyCalled) {
|
171
|
+
state.tokenize.pop();
|
172
|
+
return state.tokenize[state.tokenize.length-1](stream, state);
|
173
|
+
}
|
174
|
+
alreadyCalled = true;
|
175
|
+
return tokenBase(stream, state);
|
176
|
+
};
|
177
|
+
}
|
178
|
+
function readQuoted(quote, style, embed, unescaped) {
|
179
|
+
return function(stream, state) {
|
180
|
+
var escaped = false, ch;
|
181
|
+
|
182
|
+
if (state.context.type === 'read-quoted-paused') {
|
183
|
+
state.context = state.context.prev;
|
184
|
+
stream.eat("}");
|
185
|
+
}
|
186
|
+
|
187
|
+
while ((ch = stream.next()) != null) {
|
188
|
+
if (ch == quote && (unescaped || !escaped)) {
|
189
|
+
state.tokenize.pop();
|
190
|
+
break;
|
191
|
+
}
|
192
|
+
if (embed && ch == "#" && !escaped) {
|
193
|
+
if (stream.eat("{")) {
|
194
|
+
if (quote == "}") {
|
195
|
+
state.context = {prev: state.context, type: 'read-quoted-paused'};
|
196
|
+
}
|
197
|
+
state.tokenize.push(tokenBaseUntilBrace());
|
198
|
+
break;
|
199
|
+
} else if (/[@\$]/.test(stream.peek())) {
|
200
|
+
state.tokenize.push(tokenBaseOnce());
|
201
|
+
break;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
escaped = !escaped && ch == "\\";
|
205
|
+
}
|
206
|
+
return style;
|
207
|
+
};
|
208
|
+
}
|
209
|
+
function readHereDoc(phrase) {
|
210
|
+
return function(stream, state) {
|
211
|
+
if (stream.match(phrase)) state.tokenize.pop();
|
212
|
+
else stream.skipToEnd();
|
213
|
+
return "string";
|
214
|
+
};
|
215
|
+
}
|
216
|
+
function readBlockComment(stream, state) {
|
217
|
+
if (stream.sol() && stream.match("=end") && stream.eol())
|
218
|
+
state.tokenize.pop();
|
219
|
+
stream.skipToEnd();
|
220
|
+
return "comment";
|
221
|
+
}
|
222
|
+
|
223
|
+
return {
|
224
|
+
startState: function() {
|
225
|
+
return {tokenize: [tokenBase],
|
226
|
+
indented: 0,
|
227
|
+
context: {type: "top", indented: -config.indentUnit},
|
228
|
+
continuedLine: false,
|
229
|
+
lastTok: null,
|
230
|
+
varList: false};
|
231
|
+
},
|
232
|
+
|
233
|
+
token: function(stream, state) {
|
234
|
+
curPunc = null;
|
235
|
+
if (stream.sol()) state.indented = stream.indentation();
|
236
|
+
var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype;
|
237
|
+
var thisTok = curPunc;
|
238
|
+
if (style == "ident") {
|
239
|
+
var word = stream.current();
|
240
|
+
style = state.lastTok == "." ? "property"
|
241
|
+
: keywords.propertyIsEnumerable(stream.current()) ? "keyword"
|
242
|
+
: /^[A-Z]/.test(word) ? "tag"
|
243
|
+
: (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def"
|
244
|
+
: "variable";
|
245
|
+
if (style == "keyword") {
|
246
|
+
thisTok = word;
|
247
|
+
if (indentWords.propertyIsEnumerable(word)) kwtype = "indent";
|
248
|
+
else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent";
|
249
|
+
else if ((word == "if" || word == "unless") && stream.column() == stream.indentation())
|
250
|
+
kwtype = "indent";
|
251
|
+
else if (word == "do" && state.context.indented < state.indented)
|
252
|
+
kwtype = "indent";
|
253
|
+
}
|
254
|
+
}
|
255
|
+
if (curPunc || (style && style != "comment")) state.lastTok = thisTok;
|
256
|
+
if (curPunc == "|") state.varList = !state.varList;
|
257
|
+
|
258
|
+
if (kwtype == "indent" || /[\(\[\{]/.test(curPunc))
|
259
|
+
state.context = {prev: state.context, type: curPunc || style, indented: state.indented};
|
260
|
+
else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev)
|
261
|
+
state.context = state.context.prev;
|
262
|
+
|
263
|
+
if (stream.eol())
|
264
|
+
state.continuedLine = (curPunc == "\\" || style == "operator");
|
265
|
+
return style;
|
266
|
+
},
|
267
|
+
|
268
|
+
indent: function(state, textAfter) {
|
269
|
+
if (state.tokenize[state.tokenize.length-1] != tokenBase) return 0;
|
270
|
+
var firstChar = textAfter && textAfter.charAt(0);
|
271
|
+
var ct = state.context;
|
272
|
+
var closing = ct.type == matching[firstChar] ||
|
273
|
+
ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter);
|
274
|
+
return ct.indented + (closing ? 0 : config.indentUnit) +
|
275
|
+
(state.continuedLine ? config.indentUnit : 0);
|
276
|
+
},
|
277
|
+
|
278
|
+
electricInput: /^\s*(?:end|rescue|\})$/,
|
279
|
+
lineComment: "#"
|
280
|
+
};
|
281
|
+
});
|
282
|
+
|
283
|
+
CodeMirror.defineMIME("text/x-ruby", "ruby");
|
284
|
+
|
285
|
+
});
|
@@ -0,0 +1,71 @@
|
|
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"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
CodeMirror.defineSimpleMode("rust",{
|
15
|
+
start: [
|
16
|
+
// string and byte string
|
17
|
+
{regex: /b?"/, token: "string", next: "string"},
|
18
|
+
// raw string and raw byte string
|
19
|
+
{regex: /b?r"/, token: "string", next: "string_raw"},
|
20
|
+
{regex: /b?r#+"/, token: "string", next: "string_raw_hash"},
|
21
|
+
// character
|
22
|
+
{regex: /'(?:[^'\\]|\\(?:[nrt0'"]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\}))'/, token: "string-2"},
|
23
|
+
// byte
|
24
|
+
{regex: /b'(?:[^']|\\(?:['\\nrt0]|x[\da-fA-F]{2}))'/, token: "string-2"},
|
25
|
+
|
26
|
+
{regex: /(?:(?:[0-9][0-9_]*)(?:(?:[Ee][+-]?[0-9_]+)|\.[0-9_]+(?:[Ee][+-]?[0-9_]+)?)(?:f32|f64)?)|(?:0(?:b[01_]+|(?:o[0-7_]+)|(?:x[0-9a-fA-F_]+))|(?:[0-9][0-9_]*))(?:u8|u16|u32|u64|i8|i16|i32|i64|isize|usize)?/,
|
27
|
+
token: "number"},
|
28
|
+
{regex: /(let(?:\s+mut)?|fn|enum|mod|struct|type)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/, token: ["keyword", null, "def"]},
|
29
|
+
{regex: /(?:abstract|alignof|as|box|break|continue|const|crate|do|else|enum|extern|fn|for|final|if|impl|in|loop|macro|match|mod|move|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b/, token: "keyword"},
|
30
|
+
{regex: /\b(?:Self|isize|usize|char|bool|u8|u16|u32|u64|f16|f32|f64|i8|i16|i32|i64|str|Option)\b/, token: "atom"},
|
31
|
+
{regex: /\b(?:true|false|Some|None|Ok|Err)\b/, token: "builtin"},
|
32
|
+
{regex: /\b(fn)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/,
|
33
|
+
token: ["keyword", null ,"def"]},
|
34
|
+
{regex: /#!?\[.*\]/, token: "meta"},
|
35
|
+
{regex: /\/\/.*/, token: "comment"},
|
36
|
+
{regex: /\/\*/, token: "comment", next: "comment"},
|
37
|
+
{regex: /[-+\/*=<>!]+/, token: "operator"},
|
38
|
+
{regex: /[a-zA-Z_]\w*!/,token: "variable-3"},
|
39
|
+
{regex: /[a-zA-Z_]\w*/, token: "variable"},
|
40
|
+
{regex: /[\{\[\(]/, indent: true},
|
41
|
+
{regex: /[\}\]\)]/, dedent: true}
|
42
|
+
],
|
43
|
+
string: [
|
44
|
+
{regex: /"/, token: "string", next: "start"},
|
45
|
+
{regex: /(?:[^\\"]|\\(?:.|$))*/, token: "string"}
|
46
|
+
],
|
47
|
+
string_raw: [
|
48
|
+
{regex: /"/, token: "string", next: "start"},
|
49
|
+
{regex: /[^"]*/, token: "string"}
|
50
|
+
],
|
51
|
+
string_raw_hash: [
|
52
|
+
{regex: /"#+/, token: "string", next: "start"},
|
53
|
+
{regex: /(?:[^"]|"(?!#))*/, token: "string"}
|
54
|
+
],
|
55
|
+
comment: [
|
56
|
+
{regex: /.*?\*\//, token: "comment", next: "start"},
|
57
|
+
{regex: /.*/, token: "comment"}
|
58
|
+
],
|
59
|
+
meta: {
|
60
|
+
dontIndentStates: ["comment"],
|
61
|
+
electricInput: /^\s*\}$/,
|
62
|
+
blockCommentStart: "/*",
|
63
|
+
blockCommentEnd: "*/",
|
64
|
+
lineComment: "//",
|
65
|
+
fold: "brace"
|
66
|
+
}
|
67
|
+
});
|
68
|
+
|
69
|
+
|
70
|
+
CodeMirror.defineMIME("text/x-rustsrc", "rust");
|
71
|
+
});
|
@@ -0,0 +1,315 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
|
5
|
+
// SAS mode copyright (c) 2016 Jared Dean, SAS Institute
|
6
|
+
// Created by Jared Dean
|
7
|
+
|
8
|
+
// TODO
|
9
|
+
// indent and de-indent
|
10
|
+
// identify macro variables
|
11
|
+
|
12
|
+
|
13
|
+
//Definitions
|
14
|
+
// comment -- text withing * ; or /* */
|
15
|
+
// keyword -- SAS language variable
|
16
|
+
// variable -- macro variables starts with '&' or variable formats
|
17
|
+
// variable-2 -- DATA Step, proc, or macro names
|
18
|
+
// string -- text within ' ' or " "
|
19
|
+
// operator -- numeric operator + / - * ** le eq ge ... and so on
|
20
|
+
// builtin -- proc %macro data run mend
|
21
|
+
// atom
|
22
|
+
// def
|
23
|
+
|
24
|
+
(function(mod) {
|
25
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
26
|
+
mod(require("../../lib/codemirror"));
|
27
|
+
else if (typeof define == "function" && define.amd) // AMD
|
28
|
+
define(["../../lib/codemirror"], mod);
|
29
|
+
else // Plain browser env
|
30
|
+
mod(CodeMirror);
|
31
|
+
})(function(CodeMirror) {
|
32
|
+
"use strict";
|
33
|
+
|
34
|
+
CodeMirror.defineMode("sas", function () {
|
35
|
+
var words = {};
|
36
|
+
var isDoubleOperatorSym = {
|
37
|
+
eq: 'operator',
|
38
|
+
lt: 'operator',
|
39
|
+
le: 'operator',
|
40
|
+
gt: 'operator',
|
41
|
+
ge: 'operator',
|
42
|
+
"in": 'operator',
|
43
|
+
ne: 'operator',
|
44
|
+
or: 'operator'
|
45
|
+
};
|
46
|
+
var isDoubleOperatorChar = /(<=|>=|!=|<>)/;
|
47
|
+
var isSingleOperatorChar = /[=\(:\),{}.*<>+\-\/^\[\]]/;
|
48
|
+
|
49
|
+
// Takes a string of words separated by spaces and adds them as
|
50
|
+
// keys with the value of the first argument 'style'
|
51
|
+
function define(style, string, context) {
|
52
|
+
if (context) {
|
53
|
+
var split = string.split(' ');
|
54
|
+
for (var i = 0; i < split.length; i++) {
|
55
|
+
words[split[i]] = {style: style, state: context};
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
//datastep
|
60
|
+
define('def', 'stack pgm view source debug nesting nolist', ['inDataStep']);
|
61
|
+
define('def', 'if while until for do do; end end; then else cancel', ['inDataStep']);
|
62
|
+
define('def', 'label format _n_ _error_', ['inDataStep']);
|
63
|
+
define('def', 'ALTER BUFNO BUFSIZE CNTLLEV COMPRESS DLDMGACTION ENCRYPT ENCRYPTKEY EXTENDOBSCOUNTER GENMAX GENNUM INDEX LABEL OBSBUF OUTREP PW PWREQ READ REPEMPTY REPLACE REUSE ROLE SORTEDBY SPILL TOBSNO TYPE WRITE FILECLOSE FIRSTOBS IN OBS POINTOBS WHERE WHEREUP IDXNAME IDXWHERE DROP KEEP RENAME', ['inDataStep']);
|
64
|
+
define('def', 'filevar finfo finv fipname fipnamel fipstate first firstobs floor', ['inDataStep']);
|
65
|
+
define('def', 'varfmt varinfmt varlabel varlen varname varnum varray varrayx vartype verify vformat vformatd vformatdx vformatn vformatnx vformatw vformatwx vformatx vinarray vinarrayx vinformat vinformatd vinformatdx vinformatn vinformatnx vinformatw vinformatwx vinformatx vlabel vlabelx vlength vlengthx vname vnamex vnferr vtype vtypex weekday', ['inDataStep']);
|
66
|
+
define('def', 'zipfips zipname zipnamel zipstate', ['inDataStep']);
|
67
|
+
define('def', 'put putc putn', ['inDataStep']);
|
68
|
+
define('builtin', 'data run', ['inDataStep']);
|
69
|
+
|
70
|
+
|
71
|
+
//proc
|
72
|
+
define('def', 'data', ['inProc']);
|
73
|
+
|
74
|
+
// flow control for macros
|
75
|
+
define('def', '%if %end %end; %else %else; %do %do; %then', ['inMacro']);
|
76
|
+
|
77
|
+
//everywhere
|
78
|
+
define('builtin', 'proc run; quit; libname filename %macro %mend option options', ['ALL']);
|
79
|
+
|
80
|
+
define('def', 'footnote title libname ods', ['ALL']);
|
81
|
+
define('def', '%let %put %global %sysfunc %eval ', ['ALL']);
|
82
|
+
// automatic macro variables http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a003167023.htm
|
83
|
+
define('variable', '&sysbuffr &syscc &syscharwidth &syscmd &sysdate &sysdate9 &sysday &sysdevic &sysdmg &sysdsn &sysencoding &sysenv &syserr &syserrortext &sysfilrc &syshostname &sysindex &sysinfo &sysjobid &syslast &syslckrc &syslibrc &syslogapplname &sysmacroname &sysmenv &sysmsg &sysncpu &sysodspath &sysparm &syspbuff &sysprocessid &sysprocessname &sysprocname &sysrc &sysscp &sysscpl &sysscpl &syssite &sysstartid &sysstartname &systcpiphostname &systime &sysuserid &sysver &sysvlong &sysvlong4 &syswarningtext', ['ALL']);
|
84
|
+
|
85
|
+
//footnote[1-9]? title[1-9]?
|
86
|
+
|
87
|
+
//options statement
|
88
|
+
define('def', 'source2 nosource2 page pageno pagesize', ['ALL']);
|
89
|
+
|
90
|
+
//proc and datastep
|
91
|
+
define('def', '_all_ _character_ _cmd_ _freq_ _i_ _infile_ _last_ _msg_ _null_ _numeric_ _temporary_ _type_ abort abs addr adjrsq airy alpha alter altlog altprint and arcos array arsin as atan attrc attrib attrn authserver autoexec awscontrol awsdef awsmenu awsmenumerge awstitle backward band base betainv between blocksize blshift bnot bor brshift bufno bufsize bxor by byerr byline byte calculated call cards cards4 catcache cbufno cdf ceil center cexist change chisq cinv class cleanup close cnonct cntllev coalesce codegen col collate collin column comamid comaux1 comaux2 comdef compbl compound compress config continue convert cos cosh cpuid create cross crosstab css curobs cv daccdb daccdbsl daccsl daccsyd dacctab dairy datalines datalines4 datejul datepart datetime day dbcslang dbcstype dclose ddm delete delimiter depdb depdbsl depsl depsyd deptab dequote descending descript design= device dflang dhms dif digamma dim dinfo display distinct dkricond dkrocond dlm dnum do dopen doptname doptnum dread drop dropnote dsname dsnferr echo else emaildlg emailid emailpw emailserver emailsys encrypt end endsas engine eof eov erf erfc error errorcheck errors exist exp fappend fclose fcol fdelete feedback fetch fetchobs fexist fget file fileclose fileexist filefmt filename fileref fmterr fmtsearch fnonct fnote font fontalias fopen foptname foptnum force formatted formchar formdelim formdlim forward fpoint fpos fput fread frewind frlen from fsep fuzz fwrite gaminv gamma getoption getvarc getvarn go goto group gwindow hbar hbound helpenv helploc hms honorappearance hosthelp hostprint hour hpct html hvar ibessel ibr id if index indexc indexw initcmd initstmt inner input inputc inputn inr insert int intck intnx into intrr invaliddata irr is jbessel join juldate keep kentb kurtosis label lag last lbound leave left length levels lgamma lib library libref line linesize link list log log10 log2 logpdf logpmf logsdf lostcard lowcase lrecl ls macro macrogen maps mautosource max maxdec maxr mdy mean measures median memtype merge merror min minute missing missover mlogic mod mode model modify month mopen mort mprint mrecall msglevel msymtabmax mvarsize myy n nest netpv new news nmiss no nobatch nobs nocaps nocardimage nocenter nocharcode nocmdmac nocol nocum nodate nodbcs nodetails nodmr nodms nodmsbatch nodup nodupkey noduplicates noechoauto noequals noerrorabend noexitwindows nofullstimer noicon noimplmac noint nolist noloadlist nomiss nomlogic nomprint nomrecall nomsgcase nomstored nomultenvappl nonotes nonumber noobs noovp nopad nopercent noprint noprintinit normal norow norsasuser nosetinit nosplash nosymbolgen note notes notitle notitles notsorted noverbose noxsync noxwait npv null number numkeys nummousekeys nway obs on open order ordinal otherwise out outer outp= output over ovp p(1 5 10 25 50 75 90 95 99) pad pad2 paired parm parmcards path pathdll pathname pdf peek peekc pfkey pmf point poisson poke position printer probbeta probbnml probchi probf probgam probhypr probit probnegb probnorm probsig probt procleave prt ps pw pwreq qtr quote r ranbin rancau ranexp rangam range ranks rannor ranpoi rantbl rantri ranuni read recfm register regr remote remove rename repeat replace resolve retain return reuse reverse rewind right round rsquare rtf rtrace rtraceloc s s2 samploc sasautos sascontrol sasfrscr sasmsg sasmstore sasscript sasuser saving scan sdf second select selection separated seq serror set setcomm setot sign simple sin sinh siteinfo skewness skip sle sls sortedby sortpgm sortseq sortsize soundex spedis splashlocation split spool sqrt start std stderr stdin stfips stimer stname stnamel stop stopover subgroup subpopn substr sum sumwgt symbol symbolgen symget symput sysget sysin sysleave sysmsg sysparm sysprint sysprintfont sysprod sysrc system t table tables tan tanh tapeclose tbufsize terminal test then timepart tinv tnonct to today tol tooldef totper transformout translate trantab tranwrd trigamma trim trimn trunc truncover type unformatted uniform union until upcase update user usericon uss validate value var weight when where while wincharset window work workinit workterm write wsum xsync xwait yearcutoff yes yyq min max', ['inDataStep', 'inProc']);
|
92
|
+
define('operator', 'and not ', ['inDataStep', 'inProc']);
|
93
|
+
|
94
|
+
// Main function
|
95
|
+
function tokenize(stream, state) {
|
96
|
+
// Finally advance the stream
|
97
|
+
var ch = stream.next();
|
98
|
+
|
99
|
+
// BLOCKCOMMENT
|
100
|
+
if (ch === '/' && stream.eat('*')) {
|
101
|
+
state.continueComment = true;
|
102
|
+
return "comment";
|
103
|
+
} else if (state.continueComment === true) { // in comment block
|
104
|
+
//comment ends at the beginning of the line
|
105
|
+
if (ch === '*' && stream.peek() === '/') {
|
106
|
+
stream.next();
|
107
|
+
state.continueComment = false;
|
108
|
+
} else if (stream.skipTo('*')) { //comment is potentially later in line
|
109
|
+
stream.skipTo('*');
|
110
|
+
stream.next();
|
111
|
+
if (stream.eat('/'))
|
112
|
+
state.continueComment = false;
|
113
|
+
} else {
|
114
|
+
stream.skipToEnd();
|
115
|
+
}
|
116
|
+
return "comment";
|
117
|
+
}
|
118
|
+
|
119
|
+
// DoubleOperator match
|
120
|
+
var doubleOperator = ch + stream.peek();
|
121
|
+
|
122
|
+
// Match all line comments.
|
123
|
+
var myString = stream.string;
|
124
|
+
var myRegexp = /(?:^\s*|[;]\s*)(\*.*?);/ig;
|
125
|
+
var match = myRegexp.exec(myString);
|
126
|
+
if (match !== null) {
|
127
|
+
if (match.index === 0 && (stream.column() !== (match.index + match[0].length - 1))) {
|
128
|
+
stream.backUp(stream.column());
|
129
|
+
stream.skipTo(';');
|
130
|
+
stream.next();
|
131
|
+
return 'comment';
|
132
|
+
} else if (match.index + 1 < stream.column() && stream.column() < match.index + match[0].length - 1) {
|
133
|
+
// the ';' triggers the match so move one past it to start
|
134
|
+
// the comment block that is why match.index+1
|
135
|
+
stream.backUp(stream.column() - match.index - 1);
|
136
|
+
stream.skipTo(';');
|
137
|
+
stream.next();
|
138
|
+
return 'comment';
|
139
|
+
}
|
140
|
+
} else if (!state.continueString && (ch === '"' || ch === "'")) {
|
141
|
+
// Have we found a string?
|
142
|
+
state.continueString = ch; //save the matching quote in the state
|
143
|
+
return "string";
|
144
|
+
} else if (state.continueString !== null) {
|
145
|
+
if (stream.skipTo(state.continueString)) {
|
146
|
+
// quote found on this line
|
147
|
+
stream.next();
|
148
|
+
state.continueString = null;
|
149
|
+
} else {
|
150
|
+
stream.skipToEnd();
|
151
|
+
}
|
152
|
+
return "string";
|
153
|
+
} else if (state.continueString !== null && stream.eol()) {
|
154
|
+
stream.skipTo(state.continueString) || stream.skipToEnd();
|
155
|
+
return "string";
|
156
|
+
} else if (/[\d\.]/.test(ch)) { //find numbers
|
157
|
+
if (ch === ".")
|
158
|
+
stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
|
159
|
+
else if (ch === "0")
|
160
|
+
stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
|
161
|
+
else
|
162
|
+
stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
|
163
|
+
return "number";
|
164
|
+
} else if (isDoubleOperatorChar.test(ch + stream.peek())) { // TWO SYMBOL TOKENS
|
165
|
+
stream.next();
|
166
|
+
return "operator";
|
167
|
+
} else if (isDoubleOperatorSym.hasOwnProperty(doubleOperator)) {
|
168
|
+
stream.next();
|
169
|
+
if (stream.peek() === ' ')
|
170
|
+
return isDoubleOperatorSym[doubleOperator.toLowerCase()];
|
171
|
+
} else if (isSingleOperatorChar.test(ch)) { // SINGLE SYMBOL TOKENS
|
172
|
+
return "operator";
|
173
|
+
}
|
174
|
+
|
175
|
+
// Matches one whole word -- even if the word is a character
|
176
|
+
var word;
|
177
|
+
if (stream.match(/[%&;\w]+/, false) != null) {
|
178
|
+
word = ch + stream.match(/[%&;\w]+/, true);
|
179
|
+
if (/&/.test(word)) return 'variable'
|
180
|
+
} else {
|
181
|
+
word = ch;
|
182
|
+
}
|
183
|
+
// the word after DATA PROC or MACRO
|
184
|
+
if (state.nextword) {
|
185
|
+
stream.match(/[\w]+/);
|
186
|
+
// match memname.libname
|
187
|
+
if (stream.peek() === '.') stream.skipTo(' ');
|
188
|
+
state.nextword = false;
|
189
|
+
return 'variable-2';
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
// Are we in a DATA Step?
|
194
|
+
if (state.inDataStep) {
|
195
|
+
if (word.toLowerCase() === 'run;' || stream.match(/run\s;/)) {
|
196
|
+
state.inDataStep = false;
|
197
|
+
return 'builtin';
|
198
|
+
}
|
199
|
+
// variable formats
|
200
|
+
if ((word) && stream.next() === '.') {
|
201
|
+
//either a format or libname.memname
|
202
|
+
if (/\w/.test(stream.peek())) return 'variable-2';
|
203
|
+
else return 'variable';
|
204
|
+
}
|
205
|
+
// do we have a DATA Step keyword
|
206
|
+
if (word && words.hasOwnProperty(word.toLowerCase()) &&
|
207
|
+
(words[word.toLowerCase()].state.indexOf("inDataStep") !== -1 ||
|
208
|
+
words[word.toLowerCase()].state.indexOf("ALL") !== -1)) {
|
209
|
+
//backup to the start of the word
|
210
|
+
if (stream.start < stream.pos)
|
211
|
+
stream.backUp(stream.pos - stream.start);
|
212
|
+
//advance the length of the word and return
|
213
|
+
for (var i = 0; i < word.length; ++i) stream.next();
|
214
|
+
return words[word.toLowerCase()].style;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
// Are we in an Proc statement?
|
218
|
+
if (state.inProc) {
|
219
|
+
if (word.toLowerCase() === 'run;' || word.toLowerCase() === 'quit;') {
|
220
|
+
state.inProc = false;
|
221
|
+
return 'builtin';
|
222
|
+
}
|
223
|
+
// do we have a proc keyword
|
224
|
+
if (word && words.hasOwnProperty(word.toLowerCase()) &&
|
225
|
+
(words[word.toLowerCase()].state.indexOf("inProc") !== -1 ||
|
226
|
+
words[word.toLowerCase()].state.indexOf("ALL") !== -1)) {
|
227
|
+
stream.match(/[\w]+/);
|
228
|
+
return words[word].style;
|
229
|
+
}
|
230
|
+
}
|
231
|
+
// Are we in a Macro statement?
|
232
|
+
if (state.inMacro) {
|
233
|
+
if (word.toLowerCase() === '%mend') {
|
234
|
+
if (stream.peek() === ';') stream.next();
|
235
|
+
state.inMacro = false;
|
236
|
+
return 'builtin';
|
237
|
+
}
|
238
|
+
if (word && words.hasOwnProperty(word.toLowerCase()) &&
|
239
|
+
(words[word.toLowerCase()].state.indexOf("inMacro") !== -1 ||
|
240
|
+
words[word.toLowerCase()].state.indexOf("ALL") !== -1)) {
|
241
|
+
stream.match(/[\w]+/);
|
242
|
+
return words[word.toLowerCase()].style;
|
243
|
+
}
|
244
|
+
|
245
|
+
return 'atom';
|
246
|
+
}
|
247
|
+
// Do we have Keywords specific words?
|
248
|
+
if (word && words.hasOwnProperty(word.toLowerCase())) {
|
249
|
+
// Negates the initial next()
|
250
|
+
stream.backUp(1);
|
251
|
+
// Actually move the stream
|
252
|
+
stream.match(/[\w]+/);
|
253
|
+
if (word.toLowerCase() === 'data' && /=/.test(stream.peek()) === false) {
|
254
|
+
state.inDataStep = true;
|
255
|
+
state.nextword = true;
|
256
|
+
return 'builtin';
|
257
|
+
}
|
258
|
+
if (word.toLowerCase() === 'proc') {
|
259
|
+
state.inProc = true;
|
260
|
+
state.nextword = true;
|
261
|
+
return 'builtin';
|
262
|
+
}
|
263
|
+
if (word.toLowerCase() === '%macro') {
|
264
|
+
state.inMacro = true;
|
265
|
+
state.nextword = true;
|
266
|
+
return 'builtin';
|
267
|
+
}
|
268
|
+
if (/title[1-9]/i.test(word)) return 'def';
|
269
|
+
|
270
|
+
if (word.toLowerCase() === 'footnote') {
|
271
|
+
stream.eat(/[1-9]/);
|
272
|
+
return 'def';
|
273
|
+
}
|
274
|
+
|
275
|
+
// Returns their value as state in the prior define methods
|
276
|
+
if (state.inDataStep === true && words[word.toLowerCase()].state.indexOf("inDataStep") !== -1)
|
277
|
+
return words[word.toLowerCase()].style;
|
278
|
+
if (state.inProc === true && words[word.toLowerCase()].state.indexOf("inProc") !== -1)
|
279
|
+
return words[word.toLowerCase()].style;
|
280
|
+
if (state.inMacro === true && words[word.toLowerCase()].state.indexOf("inMacro") !== -1)
|
281
|
+
return words[word.toLowerCase()].style;
|
282
|
+
if (words[word.toLowerCase()].state.indexOf("ALL") !== -1)
|
283
|
+
return words[word.toLowerCase()].style;
|
284
|
+
return null;
|
285
|
+
}
|
286
|
+
// Unrecognized syntax
|
287
|
+
return null;
|
288
|
+
}
|
289
|
+
|
290
|
+
return {
|
291
|
+
startState: function () {
|
292
|
+
return {
|
293
|
+
inDataStep: false,
|
294
|
+
inProc: false,
|
295
|
+
inMacro: false,
|
296
|
+
nextword: false,
|
297
|
+
continueString: null,
|
298
|
+
continueComment: false
|
299
|
+
};
|
300
|
+
},
|
301
|
+
token: function (stream, state) {
|
302
|
+
// Strip the spaces, but regex will account for them either way
|
303
|
+
if (stream.eatSpace()) return null;
|
304
|
+
// Go through the main process
|
305
|
+
return tokenize(stream, state);
|
306
|
+
},
|
307
|
+
|
308
|
+
blockCommentStart: "/*",
|
309
|
+
blockCommentEnd: "*/"
|
310
|
+
};
|
311
|
+
|
312
|
+
});
|
313
|
+
|
314
|
+
CodeMirror.defineMIME("text/x-sas", "sas");
|
315
|
+
});
|