active_admin_pro 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +5 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/active_admin_pro.js +41 -0
- data/app/assets/javascripts/active_admin_pro/actions/new.js +8 -0
- data/app/assets/javascripts/active_admin_pro/actions/show.js +12 -0
- data/app/assets/javascripts/active_admin_pro/components/codemirror_input.js +92 -0
- data/app/assets/javascripts/active_admin_pro/components/flashes.js +9 -0
- data/app/assets/javascripts/active_admin_pro/components/link.js +23 -0
- data/app/assets/javascripts/active_admin_pro/components/phone_input.js +52 -0
- data/app/assets/javascripts/active_admin_pro/components/select_input.js +31 -0
- data/app/assets/javascripts/active_admin_pro/components/sortable_handle.js +8 -0
- data/app/assets/javascripts/active_admin_pro/components/summernote_input.js +132 -0
- data/app/assets/javascripts/active_admin_pro/components/text_input.js +47 -0
- data/app/assets/javascripts/active_admin_pro/components/time_zone_input.js +51 -0
- data/app/assets/javascripts/active_admin_pro/components/title_to_slug.js +16 -0
- data/app/assets/stylesheets/active_admin_pro.scss +20 -0
- data/app/assets/stylesheets/active_admin_pro/breakpoints.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/components/_input_variables.scss +9 -0
- data/app/assets/stylesheets/active_admin_pro/components/actions.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/components/boolean_input.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/components/button.scss +7 -0
- data/app/assets/stylesheets/active_admin_pro/components/check_boxes_input.scss +38 -0
- data/app/assets/stylesheets/active_admin_pro/components/codemirror_input.scss +53 -0
- data/app/assets/stylesheets/active_admin_pro/components/comments.scss +17 -0
- data/app/assets/stylesheets/active_admin_pro/components/datepicker.scss +108 -0
- data/app/assets/stylesheets/active_admin_pro/components/dialog.scss +66 -0
- data/app/assets/stylesheets/active_admin_pro/components/dropdown_menu_button.scss +40 -0
- data/app/assets/stylesheets/active_admin_pro/components/fieldset.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/components/file_input.scss +27 -0
- data/app/assets/stylesheets/active_admin_pro/components/has_many_fields.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/components/inline_errors.scss +7 -0
- data/app/assets/stylesheets/active_admin_pro/components/link.scss +16 -0
- data/app/assets/stylesheets/active_admin_pro/components/panel.scss +62 -0
- data/app/assets/stylesheets/active_admin_pro/components/phone_input.scss +31 -0
- data/app/assets/stylesheets/active_admin_pro/components/radio_input.scss +38 -0
- data/app/assets/stylesheets/active_admin_pro/components/segmented_control.scss +41 -0
- data/app/assets/stylesheets/active_admin_pro/components/select_input.scss +42 -0
- data/app/assets/stylesheets/active_admin_pro/components/sortable_handle.scss +21 -0
- data/app/assets/stylesheets/active_admin_pro/components/string_input.scss +85 -0
- data/app/assets/stylesheets/active_admin_pro/components/summernote_input.scss +190 -0
- data/app/assets/stylesheets/active_admin_pro/components/table.scss +100 -0
- data/app/assets/stylesheets/active_admin_pro/components/text_input.scss +55 -0
- data/app/assets/stylesheets/active_admin_pro/functions/color.scss +130 -0
- data/app/assets/stylesheets/active_admin_pro/functions/text-color.scss +35 -0
- data/app/assets/stylesheets/active_admin_pro/layout/actions/comments.scss +14 -0
- data/app/assets/stylesheets/active_admin_pro/layout/actions/index.scss +88 -0
- data/app/assets/stylesheets/active_admin_pro/layout/actions/show.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/layout/body.scss +60 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/action_items.scss +32 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/actions/comments.scss +10 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/active_admin_content.scss +22 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/breadcrumbs.scss +57 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/navigation.scss +197 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/sidebar.scss +5 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/title_bar.scss +24 -0
- data/app/assets/stylesheets/active_admin_pro/layout/desktop/wrapper.scss +5 -0
- data/app/assets/stylesheets/active_admin_pro/layout/filters.scss +41 -0
- data/app/assets/stylesheets/active_admin_pro/layout/flashes.scss +52 -0
- data/app/assets/stylesheets/active_admin_pro/layout/footer.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/layout/mobile/actions/index.scss +7 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/dashboard.scss +105 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/index.scss +20 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/show.scss +78 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/active_admin_content.scss +9 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/flashes.scss +5 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/navigation.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/layout/tablet/title_bar.scss +53 -0
- data/app/assets/stylesheets/active_admin_pro/mixins/button.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/variables.scss +10 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon.scss +87 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/_bourbon-deprecated-upcoming.scss +411 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-color.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-radius.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-style.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-width.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_buttons.scss +64 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_clearfix.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_ellipsis.scss +30 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_font-stacks.scss +31 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_hide-text.scss +27 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_margin.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_padding.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_position.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_prefixer.scss +66 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_retina-image.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_size.scss +51 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_text-inputs.scss +113 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_timing-functions.scss +34 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_triangle.scss +63 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_word-wrap.scss +29 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_animation.scss +43 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_appearance.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_backface-visibility.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_background-image.scss +42 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_background.scss +55 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_border-image.scss +59 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_calc.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_columns.scss +47 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_filter.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_flex-box.scss +287 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_font-face.scss +24 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_font-feature-settings.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_hidpi-media-query.scss +10 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_hyphens.scss +4 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_image-rendering.scss +14 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_keyframes.scss +36 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_linear-gradient.scss +38 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_perspective.scss +8 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_placeholder.scss +8 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_radial-gradient.scss +39 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_selection.scss +42 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_text-decoration.scss +19 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_transform.scss +15 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_transition.scss +71 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_user-select.scss +3 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_assign-inputs.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_contains-falsy.scss +20 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_contains.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-length.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-light.scss +21 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-number.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-size.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_modular-scale.scss +69 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_px-to-em.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_px-to-rem.scss +15 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_shade.scss +24 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_strip-units.scss +17 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_tint.scss +24 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_transition-property-name.scss +22 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_unpack.scss +27 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_convert-units.scss +21 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_directional-values.scss +96 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_font-source-declaration.scss +43 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_gradient-positions-parser.scss +13 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-angle-parser.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-gradient-parser.scss +41 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-positions-parser.scss +61 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-side-corner-parser.scss +31 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-arg-parser.scss +69 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-gradient-parser.scss +50 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-positions-parser.scss +18 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_render-gradients.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_shape-size-stripper.scss +10 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_str-to-num.scss +50 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_asset-pipeline.scss +7 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_prefixer.scss +9 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_px-to-em.scss +1 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat.scss +22 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/_neat-helpers.scss +8 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/functions/_new-breakpoint.scss +49 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/functions/_private.scss +108 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_box-sizing.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_direction-context.scss +31 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_display-context.scss +26 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_fill-parent.scss +22 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_media.scss +92 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_omega.scss +91 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_outer-container.scss +36 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_pad.scss +23 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_private.scss +35 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_row.scss +53 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss +48 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_span-columns.scss +90 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_to-deprecate.scss +105 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_visual-grid.scss +40 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_disable-warnings.scss +11 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_grid.scss +53 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_visual-grid.scss +25 -0
- data/app/assets/stylesheets/active_admin_pro/vendor/normalize.css +423 -0
- data/app/assets/stylesheets/codemirror/themes/activeadmin_pro.scss +117 -0
- data/app/inputs/codemirror_input.rb +27 -0
- data/app/inputs/datepicker_input.rb +16 -0
- data/app/inputs/phone_input.rb +5 -0
- data/app/inputs/summernote_input.rb +5 -0
- data/app/inputs/time_zone_input.rb +43 -0
- data/app/models/activeadmin_pro/summernote_image.rb +5 -0
- data/config/initializers/active_admin.rb +50 -0
- data/config/locales/en.yml +55 -0
- data/lib/active_admin_pro/admin_user/admin_user.rb +52 -0
- data/lib/active_admin_pro/engine.rb +8 -0
- data/lib/active_admin_pro/summernote_image/summernote_image.rb +61 -0
- data/lib/active_admin_pro/user/user.rb +53 -0
- data/lib/active_admin_pro/version.rb +3 -0
- data/lib/activeadmin_pro.rb +9 -0
- data/lib/generators/activeadmin_pro/install_generator.rb +14 -0
- data/lib/tasks/activeadmin_pro_tasks.rake +4 -0
- data/spec/spec_helper.rb +34 -0
- data/vendor/assets/javascripts/bootstrap.js +1243 -0
- data/vendor/assets/javascripts/codemirror.js +8887 -0
- data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +183 -0
- data/vendor/assets/javascripts/codemirror/addons/comment/continuecomment.js +85 -0
- data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.css +32 -0
- data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.js +157 -0
- data/vendor/assets/javascripts/codemirror/addons/display/autorefresh.js +47 -0
- data/vendor/assets/javascripts/codemirror/addons/display/fullscreen.css +6 -0
- data/vendor/assets/javascripts/codemirror/addons/display/fullscreen.js +41 -0
- data/vendor/assets/javascripts/codemirror/addons/display/panel.js +112 -0
- data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +60 -0
- data/vendor/assets/javascripts/codemirror/addons/display/rulers.js +63 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +195 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/closetag.js +169 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/continuelist.js +51 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/matchbrackets.js +120 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/matchtags.js +66 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/trailingspace.js +27 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +105 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/comment-fold.js +57 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +149 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.css +20 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.js +146 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/indent-fold.js +44 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/markdown-fold.js +49 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +182 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/anyword-hint.js +41 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/css-hint.js +60 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +348 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/javascript-hint.js +146 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.css +38 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +386 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +254 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js +110 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/coffeescript-lint.js +41 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/css-lint.js +35 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/html-lint.js +46 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/javascript-lint.js +136 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/json-lint.js +31 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.css +73 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +231 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/yaml-lint.js +28 -0
- data/vendor/assets/javascripts/codemirror/addons/merge/merge.css +112 -0
- data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +775 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/loadmode.js +64 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/multiplex.js +123 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/multiplex_test.js +33 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/overlay.js +85 -0
- data/vendor/assets/javascripts/codemirror/addons/mode/simple.js +213 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/colorize.js +40 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode-standalone.js +157 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.js +72 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +178 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/annotatescrollbar.js +115 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/scrollpastend.js +46 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.css +66 -0
- data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.js +147 -0
- data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +128 -0
- data/vendor/assets/javascripts/codemirror/addons/search/matchesonscrollbar.css +8 -0
- data/vendor/assets/javascripts/codemirror/addons/search/matchesonscrollbar.js +97 -0
- data/vendor/assets/javascripts/codemirror/addons/search/search.js +228 -0
- data/vendor/assets/javascripts/codemirror/addons/search/searchcursor.js +189 -0
- data/vendor/assets/javascripts/codemirror/addons/selection/active-line.js +71 -0
- data/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js +118 -0
- data/vendor/assets/javascripts/codemirror/addons/selection/selection-pointer.js +98 -0
- data/vendor/assets/javascripts/codemirror/addons/tern/tern.css +87 -0
- data/vendor/assets/javascripts/codemirror/addons/tern/tern.js +700 -0
- data/vendor/assets/javascripts/codemirror/addons/tern/worker.js +44 -0
- data/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js +139 -0
- data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +366 -0
- data/vendor/assets/javascripts/codemirror/modes/css.js +823 -0
- data/vendor/assets/javascripts/codemirror/modes/diff.js +47 -0
- data/vendor/assets/javascripts/codemirror/modes/dockerfile.js +79 -0
- data/vendor/assets/javascripts/codemirror/modes/gfm.js +130 -0
- data/vendor/assets/javascripts/codemirror/modes/go.js +185 -0
- data/vendor/assets/javascripts/codemirror/modes/haml.js +159 -0
- data/vendor/assets/javascripts/codemirror/modes/handlebars.js +53 -0
- data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +28 -0
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +150 -0
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +708 -0
- data/vendor/assets/javascripts/codemirror/modes/markdown.js +792 -0
- data/vendor/assets/javascripts/codemirror/modes/nginx.js +178 -0
- data/vendor/assets/javascripts/codemirror/modes/php.js +234 -0
- data/vendor/assets/javascripts/codemirror/modes/python.js +358 -0
- data/vendor/assets/javascripts/codemirror/modes/ruby.js +285 -0
- data/vendor/assets/javascripts/codemirror/modes/rust.js +58 -0
- data/vendor/assets/javascripts/codemirror/modes/sass.js +414 -0
- data/vendor/assets/javascripts/codemirror/modes/shell.js +139 -0
- data/vendor/assets/javascripts/codemirror/modes/xml.js +385 -0
- data/vendor/assets/javascripts/codemirror/modes/yaml.js +117 -0
- data/vendor/assets/javascripts/intl-tel-input.js +963 -0
- data/vendor/assets/javascripts/intl-tel-utils.js +480 -0
- data/vendor/assets/javascripts/slug.js +212 -0
- data/vendor/assets/javascripts/summernote.js +6939 -0
- data/vendor/assets/stylesheets/codemirror.css +334 -0
- data/vendor/assets/stylesheets/codemirror/themes/base16-dark.css +38 -0
- data/vendor/assets/stylesheets/codemirror/themes/base16-light.css +38 -0
- data/vendor/assets/stylesheets/codemirror/themes/dracula.css +41 -0
- data/vendor/assets/stylesheets/codemirror/themes/material.css +53 -0
- data/vendor/assets/stylesheets/codemirror/themes/monokai.css +35 -0
- data/vendor/assets/stylesheets/codemirror/themes/solarized.css +163 -0
- data/vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css +34 -0
- data/vendor/assets/stylesheets/intl-tel-input.scss +1054 -0
- data/vendor/assets/stylesheets/summernote-bs3.css +5425 -0
- data/vendor/assets/stylesheets/summernote.css +1 -0
- metadata +604 -0
@@ -0,0 +1,178 @@
|
|
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("nginx", function(config) {
|
15
|
+
|
16
|
+
function words(str) {
|
17
|
+
var obj = {}, words = str.split(" ");
|
18
|
+
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
19
|
+
return obj;
|
20
|
+
}
|
21
|
+
|
22
|
+
var keywords = words(
|
23
|
+
/* ngxDirectiveControl */ "break return rewrite set" +
|
24
|
+
/* ngxDirective */ " accept_mutex accept_mutex_delay access_log add_after_body add_before_body add_header addition_types aio alias allow ancient_browser ancient_browser_value auth_basic auth_basic_user_file auth_http auth_http_header auth_http_timeout autoindex autoindex_exact_size autoindex_localtime charset charset_types client_body_buffer_size client_body_in_file_only client_body_in_single_buffer client_body_temp_path client_body_timeout client_header_buffer_size client_header_timeout client_max_body_size connection_pool_size create_full_put_path daemon dav_access dav_methods debug_connection debug_points default_type degradation degrade deny devpoll_changes devpoll_events directio directio_alignment empty_gif env epoll_events error_log eventport_events expires fastcgi_bind fastcgi_buffer_size fastcgi_buffers fastcgi_busy_buffers_size fastcgi_cache fastcgi_cache_key fastcgi_cache_methods fastcgi_cache_min_uses fastcgi_cache_path fastcgi_cache_use_stale fastcgi_cache_valid fastcgi_catch_stderr fastcgi_connect_timeout fastcgi_hide_header fastcgi_ignore_client_abort fastcgi_ignore_headers fastcgi_index fastcgi_intercept_errors fastcgi_max_temp_file_size fastcgi_next_upstream fastcgi_param fastcgi_pass_header fastcgi_pass_request_body fastcgi_pass_request_headers fastcgi_read_timeout fastcgi_send_lowat fastcgi_send_timeout fastcgi_split_path_info fastcgi_store fastcgi_store_access fastcgi_temp_file_write_size fastcgi_temp_path fastcgi_upstream_fail_timeout fastcgi_upstream_max_fails flv geoip_city geoip_country google_perftools_profiles gzip gzip_buffers gzip_comp_level gzip_disable gzip_hash gzip_http_version gzip_min_length gzip_no_buffer gzip_proxied gzip_static gzip_types gzip_vary gzip_window if_modified_since ignore_invalid_headers image_filter image_filter_buffer image_filter_jpeg_quality image_filter_transparency imap_auth imap_capabilities imap_client_buffer index ip_hash keepalive_requests keepalive_timeout kqueue_changes kqueue_events large_client_header_buffers limit_conn limit_conn_log_level limit_rate limit_rate_after limit_req limit_req_log_level limit_req_zone limit_zone lingering_time lingering_timeout lock_file log_format log_not_found log_subrequest map_hash_bucket_size map_hash_max_size master_process memcached_bind memcached_buffer_size memcached_connect_timeout memcached_next_upstream memcached_read_timeout memcached_send_timeout memcached_upstream_fail_timeout memcached_upstream_max_fails merge_slashes min_delete_depth modern_browser modern_browser_value msie_padding msie_refresh multi_accept open_file_cache open_file_cache_errors open_file_cache_events open_file_cache_min_uses open_file_cache_valid open_log_file_cache output_buffers override_charset perl perl_modules perl_require perl_set pid pop3_auth pop3_capabilities port_in_redirect postpone_gzipping postpone_output protocol proxy proxy_bind proxy_buffer proxy_buffer_size proxy_buffering proxy_buffers proxy_busy_buffers_size proxy_cache proxy_cache_key proxy_cache_methods proxy_cache_min_uses proxy_cache_path proxy_cache_use_stale proxy_cache_valid proxy_connect_timeout proxy_headers_hash_bucket_size proxy_headers_hash_max_size proxy_hide_header proxy_ignore_client_abort proxy_ignore_headers proxy_intercept_errors proxy_max_temp_file_size proxy_method proxy_next_upstream proxy_pass_error_message proxy_pass_header proxy_pass_request_body proxy_pass_request_headers proxy_read_timeout proxy_redirect proxy_send_lowat proxy_send_timeout proxy_set_body proxy_set_header proxy_ssl_session_reuse proxy_store proxy_store_access proxy_temp_file_write_size proxy_temp_path proxy_timeout proxy_upstream_fail_timeout proxy_upstream_max_fails random_index read_ahead real_ip_header recursive_error_pages request_pool_size reset_timedout_connection resolver resolver_timeout rewrite_log rtsig_overflow_events rtsig_overflow_test rtsig_overflow_threshold rtsig_signo satisfy secure_link_secret send_lowat send_timeout sendfile sendfile_max_chunk server_name_in_redirect server_names_hash_bucket_size server_names_hash_max_size server_tokens set_real_ip_from smtp_auth smtp_capabilities smtp_client_buffer smtp_greeting_delay so_keepalive source_charset ssi ssi_ignore_recycled_buffers ssi_min_file_chunk ssi_silent_errors ssi_types ssi_value_length ssl ssl_certificate ssl_certificate_key ssl_ciphers ssl_client_certificate ssl_crl ssl_dhparam ssl_engine ssl_prefer_server_ciphers ssl_protocols ssl_session_cache ssl_session_timeout ssl_verify_client ssl_verify_depth starttls stub_status sub_filter sub_filter_once sub_filter_types tcp_nodelay tcp_nopush thread_stack_size timeout timer_resolution types_hash_bucket_size types_hash_max_size underscores_in_headers uninitialized_variable_warn use user userid userid_domain userid_expires userid_mark userid_name userid_p3p userid_path userid_service valid_referers variables_hash_bucket_size variables_hash_max_size worker_connections worker_cpu_affinity worker_priority worker_processes worker_rlimit_core worker_rlimit_nofile worker_rlimit_sigpending worker_threads working_directory xclient xml_entities xslt_stylesheet xslt_typesdrew@li229-23"
|
25
|
+
);
|
26
|
+
|
27
|
+
var keywords_block = words(
|
28
|
+
/* ngxDirectiveBlock */ "http mail events server types location upstream charset_map limit_except if geo map"
|
29
|
+
);
|
30
|
+
|
31
|
+
var keywords_important = words(
|
32
|
+
/* ngxDirectiveImportant */ "include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files"
|
33
|
+
);
|
34
|
+
|
35
|
+
var indentUnit = config.indentUnit, type;
|
36
|
+
function ret(style, tp) {type = tp; return style;}
|
37
|
+
|
38
|
+
function tokenBase(stream, state) {
|
39
|
+
|
40
|
+
|
41
|
+
stream.eatWhile(/[\w\$_]/);
|
42
|
+
|
43
|
+
var cur = stream.current();
|
44
|
+
|
45
|
+
|
46
|
+
if (keywords.propertyIsEnumerable(cur)) {
|
47
|
+
return "keyword";
|
48
|
+
}
|
49
|
+
else if (keywords_block.propertyIsEnumerable(cur)) {
|
50
|
+
return "variable-2";
|
51
|
+
}
|
52
|
+
else if (keywords_important.propertyIsEnumerable(cur)) {
|
53
|
+
return "string-2";
|
54
|
+
}
|
55
|
+
/**/
|
56
|
+
|
57
|
+
var ch = stream.next();
|
58
|
+
if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());}
|
59
|
+
else if (ch == "/" && stream.eat("*")) {
|
60
|
+
state.tokenize = tokenCComment;
|
61
|
+
return tokenCComment(stream, state);
|
62
|
+
}
|
63
|
+
else if (ch == "<" && stream.eat("!")) {
|
64
|
+
state.tokenize = tokenSGMLComment;
|
65
|
+
return tokenSGMLComment(stream, state);
|
66
|
+
}
|
67
|
+
else if (ch == "=") ret(null, "compare");
|
68
|
+
else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");
|
69
|
+
else if (ch == "\"" || ch == "'") {
|
70
|
+
state.tokenize = tokenString(ch);
|
71
|
+
return state.tokenize(stream, state);
|
72
|
+
}
|
73
|
+
else if (ch == "#") {
|
74
|
+
stream.skipToEnd();
|
75
|
+
return ret("comment", "comment");
|
76
|
+
}
|
77
|
+
else if (ch == "!") {
|
78
|
+
stream.match(/^\s*\w*/);
|
79
|
+
return ret("keyword", "important");
|
80
|
+
}
|
81
|
+
else if (/\d/.test(ch)) {
|
82
|
+
stream.eatWhile(/[\w.%]/);
|
83
|
+
return ret("number", "unit");
|
84
|
+
}
|
85
|
+
else if (/[,.+>*\/]/.test(ch)) {
|
86
|
+
return ret(null, "select-op");
|
87
|
+
}
|
88
|
+
else if (/[;{}:\[\]]/.test(ch)) {
|
89
|
+
return ret(null, ch);
|
90
|
+
}
|
91
|
+
else {
|
92
|
+
stream.eatWhile(/[\w\\\-]/);
|
93
|
+
return ret("variable", "variable");
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
function tokenCComment(stream, state) {
|
98
|
+
var maybeEnd = false, ch;
|
99
|
+
while ((ch = stream.next()) != null) {
|
100
|
+
if (maybeEnd && ch == "/") {
|
101
|
+
state.tokenize = tokenBase;
|
102
|
+
break;
|
103
|
+
}
|
104
|
+
maybeEnd = (ch == "*");
|
105
|
+
}
|
106
|
+
return ret("comment", "comment");
|
107
|
+
}
|
108
|
+
|
109
|
+
function tokenSGMLComment(stream, state) {
|
110
|
+
var dashes = 0, ch;
|
111
|
+
while ((ch = stream.next()) != null) {
|
112
|
+
if (dashes >= 2 && ch == ">") {
|
113
|
+
state.tokenize = tokenBase;
|
114
|
+
break;
|
115
|
+
}
|
116
|
+
dashes = (ch == "-") ? dashes + 1 : 0;
|
117
|
+
}
|
118
|
+
return ret("comment", "comment");
|
119
|
+
}
|
120
|
+
|
121
|
+
function tokenString(quote) {
|
122
|
+
return function(stream, state) {
|
123
|
+
var escaped = false, ch;
|
124
|
+
while ((ch = stream.next()) != null) {
|
125
|
+
if (ch == quote && !escaped)
|
126
|
+
break;
|
127
|
+
escaped = !escaped && ch == "\\";
|
128
|
+
}
|
129
|
+
if (!escaped) state.tokenize = tokenBase;
|
130
|
+
return ret("string", "string");
|
131
|
+
};
|
132
|
+
}
|
133
|
+
|
134
|
+
return {
|
135
|
+
startState: function(base) {
|
136
|
+
return {tokenize: tokenBase,
|
137
|
+
baseIndent: base || 0,
|
138
|
+
stack: []};
|
139
|
+
},
|
140
|
+
|
141
|
+
token: function(stream, state) {
|
142
|
+
if (stream.eatSpace()) return null;
|
143
|
+
type = null;
|
144
|
+
var style = state.tokenize(stream, state);
|
145
|
+
|
146
|
+
var context = state.stack[state.stack.length-1];
|
147
|
+
if (type == "hash" && context == "rule") style = "atom";
|
148
|
+
else if (style == "variable") {
|
149
|
+
if (context == "rule") style = "number";
|
150
|
+
else if (!context || context == "@media{") style = "tag";
|
151
|
+
}
|
152
|
+
|
153
|
+
if (context == "rule" && /^[\{\};]$/.test(type))
|
154
|
+
state.stack.pop();
|
155
|
+
if (type == "{") {
|
156
|
+
if (context == "@media") state.stack[state.stack.length-1] = "@media{";
|
157
|
+
else state.stack.push("{");
|
158
|
+
}
|
159
|
+
else if (type == "}") state.stack.pop();
|
160
|
+
else if (type == "@media") state.stack.push("@media");
|
161
|
+
else if (context == "{" && type != "comment") state.stack.push("rule");
|
162
|
+
return style;
|
163
|
+
},
|
164
|
+
|
165
|
+
indent: function(state, textAfter) {
|
166
|
+
var n = state.stack.length;
|
167
|
+
if (/^\}/.test(textAfter))
|
168
|
+
n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1;
|
169
|
+
return state.baseIndent + n * indentUnit;
|
170
|
+
},
|
171
|
+
|
172
|
+
electricChars: "}"
|
173
|
+
};
|
174
|
+
});
|
175
|
+
|
176
|
+
CodeMirror.defineMIME("text/nginx", "text/x-nginx-conf");
|
177
|
+
|
178
|
+
});
|
@@ -0,0 +1,234 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../clike/clike"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../clike/clike"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
function keywords(str) {
|
15
|
+
var obj = {}, words = str.split(" ");
|
16
|
+
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
17
|
+
return obj;
|
18
|
+
}
|
19
|
+
|
20
|
+
// Helper for phpString
|
21
|
+
function matchSequence(list, end, escapes) {
|
22
|
+
if (list.length == 0) return phpString(end);
|
23
|
+
return function (stream, state) {
|
24
|
+
var patterns = list[0];
|
25
|
+
for (var i = 0; i < patterns.length; i++) if (stream.match(patterns[i][0])) {
|
26
|
+
state.tokenize = matchSequence(list.slice(1), end);
|
27
|
+
return patterns[i][1];
|
28
|
+
}
|
29
|
+
state.tokenize = phpString(end, escapes);
|
30
|
+
return "string";
|
31
|
+
};
|
32
|
+
}
|
33
|
+
function phpString(closing, escapes) {
|
34
|
+
return function(stream, state) { return phpString_(stream, state, closing, escapes); };
|
35
|
+
}
|
36
|
+
function phpString_(stream, state, closing, escapes) {
|
37
|
+
// "Complex" syntax
|
38
|
+
if (escapes !== false && stream.match("${", false) || stream.match("{$", false)) {
|
39
|
+
state.tokenize = null;
|
40
|
+
return "string";
|
41
|
+
}
|
42
|
+
|
43
|
+
// Simple syntax
|
44
|
+
if (escapes !== false && stream.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)) {
|
45
|
+
// After the variable name there may appear array or object operator.
|
46
|
+
if (stream.match("[", false)) {
|
47
|
+
// Match array operator
|
48
|
+
state.tokenize = matchSequence([
|
49
|
+
[["[", null]],
|
50
|
+
[[/\d[\w\.]*/, "number"],
|
51
|
+
[/\$[a-zA-Z_][a-zA-Z0-9_]*/, "variable-2"],
|
52
|
+
[/[\w\$]+/, "variable"]],
|
53
|
+
[["]", null]]
|
54
|
+
], closing, escapes);
|
55
|
+
}
|
56
|
+
if (stream.match(/\-\>\w/, false)) {
|
57
|
+
// Match object operator
|
58
|
+
state.tokenize = matchSequence([
|
59
|
+
[["->", null]],
|
60
|
+
[[/[\w]+/, "variable"]]
|
61
|
+
], closing, escapes);
|
62
|
+
}
|
63
|
+
return "variable-2";
|
64
|
+
}
|
65
|
+
|
66
|
+
var escaped = false;
|
67
|
+
// Normal string
|
68
|
+
while (!stream.eol() &&
|
69
|
+
(escaped || escapes === false ||
|
70
|
+
(!stream.match("{$", false) &&
|
71
|
+
!stream.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false)))) {
|
72
|
+
if (!escaped && stream.match(closing)) {
|
73
|
+
state.tokenize = null;
|
74
|
+
state.tokStack.pop(); state.tokStack.pop();
|
75
|
+
break;
|
76
|
+
}
|
77
|
+
escaped = stream.next() == "\\" && !escaped;
|
78
|
+
}
|
79
|
+
return "string";
|
80
|
+
}
|
81
|
+
|
82
|
+
var phpKeywords = "abstract and array as break case catch class clone const continue declare default " +
|
83
|
+
"do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " +
|
84
|
+
"for foreach function global goto if implements interface instanceof namespace " +
|
85
|
+
"new or private protected public static switch throw trait try use var while xor " +
|
86
|
+
"die echo empty exit eval include include_once isset list require require_once return " +
|
87
|
+
"print unset __halt_compiler self static parent yield insteadof finally";
|
88
|
+
var phpAtoms = "true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__";
|
89
|
+
var phpBuiltin = "func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";
|
90
|
+
CodeMirror.registerHelper("hintWords", "php", [phpKeywords, phpAtoms, phpBuiltin].join(" ").split(" "));
|
91
|
+
CodeMirror.registerHelper("wordChars", "php", /[\w$]/);
|
92
|
+
|
93
|
+
var phpConfig = {
|
94
|
+
name: "clike",
|
95
|
+
helperType: "php",
|
96
|
+
keywords: keywords(phpKeywords),
|
97
|
+
blockKeywords: keywords("catch do else elseif for foreach if switch try while finally"),
|
98
|
+
defKeywords: keywords("class function interface namespace trait"),
|
99
|
+
atoms: keywords(phpAtoms),
|
100
|
+
builtin: keywords(phpBuiltin),
|
101
|
+
multiLineStrings: true,
|
102
|
+
hooks: {
|
103
|
+
"$": function(stream) {
|
104
|
+
stream.eatWhile(/[\w\$_]/);
|
105
|
+
return "variable-2";
|
106
|
+
},
|
107
|
+
"<": function(stream, state) {
|
108
|
+
var before;
|
109
|
+
if (before = stream.match(/<<\s*/)) {
|
110
|
+
var quoted = stream.eat(/['"]/);
|
111
|
+
stream.eatWhile(/[\w\.]/);
|
112
|
+
var delim = stream.current().slice(before[0].length + (quoted ? 2 : 1));
|
113
|
+
if (quoted) stream.eat(quoted);
|
114
|
+
if (delim) {
|
115
|
+
(state.tokStack || (state.tokStack = [])).push(delim, 0);
|
116
|
+
state.tokenize = phpString(delim, quoted != "'");
|
117
|
+
return "string";
|
118
|
+
}
|
119
|
+
}
|
120
|
+
return false;
|
121
|
+
},
|
122
|
+
"#": function(stream) {
|
123
|
+
while (!stream.eol() && !stream.match("?>", false)) stream.next();
|
124
|
+
return "comment";
|
125
|
+
},
|
126
|
+
"/": function(stream) {
|
127
|
+
if (stream.eat("/")) {
|
128
|
+
while (!stream.eol() && !stream.match("?>", false)) stream.next();
|
129
|
+
return "comment";
|
130
|
+
}
|
131
|
+
return false;
|
132
|
+
},
|
133
|
+
'"': function(_stream, state) {
|
134
|
+
(state.tokStack || (state.tokStack = [])).push('"', 0);
|
135
|
+
state.tokenize = phpString('"');
|
136
|
+
return "string";
|
137
|
+
},
|
138
|
+
"{": function(_stream, state) {
|
139
|
+
if (state.tokStack && state.tokStack.length)
|
140
|
+
state.tokStack[state.tokStack.length - 1]++;
|
141
|
+
return false;
|
142
|
+
},
|
143
|
+
"}": function(_stream, state) {
|
144
|
+
if (state.tokStack && state.tokStack.length > 0 &&
|
145
|
+
!--state.tokStack[state.tokStack.length - 1]) {
|
146
|
+
state.tokenize = phpString(state.tokStack[state.tokStack.length - 2]);
|
147
|
+
}
|
148
|
+
return false;
|
149
|
+
}
|
150
|
+
}
|
151
|
+
};
|
152
|
+
|
153
|
+
CodeMirror.defineMode("php", function(config, parserConfig) {
|
154
|
+
var htmlMode = CodeMirror.getMode(config, "text/html");
|
155
|
+
var phpMode = CodeMirror.getMode(config, phpConfig);
|
156
|
+
|
157
|
+
function dispatch(stream, state) {
|
158
|
+
var isPHP = state.curMode == phpMode;
|
159
|
+
if (stream.sol() && state.pending && state.pending != '"' && state.pending != "'") state.pending = null;
|
160
|
+
if (!isPHP) {
|
161
|
+
if (stream.match(/^<\?\w*/)) {
|
162
|
+
state.curMode = phpMode;
|
163
|
+
if (!state.php) state.php = CodeMirror.startState(phpMode, htmlMode.indent(state.html, ""))
|
164
|
+
state.curState = state.php;
|
165
|
+
return "meta";
|
166
|
+
}
|
167
|
+
if (state.pending == '"' || state.pending == "'") {
|
168
|
+
while (!stream.eol() && stream.next() != state.pending) {}
|
169
|
+
var style = "string";
|
170
|
+
} else if (state.pending && stream.pos < state.pending.end) {
|
171
|
+
stream.pos = state.pending.end;
|
172
|
+
var style = state.pending.style;
|
173
|
+
} else {
|
174
|
+
var style = htmlMode.token(stream, state.curState);
|
175
|
+
}
|
176
|
+
if (state.pending) state.pending = null;
|
177
|
+
var cur = stream.current(), openPHP = cur.search(/<\?/), m;
|
178
|
+
if (openPHP != -1) {
|
179
|
+
if (style == "string" && (m = cur.match(/[\'\"]$/)) && !/\?>/.test(cur)) state.pending = m[0];
|
180
|
+
else state.pending = {end: stream.pos, style: style};
|
181
|
+
stream.backUp(cur.length - openPHP);
|
182
|
+
}
|
183
|
+
return style;
|
184
|
+
} else if (isPHP && state.php.tokenize == null && stream.match("?>")) {
|
185
|
+
state.curMode = htmlMode;
|
186
|
+
state.curState = state.html;
|
187
|
+
if (!state.php.context.prev) state.php = null;
|
188
|
+
return "meta";
|
189
|
+
} else {
|
190
|
+
return phpMode.token(stream, state.curState);
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
return {
|
195
|
+
startState: function() {
|
196
|
+
var html = CodeMirror.startState(htmlMode)
|
197
|
+
var php = parserConfig.startOpen ? CodeMirror.startState(phpMode) : null
|
198
|
+
return {html: html,
|
199
|
+
php: php,
|
200
|
+
curMode: parserConfig.startOpen ? phpMode : htmlMode,
|
201
|
+
curState: parserConfig.startOpen ? php : html,
|
202
|
+
pending: null};
|
203
|
+
},
|
204
|
+
|
205
|
+
copyState: function(state) {
|
206
|
+
var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html),
|
207
|
+
php = state.php, phpNew = php && CodeMirror.copyState(phpMode, php), cur;
|
208
|
+
if (state.curMode == htmlMode) cur = htmlNew;
|
209
|
+
else cur = phpNew;
|
210
|
+
return {html: htmlNew, php: phpNew, curMode: state.curMode, curState: cur,
|
211
|
+
pending: state.pending};
|
212
|
+
},
|
213
|
+
|
214
|
+
token: dispatch,
|
215
|
+
|
216
|
+
indent: function(state, textAfter) {
|
217
|
+
if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) ||
|
218
|
+
(state.curMode == phpMode && /^\?>/.test(textAfter)))
|
219
|
+
return htmlMode.indent(state.html, textAfter);
|
220
|
+
return state.curMode.indent(state.curState, textAfter);
|
221
|
+
},
|
222
|
+
|
223
|
+
blockCommentStart: "/*",
|
224
|
+
blockCommentEnd: "*/",
|
225
|
+
lineComment: "//",
|
226
|
+
|
227
|
+
innerMode: function(state) { return {state: state.curState, mode: state.curMode}; }
|
228
|
+
};
|
229
|
+
}, "htmlmixed", "clike");
|
230
|
+
|
231
|
+
CodeMirror.defineMIME("application/x-httpd-php", "php");
|
232
|
+
CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true});
|
233
|
+
CodeMirror.defineMIME("text/x-php", phpConfig);
|
234
|
+
});
|
@@ -0,0 +1,358 @@
|
|
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
|
+
function wordRegexp(words) {
|
15
|
+
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
16
|
+
}
|
17
|
+
|
18
|
+
var wordOperators = wordRegexp(["and", "or", "not", "is"]);
|
19
|
+
var commonKeywords = ["as", "assert", "break", "class", "continue",
|
20
|
+
"def", "del", "elif", "else", "except", "finally",
|
21
|
+
"for", "from", "global", "if", "import",
|
22
|
+
"lambda", "pass", "raise", "return",
|
23
|
+
"try", "while", "with", "yield", "in"];
|
24
|
+
var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr",
|
25
|
+
"classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod",
|
26
|
+
"enumerate", "eval", "filter", "float", "format", "frozenset",
|
27
|
+
"getattr", "globals", "hasattr", "hash", "help", "hex", "id",
|
28
|
+
"input", "int", "isinstance", "issubclass", "iter", "len",
|
29
|
+
"list", "locals", "map", "max", "memoryview", "min", "next",
|
30
|
+
"object", "oct", "open", "ord", "pow", "property", "range",
|
31
|
+
"repr", "reversed", "round", "set", "setattr", "slice",
|
32
|
+
"sorted", "staticmethod", "str", "sum", "super", "tuple",
|
33
|
+
"type", "vars", "zip", "__import__", "NotImplemented",
|
34
|
+
"Ellipsis", "__debug__"];
|
35
|
+
var py2 = {builtins: ["apply", "basestring", "buffer", "cmp", "coerce", "execfile",
|
36
|
+
"file", "intern", "long", "raw_input", "reduce", "reload",
|
37
|
+
"unichr", "unicode", "xrange", "False", "True", "None"],
|
38
|
+
keywords: ["exec", "print"]};
|
39
|
+
var py3 = {builtins: ["ascii", "bytes", "exec", "print"],
|
40
|
+
keywords: ["nonlocal", "False", "True", "None", "async", "await"]};
|
41
|
+
|
42
|
+
CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins));
|
43
|
+
|
44
|
+
function top(state) {
|
45
|
+
return state.scopes[state.scopes.length - 1];
|
46
|
+
}
|
47
|
+
|
48
|
+
CodeMirror.defineMode("python", function(conf, parserConf) {
|
49
|
+
var ERRORCLASS = "error";
|
50
|
+
|
51
|
+
var singleDelimiters = parserConf.singleDelimiters || new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]");
|
52
|
+
var doubleOperators = parserConf.doubleOperators || new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
|
53
|
+
var doubleDelimiters = parserConf.doubleDelimiters || new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
|
54
|
+
var tripleDelimiters = parserConf.tripleDelimiters || new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
|
55
|
+
|
56
|
+
if (parserConf.version && parseInt(parserConf.version, 10) == 3){
|
57
|
+
// since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator
|
58
|
+
var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!@]");
|
59
|
+
var identifiers = parserConf.identifiers|| new RegExp("^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*");
|
60
|
+
} else {
|
61
|
+
var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
|
62
|
+
var identifiers = parserConf.identifiers|| new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
|
63
|
+
}
|
64
|
+
|
65
|
+
var hangingIndent = parserConf.hangingIndent || conf.indentUnit;
|
66
|
+
|
67
|
+
var myKeywords = commonKeywords, myBuiltins = commonBuiltins;
|
68
|
+
if(parserConf.extra_keywords != undefined){
|
69
|
+
myKeywords = myKeywords.concat(parserConf.extra_keywords);
|
70
|
+
}
|
71
|
+
if(parserConf.extra_builtins != undefined){
|
72
|
+
myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
|
73
|
+
}
|
74
|
+
if (parserConf.version && parseInt(parserConf.version, 10) == 3) {
|
75
|
+
myKeywords = myKeywords.concat(py3.keywords);
|
76
|
+
myBuiltins = myBuiltins.concat(py3.builtins);
|
77
|
+
var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i");
|
78
|
+
} else {
|
79
|
+
myKeywords = myKeywords.concat(py2.keywords);
|
80
|
+
myBuiltins = myBuiltins.concat(py2.builtins);
|
81
|
+
var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
|
82
|
+
}
|
83
|
+
var keywords = wordRegexp(myKeywords);
|
84
|
+
var builtins = wordRegexp(myBuiltins);
|
85
|
+
|
86
|
+
// tokenizers
|
87
|
+
function tokenBase(stream, state) {
|
88
|
+
// Handle scope changes
|
89
|
+
if (stream.sol() && top(state).type == "py") {
|
90
|
+
var scopeOffset = top(state).offset;
|
91
|
+
if (stream.eatSpace()) {
|
92
|
+
var lineOffset = stream.indentation();
|
93
|
+
if (lineOffset > scopeOffset)
|
94
|
+
pushScope(stream, state, "py");
|
95
|
+
else if (lineOffset < scopeOffset && dedent(stream, state))
|
96
|
+
state.errorToken = true;
|
97
|
+
return null;
|
98
|
+
} else {
|
99
|
+
var style = tokenBaseInner(stream, state);
|
100
|
+
if (scopeOffset > 0 && dedent(stream, state))
|
101
|
+
style += " " + ERRORCLASS;
|
102
|
+
return style;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
return tokenBaseInner(stream, state);
|
106
|
+
}
|
107
|
+
|
108
|
+
function tokenBaseInner(stream, state) {
|
109
|
+
if (stream.eatSpace()) return null;
|
110
|
+
|
111
|
+
var ch = stream.peek();
|
112
|
+
|
113
|
+
// Handle Comments
|
114
|
+
if (ch == "#") {
|
115
|
+
stream.skipToEnd();
|
116
|
+
return "comment";
|
117
|
+
}
|
118
|
+
|
119
|
+
// Handle Number Literals
|
120
|
+
if (stream.match(/^[0-9\.]/, false)) {
|
121
|
+
var floatLiteral = false;
|
122
|
+
// Floats
|
123
|
+
if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
|
124
|
+
if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
|
125
|
+
if (stream.match(/^\.\d+/)) { floatLiteral = true; }
|
126
|
+
if (floatLiteral) {
|
127
|
+
// Float literals may be "imaginary"
|
128
|
+
stream.eat(/J/i);
|
129
|
+
return "number";
|
130
|
+
}
|
131
|
+
// Integers
|
132
|
+
var intLiteral = false;
|
133
|
+
// Hex
|
134
|
+
if (stream.match(/^0x[0-9a-f]+/i)) intLiteral = true;
|
135
|
+
// Binary
|
136
|
+
if (stream.match(/^0b[01]+/i)) intLiteral = true;
|
137
|
+
// Octal
|
138
|
+
if (stream.match(/^0o[0-7]+/i)) intLiteral = true;
|
139
|
+
// Decimal
|
140
|
+
if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) {
|
141
|
+
// Decimal literals may be "imaginary"
|
142
|
+
stream.eat(/J/i);
|
143
|
+
// TODO - Can you have imaginary longs?
|
144
|
+
intLiteral = true;
|
145
|
+
}
|
146
|
+
// Zero by itself with no other piece of number.
|
147
|
+
if (stream.match(/^0(?![\dx])/i)) intLiteral = true;
|
148
|
+
if (intLiteral) {
|
149
|
+
// Integer literals may be "long"
|
150
|
+
stream.eat(/L/i);
|
151
|
+
return "number";
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
// Handle Strings
|
156
|
+
if (stream.match(stringPrefixes)) {
|
157
|
+
state.tokenize = tokenStringFactory(stream.current());
|
158
|
+
return state.tokenize(stream, state);
|
159
|
+
}
|
160
|
+
|
161
|
+
// Handle operators and Delimiters
|
162
|
+
if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters))
|
163
|
+
return null;
|
164
|
+
|
165
|
+
if (stream.match(doubleOperators) || stream.match(singleOperators))
|
166
|
+
return "operator";
|
167
|
+
|
168
|
+
if (stream.match(singleDelimiters))
|
169
|
+
return null;
|
170
|
+
|
171
|
+
if (stream.match(keywords) || stream.match(wordOperators))
|
172
|
+
return "keyword";
|
173
|
+
|
174
|
+
if (stream.match(builtins))
|
175
|
+
return "builtin";
|
176
|
+
|
177
|
+
if (stream.match(/^(self|cls)\b/))
|
178
|
+
return "variable-2";
|
179
|
+
|
180
|
+
if (stream.match(identifiers)) {
|
181
|
+
if (state.lastToken == "def" || state.lastToken == "class")
|
182
|
+
return "def";
|
183
|
+
return "variable";
|
184
|
+
}
|
185
|
+
|
186
|
+
// Handle non-detected items
|
187
|
+
stream.next();
|
188
|
+
return ERRORCLASS;
|
189
|
+
}
|
190
|
+
|
191
|
+
function tokenStringFactory(delimiter) {
|
192
|
+
while ("rub".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
|
193
|
+
delimiter = delimiter.substr(1);
|
194
|
+
|
195
|
+
var singleline = delimiter.length == 1;
|
196
|
+
var OUTCLASS = "string";
|
197
|
+
|
198
|
+
function tokenString(stream, state) {
|
199
|
+
while (!stream.eol()) {
|
200
|
+
stream.eatWhile(/[^'"\\]/);
|
201
|
+
if (stream.eat("\\")) {
|
202
|
+
stream.next();
|
203
|
+
if (singleline && stream.eol())
|
204
|
+
return OUTCLASS;
|
205
|
+
} else if (stream.match(delimiter)) {
|
206
|
+
state.tokenize = tokenBase;
|
207
|
+
return OUTCLASS;
|
208
|
+
} else {
|
209
|
+
stream.eat(/['"]/);
|
210
|
+
}
|
211
|
+
}
|
212
|
+
if (singleline) {
|
213
|
+
if (parserConf.singleLineStringErrors)
|
214
|
+
return ERRORCLASS;
|
215
|
+
else
|
216
|
+
state.tokenize = tokenBase;
|
217
|
+
}
|
218
|
+
return OUTCLASS;
|
219
|
+
}
|
220
|
+
tokenString.isString = true;
|
221
|
+
return tokenString;
|
222
|
+
}
|
223
|
+
|
224
|
+
function pushScope(stream, state, type) {
|
225
|
+
var offset = 0, align = null;
|
226
|
+
if (type == "py") {
|
227
|
+
while (top(state).type != "py")
|
228
|
+
state.scopes.pop();
|
229
|
+
}
|
230
|
+
offset = top(state).offset + (type == "py" ? conf.indentUnit : hangingIndent);
|
231
|
+
if (type != "py" && !stream.match(/^(\s|#.*)*$/, false))
|
232
|
+
align = stream.column() + 1;
|
233
|
+
state.scopes.push({offset: offset, type: type, align: align});
|
234
|
+
}
|
235
|
+
|
236
|
+
function dedent(stream, state) {
|
237
|
+
var indented = stream.indentation();
|
238
|
+
while (top(state).offset > indented) {
|
239
|
+
if (top(state).type != "py") return true;
|
240
|
+
state.scopes.pop();
|
241
|
+
}
|
242
|
+
return top(state).offset != indented;
|
243
|
+
}
|
244
|
+
|
245
|
+
function tokenLexer(stream, state) {
|
246
|
+
var style = state.tokenize(stream, state);
|
247
|
+
var current = stream.current();
|
248
|
+
|
249
|
+
// Handle '.' connected identifiers
|
250
|
+
if (current == ".") {
|
251
|
+
style = stream.match(identifiers, false) ? null : ERRORCLASS;
|
252
|
+
if (style == null && state.lastStyle == "meta") {
|
253
|
+
// Apply 'meta' style to '.' connected identifiers when
|
254
|
+
// appropriate.
|
255
|
+
style = "meta";
|
256
|
+
}
|
257
|
+
return style;
|
258
|
+
}
|
259
|
+
|
260
|
+
// Handle decorators
|
261
|
+
if (current == "@"){
|
262
|
+
if(parserConf.version && parseInt(parserConf.version, 10) == 3){
|
263
|
+
return stream.match(identifiers, false) ? "meta" : "operator";
|
264
|
+
} else {
|
265
|
+
return stream.match(identifiers, false) ? "meta" : ERRORCLASS;
|
266
|
+
}
|
267
|
+
}
|
268
|
+
|
269
|
+
if ((style == "variable" || style == "builtin")
|
270
|
+
&& state.lastStyle == "meta")
|
271
|
+
style = "meta";
|
272
|
+
|
273
|
+
// Handle scope changes.
|
274
|
+
if (current == "pass" || current == "return")
|
275
|
+
state.dedent += 1;
|
276
|
+
|
277
|
+
if (current == "lambda") state.lambda = true;
|
278
|
+
if (current == ":" && !state.lambda && top(state).type == "py")
|
279
|
+
pushScope(stream, state, "py");
|
280
|
+
|
281
|
+
var delimiter_index = current.length == 1 ? "[({".indexOf(current) : -1;
|
282
|
+
if (delimiter_index != -1)
|
283
|
+
pushScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
|
284
|
+
|
285
|
+
delimiter_index = "])}".indexOf(current);
|
286
|
+
if (delimiter_index != -1) {
|
287
|
+
if (top(state).type == current) state.scopes.pop();
|
288
|
+
else return ERRORCLASS;
|
289
|
+
}
|
290
|
+
if (state.dedent > 0 && stream.eol() && top(state).type == "py") {
|
291
|
+
if (state.scopes.length > 1) state.scopes.pop();
|
292
|
+
state.dedent -= 1;
|
293
|
+
}
|
294
|
+
|
295
|
+
return style;
|
296
|
+
}
|
297
|
+
|
298
|
+
var external = {
|
299
|
+
startState: function(basecolumn) {
|
300
|
+
return {
|
301
|
+
tokenize: tokenBase,
|
302
|
+
scopes: [{offset: basecolumn || 0, type: "py", align: null}],
|
303
|
+
lastStyle: null,
|
304
|
+
lastToken: null,
|
305
|
+
lambda: false,
|
306
|
+
dedent: 0
|
307
|
+
};
|
308
|
+
},
|
309
|
+
|
310
|
+
token: function(stream, state) {
|
311
|
+
var addErr = state.errorToken;
|
312
|
+
if (addErr) state.errorToken = false;
|
313
|
+
var style = tokenLexer(stream, state);
|
314
|
+
|
315
|
+
state.lastStyle = style;
|
316
|
+
|
317
|
+
var current = stream.current();
|
318
|
+
if (current && style)
|
319
|
+
state.lastToken = current;
|
320
|
+
|
321
|
+
if (stream.eol() && state.lambda)
|
322
|
+
state.lambda = false;
|
323
|
+
return addErr ? style + " " + ERRORCLASS : style;
|
324
|
+
},
|
325
|
+
|
326
|
+
indent: function(state, textAfter) {
|
327
|
+
if (state.tokenize != tokenBase)
|
328
|
+
return state.tokenize.isString ? CodeMirror.Pass : 0;
|
329
|
+
|
330
|
+
var scope = top(state);
|
331
|
+
var closing = textAfter && textAfter.charAt(0) == scope.type;
|
332
|
+
if (scope.align != null)
|
333
|
+
return scope.align - (closing ? 1 : 0);
|
334
|
+
else if (closing && state.scopes.length > 1)
|
335
|
+
return state.scopes[state.scopes.length - 2].offset;
|
336
|
+
else
|
337
|
+
return scope.offset;
|
338
|
+
},
|
339
|
+
|
340
|
+
closeBrackets: {triples: "'\""},
|
341
|
+
lineComment: "#",
|
342
|
+
fold: "indent"
|
343
|
+
};
|
344
|
+
return external;
|
345
|
+
});
|
346
|
+
|
347
|
+
CodeMirror.defineMIME("text/x-python", "python");
|
348
|
+
|
349
|
+
var words = function(str) { return str.split(" "); };
|
350
|
+
|
351
|
+
CodeMirror.defineMIME("text/x-cython", {
|
352
|
+
name: "python",
|
353
|
+
extra_keywords: words("by cdef cimport cpdef ctypedef enum except"+
|
354
|
+
"extern gil include nogil property public"+
|
355
|
+
"readonly struct union DEF IF ELIF ELSE")
|
356
|
+
});
|
357
|
+
|
358
|
+
});
|