administrate-field-simple_mde_markdown 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/.circleci/config.yml +72 -0
- data/.circleci/setup-rubygems.sh +3 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +196 -0
- data/LICENSE.txt +21 -0
- data/README.md +44 -0
- data/Rakefile +8 -0
- data/administrate-field-simple_mde_markdown.gemspec +31 -0
- data/app/assets/javascripts/administrate-field-simple_mde_markdown/application.js +6 -0
- data/app/assets/stylesheets/administrate-field-simple_mde_markdown/application.css +3 -0
- data/app/views/fields/simple_mde_markdown/_form.html.erb +6 -0
- data/app/views/fields/simple_mde_markdown/_index.html.erb +1 -0
- data/app/views/fields/simple_mde_markdown/_show.html.erb +1 -0
- data/lib/administrate/field/simple_mde_markdown.rb +31 -0
- data/node_modules/.bin/marked +1 -0
- data/node_modules/codemirror-spell-checker/.eslintrc +23 -0
- data/node_modules/codemirror-spell-checker/.npmignore +2 -0
- data/node_modules/codemirror-spell-checker/.travis.yml +18 -0
- data/node_modules/codemirror-spell-checker/CONTRIBUTING 2.md +10 -0
- data/node_modules/codemirror-spell-checker/CONTRIBUTING.md +10 -0
- data/node_modules/codemirror-spell-checker/LICENSE +22 -0
- data/node_modules/codemirror-spell-checker/README.md +50 -0
- data/node_modules/codemirror-spell-checker/bower.json +27 -0
- data/node_modules/codemirror-spell-checker/debug/.spell-checker 2.css.icloud +0 -0
- data/node_modules/codemirror-spell-checker/debug/spell-checker.css +9 -0
- data/node_modules/codemirror-spell-checker/debug/spell-checker.debug.js +2844 -0
- data/node_modules/codemirror-spell-checker/debug/spell-checker.js +2841 -0
- data/node_modules/codemirror-spell-checker/dist/.spell-checker.min 2.css.icloud +0 -0
- data/node_modules/codemirror-spell-checker/dist/en_US.aff +201 -0
- data/node_modules/codemirror-spell-checker/dist/en_US.dic +62120 -0
- data/node_modules/codemirror-spell-checker/dist/spell-checker.min 2.js +7 -0
- data/node_modules/codemirror-spell-checker/dist/spell-checker.min.css +7 -0
- data/node_modules/codemirror-spell-checker/dist/spell-checker.min.js +7 -0
- data/node_modules/codemirror-spell-checker/gulpfile.js +94 -0
- data/node_modules/codemirror-spell-checker/package.json +75 -0
- data/node_modules/codemirror-spell-checker/src/css/spell-checker.css +3 -0
- data/node_modules/codemirror-spell-checker/src/data/en_US.aff +201 -0
- data/node_modules/codemirror-spell-checker/src/data/en_US.dic +62120 -0
- data/node_modules/codemirror-spell-checker/src/js/spell-checker.js +119 -0
- data/node_modules/codemirror/.package 2.json.icloud +0 -0
- data/node_modules/codemirror/AUTHORS +773 -0
- data/node_modules/codemirror/CHANGELOG.md +1486 -0
- data/node_modules/codemirror/CONTRIBUTING.md +92 -0
- data/node_modules/codemirror/LICENSE +21 -0
- data/node_modules/codemirror/README.md +49 -0
- data/node_modules/codemirror/addon/comment/comment.js +209 -0
- data/node_modules/codemirror/addon/comment/continuecomment.js +78 -0
- data/node_modules/codemirror/addon/dialog/dialog.css +32 -0
- data/node_modules/codemirror/addon/dialog/dialog.js +161 -0
- data/node_modules/codemirror/addon/display/autorefresh.js +47 -0
- data/node_modules/codemirror/addon/display/fullscreen.css +6 -0
- data/node_modules/codemirror/addon/display/fullscreen.js +41 -0
- data/node_modules/codemirror/addon/display/panel.js +127 -0
- data/node_modules/codemirror/addon/display/placeholder.js +63 -0
- data/node_modules/codemirror/addon/display/rulers.js +51 -0
- data/node_modules/codemirror/addon/edit/closebrackets.js +187 -0
- data/node_modules/codemirror/addon/edit/closetag.js +175 -0
- data/node_modules/codemirror/addon/edit/continuelist.js +89 -0
- data/node_modules/codemirror/addon/edit/matchbrackets.js +145 -0
- data/node_modules/codemirror/addon/edit/matchtags.js +66 -0
- data/node_modules/codemirror/addon/edit/trailingspace.js +27 -0
- data/node_modules/codemirror/addon/fold/brace-fold.js +105 -0
- data/node_modules/codemirror/addon/fold/comment-fold.js +59 -0
- data/node_modules/codemirror/addon/fold/foldcode.js +152 -0
- data/node_modules/codemirror/addon/fold/foldgutter.css +20 -0
- data/node_modules/codemirror/addon/fold/foldgutter.js +146 -0
- data/node_modules/codemirror/addon/fold/indent-fold.js +48 -0
- data/node_modules/codemirror/addon/fold/markdown-fold.js +49 -0
- data/node_modules/codemirror/addon/fold/xml-fold.js +184 -0
- data/node_modules/codemirror/addon/hint/anyword-hint.js +41 -0
- data/node_modules/codemirror/addon/hint/css-hint.js +60 -0
- data/node_modules/codemirror/addon/hint/html-hint.js +348 -0
- data/node_modules/codemirror/addon/hint/javascript-hint.js +157 -0
- data/node_modules/codemirror/addon/hint/show-hint.css +36 -0
- data/node_modules/codemirror/addon/hint/show-hint.js +434 -0
- data/node_modules/codemirror/addon/hint/sql-hint.js +299 -0
- data/node_modules/codemirror/addon/hint/xml-hint.js +110 -0
- data/node_modules/codemirror/addon/lint/coffeescript-lint.js +47 -0
- data/node_modules/codemirror/addon/lint/css-lint.js +40 -0
- data/node_modules/codemirror/addon/lint/html-lint.js +53 -0
- data/node_modules/codemirror/addon/lint/javascript-lint.js +63 -0
- data/node_modules/codemirror/addon/lint/json-lint.js +40 -0
- data/node_modules/codemirror/addon/lint/lint.css +73 -0
- data/node_modules/codemirror/addon/lint/lint.js +252 -0
- data/node_modules/codemirror/addon/lint/yaml-lint.js +41 -0
- data/node_modules/codemirror/addon/merge/merge.css +119 -0
- data/node_modules/codemirror/addon/merge/merge.js +1002 -0
- data/node_modules/codemirror/addon/mode/loadmode.js +64 -0
- data/node_modules/codemirror/addon/mode/multiplex.js +131 -0
- data/node_modules/codemirror/addon/mode/multiplex_test.js +33 -0
- data/node_modules/codemirror/addon/mode/overlay.js +90 -0
- data/node_modules/codemirror/addon/mode/simple.js +216 -0
- data/node_modules/codemirror/addon/runmode/colorize.js +40 -0
- data/node_modules/codemirror/addon/runmode/runmode-standalone.js +158 -0
- data/node_modules/codemirror/addon/runmode/runmode.js +72 -0
- data/node_modules/codemirror/addon/runmode/runmode.node.js +197 -0
- data/node_modules/codemirror/addon/scroll/annotatescrollbar.js +122 -0
- data/node_modules/codemirror/addon/scroll/scrollpastend.js +48 -0
- data/node_modules/codemirror/addon/scroll/simplescrollbars.css +66 -0
- data/node_modules/codemirror/addon/scroll/simplescrollbars.js +152 -0
- data/node_modules/codemirror/addon/search/jump-to-line.js +50 -0
- data/node_modules/codemirror/addon/search/match-highlighter.js +165 -0
- data/node_modules/codemirror/addon/search/matchesonscrollbar.css +8 -0
- data/node_modules/codemirror/addon/search/matchesonscrollbar.js +97 -0
- data/node_modules/codemirror/addon/search/search.js +258 -0
- data/node_modules/codemirror/addon/search/searchcursor.js +293 -0
- data/node_modules/codemirror/addon/selection/active-line.js +72 -0
- data/node_modules/codemirror/addon/selection/mark-selection.js +119 -0
- data/node_modules/codemirror/addon/selection/selection-pointer.js +98 -0
- data/node_modules/codemirror/addon/tern/tern.css +87 -0
- data/node_modules/codemirror/addon/tern/tern.js +718 -0
- data/node_modules/codemirror/addon/tern/worker.js +44 -0
- data/node_modules/codemirror/addon/wrap/hardwrap.js +145 -0
- data/node_modules/codemirror/bin/source-highlight +48 -0
- data/node_modules/codemirror/keymap/emacs.js +417 -0
- data/node_modules/codemirror/keymap/sublime.js +691 -0
- data/node_modules/codemirror/keymap/vim.js +5467 -0
- data/node_modules/codemirror/lib/codemirror.css +346 -0
- data/node_modules/codemirror/lib/codemirror.js +9698 -0
- data/node_modules/codemirror/mode/apl/apl.js +174 -0
- data/node_modules/codemirror/mode/asciiarmor/asciiarmor.js +74 -0
- data/node_modules/codemirror/mode/asn.1/asn.1.js +204 -0
- data/node_modules/codemirror/mode/asterisk/asterisk.js +196 -0
- data/node_modules/codemirror/mode/brainfuck/brainfuck.js +85 -0
- data/node_modules/codemirror/mode/clike/clike.js +879 -0
- data/node_modules/codemirror/mode/clojure/clojure.js +292 -0
- data/node_modules/codemirror/mode/cmake/cmake.js +97 -0
- data/node_modules/codemirror/mode/cobol/cobol.js +255 -0
- data/node_modules/codemirror/mode/coffeescript/coffeescript.js +359 -0
- data/node_modules/codemirror/mode/commonlisp/commonlisp.js +124 -0
- data/node_modules/codemirror/mode/crystal/crystal.js +433 -0
- data/node_modules/codemirror/mode/css/css.js +832 -0
- data/node_modules/codemirror/mode/cypher/cypher.js +150 -0
- data/node_modules/codemirror/mode/d/d.js +223 -0
- data/node_modules/codemirror/mode/dart/dart.js +157 -0
- data/node_modules/codemirror/mode/diff/diff.js +47 -0
- data/node_modules/codemirror/mode/django/django.js +356 -0
- data/node_modules/codemirror/mode/dockerfile/dockerfile.js +211 -0
- data/node_modules/codemirror/mode/dtd/dtd.js +142 -0
- data/node_modules/codemirror/mode/dylan/dylan.js +352 -0
- data/node_modules/codemirror/mode/ebnf/ebnf.js +195 -0
- data/node_modules/codemirror/mode/ecl/ecl.js +206 -0
- data/node_modules/codemirror/mode/eiffel/eiffel.js +160 -0
- data/node_modules/codemirror/mode/elm/elm.js +205 -0
- data/node_modules/codemirror/mode/erlang/erlang.js +619 -0
- data/node_modules/codemirror/mode/factor/factor.js +85 -0
- data/node_modules/codemirror/mode/fcl/fcl.js +173 -0
- data/node_modules/codemirror/mode/forth/forth.js +180 -0
- data/node_modules/codemirror/mode/fortran/fortran.js +188 -0
- data/node_modules/codemirror/mode/gas/gas.js +345 -0
- data/node_modules/codemirror/mode/gfm/gfm.js +129 -0
- data/node_modules/codemirror/mode/gherkin/gherkin.js +178 -0
- data/node_modules/codemirror/mode/go/go.js +187 -0
- data/node_modules/codemirror/mode/groovy/groovy.js +230 -0
- data/node_modules/codemirror/mode/haml/haml.js +161 -0
- data/node_modules/codemirror/mode/handlebars/handlebars.js +66 -0
- data/node_modules/codemirror/mode/haskell-literate/haskell-literate.js +43 -0
- data/node_modules/codemirror/mode/haskell/haskell.js +268 -0
- data/node_modules/codemirror/mode/haxe/haxe.js +515 -0
- data/node_modules/codemirror/mode/htmlembedded/htmlembedded.js +37 -0
- data/node_modules/codemirror/mode/htmlmixed/htmlmixed.js +152 -0
- data/node_modules/codemirror/mode/http/http.js +113 -0
- data/node_modules/codemirror/mode/idl/idl.js +290 -0
- data/node_modules/codemirror/mode/javascript/javascript.js +899 -0
- data/node_modules/codemirror/mode/jinja2/jinja2.js +144 -0
- data/node_modules/codemirror/mode/jsx/jsx.js +148 -0
- data/node_modules/codemirror/mode/julia/julia.js +433 -0
- data/node_modules/codemirror/mode/livescript/livescript.js +280 -0
- data/node_modules/codemirror/mode/lua/lua.js +159 -0
- data/node_modules/codemirror/mode/markdown/markdown.js +884 -0
- data/node_modules/codemirror/mode/mathematica/mathematica.js +176 -0
- data/node_modules/codemirror/mode/mbox/mbox.js +129 -0
- data/node_modules/codemirror/mode/meta.js +217 -0
- data/node_modules/codemirror/mode/mirc/mirc.js +193 -0
- data/node_modules/codemirror/mode/mllike/mllike.js +359 -0
- data/node_modules/codemirror/mode/modelica/modelica.js +245 -0
- data/node_modules/codemirror/mode/mscgen/mscgen.js +175 -0
- data/node_modules/codemirror/mode/mumps/mumps.js +148 -0
- data/node_modules/codemirror/mode/nginx/nginx.js +178 -0
- data/node_modules/codemirror/mode/nsis/nsis.js +95 -0
- data/node_modules/codemirror/mode/ntriples/ntriples.js +195 -0
- data/node_modules/codemirror/mode/octave/octave.js +139 -0
- data/node_modules/codemirror/mode/oz/oz.js +252 -0
- data/node_modules/codemirror/mode/pascal/pascal.js +121 -0
- data/node_modules/codemirror/mode/pegjs/pegjs.js +114 -0
- data/node_modules/codemirror/mode/perl/perl.js +837 -0
- data/node_modules/codemirror/mode/php/php.js +234 -0
- data/node_modules/codemirror/mode/pig/pig.js +178 -0
- data/node_modules/codemirror/mode/powershell/powershell.js +398 -0
- data/node_modules/codemirror/mode/properties/properties 2.js +78 -0
- data/node_modules/codemirror/mode/properties/properties.js +78 -0
- data/node_modules/codemirror/mode/protobuf/protobuf.js +69 -0
- data/node_modules/codemirror/mode/pug/pug.js +591 -0
- data/node_modules/codemirror/mode/puppet/puppet.js +220 -0
- data/node_modules/codemirror/mode/python/python.js +409 -0
- data/node_modules/codemirror/mode/q/q.js +139 -0
- data/node_modules/codemirror/mode/r/r.js +190 -0
- data/node_modules/codemirror/mode/rpm/changes/index.html +66 -0
- data/node_modules/codemirror/mode/rpm/rpm.js +109 -0
- data/node_modules/codemirror/mode/rst/rst.js +557 -0
- data/node_modules/codemirror/mode/ruby/ruby.js +296 -0
- data/node_modules/codemirror/mode/rust/rust.js +72 -0
- data/node_modules/codemirror/mode/sas/sas.js +303 -0
- data/node_modules/codemirror/mode/sass/sass.js +454 -0
- data/node_modules/codemirror/mode/scheme/scheme.js +265 -0
- data/node_modules/codemirror/mode/shell/shell.js +152 -0
- data/node_modules/codemirror/mode/sieve/sieve.js +193 -0
- data/node_modules/codemirror/mode/slim/slim.js +575 -0
- data/node_modules/codemirror/mode/smalltalk/smalltalk.js +168 -0
- data/node_modules/codemirror/mode/smarty/smarty.js +225 -0
- data/node_modules/codemirror/mode/solr/solr.js +104 -0
- data/node_modules/codemirror/mode/soy/soy 2.js +359 -0
- data/node_modules/codemirror/mode/soy/soy.js +235 -0
- data/node_modules/codemirror/mode/sparql/sparql.js +180 -0
- data/node_modules/codemirror/mode/spreadsheet/spreadsheet.js +112 -0
- data/node_modules/codemirror/mode/sql/sql.js +499 -0
- data/node_modules/codemirror/mode/stex/stex.js +264 -0
- data/node_modules/codemirror/mode/stylus/stylus.js +771 -0
- data/node_modules/codemirror/mode/swift/swift.js +219 -0
- data/node_modules/codemirror/mode/tcl/tcl.js +139 -0
- data/node_modules/codemirror/mode/textile/textile.js +469 -0
- data/node_modules/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/node_modules/codemirror/mode/tiddlywiki/tiddlywiki.js +308 -0
- data/node_modules/codemirror/mode/tiki/tiki.css +26 -0
- data/node_modules/codemirror/mode/tiki/tiki.js +312 -0
- data/node_modules/codemirror/mode/toml/toml.js +88 -0
- data/node_modules/codemirror/mode/tornado/tornado.js +68 -0
- data/node_modules/codemirror/mode/troff/troff.js +84 -0
- data/node_modules/codemirror/mode/ttcn-cfg/ttcn-cfg.js +214 -0
- data/node_modules/codemirror/mode/ttcn/ttcn.js +283 -0
- data/node_modules/codemirror/mode/turtle/turtle.js +162 -0
- data/node_modules/codemirror/mode/twig/twig.js +141 -0
- data/node_modules/codemirror/mode/vb/vb.js +275 -0
- data/node_modules/codemirror/mode/vbscript/vbscript.js +350 -0
- data/node_modules/codemirror/mode/velocity/velocity.js +201 -0
- data/node_modules/codemirror/mode/verilog/verilog.js +675 -0
- data/node_modules/codemirror/mode/vhdl/vhdl.js +189 -0
- data/node_modules/codemirror/mode/vue/vue.js +77 -0
- data/node_modules/codemirror/mode/webidl/webidl.js +195 -0
- data/node_modules/codemirror/mode/xml/xml.js +402 -0
- data/node_modules/codemirror/mode/xquery/xquery.js +448 -0
- data/node_modules/codemirror/mode/yacas/yacas.js +204 -0
- data/node_modules/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +68 -0
- data/node_modules/codemirror/mode/yaml/yaml.js +120 -0
- data/node_modules/codemirror/mode/z80/z80.js +116 -0
- data/node_modules/codemirror/package.json +2395 -0
- data/node_modules/codemirror/rollup.config.js +20 -0
- data/node_modules/codemirror/src/codemirror.js +3 -0
- data/node_modules/codemirror/src/display/Display.js +106 -0
- data/node_modules/codemirror/src/display/focus.js +47 -0
- data/node_modules/codemirror/src/display/gutters.js +34 -0
- data/node_modules/codemirror/src/display/highlight_worker.js +55 -0
- data/node_modules/codemirror/src/display/line_numbers.js +48 -0
- data/node_modules/codemirror/src/display/mode_state.js +22 -0
- data/node_modules/codemirror/src/display/operations.js +205 -0
- data/node_modules/codemirror/src/display/scroll_events.js +115 -0
- data/node_modules/codemirror/src/display/scrollbars.js +193 -0
- data/node_modules/codemirror/src/display/scrolling.js +184 -0
- data/node_modules/codemirror/src/display/selection.js +158 -0
- data/node_modules/codemirror/src/display/update_display.js +260 -0
- data/node_modules/codemirror/src/display/update_line.js +188 -0
- data/node_modules/codemirror/src/display/update_lines.js +64 -0
- data/node_modules/codemirror/src/display/view_tracking.js +153 -0
- data/node_modules/codemirror/src/edit/CodeMirror.js +215 -0
- data/node_modules/codemirror/src/edit/commands.js +178 -0
- data/node_modules/codemirror/src/edit/deleteNearSelection.js +30 -0
- data/node_modules/codemirror/src/edit/drop_events.js +119 -0
- data/node_modules/codemirror/src/edit/fromTextArea.js +61 -0
- data/node_modules/codemirror/src/edit/global_events.js +42 -0
- data/node_modules/codemirror/src/edit/key_events.js +159 -0
- data/node_modules/codemirror/src/edit/legacy.js +62 -0
- data/node_modules/codemirror/src/edit/main.js +69 -0
- data/node_modules/codemirror/src/edit/methods.js +544 -0
- data/node_modules/codemirror/src/edit/mouse_events.js +407 -0
- data/node_modules/codemirror/src/edit/options.js +193 -0
- data/node_modules/codemirror/src/edit/utils.js +7 -0
- data/node_modules/codemirror/src/input/ContentEditableInput.js +527 -0
- data/node_modules/codemirror/src/input/TextareaInput.js +355 -0
- data/node_modules/codemirror/src/input/indent.js +71 -0
- data/node_modules/codemirror/src/input/input.js +135 -0
- data/node_modules/codemirror/src/input/keymap.js +148 -0
- data/node_modules/codemirror/src/input/keynames.js +17 -0
- data/node_modules/codemirror/src/input/movement.js +110 -0
- data/node_modules/codemirror/src/line/highlight.js +284 -0
- data/node_modules/codemirror/src/line/line_data.js +339 -0
- data/node_modules/codemirror/src/line/pos.js +40 -0
- data/node_modules/codemirror/src/line/saw_special_spans.js +10 -0
- data/node_modules/codemirror/src/line/spans.js +382 -0
- data/node_modules/codemirror/src/line/utils_line.js +85 -0
- data/node_modules/codemirror/src/measurement/position_measurement.js +699 -0
- data/node_modules/codemirror/src/measurement/widgets.js +26 -0
- data/node_modules/codemirror/src/model/Doc.js +432 -0
- data/node_modules/codemirror/src/model/change_measurement.js +61 -0
- data/node_modules/codemirror/src/model/changes.js +333 -0
- data/node_modules/codemirror/src/model/chunk.js +167 -0
- data/node_modules/codemirror/src/model/document_data.js +111 -0
- data/node_modules/codemirror/src/model/history.js +228 -0
- data/node_modules/codemirror/src/model/line_widget.js +78 -0
- data/node_modules/codemirror/src/model/mark_text.js +292 -0
- data/node_modules/codemirror/src/model/selection.js +84 -0
- data/node_modules/codemirror/src/model/selection_updates.js +208 -0
- data/node_modules/codemirror/src/modes.js +96 -0
- data/node_modules/codemirror/src/util/StringStream.js +90 -0
- data/node_modules/codemirror/src/util/bidi.js +214 -0
- data/node_modules/codemirror/src/util/browser.js +33 -0
- data/node_modules/codemirror/src/util/dom.js +97 -0
- data/node_modules/codemirror/src/util/event.js +103 -0
- data/node_modules/codemirror/src/util/feature_detection.js +84 -0
- data/node_modules/codemirror/src/util/misc.js +150 -0
- data/node_modules/codemirror/src/util/operation_group.js +72 -0
- data/node_modules/codemirror/theme/3024-day.css +41 -0
- data/node_modules/codemirror/theme/3024-night.css +39 -0
- data/node_modules/codemirror/theme/abcdef.css +32 -0
- data/node_modules/codemirror/theme/ambiance-mobile.css +5 -0
- data/node_modules/codemirror/theme/ambiance.css +74 -0
- data/node_modules/codemirror/theme/base16-dark.css +38 -0
- data/node_modules/codemirror/theme/base16-light.css +38 -0
- data/node_modules/codemirror/theme/bespin.css +34 -0
- data/node_modules/codemirror/theme/blackboard.css +32 -0
- data/node_modules/codemirror/theme/cobalt.css +25 -0
- data/node_modules/codemirror/theme/colorforth.css +33 -0
- data/node_modules/codemirror/theme/darcula.css +46 -0
- data/node_modules/codemirror/theme/dracula.css +40 -0
- data/node_modules/codemirror/theme/duotone-dark.css +35 -0
- data/node_modules/codemirror/theme/duotone-light.css +36 -0
- data/node_modules/codemirror/theme/eclipse.css +23 -0
- data/node_modules/codemirror/theme/elegant.css +13 -0
- data/node_modules/codemirror/theme/erlang-dark.css +34 -0
- data/node_modules/codemirror/theme/gruvbox-dark.css +37 -0
- data/node_modules/codemirror/theme/hopscotch.css +34 -0
- data/node_modules/codemirror/theme/icecoder.css +43 -0
- data/node_modules/codemirror/theme/idea.css +42 -0
- data/node_modules/codemirror/theme/isotope.css +34 -0
- data/node_modules/codemirror/theme/lesser-dark.css +47 -0
- data/node_modules/codemirror/theme/liquibyte.css +95 -0
- data/node_modules/codemirror/theme/lucario.css +37 -0
- data/node_modules/codemirror/theme/material.css +53 -0
- data/node_modules/codemirror/theme/mbo.css +37 -0
- data/node_modules/codemirror/theme/mdn-like.css +46 -0
- data/node_modules/codemirror/theme/midnight.css +43 -0
- data/node_modules/codemirror/theme/monokai.css +41 -0
- data/node_modules/codemirror/theme/neat.css +12 -0
- data/node_modules/codemirror/theme/neo.css +43 -0
- data/node_modules/codemirror/theme/night.css +27 -0
- data/node_modules/codemirror/theme/oceanic-next.css +44 -0
- data/node_modules/codemirror/theme/panda-syntax.css +85 -0
- data/node_modules/codemirror/theme/paraiso-dark.css +38 -0
- data/node_modules/codemirror/theme/paraiso-light.css +38 -0
- data/node_modules/codemirror/theme/pastel-on-dark.css +52 -0
- data/node_modules/codemirror/theme/railscasts.css +34 -0
- data/node_modules/codemirror/theme/rubyblue.css +25 -0
- data/node_modules/codemirror/theme/seti.css +44 -0
- data/node_modules/codemirror/theme/shadowfox.css +52 -0
- data/node_modules/codemirror/theme/solarized.css +168 -0
- data/node_modules/codemirror/theme/ssms.css +16 -0
- data/node_modules/codemirror/theme/the-matrix.css +30 -0
- data/node_modules/codemirror/theme/tomorrow-night-bright.css +35 -0
- data/node_modules/codemirror/theme/tomorrow-night-eighties.css +38 -0
- data/node_modules/codemirror/theme/ttcn.css +64 -0
- data/node_modules/codemirror/theme/twilight.css +32 -0
- data/node_modules/codemirror/theme/vibrant-ink.css +34 -0
- data/node_modules/codemirror/theme/xq-dark.css +53 -0
- data/node_modules/codemirror/theme/xq-light.css +43 -0
- data/node_modules/codemirror/theme/yeti.css +44 -0
- data/node_modules/codemirror/theme/zenburn.css +37 -0
- data/node_modules/marked/.editorconfig +16 -0
- data/node_modules/marked/.eslintignore +1 -0
- data/node_modules/marked/.eslintrc.json +28 -0
- data/node_modules/marked/.package 2.json.icloud +0 -0
- data/node_modules/marked/.travis.yml +47 -0
- data/node_modules/marked/Makefile +15 -0
- data/node_modules/marked/Makefile 2 +15 -0
- data/node_modules/marked/README 2.md +75 -0
- data/node_modules/marked/README.md +75 -0
- data/node_modules/marked/bin/marked +199 -0
- data/node_modules/marked/bower.json +23 -0
- data/node_modules/marked/component.json +10 -0
- data/node_modules/marked/index.js +1 -0
- data/node_modules/marked/jasmine.json +11 -0
- data/node_modules/marked/lib/marked 2.js +1604 -0
- data/node_modules/marked/lib/marked.js +1604 -0
- data/node_modules/marked/man/marked.1 +91 -0
- data/node_modules/marked/man/marked.1.txt +96 -0
- data/node_modules/marked/marked.min.js +6 -0
- data/node_modules/marked/package.json +95 -0
- data/node_modules/simplemde/.eslintrc +23 -0
- data/node_modules/simplemde/.npmignore +9 -0
- data/node_modules/simplemde/.travis.yml +18 -0
- data/node_modules/simplemde/CONTRIBUTING 2.md +10 -0
- data/node_modules/simplemde/CONTRIBUTING.md +10 -0
- data/node_modules/simplemde/LICENSE +22 -0
- data/node_modules/simplemde/README.md +331 -0
- data/node_modules/simplemde/bower.json +23 -0
- data/node_modules/simplemde/debug/.simplemde 2.css.icloud +0 -0
- data/node_modules/simplemde/debug/simplemde.css +676 -0
- data/node_modules/simplemde/debug/simplemde.debug.js +17023 -0
- data/node_modules/simplemde/debug/simplemde.js +17019 -0
- data/node_modules/simplemde/dist/simplemde.min.css +7 -0
- data/node_modules/simplemde/dist/simplemde.min.js +15 -0
- data/node_modules/simplemde/gulpfile.js +96 -0
- data/node_modules/simplemde/package.json +73 -0
- data/node_modules/simplemde/src/css/simplemde.css +328 -0
- data/node_modules/simplemde/src/js/codemirror/tablist 2.js +44 -0
- data/node_modules/simplemde/src/js/codemirror/tablist.js +44 -0
- data/node_modules/simplemde/src/js/simplemde.js +2028 -0
- data/node_modules/typo-js/README.md +45 -0
- data/node_modules/typo-js/dictionaries/en_US/.en_US 2.dic.icloud +0 -0
- data/node_modules/typo-js/dictionaries/en_US/README.md +7 -0
- data/node_modules/typo-js/dictionaries/en_US/en_US.aff +201 -0
- data/node_modules/typo-js/dictionaries/en_US/en_US.dic +62120 -0
- data/node_modules/typo-js/package.json +56 -0
- data/node_modules/typo-js/typo.js +931 -0
- data/package-lock.json +40 -0
- data/package.json +7 -0
- metadata +557 -0
@@ -0,0 +1,84 @@
|
|
1
|
+
import { cmp, copyPos, equalCursorPos, maxPos, minPos } from "../line/pos.js"
|
2
|
+
import { indexOf } from "../util/misc.js"
|
3
|
+
|
4
|
+
// Selection objects are immutable. A new one is created every time
|
5
|
+
// the selection changes. A selection is one or more non-overlapping
|
6
|
+
// (and non-touching) ranges, sorted, and an integer that indicates
|
7
|
+
// which one is the primary selection (the one that's scrolled into
|
8
|
+
// view, that getCursor returns, etc).
|
9
|
+
export class Selection {
|
10
|
+
constructor(ranges, primIndex) {
|
11
|
+
this.ranges = ranges
|
12
|
+
this.primIndex = primIndex
|
13
|
+
}
|
14
|
+
|
15
|
+
primary() { return this.ranges[this.primIndex] }
|
16
|
+
|
17
|
+
equals(other) {
|
18
|
+
if (other == this) return true
|
19
|
+
if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) return false
|
20
|
+
for (let i = 0; i < this.ranges.length; i++) {
|
21
|
+
let here = this.ranges[i], there = other.ranges[i]
|
22
|
+
if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) return false
|
23
|
+
}
|
24
|
+
return true
|
25
|
+
}
|
26
|
+
|
27
|
+
deepCopy() {
|
28
|
+
let out = []
|
29
|
+
for (let i = 0; i < this.ranges.length; i++)
|
30
|
+
out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head))
|
31
|
+
return new Selection(out, this.primIndex)
|
32
|
+
}
|
33
|
+
|
34
|
+
somethingSelected() {
|
35
|
+
for (let i = 0; i < this.ranges.length; i++)
|
36
|
+
if (!this.ranges[i].empty()) return true
|
37
|
+
return false
|
38
|
+
}
|
39
|
+
|
40
|
+
contains(pos, end) {
|
41
|
+
if (!end) end = pos
|
42
|
+
for (let i = 0; i < this.ranges.length; i++) {
|
43
|
+
let range = this.ranges[i]
|
44
|
+
if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
|
45
|
+
return i
|
46
|
+
}
|
47
|
+
return -1
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
export class Range {
|
52
|
+
constructor(anchor, head) {
|
53
|
+
this.anchor = anchor; this.head = head
|
54
|
+
}
|
55
|
+
|
56
|
+
from() { return minPos(this.anchor, this.head) }
|
57
|
+
to() { return maxPos(this.anchor, this.head) }
|
58
|
+
empty() { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch }
|
59
|
+
}
|
60
|
+
|
61
|
+
// Take an unsorted, potentially overlapping set of ranges, and
|
62
|
+
// build a selection out of it. 'Consumes' ranges array (modifying
|
63
|
+
// it).
|
64
|
+
export function normalizeSelection(cm, ranges, primIndex) {
|
65
|
+
let mayTouch = cm && cm.options.selectionsMayTouch
|
66
|
+
let prim = ranges[primIndex]
|
67
|
+
ranges.sort((a, b) => cmp(a.from(), b.from()))
|
68
|
+
primIndex = indexOf(ranges, prim)
|
69
|
+
for (let i = 1; i < ranges.length; i++) {
|
70
|
+
let cur = ranges[i], prev = ranges[i - 1]
|
71
|
+
let diff = cmp(prev.to(), cur.from())
|
72
|
+
if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {
|
73
|
+
let from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to())
|
74
|
+
let inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head
|
75
|
+
if (i <= primIndex) --primIndex
|
76
|
+
ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to))
|
77
|
+
}
|
78
|
+
}
|
79
|
+
return new Selection(ranges, primIndex)
|
80
|
+
}
|
81
|
+
|
82
|
+
export function simpleSelection(anchor, head) {
|
83
|
+
return new Selection([new Range(anchor, head || anchor)], 0)
|
84
|
+
}
|
@@ -0,0 +1,208 @@
|
|
1
|
+
import { signalLater } from "../util/operation_group.js"
|
2
|
+
import { ensureCursorVisible } from "../display/scrolling.js"
|
3
|
+
import { clipPos, cmp, Pos } from "../line/pos.js"
|
4
|
+
import { getLine } from "../line/utils_line.js"
|
5
|
+
import { hasHandler, signal, signalCursorActivity } from "../util/event.js"
|
6
|
+
import { lst, sel_dontScroll } from "../util/misc.js"
|
7
|
+
|
8
|
+
import { addSelectionToHistory } from "./history.js"
|
9
|
+
import { normalizeSelection, Range, Selection, simpleSelection } from "./selection.js"
|
10
|
+
|
11
|
+
// The 'scroll' parameter given to many of these indicated whether
|
12
|
+
// the new cursor position should be scrolled into view after
|
13
|
+
// modifying the selection.
|
14
|
+
|
15
|
+
// If shift is held or the extend flag is set, extends a range to
|
16
|
+
// include a given position (and optionally a second position).
|
17
|
+
// Otherwise, simply returns the range between the given positions.
|
18
|
+
// Used for cursor motion and such.
|
19
|
+
export function extendRange(range, head, other, extend) {
|
20
|
+
if (extend) {
|
21
|
+
let anchor = range.anchor
|
22
|
+
if (other) {
|
23
|
+
let posBefore = cmp(head, anchor) < 0
|
24
|
+
if (posBefore != (cmp(other, anchor) < 0)) {
|
25
|
+
anchor = head
|
26
|
+
head = other
|
27
|
+
} else if (posBefore != (cmp(head, other) < 0)) {
|
28
|
+
head = other
|
29
|
+
}
|
30
|
+
}
|
31
|
+
return new Range(anchor, head)
|
32
|
+
} else {
|
33
|
+
return new Range(other || head, head)
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
// Extend the primary selection range, discard the rest.
|
38
|
+
export function extendSelection(doc, head, other, options, extend) {
|
39
|
+
if (extend == null) extend = doc.cm && (doc.cm.display.shift || doc.extend)
|
40
|
+
setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options)
|
41
|
+
}
|
42
|
+
|
43
|
+
// Extend all selections (pos is an array of selections with length
|
44
|
+
// equal the number of selections)
|
45
|
+
export function extendSelections(doc, heads, options) {
|
46
|
+
let out = []
|
47
|
+
let extend = doc.cm && (doc.cm.display.shift || doc.extend)
|
48
|
+
for (let i = 0; i < doc.sel.ranges.length; i++)
|
49
|
+
out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend)
|
50
|
+
let newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex)
|
51
|
+
setSelection(doc, newSel, options)
|
52
|
+
}
|
53
|
+
|
54
|
+
// Updates a single range in the selection.
|
55
|
+
export function replaceOneSelection(doc, i, range, options) {
|
56
|
+
let ranges = doc.sel.ranges.slice(0)
|
57
|
+
ranges[i] = range
|
58
|
+
setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options)
|
59
|
+
}
|
60
|
+
|
61
|
+
// Reset the selection to a single range.
|
62
|
+
export function setSimpleSelection(doc, anchor, head, options) {
|
63
|
+
setSelection(doc, simpleSelection(anchor, head), options)
|
64
|
+
}
|
65
|
+
|
66
|
+
// Give beforeSelectionChange handlers a change to influence a
|
67
|
+
// selection update.
|
68
|
+
function filterSelectionChange(doc, sel, options) {
|
69
|
+
let obj = {
|
70
|
+
ranges: sel.ranges,
|
71
|
+
update: function(ranges) {
|
72
|
+
this.ranges = []
|
73
|
+
for (let i = 0; i < ranges.length; i++)
|
74
|
+
this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
|
75
|
+
clipPos(doc, ranges[i].head))
|
76
|
+
},
|
77
|
+
origin: options && options.origin
|
78
|
+
}
|
79
|
+
signal(doc, "beforeSelectionChange", doc, obj)
|
80
|
+
if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj)
|
81
|
+
if (obj.ranges != sel.ranges) return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1)
|
82
|
+
else return sel
|
83
|
+
}
|
84
|
+
|
85
|
+
export function setSelectionReplaceHistory(doc, sel, options) {
|
86
|
+
let done = doc.history.done, last = lst(done)
|
87
|
+
if (last && last.ranges) {
|
88
|
+
done[done.length - 1] = sel
|
89
|
+
setSelectionNoUndo(doc, sel, options)
|
90
|
+
} else {
|
91
|
+
setSelection(doc, sel, options)
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
// Set a new selection.
|
96
|
+
export function setSelection(doc, sel, options) {
|
97
|
+
setSelectionNoUndo(doc, sel, options)
|
98
|
+
addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options)
|
99
|
+
}
|
100
|
+
|
101
|
+
export function setSelectionNoUndo(doc, sel, options) {
|
102
|
+
if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
|
103
|
+
sel = filterSelectionChange(doc, sel, options)
|
104
|
+
|
105
|
+
let bias = options && options.bias ||
|
106
|
+
(cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1)
|
107
|
+
setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true))
|
108
|
+
|
109
|
+
if (!(options && options.scroll === false) && doc.cm)
|
110
|
+
ensureCursorVisible(doc.cm)
|
111
|
+
}
|
112
|
+
|
113
|
+
function setSelectionInner(doc, sel) {
|
114
|
+
if (sel.equals(doc.sel)) return
|
115
|
+
|
116
|
+
doc.sel = sel
|
117
|
+
|
118
|
+
if (doc.cm) {
|
119
|
+
doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true
|
120
|
+
signalCursorActivity(doc.cm)
|
121
|
+
}
|
122
|
+
signalLater(doc, "cursorActivity", doc)
|
123
|
+
}
|
124
|
+
|
125
|
+
// Verify that the selection does not partially select any atomic
|
126
|
+
// marked ranges.
|
127
|
+
export function reCheckSelection(doc) {
|
128
|
+
setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false))
|
129
|
+
}
|
130
|
+
|
131
|
+
// Return a selection that does not partially select any atomic
|
132
|
+
// ranges.
|
133
|
+
function skipAtomicInSelection(doc, sel, bias, mayClear) {
|
134
|
+
let out
|
135
|
+
for (let i = 0; i < sel.ranges.length; i++) {
|
136
|
+
let range = sel.ranges[i]
|
137
|
+
let old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]
|
138
|
+
let newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)
|
139
|
+
let newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear)
|
140
|
+
if (out || newAnchor != range.anchor || newHead != range.head) {
|
141
|
+
if (!out) out = sel.ranges.slice(0, i)
|
142
|
+
out[i] = new Range(newAnchor, newHead)
|
143
|
+
}
|
144
|
+
}
|
145
|
+
return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel
|
146
|
+
}
|
147
|
+
|
148
|
+
function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
|
149
|
+
let line = getLine(doc, pos.line)
|
150
|
+
if (line.markedSpans) for (let i = 0; i < line.markedSpans.length; ++i) {
|
151
|
+
let sp = line.markedSpans[i], m = sp.marker
|
152
|
+
if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
|
153
|
+
(sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
|
154
|
+
if (mayClear) {
|
155
|
+
signal(m, "beforeCursorEnter")
|
156
|
+
if (m.explicitlyCleared) {
|
157
|
+
if (!line.markedSpans) break
|
158
|
+
else {--i; continue}
|
159
|
+
}
|
160
|
+
}
|
161
|
+
if (!m.atomic) continue
|
162
|
+
|
163
|
+
if (oldPos) {
|
164
|
+
let near = m.find(dir < 0 ? 1 : -1), diff
|
165
|
+
if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
|
166
|
+
near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null)
|
167
|
+
if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
|
168
|
+
return skipAtomicInner(doc, near, pos, dir, mayClear)
|
169
|
+
}
|
170
|
+
|
171
|
+
let far = m.find(dir < 0 ? -1 : 1)
|
172
|
+
if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
|
173
|
+
far = movePos(doc, far, dir, far.line == pos.line ? line : null)
|
174
|
+
return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
|
175
|
+
}
|
176
|
+
}
|
177
|
+
return pos
|
178
|
+
}
|
179
|
+
|
180
|
+
// Ensure a given position is not inside an atomic range.
|
181
|
+
export function skipAtomic(doc, pos, oldPos, bias, mayClear) {
|
182
|
+
let dir = bias || 1
|
183
|
+
let found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
|
184
|
+
(!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
|
185
|
+
skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
|
186
|
+
(!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true))
|
187
|
+
if (!found) {
|
188
|
+
doc.cantEdit = true
|
189
|
+
return Pos(doc.first, 0)
|
190
|
+
}
|
191
|
+
return found
|
192
|
+
}
|
193
|
+
|
194
|
+
function movePos(doc, pos, dir, line) {
|
195
|
+
if (dir < 0 && pos.ch == 0) {
|
196
|
+
if (pos.line > doc.first) return clipPos(doc, Pos(pos.line - 1))
|
197
|
+
else return null
|
198
|
+
} else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
|
199
|
+
if (pos.line < doc.first + doc.size - 1) return Pos(pos.line + 1, 0)
|
200
|
+
else return null
|
201
|
+
} else {
|
202
|
+
return new Pos(pos.line, pos.ch + dir)
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
export function selectAll(cm) {
|
207
|
+
cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll)
|
208
|
+
}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
import { copyObj, createObj } from "./util/misc.js"
|
2
|
+
|
3
|
+
// Known modes, by name and by MIME
|
4
|
+
export let modes = {}, mimeModes = {}
|
5
|
+
|
6
|
+
// Extra arguments are stored as the mode's dependencies, which is
|
7
|
+
// used by (legacy) mechanisms like loadmode.js to automatically
|
8
|
+
// load a mode. (Preferred mechanism is the require/define calls.)
|
9
|
+
export function defineMode(name, mode) {
|
10
|
+
if (arguments.length > 2)
|
11
|
+
mode.dependencies = Array.prototype.slice.call(arguments, 2)
|
12
|
+
modes[name] = mode
|
13
|
+
}
|
14
|
+
|
15
|
+
export function defineMIME(mime, spec) {
|
16
|
+
mimeModes[mime] = spec
|
17
|
+
}
|
18
|
+
|
19
|
+
// Given a MIME type, a {name, ...options} config object, or a name
|
20
|
+
// string, return a mode config object.
|
21
|
+
export function resolveMode(spec) {
|
22
|
+
if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
|
23
|
+
spec = mimeModes[spec]
|
24
|
+
} else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
|
25
|
+
let found = mimeModes[spec.name]
|
26
|
+
if (typeof found == "string") found = {name: found}
|
27
|
+
spec = createObj(found, spec)
|
28
|
+
spec.name = found.name
|
29
|
+
} else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
|
30
|
+
return resolveMode("application/xml")
|
31
|
+
} else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
|
32
|
+
return resolveMode("application/json")
|
33
|
+
}
|
34
|
+
if (typeof spec == "string") return {name: spec}
|
35
|
+
else return spec || {name: "null"}
|
36
|
+
}
|
37
|
+
|
38
|
+
// Given a mode spec (anything that resolveMode accepts), find and
|
39
|
+
// initialize an actual mode object.
|
40
|
+
export function getMode(options, spec) {
|
41
|
+
spec = resolveMode(spec)
|
42
|
+
let mfactory = modes[spec.name]
|
43
|
+
if (!mfactory) return getMode(options, "text/plain")
|
44
|
+
let modeObj = mfactory(options, spec)
|
45
|
+
if (modeExtensions.hasOwnProperty(spec.name)) {
|
46
|
+
let exts = modeExtensions[spec.name]
|
47
|
+
for (let prop in exts) {
|
48
|
+
if (!exts.hasOwnProperty(prop)) continue
|
49
|
+
if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop]
|
50
|
+
modeObj[prop] = exts[prop]
|
51
|
+
}
|
52
|
+
}
|
53
|
+
modeObj.name = spec.name
|
54
|
+
if (spec.helperType) modeObj.helperType = spec.helperType
|
55
|
+
if (spec.modeProps) for (let prop in spec.modeProps)
|
56
|
+
modeObj[prop] = spec.modeProps[prop]
|
57
|
+
|
58
|
+
return modeObj
|
59
|
+
}
|
60
|
+
|
61
|
+
// This can be used to attach properties to mode objects from
|
62
|
+
// outside the actual mode definition.
|
63
|
+
export let modeExtensions = {}
|
64
|
+
export function extendMode(mode, properties) {
|
65
|
+
let exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {})
|
66
|
+
copyObj(properties, exts)
|
67
|
+
}
|
68
|
+
|
69
|
+
export function copyState(mode, state) {
|
70
|
+
if (state === true) return state
|
71
|
+
if (mode.copyState) return mode.copyState(state)
|
72
|
+
let nstate = {}
|
73
|
+
for (let n in state) {
|
74
|
+
let val = state[n]
|
75
|
+
if (val instanceof Array) val = val.concat([])
|
76
|
+
nstate[n] = val
|
77
|
+
}
|
78
|
+
return nstate
|
79
|
+
}
|
80
|
+
|
81
|
+
// Given a mode and a state (for that mode), find the inner mode and
|
82
|
+
// state at the position that the state refers to.
|
83
|
+
export function innerMode(mode, state) {
|
84
|
+
let info
|
85
|
+
while (mode.innerMode) {
|
86
|
+
info = mode.innerMode(state)
|
87
|
+
if (!info || info.mode == mode) break
|
88
|
+
state = info.state
|
89
|
+
mode = info.mode
|
90
|
+
}
|
91
|
+
return info || {mode: mode, state: state}
|
92
|
+
}
|
93
|
+
|
94
|
+
export function startState(mode, a1, a2) {
|
95
|
+
return mode.startState ? mode.startState(a1, a2) : true
|
96
|
+
}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import { countColumn } from "./misc.js"
|
2
|
+
|
3
|
+
// STRING STREAM
|
4
|
+
|
5
|
+
// Fed to the mode parsers, provides helper functions to make
|
6
|
+
// parsers more succinct.
|
7
|
+
|
8
|
+
class StringStream {
|
9
|
+
constructor(string, tabSize, lineOracle) {
|
10
|
+
this.pos = this.start = 0
|
11
|
+
this.string = string
|
12
|
+
this.tabSize = tabSize || 8
|
13
|
+
this.lastColumnPos = this.lastColumnValue = 0
|
14
|
+
this.lineStart = 0
|
15
|
+
this.lineOracle = lineOracle
|
16
|
+
}
|
17
|
+
|
18
|
+
eol() {return this.pos >= this.string.length}
|
19
|
+
sol() {return this.pos == this.lineStart}
|
20
|
+
peek() {return this.string.charAt(this.pos) || undefined}
|
21
|
+
next() {
|
22
|
+
if (this.pos < this.string.length)
|
23
|
+
return this.string.charAt(this.pos++)
|
24
|
+
}
|
25
|
+
eat(match) {
|
26
|
+
let ch = this.string.charAt(this.pos)
|
27
|
+
let ok
|
28
|
+
if (typeof match == "string") ok = ch == match
|
29
|
+
else ok = ch && (match.test ? match.test(ch) : match(ch))
|
30
|
+
if (ok) {++this.pos; return ch}
|
31
|
+
}
|
32
|
+
eatWhile(match) {
|
33
|
+
let start = this.pos
|
34
|
+
while (this.eat(match)){}
|
35
|
+
return this.pos > start
|
36
|
+
}
|
37
|
+
eatSpace() {
|
38
|
+
let start = this.pos
|
39
|
+
while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos
|
40
|
+
return this.pos > start
|
41
|
+
}
|
42
|
+
skipToEnd() {this.pos = this.string.length}
|
43
|
+
skipTo(ch) {
|
44
|
+
let found = this.string.indexOf(ch, this.pos)
|
45
|
+
if (found > -1) {this.pos = found; return true}
|
46
|
+
}
|
47
|
+
backUp(n) {this.pos -= n}
|
48
|
+
column() {
|
49
|
+
if (this.lastColumnPos < this.start) {
|
50
|
+
this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue)
|
51
|
+
this.lastColumnPos = this.start
|
52
|
+
}
|
53
|
+
return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
|
54
|
+
}
|
55
|
+
indentation() {
|
56
|
+
return countColumn(this.string, null, this.tabSize) -
|
57
|
+
(this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
|
58
|
+
}
|
59
|
+
match(pattern, consume, caseInsensitive) {
|
60
|
+
if (typeof pattern == "string") {
|
61
|
+
let cased = str => caseInsensitive ? str.toLowerCase() : str
|
62
|
+
let substr = this.string.substr(this.pos, pattern.length)
|
63
|
+
if (cased(substr) == cased(pattern)) {
|
64
|
+
if (consume !== false) this.pos += pattern.length
|
65
|
+
return true
|
66
|
+
}
|
67
|
+
} else {
|
68
|
+
let match = this.string.slice(this.pos).match(pattern)
|
69
|
+
if (match && match.index > 0) return null
|
70
|
+
if (match && consume !== false) this.pos += match[0].length
|
71
|
+
return match
|
72
|
+
}
|
73
|
+
}
|
74
|
+
current(){return this.string.slice(this.start, this.pos)}
|
75
|
+
hideFirstChars(n, inner) {
|
76
|
+
this.lineStart += n
|
77
|
+
try { return inner() }
|
78
|
+
finally { this.lineStart -= n }
|
79
|
+
}
|
80
|
+
lookAhead(n) {
|
81
|
+
let oracle = this.lineOracle
|
82
|
+
return oracle && oracle.lookAhead(n)
|
83
|
+
}
|
84
|
+
baseToken() {
|
85
|
+
let oracle = this.lineOracle
|
86
|
+
return oracle && oracle.baseToken(this.pos)
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
export default StringStream
|