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,356 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"),
|
7
|
+
require("../../addon/mode/overlay"));
|
8
|
+
else if (typeof define == "function" && define.amd) // AMD
|
9
|
+
define(["../../lib/codemirror", "../htmlmixed/htmlmixed",
|
10
|
+
"../../addon/mode/overlay"], mod);
|
11
|
+
else // Plain browser env
|
12
|
+
mod(CodeMirror);
|
13
|
+
})(function(CodeMirror) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
CodeMirror.defineMode("django:inner", function() {
|
17
|
+
var keywords = ["block", "endblock", "for", "endfor", "true", "false", "filter", "endfilter",
|
18
|
+
"loop", "none", "self", "super", "if", "elif", "endif", "as", "else", "import",
|
19
|
+
"with", "endwith", "without", "context", "ifequal", "endifequal", "ifnotequal",
|
20
|
+
"endifnotequal", "extends", "include", "load", "comment", "endcomment",
|
21
|
+
"empty", "url", "static", "trans", "blocktrans", "endblocktrans", "now",
|
22
|
+
"regroup", "lorem", "ifchanged", "endifchanged", "firstof", "debug", "cycle",
|
23
|
+
"csrf_token", "autoescape", "endautoescape", "spaceless", "endspaceless",
|
24
|
+
"ssi", "templatetag", "verbatim", "endverbatim", "widthratio"],
|
25
|
+
filters = ["add", "addslashes", "capfirst", "center", "cut", "date",
|
26
|
+
"default", "default_if_none", "dictsort",
|
27
|
+
"dictsortreversed", "divisibleby", "escape", "escapejs",
|
28
|
+
"filesizeformat", "first", "floatformat", "force_escape",
|
29
|
+
"get_digit", "iriencode", "join", "last", "length",
|
30
|
+
"length_is", "linebreaks", "linebreaksbr", "linenumbers",
|
31
|
+
"ljust", "lower", "make_list", "phone2numeric", "pluralize",
|
32
|
+
"pprint", "random", "removetags", "rjust", "safe",
|
33
|
+
"safeseq", "slice", "slugify", "stringformat", "striptags",
|
34
|
+
"time", "timesince", "timeuntil", "title", "truncatechars",
|
35
|
+
"truncatechars_html", "truncatewords", "truncatewords_html",
|
36
|
+
"unordered_list", "upper", "urlencode", "urlize",
|
37
|
+
"urlizetrunc", "wordcount", "wordwrap", "yesno"],
|
38
|
+
operators = ["==", "!=", "<", ">", "<=", ">="],
|
39
|
+
wordOperators = ["in", "not", "or", "and"];
|
40
|
+
|
41
|
+
keywords = new RegExp("^\\b(" + keywords.join("|") + ")\\b");
|
42
|
+
filters = new RegExp("^\\b(" + filters.join("|") + ")\\b");
|
43
|
+
operators = new RegExp("^\\b(" + operators.join("|") + ")\\b");
|
44
|
+
wordOperators = new RegExp("^\\b(" + wordOperators.join("|") + ")\\b");
|
45
|
+
|
46
|
+
// We have to return "null" instead of null, in order to avoid string
|
47
|
+
// styling as the default, when using Django templates inside HTML
|
48
|
+
// element attributes
|
49
|
+
function tokenBase (stream, state) {
|
50
|
+
// Attempt to identify a variable, template or comment tag respectively
|
51
|
+
if (stream.match("{{")) {
|
52
|
+
state.tokenize = inVariable;
|
53
|
+
return "tag";
|
54
|
+
} else if (stream.match("{%")) {
|
55
|
+
state.tokenize = inTag;
|
56
|
+
return "tag";
|
57
|
+
} else if (stream.match("{#")) {
|
58
|
+
state.tokenize = inComment;
|
59
|
+
return "comment";
|
60
|
+
}
|
61
|
+
|
62
|
+
// Ignore completely any stream series that do not match the
|
63
|
+
// Django template opening tags.
|
64
|
+
while (stream.next() != null && !stream.match(/\{[{%#]/, false)) {}
|
65
|
+
return null;
|
66
|
+
}
|
67
|
+
|
68
|
+
// A string can be included in either single or double quotes (this is
|
69
|
+
// the delimiter). Mark everything as a string until the start delimiter
|
70
|
+
// occurs again.
|
71
|
+
function inString (delimiter, previousTokenizer) {
|
72
|
+
return function (stream, state) {
|
73
|
+
if (!state.escapeNext && stream.eat(delimiter)) {
|
74
|
+
state.tokenize = previousTokenizer;
|
75
|
+
} else {
|
76
|
+
if (state.escapeNext) {
|
77
|
+
state.escapeNext = false;
|
78
|
+
}
|
79
|
+
|
80
|
+
var ch = stream.next();
|
81
|
+
|
82
|
+
// Take into account the backslash for escaping characters, such as
|
83
|
+
// the string delimiter.
|
84
|
+
if (ch == "\\") {
|
85
|
+
state.escapeNext = true;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
return "string";
|
90
|
+
};
|
91
|
+
}
|
92
|
+
|
93
|
+
// Apply Django template variable syntax highlighting
|
94
|
+
function inVariable (stream, state) {
|
95
|
+
// Attempt to match a dot that precedes a property
|
96
|
+
if (state.waitDot) {
|
97
|
+
state.waitDot = false;
|
98
|
+
|
99
|
+
if (stream.peek() != ".") {
|
100
|
+
return "null";
|
101
|
+
}
|
102
|
+
|
103
|
+
// Dot followed by a non-word character should be considered an error.
|
104
|
+
if (stream.match(/\.\W+/)) {
|
105
|
+
return "error";
|
106
|
+
} else if (stream.eat(".")) {
|
107
|
+
state.waitProperty = true;
|
108
|
+
return "null";
|
109
|
+
} else {
|
110
|
+
throw Error ("Unexpected error while waiting for property.");
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
// Attempt to match a pipe that precedes a filter
|
115
|
+
if (state.waitPipe) {
|
116
|
+
state.waitPipe = false;
|
117
|
+
|
118
|
+
if (stream.peek() != "|") {
|
119
|
+
return "null";
|
120
|
+
}
|
121
|
+
|
122
|
+
// Pipe followed by a non-word character should be considered an error.
|
123
|
+
if (stream.match(/\.\W+/)) {
|
124
|
+
return "error";
|
125
|
+
} else if (stream.eat("|")) {
|
126
|
+
state.waitFilter = true;
|
127
|
+
return "null";
|
128
|
+
} else {
|
129
|
+
throw Error ("Unexpected error while waiting for filter.");
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
// Highlight properties
|
134
|
+
if (state.waitProperty) {
|
135
|
+
state.waitProperty = false;
|
136
|
+
if (stream.match(/\b(\w+)\b/)) {
|
137
|
+
state.waitDot = true; // A property can be followed by another property
|
138
|
+
state.waitPipe = true; // A property can be followed by a filter
|
139
|
+
return "property";
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
// Highlight filters
|
144
|
+
if (state.waitFilter) {
|
145
|
+
state.waitFilter = false;
|
146
|
+
if (stream.match(filters)) {
|
147
|
+
return "variable-2";
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
// Ignore all white spaces
|
152
|
+
if (stream.eatSpace()) {
|
153
|
+
state.waitProperty = false;
|
154
|
+
return "null";
|
155
|
+
}
|
156
|
+
|
157
|
+
// Identify numbers
|
158
|
+
if (stream.match(/\b\d+(\.\d+)?\b/)) {
|
159
|
+
return "number";
|
160
|
+
}
|
161
|
+
|
162
|
+
// Identify strings
|
163
|
+
if (stream.match("'")) {
|
164
|
+
state.tokenize = inString("'", state.tokenize);
|
165
|
+
return "string";
|
166
|
+
} else if (stream.match('"')) {
|
167
|
+
state.tokenize = inString('"', state.tokenize);
|
168
|
+
return "string";
|
169
|
+
}
|
170
|
+
|
171
|
+
// Attempt to find the variable
|
172
|
+
if (stream.match(/\b(\w+)\b/) && !state.foundVariable) {
|
173
|
+
state.waitDot = true;
|
174
|
+
state.waitPipe = true; // A property can be followed by a filter
|
175
|
+
return "variable";
|
176
|
+
}
|
177
|
+
|
178
|
+
// If found closing tag reset
|
179
|
+
if (stream.match("}}")) {
|
180
|
+
state.waitProperty = null;
|
181
|
+
state.waitFilter = null;
|
182
|
+
state.waitDot = null;
|
183
|
+
state.waitPipe = null;
|
184
|
+
state.tokenize = tokenBase;
|
185
|
+
return "tag";
|
186
|
+
}
|
187
|
+
|
188
|
+
// If nothing was found, advance to the next character
|
189
|
+
stream.next();
|
190
|
+
return "null";
|
191
|
+
}
|
192
|
+
|
193
|
+
function inTag (stream, state) {
|
194
|
+
// Attempt to match a dot that precedes a property
|
195
|
+
if (state.waitDot) {
|
196
|
+
state.waitDot = false;
|
197
|
+
|
198
|
+
if (stream.peek() != ".") {
|
199
|
+
return "null";
|
200
|
+
}
|
201
|
+
|
202
|
+
// Dot followed by a non-word character should be considered an error.
|
203
|
+
if (stream.match(/\.\W+/)) {
|
204
|
+
return "error";
|
205
|
+
} else if (stream.eat(".")) {
|
206
|
+
state.waitProperty = true;
|
207
|
+
return "null";
|
208
|
+
} else {
|
209
|
+
throw Error ("Unexpected error while waiting for property.");
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
// Attempt to match a pipe that precedes a filter
|
214
|
+
if (state.waitPipe) {
|
215
|
+
state.waitPipe = false;
|
216
|
+
|
217
|
+
if (stream.peek() != "|") {
|
218
|
+
return "null";
|
219
|
+
}
|
220
|
+
|
221
|
+
// Pipe followed by a non-word character should be considered an error.
|
222
|
+
if (stream.match(/\.\W+/)) {
|
223
|
+
return "error";
|
224
|
+
} else if (stream.eat("|")) {
|
225
|
+
state.waitFilter = true;
|
226
|
+
return "null";
|
227
|
+
} else {
|
228
|
+
throw Error ("Unexpected error while waiting for filter.");
|
229
|
+
}
|
230
|
+
}
|
231
|
+
|
232
|
+
// Highlight properties
|
233
|
+
if (state.waitProperty) {
|
234
|
+
state.waitProperty = false;
|
235
|
+
if (stream.match(/\b(\w+)\b/)) {
|
236
|
+
state.waitDot = true; // A property can be followed by another property
|
237
|
+
state.waitPipe = true; // A property can be followed by a filter
|
238
|
+
return "property";
|
239
|
+
}
|
240
|
+
}
|
241
|
+
|
242
|
+
// Highlight filters
|
243
|
+
if (state.waitFilter) {
|
244
|
+
state.waitFilter = false;
|
245
|
+
if (stream.match(filters)) {
|
246
|
+
return "variable-2";
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
// Ignore all white spaces
|
251
|
+
if (stream.eatSpace()) {
|
252
|
+
state.waitProperty = false;
|
253
|
+
return "null";
|
254
|
+
}
|
255
|
+
|
256
|
+
// Identify numbers
|
257
|
+
if (stream.match(/\b\d+(\.\d+)?\b/)) {
|
258
|
+
return "number";
|
259
|
+
}
|
260
|
+
|
261
|
+
// Identify strings
|
262
|
+
if (stream.match("'")) {
|
263
|
+
state.tokenize = inString("'", state.tokenize);
|
264
|
+
return "string";
|
265
|
+
} else if (stream.match('"')) {
|
266
|
+
state.tokenize = inString('"', state.tokenize);
|
267
|
+
return "string";
|
268
|
+
}
|
269
|
+
|
270
|
+
// Attempt to match an operator
|
271
|
+
if (stream.match(operators)) {
|
272
|
+
return "operator";
|
273
|
+
}
|
274
|
+
|
275
|
+
// Attempt to match a word operator
|
276
|
+
if (stream.match(wordOperators)) {
|
277
|
+
return "keyword";
|
278
|
+
}
|
279
|
+
|
280
|
+
// Attempt to match a keyword
|
281
|
+
var keywordMatch = stream.match(keywords);
|
282
|
+
if (keywordMatch) {
|
283
|
+
if (keywordMatch[0] == "comment") {
|
284
|
+
state.blockCommentTag = true;
|
285
|
+
}
|
286
|
+
return "keyword";
|
287
|
+
}
|
288
|
+
|
289
|
+
// Attempt to match a variable
|
290
|
+
if (stream.match(/\b(\w+)\b/)) {
|
291
|
+
state.waitDot = true;
|
292
|
+
state.waitPipe = true; // A property can be followed by a filter
|
293
|
+
return "variable";
|
294
|
+
}
|
295
|
+
|
296
|
+
// If found closing tag reset
|
297
|
+
if (stream.match("%}")) {
|
298
|
+
state.waitProperty = null;
|
299
|
+
state.waitFilter = null;
|
300
|
+
state.waitDot = null;
|
301
|
+
state.waitPipe = null;
|
302
|
+
// If the tag that closes is a block comment tag, we want to mark the
|
303
|
+
// following code as comment, until the tag closes.
|
304
|
+
if (state.blockCommentTag) {
|
305
|
+
state.blockCommentTag = false; // Release the "lock"
|
306
|
+
state.tokenize = inBlockComment;
|
307
|
+
} else {
|
308
|
+
state.tokenize = tokenBase;
|
309
|
+
}
|
310
|
+
return "tag";
|
311
|
+
}
|
312
|
+
|
313
|
+
// If nothing was found, advance to the next character
|
314
|
+
stream.next();
|
315
|
+
return "null";
|
316
|
+
}
|
317
|
+
|
318
|
+
// Mark everything as comment inside the tag and the tag itself.
|
319
|
+
function inComment (stream, state) {
|
320
|
+
if (stream.match(/^.*?#\}/)) state.tokenize = tokenBase
|
321
|
+
else stream.skipToEnd()
|
322
|
+
return "comment";
|
323
|
+
}
|
324
|
+
|
325
|
+
// Mark everything as a comment until the `blockcomment` tag closes.
|
326
|
+
function inBlockComment (stream, state) {
|
327
|
+
if (stream.match(/\{%\s*endcomment\s*%\}/, false)) {
|
328
|
+
state.tokenize = inTag;
|
329
|
+
stream.match("{%");
|
330
|
+
return "tag";
|
331
|
+
} else {
|
332
|
+
stream.next();
|
333
|
+
return "comment";
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
return {
|
338
|
+
startState: function () {
|
339
|
+
return {tokenize: tokenBase};
|
340
|
+
},
|
341
|
+
token: function (stream, state) {
|
342
|
+
return state.tokenize(stream, state);
|
343
|
+
},
|
344
|
+
blockCommentStart: "{% comment %}",
|
345
|
+
blockCommentEnd: "{% endcomment %}"
|
346
|
+
};
|
347
|
+
});
|
348
|
+
|
349
|
+
CodeMirror.defineMode("django", function(config) {
|
350
|
+
var htmlBase = CodeMirror.getMode(config, "text/html");
|
351
|
+
var djangoInner = CodeMirror.getMode(config, "django:inner");
|
352
|
+
return CodeMirror.overlayMode(htmlBase, djangoInner);
|
353
|
+
});
|
354
|
+
|
355
|
+
CodeMirror.defineMIME("text/x-django", "django");
|
356
|
+
});
|
@@ -0,0 +1,79 @@
|
|
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
|
+
// Collect all Dockerfile directives
|
15
|
+
var instructions = ["from", "maintainer", "run", "cmd", "expose", "env",
|
16
|
+
"add", "copy", "entrypoint", "volume", "user",
|
17
|
+
"workdir", "onbuild"],
|
18
|
+
instructionRegex = "(" + instructions.join('|') + ")",
|
19
|
+
instructionOnlyLine = new RegExp(instructionRegex + "\\s*$", "i"),
|
20
|
+
instructionWithArguments = new RegExp(instructionRegex + "(\\s+)", "i");
|
21
|
+
|
22
|
+
CodeMirror.defineSimpleMode("dockerfile", {
|
23
|
+
start: [
|
24
|
+
// Block comment: This is a line starting with a comment
|
25
|
+
{
|
26
|
+
regex: /#.*$/,
|
27
|
+
token: "comment"
|
28
|
+
},
|
29
|
+
// Highlight an instruction without any arguments (for convenience)
|
30
|
+
{
|
31
|
+
regex: instructionOnlyLine,
|
32
|
+
token: "variable-2"
|
33
|
+
},
|
34
|
+
// Highlight an instruction followed by arguments
|
35
|
+
{
|
36
|
+
regex: instructionWithArguments,
|
37
|
+
token: ["variable-2", null],
|
38
|
+
next: "arguments"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
regex: /./,
|
42
|
+
token: null
|
43
|
+
}
|
44
|
+
],
|
45
|
+
arguments: [
|
46
|
+
{
|
47
|
+
// Line comment without instruction arguments is an error
|
48
|
+
regex: /#.*$/,
|
49
|
+
token: "error",
|
50
|
+
next: "start"
|
51
|
+
},
|
52
|
+
{
|
53
|
+
regex: /[^#]+\\$/,
|
54
|
+
token: null
|
55
|
+
},
|
56
|
+
{
|
57
|
+
// Match everything except for the inline comment
|
58
|
+
regex: /[^#]+/,
|
59
|
+
token: null,
|
60
|
+
next: "start"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
regex: /$/,
|
64
|
+
token: null,
|
65
|
+
next: "start"
|
66
|
+
},
|
67
|
+
// Fail safe return to start
|
68
|
+
{
|
69
|
+
token: null,
|
70
|
+
next: "start"
|
71
|
+
}
|
72
|
+
],
|
73
|
+
meta: {
|
74
|
+
lineComment: "#"
|
75
|
+
}
|
76
|
+
});
|
77
|
+
|
78
|
+
CodeMirror.defineMIME("text/x-dockerfile", "dockerfile");
|
79
|
+
});
|
@@ -0,0 +1,142 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
/*
|
5
|
+
DTD mode
|
6
|
+
Ported to CodeMirror by Peter Kroon <plakroon@gmail.com>
|
7
|
+
Report bugs/issues here: https://github.com/codemirror/CodeMirror/issues
|
8
|
+
GitHub: @peterkroon
|
9
|
+
*/
|
10
|
+
|
11
|
+
(function(mod) {
|
12
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
13
|
+
mod(require("../../lib/codemirror"));
|
14
|
+
else if (typeof define == "function" && define.amd) // AMD
|
15
|
+
define(["../../lib/codemirror"], mod);
|
16
|
+
else // Plain browser env
|
17
|
+
mod(CodeMirror);
|
18
|
+
})(function(CodeMirror) {
|
19
|
+
"use strict";
|
20
|
+
|
21
|
+
CodeMirror.defineMode("dtd", function(config) {
|
22
|
+
var indentUnit = config.indentUnit, type;
|
23
|
+
function ret(style, tp) {type = tp; return style;}
|
24
|
+
|
25
|
+
function tokenBase(stream, state) {
|
26
|
+
var ch = stream.next();
|
27
|
+
|
28
|
+
if (ch == "<" && stream.eat("!") ) {
|
29
|
+
if (stream.eatWhile(/[\-]/)) {
|
30
|
+
state.tokenize = tokenSGMLComment;
|
31
|
+
return tokenSGMLComment(stream, state);
|
32
|
+
} else if (stream.eatWhile(/[\w]/)) return ret("keyword", "doindent");
|
33
|
+
} else if (ch == "<" && stream.eat("?")) { //xml declaration
|
34
|
+
state.tokenize = inBlock("meta", "?>");
|
35
|
+
return ret("meta", ch);
|
36
|
+
} else if (ch == "#" && stream.eatWhile(/[\w]/)) return ret("atom", "tag");
|
37
|
+
else if (ch == "|") return ret("keyword", "seperator");
|
38
|
+
else if (ch.match(/[\(\)\[\]\-\.,\+\?>]/)) return ret(null, ch);//if(ch === ">") return ret(null, "endtag"); else
|
39
|
+
else if (ch.match(/[\[\]]/)) return ret("rule", ch);
|
40
|
+
else if (ch == "\"" || ch == "'") {
|
41
|
+
state.tokenize = tokenString(ch);
|
42
|
+
return state.tokenize(stream, state);
|
43
|
+
} else if (stream.eatWhile(/[a-zA-Z\?\+\d]/)) {
|
44
|
+
var sc = stream.current();
|
45
|
+
if( sc.substr(sc.length-1,sc.length).match(/\?|\+/) !== null )stream.backUp(1);
|
46
|
+
return ret("tag", "tag");
|
47
|
+
} else if (ch == "%" || ch == "*" ) return ret("number", "number");
|
48
|
+
else {
|
49
|
+
stream.eatWhile(/[\w\\\-_%.{,]/);
|
50
|
+
return ret(null, null);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
function tokenSGMLComment(stream, state) {
|
55
|
+
var dashes = 0, ch;
|
56
|
+
while ((ch = stream.next()) != null) {
|
57
|
+
if (dashes >= 2 && ch == ">") {
|
58
|
+
state.tokenize = tokenBase;
|
59
|
+
break;
|
60
|
+
}
|
61
|
+
dashes = (ch == "-") ? dashes + 1 : 0;
|
62
|
+
}
|
63
|
+
return ret("comment", "comment");
|
64
|
+
}
|
65
|
+
|
66
|
+
function tokenString(quote) {
|
67
|
+
return function(stream, state) {
|
68
|
+
var escaped = false, ch;
|
69
|
+
while ((ch = stream.next()) != null) {
|
70
|
+
if (ch == quote && !escaped) {
|
71
|
+
state.tokenize = tokenBase;
|
72
|
+
break;
|
73
|
+
}
|
74
|
+
escaped = !escaped && ch == "\\";
|
75
|
+
}
|
76
|
+
return ret("string", "tag");
|
77
|
+
};
|
78
|
+
}
|
79
|
+
|
80
|
+
function inBlock(style, terminator) {
|
81
|
+
return function(stream, state) {
|
82
|
+
while (!stream.eol()) {
|
83
|
+
if (stream.match(terminator)) {
|
84
|
+
state.tokenize = tokenBase;
|
85
|
+
break;
|
86
|
+
}
|
87
|
+
stream.next();
|
88
|
+
}
|
89
|
+
return style;
|
90
|
+
};
|
91
|
+
}
|
92
|
+
|
93
|
+
return {
|
94
|
+
startState: function(base) {
|
95
|
+
return {tokenize: tokenBase,
|
96
|
+
baseIndent: base || 0,
|
97
|
+
stack: []};
|
98
|
+
},
|
99
|
+
|
100
|
+
token: function(stream, state) {
|
101
|
+
if (stream.eatSpace()) return null;
|
102
|
+
var style = state.tokenize(stream, state);
|
103
|
+
|
104
|
+
var context = state.stack[state.stack.length-1];
|
105
|
+
if (stream.current() == "[" || type === "doindent" || type == "[") state.stack.push("rule");
|
106
|
+
else if (type === "endtag") state.stack[state.stack.length-1] = "endtag";
|
107
|
+
else if (stream.current() == "]" || type == "]" || (type == ">" && context == "rule")) state.stack.pop();
|
108
|
+
else if (type == "[") state.stack.push("[");
|
109
|
+
return style;
|
110
|
+
},
|
111
|
+
|
112
|
+
indent: function(state, textAfter) {
|
113
|
+
var n = state.stack.length;
|
114
|
+
|
115
|
+
if( textAfter.match(/\]\s+|\]/) )n=n-1;
|
116
|
+
else if(textAfter.substr(textAfter.length-1, textAfter.length) === ">"){
|
117
|
+
if(textAfter.substr(0,1) === "<") {}
|
118
|
+
else if( type == "doindent" && textAfter.length > 1 ) {}
|
119
|
+
else if( type == "doindent")n--;
|
120
|
+
else if( type == ">" && textAfter.length > 1) {}
|
121
|
+
else if( type == "tag" && textAfter !== ">") {}
|
122
|
+
else if( type == "tag" && state.stack[state.stack.length-1] == "rule")n--;
|
123
|
+
else if( type == "tag")n++;
|
124
|
+
else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule" && type === ">")n--;
|
125
|
+
else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule") {}
|
126
|
+
else if( textAfter.substr(0,1) !== "<" && textAfter.substr(0,1) === ">" )n=n-1;
|
127
|
+
else if( textAfter === ">") {}
|
128
|
+
else n=n-1;
|
129
|
+
//over rule them all
|
130
|
+
if(type == null || type == "]")n--;
|
131
|
+
}
|
132
|
+
|
133
|
+
return state.baseIndent + n * indentUnit;
|
134
|
+
},
|
135
|
+
|
136
|
+
electricChars: "]>"
|
137
|
+
};
|
138
|
+
});
|
139
|
+
|
140
|
+
CodeMirror.defineMIME("application/xml-dtd", "dtd");
|
141
|
+
|
142
|
+
});
|