marty 0.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +84 -0
- data/Rakefile +29 -0
- data/app/assets/javascripts/marty/application.js +15 -0
- data/app/assets/stylesheets/marty/application.css +13 -0
- data/app/components/marty/api_auth_view.rb +32 -0
- data/app/components/marty/auth_app.rb +55 -0
- data/app/components/marty/auth_app.rb~ +51 -0
- data/app/components/marty/auth_app/javascripts/auth_app.js +91 -0
- data/app/components/marty/auth_app/javascripts/auth_app.js~ +91 -0
- data/app/components/marty/cm_form_panel.rb~ +5 -0
- data/app/components/marty/cm_grid_panel.rb~ +35 -0
- data/app/components/marty/data_import_view.rb~ +142 -0
- data/app/components/marty/extras/layout.rb +46 -0
- data/app/components/marty/extras/layout.rb~ +46 -0
- data/app/components/marty/extras/misc.rb +18 -0
- data/app/components/marty/form.rb +6 -0
- data/app/components/marty/grid.rb +45 -0
- data/app/components/marty/grid_append_only.rb +12 -0
- data/app/components/marty/import_type_view.rb +53 -0
- data/app/components/marty/live_search_grid_panel.rb +46 -0
- data/app/components/marty/live_search_grid_panel.rb~ +49 -0
- data/app/components/marty/main_auth_app.rb +269 -0
- data/app/components/marty/main_auth_app.rb~ +238 -0
- data/app/components/marty/mcfly_grid_panel.rb +62 -0
- data/app/components/marty/mcfly_grid_panel.rb~ +80 -0
- data/app/components/marty/new_posting_form.rb +46 -0
- data/app/components/marty/new_posting_form.rb~ +46 -0
- data/app/components/marty/new_posting_window.rb +21 -0
- data/app/components/marty/new_posting_window.rb~ +21 -0
- data/app/components/marty/panel.rb +12 -0
- data/app/components/marty/pivot_grid.rb +52 -0
- data/app/components/marty/pivot_grid/endpoints.rb +45 -0
- data/app/components/marty/pivot_grid/javascripts/extensions.js +150 -0
- data/app/components/marty/pivot_grid/javascripts/pivot_grid.js +86 -0
- data/app/components/marty/pivot_grid/services.rb +44 -0
- data/app/components/marty/posting_grid.rb +139 -0
- data/app/components/marty/posting_grid.rb~ +140 -0
- data/app/components/marty/posting_window.rb +27 -0
- data/app/components/marty/promise_view.rb +177 -0
- data/app/components/marty/promise_view.rb~ +157 -0
- data/app/components/marty/promise_view/stylesheets/promise_view.css +26 -0
- data/app/components/marty/promise_view/stylesheets/promise_view.css~ +15 -0
- data/app/components/marty/report_form.rb +225 -0
- data/app/components/marty/report_form.rb~ +217 -0
- data/app/components/marty/report_select.rb +145 -0
- data/app/components/marty/report_select.rb~ +133 -0
- data/app/components/marty/reporting.rb +39 -0
- data/app/components/marty/reporting.rb~ +39 -0
- data/app/components/marty/script_detail.rb~ +430 -0
- data/app/components/marty/script_form.rb +233 -0
- data/app/components/marty/script_form.rb~ +233 -0
- data/app/components/marty/script_form/javascripts/Ext.ux.form.field.CodeMirror.js +698 -0
- data/app/components/marty/script_form/javascripts/Ext.ux.form.field.CodeMirror.js~ +909 -0
- data/app/components/marty/script_form/javascripts/codemirror.js +3130 -0
- data/app/components/marty/script_form/javascripts/mode/clike/clike.js +284 -0
- data/app/components/marty/script_form/javascripts/mode/clike/index.html +102 -0
- data/app/components/marty/script_form/javascripts/mode/clike/scala.html +766 -0
- data/app/components/marty/script_form/javascripts/mode/clojure/clojure.js +206 -0
- data/app/components/marty/script_form/javascripts/mode/clojure/index.html +67 -0
- data/app/components/marty/script_form/javascripts/mode/coffeescript/LICENSE +22 -0
- data/app/components/marty/script_form/javascripts/mode/coffeescript/coffeescript.js +346 -0
- data/app/components/marty/script_form/javascripts/mode/coffeescript/index.html +728 -0
- data/app/components/marty/script_form/javascripts/mode/commonlisp/commonlisp.js +101 -0
- data/app/components/marty/script_form/javascripts/mode/commonlisp/index.html +165 -0
- data/app/components/marty/script_form/javascripts/mode/css/css.js +448 -0
- data/app/components/marty/script_form/javascripts/mode/css/index.html +58 -0
- data/app/components/marty/script_form/javascripts/mode/css/test.js +501 -0
- data/app/components/marty/script_form/javascripts/mode/delorean/delorean.js +189 -0
- data/app/components/marty/script_form/javascripts/mode/diff/diff.js +32 -0
- data/app/components/marty/script_form/javascripts/mode/diff/index.html +105 -0
- data/app/components/marty/script_form/javascripts/mode/ecl/ecl.js +203 -0
- data/app/components/marty/script_form/javascripts/mode/ecl/index.html +42 -0
- data/app/components/marty/script_form/javascripts/mode/erlang/erlang.js +463 -0
- data/app/components/marty/script_form/javascripts/mode/erlang/index.html +63 -0
- data/app/components/marty/script_form/javascripts/mode/gfm/gfm.js +150 -0
- data/app/components/marty/script_form/javascripts/mode/gfm/index.html +48 -0
- data/app/components/marty/script_form/javascripts/mode/go/go.js +170 -0
- data/app/components/marty/script_form/javascripts/mode/go/index.html +73 -0
- data/app/components/marty/script_form/javascripts/mode/groovy/groovy.js +210 -0
- data/app/components/marty/script_form/javascripts/mode/groovy/index.html +72 -0
- data/app/components/marty/script_form/javascripts/mode/haskell/haskell.js +242 -0
- data/app/components/marty/script_form/javascripts/mode/haskell/index.html +61 -0
- data/app/components/marty/script_form/javascripts/mode/haxe/haxe.js +429 -0
- data/app/components/marty/script_form/javascripts/mode/haxe/index.html +91 -0
- data/app/components/marty/script_form/javascripts/mode/htmlembedded/htmlembedded.js +72 -0
- data/app/components/marty/script_form/javascripts/mode/htmlembedded/index.html +50 -0
- data/app/components/marty/script_form/javascripts/mode/htmlmixed/htmlmixed.js +84 -0
- data/app/components/marty/script_form/javascripts/mode/htmlmixed/index.html +52 -0
- data/app/components/marty/script_form/javascripts/mode/javascript/index.html +78 -0
- data/app/components/marty/script_form/javascripts/mode/javascript/javascript.js +361 -0
- data/app/components/marty/script_form/javascripts/mode/jinja2/index.html +38 -0
- data/app/components/marty/script_form/javascripts/mode/jinja2/jinja2.js +42 -0
- data/app/components/marty/script_form/javascripts/mode/less/index.html +740 -0
- data/app/components/marty/script_form/javascripts/mode/less/less.js +266 -0
- data/app/components/marty/script_form/javascripts/mode/lua/index.html +73 -0
- data/app/components/marty/script_form/javascripts/mode/lua/lua.js +140 -0
- data/app/components/marty/script_form/javascripts/mode/markdown/index.html +343 -0
- data/app/components/marty/script_form/javascripts/mode/markdown/markdown.js +382 -0
- data/app/components/marty/script_form/javascripts/mode/markdown/test.js +1084 -0
- data/app/components/marty/script_form/javascripts/mode/mysql/index.html +42 -0
- data/app/components/marty/script_form/javascripts/mode/mysql/mysql.js +186 -0
- data/app/components/marty/script_form/javascripts/mode/ntriples/index.html +33 -0
- data/app/components/marty/script_form/javascripts/mode/ntriples/ntriples.js +172 -0
- data/app/components/marty/script_form/javascripts/mode/ocaml/index.html +130 -0
- data/app/components/marty/script_form/javascripts/mode/ocaml/ocaml.js +114 -0
- data/app/components/marty/script_form/javascripts/mode/pascal/LICENSE +7 -0
- data/app/components/marty/script_form/javascripts/mode/pascal/index.html +49 -0
- data/app/components/marty/script_form/javascripts/mode/pascal/pascal.js +94 -0
- data/app/components/marty/script_form/javascripts/mode/perl/LICENSE +19 -0
- data/app/components/marty/script_form/javascripts/mode/perl/index.html +63 -0
- data/app/components/marty/script_form/javascripts/mode/perl/perl.js +816 -0
- data/app/components/marty/script_form/javascripts/mode/php/index.html +49 -0
- data/app/components/marty/script_form/javascripts/mode/php/php.js +148 -0
- data/app/components/marty/script_form/javascripts/mode/pig/index.html +43 -0
- data/app/components/marty/script_form/javascripts/mode/pig/pig.js +172 -0
- data/app/components/marty/script_form/javascripts/mode/plsql/index.html +63 -0
- data/app/components/marty/script_form/javascripts/mode/plsql/plsql.js +217 -0
- data/app/components/marty/script_form/javascripts/mode/properties/index.html +41 -0
- data/app/components/marty/script_form/javascripts/mode/properties/properties.js +63 -0
- data/app/components/marty/script_form/javascripts/mode/python/LICENSE.txt +21 -0
- data/app/components/marty/script_form/javascripts/mode/python/index.html +123 -0
- data/app/components/marty/script_form/javascripts/mode/python/python.js +338 -0
- data/app/components/marty/script_form/javascripts/mode/r/LICENSE +24 -0
- data/app/components/marty/script_form/javascripts/mode/r/index.html +74 -0
- data/app/components/marty/script_form/javascripts/mode/r/r.js +141 -0
- data/app/components/marty/script_form/javascripts/mode/rpm/changes/changes.js +19 -0
- data/app/components/marty/script_form/javascripts/mode/rpm/changes/index.html +54 -0
- data/app/components/marty/script_form/javascripts/mode/rpm/spec/index.html +100 -0
- data/app/components/marty/script_form/javascripts/mode/rpm/spec/spec.css +5 -0
- data/app/components/marty/script_form/javascripts/mode/rpm/spec/spec.js +66 -0
- data/app/components/marty/script_form/javascripts/mode/rst/index.html +526 -0
- data/app/components/marty/script_form/javascripts/mode/rst/rst.js +326 -0
- data/app/components/marty/script_form/javascripts/mode/ruby/LICENSE +24 -0
- data/app/components/marty/script_form/javascripts/mode/ruby/index.html +172 -0
- data/app/components/marty/script_form/javascripts/mode/ruby/ruby.js +195 -0
- data/app/components/marty/script_form/javascripts/mode/rust/index.html +49 -0
- data/app/components/marty/script_form/javascripts/mode/rust/rust.js +432 -0
- data/app/components/marty/script_form/javascripts/mode/scheme/index.html +65 -0
- data/app/components/marty/script_form/javascripts/mode/scheme/scheme.js +230 -0
- data/app/components/marty/script_form/javascripts/mode/shell/index.html +50 -0
- data/app/components/marty/script_form/javascripts/mode/shell/shell.js +118 -0
- data/app/components/marty/script_form/javascripts/mode/sieve/LICENSE +23 -0
- data/app/components/marty/script_form/javascripts/mode/sieve/index.html +81 -0
- data/app/components/marty/script_form/javascripts/mode/sieve/sieve.js +156 -0
- data/app/components/marty/script_form/javascripts/mode/smalltalk/index.html +56 -0
- data/app/components/marty/script_form/javascripts/mode/smalltalk/smalltalk.js +139 -0
- data/app/components/marty/script_form/javascripts/mode/smarty/index.html +83 -0
- data/app/components/marty/script_form/javascripts/mode/smarty/smarty.js +148 -0
- data/app/components/marty/script_form/javascripts/mode/sparql/index.html +41 -0
- data/app/components/marty/script_form/javascripts/mode/sparql/sparql.js +143 -0
- data/app/components/marty/script_form/javascripts/mode/stex/index.html +98 -0
- data/app/components/marty/script_form/javascripts/mode/stex/stex.js +182 -0
- data/app/components/marty/script_form/javascripts/mode/stex/test.js +343 -0
- data/app/components/marty/script_form/javascripts/mode/tiddlywiki/index.html +141 -0
- data/app/components/marty/script_form/javascripts/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/app/components/marty/script_form/javascripts/mode/tiddlywiki/tiddlywiki.js +384 -0
- data/app/components/marty/script_form/javascripts/mode/tiki/index.html +83 -0
- data/app/components/marty/script_form/javascripts/mode/tiki/tiki.css +26 -0
- data/app/components/marty/script_form/javascripts/mode/tiki/tiki.js +309 -0
- data/app/components/marty/script_form/javascripts/mode/vb/LICENSE.txt +21 -0
- data/app/components/marty/script_form/javascripts/mode/vb/index.html +89 -0
- data/app/components/marty/script_form/javascripts/mode/vb/vb.js +260 -0
- data/app/components/marty/script_form/javascripts/mode/vbscript/index.html +43 -0
- data/app/components/marty/script_form/javascripts/mode/vbscript/vbscript.js +26 -0
- data/app/components/marty/script_form/javascripts/mode/velocity/index.html +104 -0
- data/app/components/marty/script_form/javascripts/mode/velocity/velocity.js +146 -0
- data/app/components/marty/script_form/javascripts/mode/verilog/index.html +211 -0
- data/app/components/marty/script_form/javascripts/mode/verilog/verilog.js +194 -0
- data/app/components/marty/script_form/javascripts/mode/xml/index.html +45 -0
- data/app/components/marty/script_form/javascripts/mode/xml/xml.js +318 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/LICENSE +20 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/index.html +223 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/test/index.html +27 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/test/testBase.js +42 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/test/testEmptySequenceKeyword.js +16 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/test/testMultiAttr.js +16 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/test/testNamespaces.js +91 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/test/testProcessingInstructions.js +16 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/test/testQuotes.js +19 -0
- data/app/components/marty/script_form/javascripts/mode/xquery/xquery.js +451 -0
- data/app/components/marty/script_form/javascripts/mode/yaml/index.html +68 -0
- data/app/components/marty/script_form/javascripts/mode/yaml/yaml.js +95 -0
- data/app/components/marty/script_form/javascripts/util/closetag.js +164 -0
- data/app/components/marty/script_form/javascripts/util/dialog.css +27 -0
- data/app/components/marty/script_form/javascripts/util/dialog.js +70 -0
- data/app/components/marty/script_form/javascripts/util/foldcode.js +196 -0
- data/app/components/marty/script_form/javascripts/util/formatting.js +193 -0
- data/app/components/marty/script_form/javascripts/util/javascript-hint.js +134 -0
- data/app/components/marty/script_form/javascripts/util/loadmode.js +51 -0
- data/app/components/marty/script_form/javascripts/util/match-highlighter.js +44 -0
- data/app/components/marty/script_form/javascripts/util/multiplex.js +77 -0
- data/app/components/marty/script_form/javascripts/util/overlay.js +54 -0
- data/app/components/marty/script_form/javascripts/util/pig-hint.js +123 -0
- data/app/components/marty/script_form/javascripts/util/runmode-standalone.js +90 -0
- data/app/components/marty/script_form/javascripts/util/runmode.js +53 -0
- data/app/components/marty/script_form/javascripts/util/search.js +118 -0
- data/app/components/marty/script_form/javascripts/util/searchcursor.js +119 -0
- data/app/components/marty/script_form/javascripts/util/simple-hint.css +16 -0
- data/app/components/marty/script_form/javascripts/util/simple-hint.js +97 -0
- data/app/components/marty/script_form/javascripts/util/xml-hint.js +137 -0
- data/app/components/marty/script_form/stylesheets/codemirror.css +172 -0
- data/app/components/marty/script_form/stylesheets/delorean.css +10 -0
- data/app/components/marty/script_form/stylesheets/theme/ambiance.css +81 -0
- data/app/components/marty/script_form/stylesheets/theme/blackboard.css +25 -0
- data/app/components/marty/script_form/stylesheets/theme/cobalt.css +18 -0
- data/app/components/marty/script_form/stylesheets/theme/eclipse.css +25 -0
- data/app/components/marty/script_form/stylesheets/theme/elegant.css +10 -0
- data/app/components/marty/script_form/stylesheets/theme/erlang-dark.css +21 -0
- data/app/components/marty/script_form/stylesheets/theme/lesser-dark.css +44 -0
- data/app/components/marty/script_form/stylesheets/theme/monokai.css +28 -0
- data/app/components/marty/script_form/stylesheets/theme/neat.css +9 -0
- data/app/components/marty/script_form/stylesheets/theme/night.css +21 -0
- data/app/components/marty/script_form/stylesheets/theme/rubyblue.css +21 -0
- data/app/components/marty/script_form/stylesheets/theme/vibrant-ink.css +27 -0
- data/app/components/marty/script_form/stylesheets/theme/xq-dark.css +46 -0
- data/app/components/marty/script_grid.rb +104 -0
- data/app/components/marty/script_grid.rb~ +99 -0
- data/app/components/marty/script_tester.rb +114 -0
- data/app/components/marty/script_tester.rb~ +213 -0
- data/app/components/marty/scripting.rb +132 -0
- data/app/components/marty/scripting.rb~ +124 -0
- data/app/components/marty/select_report.rb~ +143 -0
- data/app/components/marty/simple_app.rb +97 -0
- data/app/components/marty/simple_app.rb~ +101 -0
- data/app/components/marty/simple_app/javascripts/simple_app.js +50 -0
- data/app/components/marty/simple_app/javascripts/statusbar_ext.js +8 -0
- data/app/components/marty/tag_grid.rb +83 -0
- data/app/components/marty/tag_grid.rb~ +89 -0
- data/app/components/marty/tree_panel.rb~ +256 -0
- data/app/components/marty/tree_panel/javascripts/tree_panel.js~ +317 -0
- data/app/components/marty/user_pivot.rb +128 -0
- data/app/components/marty/user_view.rb +181 -0
- data/app/components/marty/user_view.rb~ +188 -0
- data/app/controllers/marty/application_controller.rb +124 -0
- data/app/controllers/marty/application_controller.rb~ +133 -0
- data/app/controllers/marty/components_controller.rb +41 -0
- data/app/controllers/marty/components_controller.rb~ +37 -0
- data/app/controllers/marty/job_controller.rb +28 -0
- data/app/controllers/marty/job_controller.rb~ +28 -0
- data/app/controllers/marty/rpc_controller.rb +64 -0
- data/app/controllers/marty/rpc_controller.rb~ +61 -0
- data/app/helpers/marty/application_helper.rb +4 -0
- data/app/helpers/marty/script_set.rb +57 -0
- data/app/helpers/marty/script_set.rb~ +59 -0
- data/app/models/marty/api_auth.rb +44 -0
- data/app/models/marty/api_auth.rb~ +48 -0
- data/app/models/marty/base.rb +4 -0
- data/app/models/marty/data_change.rb +179 -0
- data/app/models/marty/data_change.rb~ +141 -0
- data/app/models/marty/enum.rb +22 -0
- data/app/models/marty/enum.rb~ +16 -0
- data/app/models/marty/import_type.rb +44 -0
- data/app/models/marty/import_type.rb~ +48 -0
- data/app/models/marty/poop.rb~ +169 -0
- data/app/models/marty/posting.rb +101 -0
- data/app/models/marty/posting.rb~ +86 -0
- data/app/models/marty/posting_type.rb +12 -0
- data/app/models/marty/posting_type.rb~ +21 -0
- data/app/models/marty/promise.rb +252 -0
- data/app/models/marty/promise.rb~ +196 -0
- data/app/models/marty/role.rb +6 -0
- data/app/models/marty/role.rb~ +10 -0
- data/app/models/marty/script.rb +144 -0
- data/app/models/marty/script.rb~ +62 -0
- data/app/models/marty/tag.rb +96 -0
- data/app/models/marty/tag.rb~ +91 -0
- data/app/models/marty/token.rb +30 -0
- data/app/models/marty/user.rb +146 -0
- data/app/models/marty/user.rb~ +148 -0
- data/app/models/marty/user_role.rb +7 -0
- data/app/models/marty/user_role.rb~ +13 -0
- data/app/views/layouts/marty/application.html.erb +12 -0
- data/app/views/layouts/marty/application.html.erb~ +11 -0
- data/config/locales/en.yml +134 -0
- data/config/routes.rb +6 -0
- data/config/routes.rb~ +10 -0
- data/db/migrate/001_create_marty_scripts.rb +14 -0
- data/db/migrate/003_create_marty_users.rb +12 -0
- data/db/migrate/004_create_marty_roles.rb +7 -0
- data/db/migrate/005_create_marty_user_roles.rb +14 -0
- data/db/migrate/006_create_marty_tokens.rb +14 -0
- data/db/migrate/008_create_marty_posting_types.rb +7 -0
- data/db/migrate/019_create_marty_postings.rb +18 -0
- data/db/migrate/019_create_marty_postings.rb~ +19 -0
- data/db/migrate/068_create_marty_import_types.rb +12 -0
- data/db/migrate/069_create_marty_import_synonyms.rb +15 -0
- data/db/migrate/070_create_versions.rb +18 -0
- data/db/migrate/071_add_object_changes_column_to_versions.rb +9 -0
- data/db/migrate/072_add_validation_function_to_import_types.rb +6 -0
- data/db/migrate/073_add_preprocess_function_to_import_types.rb +5 -0
- data/db/migrate/090_create_delayed_jobs.rb +22 -0
- data/db/migrate/091_create_marty_promises.rb +36 -0
- data/db/migrate/095_create_marty_tags.rb +14 -0
- data/db/migrate/095_create_marty_tags.rb~ +19 -0
- data/db/migrate/096_add_user_roles_to_import_types.rb +11 -0
- data/db/migrate/097_drop_versions.rb +9 -0
- data/db/migrate/098_create_marty_api_auths.rb +20 -0
- data/db/seeds.rb +48 -0
- data/lib/marty.rb +18 -0
- data/lib/marty.rb~ +13 -0
- data/lib/marty/content_handler.rb +97 -0
- data/lib/marty/content_handler.rb~ +93 -0
- data/lib/marty/data_conversion.rb +298 -0
- data/lib/marty/data_exporter.rb +150 -0
- data/lib/marty/data_exporter.rb~ +137 -0
- data/lib/marty/data_importer.rb +122 -0
- data/lib/marty/data_importer.rb~ +114 -0
- data/lib/marty/data_row_processor.rb~ +206 -0
- data/lib/marty/drop_folder_hook.rb~ +17 -0
- data/lib/marty/engine.rb +10 -0
- data/lib/marty/folder_hook.rb~ +9 -0
- data/lib/marty/lazy_column_loader.rb +57 -0
- data/lib/marty/lazy_column_loader.rb~ +47 -0
- data/lib/marty/mcfly_query.rb +189 -0
- data/lib/marty/mcfly_query.rb~ +188 -0
- data/lib/marty/migrations.rb +108 -0
- data/lib/marty/migrations.rb~ +65 -0
- data/lib/marty/monkey.rb +163 -0
- data/lib/marty/monkey.rb~ +160 -0
- data/lib/marty/permissions.rb +64 -0
- data/lib/marty/permissions.rb~ +69 -0
- data/lib/marty/promise.rb~ +41 -0
- data/lib/marty/promise_job.rb +123 -0
- data/lib/marty/promise_job.rb~ +121 -0
- data/lib/marty/promise_proxy.rb +94 -0
- data/lib/marty/promise_proxy.rb~ +69 -0
- data/lib/marty/railtie.rb +5 -0
- data/lib/marty/relation.rb +39 -0
- data/lib/marty/util.rb +110 -0
- data/lib/marty/util.rb~ +80 -0
- data/lib/marty/version.rb +3 -0
- data/lib/marty/version.rb~ +3 -0
- data/lib/marty/xl.rb +527 -0
- data/lib/marty/xl.rb~ +526 -0
- data/lib/pyxll/README.txt +19 -0
- data/lib/pyxll/README.txt~ +16 -0
- data/lib/pyxll/gemini.py +155 -0
- data/lib/pyxll/gemini.py~ +110 -0
- data/lib/pyxll/pyxll.cfg +12 -0
- data/lib/pyxll/pyxll.cfg~ +12 -0
- data/lib/pyxll/sample.xlsx +0 -0
- data/lib/tasks/marty_tasks.rake +37 -0
- metadata +517 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// ============== Formatting extensions ============================
|
|
2
|
+
(function() {
|
|
3
|
+
// Define extensions for a few modes
|
|
4
|
+
CodeMirror.extendMode("css", {
|
|
5
|
+
commentStart: "/*",
|
|
6
|
+
commentEnd: "*/",
|
|
7
|
+
wordWrapChars: [";", "\\{", "\\}"],
|
|
8
|
+
autoFormatLineBreaks: function (text) {
|
|
9
|
+
return text.replace(new RegExp("(;|\\{|\\})([^\r\n])", "g"), "$1\n$2");
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
function jsNonBreakableBlocks(text) {
|
|
14
|
+
var nonBreakableRegexes = [/for\s*?\((.*?)\)/,
|
|
15
|
+
/\"(.*?)(\"|$)/,
|
|
16
|
+
/\'(.*?)(\'|$)/,
|
|
17
|
+
/\/\*(.*?)(\*\/|$)/,
|
|
18
|
+
/\/\/.*/];
|
|
19
|
+
var nonBreakableBlocks = [];
|
|
20
|
+
for (var i = 0; i < nonBreakableRegexes.length; i++) {
|
|
21
|
+
var curPos = 0;
|
|
22
|
+
while (curPos < text.length) {
|
|
23
|
+
var m = text.substr(curPos).match(nonBreakableRegexes[i]);
|
|
24
|
+
if (m != null) {
|
|
25
|
+
nonBreakableBlocks.push({
|
|
26
|
+
start: curPos + m.index,
|
|
27
|
+
end: curPos + m.index + m[0].length
|
|
28
|
+
});
|
|
29
|
+
curPos += m.index + Math.max(1, m[0].length);
|
|
30
|
+
}
|
|
31
|
+
else { // No more matches
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
nonBreakableBlocks.sort(function (a, b) {
|
|
37
|
+
return a.start - b.start;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return nonBreakableBlocks;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
CodeMirror.extendMode("javascript", {
|
|
44
|
+
commentStart: "/*",
|
|
45
|
+
commentEnd: "*/",
|
|
46
|
+
wordWrapChars: [";", "\\{", "\\}"],
|
|
47
|
+
|
|
48
|
+
autoFormatLineBreaks: function (text) {
|
|
49
|
+
var curPos = 0;
|
|
50
|
+
var reLinesSplitter = /(;|\{|\})([^\r\n;])/g;
|
|
51
|
+
var nonBreakableBlocks = jsNonBreakableBlocks(text);
|
|
52
|
+
if (nonBreakableBlocks != null) {
|
|
53
|
+
var res = "";
|
|
54
|
+
for (var i = 0; i < nonBreakableBlocks.length; i++) {
|
|
55
|
+
if (nonBreakableBlocks[i].start > curPos) { // Break lines till the block
|
|
56
|
+
res += text.substring(curPos, nonBreakableBlocks[i].start).replace(reLinesSplitter, "$1\n$2");
|
|
57
|
+
curPos = nonBreakableBlocks[i].start;
|
|
58
|
+
}
|
|
59
|
+
if (nonBreakableBlocks[i].start <= curPos
|
|
60
|
+
&& nonBreakableBlocks[i].end >= curPos) { // Skip non-breakable block
|
|
61
|
+
res += text.substring(curPos, nonBreakableBlocks[i].end);
|
|
62
|
+
curPos = nonBreakableBlocks[i].end;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (curPos < text.length)
|
|
66
|
+
res += text.substr(curPos).replace(reLinesSplitter, "$1\n$2");
|
|
67
|
+
return res;
|
|
68
|
+
} else {
|
|
69
|
+
return text.replace(reLinesSplitter, "$1\n$2");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
CodeMirror.extendMode("xml", {
|
|
75
|
+
commentStart: "<!--",
|
|
76
|
+
commentEnd: "-->",
|
|
77
|
+
wordWrapChars: [">"],
|
|
78
|
+
|
|
79
|
+
autoFormatLineBreaks: function (text) {
|
|
80
|
+
var lines = text.split("\n");
|
|
81
|
+
var reProcessedPortion = new RegExp("(^\\s*?<|^[^<]*?)(.+)(>\\s*?$|[^>]*?$)");
|
|
82
|
+
var reOpenBrackets = new RegExp("<", "g");
|
|
83
|
+
var reCloseBrackets = new RegExp("(>)([^\r\n])", "g");
|
|
84
|
+
for (var i = 0; i < lines.length; i++) {
|
|
85
|
+
var mToProcess = lines[i].match(reProcessedPortion);
|
|
86
|
+
if (mToProcess != null && mToProcess.length > 3) { // The line starts with whitespaces and ends with whitespaces
|
|
87
|
+
lines[i] = mToProcess[1]
|
|
88
|
+
+ mToProcess[2].replace(reOpenBrackets, "\n$&").replace(reCloseBrackets, "$1\n$2")
|
|
89
|
+
+ mToProcess[3];
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return lines.join("\n");
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
function localModeAt(cm, pos) {
|
|
98
|
+
return CodeMirror.innerMode(cm.getMode(), cm.getTokenAt(pos).state).mode;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function enumerateModesBetween(cm, line, start, end) {
|
|
102
|
+
var outer = cm.getMode(), text = cm.getLine(line);
|
|
103
|
+
if (end == null) end = text.length;
|
|
104
|
+
if (!outer.innerMode) return [{from: start, to: end, mode: outer}];
|
|
105
|
+
var state = cm.getTokenAt({line: line, ch: start}).state;
|
|
106
|
+
var mode = CodeMirror.innerMode(outer, state).mode;
|
|
107
|
+
var found = [], stream = new CodeMirror.StringStream(text);
|
|
108
|
+
stream.pos = stream.start = start;
|
|
109
|
+
for (;;) {
|
|
110
|
+
outer.token(stream, state);
|
|
111
|
+
var curMode = CodeMirror.innerMode(outer, state).mode;
|
|
112
|
+
if (curMode != mode) {
|
|
113
|
+
var cut = stream.start;
|
|
114
|
+
// Crappy heuristic to deal with the fact that a change in
|
|
115
|
+
// mode can occur both at the end and the start of a token,
|
|
116
|
+
// and we don't know which it was.
|
|
117
|
+
if (mode.name == "xml" && text.charAt(stream.pos - 1) == ">") cut = stream.pos;
|
|
118
|
+
found.push({from: start, to: cut, mode: mode});
|
|
119
|
+
start = cut;
|
|
120
|
+
mode = curMode;
|
|
121
|
+
}
|
|
122
|
+
if (stream.pos >= end) break;
|
|
123
|
+
stream.start = stream.pos;
|
|
124
|
+
}
|
|
125
|
+
if (start < end) found.push({from: start, to: end, mode: mode});
|
|
126
|
+
return found;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Comment/uncomment the specified range
|
|
130
|
+
CodeMirror.defineExtension("commentRange", function (isComment, from, to) {
|
|
131
|
+
var curMode = localModeAt(this, from);
|
|
132
|
+
this.operation(function() {
|
|
133
|
+
if (isComment) { // Comment range
|
|
134
|
+
this.replaceRange(curMode.commentEnd, to);
|
|
135
|
+
this.replaceRange(curMode.commentStart, from);
|
|
136
|
+
if (from.line == to.line && from.ch == to.ch) // An empty comment inserted - put cursor inside
|
|
137
|
+
this.setCursor(from.line, from.ch + curMode.commentStart.length);
|
|
138
|
+
} else { // Uncomment range
|
|
139
|
+
var selText = this.getRange(from, to);
|
|
140
|
+
var startIndex = selText.indexOf(curMode.commentStart);
|
|
141
|
+
var endIndex = selText.lastIndexOf(curMode.commentEnd);
|
|
142
|
+
if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) {
|
|
143
|
+
// Take string till comment start
|
|
144
|
+
selText = selText.substr(0, startIndex)
|
|
145
|
+
// From comment start till comment end
|
|
146
|
+
+ selText.substring(startIndex + curMode.commentStart.length, endIndex)
|
|
147
|
+
// From comment end till string end
|
|
148
|
+
+ selText.substr(endIndex + curMode.commentEnd.length);
|
|
149
|
+
}
|
|
150
|
+
this.replaceRange(selText, from, to);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// Applies automatic mode-aware indentation to the specified range
|
|
156
|
+
CodeMirror.defineExtension("autoIndentRange", function (from, to) {
|
|
157
|
+
var cmInstance = this;
|
|
158
|
+
this.operation(function () {
|
|
159
|
+
for (var i = from.line; i <= to.line; i++) {
|
|
160
|
+
cmInstance.indentLine(i, "smart");
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// Applies automatic formatting to the specified range
|
|
166
|
+
CodeMirror.defineExtension("autoFormatRange", function (from, to) {
|
|
167
|
+
var cm = this;
|
|
168
|
+
cm.operation(function () {
|
|
169
|
+
for (var cur = from.line, end = to.line; cur <= end; ++cur) {
|
|
170
|
+
var f = {line: cur, ch: cur == from.line ? from.ch : 0};
|
|
171
|
+
var t = {line: cur, ch: cur == end ? to.ch : null};
|
|
172
|
+
var modes = enumerateModesBetween(cm, cur, f.ch, t.ch), mangled = "";
|
|
173
|
+
var text = cm.getRange(f, t);
|
|
174
|
+
for (var i = 0; i < modes.length; ++i) {
|
|
175
|
+
var part = modes.length > 1 ? text.slice(modes[i].from, modes[i].to) : text;
|
|
176
|
+
if (mangled) mangled += "\n";
|
|
177
|
+
if (modes[i].mode.autoFormatLineBreaks) {
|
|
178
|
+
mangled += modes[i].mode.autoFormatLineBreaks(part);
|
|
179
|
+
} else mangled += text;
|
|
180
|
+
}
|
|
181
|
+
if (mangled != text) {
|
|
182
|
+
for (var count = 0, pos = mangled.indexOf("\n"); pos != -1; pos = mangled.indexOf("\n", pos + 1), ++count) {}
|
|
183
|
+
cm.replaceRange(mangled, f, t);
|
|
184
|
+
cur += count;
|
|
185
|
+
end += count;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
for (var cur = from.line + 1; cur <= end; ++cur)
|
|
189
|
+
cm.indentLine(cur, "smart");
|
|
190
|
+
cm.setSelection(from, cm.getCursor(false));
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
})();
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
function forEach(arr, f) {
|
|
3
|
+
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
function arrayContains(arr, item) {
|
|
7
|
+
if (!Array.prototype.indexOf) {
|
|
8
|
+
var i = arr.length;
|
|
9
|
+
while (i--) {
|
|
10
|
+
if (arr[i] === item) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return arr.indexOf(item) != -1;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function scriptHint(editor, keywords, getToken) {
|
|
20
|
+
// Find the token at the cursor
|
|
21
|
+
var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
|
|
22
|
+
// If it's not a 'word-style' token, ignore the token.
|
|
23
|
+
if (!/^[\w$_]*$/.test(token.string)) {
|
|
24
|
+
token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
|
|
25
|
+
className: token.string == "." ? "property" : null};
|
|
26
|
+
}
|
|
27
|
+
// If it is a property, find out what it is a property of.
|
|
28
|
+
while (tprop.className == "property") {
|
|
29
|
+
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
|
|
30
|
+
if (tprop.string != ".") return;
|
|
31
|
+
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
|
|
32
|
+
if (tprop.string == ')') {
|
|
33
|
+
var level = 1;
|
|
34
|
+
do {
|
|
35
|
+
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
|
|
36
|
+
switch (tprop.string) {
|
|
37
|
+
case ')': level++; break;
|
|
38
|
+
case '(': level--; break;
|
|
39
|
+
default: break;
|
|
40
|
+
}
|
|
41
|
+
} while (level > 0);
|
|
42
|
+
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
|
|
43
|
+
if (tprop.className == 'variable')
|
|
44
|
+
tprop.className = 'function';
|
|
45
|
+
else return; // no clue
|
|
46
|
+
}
|
|
47
|
+
if (!context) var context = [];
|
|
48
|
+
context.push(tprop);
|
|
49
|
+
}
|
|
50
|
+
return {list: getCompletions(token, context, keywords),
|
|
51
|
+
from: {line: cur.line, ch: token.start},
|
|
52
|
+
to: {line: cur.line, ch: token.end}};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
CodeMirror.javascriptHint = function(editor) {
|
|
56
|
+
return scriptHint(editor, javascriptKeywords,
|
|
57
|
+
function (e, cur) {return e.getTokenAt(cur);});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
function getCoffeeScriptToken(editor, cur) {
|
|
61
|
+
// This getToken, it is for coffeescript, imitates the behavior of
|
|
62
|
+
// getTokenAt method in javascript.js, that is, returning "property"
|
|
63
|
+
// type and treat "." as indepenent token.
|
|
64
|
+
var token = editor.getTokenAt(cur);
|
|
65
|
+
if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
|
|
66
|
+
token.end = token.start;
|
|
67
|
+
token.string = '.';
|
|
68
|
+
token.className = "property";
|
|
69
|
+
}
|
|
70
|
+
else if (/^\.[\w$_]*$/.test(token.string)) {
|
|
71
|
+
token.className = "property";
|
|
72
|
+
token.start++;
|
|
73
|
+
token.string = token.string.replace(/\./, '');
|
|
74
|
+
}
|
|
75
|
+
return token;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
CodeMirror.coffeescriptHint = function(editor) {
|
|
79
|
+
return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
|
|
83
|
+
"toUpperCase toLowerCase split concat match replace search").split(" ");
|
|
84
|
+
var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
|
|
85
|
+
"lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
|
|
86
|
+
var funcProps = "prototype apply call bind".split(" ");
|
|
87
|
+
var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " +
|
|
88
|
+
"if in instanceof new null return switch throw true try typeof var void while with").split(" ");
|
|
89
|
+
var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
|
|
90
|
+
"if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");
|
|
91
|
+
|
|
92
|
+
function getCompletions(token, context, keywords) {
|
|
93
|
+
var found = [], start = token.string;
|
|
94
|
+
function maybeAdd(str) {
|
|
95
|
+
if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
|
|
96
|
+
}
|
|
97
|
+
function gatherCompletions(obj) {
|
|
98
|
+
if (typeof obj == "string") forEach(stringProps, maybeAdd);
|
|
99
|
+
else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
|
|
100
|
+
else if (obj instanceof Function) forEach(funcProps, maybeAdd);
|
|
101
|
+
for (var name in obj) maybeAdd(name);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (context) {
|
|
105
|
+
// If this is a property, see if it belongs to some object we can
|
|
106
|
+
// find in the current environment.
|
|
107
|
+
var obj = context.pop(), base;
|
|
108
|
+
if (obj.className == "variable")
|
|
109
|
+
base = window[obj.string];
|
|
110
|
+
else if (obj.className == "string")
|
|
111
|
+
base = "";
|
|
112
|
+
else if (obj.className == "atom")
|
|
113
|
+
base = 1;
|
|
114
|
+
else if (obj.className == "function") {
|
|
115
|
+
if (window.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
|
|
116
|
+
(typeof window.jQuery == 'function'))
|
|
117
|
+
base = window.jQuery();
|
|
118
|
+
else if (window._ != null && (obj.string == '_') && (typeof window._ == 'function'))
|
|
119
|
+
base = window._();
|
|
120
|
+
}
|
|
121
|
+
while (base != null && context.length)
|
|
122
|
+
base = base[context.pop().string];
|
|
123
|
+
if (base != null) gatherCompletions(base);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
// If not, just look in the window object and any local scope
|
|
127
|
+
// (reading into JS mode internals to get at the local variables)
|
|
128
|
+
for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
|
|
129
|
+
gatherCompletions(window);
|
|
130
|
+
forEach(keywords, maybeAdd);
|
|
131
|
+
}
|
|
132
|
+
return found;
|
|
133
|
+
}
|
|
134
|
+
})();
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";
|
|
3
|
+
|
|
4
|
+
var loading = {};
|
|
5
|
+
function splitCallback(cont, n) {
|
|
6
|
+
var countDown = n;
|
|
7
|
+
return function() { if (--countDown == 0) cont(); };
|
|
8
|
+
}
|
|
9
|
+
function ensureDeps(mode, cont) {
|
|
10
|
+
var deps = CodeMirror.modes[mode].dependencies;
|
|
11
|
+
if (!deps) return cont();
|
|
12
|
+
var missing = [];
|
|
13
|
+
for (var i = 0; i < deps.length; ++i) {
|
|
14
|
+
if (!CodeMirror.modes.hasOwnProperty(deps[i]))
|
|
15
|
+
missing.push(deps[i]);
|
|
16
|
+
}
|
|
17
|
+
if (!missing.length) return cont();
|
|
18
|
+
var split = splitCallback(cont, missing.length);
|
|
19
|
+
for (var i = 0; i < missing.length; ++i)
|
|
20
|
+
CodeMirror.requireMode(missing[i], split);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
CodeMirror.requireMode = function(mode, cont) {
|
|
24
|
+
if (typeof mode != "string") mode = mode.name;
|
|
25
|
+
if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont);
|
|
26
|
+
if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
|
|
27
|
+
|
|
28
|
+
var script = document.createElement("script");
|
|
29
|
+
script.src = CodeMirror.modeURL.replace(/%N/g, mode);
|
|
30
|
+
var others = document.getElementsByTagName("script")[0];
|
|
31
|
+
others.parentNode.insertBefore(script, others);
|
|
32
|
+
var list = loading[mode] = [cont];
|
|
33
|
+
var count = 0, poll = setInterval(function() {
|
|
34
|
+
if (++count > 100) return clearInterval(poll);
|
|
35
|
+
if (CodeMirror.modes.hasOwnProperty(mode)) {
|
|
36
|
+
clearInterval(poll);
|
|
37
|
+
loading[mode] = null;
|
|
38
|
+
ensureDeps(mode, function() {
|
|
39
|
+
for (var i = 0; i < list.length; ++i) list[i]();
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}, 200);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
CodeMirror.autoLoadMode = function(instance, mode) {
|
|
46
|
+
if (!CodeMirror.modes.hasOwnProperty(mode))
|
|
47
|
+
CodeMirror.requireMode(mode, function() {
|
|
48
|
+
instance.setOption("mode", instance.getOption("mode"));
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
}());
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Define match-highlighter commands. Depends on searchcursor.js
|
|
2
|
+
// Use by attaching the following function call to the onCursorActivity event:
|
|
3
|
+
//myCodeMirror.matchHighlight(minChars);
|
|
4
|
+
// And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see demo matchhighlighter.html)
|
|
5
|
+
|
|
6
|
+
(function() {
|
|
7
|
+
var DEFAULT_MIN_CHARS = 2;
|
|
8
|
+
|
|
9
|
+
function MatchHighlightState() {
|
|
10
|
+
this.marked = [];
|
|
11
|
+
}
|
|
12
|
+
function getMatchHighlightState(cm) {
|
|
13
|
+
return cm._matchHighlightState || (cm._matchHighlightState = new MatchHighlightState());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function clearMarks(cm) {
|
|
17
|
+
var state = getMatchHighlightState(cm);
|
|
18
|
+
for (var i = 0; i < state.marked.length; ++i)
|
|
19
|
+
state.marked[i].clear();
|
|
20
|
+
state.marked = [];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function markDocument(cm, className, minChars) {
|
|
24
|
+
clearMarks(cm);
|
|
25
|
+
minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS);
|
|
26
|
+
if (cm.somethingSelected() && cm.getSelection().replace(/^\s+|\s+$/g, "").length >= minChars) {
|
|
27
|
+
var state = getMatchHighlightState(cm);
|
|
28
|
+
var query = cm.getSelection();
|
|
29
|
+
cm.operation(function() {
|
|
30
|
+
if (cm.lineCount() < 2000) { // This is too expensive on big documents.
|
|
31
|
+
for (var cursor = cm.getSearchCursor(query); cursor.findNext();) {
|
|
32
|
+
//Only apply matchhighlight to the matches other than the one actually selected
|
|
33
|
+
if (!(cursor.from().line === cm.getCursor(true).line && cursor.from().ch === cm.getCursor(true).ch))
|
|
34
|
+
state.marked.push(cm.markText(cursor.from(), cursor.to(), className));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
CodeMirror.defineExtension("matchHighlight", function(className, minChars) {
|
|
42
|
+
markDocument(this, className, minChars);
|
|
43
|
+
});
|
|
44
|
+
})();
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
CodeMirror.multiplexingMode = function(outer /*, others */) {
|
|
2
|
+
// Others should be {open, close, mode [, delimStyle]} objects
|
|
3
|
+
var others = Array.prototype.slice.call(arguments, 1);
|
|
4
|
+
var n_others = others.length;
|
|
5
|
+
|
|
6
|
+
function indexOf(string, pattern, from) {
|
|
7
|
+
if (typeof pattern == "string") return string.indexOf(pattern, from);
|
|
8
|
+
var m = pattern.exec(from ? string.slice(from) : string);
|
|
9
|
+
return m ? m.index + from : -1;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
startState: function() {
|
|
14
|
+
return {
|
|
15
|
+
outer: CodeMirror.startState(outer),
|
|
16
|
+
innerActive: null,
|
|
17
|
+
inner: null
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
copyState: function(state) {
|
|
22
|
+
return {
|
|
23
|
+
outer: CodeMirror.copyState(outer, state.outer),
|
|
24
|
+
innerActive: state.innerActive,
|
|
25
|
+
inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner)
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
token: function(stream, state) {
|
|
30
|
+
if (!state.innerActive) {
|
|
31
|
+
var cutOff = Infinity, oldContent = stream.string;
|
|
32
|
+
for (var i = 0; i < n_others; ++i) {
|
|
33
|
+
var other = others[i];
|
|
34
|
+
var found = indexOf(oldContent, other.open, stream.pos);
|
|
35
|
+
if (found == stream.pos) {
|
|
36
|
+
stream.match(other.open);
|
|
37
|
+
state.innerActive = other;
|
|
38
|
+
state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0);
|
|
39
|
+
return other.delimStyle;
|
|
40
|
+
} else if (found != -1 && found < cutOff) {
|
|
41
|
+
cutOff = found;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff);
|
|
45
|
+
var outerToken = outer.token(stream, state.outer);
|
|
46
|
+
if (cutOff != Infinity) stream.string = oldContent;
|
|
47
|
+
return outerToken;
|
|
48
|
+
} else {
|
|
49
|
+
var curInner = state.innerActive, oldContent = stream.string;
|
|
50
|
+
var found = indexOf(oldContent, curInner.close, stream.pos);
|
|
51
|
+
if (found == stream.pos) {
|
|
52
|
+
stream.match(curInner.close);
|
|
53
|
+
state.innerActive = state.inner = null;
|
|
54
|
+
return curInner.delimStyle;
|
|
55
|
+
}
|
|
56
|
+
if (found > -1) stream.string = oldContent.slice(0, found);
|
|
57
|
+
var innerToken = curInner.mode.token(stream, state.inner);
|
|
58
|
+
if (found > -1) stream.string = oldContent;
|
|
59
|
+
var cur = stream.current(), found = cur.indexOf(curInner.close);
|
|
60
|
+
if (found > -1) stream.backUp(cur.length - found);
|
|
61
|
+
return innerToken;
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
indent: function(state, textAfter) {
|
|
66
|
+
var mode = state.innerActive ? state.innerActive.mode : outer;
|
|
67
|
+
if (!mode.indent) return CodeMirror.Pass;
|
|
68
|
+
return mode.indent(state.innerActive ? state.inner : state.outer, textAfter);
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
electricChars: outer.electricChars,
|
|
72
|
+
|
|
73
|
+
innerMode: function(state) {
|
|
74
|
+
return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer};
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
};
|