From a35c84b51283fdeafab7a911c04244b97cf3b3f2 Mon Sep 17 00:00:00 2001 From: LingYuZhao <113756063+BeardedManZhao@users.noreply.github.com> Date: Fri, 23 Aug 2024 19:22:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E5=8C=96?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E5=B8=83=201.0.7=20=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 + web/FileExplorer.html | 9 +- web/WEB-INF/web.xml | 2 +- web/css/public.css | 8 + web/editor.md/.jshintrc | 36 +- web/editor.md/CHANGE.md | 108 +- web/editor.md/Gulpfile.js | 336 +- web/editor.md/README.md | 34 +- web/editor.md/css/editormd.css | 3643 ++-- web/editor.md/css/editormd.logo.css | 68 +- web/editor.md/css/editormd.preview.css | 2422 ++- web/editor.md/docs/editormd.js.html | 19 +- .../docs/fonts/OpenSans-Bold-webfont.svg | 3838 ++-- .../fonts/OpenSans-BoldItalic-webfont.svg | 3843 ++-- .../docs/fonts/OpenSans-Italic-webfont.svg | 3843 ++-- .../docs/fonts/OpenSans-Light-webfont.svg | 3838 ++-- .../fonts/OpenSans-LightItalic-webfont.svg | 3850 ++-- .../docs/fonts/OpenSans-Regular-webfont.svg | 3842 ++-- web/editor.md/docs/index.html | 39 +- web/editor.md/docs/scripts/linenumber.js | 2 +- web/editor.md/docs/styles/jsdoc-default.css | 190 +- web/editor.md/docs/styles/prettify-jsdoc.css | 92 +- .../docs/styles/prettify-tomorrow.css | 207 +- web/editor.md/editormd.amd.js | 4467 ++-- web/editor.md/examples/@links.html | 74 +- web/editor.md/examples/auto-height.html | 84 +- web/editor.md/examples/change-mode.html | 250 +- web/editor.md/examples/code-fold.html | 80 +- web/editor.md/examples/css/style.css | 11 +- .../examples/custom-keyboard-shortcuts.html | 143 +- web/editor.md/examples/custom-toolbar.html | 192 +- web/editor.md/examples/define-plugin.html | 112 +- .../examples/delay-renderer-preview.html | 87 +- .../examples/dynamic-create-editormd.html | 82 +- web/editor.md/examples/emoji.html | 116 +- web/editor.md/examples/extends.html | 164 +- web/editor.md/examples/external-use.html | 164 +- web/editor.md/examples/flowchart.html | 61 +- web/editor.md/examples/form-get-value.html | 84 +- web/editor.md/examples/full.html | 454 +- web/editor.md/examples/goto-line.html | 160 +- ...markdown-to-html-custom-toc-container.html | 250 +- .../html-preview-markdown-to-html.html | 174 +- web/editor.md/examples/html-tags-decode.html | 99 +- .../examples/image-cross-domain-upload.html | 88 +- web/editor.md/examples/image-upload.html | 92 +- web/editor.md/examples/index.html | 700 +- web/editor.md/examples/js/seajs-main.js | 54 +- web/editor.md/examples/katex.html | 67 +- .../examples/manually-load-modules.html | 116 +- web/editor.md/examples/multi-editormd.html | 118 +- web/editor.md/examples/multi-languages.html | 141 +- web/editor.md/examples/on-off.html | 118 +- web/editor.md/examples/onchange.html | 70 +- web/editor.md/examples/onfullscreen.html | 72 +- web/editor.md/examples/onload.html | 74 +- .../examples/onpreviewing-onpreviewed.html | 77 +- web/editor.md/examples/onresize.html | 64 +- .../examples/onscroll-onpreviewscroll.html | 80 +- web/editor.md/examples/onwatch-onunwatch.html | 68 +- web/editor.md/examples/page-break.html | 96 +- .../examples/php/upload_callback.html | 52 +- web/editor.md/examples/readonly.html | 90 +- web/editor.md/examples/resettings.html | 239 +- web/editor.md/examples/search-replace.html | 84 +- web/editor.md/examples/sequence-diagram.html | 61 +- .../examples/set-get-replace-selection.html | 136 +- web/editor.md/examples/simple.html | 78 +- web/editor.md/examples/sync-scrolling.html | 90 +- web/editor.md/examples/task-lists.html | 66 +- web/editor.md/examples/test.md | 118 +- web/editor.md/examples/themes.html | 235 +- web/editor.md/examples/toc.html | 184 +- .../examples/toolbar-auto-fixed.html | 92 +- web/editor.md/examples/use-requirejs.html | 338 +- web/editor.md/examples/use-seajs.html | 342 +- web/editor.md/examples/use-zepto.html | 226 +- web/editor.md/fonts/editormd-logo.svg | 20 +- web/editor.md/fonts/fontawesome-webfont.svg | 1646 +- web/editor.md/languages/en.js | 196 +- web/editor.md/languages/zh-tw.js | 196 +- web/editor.md/lib/codemirror/README.md | 4 +- .../lib/codemirror/addon/comment/comment.js | 324 +- .../addon/comment/continuecomment.js | 148 +- .../lib/codemirror/addon/dialog/dialog.css | 37 +- .../lib/codemirror/addon/dialog/dialog.js | 289 +- .../codemirror/addon/display/fullscreen.css | 11 +- .../codemirror/addon/display/fullscreen.js | 71 +- .../lib/codemirror/addon/display/panel.js | 164 +- .../codemirror/addon/display/placeholder.js | 102 +- .../lib/codemirror/addon/display/rulers.js | 108 +- .../codemirror/addon/edit/closebrackets.js | 298 +- .../lib/codemirror/addon/edit/closetag.js | 256 +- .../lib/codemirror/addon/edit/continuelist.js | 82 +- .../codemirror/addon/edit/matchbrackets.js | 206 +- .../lib/codemirror/addon/edit/matchtags.js | 115 +- .../codemirror/addon/edit/trailingspace.js | 50 +- .../lib/codemirror/addon/fold/brace-fold.js | 192 +- .../lib/codemirror/addon/fold/comment-fold.js | 104 +- .../lib/codemirror/addon/fold/foldcode.js | 268 +- .../lib/codemirror/addon/fold/foldgutter.css | 22 +- .../lib/codemirror/addon/fold/foldgutter.js | 257 +- .../lib/codemirror/addon/fold/indent-fold.js | 76 +- .../codemirror/addon/fold/markdown-fold.js | 88 +- .../lib/codemirror/addon/fold/xml-fold.js | 364 +- .../lib/codemirror/addon/hint/anyword-hint.js | 67 +- .../lib/codemirror/addon/hint/css-hint.js | 106 +- .../lib/codemirror/addon/hint/html-hint.js | 681 +- .../codemirror/addon/hint/javascript-hint.js | 258 +- .../lib/codemirror/addon/hint/show-hint.css | 52 +- .../lib/codemirror/addon/hint/show-hint.js | 784 +- .../lib/codemirror/addon/hint/sql-hint.js | 434 +- .../lib/codemirror/addon/hint/xml-hint.js | 198 +- .../addon/lint/coffeescript-lint.js | 58 +- .../lib/codemirror/addon/lint/css-lint.js | 49 +- .../codemirror/addon/lint/javascript-lint.js | 252 +- .../lib/codemirror/addon/lint/json-lint.js | 44 +- .../lib/codemirror/addon/lint/lint.css | 85 +- .../lib/codemirror/addon/lint/lint.js | 413 +- .../lib/codemirror/addon/lint/yaml-lint.js | 41 +- .../lib/codemirror/addon/merge/merge.css | 199 +- .../lib/codemirror/addon/merge/merge.js | 1538 +- .../lib/codemirror/addon/mode/loadmode.js | 116 +- .../lib/codemirror/addon/mode/multiplex.js | 207 +- .../codemirror/addon/mode/multiplex_test.js | 48 +- .../lib/codemirror/addon/mode/overlay.js | 130 +- .../lib/codemirror/addon/mode/simple.js | 414 +- .../lib/codemirror/addon/runmode/colorize.js | 58 +- .../addon/runmode/runmode-standalone.js | 319 +- .../lib/codemirror/addon/runmode/runmode.js | 124 +- .../codemirror/addon/runmode/runmode.node.js | 215 +- .../addon/scroll/annotatescrollbar.js | 172 +- .../codemirror/addon/scroll/scrollpastend.js | 76 +- .../addon/scroll/simplescrollbars.css | 70 +- .../addon/scroll/simplescrollbars.js | 272 +- .../addon/search/match-highlighter.js | 200 +- .../addon/search/matchesonscrollbar.css | 12 +- .../addon/search/matchesonscrollbar.js | 164 +- .../lib/codemirror/addon/search/search.js | 332 +- .../codemirror/addon/search/searchcursor.js | 357 +- .../codemirror/addon/selection/active-line.js | 108 +- .../addon/selection/mark-selection.js | 190 +- .../addon/selection/selection-pointer.js | 174 +- .../lib/codemirror/addon/tern/tern.css | 138 +- .../lib/codemirror/addon/tern/tern.js | 1299 +- .../lib/codemirror/addon/tern/worker.js | 60 +- .../lib/codemirror/addon/wrap/hardwrap.js | 251 +- web/editor.md/lib/codemirror/bower.json | 7 +- .../lib/codemirror/lib/codemirror.css | 540 +- .../lib/codemirror/lib/codemirror.js | 17908 ++++++++-------- web/editor.md/lib/codemirror/mode/apl/apl.js | 332 +- .../lib/codemirror/mode/apl/index.html | 52 +- .../lib/codemirror/mode/asterisk/asterisk.js | 346 +- .../lib/codemirror/mode/asterisk/index.html | 53 +- .../lib/codemirror/mode/clike/clike.js | 956 +- .../lib/codemirror/mode/clike/index.html | 124 +- .../lib/codemirror/mode/clike/scala.html | 48 +- .../lib/codemirror/mode/clojure/clojure.js | 414 +- .../lib/codemirror/mode/clojure/index.html | 38 +- .../lib/codemirror/mode/cobol/cobol.js | 484 +- .../lib/codemirror/mode/cobol/index.html | 191 +- .../mode/coffeescript/coffeescript.js | 706 +- .../codemirror/mode/coffeescript/index.html | 39 +- .../codemirror/mode/commonlisp/commonlisp.js | 238 +- .../lib/codemirror/mode/commonlisp/index.html | 38 +- web/editor.md/lib/codemirror/mode/css/css.js | 1521 +- .../lib/codemirror/mode/css/index.html | 48 +- .../lib/codemirror/mode/css/less.html | 50 +- .../lib/codemirror/mode/css/less_test.js | 87 +- .../lib/codemirror/mode/css/scss.html | 49 +- .../lib/codemirror/mode/css/scss_test.js | 157 +- web/editor.md/lib/codemirror/mode/css/test.js | 377 +- .../lib/codemirror/mode/cypher/cypher.js | 262 +- .../lib/codemirror/mode/cypher/index.html | 84 +- web/editor.md/lib/codemirror/mode/d/d.js | 426 +- .../lib/codemirror/mode/d/index.html | 50 +- .../lib/codemirror/mode/dart/dart.js | 82 +- .../lib/codemirror/mode/dart/index.html | 46 +- .../lib/codemirror/mode/diff/diff.js | 84 +- .../lib/codemirror/mode/diff/index.html | 60 +- .../lib/codemirror/mode/django/django.js | 114 +- .../lib/codemirror/mode/django/index.html | 47 +- .../codemirror/mode/dockerfile/dockerfile.js | 138 +- .../lib/codemirror/mode/dockerfile/index.html | 45 +- web/editor.md/lib/codemirror/mode/dtd/dtd.js | 260 +- .../lib/codemirror/mode/dtd/index.html | 47 +- .../lib/codemirror/mode/dylan/dylan.js | 576 +- .../lib/codemirror/mode/dylan/index.html | 53 +- .../lib/codemirror/mode/ebnf/ebnf.js | 350 +- .../lib/codemirror/mode/ebnf/index.html | 53 +- web/editor.md/lib/codemirror/mode/ecl/ecl.js | 394 +- .../lib/codemirror/mode/ecl/index.html | 41 +- .../lib/codemirror/mode/eiffel/eiffel.js | 299 +- .../lib/codemirror/mode/eiffel/index.html | 62 +- .../lib/codemirror/mode/erlang/erlang.js | 1181 +- .../lib/codemirror/mode/erlang/index.html | 49 +- .../lib/codemirror/mode/forth/forth.js | 331 +- .../lib/codemirror/mode/forth/index.html | 67 +- .../lib/codemirror/mode/fortran/fortran.js | 340 +- .../lib/codemirror/mode/fortran/index.html | 45 +- web/editor.md/lib/codemirror/mode/gas/gas.js | 670 +- .../lib/codemirror/mode/gas/index.html | 52 +- web/editor.md/lib/codemirror/mode/gfm/gfm.js | 228 +- .../lib/codemirror/mode/gfm/index.html | 50 +- web/editor.md/lib/codemirror/mode/gfm/test.js | 325 +- .../lib/codemirror/mode/gherkin/gherkin.js | 312 +- .../lib/codemirror/mode/gherkin/index.html | 37 +- web/editor.md/lib/codemirror/mode/go/go.js | 365 +- .../lib/codemirror/mode/go/index.html | 53 +- .../lib/codemirror/mode/groovy/groovy.js | 456 +- .../lib/codemirror/mode/groovy/index.html | 45 +- .../lib/codemirror/mode/haml/haml.js | 278 +- .../lib/codemirror/mode/haml/index.html | 45 +- .../lib/codemirror/mode/haml/test.js | 189 +- .../lib/codemirror/mode/haskell/haskell.js | 511 +- .../lib/codemirror/mode/haskell/index.html | 47 +- .../lib/codemirror/mode/haxe/haxe.js | 1056 +- .../lib/codemirror/mode/haxe/index.html | 67 +- .../mode/htmlembedded/htmlembedded.js | 136 +- .../codemirror/mode/htmlembedded/index.html | 53 +- .../codemirror/mode/htmlmixed/htmlmixed.js | 223 +- .../lib/codemirror/mode/htmlmixed/index.html | 87 +- .../lib/codemirror/mode/http/http.js | 190 +- .../lib/codemirror/mode/http/index.html | 39 +- web/editor.md/lib/codemirror/mode/idl/idl.js | 553 +- .../lib/codemirror/mode/idl/index.html | 49 +- web/editor.md/lib/codemirror/mode/index.html | 238 +- .../lib/codemirror/mode/jade/index.html | 47 +- .../lib/codemirror/mode/jade/jade.js | 1179 +- .../lib/codemirror/mode/javascript/index.html | 83 +- .../codemirror/mode/javascript/javascript.js | 1485 +- .../codemirror/mode/javascript/json-ld.html | 49 +- .../lib/codemirror/mode/javascript/test.js | 396 +- .../mode/javascript/typescript.html | 47 +- .../lib/codemirror/mode/jinja2/index.html | 43 +- .../lib/codemirror/mode/jinja2/jinja2.js | 260 +- .../lib/codemirror/mode/julia/index.html | 48 +- .../lib/codemirror/mode/julia/julia.js | 594 +- .../lib/codemirror/mode/kotlin/index.html | 35 +- .../lib/codemirror/mode/kotlin/kotlin.js | 530 +- .../lib/codemirror/mode/livescript/index.html | 48 +- .../codemirror/mode/livescript/livescript.js | 516 +- .../lib/codemirror/mode/lua/index.html | 54 +- web/editor.md/lib/codemirror/mode/lua/lua.js | 305 +- .../lib/codemirror/mode/markdown/index.html | 70 +- .../lib/codemirror/mode/markdown/markdown.js | 1494 +- .../lib/codemirror/mode/markdown/test.js | 1379 +- web/editor.md/lib/codemirror/mode/meta.js | 386 +- .../lib/codemirror/mode/mirc/index.html | 50 +- .../lib/codemirror/mode/mirc/mirc.js | 365 +- .../lib/codemirror/mode/mllike/index.html | 65 +- .../lib/codemirror/mode/mllike/mllike.js | 380 +- .../lib/codemirror/mode/modelica/index.html | 50 +- .../lib/codemirror/mode/modelica/modelica.js | 412 +- .../lib/codemirror/mode/nginx/index.html | 50 +- .../lib/codemirror/mode/nginx/nginx.js | 343 +- .../lib/codemirror/mode/ntriples/index.html | 40 +- .../lib/codemirror/mode/ntriples/ntriples.js | 349 +- .../lib/codemirror/mode/octave/index.html | 49 +- .../lib/codemirror/mode/octave/octave.js | 294 +- .../lib/codemirror/mode/pascal/index.html | 45 +- .../lib/codemirror/mode/pascal/pascal.js | 192 +- .../lib/codemirror/mode/pegjs/index.html | 51 +- .../lib/codemirror/mode/pegjs/pegjs.js | 207 +- .../lib/codemirror/mode/perl/index.html | 43 +- .../lib/codemirror/mode/perl/perl.js | 1674 +- .../lib/codemirror/mode/php/index.html | 56 +- web/editor.md/lib/codemirror/mode/php/php.js | 430 +- web/editor.md/lib/codemirror/mode/php/test.js | 303 +- .../lib/codemirror/mode/pig/index.html | 48 +- web/editor.md/lib/codemirror/mode/pig/pig.js | 343 +- .../lib/codemirror/mode/properties/index.html | 39 +- .../codemirror/mode/properties/properties.js | 125 +- .../lib/codemirror/mode/puppet/index.html | 54 +- .../lib/codemirror/mode/puppet/puppet.js | 415 +- .../lib/codemirror/mode/python/index.html | 124 +- .../lib/codemirror/mode/python/python.js | 671 +- .../lib/codemirror/mode/q/index.html | 43 +- web/editor.md/lib/codemirror/mode/q/q.js | 286 +- .../lib/codemirror/mode/r/index.html | 65 +- web/editor.md/lib/codemirror/mode/r/r.js | 305 +- .../codemirror/mode/rpm/changes/index.html | 47 +- .../lib/codemirror/mode/rpm/index.html | 63 +- web/editor.md/lib/codemirror/mode/rpm/rpm.js | 207 +- .../lib/codemirror/mode/rst/index.html | 43 +- web/editor.md/lib/codemirror/mode/rst/rst.js | 1063 +- .../lib/codemirror/mode/ruby/index.html | 56 +- .../lib/codemirror/mode/ruby/ruby.js | 529 +- .../lib/codemirror/mode/ruby/test.js | 17 +- .../lib/codemirror/mode/rust/index.html | 43 +- .../lib/codemirror/mode/rust/rust.js | 1009 +- .../lib/codemirror/mode/sass/index.html | 44 +- .../lib/codemirror/mode/sass/sass.js | 766 +- .../lib/codemirror/mode/scheme/index.html | 36 +- .../lib/codemirror/mode/scheme/scheme.js | 429 +- .../lib/codemirror/mode/shell/index.html | 49 +- .../lib/codemirror/mode/shell/shell.js | 267 +- .../lib/codemirror/mode/shell/test.js | 111 +- .../lib/codemirror/mode/sieve/index.html | 36 +- .../lib/codemirror/mode/sieve/sieve.js | 376 +- .../lib/codemirror/mode/slim/index.html | 74 +- .../lib/codemirror/mode/slim/slim.js | 1148 +- .../lib/codemirror/mode/slim/test.js | 139 +- .../lib/codemirror/mode/smalltalk/index.html | 61 +- .../codemirror/mode/smalltalk/smalltalk.js | 322 +- .../lib/codemirror/mode/smarty/index.html | 85 +- .../lib/codemirror/mode/smarty/smarty.js | 417 +- .../codemirror/mode/smartymixed/index.html | 50 +- .../mode/smartymixed/smartymixed.js | 368 +- .../lib/codemirror/mode/solr/index.html | 62 +- .../lib/codemirror/mode/solr/solr.js | 198 +- .../lib/codemirror/mode/soy/index.html | 49 +- web/editor.md/lib/codemirror/mode/soy/soy.js | 376 +- .../lib/codemirror/mode/sparql/index.html | 45 +- .../lib/codemirror/mode/sparql/sparql.js | 327 +- .../codemirror/mode/spreadsheet/index.html | 55 +- .../mode/spreadsheet/spreadsheet.js | 192 +- .../lib/codemirror/mode/sql/index.html | 106 +- web/editor.md/lib/codemirror/mode/sql/sql.js | 709 +- .../lib/codemirror/mode/stex/index.html | 39 +- .../lib/codemirror/mode/stex/stex.js | 478 +- .../lib/codemirror/mode/stex/test.js | 167 +- .../lib/codemirror/mode/stylus/index.html | 52 +- .../lib/codemirror/mode/stylus/stylus.js | 834 +- .../lib/codemirror/mode/tcl/index.html | 46 +- web/editor.md/lib/codemirror/mode/tcl/tcl.js | 265 +- .../lib/codemirror/mode/textile/index.html | 33 +- .../lib/codemirror/mode/textile/test.js | 727 +- .../lib/codemirror/mode/textile/textile.js | 874 +- .../lib/codemirror/mode/tiddlywiki/index.html | 49 +- .../codemirror/mode/tiddlywiki/tiddlywiki.css | 15 +- .../codemirror/mode/tiddlywiki/tiddlywiki.js | 718 +- .../lib/codemirror/mode/tiki/index.html | 49 +- .../lib/codemirror/mode/tiki/tiki.css | 21 +- .../lib/codemirror/mode/tiki/tiki.js | 642 +- .../lib/codemirror/mode/toml/index.html | 45 +- .../lib/codemirror/mode/toml/toml.js | 164 +- .../lib/codemirror/mode/tornado/index.html | 47 +- .../lib/codemirror/mode/tornado/tornado.js | 116 +- .../lib/codemirror/mode/turtle/index.html | 45 +- .../lib/codemirror/mode/turtle/turtle.js | 300 +- .../lib/codemirror/mode/vb/index.html | 196 +- web/editor.md/lib/codemirror/mode/vb/vb.js | 466 +- .../lib/codemirror/mode/vbscript/index.html | 45 +- .../lib/codemirror/mode/vbscript/vbscript.js | 588 +- .../lib/codemirror/mode/velocity/index.html | 50 +- .../lib/codemirror/mode/velocity/velocity.js | 341 +- .../lib/codemirror/mode/verilog/index.html | 71 +- .../lib/codemirror/mode/verilog/test.js | 539 +- .../lib/codemirror/mode/verilog/verilog.js | 1040 +- .../lib/codemirror/mode/xml/index.html | 59 +- web/editor.md/lib/codemirror/mode/xml/test.js | 95 +- web/editor.md/lib/codemirror/mode/xml/xml.js | 726 +- .../lib/codemirror/mode/xquery/index.html | 83 +- .../lib/codemirror/mode/xquery/test.js | 101 +- .../lib/codemirror/mode/xquery/xquery.js | 896 +- .../lib/codemirror/mode/yaml/index.html | 37 +- .../lib/codemirror/mode/yaml/yaml.js | 228 +- .../lib/codemirror/mode/z80/index.html | 43 +- web/editor.md/lib/codemirror/mode/z80/z80.js | 166 +- web/editor.md/lib/codemirror/package.json | 58 +- .../lib/codemirror/theme/3024-day.css | 129 +- .../lib/codemirror/theme/3024-night.css | 128 +- .../lib/codemirror/theme/ambiance-mobile.css | 6 +- .../lib/codemirror/theme/ambiance.css | 191 +- .../lib/codemirror/theme/base16-dark.css | 127 +- .../lib/codemirror/theme/base16-light.css | 127 +- .../lib/codemirror/theme/blackboard.css | 145 +- web/editor.md/lib/codemirror/theme/cobalt.css | 119 +- .../lib/codemirror/theme/colorforth.css | 141 +- .../lib/codemirror/theme/eclipse.css | 113 +- .../lib/codemirror/theme/elegant.css | 65 +- .../lib/codemirror/theme/erlang-dark.css | 164 +- .../lib/codemirror/theme/lesser-dark.css | 197 +- web/editor.md/lib/codemirror/theme/mbo.css | 142 +- .../lib/codemirror/theme/mdn-like.css | 173 +- .../lib/codemirror/theme/midnight.css | 121 +- .../lib/codemirror/theme/monokai.css | 126 +- web/editor.md/lib/codemirror/theme/neat.css | 62 +- web/editor.md/lib/codemirror/theme/neo.css | 65 +- web/editor.md/lib/codemirror/theme/night.css | 124 +- .../lib/codemirror/theme/paraiso-dark.css | 127 +- .../lib/codemirror/theme/paraiso-light.css | 127 +- .../lib/codemirror/theme/pastel-on-dark.css | 143 +- .../lib/codemirror/theme/rubyblue.css | 120 +- .../lib/codemirror/theme/solarized.css | 316 +- .../lib/codemirror/theme/the-matrix.css | 144 +- .../theme/tomorrow-night-bright.css | 117 +- .../theme/tomorrow-night-eighties.css | 127 +- .../lib/codemirror/theme/twilight.css | 171 +- .../lib/codemirror/theme/vibrant-ink.css | 151 +- .../lib/codemirror/theme/xq-dark.css | 148 +- .../lib/codemirror/theme/xq-light.css | 103 +- .../lib/codemirror/theme/zenburn.css | 140 +- .../code-block-dialog/code-block-dialog.js | 328 +- .../plugins/emoji-dialog/emoji-dialog.js | 472 +- web/editor.md/plugins/emoji-dialog/emoji.json | 3049 ++- .../goto-line-dialog/goto-line-dialog.js | 243 +- .../plugins/help-dialog/help-dialog.js | 150 +- web/editor.md/plugins/help-dialog/help.md | 94 +- .../html-entities-dialog.js | 282 +- .../html-entities-dialog/html-entities.json | 1862 +- .../plugins/image-dialog/image-dialog.js | 207 +- .../plugins/link-dialog/link-dialog.js | 121 +- web/editor.md/plugins/plugin-template.js | 156 +- .../preformatted-text-dialog.js | 206 +- .../reference-link-dialog.js | 156 +- .../plugins/table-dialog/table-dialog.js | 354 +- .../plugins/test-plugin/test-plugin.js | 66 +- web/editor.md/scss/editormd.codemirror.scss | 141 +- web/editor.md/scss/editormd.dialog.scss | 256 +- web/editor.md/scss/editormd.form.scss | 197 +- web/editor.md/scss/editormd.grid.scss | 50 +- web/editor.md/scss/editormd.logo.scss | 96 +- web/editor.md/scss/editormd.menu.scss | 188 +- web/editor.md/scss/editormd.preview.scss | 512 +- .../scss/editormd.preview.themes.scss | 291 +- web/editor.md/scss/editormd.scss | 200 +- web/editor.md/scss/editormd.tab.scss | 68 +- web/editor.md/scss/editormd.themes.scss | 38 +- web/editor.md/scss/font-awesome.scss | 550 + web/editor.md/scss/github-markdown.scss | 19 +- web/editor.md/scss/lib/prefixes.scss | 742 +- web/editor.md/scss/lib/variables.scss | 14 +- web/editor.md/scss/prettify.scss | 121 +- web/editor.md/src/editormd.js | 4415 ++-- web/editor.md/tests/bootstrap-test.html | 115 +- .../tests/codemirror-searchbox-test.html | 207 +- web/editor.md/tests/codemirror-test.html | 140 +- web/editor.md/tests/js/searchbox.js | 728 +- web/editor.md/tests/katex-tests.html | 233 +- web/editor.md/tests/marked-@at-test.html | 369 +- web/editor.md/tests/marked-emoji-test.html | 384 +- .../tests/marked-heading-link-test.html | 266 +- .../tests/marked-todo-list-test.html | 113 +- web/editor.md/tests/qunit/qunit-1.16.0.css | 248 +- web/editor.md/tests/qunit/qunit-1.16.0.js | 5421 ++--- web/js/conf/indexConfig.js | 4 +- web/js/main.js | 33 +- 439 files changed, 86348 insertions(+), 75807 deletions(-) diff --git a/README.md b/README.md index eece425..a3ae5fd 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,10 @@ const indexConfig = { ## 更新记录 +### 1.0.7 版本 发布 + +- 为 logo 图标增加了点击展示获取版本号的动作 + ### 1.0.6 版本 发布 - 新增文件上传进度显示支持 diff --git a/web/FileExplorer.html b/web/FileExplorer.html index a4445bf..5784128 100644 --- a/web/FileExplorer.html +++ b/web/FileExplorer.html @@ -12,6 +12,9 @@ +

MIME types defined: text/x-haxe, text/x-hxml.

- + diff --git a/web/editor.md/lib/codemirror/mode/htmlembedded/htmlembedded.js b/web/editor.md/lib/codemirror/mode/htmlembedded/htmlembedded.js index e8f7ba8..7f06441 100644 --- a/web/editor.md/lib/codemirror/mode/htmlembedded/htmlembedded.js +++ b/web/editor.md/lib/codemirror/mode/htmlembedded/htmlembedded.js @@ -1,86 +1,84 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../htmlmixed/htmlmixed"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../htmlmixed/htmlmixed"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("htmlembedded", function(config, parserConfig) { + CodeMirror.defineMode("htmlembedded", function (config, parserConfig) { - //config settings - var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i, - scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i; + //config settings + var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i, + scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i; - //inner modes - var scriptingMode, htmlMixedMode; + //inner modes + var scriptingMode, htmlMixedMode; - //tokenizer when in html mode - function htmlDispatch(stream, state) { - if (stream.match(scriptStartRegex, false)) { - state.token=scriptingDispatch; - return scriptingMode.token(stream, state.scriptState); - } - else - return htmlMixedMode.token(stream, state.htmlState); - } + //tokenizer when in html mode + function htmlDispatch(stream, state) { + if (stream.match(scriptStartRegex, false)) { + state.token = scriptingDispatch; + return scriptingMode.token(stream, state.scriptState); + } else + return htmlMixedMode.token(stream, state.htmlState); + } - //tokenizer when in scripting mode - function scriptingDispatch(stream, state) { - if (stream.match(scriptEndRegex, false)) { - state.token=htmlDispatch; - return htmlMixedMode.token(stream, state.htmlState); - } - else - return scriptingMode.token(stream, state.scriptState); - } + //tokenizer when in scripting mode + function scriptingDispatch(stream, state) { + if (stream.match(scriptEndRegex, false)) { + state.token = htmlDispatch; + return htmlMixedMode.token(stream, state.htmlState); + } else + return scriptingMode.token(stream, state.scriptState); + } - return { - startState: function() { - scriptingMode = scriptingMode || CodeMirror.getMode(config, parserConfig.scriptingModeSpec); - htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed"); - return { - token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch, - htmlState : CodeMirror.startState(htmlMixedMode), - scriptState : CodeMirror.startState(scriptingMode) - }; - }, + return { + startState: function () { + scriptingMode = scriptingMode || CodeMirror.getMode(config, parserConfig.scriptingModeSpec); + htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed"); + return { + token: parserConfig.startOpen ? scriptingDispatch : htmlDispatch, + htmlState: CodeMirror.startState(htmlMixedMode), + scriptState: CodeMirror.startState(scriptingMode) + }; + }, - token: function(stream, state) { - return state.token(stream, state); - }, + token: function (stream, state) { + return state.token(stream, state); + }, - indent: function(state, textAfter) { - if (state.token == htmlDispatch) - return htmlMixedMode.indent(state.htmlState, textAfter); - else if (scriptingMode.indent) - return scriptingMode.indent(state.scriptState, textAfter); - }, + indent: function (state, textAfter) { + if (state.token == htmlDispatch) + return htmlMixedMode.indent(state.htmlState, textAfter); + else if (scriptingMode.indent) + return scriptingMode.indent(state.scriptState, textAfter); + }, - copyState: function(state) { - return { - token : state.token, - htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState), - scriptState : CodeMirror.copyState(scriptingMode, state.scriptState) - }; - }, + copyState: function (state) { + return { + token: state.token, + htmlState: CodeMirror.copyState(htmlMixedMode, state.htmlState), + scriptState: CodeMirror.copyState(scriptingMode, state.scriptState) + }; + }, - innerMode: function(state) { - if (state.token == scriptingDispatch) return {state: state.scriptState, mode: scriptingMode}; - else return {state: state.htmlState, mode: htmlMixedMode}; - } - }; -}, "htmlmixed"); + innerMode: function (state) { + if (state.token == scriptingDispatch) return {state: state.scriptState, mode: scriptingMode}; + else return {state: state.htmlState, mode: htmlMixedMode}; + } + }; + }, "htmlmixed"); -CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"}); -CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingModeSpec:"text/x-csharp"}); -CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingModeSpec:"text/x-java"}); -CodeMirror.defineMIME("application/x-erb", { name: "htmlembedded", scriptingModeSpec:"ruby"}); + CodeMirror.defineMIME("application/x-ejs", {name: "htmlembedded", scriptingModeSpec: "javascript"}); + CodeMirror.defineMIME("application/x-aspx", {name: "htmlembedded", scriptingModeSpec: "text/x-csharp"}); + CodeMirror.defineMIME("application/x-jsp", {name: "htmlembedded", scriptingModeSpec: "text/x-java"}); + CodeMirror.defineMIME("application/x-erb", {name: "htmlembedded", scriptingModeSpec: "ruby"}); }); diff --git a/web/editor.md/lib/codemirror/mode/htmlembedded/index.html b/web/editor.md/lib/codemirror/mode/htmlembedded/index.html index 93d01c4..6b1af5a 100644 --- a/web/editor.md/lib/codemirror/mode/htmlembedded/index.html +++ b/web/editor.md/lib/codemirror/mode/htmlembedded/index.html @@ -2,33 +2,36 @@ CodeMirror: Html Embedded Scripts mode - + - + - +
-

Html Embedded Scripts mode

-

Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on - JavaScript, CSS and XML.
Other dependancies include those of the scriping language chosen.

+ JavaScript, CSS and XML.
Other dependancies include those of the scriping language chosen.

-

MIME types defined: application/x-aspx (ASP.NET), - application/x-ejs (Embedded Javascript), application/x-jsp (JavaServer Pages)

-
+

MIME types defined: application/x-aspx (ASP.NET), + application/x-ejs (Embedded Javascript), application/x-jsp (JavaServer Pages)

+ diff --git a/web/editor.md/lib/codemirror/mode/htmlmixed/htmlmixed.js b/web/editor.md/lib/codemirror/mode/htmlmixed/htmlmixed.js index 1cc438f..5fd872a 100644 --- a/web/editor.md/lib/codemirror/mode/htmlmixed/htmlmixed.js +++ b/web/editor.md/lib/codemirror/mode/htmlmixed/htmlmixed.js @@ -1,121 +1,132 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../xml/xml"), require("../javascript/javascript"), require("../css/css")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript", "../css/css"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../xml/xml"), require("../javascript/javascript"), require("../css/css")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript", "../css/css"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("htmlmixed", function(config, parserConfig) { - var htmlMode = CodeMirror.getMode(config, {name: "xml", - htmlMode: true, - multilineTagIndentFactor: parserConfig.multilineTagIndentFactor, - multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag}); - var cssMode = CodeMirror.getMode(config, "css"); + CodeMirror.defineMode("htmlmixed", function (config, parserConfig) { + var htmlMode = CodeMirror.getMode(config, { + name: "xml", + htmlMode: true, + multilineTagIndentFactor: parserConfig.multilineTagIndentFactor, + multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag + }); + var cssMode = CodeMirror.getMode(config, "css"); - var scriptTypes = [], scriptTypesConf = parserConfig && parserConfig.scriptTypes; - scriptTypes.push({matches: /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i, - mode: CodeMirror.getMode(config, "javascript")}); - if (scriptTypesConf) for (var i = 0; i < scriptTypesConf.length; ++i) { - var conf = scriptTypesConf[i]; - scriptTypes.push({matches: conf.matches, mode: conf.mode && CodeMirror.getMode(config, conf.mode)}); - } - scriptTypes.push({matches: /./, - mode: CodeMirror.getMode(config, "text/plain")}); + var scriptTypes = [], scriptTypesConf = parserConfig && parserConfig.scriptTypes; + scriptTypes.push({ + matches: /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i, + mode: CodeMirror.getMode(config, "javascript") + }); + if (scriptTypesConf) for (var i = 0; i < scriptTypesConf.length; ++i) { + var conf = scriptTypesConf[i]; + scriptTypes.push({matches: conf.matches, mode: conf.mode && CodeMirror.getMode(config, conf.mode)}); + } + scriptTypes.push({ + matches: /./, + mode: CodeMirror.getMode(config, "text/plain") + }); + + function html(stream, state) { + var tagName = state.htmlState.tagName; + if (tagName) tagName = tagName.toLowerCase(); + var style = htmlMode.token(stream, state.htmlState); + if (tagName == "script" && /\btag\b/.test(style) && stream.current() == ">") { + // Script block: mode to change to depends on type attribute + var scriptType = stream.string.slice(Math.max(0, stream.pos - 100), stream.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i); + scriptType = scriptType ? scriptType[1] : ""; + if (scriptType && /[\"\']/.test(scriptType.charAt(0))) scriptType = scriptType.slice(1, scriptType.length - 1); + for (var i = 0; i < scriptTypes.length; ++i) { + var tp = scriptTypes[i]; + if (typeof tp.matches == "string" ? scriptType == tp.matches : tp.matches.test(scriptType)) { + if (tp.mode) { + state.token = script; + state.localMode = tp.mode; + state.localState = tp.mode.startState && tp.mode.startState(htmlMode.indent(state.htmlState, "")); + } + break; + } + } + } else if (tagName == "style" && /\btag\b/.test(style) && stream.current() == ">") { + state.token = css; + state.localMode = cssMode; + state.localState = cssMode.startState(htmlMode.indent(state.htmlState, "")); + } + return style; + } + + function maybeBackup(stream, pat, style) { + var cur = stream.current(); + var close = cur.search(pat), m; + if (close > -1) stream.backUp(cur.length - close); + else if (m = cur.match(/<\/?$/)) { + stream.backUp(cur.length); + if (!stream.match(pat, false)) stream.match(cur); + } + return style; + } + + function script(stream, state) { + if (stream.match(/^<\/\s*script\s*>/i, false)) { + state.token = html; + state.localState = state.localMode = null; + return null; + } + return maybeBackup(stream, /<\/\s*script\s*>/, + state.localMode.token(stream, state.localState)); + } - function html(stream, state) { - var tagName = state.htmlState.tagName; - if (tagName) tagName = tagName.toLowerCase(); - var style = htmlMode.token(stream, state.htmlState); - if (tagName == "script" && /\btag\b/.test(style) && stream.current() == ">") { - // Script block: mode to change to depends on type attribute - var scriptType = stream.string.slice(Math.max(0, stream.pos - 100), stream.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i); - scriptType = scriptType ? scriptType[1] : ""; - if (scriptType && /[\"\']/.test(scriptType.charAt(0))) scriptType = scriptType.slice(1, scriptType.length - 1); - for (var i = 0; i < scriptTypes.length; ++i) { - var tp = scriptTypes[i]; - if (typeof tp.matches == "string" ? scriptType == tp.matches : tp.matches.test(scriptType)) { - if (tp.mode) { - state.token = script; - state.localMode = tp.mode; - state.localState = tp.mode.startState && tp.mode.startState(htmlMode.indent(state.htmlState, "")); - } - break; + function css(stream, state) { + if (stream.match(/^<\/\s*style\s*>/i, false)) { + state.token = html; + state.localState = state.localMode = null; + return null; + } + return maybeBackup(stream, /<\/\s*style\s*>/, + cssMode.token(stream, state.localState)); } - } - } else if (tagName == "style" && /\btag\b/.test(style) && stream.current() == ">") { - state.token = css; - state.localMode = cssMode; - state.localState = cssMode.startState(htmlMode.indent(state.htmlState, "")); - } - return style; - } - function maybeBackup(stream, pat, style) { - var cur = stream.current(); - var close = cur.search(pat), m; - if (close > -1) stream.backUp(cur.length - close); - else if (m = cur.match(/<\/?$/)) { - stream.backUp(cur.length); - if (!stream.match(pat, false)) stream.match(cur); - } - return style; - } - function script(stream, state) { - if (stream.match(/^<\/\s*script\s*>/i, false)) { - state.token = html; - state.localState = state.localMode = null; - return null; - } - return maybeBackup(stream, /<\/\s*script\s*>/, - state.localMode.token(stream, state.localState)); - } - function css(stream, state) { - if (stream.match(/^<\/\s*style\s*>/i, false)) { - state.token = html; - state.localState = state.localMode = null; - return null; - } - return maybeBackup(stream, /<\/\s*style\s*>/, - cssMode.token(stream, state.localState)); - } - return { - startState: function() { - var state = htmlMode.startState(); - return {token: html, localMode: null, localState: null, htmlState: state}; - }, + return { + startState: function () { + var state = htmlMode.startState(); + return {token: html, localMode: null, localState: null, htmlState: state}; + }, - copyState: function(state) { - if (state.localState) - var local = CodeMirror.copyState(state.localMode, state.localState); - return {token: state.token, localMode: state.localMode, localState: local, - htmlState: CodeMirror.copyState(htmlMode, state.htmlState)}; - }, + copyState: function (state) { + if (state.localState) + var local = CodeMirror.copyState(state.localMode, state.localState); + return { + token: state.token, localMode: state.localMode, localState: local, + htmlState: CodeMirror.copyState(htmlMode, state.htmlState) + }; + }, - token: function(stream, state) { - return state.token(stream, state); - }, + token: function (stream, state) { + return state.token(stream, state); + }, - indent: function(state, textAfter) { - if (!state.localMode || /^\s*<\//.test(textAfter)) - return htmlMode.indent(state.htmlState, textAfter); - else if (state.localMode.indent) - return state.localMode.indent(state.localState, textAfter); - else - return CodeMirror.Pass; - }, + indent: function (state, textAfter) { + if (!state.localMode || /^\s*<\//.test(textAfter)) + return htmlMode.indent(state.htmlState, textAfter); + else if (state.localMode.indent) + return state.localMode.indent(state.localState, textAfter); + else + return CodeMirror.Pass; + }, - innerMode: function(state) { - return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode}; - } - }; -}, "xml", "javascript", "css"); + innerMode: function (state) { + return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode}; + } + }; + }, "xml", "javascript", "css"); -CodeMirror.defineMIME("text/html", "htmlmixed"); + CodeMirror.defineMIME("text/html", "htmlmixed"); }); diff --git a/web/editor.md/lib/codemirror/mode/htmlmixed/index.html b/web/editor.md/lib/codemirror/mode/htmlmixed/index.html index f94df9e..701f57d 100644 --- a/web/editor.md/lib/codemirror/mode/htmlmixed/index.html +++ b/web/editor.md/lib/codemirror/mode/htmlmixed/index.html @@ -2,9 +2,9 @@ CodeMirror: HTML mixed mode - + - + @@ -12,24 +12,27 @@ - +
-

HTML mixed mode

-

The HTML mixed mode depends on the XML, JavaScript, and CSS modes.

It takes an optional mode configuration - option, scriptTypes, which can be used to add custom - behavior for specific <script type="..."> tags. If - given, it should hold an array of {matches, mode} - objects, where matches is a string or regexp that - matches the script type, and mode is - either null, for script types that should stay in - HTML mode, or a mode - spec corresponding to the mode that should be used for the - script.

+ option, scriptTypes, which can be used to add custom + behavior for specific <script type="..."> tags. If + given, it should hold an array of {matches, mode} + objects, where matches is a string or regexp that + matches the script type, and mode is + either null, for script types that should stay in + HTML mode, or a mode + spec corresponding to the mode that should be used for the + script.

MIME types defined: text/html - (redefined, only takes effect if you load this parser after the - XML parser).

+ (redefined, only takes effect if you load this parser after the + XML parser).

-
+ diff --git a/web/editor.md/lib/codemirror/mode/http/http.js b/web/editor.md/lib/codemirror/mode/http/http.js index 9a3c5f9..2f5b5f5 100644 --- a/web/editor.md/lib/codemirror/mode/http/http.js +++ b/web/editor.md/lib/codemirror/mode/http/http.js @@ -1,113 +1,113 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("http", function() { - function failFirstLine(stream, state) { - stream.skipToEnd(); - state.cur = header; - return "error"; - } + CodeMirror.defineMode("http", function () { + function failFirstLine(stream, state) { + stream.skipToEnd(); + state.cur = header; + return "error"; + } - function start(stream, state) { - if (stream.match(/^HTTP\/\d\.\d/)) { - state.cur = responseStatusCode; - return "keyword"; - } else if (stream.match(/^[A-Z]+/) && /[ \t]/.test(stream.peek())) { - state.cur = requestPath; - return "keyword"; - } else { - return failFirstLine(stream, state); - } - } + function start(stream, state) { + if (stream.match(/^HTTP\/\d\.\d/)) { + state.cur = responseStatusCode; + return "keyword"; + } else if (stream.match(/^[A-Z]+/) && /[ \t]/.test(stream.peek())) { + state.cur = requestPath; + return "keyword"; + } else { + return failFirstLine(stream, state); + } + } - function responseStatusCode(stream, state) { - var code = stream.match(/^\d+/); - if (!code) return failFirstLine(stream, state); + function responseStatusCode(stream, state) { + var code = stream.match(/^\d+/); + if (!code) return failFirstLine(stream, state); - state.cur = responseStatusText; - var status = Number(code[0]); - if (status >= 100 && status < 200) { - return "positive informational"; - } else if (status >= 200 && status < 300) { - return "positive success"; - } else if (status >= 300 && status < 400) { - return "positive redirect"; - } else if (status >= 400 && status < 500) { - return "negative client-error"; - } else if (status >= 500 && status < 600) { - return "negative server-error"; - } else { - return "error"; - } - } + state.cur = responseStatusText; + var status = Number(code[0]); + if (status >= 100 && status < 200) { + return "positive informational"; + } else if (status >= 200 && status < 300) { + return "positive success"; + } else if (status >= 300 && status < 400) { + return "positive redirect"; + } else if (status >= 400 && status < 500) { + return "negative client-error"; + } else if (status >= 500 && status < 600) { + return "negative server-error"; + } else { + return "error"; + } + } - function responseStatusText(stream, state) { - stream.skipToEnd(); - state.cur = header; - return null; - } + function responseStatusText(stream, state) { + stream.skipToEnd(); + state.cur = header; + return null; + } - function requestPath(stream, state) { - stream.eatWhile(/\S/); - state.cur = requestProtocol; - return "string-2"; - } + function requestPath(stream, state) { + stream.eatWhile(/\S/); + state.cur = requestProtocol; + return "string-2"; + } - function requestProtocol(stream, state) { - if (stream.match(/^HTTP\/\d\.\d$/)) { - state.cur = header; - return "keyword"; - } else { - return failFirstLine(stream, state); - } - } + function requestProtocol(stream, state) { + if (stream.match(/^HTTP\/\d\.\d$/)) { + state.cur = header; + return "keyword"; + } else { + return failFirstLine(stream, state); + } + } - function header(stream) { - if (stream.sol() && !stream.eat(/[ \t]/)) { - if (stream.match(/^.*?:/)) { - return "atom"; - } else { - stream.skipToEnd(); - return "error"; - } - } else { - stream.skipToEnd(); - return "string"; - } - } + function header(stream) { + if (stream.sol() && !stream.eat(/[ \t]/)) { + if (stream.match(/^.*?:/)) { + return "atom"; + } else { + stream.skipToEnd(); + return "error"; + } + } else { + stream.skipToEnd(); + return "string"; + } + } - function body(stream) { - stream.skipToEnd(); - return null; - } + function body(stream) { + stream.skipToEnd(); + return null; + } - return { - token: function(stream, state) { - var cur = state.cur; - if (cur != header && cur != body && stream.eatSpace()) return null; - return cur(stream, state); - }, + return { + token: function (stream, state) { + var cur = state.cur; + if (cur != header && cur != body && stream.eatSpace()) return null; + return cur(stream, state); + }, - blankLine: function(state) { - state.cur = body; - }, + blankLine: function (state) { + state.cur = body; + }, - startState: function() { - return {cur: start}; - } - }; -}); + startState: function () { + return {cur: start}; + } + }; + }); -CodeMirror.defineMIME("message/http", "http"); + CodeMirror.defineMIME("message/http", "http"); }); diff --git a/web/editor.md/lib/codemirror/mode/http/index.html b/web/editor.md/lib/codemirror/mode/http/index.html index 0b8d531..4d21db1 100644 --- a/web/editor.md/lib/codemirror/mode/http/index.html +++ b/web/editor.md/lib/codemirror/mode/http/index.html @@ -2,31 +2,34 @@ CodeMirror: HTTP mode - + - + - +
-

HTTP mode

+

HTTP mode

-

MIME types defined: message/http.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/idl/idl.js b/web/editor.md/lib/codemirror/mode/idl/idl.js index 07308d7..792b032 100644 --- a/web/editor.md/lib/codemirror/mode/idl/idl.js +++ b/web/editor.md/lib/codemirror/mode/idl/idl.js @@ -1,290 +1,301 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; - function wordRegexp(words) { - return new RegExp('^((' + words.join(')|(') + '))\\b', 'i'); - }; - - var builtinArray = [ - 'a_correlate', 'abs', 'acos', 'adapt_hist_equal', 'alog', - 'alog2', 'alog10', 'amoeba', 'annotate', 'app_user_dir', - 'app_user_dir_query', 'arg_present', 'array_equal', 'array_indices', - 'arrow', 'ascii_template', 'asin', 'assoc', 'atan', - 'axis', 'axis', 'bandpass_filter', 'bandreject_filter', 'barplot', - 'bar_plot', 'beseli', 'beselj', 'beselk', 'besely', - 'beta', 'biginteger', 'bilinear', 'bin_date', 'binary_template', - 'bindgen', 'binomial', 'bit_ffs', 'bit_population', 'blas_axpy', - 'blk_con', 'boolarr', 'boolean', 'boxplot', 'box_cursor', - 'breakpoint', 'broyden', 'bubbleplot', 'butterworth', 'bytarr', - 'byte', 'byteorder', 'bytscl', 'c_correlate', 'calendar', - 'caldat', 'call_external', 'call_function', 'call_method', - 'call_procedure', 'canny', 'catch', 'cd', 'cdf', 'ceil', - 'chebyshev', 'check_math', 'chisqr_cvf', 'chisqr_pdf', 'choldc', - 'cholsol', 'cindgen', 'cir_3pnt', 'clipboard', 'close', - 'clust_wts', 'cluster', 'cluster_tree', 'cmyk_convert', 'code_coverage', - 'color_convert', 'color_exchange', 'color_quan', 'color_range_map', - 'colorbar', 'colorize_sample', 'colormap_applicable', - 'colormap_gradient', 'colormap_rotation', 'colortable', - 'comfit', 'command_line_args', 'common', 'compile_opt', 'complex', - 'complexarr', 'complexround', 'compute_mesh_normals', 'cond', 'congrid', - 'conj', 'constrained_min', 'contour', 'contour', 'convert_coord', - 'convol', 'convol_fft', 'coord2to3', 'copy_lun', 'correlate', - 'cos', 'cosh', 'cpu', 'cramer', 'createboxplotdata', - 'create_cursor', 'create_struct', 'create_view', 'crossp', 'crvlength', - 'ct_luminance', 'cti_test', 'cursor', 'curvefit', 'cv_coord', - 'cvttobm', 'cw_animate', 'cw_animate_getp', 'cw_animate_load', - 'cw_animate_run', 'cw_arcball', 'cw_bgroup', 'cw_clr_index', - 'cw_colorsel', 'cw_defroi', 'cw_field', 'cw_filesel', 'cw_form', - 'cw_fslider', 'cw_light_editor', 'cw_light_editor_get', - 'cw_light_editor_set', 'cw_orient', 'cw_palette_editor', - 'cw_palette_editor_get', 'cw_palette_editor_set', 'cw_pdmenu', - 'cw_rgbslider', 'cw_tmpl', 'cw_zoom', 'db_exists', - 'dblarr', 'dcindgen', 'dcomplex', 'dcomplexarr', 'define_key', - 'define_msgblk', 'define_msgblk_from_file', 'defroi', 'defsysv', - 'delvar', 'dendro_plot', 'dendrogram', 'deriv', 'derivsig', - 'determ', 'device', 'dfpmin', 'diag_matrix', 'dialog_dbconnect', - 'dialog_message', 'dialog_pickfile', 'dialog_printersetup', - 'dialog_printjob', 'dialog_read_image', - 'dialog_write_image', 'dictionary', 'digital_filter', 'dilate', 'dindgen', - 'dissolve', 'dist', 'distance_measure', 'dlm_load', 'dlm_register', - 'doc_library', 'double', 'draw_roi', 'edge_dog', 'efont', - 'eigenql', 'eigenvec', 'ellipse', 'elmhes', 'emboss', - 'empty', 'enable_sysrtn', 'eof', 'eos', 'erase', - 'erf', 'erfc', 'erfcx', 'erode', 'errorplot', - 'errplot', 'estimator_filter', 'execute', 'exit', 'exp', - 'expand', 'expand_path', 'expint', 'extrac', 'extract_slice', - 'f_cvf', 'f_pdf', 'factorial', 'fft', 'file_basename', - 'file_chmod', 'file_copy', 'file_delete', 'file_dirname', - 'file_expand_path', 'file_gunzip', 'file_gzip', 'file_info', - 'file_lines', 'file_link', 'file_mkdir', 'file_move', - 'file_poll_input', 'file_readlink', 'file_same', - 'file_search', 'file_tar', 'file_test', 'file_untar', 'file_unzip', - 'file_which', 'file_zip', 'filepath', 'findgen', 'finite', - 'fix', 'flick', 'float', 'floor', 'flow3', - 'fltarr', 'flush', 'format_axis_values', 'forward_function', 'free_lun', - 'fstat', 'fulstr', 'funct', 'function', 'fv_test', - 'fx_root', 'fz_roots', 'gamma', 'gamma_ct', 'gauss_cvf', - 'gauss_pdf', 'gauss_smooth', 'gauss2dfit', 'gaussfit', - 'gaussian_function', 'gaussint', 'get_drive_list', 'get_dxf_objects', - 'get_kbrd', 'get_login_info', - 'get_lun', 'get_screen_size', 'getenv', 'getwindows', 'greg2jul', - 'grib', 'grid_input', 'grid_tps', 'grid3', 'griddata', - 'gs_iter', 'h_eq_ct', 'h_eq_int', 'hanning', 'hash', - 'hdf', 'hdf5', 'heap_free', 'heap_gc', 'heap_nosave', - 'heap_refcount', 'heap_save', 'help', 'hilbert', 'hist_2d', - 'hist_equal', 'histogram', 'hls', 'hough', 'hqr', - 'hsv', 'i18n_multibytetoutf8', - 'i18n_multibytetowidechar', 'i18n_utf8tomultibyte', - 'i18n_widechartomultibyte', - 'ibeta', 'icontour', 'iconvertcoord', 'idelete', 'identity', - 'idl_base64', 'idl_container', 'idl_validname', - 'idlexbr_assistant', 'idlitsys_createtool', - 'idlunit', 'iellipse', 'igamma', 'igetcurrent', 'igetdata', - 'igetid', 'igetproperty', 'iimage', 'image', 'image_cont', - 'image_statistics', 'image_threshold', 'imaginary', 'imap', 'indgen', - 'int_2d', 'int_3d', 'int_tabulated', 'intarr', 'interpol', - 'interpolate', 'interval_volume', 'invert', 'ioctl', 'iopen', - 'ir_filter', 'iplot', 'ipolygon', 'ipolyline', 'iputdata', - 'iregister', 'ireset', 'iresolve', 'irotate', 'isa', - 'isave', 'iscale', 'isetcurrent', 'isetproperty', 'ishft', - 'isocontour', 'isosurface', 'isurface', 'itext', 'itranslate', - 'ivector', 'ivolume', 'izoom', 'journal', 'json_parse', - 'json_serialize', 'jul2greg', 'julday', 'keyword_set', 'krig2d', - 'kurtosis', 'kw_test', 'l64indgen', 'la_choldc', 'la_cholmprove', - 'la_cholsol', 'la_determ', 'la_eigenproblem', 'la_eigenql', 'la_eigenvec', - 'la_elmhes', 'la_gm_linear_model', 'la_hqr', 'la_invert', - 'la_least_square_equality', 'la_least_squares', 'la_linear_equation', - 'la_ludc', 'la_lumprove', 'la_lusol', - 'la_svd', 'la_tridc', 'la_trimprove', 'la_triql', 'la_trired', - 'la_trisol', 'label_date', 'label_region', 'ladfit', 'laguerre', - 'lambda', 'lambdap', 'lambertw', 'laplacian', 'least_squares_filter', - 'leefilt', 'legend', 'legendre', 'linbcg', 'lindgen', - 'linfit', 'linkimage', 'list', 'll_arc_distance', 'lmfit', - 'lmgr', 'lngamma', 'lnp_test', 'loadct', 'locale_get', - 'logical_and', 'logical_or', 'logical_true', 'lon64arr', 'lonarr', - 'long', 'long64', 'lsode', 'lu_complex', 'ludc', - 'lumprove', 'lusol', 'm_correlate', 'machar', 'make_array', - 'make_dll', 'make_rt', 'map', 'mapcontinents', 'mapgrid', - 'map_2points', 'map_continents', 'map_grid', 'map_image', 'map_patch', - 'map_proj_forward', 'map_proj_image', 'map_proj_info', - 'map_proj_init', 'map_proj_inverse', - 'map_set', 'matrix_multiply', 'matrix_power', 'max', 'md_test', - 'mean', 'meanabsdev', 'mean_filter', 'median', 'memory', - 'mesh_clip', 'mesh_decimate', 'mesh_issolid', - 'mesh_merge', 'mesh_numtriangles', - 'mesh_obj', 'mesh_smooth', 'mesh_surfacearea', - 'mesh_validate', 'mesh_volume', - 'message', 'min', 'min_curve_surf', 'mk_html_help', 'modifyct', - 'moment', 'morph_close', 'morph_distance', - 'morph_gradient', 'morph_hitormiss', - 'morph_open', 'morph_thin', 'morph_tophat', 'multi', 'n_elements', - 'n_params', 'n_tags', 'ncdf', 'newton', 'noise_hurl', - 'noise_pick', 'noise_scatter', 'noise_slur', 'norm', 'obj_class', - 'obj_destroy', 'obj_hasmethod', 'obj_isa', 'obj_new', 'obj_valid', - 'objarr', 'on_error', 'on_ioerror', 'online_help', 'openr', - 'openu', 'openw', 'oplot', 'oploterr', 'orderedhash', - 'p_correlate', 'parse_url', 'particle_trace', 'path_cache', 'path_sep', - 'pcomp', 'plot', 'plot3d', 'plot', 'plot_3dbox', - 'plot_field', 'ploterr', 'plots', 'polar_contour', 'polar_surface', - 'polyfill', 'polyshade', 'pnt_line', 'point_lun', 'polarplot', - 'poly', 'poly_2d', 'poly_area', 'poly_fit', 'polyfillv', - 'polygon', 'polyline', 'polywarp', 'popd', 'powell', - 'pref_commit', 'pref_get', 'pref_set', 'prewitt', 'primes', - 'print', 'printf', 'printd', 'pro', 'product', - 'profile', 'profiler', 'profiles', 'project_vol', 'ps_show_fonts', - 'psafm', 'pseudo', 'ptr_free', 'ptr_new', 'ptr_valid', - 'ptrarr', 'pushd', 'qgrid3', 'qhull', 'qromb', - 'qromo', 'qsimp', 'query_*', 'query_ascii', 'query_bmp', - 'query_csv', 'query_dicom', 'query_gif', 'query_image', 'query_jpeg', - 'query_jpeg2000', 'query_mrsid', 'query_pict', 'query_png', 'query_ppm', - 'query_srf', 'query_tiff', 'query_video', 'query_wav', 'r_correlate', - 'r_test', 'radon', 'randomn', 'randomu', 'ranks', - 'rdpix', 'read', 'readf', 'read_ascii', 'read_binary', - 'read_bmp', 'read_csv', 'read_dicom', 'read_gif', 'read_image', - 'read_interfile', 'read_jpeg', 'read_jpeg2000', 'read_mrsid', 'read_pict', - 'read_png', 'read_ppm', 'read_spr', 'read_srf', 'read_sylk', - 'read_tiff', 'read_video', 'read_wav', 'read_wave', 'read_x11_bitmap', - 'read_xwd', 'reads', 'readu', 'real_part', 'rebin', - 'recall_commands', 'recon3', 'reduce_colors', 'reform', 'region_grow', - 'register_cursor', 'regress', 'replicate', - 'replicate_inplace', 'resolve_all', - 'resolve_routine', 'restore', 'retall', 'return', 'reverse', - 'rk4', 'roberts', 'rot', 'rotate', 'round', - 'routine_filepath', 'routine_info', 'rs_test', 's_test', 'save', - 'savgol', 'scale3', 'scale3d', 'scatterplot', 'scatterplot3d', - 'scope_level', 'scope_traceback', 'scope_varfetch', - 'scope_varname', 'search2d', - 'search3d', 'sem_create', 'sem_delete', 'sem_lock', 'sem_release', - 'set_plot', 'set_shading', 'setenv', 'sfit', 'shade_surf', - 'shade_surf_irr', 'shade_volume', 'shift', 'shift_diff', 'shmdebug', - 'shmmap', 'shmunmap', 'shmvar', 'show3', 'showfont', - 'signum', 'simplex', 'sin', 'sindgen', 'sinh', - 'size', 'skewness', 'skip_lun', 'slicer3', 'slide_image', - 'smooth', 'sobel', 'socket', 'sort', 'spawn', - 'sph_4pnt', 'sph_scat', 'spher_harm', 'spl_init', 'spl_interp', - 'spline', 'spline_p', 'sprsab', 'sprsax', 'sprsin', - 'sprstp', 'sqrt', 'standardize', 'stddev', 'stop', - 'strarr', 'strcmp', 'strcompress', 'streamline', 'streamline', - 'stregex', 'stretch', 'string', 'strjoin', 'strlen', - 'strlowcase', 'strmatch', 'strmessage', 'strmid', 'strpos', - 'strput', 'strsplit', 'strtrim', 'struct_assign', 'struct_hide', - 'strupcase', 'surface', 'surface', 'surfr', 'svdc', - 'svdfit', 'svsol', 'swap_endian', 'swap_endian_inplace', 'symbol', - 'systime', 't_cvf', 't_pdf', 't3d', 'tag_names', - 'tan', 'tanh', 'tek_color', 'temporary', 'terminal_size', - 'tetra_clip', 'tetra_surface', 'tetra_volume', 'text', 'thin', - 'thread', 'threed', 'tic', 'time_test2', 'timegen', - 'timer', 'timestamp', 'timestamptovalues', 'tm_test', 'toc', - 'total', 'trace', 'transpose', 'tri_surf', 'triangulate', - 'trigrid', 'triql', 'trired', 'trisol', 'truncate_lun', - 'ts_coef', 'ts_diff', 'ts_fcast', 'ts_smooth', 'tv', - 'tvcrs', 'tvlct', 'tvrd', 'tvscl', 'typename', - 'uindgen', 'uint', 'uintarr', 'ul64indgen', 'ulindgen', - 'ulon64arr', 'ulonarr', 'ulong', 'ulong64', 'uniq', - 'unsharp_mask', 'usersym', 'value_locate', 'variance', 'vector', - 'vector_field', 'vel', 'velovect', 'vert_t3d', 'voigt', - 'volume', 'voronoi', 'voxel_proj', 'wait', 'warp_tri', - 'watershed', 'wdelete', 'wf_draw', 'where', 'widget_base', - 'widget_button', 'widget_combobox', 'widget_control', - 'widget_displaycontextmenu', 'widget_draw', - 'widget_droplist', 'widget_event', 'widget_info', - 'widget_label', 'widget_list', - 'widget_propertysheet', 'widget_slider', 'widget_tab', - 'widget_table', 'widget_text', - 'widget_tree', 'widget_tree_move', 'widget_window', - 'wiener_filter', 'window', - 'window', 'write_bmp', 'write_csv', 'write_gif', 'write_image', - 'write_jpeg', 'write_jpeg2000', 'write_nrif', 'write_pict', 'write_png', - 'write_ppm', 'write_spr', 'write_srf', 'write_sylk', 'write_tiff', - 'write_video', 'write_wav', 'write_wave', 'writeu', 'wset', - 'wshow', 'wtn', 'wv_applet', 'wv_cwt', 'wv_cw_wavelet', - 'wv_denoise', 'wv_dwt', 'wv_fn_coiflet', - 'wv_fn_daubechies', 'wv_fn_gaussian', - 'wv_fn_haar', 'wv_fn_morlet', 'wv_fn_paul', - 'wv_fn_symlet', 'wv_import_data', - 'wv_import_wavelet', 'wv_plot3d_wps', 'wv_plot_multires', - 'wv_pwt', 'wv_tool_denoise', - 'xbm_edit', 'xdisplayfile', 'xdxf', 'xfont', 'xinteranimate', - 'xloadct', 'xmanager', 'xmng_tmpl', 'xmtool', 'xobjview', - 'xobjview_rotate', 'xobjview_write_image', - 'xpalette', 'xpcolor', 'xplot3d', - 'xregistered', 'xroi', 'xsq_test', 'xsurface', 'xvaredit', - 'xvolume', 'xvolume_rotate', 'xvolume_write_image', - 'xyouts', 'zlib_compress', 'zlib_uncompress', 'zoom', 'zoom_24' - ]; - var builtins = wordRegexp(builtinArray); + function wordRegexp(words) { + return new RegExp('^((' + words.join(')|(') + '))\\b', 'i'); + }; - var keywordArray = [ - 'begin', 'end', 'endcase', 'endfor', - 'endwhile', 'endif', 'endrep', 'endforeach', - 'break', 'case', 'continue', 'for', - 'foreach', 'goto', 'if', 'then', 'else', - 'repeat', 'until', 'switch', 'while', - 'do', 'pro', 'function' - ]; - var keywords = wordRegexp(keywordArray); + var builtinArray = [ + 'a_correlate', 'abs', 'acos', 'adapt_hist_equal', 'alog', + 'alog2', 'alog10', 'amoeba', 'annotate', 'app_user_dir', + 'app_user_dir_query', 'arg_present', 'array_equal', 'array_indices', + 'arrow', 'ascii_template', 'asin', 'assoc', 'atan', + 'axis', 'axis', 'bandpass_filter', 'bandreject_filter', 'barplot', + 'bar_plot', 'beseli', 'beselj', 'beselk', 'besely', + 'beta', 'biginteger', 'bilinear', 'bin_date', 'binary_template', + 'bindgen', 'binomial', 'bit_ffs', 'bit_population', 'blas_axpy', + 'blk_con', 'boolarr', 'boolean', 'boxplot', 'box_cursor', + 'breakpoint', 'broyden', 'bubbleplot', 'butterworth', 'bytarr', + 'byte', 'byteorder', 'bytscl', 'c_correlate', 'calendar', + 'caldat', 'call_external', 'call_function', 'call_method', + 'call_procedure', 'canny', 'catch', 'cd', 'cdf', 'ceil', + 'chebyshev', 'check_math', 'chisqr_cvf', 'chisqr_pdf', 'choldc', + 'cholsol', 'cindgen', 'cir_3pnt', 'clipboard', 'close', + 'clust_wts', 'cluster', 'cluster_tree', 'cmyk_convert', 'code_coverage', + 'color_convert', 'color_exchange', 'color_quan', 'color_range_map', + 'colorbar', 'colorize_sample', 'colormap_applicable', + 'colormap_gradient', 'colormap_rotation', 'colortable', + 'comfit', 'command_line_args', 'common', 'compile_opt', 'complex', + 'complexarr', 'complexround', 'compute_mesh_normals', 'cond', 'congrid', + 'conj', 'constrained_min', 'contour', 'contour', 'convert_coord', + 'convol', 'convol_fft', 'coord2to3', 'copy_lun', 'correlate', + 'cos', 'cosh', 'cpu', 'cramer', 'createboxplotdata', + 'create_cursor', 'create_struct', 'create_view', 'crossp', 'crvlength', + 'ct_luminance', 'cti_test', 'cursor', 'curvefit', 'cv_coord', + 'cvttobm', 'cw_animate', 'cw_animate_getp', 'cw_animate_load', + 'cw_animate_run', 'cw_arcball', 'cw_bgroup', 'cw_clr_index', + 'cw_colorsel', 'cw_defroi', 'cw_field', 'cw_filesel', 'cw_form', + 'cw_fslider', 'cw_light_editor', 'cw_light_editor_get', + 'cw_light_editor_set', 'cw_orient', 'cw_palette_editor', + 'cw_palette_editor_get', 'cw_palette_editor_set', 'cw_pdmenu', + 'cw_rgbslider', 'cw_tmpl', 'cw_zoom', 'db_exists', + 'dblarr', 'dcindgen', 'dcomplex', 'dcomplexarr', 'define_key', + 'define_msgblk', 'define_msgblk_from_file', 'defroi', 'defsysv', + 'delvar', 'dendro_plot', 'dendrogram', 'deriv', 'derivsig', + 'determ', 'device', 'dfpmin', 'diag_matrix', 'dialog_dbconnect', + 'dialog_message', 'dialog_pickfile', 'dialog_printersetup', + 'dialog_printjob', 'dialog_read_image', + 'dialog_write_image', 'dictionary', 'digital_filter', 'dilate', 'dindgen', + 'dissolve', 'dist', 'distance_measure', 'dlm_load', 'dlm_register', + 'doc_library', 'double', 'draw_roi', 'edge_dog', 'efont', + 'eigenql', 'eigenvec', 'ellipse', 'elmhes', 'emboss', + 'empty', 'enable_sysrtn', 'eof', 'eos', 'erase', + 'erf', 'erfc', 'erfcx', 'erode', 'errorplot', + 'errplot', 'estimator_filter', 'execute', 'exit', 'exp', + 'expand', 'expand_path', 'expint', 'extrac', 'extract_slice', + 'f_cvf', 'f_pdf', 'factorial', 'fft', 'file_basename', + 'file_chmod', 'file_copy', 'file_delete', 'file_dirname', + 'file_expand_path', 'file_gunzip', 'file_gzip', 'file_info', + 'file_lines', 'file_link', 'file_mkdir', 'file_move', + 'file_poll_input', 'file_readlink', 'file_same', + 'file_search', 'file_tar', 'file_test', 'file_untar', 'file_unzip', + 'file_which', 'file_zip', 'filepath', 'findgen', 'finite', + 'fix', 'flick', 'float', 'floor', 'flow3', + 'fltarr', 'flush', 'format_axis_values', 'forward_function', 'free_lun', + 'fstat', 'fulstr', 'funct', 'function', 'fv_test', + 'fx_root', 'fz_roots', 'gamma', 'gamma_ct', 'gauss_cvf', + 'gauss_pdf', 'gauss_smooth', 'gauss2dfit', 'gaussfit', + 'gaussian_function', 'gaussint', 'get_drive_list', 'get_dxf_objects', + 'get_kbrd', 'get_login_info', + 'get_lun', 'get_screen_size', 'getenv', 'getwindows', 'greg2jul', + 'grib', 'grid_input', 'grid_tps', 'grid3', 'griddata', + 'gs_iter', 'h_eq_ct', 'h_eq_int', 'hanning', 'hash', + 'hdf', 'hdf5', 'heap_free', 'heap_gc', 'heap_nosave', + 'heap_refcount', 'heap_save', 'help', 'hilbert', 'hist_2d', + 'hist_equal', 'histogram', 'hls', 'hough', 'hqr', + 'hsv', 'i18n_multibytetoutf8', + 'i18n_multibytetowidechar', 'i18n_utf8tomultibyte', + 'i18n_widechartomultibyte', + 'ibeta', 'icontour', 'iconvertcoord', 'idelete', 'identity', + 'idl_base64', 'idl_container', 'idl_validname', + 'idlexbr_assistant', 'idlitsys_createtool', + 'idlunit', 'iellipse', 'igamma', 'igetcurrent', 'igetdata', + 'igetid', 'igetproperty', 'iimage', 'image', 'image_cont', + 'image_statistics', 'image_threshold', 'imaginary', 'imap', 'indgen', + 'int_2d', 'int_3d', 'int_tabulated', 'intarr', 'interpol', + 'interpolate', 'interval_volume', 'invert', 'ioctl', 'iopen', + 'ir_filter', 'iplot', 'ipolygon', 'ipolyline', 'iputdata', + 'iregister', 'ireset', 'iresolve', 'irotate', 'isa', + 'isave', 'iscale', 'isetcurrent', 'isetproperty', 'ishft', + 'isocontour', 'isosurface', 'isurface', 'itext', 'itranslate', + 'ivector', 'ivolume', 'izoom', 'journal', 'json_parse', + 'json_serialize', 'jul2greg', 'julday', 'keyword_set', 'krig2d', + 'kurtosis', 'kw_test', 'l64indgen', 'la_choldc', 'la_cholmprove', + 'la_cholsol', 'la_determ', 'la_eigenproblem', 'la_eigenql', 'la_eigenvec', + 'la_elmhes', 'la_gm_linear_model', 'la_hqr', 'la_invert', + 'la_least_square_equality', 'la_least_squares', 'la_linear_equation', + 'la_ludc', 'la_lumprove', 'la_lusol', + 'la_svd', 'la_tridc', 'la_trimprove', 'la_triql', 'la_trired', + 'la_trisol', 'label_date', 'label_region', 'ladfit', 'laguerre', + 'lambda', 'lambdap', 'lambertw', 'laplacian', 'least_squares_filter', + 'leefilt', 'legend', 'legendre', 'linbcg', 'lindgen', + 'linfit', 'linkimage', 'list', 'll_arc_distance', 'lmfit', + 'lmgr', 'lngamma', 'lnp_test', 'loadct', 'locale_get', + 'logical_and', 'logical_or', 'logical_true', 'lon64arr', 'lonarr', + 'long', 'long64', 'lsode', 'lu_complex', 'ludc', + 'lumprove', 'lusol', 'm_correlate', 'machar', 'make_array', + 'make_dll', 'make_rt', 'map', 'mapcontinents', 'mapgrid', + 'map_2points', 'map_continents', 'map_grid', 'map_image', 'map_patch', + 'map_proj_forward', 'map_proj_image', 'map_proj_info', + 'map_proj_init', 'map_proj_inverse', + 'map_set', 'matrix_multiply', 'matrix_power', 'max', 'md_test', + 'mean', 'meanabsdev', 'mean_filter', 'median', 'memory', + 'mesh_clip', 'mesh_decimate', 'mesh_issolid', + 'mesh_merge', 'mesh_numtriangles', + 'mesh_obj', 'mesh_smooth', 'mesh_surfacearea', + 'mesh_validate', 'mesh_volume', + 'message', 'min', 'min_curve_surf', 'mk_html_help', 'modifyct', + 'moment', 'morph_close', 'morph_distance', + 'morph_gradient', 'morph_hitormiss', + 'morph_open', 'morph_thin', 'morph_tophat', 'multi', 'n_elements', + 'n_params', 'n_tags', 'ncdf', 'newton', 'noise_hurl', + 'noise_pick', 'noise_scatter', 'noise_slur', 'norm', 'obj_class', + 'obj_destroy', 'obj_hasmethod', 'obj_isa', 'obj_new', 'obj_valid', + 'objarr', 'on_error', 'on_ioerror', 'online_help', 'openr', + 'openu', 'openw', 'oplot', 'oploterr', 'orderedhash', + 'p_correlate', 'parse_url', 'particle_trace', 'path_cache', 'path_sep', + 'pcomp', 'plot', 'plot3d', 'plot', 'plot_3dbox', + 'plot_field', 'ploterr', 'plots', 'polar_contour', 'polar_surface', + 'polyfill', 'polyshade', 'pnt_line', 'point_lun', 'polarplot', + 'poly', 'poly_2d', 'poly_area', 'poly_fit', 'polyfillv', + 'polygon', 'polyline', 'polywarp', 'popd', 'powell', + 'pref_commit', 'pref_get', 'pref_set', 'prewitt', 'primes', + 'print', 'printf', 'printd', 'pro', 'product', + 'profile', 'profiler', 'profiles', 'project_vol', 'ps_show_fonts', + 'psafm', 'pseudo', 'ptr_free', 'ptr_new', 'ptr_valid', + 'ptrarr', 'pushd', 'qgrid3', 'qhull', 'qromb', + 'qromo', 'qsimp', 'query_*', 'query_ascii', 'query_bmp', + 'query_csv', 'query_dicom', 'query_gif', 'query_image', 'query_jpeg', + 'query_jpeg2000', 'query_mrsid', 'query_pict', 'query_png', 'query_ppm', + 'query_srf', 'query_tiff', 'query_video', 'query_wav', 'r_correlate', + 'r_test', 'radon', 'randomn', 'randomu', 'ranks', + 'rdpix', 'read', 'readf', 'read_ascii', 'read_binary', + 'read_bmp', 'read_csv', 'read_dicom', 'read_gif', 'read_image', + 'read_interfile', 'read_jpeg', 'read_jpeg2000', 'read_mrsid', 'read_pict', + 'read_png', 'read_ppm', 'read_spr', 'read_srf', 'read_sylk', + 'read_tiff', 'read_video', 'read_wav', 'read_wave', 'read_x11_bitmap', + 'read_xwd', 'reads', 'readu', 'real_part', 'rebin', + 'recall_commands', 'recon3', 'reduce_colors', 'reform', 'region_grow', + 'register_cursor', 'regress', 'replicate', + 'replicate_inplace', 'resolve_all', + 'resolve_routine', 'restore', 'retall', 'return', 'reverse', + 'rk4', 'roberts', 'rot', 'rotate', 'round', + 'routine_filepath', 'routine_info', 'rs_test', 's_test', 'save', + 'savgol', 'scale3', 'scale3d', 'scatterplot', 'scatterplot3d', + 'scope_level', 'scope_traceback', 'scope_varfetch', + 'scope_varname', 'search2d', + 'search3d', 'sem_create', 'sem_delete', 'sem_lock', 'sem_release', + 'set_plot', 'set_shading', 'setenv', 'sfit', 'shade_surf', + 'shade_surf_irr', 'shade_volume', 'shift', 'shift_diff', 'shmdebug', + 'shmmap', 'shmunmap', 'shmvar', 'show3', 'showfont', + 'signum', 'simplex', 'sin', 'sindgen', 'sinh', + 'size', 'skewness', 'skip_lun', 'slicer3', 'slide_image', + 'smooth', 'sobel', 'socket', 'sort', 'spawn', + 'sph_4pnt', 'sph_scat', 'spher_harm', 'spl_init', 'spl_interp', + 'spline', 'spline_p', 'sprsab', 'sprsax', 'sprsin', + 'sprstp', 'sqrt', 'standardize', 'stddev', 'stop', + 'strarr', 'strcmp', 'strcompress', 'streamline', 'streamline', + 'stregex', 'stretch', 'string', 'strjoin', 'strlen', + 'strlowcase', 'strmatch', 'strmessage', 'strmid', 'strpos', + 'strput', 'strsplit', 'strtrim', 'struct_assign', 'struct_hide', + 'strupcase', 'surface', 'surface', 'surfr', 'svdc', + 'svdfit', 'svsol', 'swap_endian', 'swap_endian_inplace', 'symbol', + 'systime', 't_cvf', 't_pdf', 't3d', 'tag_names', + 'tan', 'tanh', 'tek_color', 'temporary', 'terminal_size', + 'tetra_clip', 'tetra_surface', 'tetra_volume', 'text', 'thin', + 'thread', 'threed', 'tic', 'time_test2', 'timegen', + 'timer', 'timestamp', 'timestamptovalues', 'tm_test', 'toc', + 'total', 'trace', 'transpose', 'tri_surf', 'triangulate', + 'trigrid', 'triql', 'trired', 'trisol', 'truncate_lun', + 'ts_coef', 'ts_diff', 'ts_fcast', 'ts_smooth', 'tv', + 'tvcrs', 'tvlct', 'tvrd', 'tvscl', 'typename', + 'uindgen', 'uint', 'uintarr', 'ul64indgen', 'ulindgen', + 'ulon64arr', 'ulonarr', 'ulong', 'ulong64', 'uniq', + 'unsharp_mask', 'usersym', 'value_locate', 'variance', 'vector', + 'vector_field', 'vel', 'velovect', 'vert_t3d', 'voigt', + 'volume', 'voronoi', 'voxel_proj', 'wait', 'warp_tri', + 'watershed', 'wdelete', 'wf_draw', 'where', 'widget_base', + 'widget_button', 'widget_combobox', 'widget_control', + 'widget_displaycontextmenu', 'widget_draw', + 'widget_droplist', 'widget_event', 'widget_info', + 'widget_label', 'widget_list', + 'widget_propertysheet', 'widget_slider', 'widget_tab', + 'widget_table', 'widget_text', + 'widget_tree', 'widget_tree_move', 'widget_window', + 'wiener_filter', 'window', + 'window', 'write_bmp', 'write_csv', 'write_gif', 'write_image', + 'write_jpeg', 'write_jpeg2000', 'write_nrif', 'write_pict', 'write_png', + 'write_ppm', 'write_spr', 'write_srf', 'write_sylk', 'write_tiff', + 'write_video', 'write_wav', 'write_wave', 'writeu', 'wset', + 'wshow', 'wtn', 'wv_applet', 'wv_cwt', 'wv_cw_wavelet', + 'wv_denoise', 'wv_dwt', 'wv_fn_coiflet', + 'wv_fn_daubechies', 'wv_fn_gaussian', + 'wv_fn_haar', 'wv_fn_morlet', 'wv_fn_paul', + 'wv_fn_symlet', 'wv_import_data', + 'wv_import_wavelet', 'wv_plot3d_wps', 'wv_plot_multires', + 'wv_pwt', 'wv_tool_denoise', + 'xbm_edit', 'xdisplayfile', 'xdxf', 'xfont', 'xinteranimate', + 'xloadct', 'xmanager', 'xmng_tmpl', 'xmtool', 'xobjview', + 'xobjview_rotate', 'xobjview_write_image', + 'xpalette', 'xpcolor', 'xplot3d', + 'xregistered', 'xroi', 'xsq_test', 'xsurface', 'xvaredit', + 'xvolume', 'xvolume_rotate', 'xvolume_write_image', + 'xyouts', 'zlib_compress', 'zlib_uncompress', 'zoom', 'zoom_24' + ]; + var builtins = wordRegexp(builtinArray); - CodeMirror.registerHelper("hintWords", "idl", builtinArray.concat(keywordArray)); + var keywordArray = [ + 'begin', 'end', 'endcase', 'endfor', + 'endwhile', 'endif', 'endrep', 'endforeach', + 'break', 'case', 'continue', 'for', + 'foreach', 'goto', 'if', 'then', 'else', + 'repeat', 'until', 'switch', 'while', + 'do', 'pro', 'function' + ]; + var keywords = wordRegexp(keywordArray); - var identifiers = new RegExp('^[_a-z\xa1-\uffff][_a-z0-9\xa1-\uffff]*', 'i'); + CodeMirror.registerHelper("hintWords", "idl", builtinArray.concat(keywordArray)); - var singleOperators = /[+\-*&=<>\/@#~$]/; - var boolOperators = new RegExp('(and|or|eq|lt|le|gt|ge|ne|not)', 'i'); + var identifiers = new RegExp('^[_a-z\xa1-\uffff][_a-z0-9\xa1-\uffff]*', 'i'); - function tokenBase(stream) { - // whitespaces - if (stream.eatSpace()) return null; + var singleOperators = /[+\-*&=<>\/@#~$]/; + var boolOperators = new RegExp('(and|or|eq|lt|le|gt|ge|ne|not)', 'i'); - // Handle one line Comments - if (stream.match(';')) { - stream.skipToEnd(); - return 'comment'; - } + function tokenBase(stream) { + // whitespaces + if (stream.eatSpace()) return null; - // Handle Number Literals - if (stream.match(/^[0-9\.+-]/, false)) { - if (stream.match(/^[+-]?0x[0-9a-fA-F]+/)) - return 'number'; - if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?/)) - return 'number'; - if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?/)) - return 'number'; - } + // Handle one line Comments + if (stream.match(';')) { + stream.skipToEnd(); + return 'comment'; + } - // Handle Strings - if (stream.match(/^"([^"]|(""))*"/)) { return 'string'; } - if (stream.match(/^'([^']|(''))*'/)) { return 'string'; } + // Handle Number Literals + if (stream.match(/^[0-9\.+-]/, false)) { + if (stream.match(/^[+-]?0x[0-9a-fA-F]+/)) + return 'number'; + if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?/)) + return 'number'; + if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?/)) + return 'number'; + } - // Handle words - if (stream.match(keywords)) { return 'keyword'; } - if (stream.match(builtins)) { return 'builtin'; } - if (stream.match(identifiers)) { return 'variable'; } + // Handle Strings + if (stream.match(/^"([^"]|(""))*"/)) { + return 'string'; + } + if (stream.match(/^'([^']|(''))*'/)) { + return 'string'; + } - if (stream.match(singleOperators) || stream.match(boolOperators)) { - return 'operator'; } + // Handle words + if (stream.match(keywords)) { + return 'keyword'; + } + if (stream.match(builtins)) { + return 'builtin'; + } + if (stream.match(identifiers)) { + return 'variable'; + } - // Handle non-detected items - stream.next(); - return null; - }; + if (stream.match(singleOperators) || stream.match(boolOperators)) { + return 'operator'; + } - CodeMirror.defineMode('idl', function() { - return { - token: function(stream) { - return tokenBase(stream); - } + // Handle non-detected items + stream.next(); + return null; }; - }); - CodeMirror.defineMIME('text/x-idl', 'idl'); + CodeMirror.defineMode('idl', function () { + return { + token: function (stream) { + return tokenBase(stream); + } + }; + }); + + CodeMirror.defineMIME('text/x-idl', 'idl'); }); diff --git a/web/editor.md/lib/codemirror/mode/idl/index.html b/web/editor.md/lib/codemirror/mode/idl/index.html index 4c169e2..1fe3d28 100644 --- a/web/editor.md/lib/codemirror/mode/idl/index.html +++ b/web/editor.md/lib/codemirror/mode/idl/index.html @@ -2,28 +2,31 @@ CodeMirror: IDL mode - + - + - +
-

IDL mode

+

IDL mode

MIME types defined: text/x-idl.

diff --git a/web/editor.md/lib/codemirror/mode/index.html b/web/editor.md/lib/codemirror/mode/index.html index 04167a5..4bc5e68 100644 --- a/web/editor.md/lib/codemirror/mode/index.html +++ b/web/editor.md/lib/codemirror/mode/index.html @@ -2,133 +2,133 @@ CodeMirror: Language Modes - +
-

Language modes

+

Language modes

-

This is a list of every mode in the distribution. Each mode lives -in a subdirectory of the mode/ directory, and typically -defines a single JavaScript file that implements the mode. Loading -such file will make the language available to CodeMirror, through -the mode -option.

+

This is a list of every mode in the distribution. Each mode lives + in a subdirectory of the mode/ directory, and typically + defines a single JavaScript file that implements the mode. Loading + such file will make the language available to CodeMirror, through + the mode + option.

-
- -
+
+ +
diff --git a/web/editor.md/lib/codemirror/mode/jade/index.html b/web/editor.md/lib/codemirror/mode/jade/index.html index e534981..c9cd2da 100644 --- a/web/editor.md/lib/codemirror/mode/jade/index.html +++ b/web/editor.md/lib/codemirror/mode/jade/index.html @@ -2,33 +2,36 @@ CodeMirror: Jade Templating Mode - + - + - +
-

Jade Templating Mode

-

The Jade Templating Mode

-

Created by Forbes Lindesay. Managed as part of a Brackets extension at https://github.com/ForbesLindesay/jade-brackets.

+

Created by Forbes Lindesay. Managed as part of a Brackets extension at https://github.com/ForbesLindesay/jade-brackets. +

MIME type defined: text/x-jade.

-
+
diff --git a/web/editor.md/lib/codemirror/mode/jade/jade.js b/web/editor.md/lib/codemirror/mode/jade/jade.js index 96fadb1..85f66f7 100644 --- a/web/editor.md/lib/codemirror/mode/jade/jade.js +++ b/web/editor.md/lib/codemirror/mode/jade/jade.js @@ -1,590 +1,601 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../javascript/javascript"), require("../css/css"), require("../htmlmixed/htmlmixed")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../javascript/javascript", "../css/css", "../htmlmixed/htmlmixed"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode('jade', function (config) { - // token types - var KEYWORD = 'keyword'; - var DOCTYPE = 'meta'; - var ID = 'builtin'; - var CLASS = 'qualifier'; - - var ATTRS_NEST = { - '{': '}', - '(': ')', - '[': ']' - }; - - var jsMode = CodeMirror.getMode(config, 'javascript'); - - function State() { - this.javaScriptLine = false; - this.javaScriptLineExcludesColon = false; - - this.javaScriptArguments = false; - this.javaScriptArgumentsDepth = 0; - - this.isInterpolating = false; - this.interpolationNesting = 0; - - this.jsState = jsMode.startState(); - - this.restOfLine = ''; - - this.isIncludeFiltered = false; - this.isEach = false; - - this.lastTag = ''; - this.scriptType = ''; - - // Attributes Mode - this.isAttrs = false; - this.attrsNest = []; - this.inAttributeName = true; - this.attributeIsType = false; - this.attrValue = ''; - - // Indented Mode - this.indentOf = Infinity; - this.indentToken = ''; - - this.innerMode = null; - this.innerState = null; - - this.innerModeForLine = false; - } - /** - * Safely copy a state - * - * @return {State} - */ - State.prototype.copy = function () { - var res = new State(); - res.javaScriptLine = this.javaScriptLine; - res.javaScriptLineExcludesColon = this.javaScriptLineExcludesColon; - res.javaScriptArguments = this.javaScriptArguments; - res.javaScriptArgumentsDepth = this.javaScriptArgumentsDepth; - res.isInterpolating = this.isInterpolating; - res.interpolationNesting = this.intpolationNesting; - - res.jsState = CodeMirror.copyState(jsMode, this.jsState); - - res.innerMode = this.innerMode; - if (this.innerMode && this.innerState) { - res.innerState = CodeMirror.copyState(this.innerMode, this.innerState); - } - - res.restOfLine = this.restOfLine; - - res.isIncludeFiltered = this.isIncludeFiltered; - res.isEach = this.isEach; - res.lastTag = this.lastTag; - res.scriptType = this.scriptType; - res.isAttrs = this.isAttrs; - res.attrsNest = this.attrsNest.slice(); - res.inAttributeName = this.inAttributeName; - res.attributeIsType = this.attributeIsType; - res.attrValue = this.attrValue; - res.indentOf = this.indentOf; - res.indentToken = this.indentToken; - - res.innerModeForLine = this.innerModeForLine; - - return res; - }; - - function javaScript(stream, state) { - if (stream.sol()) { - // if javaScriptLine was set at end of line, ignore it - state.javaScriptLine = false; - state.javaScriptLineExcludesColon = false; - } - if (state.javaScriptLine) { - if (state.javaScriptLineExcludesColon && stream.peek() === ':') { - state.javaScriptLine = false; - state.javaScriptLineExcludesColon = false; - return; - } - var tok = jsMode.token(stream, state.jsState); - if (stream.eol()) state.javaScriptLine = false; - return tok || true; - } - } - function javaScriptArguments(stream, state) { - if (state.javaScriptArguments) { - if (state.javaScriptArgumentsDepth === 0 && stream.peek() !== '(') { - state.javaScriptArguments = false; - return; - } - if (stream.peek() === '(') { - state.javaScriptArgumentsDepth++; - } else if (stream.peek() === ')') { - state.javaScriptArgumentsDepth--; - } - if (state.javaScriptArgumentsDepth === 0) { - state.javaScriptArguments = false; - return; - } - - var tok = jsMode.token(stream, state.jsState); - return tok || true; - } - } - - function yieldStatement(stream) { - if (stream.match(/^yield\b/)) { - return 'keyword'; - } - } - - function doctype(stream) { - if (stream.match(/^(?:doctype) *([^\n]+)?/)) { - return DOCTYPE; - } - } - - function interpolation(stream, state) { - if (stream.match('#{')) { - state.isInterpolating = true; - state.interpolationNesting = 0; - return 'punctuation'; - } - } - - function interpolationContinued(stream, state) { - if (state.isInterpolating) { - if (stream.peek() === '}') { - state.interpolationNesting--; - if (state.interpolationNesting < 0) { - stream.next(); - state.isInterpolating = false; - return 'puncutation'; - } - } else if (stream.peek() === '{') { - state.interpolationNesting++; - } - return jsMode.token(stream, state.jsState) || true; - } - } - - function caseStatement(stream, state) { - if (stream.match(/^case\b/)) { - state.javaScriptLine = true; - return KEYWORD; - } - } - - function when(stream, state) { - if (stream.match(/^when\b/)) { - state.javaScriptLine = true; - state.javaScriptLineExcludesColon = true; - return KEYWORD; - } - } - - function defaultStatement(stream) { - if (stream.match(/^default\b/)) { - return KEYWORD; - } - } - - function extendsStatement(stream, state) { - if (stream.match(/^extends?\b/)) { - state.restOfLine = 'string'; - return KEYWORD; - } - } - - function append(stream, state) { - if (stream.match(/^append\b/)) { - state.restOfLine = 'variable'; - return KEYWORD; - } - } - function prepend(stream, state) { - if (stream.match(/^prepend\b/)) { - state.restOfLine = 'variable'; - return KEYWORD; - } - } - function block(stream, state) { - if (stream.match(/^block\b *(?:(prepend|append)\b)?/)) { - state.restOfLine = 'variable'; - return KEYWORD; - } - } - - function include(stream, state) { - if (stream.match(/^include\b/)) { - state.restOfLine = 'string'; - return KEYWORD; - } - } - - function includeFiltered(stream, state) { - if (stream.match(/^include:([a-zA-Z0-9\-]+)/, false) && stream.match('include')) { - state.isIncludeFiltered = true; - return KEYWORD; - } - } - - function includeFilteredContinued(stream, state) { - if (state.isIncludeFiltered) { - var tok = filter(stream, state); - state.isIncludeFiltered = false; - state.restOfLine = 'string'; - return tok; - } - } - - function mixin(stream, state) { - if (stream.match(/^mixin\b/)) { - state.javaScriptLine = true; - return KEYWORD; - } - } - - function call(stream, state) { - if (stream.match(/^\+([-\w]+)/)) { - if (!stream.match(/^\( *[-\w]+ *=/, false)) { - state.javaScriptArguments = true; - state.javaScriptArgumentsDepth = 0; - } - return 'variable'; - } - if (stream.match(/^\+#{/, false)) { - stream.next(); - state.mixinCallAfter = true; - return interpolation(stream, state); - } - } - function callArguments(stream, state) { - if (state.mixinCallAfter) { - state.mixinCallAfter = false; - if (!stream.match(/^\( *[-\w]+ *=/, false)) { - state.javaScriptArguments = true; - state.javaScriptArgumentsDepth = 0; - } - return true; - } - } - - function conditional(stream, state) { - if (stream.match(/^(if|unless|else if|else)\b/)) { - state.javaScriptLine = true; - return KEYWORD; - } - } - - function each(stream, state) { - if (stream.match(/^(- *)?(each|for)\b/)) { - state.isEach = true; - return KEYWORD; - } - } - function eachContinued(stream, state) { - if (state.isEach) { - if (stream.match(/^ in\b/)) { - state.javaScriptLine = true; - state.isEach = false; - return KEYWORD; - } else if (stream.sol() || stream.eol()) { - state.isEach = false; - } else if (stream.next()) { - while (!stream.match(/^ in\b/, false) && stream.next()); - return 'variable'; - } - } - } - - function whileStatement(stream, state) { - if (stream.match(/^while\b/)) { - state.javaScriptLine = true; - return KEYWORD; - } - } - - function tag(stream, state) { - var captures; - if (captures = stream.match(/^(\w(?:[-:\w]*\w)?)\/?/)) { - state.lastTag = captures[1].toLowerCase(); - if (state.lastTag === 'script') { - state.scriptType = 'application/javascript'; - } - return 'tag'; - } - } - - function filter(stream, state) { - if (stream.match(/^:([\w\-]+)/)) { - var innerMode; - if (config && config.innerModes) { - innerMode = config.innerModes(stream.current().substring(1)); - } - if (!innerMode) { - innerMode = stream.current().substring(1); - } - if (typeof innerMode === 'string') { - innerMode = CodeMirror.getMode(config, innerMode); - } - setInnerMode(stream, state, innerMode); - return 'atom'; - } - } - - function code(stream, state) { - if (stream.match(/^(!?=|-)/)) { - state.javaScriptLine = true; - return 'punctuation'; - } - } - - function id(stream) { - if (stream.match(/^#([\w-]+)/)) { - return ID; - } - } - - function className(stream) { - if (stream.match(/^\.([\w-]+)/)) { - return CLASS; - } - } - - function attrs(stream, state) { - if (stream.peek() == '(') { - stream.next(); - state.isAttrs = true; - state.attrsNest = []; - state.inAttributeName = true; - state.attrValue = ''; - state.attributeIsType = false; - return 'punctuation'; - } - } - - function attrsContinued(stream, state) { - if (state.isAttrs) { - if (ATTRS_NEST[stream.peek()]) { - state.attrsNest.push(ATTRS_NEST[stream.peek()]); - } - if (state.attrsNest[state.attrsNest.length - 1] === stream.peek()) { - state.attrsNest.pop(); - } else if (stream.eat(')')) { - state.isAttrs = false; - return 'punctuation'; - } - if (state.inAttributeName && stream.match(/^[^=,\)!]+/)) { - if (stream.peek() === '=' || stream.peek() === '!') { - state.inAttributeName = false; - state.jsState = jsMode.startState(); - if (state.lastTag === 'script' && stream.current().trim().toLowerCase() === 'type') { - state.attributeIsType = true; - } else { - state.attributeIsType = false; - } - } - return 'attribute'; - } - - var tok = jsMode.token(stream, state.jsState); - if (state.attributeIsType && tok === 'string') { - state.scriptType = stream.current().toString(); - } - if (state.attrsNest.length === 0 && (tok === 'string' || tok === 'variable' || tok === 'keyword')) { - try { - Function('', 'var x ' + state.attrValue.replace(/,\s*$/, '').replace(/^!/, '')); - state.inAttributeName = true; - state.attrValue = ''; - stream.backUp(stream.current().length); - return attrsContinued(stream, state); - } catch (ex) { - //not the end of an attribute - } - } - state.attrValue += stream.current(); - return tok || true; - } - } - - function attributesBlock(stream, state) { - if (stream.match(/^&attributes\b/)) { - state.javaScriptArguments = true; - state.javaScriptArgumentsDepth = 0; - return 'keyword'; - } - } - - function indent(stream) { - if (stream.sol() && stream.eatSpace()) { - return 'indent'; - } - } - - function comment(stream, state) { - if (stream.match(/^ *\/\/(-)?([^\n]*)/)) { - state.indentOf = stream.indentation(); - state.indentToken = 'comment'; - return 'comment'; - } - } - - function colon(stream) { - if (stream.match(/^: */)) { - return 'colon'; - } - } - - function text(stream, state) { - if (stream.match(/^(?:\| ?| )([^\n]+)/)) { - return 'string'; - } - if (stream.match(/^(<[^\n]*)/, false)) { - // html string - setInnerMode(stream, state, 'htmlmixed'); - state.innerModeForLine = true; - return innerMode(stream, state, true); - } - } - - function dot(stream, state) { - if (stream.eat('.')) { - var innerMode = null; - if (state.lastTag === 'script' && state.scriptType.toLowerCase().indexOf('javascript') != -1) { - innerMode = state.scriptType.toLowerCase().replace(/"|'/g, ''); - } else if (state.lastTag === 'style') { - innerMode = 'css'; - } - setInnerMode(stream, state, innerMode); - return 'dot'; - } - } - - function fail(stream) { - stream.next(); - return null; - } - - - function setInnerMode(stream, state, mode) { - mode = CodeMirror.mimeModes[mode] || mode; - mode = config.innerModes ? config.innerModes(mode) || mode : mode; - mode = CodeMirror.mimeModes[mode] || mode; - mode = CodeMirror.getMode(config, mode); - state.indentOf = stream.indentation(); - - if (mode && mode.name !== 'null') { - state.innerMode = mode; - } else { - state.indentToken = 'string'; - } - } - function innerMode(stream, state, force) { - if (stream.indentation() > state.indentOf || (state.innerModeForLine && !stream.sol()) || force) { - if (state.innerMode) { - if (!state.innerState) { - state.innerState = state.innerMode.startState ? state.innerMode.startState(stream.indentation()) : {}; - } - return stream.hideFirstChars(state.indentOf + 2, function () { - return state.innerMode.token(stream, state.innerState) || true; - }); - } else { - stream.skipToEnd(); - return state.indentToken; - } - } else if (stream.sol()) { - state.indentOf = Infinity; - state.indentToken = null; - state.innerMode = null; - state.innerState = null; - } - } - function restOfLine(stream, state) { - if (stream.sol()) { - // if restOfLine was set at end of line, ignore it - state.restOfLine = ''; - } - if (state.restOfLine) { - stream.skipToEnd(); - var tok = state.restOfLine; - state.restOfLine = ''; - return tok; - } - } - - - function startState() { - return new State(); - } - function copyState(state) { - return state.copy(); - } - /** - * Get the next token in the stream - * - * @param {Stream} stream - * @param {State} state - */ - function nextToken(stream, state) { - var tok = innerMode(stream, state) - || restOfLine(stream, state) - || interpolationContinued(stream, state) - || includeFilteredContinued(stream, state) - || eachContinued(stream, state) - || attrsContinued(stream, state) - || javaScript(stream, state) - || javaScriptArguments(stream, state) - || callArguments(stream, state) - - || yieldStatement(stream, state) - || doctype(stream, state) - || interpolation(stream, state) - || caseStatement(stream, state) - || when(stream, state) - || defaultStatement(stream, state) - || extendsStatement(stream, state) - || append(stream, state) - || prepend(stream, state) - || block(stream, state) - || include(stream, state) - || includeFiltered(stream, state) - || mixin(stream, state) - || call(stream, state) - || conditional(stream, state) - || each(stream, state) - || whileStatement(stream, state) - || tag(stream, state) - || filter(stream, state) - || code(stream, state) - || id(stream, state) - || className(stream, state) - || attrs(stream, state) - || attributesBlock(stream, state) - || indent(stream, state) - || text(stream, state) - || comment(stream, state) - || colon(stream, state) - || dot(stream, state) - || fail(stream, state); - - return tok === true ? null : tok; - } - return { - startState: startState, - copyState: copyState, - token: nextToken - }; -}); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../javascript/javascript"), require("../css/css"), require("../htmlmixed/htmlmixed")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../javascript/javascript", "../css/css", "../htmlmixed/htmlmixed"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode('jade', function (config) { + // token types + var KEYWORD = 'keyword'; + var DOCTYPE = 'meta'; + var ID = 'builtin'; + var CLASS = 'qualifier'; + + var ATTRS_NEST = { + '{': '}', + '(': ')', + '[': ']' + }; + + var jsMode = CodeMirror.getMode(config, 'javascript'); + + function State() { + this.javaScriptLine = false; + this.javaScriptLineExcludesColon = false; + + this.javaScriptArguments = false; + this.javaScriptArgumentsDepth = 0; + + this.isInterpolating = false; + this.interpolationNesting = 0; + + this.jsState = jsMode.startState(); + + this.restOfLine = ''; + + this.isIncludeFiltered = false; + this.isEach = false; + + this.lastTag = ''; + this.scriptType = ''; + + // Attributes Mode + this.isAttrs = false; + this.attrsNest = []; + this.inAttributeName = true; + this.attributeIsType = false; + this.attrValue = ''; + + // Indented Mode + this.indentOf = Infinity; + this.indentToken = ''; + + this.innerMode = null; + this.innerState = null; + + this.innerModeForLine = false; + } + + /** + * Safely copy a state + * + * @return {State} + */ + State.prototype.copy = function () { + var res = new State(); + res.javaScriptLine = this.javaScriptLine; + res.javaScriptLineExcludesColon = this.javaScriptLineExcludesColon; + res.javaScriptArguments = this.javaScriptArguments; + res.javaScriptArgumentsDepth = this.javaScriptArgumentsDepth; + res.isInterpolating = this.isInterpolating; + res.interpolationNesting = this.intpolationNesting; + + res.jsState = CodeMirror.copyState(jsMode, this.jsState); + + res.innerMode = this.innerMode; + if (this.innerMode && this.innerState) { + res.innerState = CodeMirror.copyState(this.innerMode, this.innerState); + } + + res.restOfLine = this.restOfLine; + + res.isIncludeFiltered = this.isIncludeFiltered; + res.isEach = this.isEach; + res.lastTag = this.lastTag; + res.scriptType = this.scriptType; + res.isAttrs = this.isAttrs; + res.attrsNest = this.attrsNest.slice(); + res.inAttributeName = this.inAttributeName; + res.attributeIsType = this.attributeIsType; + res.attrValue = this.attrValue; + res.indentOf = this.indentOf; + res.indentToken = this.indentToken; + + res.innerModeForLine = this.innerModeForLine; + + return res; + }; + + function javaScript(stream, state) { + if (stream.sol()) { + // if javaScriptLine was set at end of line, ignore it + state.javaScriptLine = false; + state.javaScriptLineExcludesColon = false; + } + if (state.javaScriptLine) { + if (state.javaScriptLineExcludesColon && stream.peek() === ':') { + state.javaScriptLine = false; + state.javaScriptLineExcludesColon = false; + return; + } + var tok = jsMode.token(stream, state.jsState); + if (stream.eol()) state.javaScriptLine = false; + return tok || true; + } + } + + function javaScriptArguments(stream, state) { + if (state.javaScriptArguments) { + if (state.javaScriptArgumentsDepth === 0 && stream.peek() !== '(') { + state.javaScriptArguments = false; + return; + } + if (stream.peek() === '(') { + state.javaScriptArgumentsDepth++; + } else if (stream.peek() === ')') { + state.javaScriptArgumentsDepth--; + } + if (state.javaScriptArgumentsDepth === 0) { + state.javaScriptArguments = false; + return; + } + + var tok = jsMode.token(stream, state.jsState); + return tok || true; + } + } + + function yieldStatement(stream) { + if (stream.match(/^yield\b/)) { + return 'keyword'; + } + } + + function doctype(stream) { + if (stream.match(/^(?:doctype) *([^\n]+)?/)) { + return DOCTYPE; + } + } + + function interpolation(stream, state) { + if (stream.match('#{')) { + state.isInterpolating = true; + state.interpolationNesting = 0; + return 'punctuation'; + } + } + + function interpolationContinued(stream, state) { + if (state.isInterpolating) { + if (stream.peek() === '}') { + state.interpolationNesting--; + if (state.interpolationNesting < 0) { + stream.next(); + state.isInterpolating = false; + return 'puncutation'; + } + } else if (stream.peek() === '{') { + state.interpolationNesting++; + } + return jsMode.token(stream, state.jsState) || true; + } + } + + function caseStatement(stream, state) { + if (stream.match(/^case\b/)) { + state.javaScriptLine = true; + return KEYWORD; + } + } + + function when(stream, state) { + if (stream.match(/^when\b/)) { + state.javaScriptLine = true; + state.javaScriptLineExcludesColon = true; + return KEYWORD; + } + } + + function defaultStatement(stream) { + if (stream.match(/^default\b/)) { + return KEYWORD; + } + } + + function extendsStatement(stream, state) { + if (stream.match(/^extends?\b/)) { + state.restOfLine = 'string'; + return KEYWORD; + } + } + + function append(stream, state) { + if (stream.match(/^append\b/)) { + state.restOfLine = 'variable'; + return KEYWORD; + } + } + + function prepend(stream, state) { + if (stream.match(/^prepend\b/)) { + state.restOfLine = 'variable'; + return KEYWORD; + } + } + + function block(stream, state) { + if (stream.match(/^block\b *(?:(prepend|append)\b)?/)) { + state.restOfLine = 'variable'; + return KEYWORD; + } + } + + function include(stream, state) { + if (stream.match(/^include\b/)) { + state.restOfLine = 'string'; + return KEYWORD; + } + } + + function includeFiltered(stream, state) { + if (stream.match(/^include:([a-zA-Z0-9\-]+)/, false) && stream.match('include')) { + state.isIncludeFiltered = true; + return KEYWORD; + } + } + + function includeFilteredContinued(stream, state) { + if (state.isIncludeFiltered) { + var tok = filter(stream, state); + state.isIncludeFiltered = false; + state.restOfLine = 'string'; + return tok; + } + } + + function mixin(stream, state) { + if (stream.match(/^mixin\b/)) { + state.javaScriptLine = true; + return KEYWORD; + } + } + + function call(stream, state) { + if (stream.match(/^\+([-\w]+)/)) { + if (!stream.match(/^\( *[-\w]+ *=/, false)) { + state.javaScriptArguments = true; + state.javaScriptArgumentsDepth = 0; + } + return 'variable'; + } + if (stream.match(/^\+#{/, false)) { + stream.next(); + state.mixinCallAfter = true; + return interpolation(stream, state); + } + } + + function callArguments(stream, state) { + if (state.mixinCallAfter) { + state.mixinCallAfter = false; + if (!stream.match(/^\( *[-\w]+ *=/, false)) { + state.javaScriptArguments = true; + state.javaScriptArgumentsDepth = 0; + } + return true; + } + } + + function conditional(stream, state) { + if (stream.match(/^(if|unless|else if|else)\b/)) { + state.javaScriptLine = true; + return KEYWORD; + } + } + + function each(stream, state) { + if (stream.match(/^(- *)?(each|for)\b/)) { + state.isEach = true; + return KEYWORD; + } + } + + function eachContinued(stream, state) { + if (state.isEach) { + if (stream.match(/^ in\b/)) { + state.javaScriptLine = true; + state.isEach = false; + return KEYWORD; + } else if (stream.sol() || stream.eol()) { + state.isEach = false; + } else if (stream.next()) { + while (!stream.match(/^ in\b/, false) && stream.next()) ; + return 'variable'; + } + } + } + + function whileStatement(stream, state) { + if (stream.match(/^while\b/)) { + state.javaScriptLine = true; + return KEYWORD; + } + } + + function tag(stream, state) { + var captures; + if (captures = stream.match(/^(\w(?:[-:\w]*\w)?)\/?/)) { + state.lastTag = captures[1].toLowerCase(); + if (state.lastTag === 'script') { + state.scriptType = 'application/javascript'; + } + return 'tag'; + } + } + + function filter(stream, state) { + if (stream.match(/^:([\w\-]+)/)) { + var innerMode; + if (config && config.innerModes) { + innerMode = config.innerModes(stream.current().substring(1)); + } + if (!innerMode) { + innerMode = stream.current().substring(1); + } + if (typeof innerMode === 'string') { + innerMode = CodeMirror.getMode(config, innerMode); + } + setInnerMode(stream, state, innerMode); + return 'atom'; + } + } + + function code(stream, state) { + if (stream.match(/^(!?=|-)/)) { + state.javaScriptLine = true; + return 'punctuation'; + } + } + + function id(stream) { + if (stream.match(/^#([\w-]+)/)) { + return ID; + } + } + + function className(stream) { + if (stream.match(/^\.([\w-]+)/)) { + return CLASS; + } + } + + function attrs(stream, state) { + if (stream.peek() == '(') { + stream.next(); + state.isAttrs = true; + state.attrsNest = []; + state.inAttributeName = true; + state.attrValue = ''; + state.attributeIsType = false; + return 'punctuation'; + } + } + + function attrsContinued(stream, state) { + if (state.isAttrs) { + if (ATTRS_NEST[stream.peek()]) { + state.attrsNest.push(ATTRS_NEST[stream.peek()]); + } + if (state.attrsNest[state.attrsNest.length - 1] === stream.peek()) { + state.attrsNest.pop(); + } else if (stream.eat(')')) { + state.isAttrs = false; + return 'punctuation'; + } + if (state.inAttributeName && stream.match(/^[^=,\)!]+/)) { + if (stream.peek() === '=' || stream.peek() === '!') { + state.inAttributeName = false; + state.jsState = jsMode.startState(); + if (state.lastTag === 'script' && stream.current().trim().toLowerCase() === 'type') { + state.attributeIsType = true; + } else { + state.attributeIsType = false; + } + } + return 'attribute'; + } + + var tok = jsMode.token(stream, state.jsState); + if (state.attributeIsType && tok === 'string') { + state.scriptType = stream.current().toString(); + } + if (state.attrsNest.length === 0 && (tok === 'string' || tok === 'variable' || tok === 'keyword')) { + try { + Function('', 'var x ' + state.attrValue.replace(/,\s*$/, '').replace(/^!/, '')); + state.inAttributeName = true; + state.attrValue = ''; + stream.backUp(stream.current().length); + return attrsContinued(stream, state); + } catch (ex) { + //not the end of an attribute + } + } + state.attrValue += stream.current(); + return tok || true; + } + } + + function attributesBlock(stream, state) { + if (stream.match(/^&attributes\b/)) { + state.javaScriptArguments = true; + state.javaScriptArgumentsDepth = 0; + return 'keyword'; + } + } + + function indent(stream) { + if (stream.sol() && stream.eatSpace()) { + return 'indent'; + } + } + + function comment(stream, state) { + if (stream.match(/^ *\/\/(-)?([^\n]*)/)) { + state.indentOf = stream.indentation(); + state.indentToken = 'comment'; + return 'comment'; + } + } + + function colon(stream) { + if (stream.match(/^: */)) { + return 'colon'; + } + } + + function text(stream, state) { + if (stream.match(/^(?:\| ?| )([^\n]+)/)) { + return 'string'; + } + if (stream.match(/^(<[^\n]*)/, false)) { + // html string + setInnerMode(stream, state, 'htmlmixed'); + state.innerModeForLine = true; + return innerMode(stream, state, true); + } + } + + function dot(stream, state) { + if (stream.eat('.')) { + var innerMode = null; + if (state.lastTag === 'script' && state.scriptType.toLowerCase().indexOf('javascript') != -1) { + innerMode = state.scriptType.toLowerCase().replace(/"|'/g, ''); + } else if (state.lastTag === 'style') { + innerMode = 'css'; + } + setInnerMode(stream, state, innerMode); + return 'dot'; + } + } + + function fail(stream) { + stream.next(); + return null; + } + + + function setInnerMode(stream, state, mode) { + mode = CodeMirror.mimeModes[mode] || mode; + mode = config.innerModes ? config.innerModes(mode) || mode : mode; + mode = CodeMirror.mimeModes[mode] || mode; + mode = CodeMirror.getMode(config, mode); + state.indentOf = stream.indentation(); + + if (mode && mode.name !== 'null') { + state.innerMode = mode; + } else { + state.indentToken = 'string'; + } + } + + function innerMode(stream, state, force) { + if (stream.indentation() > state.indentOf || (state.innerModeForLine && !stream.sol()) || force) { + if (state.innerMode) { + if (!state.innerState) { + state.innerState = state.innerMode.startState ? state.innerMode.startState(stream.indentation()) : {}; + } + return stream.hideFirstChars(state.indentOf + 2, function () { + return state.innerMode.token(stream, state.innerState) || true; + }); + } else { + stream.skipToEnd(); + return state.indentToken; + } + } else if (stream.sol()) { + state.indentOf = Infinity; + state.indentToken = null; + state.innerMode = null; + state.innerState = null; + } + } + + function restOfLine(stream, state) { + if (stream.sol()) { + // if restOfLine was set at end of line, ignore it + state.restOfLine = ''; + } + if (state.restOfLine) { + stream.skipToEnd(); + var tok = state.restOfLine; + state.restOfLine = ''; + return tok; + } + } + + + function startState() { + return new State(); + } + + function copyState(state) { + return state.copy(); + } + + /** + * Get the next token in the stream + * + * @param {Stream} stream + * @param {State} state + */ + function nextToken(stream, state) { + var tok = innerMode(stream, state) + || restOfLine(stream, state) + || interpolationContinued(stream, state) + || includeFilteredContinued(stream, state) + || eachContinued(stream, state) + || attrsContinued(stream, state) + || javaScript(stream, state) + || javaScriptArguments(stream, state) + || callArguments(stream, state) + + || yieldStatement(stream, state) + || doctype(stream, state) + || interpolation(stream, state) + || caseStatement(stream, state) + || when(stream, state) + || defaultStatement(stream, state) + || extendsStatement(stream, state) + || append(stream, state) + || prepend(stream, state) + || block(stream, state) + || include(stream, state) + || includeFiltered(stream, state) + || mixin(stream, state) + || call(stream, state) + || conditional(stream, state) + || each(stream, state) + || whileStatement(stream, state) + || tag(stream, state) + || filter(stream, state) + || code(stream, state) + || id(stream, state) + || className(stream, state) + || attrs(stream, state) + || attributesBlock(stream, state) + || indent(stream, state) + || text(stream, state) + || comment(stream, state) + || colon(stream, state) + || dot(stream, state) + || fail(stream, state); + + return tok === true ? null : tok; + } + + return { + startState: startState, + copyState: copyState, + token: nextToken + }; + }); -CodeMirror.defineMIME('text/x-jade', 'jade'); + CodeMirror.defineMIME('text/x-jade', 'jade'); }); diff --git a/web/editor.md/lib/codemirror/mode/javascript/index.html b/web/editor.md/lib/codemirror/mode/javascript/index.html index 592a133..b082b26 100644 --- a/web/editor.md/lib/codemirror/mode/javascript/index.html +++ b/web/editor.md/lib/codemirror/mode/javascript/index.html @@ -2,34 +2,37 @@ CodeMirror: JavaScript mode - + - + - +
-

JavaScript mode

+

JavaScript mode

-

- JavaScript mode supports several configuration options: -

    + JavaScript mode supports several configuration options: +
    • json which will set the mode to expect JSON - data rather than a JavaScript program.
    • + data rather than a JavaScript program. +
    • jsonld which will set the mode to expect - JSON-LD linked data rather - than a JavaScript program (demo).
    • + JSON-LD linked data rather + than a JavaScript program (demo). +
    • typescript which will activate additional - syntax highlighting and some other things for TypeScript code - (demo).
    • + syntax highlighting and some other things for TypeScript code + (demo). +
    • statementIndent which (given a number) will - determine the amount of indentation to use for statements - continued on a new line.
    • + determine the amount of indentation to use for statements + continued on a new line. +
    • wordCharacters, a regexp that indicates which - characters should be considered part of an identifier. - Defaults to /[\w$]/, which does not handle - non-ASCII identifiers. Can be set to something more elaborate - to improve Unicode support.
    • -
    + characters should be considered part of an identifier. + Defaults to /[\w$]/, which does not handle + non-ASCII identifiers. Can be set to something more elaborate + to improve Unicode support. + +

-

MIME types defined: text/javascript, application/json, application/ld+json, text/typescript, application/typescript.

-
+

MIME types defined: text/javascript, application/json, application/ld+json, + text/typescript, application/typescript.

+ diff --git a/web/editor.md/lib/codemirror/mode/javascript/javascript.js b/web/editor.md/lib/codemirror/mode/javascript/javascript.js index 3f05ac4..9db89ea 100644 --- a/web/editor.md/lib/codemirror/mode/javascript/javascript.js +++ b/web/editor.md/lib/codemirror/mode/javascript/javascript.js @@ -3,690 +3,805 @@ // TODO actually recognize syntax of TypeScript constructs -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("javascript", function(config, parserConfig) { - var indentUnit = config.indentUnit; - var statementIndent = parserConfig.statementIndent; - var jsonldMode = parserConfig.jsonld; - var jsonMode = parserConfig.json || jsonldMode; - var isTS = parserConfig.typescript; - var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/; - - // Tokenizer - - var keywords = function(){ - function kw(type) {return {type: type, style: "keyword"};} - var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"); - var operator = kw("operator"), atom = {type: "atom", style: "atom"}; - - var jsKeywords = { - "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B, - "return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C, "debugger": C, - "var": kw("var"), "const": kw("var"), "let": kw("var"), - "function": kw("function"), "catch": kw("catch"), - "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"), - "in": operator, "typeof": operator, "instanceof": operator, - "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom, - "this": kw("this"), "module": kw("module"), "class": kw("class"), "super": kw("atom"), - "yield": C, "export": kw("export"), "import": kw("import"), "extends": C - }; - - // Extend the 'normal' keywords with the TypeScript language extensions - if (isTS) { - var type = {type: "variable", style: "variable-3"}; - var tsKeywords = { - // object-like things - "interface": kw("interface"), - "extends": kw("extends"), - "constructor": kw("constructor"), - - // scope modifiers - "public": kw("public"), - "private": kw("private"), - "protected": kw("protected"), - "static": kw("static"), - - // types - "string": type, "number": type, "bool": type, "any": type - }; - - for (var attr in tsKeywords) { - jsKeywords[attr] = tsKeywords[attr]; - } - } - - return jsKeywords; - }(); - - var isOperatorChar = /[+\-*&%=<>!?|~^]/; - var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/; - - function readRegexp(stream) { - var escaped = false, next, inSet = false; - while ((next = stream.next()) != null) { - if (!escaped) { - if (next == "/" && !inSet) return; - if (next == "[") inSet = true; - else if (inSet && next == "]") inSet = false; - } - escaped = !escaped && next == "\\"; - } - } - - // Used as scratch variables to communicate multiple values without - // consing up tons of objects. - var type, content; - function ret(tp, style, cont) { - type = tp; content = cont; - return style; - } - function tokenBase(stream, state) { - var ch = stream.next(); - if (ch == '"' || ch == "'") { - state.tokenize = tokenString(ch); - return state.tokenize(stream, state); - } else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) { - return ret("number", "number"); - } else if (ch == "." && stream.match("..")) { - return ret("spread", "meta"); - } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) { - return ret(ch); - } else if (ch == "=" && stream.eat(">")) { - return ret("=>", "operator"); - } else if (ch == "0" && stream.eat(/x/i)) { - stream.eatWhile(/[\da-f]/i); - return ret("number", "number"); - } else if (/\d/.test(ch)) { - stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/); - return ret("number", "number"); - } else if (ch == "/") { - if (stream.eat("*")) { - state.tokenize = tokenComment; - return tokenComment(stream, state); - } else if (stream.eat("/")) { - stream.skipToEnd(); - return ret("comment", "comment"); - } else if (state.lastType == "operator" || state.lastType == "keyword c" || - state.lastType == "sof" || /^[\[{}\(,;:]$/.test(state.lastType)) { - readRegexp(stream); - stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/); - return ret("regexp", "string-2"); - } else { - stream.eatWhile(isOperatorChar); - return ret("operator", "operator", stream.current()); - } - } else if (ch == "`") { - state.tokenize = tokenQuasi; - return tokenQuasi(stream, state); - } else if (ch == "#") { - stream.skipToEnd(); - return ret("error", "error"); - } else if (isOperatorChar.test(ch)) { - stream.eatWhile(isOperatorChar); - return ret("operator", "operator", stream.current()); - } else if (wordRE.test(ch)) { - stream.eatWhile(wordRE); - var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word]; - return (known && state.lastType != ".") ? ret(known.type, known.style, word) : - ret("variable", "variable", word); - } - } - - function tokenString(quote) { - return function(stream, state) { - var escaped = false, next; - if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){ - state.tokenize = tokenBase; - return ret("jsonld-keyword", "meta"); - } - while ((next = stream.next()) != null) { - if (next == quote && !escaped) break; - escaped = !escaped && next == "\\"; - } - if (!escaped) state.tokenize = tokenBase; - return ret("string", "string"); - }; - } - - function tokenComment(stream, state) { - var maybeEnd = false, ch; - while (ch = stream.next()) { - if (ch == "/" && maybeEnd) { - state.tokenize = tokenBase; - break; - } - maybeEnd = (ch == "*"); - } - return ret("comment", "comment"); - } - - function tokenQuasi(stream, state) { - var escaped = false, next; - while ((next = stream.next()) != null) { - if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) { - state.tokenize = tokenBase; - break; - } - escaped = !escaped && next == "\\"; - } - return ret("quasi", "string-2", stream.current()); - } - - var brackets = "([{}])"; - // This is a crude lookahead trick to try and notice that we're - // parsing the argument patterns for a fat-arrow function before we - // actually hit the arrow token. It only works if the arrow is on - // the same line as the arguments and there's no strange noise - // (comments) in between. Fallback is to only notice when we hit the - // arrow, and not declare the arguments as locals for the arrow - // body. - function findFatArrow(stream, state) { - if (state.fatArrowAt) state.fatArrowAt = null; - var arrow = stream.string.indexOf("=>", stream.start); - if (arrow < 0) return; - - var depth = 0, sawSomething = false; - for (var pos = arrow - 1; pos >= 0; --pos) { - var ch = stream.string.charAt(pos); - var bracket = brackets.indexOf(ch); - if (bracket >= 0 && bracket < 3) { - if (!depth) { ++pos; break; } - if (--depth == 0) break; - } else if (bracket >= 3 && bracket < 6) { - ++depth; - } else if (wordRE.test(ch)) { - sawSomething = true; - } else if (/["'\/]/.test(ch)) { - return; - } else if (sawSomething && !depth) { - ++pos; - break; - } - } - if (sawSomething && !depth) state.fatArrowAt = pos; - } - - // Parser - - var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true}; - - function JSLexical(indented, column, type, align, prev, info) { - this.indented = indented; - this.column = column; - this.type = type; - this.prev = prev; - this.info = info; - if (align != null) this.align = align; - } - - function inScope(state, varname) { - for (var v = state.localVars; v; v = v.next) - if (v.name == varname) return true; - for (var cx = state.context; cx; cx = cx.prev) { - for (var v = cx.vars; v; v = v.next) - if (v.name == varname) return true; - } - } - - function parseJS(state, style, type, content, stream) { - var cc = state.cc; - // Communicate our context to the combinators. - // (Less wasteful than consing up a hundred closures on every call.) - cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style; - - if (!state.lexical.hasOwnProperty("align")) - state.lexical.align = true; - - while(true) { - var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement; - if (combinator(type, content)) { - while(cc.length && cc[cc.length - 1].lex) - cc.pop()(); - if (cx.marked) return cx.marked; - if (type == "variable" && inScope(state, content)) return "variable-2"; - return style; - } - } - } - - // Combinator utils - - var cx = {state: null, column: null, marked: null, cc: null}; - function pass() { - for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); - } - function cont() { - pass.apply(null, arguments); - return true; - } - function register(varname) { - function inList(list) { - for (var v = list; v; v = v.next) - if (v.name == varname) return true; - return false; - } - var state = cx.state; - if (state.context) { - cx.marked = "def"; - if (inList(state.localVars)) return; - state.localVars = {name: varname, next: state.localVars}; - } else { - if (inList(state.globalVars)) return; - if (parserConfig.globalVars) - state.globalVars = {name: varname, next: state.globalVars}; - } - } - - // Combinators - - var defaultVars = {name: "this", next: {name: "arguments"}}; - function pushcontext() { - cx.state.context = {prev: cx.state.context, vars: cx.state.localVars}; - cx.state.localVars = defaultVars; - } - function popcontext() { - cx.state.localVars = cx.state.context.vars; - cx.state.context = cx.state.context.prev; - } - function pushlex(type, info) { - var result = function() { - var state = cx.state, indent = state.indented; - if (state.lexical.type == "stat") indent = state.lexical.indented; - else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev) - indent = outer.indented; - state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info); - }; - result.lex = true; - return result; - } - function poplex() { - var state = cx.state; - if (state.lexical.prev) { - if (state.lexical.type == ")") - state.indented = state.lexical.indented; - state.lexical = state.lexical.prev; - } - } - poplex.lex = true; - - function expect(wanted) { - function exp(type) { - if (type == wanted) return cont(); - else if (wanted == ";") return pass(); - else return cont(exp); - }; - return exp; - } - - function statement(type, value) { - if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex); - if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex); - if (type == "keyword b") return cont(pushlex("form"), statement, poplex); - if (type == "{") return cont(pushlex("}"), block, poplex); - if (type == ";") return cont(); - if (type == "if") { - if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex) - cx.state.cc.pop()(); - return cont(pushlex("form"), expression, statement, poplex, maybeelse); - } - if (type == "function") return cont(functiondef); - if (type == "for") return cont(pushlex("form"), forspec, statement, poplex); - if (type == "variable") return cont(pushlex("stat"), maybelabel); - if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"), - block, poplex, poplex); - if (type == "case") return cont(expression, expect(":")); - if (type == "default") return cont(expect(":")); - if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), - statement, poplex, popcontext); - if (type == "module") return cont(pushlex("form"), pushcontext, afterModule, popcontext, poplex); - if (type == "class") return cont(pushlex("form"), className, poplex); - if (type == "export") return cont(pushlex("form"), afterExport, poplex); - if (type == "import") return cont(pushlex("form"), afterImport, poplex); - return pass(pushlex("stat"), expression, expect(";"), poplex); - } - function expression(type) { - return expressionInner(type, false); - } - function expressionNoComma(type) { - return expressionInner(type, true); - } - function expressionInner(type, noComma) { - if (cx.state.fatArrowAt == cx.stream.start) { - var body = noComma ? arrowBodyNoComma : arrowBody; - if (type == "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext); - else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext); - } - - var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma; - if (atomicTypes.hasOwnProperty(type)) return cont(maybeop); - if (type == "function") return cont(functiondef, maybeop); - if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression); - if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop); - if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression); - if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop); - if (type == "{") return contCommasep(objprop, "}", null, maybeop); - if (type == "quasi") { return pass(quasi, maybeop); } - return cont(); - } - function maybeexpression(type) { - if (type.match(/[;\}\)\],]/)) return pass(); - return pass(expression); - } - function maybeexpressionNoComma(type) { - if (type.match(/[;\}\)\],]/)) return pass(); - return pass(expressionNoComma); - } - - function maybeoperatorComma(type, value) { - if (type == ",") return cont(expression); - return maybeoperatorNoComma(type, value, false); - } - function maybeoperatorNoComma(type, value, noComma) { - var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma; - var expr = noComma == false ? expression : expressionNoComma; - if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext); - if (type == "operator") { - if (/\+\+|--/.test(value)) return cont(me); - if (value == "?") return cont(expression, expect(":"), expr); - return cont(expr); - } - if (type == "quasi") { return pass(quasi, me); } - if (type == ";") return; - if (type == "(") return contCommasep(expressionNoComma, ")", "call", me); - if (type == ".") return cont(property, me); - if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me); - } - function quasi(type, value) { - if (type != "quasi") return pass(); - if (value.slice(value.length - 2) != "${") return cont(quasi); - return cont(expression, continueQuasi); - } - function continueQuasi(type) { - if (type == "}") { - cx.marked = "string-2"; - cx.state.tokenize = tokenQuasi; - return cont(quasi); - } - } - function arrowBody(type) { - findFatArrow(cx.stream, cx.state); - return pass(type == "{" ? statement : expression); - } - function arrowBodyNoComma(type) { - findFatArrow(cx.stream, cx.state); - return pass(type == "{" ? statement : expressionNoComma); - } - function maybelabel(type) { - if (type == ":") return cont(poplex, statement); - return pass(maybeoperatorComma, expect(";"), poplex); - } - function property(type) { - if (type == "variable") {cx.marked = "property"; return cont();} - } - function objprop(type, value) { - if (type == "variable" || cx.style == "keyword") { - cx.marked = "property"; - if (value == "get" || value == "set") return cont(getterSetter); - return cont(afterprop); - } else if (type == "number" || type == "string") { - cx.marked = jsonldMode ? "property" : (cx.style + " property"); - return cont(afterprop); - } else if (type == "jsonld-keyword") { - return cont(afterprop); - } else if (type == "[") { - return cont(expression, expect("]"), afterprop); - } - } - function getterSetter(type) { - if (type != "variable") return pass(afterprop); - cx.marked = "property"; - return cont(functiondef); - } - function afterprop(type) { - if (type == ":") return cont(expressionNoComma); - if (type == "(") return pass(functiondef); - } - function commasep(what, end) { - function proceed(type) { - if (type == ",") { - var lex = cx.state.lexical; - if (lex.info == "call") lex.pos = (lex.pos || 0) + 1; - return cont(what, proceed); - } - if (type == end) return cont(); - return cont(expect(end)); - } - return function(type) { - if (type == end) return cont(); - return pass(what, proceed); - }; - } - function contCommasep(what, end, info) { - for (var i = 3; i < arguments.length; i++) - cx.cc.push(arguments[i]); - return cont(pushlex(end, info), commasep(what, end), poplex); - } - function block(type) { - if (type == "}") return cont(); - return pass(statement, block); - } - function maybetype(type) { - if (isTS && type == ":") return cont(typedef); - } - function typedef(type) { - if (type == "variable"){cx.marked = "variable-3"; return cont();} - } - function vardef() { - return pass(pattern, maybetype, maybeAssign, vardefCont); - } - function pattern(type, value) { - if (type == "variable") { register(value); return cont(); } - if (type == "[") return contCommasep(pattern, "]"); - if (type == "{") return contCommasep(proppattern, "}"); - } - function proppattern(type, value) { - if (type == "variable" && !cx.stream.match(/^\s*:/, false)) { - register(value); - return cont(maybeAssign); - } - if (type == "variable") cx.marked = "property"; - return cont(expect(":"), pattern, maybeAssign); - } - function maybeAssign(_type, value) { - if (value == "=") return cont(expressionNoComma); - } - function vardefCont(type) { - if (type == ",") return cont(vardef); - } - function maybeelse(type, value) { - if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex); - } - function forspec(type) { - if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex); - } - function forspec1(type) { - if (type == "var") return cont(vardef, expect(";"), forspec2); - if (type == ";") return cont(forspec2); - if (type == "variable") return cont(formaybeinof); - return pass(expression, expect(";"), forspec2); - } - function formaybeinof(_type, value) { - if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); } - return cont(maybeoperatorComma, forspec2); - } - function forspec2(type, value) { - if (type == ";") return cont(forspec3); - if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); } - return pass(expression, expect(";"), forspec3); - } - function forspec3(type) { - if (type != ")") cont(expression); - } - function functiondef(type, value) { - if (value == "*") {cx.marked = "keyword"; return cont(functiondef);} - if (type == "variable") {register(value); return cont(functiondef);} - if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, statement, popcontext); - } - function funarg(type) { - if (type == "spread") return cont(funarg); - return pass(pattern, maybetype); - } - function className(type, value) { - if (type == "variable") {register(value); return cont(classNameAfter);} - } - function classNameAfter(type, value) { - if (value == "extends") return cont(expression, classNameAfter); - if (type == "{") return cont(pushlex("}"), classBody, poplex); - } - function classBody(type, value) { - if (type == "variable" || cx.style == "keyword") { - cx.marked = "property"; - if (value == "get" || value == "set") return cont(classGetterSetter, functiondef, classBody); - return cont(functiondef, classBody); - } - if (value == "*") { - cx.marked = "keyword"; - return cont(classBody); - } - if (type == ";") return cont(classBody); - if (type == "}") return cont(); - } - function classGetterSetter(type) { - if (type != "variable") return pass(); - cx.marked = "property"; - return cont(); - } - function afterModule(type, value) { - if (type == "string") return cont(statement); - if (type == "variable") { register(value); return cont(maybeFrom); } - } - function afterExport(_type, value) { - if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); } - if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); } - return pass(statement); - } - function afterImport(type) { - if (type == "string") return cont(); - return pass(importSpec, maybeFrom); - } - function importSpec(type, value) { - if (type == "{") return contCommasep(importSpec, "}"); - if (type == "variable") register(value); - return cont(); - } - function maybeFrom(_type, value) { - if (value == "from") { cx.marked = "keyword"; return cont(expression); } - } - function arrayLiteral(type) { - if (type == "]") return cont(); - return pass(expressionNoComma, maybeArrayComprehension); - } - function maybeArrayComprehension(type) { - if (type == "for") return pass(comprehension, expect("]")); - if (type == ",") return cont(commasep(maybeexpressionNoComma, "]")); - return pass(commasep(expressionNoComma, "]")); - } - function comprehension(type) { - if (type == "for") return cont(forspec, comprehension); - if (type == "if") return cont(expression, comprehension); - } - - function isContinuedStatement(state, textAfter) { - return state.lastType == "operator" || state.lastType == "," || - isOperatorChar.test(textAfter.charAt(0)) || - /[,.]/.test(textAfter.charAt(0)); - } - - // Interface - - return { - startState: function(basecolumn) { - var state = { - tokenize: tokenBase, - lastType: "sof", - cc: [], - lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false), - localVars: parserConfig.localVars, - context: parserConfig.localVars && {vars: parserConfig.localVars}, - indented: 0 - }; - if (parserConfig.globalVars && typeof parserConfig.globalVars == "object") - state.globalVars = parserConfig.globalVars; - return state; - }, - - token: function(stream, state) { - if (stream.sol()) { - if (!state.lexical.hasOwnProperty("align")) - state.lexical.align = false; - state.indented = stream.indentation(); - findFatArrow(stream, state); - } - if (state.tokenize != tokenComment && stream.eatSpace()) return null; - var style = state.tokenize(stream, state); - if (type == "comment") return style; - state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type; - return parseJS(state, style, type, content, stream); - }, - - indent: function(state, textAfter) { - if (state.tokenize == tokenComment) return CodeMirror.Pass; - if (state.tokenize != tokenBase) return 0; - var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical; - // Kludge to prevent 'maybelse' from blocking lexical scope pops - if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) { - var c = state.cc[i]; - if (c == poplex) lexical = lexical.prev; - else if (c != maybeelse) break; - } - if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev; - if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat") - lexical = lexical.prev; - var type = lexical.type, closing = firstChar == type; - - if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0); - else if (type == "form" && firstChar == "{") return lexical.indented; - else if (type == "form") return lexical.indented + indentUnit; - else if (type == "stat") - return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0); - else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false) - return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit); - else if (lexical.align) return lexical.column + (closing ? 0 : 1); - else return lexical.indented + (closing ? 0 : indentUnit); - }, - - electricInput: /^\s*(?:case .*?:|default:|\{|\})$/, - blockCommentStart: jsonMode ? null : "/*", - blockCommentEnd: jsonMode ? null : "*/", - lineComment: jsonMode ? null : "//", - fold: "brace", - - helperType: jsonMode ? "json" : "javascript", - jsonldMode: jsonldMode, - jsonMode: jsonMode - }; -}); - -CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/); - -CodeMirror.defineMIME("text/javascript", "javascript"); -CodeMirror.defineMIME("text/ecmascript", "javascript"); -CodeMirror.defineMIME("application/javascript", "javascript"); -CodeMirror.defineMIME("application/x-javascript", "javascript"); -CodeMirror.defineMIME("application/ecmascript", "javascript"); -CodeMirror.defineMIME("application/json", {name: "javascript", json: true}); -CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true}); -CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true}); -CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true }); -CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true }); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("javascript", function (config, parserConfig) { + var indentUnit = config.indentUnit; + var statementIndent = parserConfig.statementIndent; + var jsonldMode = parserConfig.jsonld; + var jsonMode = parserConfig.json || jsonldMode; + var isTS = parserConfig.typescript; + var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/; + + // Tokenizer + + var keywords = function () { + function kw(type) { + return {type: type, style: "keyword"}; + } + + var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"); + var operator = kw("operator"), atom = {type: "atom", style: "atom"}; + + var jsKeywords = { + "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B, + "return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C, "debugger": C, + "var": kw("var"), "const": kw("var"), "let": kw("var"), + "function": kw("function"), "catch": kw("catch"), + "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"), + "in": operator, "typeof": operator, "instanceof": operator, + "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom, + "this": kw("this"), "module": kw("module"), "class": kw("class"), "super": kw("atom"), + "yield": C, "export": kw("export"), "import": kw("import"), "extends": C + }; + + // Extend the 'normal' keywords with the TypeScript language extensions + if (isTS) { + var type = {type: "variable", style: "variable-3"}; + var tsKeywords = { + // object-like things + "interface": kw("interface"), + "extends": kw("extends"), + "constructor": kw("constructor"), + + // scope modifiers + "public": kw("public"), + "private": kw("private"), + "protected": kw("protected"), + "static": kw("static"), + + // types + "string": type, "number": type, "bool": type, "any": type + }; + + for (var attr in tsKeywords) { + jsKeywords[attr] = tsKeywords[attr]; + } + } + + return jsKeywords; + }(); + + var isOperatorChar = /[+\-*&%=<>!?|~^]/; + var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/; + + function readRegexp(stream) { + var escaped = false, next, inSet = false; + while ((next = stream.next()) != null) { + if (!escaped) { + if (next == "/" && !inSet) return; + if (next == "[") inSet = true; + else if (inSet && next == "]") inSet = false; + } + escaped = !escaped && next == "\\"; + } + } + + // Used as scratch variables to communicate multiple values without + // consing up tons of objects. + var type, content; + + function ret(tp, style, cont) { + type = tp; + content = cont; + return style; + } + + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == '"' || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) { + return ret("number", "number"); + } else if (ch == "." && stream.match("..")) { + return ret("spread", "meta"); + } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) { + return ret(ch); + } else if (ch == "=" && stream.eat(">")) { + return ret("=>", "operator"); + } else if (ch == "0" && stream.eat(/x/i)) { + stream.eatWhile(/[\da-f]/i); + return ret("number", "number"); + } else if (/\d/.test(ch)) { + stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/); + return ret("number", "number"); + } else if (ch == "/") { + if (stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } else if (stream.eat("/")) { + stream.skipToEnd(); + return ret("comment", "comment"); + } else if (state.lastType == "operator" || state.lastType == "keyword c" || + state.lastType == "sof" || /^[\[{}\(,;:]$/.test(state.lastType)) { + readRegexp(stream); + stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/); + return ret("regexp", "string-2"); + } else { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator", stream.current()); + } + } else if (ch == "`") { + state.tokenize = tokenQuasi; + return tokenQuasi(stream, state); + } else if (ch == "#") { + stream.skipToEnd(); + return ret("error", "error"); + } else if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator", stream.current()); + } else if (wordRE.test(ch)) { + stream.eatWhile(wordRE); + var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word]; + return (known && state.lastType != ".") ? ret(known.type, known.style, word) : + ret("variable", "variable", word); + } + } + + function tokenString(quote) { + return function (stream, state) { + var escaped = false, next; + if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)) { + state.tokenize = tokenBase; + return ret("jsonld-keyword", "meta"); + } + while ((next = stream.next()) != null) { + if (next == quote && !escaped) break; + escaped = !escaped && next == "\\"; + } + if (!escaped) state.tokenize = tokenBase; + return ret("string", "string"); + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return ret("comment", "comment"); + } + + function tokenQuasi(stream, state) { + var escaped = false, next; + while ((next = stream.next()) != null) { + if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) { + state.tokenize = tokenBase; + break; + } + escaped = !escaped && next == "\\"; + } + return ret("quasi", "string-2", stream.current()); + } + + var brackets = "([{}])"; + // This is a crude lookahead trick to try and notice that we're + // parsing the argument patterns for a fat-arrow function before we + // actually hit the arrow token. It only works if the arrow is on + // the same line as the arguments and there's no strange noise + // (comments) in between. Fallback is to only notice when we hit the + // arrow, and not declare the arguments as locals for the arrow + // body. + function findFatArrow(stream, state) { + if (state.fatArrowAt) state.fatArrowAt = null; + var arrow = stream.string.indexOf("=>", stream.start); + if (arrow < 0) return; + + var depth = 0, sawSomething = false; + for (var pos = arrow - 1; pos >= 0; --pos) { + var ch = stream.string.charAt(pos); + var bracket = brackets.indexOf(ch); + if (bracket >= 0 && bracket < 3) { + if (!depth) { + ++pos; + break; + } + if (--depth == 0) break; + } else if (bracket >= 3 && bracket < 6) { + ++depth; + } else if (wordRE.test(ch)) { + sawSomething = true; + } else if (/["'\/]/.test(ch)) { + return; + } else if (sawSomething && !depth) { + ++pos; + break; + } + } + if (sawSomething && !depth) state.fatArrowAt = pos; + } + + // Parser + + var atomicTypes = { + "atom": true, + "number": true, + "variable": true, + "string": true, + "regexp": true, + "this": true, + "jsonld-keyword": true + }; + + function JSLexical(indented, column, type, align, prev, info) { + this.indented = indented; + this.column = column; + this.type = type; + this.prev = prev; + this.info = info; + if (align != null) this.align = align; + } + + function inScope(state, varname) { + for (var v = state.localVars; v; v = v.next) + if (v.name == varname) return true; + for (var cx = state.context; cx; cx = cx.prev) { + for (var v = cx.vars; v; v = v.next) + if (v.name == varname) return true; + } + } + + function parseJS(state, style, type, content, stream) { + var cc = state.cc; + // Communicate our context to the combinators. + // (Less wasteful than consing up a hundred closures on every call.) + cx.state = state; + cx.stream = stream; + cx.marked = null, cx.cc = cc; + cx.style = style; + + if (!state.lexical.hasOwnProperty("align")) + state.lexical.align = true; + + while (true) { + var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement; + if (combinator(type, content)) { + while (cc.length && cc[cc.length - 1].lex) + cc.pop()(); + if (cx.marked) return cx.marked; + if (type == "variable" && inScope(state, content)) return "variable-2"; + return style; + } + } + } + + // Combinator utils + + var cx = {state: null, column: null, marked: null, cc: null}; + + function pass() { + for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); + } + + function cont() { + pass.apply(null, arguments); + return true; + } + + function register(varname) { + function inList(list) { + for (var v = list; v; v = v.next) + if (v.name == varname) return true; + return false; + } + + var state = cx.state; + if (state.context) { + cx.marked = "def"; + if (inList(state.localVars)) return; + state.localVars = {name: varname, next: state.localVars}; + } else { + if (inList(state.globalVars)) return; + if (parserConfig.globalVars) + state.globalVars = {name: varname, next: state.globalVars}; + } + } + + // Combinators + + var defaultVars = {name: "this", next: {name: "arguments"}}; + + function pushcontext() { + cx.state.context = {prev: cx.state.context, vars: cx.state.localVars}; + cx.state.localVars = defaultVars; + } + + function popcontext() { + cx.state.localVars = cx.state.context.vars; + cx.state.context = cx.state.context.prev; + } + + function pushlex(type, info) { + var result = function () { + var state = cx.state, indent = state.indented; + if (state.lexical.type == "stat") indent = state.lexical.indented; + else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev) + indent = outer.indented; + state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info); + }; + result.lex = true; + return result; + } + + function poplex() { + var state = cx.state; + if (state.lexical.prev) { + if (state.lexical.type == ")") + state.indented = state.lexical.indented; + state.lexical = state.lexical.prev; + } + } + + poplex.lex = true; + + function expect(wanted) { + function exp(type) { + if (type == wanted) return cont(); + else if (wanted == ";") return pass(); + else return cont(exp); + }; + return exp; + } + + function statement(type, value) { + if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex); + if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex); + if (type == "keyword b") return cont(pushlex("form"), statement, poplex); + if (type == "{") return cont(pushlex("}"), block, poplex); + if (type == ";") return cont(); + if (type == "if") { + if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex) + cx.state.cc.pop()(); + return cont(pushlex("form"), expression, statement, poplex, maybeelse); + } + if (type == "function") return cont(functiondef); + if (type == "for") return cont(pushlex("form"), forspec, statement, poplex); + if (type == "variable") return cont(pushlex("stat"), maybelabel); + if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"), + block, poplex, poplex); + if (type == "case") return cont(expression, expect(":")); + if (type == "default") return cont(expect(":")); + if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), + statement, poplex, popcontext); + if (type == "module") return cont(pushlex("form"), pushcontext, afterModule, popcontext, poplex); + if (type == "class") return cont(pushlex("form"), className, poplex); + if (type == "export") return cont(pushlex("form"), afterExport, poplex); + if (type == "import") return cont(pushlex("form"), afterImport, poplex); + return pass(pushlex("stat"), expression, expect(";"), poplex); + } + + function expression(type) { + return expressionInner(type, false); + } + + function expressionNoComma(type) { + return expressionInner(type, true); + } + + function expressionInner(type, noComma) { + if (cx.state.fatArrowAt == cx.stream.start) { + var body = noComma ? arrowBodyNoComma : arrowBody; + if (type == "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext); + else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext); + } + + var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma; + if (atomicTypes.hasOwnProperty(type)) return cont(maybeop); + if (type == "function") return cont(functiondef, maybeop); + if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression); + if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop); + if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression); + if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop); + if (type == "{") return contCommasep(objprop, "}", null, maybeop); + if (type == "quasi") { + return pass(quasi, maybeop); + } + return cont(); + } + + function maybeexpression(type) { + if (type.match(/[;\}\)\],]/)) return pass(); + return pass(expression); + } + + function maybeexpressionNoComma(type) { + if (type.match(/[;\}\)\],]/)) return pass(); + return pass(expressionNoComma); + } + + function maybeoperatorComma(type, value) { + if (type == ",") return cont(expression); + return maybeoperatorNoComma(type, value, false); + } + + function maybeoperatorNoComma(type, value, noComma) { + var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma; + var expr = noComma == false ? expression : expressionNoComma; + if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext); + if (type == "operator") { + if (/\+\+|--/.test(value)) return cont(me); + if (value == "?") return cont(expression, expect(":"), expr); + return cont(expr); + } + if (type == "quasi") { + return pass(quasi, me); + } + if (type == ";") return; + if (type == "(") return contCommasep(expressionNoComma, ")", "call", me); + if (type == ".") return cont(property, me); + if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me); + } + + function quasi(type, value) { + if (type != "quasi") return pass(); + if (value.slice(value.length - 2) != "${") return cont(quasi); + return cont(expression, continueQuasi); + } + + function continueQuasi(type) { + if (type == "}") { + cx.marked = "string-2"; + cx.state.tokenize = tokenQuasi; + return cont(quasi); + } + } + + function arrowBody(type) { + findFatArrow(cx.stream, cx.state); + return pass(type == "{" ? statement : expression); + } + + function arrowBodyNoComma(type) { + findFatArrow(cx.stream, cx.state); + return pass(type == "{" ? statement : expressionNoComma); + } + + function maybelabel(type) { + if (type == ":") return cont(poplex, statement); + return pass(maybeoperatorComma, expect(";"), poplex); + } + + function property(type) { + if (type == "variable") { + cx.marked = "property"; + return cont(); + } + } + + function objprop(type, value) { + if (type == "variable" || cx.style == "keyword") { + cx.marked = "property"; + if (value == "get" || value == "set") return cont(getterSetter); + return cont(afterprop); + } else if (type == "number" || type == "string") { + cx.marked = jsonldMode ? "property" : (cx.style + " property"); + return cont(afterprop); + } else if (type == "jsonld-keyword") { + return cont(afterprop); + } else if (type == "[") { + return cont(expression, expect("]"), afterprop); + } + } + + function getterSetter(type) { + if (type != "variable") return pass(afterprop); + cx.marked = "property"; + return cont(functiondef); + } + + function afterprop(type) { + if (type == ":") return cont(expressionNoComma); + if (type == "(") return pass(functiondef); + } + + function commasep(what, end) { + function proceed(type) { + if (type == ",") { + var lex = cx.state.lexical; + if (lex.info == "call") lex.pos = (lex.pos || 0) + 1; + return cont(what, proceed); + } + if (type == end) return cont(); + return cont(expect(end)); + } + + return function (type) { + if (type == end) return cont(); + return pass(what, proceed); + }; + } + + function contCommasep(what, end, info) { + for (var i = 3; i < arguments.length; i++) + cx.cc.push(arguments[i]); + return cont(pushlex(end, info), commasep(what, end), poplex); + } + + function block(type) { + if (type == "}") return cont(); + return pass(statement, block); + } + + function maybetype(type) { + if (isTS && type == ":") return cont(typedef); + } + + function typedef(type) { + if (type == "variable") { + cx.marked = "variable-3"; + return cont(); + } + } + + function vardef() { + return pass(pattern, maybetype, maybeAssign, vardefCont); + } + + function pattern(type, value) { + if (type == "variable") { + register(value); + return cont(); + } + if (type == "[") return contCommasep(pattern, "]"); + if (type == "{") return contCommasep(proppattern, "}"); + } + + function proppattern(type, value) { + if (type == "variable" && !cx.stream.match(/^\s*:/, false)) { + register(value); + return cont(maybeAssign); + } + if (type == "variable") cx.marked = "property"; + return cont(expect(":"), pattern, maybeAssign); + } + + function maybeAssign(_type, value) { + if (value == "=") return cont(expressionNoComma); + } + + function vardefCont(type) { + if (type == ",") return cont(vardef); + } + + function maybeelse(type, value) { + if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex); + } + + function forspec(type) { + if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex); + } + + function forspec1(type) { + if (type == "var") return cont(vardef, expect(";"), forspec2); + if (type == ";") return cont(forspec2); + if (type == "variable") return cont(formaybeinof); + return pass(expression, expect(";"), forspec2); + } + + function formaybeinof(_type, value) { + if (value == "in" || value == "of") { + cx.marked = "keyword"; + return cont(expression); + } + return cont(maybeoperatorComma, forspec2); + } + + function forspec2(type, value) { + if (type == ";") return cont(forspec3); + if (value == "in" || value == "of") { + cx.marked = "keyword"; + return cont(expression); + } + return pass(expression, expect(";"), forspec3); + } + + function forspec3(type) { + if (type != ")") cont(expression); + } + + function functiondef(type, value) { + if (value == "*") { + cx.marked = "keyword"; + return cont(functiondef); + } + if (type == "variable") { + register(value); + return cont(functiondef); + } + if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, statement, popcontext); + } + + function funarg(type) { + if (type == "spread") return cont(funarg); + return pass(pattern, maybetype); + } + + function className(type, value) { + if (type == "variable") { + register(value); + return cont(classNameAfter); + } + } + + function classNameAfter(type, value) { + if (value == "extends") return cont(expression, classNameAfter); + if (type == "{") return cont(pushlex("}"), classBody, poplex); + } + + function classBody(type, value) { + if (type == "variable" || cx.style == "keyword") { + cx.marked = "property"; + if (value == "get" || value == "set") return cont(classGetterSetter, functiondef, classBody); + return cont(functiondef, classBody); + } + if (value == "*") { + cx.marked = "keyword"; + return cont(classBody); + } + if (type == ";") return cont(classBody); + if (type == "}") return cont(); + } + + function classGetterSetter(type) { + if (type != "variable") return pass(); + cx.marked = "property"; + return cont(); + } + + function afterModule(type, value) { + if (type == "string") return cont(statement); + if (type == "variable") { + register(value); + return cont(maybeFrom); + } + } + + function afterExport(_type, value) { + if (value == "*") { + cx.marked = "keyword"; + return cont(maybeFrom, expect(";")); + } + if (value == "default") { + cx.marked = "keyword"; + return cont(expression, expect(";")); + } + return pass(statement); + } + + function afterImport(type) { + if (type == "string") return cont(); + return pass(importSpec, maybeFrom); + } + + function importSpec(type, value) { + if (type == "{") return contCommasep(importSpec, "}"); + if (type == "variable") register(value); + return cont(); + } + + function maybeFrom(_type, value) { + if (value == "from") { + cx.marked = "keyword"; + return cont(expression); + } + } + + function arrayLiteral(type) { + if (type == "]") return cont(); + return pass(expressionNoComma, maybeArrayComprehension); + } + + function maybeArrayComprehension(type) { + if (type == "for") return pass(comprehension, expect("]")); + if (type == ",") return cont(commasep(maybeexpressionNoComma, "]")); + return pass(commasep(expressionNoComma, "]")); + } + + function comprehension(type) { + if (type == "for") return cont(forspec, comprehension); + if (type == "if") return cont(expression, comprehension); + } + + function isContinuedStatement(state, textAfter) { + return state.lastType == "operator" || state.lastType == "," || + isOperatorChar.test(textAfter.charAt(0)) || + /[,.]/.test(textAfter.charAt(0)); + } + + // Interface + + return { + startState: function (basecolumn) { + var state = { + tokenize: tokenBase, + lastType: "sof", + cc: [], + lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false), + localVars: parserConfig.localVars, + context: parserConfig.localVars && {vars: parserConfig.localVars}, + indented: 0 + }; + if (parserConfig.globalVars && typeof parserConfig.globalVars == "object") + state.globalVars = parserConfig.globalVars; + return state; + }, + + token: function (stream, state) { + if (stream.sol()) { + if (!state.lexical.hasOwnProperty("align")) + state.lexical.align = false; + state.indented = stream.indentation(); + findFatArrow(stream, state); + } + if (state.tokenize != tokenComment && stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + if (type == "comment") return style; + state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type; + return parseJS(state, style, type, content, stream); + }, + + indent: function (state, textAfter) { + if (state.tokenize == tokenComment) return CodeMirror.Pass; + if (state.tokenize != tokenBase) return 0; + var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical; + // Kludge to prevent 'maybelse' from blocking lexical scope pops + if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) { + var c = state.cc[i]; + if (c == poplex) lexical = lexical.prev; + else if (c != maybeelse) break; + } + if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev; + if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat") + lexical = lexical.prev; + var type = lexical.type, closing = firstChar == type; + + if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0); + else if (type == "form" && firstChar == "{") return lexical.indented; + else if (type == "form") return lexical.indented + indentUnit; + else if (type == "stat") + return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0); + else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false) + return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit); + else if (lexical.align) return lexical.column + (closing ? 0 : 1); + else return lexical.indented + (closing ? 0 : indentUnit); + }, + + electricInput: /^\s*(?:case .*?:|default:|\{|\})$/, + blockCommentStart: jsonMode ? null : "/*", + blockCommentEnd: jsonMode ? null : "*/", + lineComment: jsonMode ? null : "//", + fold: "brace", + + helperType: jsonMode ? "json" : "javascript", + jsonldMode: jsonldMode, + jsonMode: jsonMode + }; + }); + + CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/); + + CodeMirror.defineMIME("text/javascript", "javascript"); + CodeMirror.defineMIME("text/ecmascript", "javascript"); + CodeMirror.defineMIME("application/javascript", "javascript"); + CodeMirror.defineMIME("application/x-javascript", "javascript"); + CodeMirror.defineMIME("application/ecmascript", "javascript"); + CodeMirror.defineMIME("application/json", {name: "javascript", json: true}); + CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true}); + CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true}); + CodeMirror.defineMIME("text/typescript", {name: "javascript", typescript: true}); + CodeMirror.defineMIME("application/typescript", {name: "javascript", typescript: true}); }); diff --git a/web/editor.md/lib/codemirror/mode/javascript/json-ld.html b/web/editor.md/lib/codemirror/mode/javascript/json-ld.html index 3a37f0b..9f86fbb 100644 --- a/web/editor.md/lib/codemirror/mode/javascript/json-ld.html +++ b/web/editor.md/lib/codemirror/mode/javascript/json-ld.html @@ -2,34 +2,37 @@ CodeMirror: JSON-LD mode - + - + - +
-

JSON-LD mode

+

JSON-LD mode

-
- +

This is a specialization of the JavaScript mode.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/javascript/test.js b/web/editor.md/lib/codemirror/mode/javascript/test.js index 91b0e89..a8d3b92 100644 --- a/web/editor.md/lib/codemirror/mode/javascript/test.js +++ b/web/editor.md/lib/codemirror/mode/javascript/test.js @@ -1,200 +1,204 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function() { - var mode = CodeMirror.getMode({indentUnit: 2}, "javascript"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - - MT("locals", - "[keyword function] [variable foo]([def a], [def b]) { [keyword var] [def c] [operator =] [number 10]; [keyword return] [variable-2 a] [operator +] [variable-2 c] [operator +] [variable d]; }"); - - MT("comma-and-binop", - "[keyword function](){ [keyword var] [def x] [operator =] [number 1] [operator +] [number 2], [def y]; }"); - - MT("destructuring", - "([keyword function]([def a], [[[def b], [def c] ]]) {", - " [keyword let] {[def d], [property foo]: [def c][operator =][number 10], [def x]} [operator =] [variable foo]([variable-2 a]);", - " [[[variable-2 c], [variable y] ]] [operator =] [variable-2 c];", - "})();"); - - MT("class_body", - "[keyword class] [variable Foo] {", - " [property constructor]() {}", - " [property sayName]() {", - " [keyword return] [string-2 `foo${][variable foo][string-2 }oo`];", - " }", - "}"); - - MT("class", - "[keyword class] [variable Point] [keyword extends] [variable SuperThing] {", - " [property get] [property prop]() { [keyword return] [number 24]; }", - " [property constructor]([def x], [def y]) {", - " [keyword super]([string 'something']);", - " [keyword this].[property x] [operator =] [variable-2 x];", - " }", - "}"); - - MT("module", - "[keyword module] [string 'foo'] {", - " [keyword export] [keyword let] [def x] [operator =] [number 42];", - " [keyword export] [keyword *] [keyword from] [string 'somewhere'];", - "}"); - - MT("import", - "[keyword function] [variable foo]() {", - " [keyword import] [def $] [keyword from] [string 'jquery'];", - " [keyword module] [def crypto] [keyword from] [string 'crypto'];", - " [keyword import] { [def encrypt], [def decrypt] } [keyword from] [string 'crypto'];", - "}"); - - MT("const", - "[keyword function] [variable f]() {", - " [keyword const] [[ [def a], [def b] ]] [operator =] [[ [number 1], [number 2] ]];", - "}"); - - MT("for/of", - "[keyword for]([keyword let] [variable of] [keyword of] [variable something]) {}"); - - MT("generator", - "[keyword function*] [variable repeat]([def n]) {", - " [keyword for]([keyword var] [def i] [operator =] [number 0]; [variable-2 i] [operator <] [variable-2 n]; [operator ++][variable-2 i])", - " [keyword yield] [variable-2 i];", - "}"); - - MT("quotedStringAddition", - "[keyword let] [variable f] [operator =] [variable a] [operator +] [string 'fatarrow'] [operator +] [variable c];"); - - MT("quotedFatArrow", - "[keyword let] [variable f] [operator =] [variable a] [operator +] [string '=>'] [operator +] [variable c];"); - - MT("fatArrow", - "[variable array].[property filter]([def a] [operator =>] [variable-2 a] [operator +] [number 1]);", - "[variable a];", // No longer in scope - "[keyword let] [variable f] [operator =] ([[ [def a], [def b] ]], [def c]) [operator =>] [variable-2 a] [operator +] [variable-2 c];", - "[variable c];"); - - MT("spread", - "[keyword function] [variable f]([def a], [meta ...][def b]) {", - " [variable something]([variable-2 a], [meta ...][variable-2 b]);", - "}"); - - MT("comprehension", - "[keyword function] [variable f]() {", - " [[([variable x] [operator +] [number 1]) [keyword for] ([keyword var] [def x] [keyword in] [variable y]) [keyword if] [variable pred]([variable-2 x]) ]];", - " ([variable u] [keyword for] ([keyword var] [def u] [keyword of] [variable generateValues]()) [keyword if] ([variable-2 u].[property color] [operator ===] [string 'blue']));", - "}"); - - MT("quasi", - "[variable re][string-2 `fofdlakj${][variable x] [operator +] ([variable re][string-2 `foo`]) [operator +] [number 1][string-2 }fdsa`] [operator +] [number 2]"); - - MT("quasi_no_function", - "[variable x] [operator =] [string-2 `fofdlakj${][variable x] [operator +] [string-2 `foo`] [operator +] [number 1][string-2 }fdsa`] [operator +] [number 2]"); - - MT("indent_statement", - "[keyword var] [variable x] [operator =] [number 10]", - "[variable x] [operator +=] [variable y] [operator +]", - " [atom Infinity]", - "[keyword debugger];"); - - MT("indent_if", - "[keyword if] ([number 1])", - " [keyword break];", - "[keyword else] [keyword if] ([number 2])", - " [keyword continue];", - "[keyword else]", - " [number 10];", - "[keyword if] ([number 1]) {", - " [keyword break];", - "} [keyword else] [keyword if] ([number 2]) {", - " [keyword continue];", - "} [keyword else] {", - " [number 10];", - "}"); - - MT("indent_for", - "[keyword for] ([keyword var] [variable i] [operator =] [number 0];", - " [variable i] [operator <] [number 100];", - " [variable i][operator ++])", - " [variable doSomething]([variable i]);", - "[keyword debugger];"); - - MT("indent_c_style", - "[keyword function] [variable foo]()", - "{", - " [keyword debugger];", - "}"); - - MT("indent_else", - "[keyword for] (;;)", - " [keyword if] ([variable foo])", - " [keyword if] ([variable bar])", - " [number 1];", - " [keyword else]", - " [number 2];", - " [keyword else]", - " [number 3];"); - - MT("indent_funarg", - "[variable foo]([number 10000],", - " [keyword function]([def a]) {", - " [keyword debugger];", - "};"); - - MT("indent_below_if", - "[keyword for] (;;)", - " [keyword if] ([variable foo])", - " [number 1];", - "[number 2];"); - - MT("multilinestring", - "[keyword var] [variable x] [operator =] [string 'foo\\]", - "[string bar'];"); - - MT("scary_regexp", - "[string-2 /foo[[/]]bar/];"); - - MT("indent_strange_array", - "[keyword var] [variable x] [operator =] [[", - " [number 1],,", - " [number 2],", - "]];", - "[number 10];"); - - var jsonld_mode = CodeMirror.getMode( - {indentUnit: 2}, - {name: "javascript", jsonld: true} - ); - function LD(name) { - test.mode(name, jsonld_mode, Array.prototype.slice.call(arguments, 1)); - } - - LD("json_ld_keywords", - '{', - ' [meta "@context"]: {', - ' [meta "@base"]: [string "http://example.com"],', - ' [meta "@vocab"]: [string "http://xmlns.com/foaf/0.1/"],', - ' [property "likesFlavor"]: {', - ' [meta "@container"]: [meta "@list"]', - ' [meta "@reverse"]: [string "@beFavoriteOf"]', - ' },', - ' [property "nick"]: { [meta "@container"]: [meta "@set"] },', - ' [property "nick"]: { [meta "@container"]: [meta "@index"] }', - ' },', - ' [meta "@graph"]: [[ {', - ' [meta "@id"]: [string "http://dbpedia.org/resource/John_Lennon"],', - ' [property "name"]: [string "John Lennon"],', - ' [property "modified"]: {', - ' [meta "@value"]: [string "2010-05-29T14:17:39+02:00"],', - ' [meta "@type"]: [string "http://www.w3.org/2001/XMLSchema#dateTime"]', - ' }', - ' } ]]', - '}'); - - LD("json_ld_fake", - '{', - ' [property "@fake"]: [string "@fake"],', - ' [property "@contextual"]: [string "@identifier"],', - ' [property "user@domain.com"]: [string "@graphical"],', - ' [property "@ID"]: [string "@@ID"]', - '}'); +(function () { + var mode = CodeMirror.getMode({indentUnit: 2}, "javascript"); + + function MT(name) { + test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); + } + + MT("locals", + "[keyword function] [variable foo]([def a], [def b]) { [keyword var] [def c] [operator =] [number 10]; [keyword return] [variable-2 a] [operator +] [variable-2 c] [operator +] [variable d]; }"); + + MT("comma-and-binop", + "[keyword function](){ [keyword var] [def x] [operator =] [number 1] [operator +] [number 2], [def y]; }"); + + MT("destructuring", + "([keyword function]([def a], [[[def b], [def c] ]]) {", + " [keyword let] {[def d], [property foo]: [def c][operator =][number 10], [def x]} [operator =] [variable foo]([variable-2 a]);", + " [[[variable-2 c], [variable y] ]] [operator =] [variable-2 c];", + "})();"); + + MT("class_body", + "[keyword class] [variable Foo] {", + " [property constructor]() {}", + " [property sayName]() {", + " [keyword return] [string-2 `foo${][variable foo][string-2 }oo`];", + " }", + "}"); + + MT("class", + "[keyword class] [variable Point] [keyword extends] [variable SuperThing] {", + " [property get] [property prop]() { [keyword return] [number 24]; }", + " [property constructor]([def x], [def y]) {", + " [keyword super]([string 'something']);", + " [keyword this].[property x] [operator =] [variable-2 x];", + " }", + "}"); + + MT("module", + "[keyword module] [string 'foo'] {", + " [keyword export] [keyword let] [def x] [operator =] [number 42];", + " [keyword export] [keyword *] [keyword from] [string 'somewhere'];", + "}"); + + MT("import", + "[keyword function] [variable foo]() {", + " [keyword import] [def $] [keyword from] [string 'jquery'];", + " [keyword module] [def crypto] [keyword from] [string 'crypto'];", + " [keyword import] { [def encrypt], [def decrypt] } [keyword from] [string 'crypto'];", + "}"); + + MT("const", + "[keyword function] [variable f]() {", + " [keyword const] [[ [def a], [def b] ]] [operator =] [[ [number 1], [number 2] ]];", + "}"); + + MT("for/of", + "[keyword for]([keyword let] [variable of] [keyword of] [variable something]) {}"); + + MT("generator", + "[keyword function*] [variable repeat]([def n]) {", + " [keyword for]([keyword var] [def i] [operator =] [number 0]; [variable-2 i] [operator <] [variable-2 n]; [operator ++][variable-2 i])", + " [keyword yield] [variable-2 i];", + "}"); + + MT("quotedStringAddition", + "[keyword let] [variable f] [operator =] [variable a] [operator +] [string 'fatarrow'] [operator +] [variable c];"); + + MT("quotedFatArrow", + "[keyword let] [variable f] [operator =] [variable a] [operator +] [string '=>'] [operator +] [variable c];"); + + MT("fatArrow", + "[variable array].[property filter]([def a] [operator =>] [variable-2 a] [operator +] [number 1]);", + "[variable a];", // No longer in scope + "[keyword let] [variable f] [operator =] ([[ [def a], [def b] ]], [def c]) [operator =>] [variable-2 a] [operator +] [variable-2 c];", + "[variable c];"); + + MT("spread", + "[keyword function] [variable f]([def a], [meta ...][def b]) {", + " [variable something]([variable-2 a], [meta ...][variable-2 b]);", + "}"); + + MT("comprehension", + "[keyword function] [variable f]() {", + " [[([variable x] [operator +] [number 1]) [keyword for] ([keyword var] [def x] [keyword in] [variable y]) [keyword if] [variable pred]([variable-2 x]) ]];", + " ([variable u] [keyword for] ([keyword var] [def u] [keyword of] [variable generateValues]()) [keyword if] ([variable-2 u].[property color] [operator ===] [string 'blue']));", + "}"); + + MT("quasi", + "[variable re][string-2 `fofdlakj${][variable x] [operator +] ([variable re][string-2 `foo`]) [operator +] [number 1][string-2 }fdsa`] [operator +] [number 2]"); + + MT("quasi_no_function", + "[variable x] [operator =] [string-2 `fofdlakj${][variable x] [operator +] [string-2 `foo`] [operator +] [number 1][string-2 }fdsa`] [operator +] [number 2]"); + + MT("indent_statement", + "[keyword var] [variable x] [operator =] [number 10]", + "[variable x] [operator +=] [variable y] [operator +]", + " [atom Infinity]", + "[keyword debugger];"); + + MT("indent_if", + "[keyword if] ([number 1])", + " [keyword break];", + "[keyword else] [keyword if] ([number 2])", + " [keyword continue];", + "[keyword else]", + " [number 10];", + "[keyword if] ([number 1]) {", + " [keyword break];", + "} [keyword else] [keyword if] ([number 2]) {", + " [keyword continue];", + "} [keyword else] {", + " [number 10];", + "}"); + + MT("indent_for", + "[keyword for] ([keyword var] [variable i] [operator =] [number 0];", + " [variable i] [operator <] [number 100];", + " [variable i][operator ++])", + " [variable doSomething]([variable i]);", + "[keyword debugger];"); + + MT("indent_c_style", + "[keyword function] [variable foo]()", + "{", + " [keyword debugger];", + "}"); + + MT("indent_else", + "[keyword for] (;;)", + " [keyword if] ([variable foo])", + " [keyword if] ([variable bar])", + " [number 1];", + " [keyword else]", + " [number 2];", + " [keyword else]", + " [number 3];"); + + MT("indent_funarg", + "[variable foo]([number 10000],", + " [keyword function]([def a]) {", + " [keyword debugger];", + "};"); + + MT("indent_below_if", + "[keyword for] (;;)", + " [keyword if] ([variable foo])", + " [number 1];", + "[number 2];"); + + MT("multilinestring", + "[keyword var] [variable x] [operator =] [string 'foo\\]", + "[string bar'];"); + + MT("scary_regexp", + "[string-2 /foo[[/]]bar/];"); + + MT("indent_strange_array", + "[keyword var] [variable x] [operator =] [[", + " [number 1],,", + " [number 2],", + "]];", + "[number 10];"); + + var jsonld_mode = CodeMirror.getMode( + {indentUnit: 2}, + {name: "javascript", jsonld: true} + ); + + function LD(name) { + test.mode(name, jsonld_mode, Array.prototype.slice.call(arguments, 1)); + } + + LD("json_ld_keywords", + '{', + ' [meta "@context"]: {', + ' [meta "@base"]: [string "http://example.com"],', + ' [meta "@vocab"]: [string "http://xmlns.com/foaf/0.1/"],', + ' [property "likesFlavor"]: {', + ' [meta "@container"]: [meta "@list"]', + ' [meta "@reverse"]: [string "@beFavoriteOf"]', + ' },', + ' [property "nick"]: { [meta "@container"]: [meta "@set"] },', + ' [property "nick"]: { [meta "@container"]: [meta "@index"] }', + ' },', + ' [meta "@graph"]: [[ {', + ' [meta "@id"]: [string "http://dbpedia.org/resource/John_Lennon"],', + ' [property "name"]: [string "John Lennon"],', + ' [property "modified"]: {', + ' [meta "@value"]: [string "2010-05-29T14:17:39+02:00"],', + ' [meta "@type"]: [string "http://www.w3.org/2001/XMLSchema#dateTime"]', + ' }', + ' } ]]', + '}'); + + LD("json_ld_fake", + '{', + ' [property "@fake"]: [string "@fake"],', + ' [property "@contextual"]: [string "@identifier"],', + ' [property "user@domain.com"]: [string "@graphical"],', + ' [property "@ID"]: [string "@@ID"]', + '}'); })(); diff --git a/web/editor.md/lib/codemirror/mode/javascript/typescript.html b/web/editor.md/lib/codemirror/mode/javascript/typescript.html index 2cfc538..c8e7251 100644 --- a/web/editor.md/lib/codemirror/mode/javascript/typescript.html +++ b/web/editor.md/lib/codemirror/mode/javascript/typescript.html @@ -2,31 +2,34 @@ CodeMirror: TypeScript mode - + - + - +
-

TypeScript mode

+

TypeScript mode

-

This is a specialization of the JavaScript mode.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/jinja2/index.html b/web/editor.md/lib/codemirror/mode/jinja2/index.html index 5a70e91..a6ae6be 100644 --- a/web/editor.md/lib/codemirror/mode/jinja2/index.html +++ b/web/editor.md/lib/codemirror/mode/jinja2/index.html @@ -2,29 +2,32 @@ CodeMirror: Jinja2 mode - + - + - +
-

Jinja2 mode

-
-
+ diff --git a/web/editor.md/lib/codemirror/mode/jinja2/jinja2.js b/web/editor.md/lib/codemirror/mode/jinja2/jinja2.js index ed19558..5d9e119 100644 --- a/web/editor.md/lib/codemirror/mode/jinja2/jinja2.js +++ b/web/editor.md/lib/codemirror/mode/jinja2/jinja2.js @@ -1,142 +1,142 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; - CodeMirror.defineMode("jinja2", function() { - var keywords = ["and", "as", "block", "endblock", "by", "cycle", "debug", "else", "elif", - "extends", "filter", "endfilter", "firstof", "for", - "endfor", "if", "endif", "ifchanged", "endifchanged", - "ifequal", "endifequal", "ifnotequal", - "endifnotequal", "in", "include", "load", "not", "now", "or", - "parsed", "regroup", "reversed", "spaceless", - "endspaceless", "ssi", "templatetag", "openblock", - "closeblock", "openvariable", "closevariable", - "openbrace", "closebrace", "opencomment", - "closecomment", "widthratio", "url", "with", "endwith", - "get_current_language", "trans", "endtrans", "noop", "blocktrans", - "endblocktrans", "get_available_languages", - "get_current_language_bidi", "plural"], - operator = /^[+\-*&%=<>!?|~^]/, - sign = /^[:\[\(\{]/, - atom = ["true", "false"], - number = /^(\d[+\-\*\/])?\d+(\.\d+)?/; + CodeMirror.defineMode("jinja2", function () { + var keywords = ["and", "as", "block", "endblock", "by", "cycle", "debug", "else", "elif", + "extends", "filter", "endfilter", "firstof", "for", + "endfor", "if", "endif", "ifchanged", "endifchanged", + "ifequal", "endifequal", "ifnotequal", + "endifnotequal", "in", "include", "load", "not", "now", "or", + "parsed", "regroup", "reversed", "spaceless", + "endspaceless", "ssi", "templatetag", "openblock", + "closeblock", "openvariable", "closevariable", + "openbrace", "closebrace", "opencomment", + "closecomment", "widthratio", "url", "with", "endwith", + "get_current_language", "trans", "endtrans", "noop", "blocktrans", + "endblocktrans", "get_available_languages", + "get_current_language_bidi", "plural"], + operator = /^[+\-*&%=<>!?|~^]/, + sign = /^[:\[\(\{]/, + atom = ["true", "false"], + number = /^(\d[+\-\*\/])?\d+(\.\d+)?/; - keywords = new RegExp("((" + keywords.join(")|(") + "))\\b"); - atom = new RegExp("((" + atom.join(")|(") + "))\\b"); + keywords = new RegExp("((" + keywords.join(")|(") + "))\\b"); + atom = new RegExp("((" + atom.join(")|(") + "))\\b"); - function tokenBase (stream, state) { - var ch = stream.peek(); + function tokenBase(stream, state) { + var ch = stream.peek(); - //Comment - if (state.incomment) { - if(!stream.skipTo("#}")) { - stream.skipToEnd(); - } else { - stream.eatWhile(/\#|}/); - state.incomment = false; - } - return "comment"; - //Tag - } else if (state.intag) { - //After operator - if(state.operator) { - state.operator = false; - if(stream.match(atom)) { - return "atom"; - } - if(stream.match(number)) { - return "number"; - } - } - //After sign - if(state.sign) { - state.sign = false; - if(stream.match(atom)) { - return "atom"; - } - if(stream.match(number)) { - return "number"; - } - } + //Comment + if (state.incomment) { + if (!stream.skipTo("#}")) { + stream.skipToEnd(); + } else { + stream.eatWhile(/\#|}/); + state.incomment = false; + } + return "comment"; + //Tag + } else if (state.intag) { + //After operator + if (state.operator) { + state.operator = false; + if (stream.match(atom)) { + return "atom"; + } + if (stream.match(number)) { + return "number"; + } + } + //After sign + if (state.sign) { + state.sign = false; + if (stream.match(atom)) { + return "atom"; + } + if (stream.match(number)) { + return "number"; + } + } - if(state.instring) { - if(ch == state.instring) { - state.instring = false; - } - stream.next(); - return "string"; - } else if(ch == "'" || ch == '"') { - state.instring = ch; - stream.next(); - return "string"; - } else if(stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}")) { - state.intag = false; - return "tag"; - } else if(stream.match(operator)) { - state.operator = true; - return "operator"; - } else if(stream.match(sign)) { - state.sign = true; - } else { - if(stream.eat(" ") || stream.sol()) { - if(stream.match(keywords)) { - return "keyword"; - } - if(stream.match(atom)) { - return "atom"; - } - if(stream.match(number)) { - return "number"; - } - if(stream.sol()) { - stream.next(); + if (state.instring) { + if (ch == state.instring) { + state.instring = false; + } + stream.next(); + return "string"; + } else if (ch == "'" || ch == '"') { + state.instring = ch; + stream.next(); + return "string"; + } else if (stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}")) { + state.intag = false; + return "tag"; + } else if (stream.match(operator)) { + state.operator = true; + return "operator"; + } else if (stream.match(sign)) { + state.sign = true; + } else { + if (stream.eat(" ") || stream.sol()) { + if (stream.match(keywords)) { + return "keyword"; + } + if (stream.match(atom)) { + return "atom"; + } + if (stream.match(number)) { + return "number"; + } + if (stream.sol()) { + stream.next(); + } + } else { + stream.next(); + } + + } + return "variable"; + } else if (stream.eat("{")) { + if (ch = stream.eat("#")) { + state.incomment = true; + if (!stream.skipTo("#}")) { + stream.skipToEnd(); + } else { + stream.eatWhile(/\#|}/); + state.incomment = false; + } + return "comment"; + //Open tag + } else if (ch = stream.eat(/\{|%/)) { + //Cache close tag + state.intag = ch; + if (ch == "{") { + state.intag = "}"; + } + stream.eat("-"); + return "tag"; + } } - } else { stream.next(); - } - - } - return "variable"; - } else if (stream.eat("{")) { - if (ch = stream.eat("#")) { - state.incomment = true; - if(!stream.skipTo("#}")) { - stream.skipToEnd(); - } else { - stream.eatWhile(/\#|}/); - state.incomment = false; - } - return "comment"; - //Open tag - } else if (ch = stream.eat(/\{|%/)) { - //Cache close tag - state.intag = ch; - if(ch == "{") { - state.intag = "}"; - } - stream.eat("-"); - return "tag"; - } - } - stream.next(); - }; + }; - return { - startState: function () { - return {tokenize: tokenBase}; - }, - token: function (stream, state) { - return state.tokenize(stream, state); - } - }; - }); + return { + startState: function () { + return {tokenize: tokenBase}; + }, + token: function (stream, state) { + return state.tokenize(stream, state); + } + }; + }); }); diff --git a/web/editor.md/lib/codemirror/mode/julia/index.html b/web/editor.md/lib/codemirror/mode/julia/index.html index e1492c2..1b21e82 100644 --- a/web/editor.md/lib/codemirror/mode/julia/index.html +++ b/web/editor.md/lib/codemirror/mode/julia/index.html @@ -2,28 +2,31 @@ CodeMirror: Julia mode - + - + - +
-

Julia mode

+

Julia mode

MIME types defined: text/x-julia.

diff --git a/web/editor.md/lib/codemirror/mode/julia/julia.js b/web/editor.md/lib/codemirror/mode/julia/julia.js index e854988..8a0c869 100644 --- a/web/editor.md/lib/codemirror/mode/julia/julia.js +++ b/web/editor.md/lib/codemirror/mode/julia/julia.js @@ -1,301 +1,315 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("julia", function(_conf, parserConf) { - var ERRORCLASS = 'error'; - - function wordRegexp(words) { - return new RegExp("^((" + words.join(")|(") + "))\\b"); - } - - var operators = parserConf.operators || /^\.?[|&^\\%*+\-<>!=\/]=?|\?|~|:|\$|\.[<>]|<<=?|>>>?=?|\.[<>=]=|->?|\/\/|\bin\b/; - var delimiters = parserConf.delimiters || /^[;,()[\]{}]/; - var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*!*/; - var blockOpeners = ["begin", "function", "type", "immutable", "let", "macro", "for", "while", "quote", "if", "else", "elseif", "try", "finally", "catch", "do"]; - var blockClosers = ["end", "else", "elseif", "catch", "finally"]; - var keywordList = ['if', 'else', 'elseif', 'while', 'for', 'begin', 'let', 'end', 'do', 'try', 'catch', 'finally', 'return', 'break', 'continue', 'global', 'local', 'const', 'export', 'import', 'importall', 'using', 'function', 'macro', 'module', 'baremodule', 'type', 'immutable', 'quote', 'typealias', 'abstract', 'bitstype', 'ccall']; - var builtinList = ['true', 'false', 'enumerate', 'open', 'close', 'nothing', 'NaN', 'Inf', 'print', 'println', 'Int', 'Int8', 'Uint8', 'Int16', 'Uint16', 'Int32', 'Uint32', 'Int64', 'Uint64', 'Int128', 'Uint128', 'Bool', 'Char', 'Float16', 'Float32', 'Float64', 'Array', 'Vector', 'Matrix', 'String', 'UTF8String', 'ASCIIString', 'error', 'warn', 'info', '@printf']; - - //var stringPrefixes = new RegExp("^[br]?('|\")") - var stringPrefixes = /^(`|'|"{3}|([br]?"))/; - var keywords = wordRegexp(keywordList); - var builtins = wordRegexp(builtinList); - var openers = wordRegexp(blockOpeners); - var closers = wordRegexp(blockClosers); - var macro = /^@[_A-Za-z][_A-Za-z0-9]*/; - var symbol = /^:[_A-Za-z][_A-Za-z0-9]*/; - var indentInfo = null; - - function in_array(state) { - var ch = cur_scope(state); - if(ch=="[" || ch=="{") { - return true; - } - else { - return false; - } - } - - function cur_scope(state) { - if(state.scopes.length==0) { - return null; - } - return state.scopes[state.scopes.length - 1]; - } - - // tokenizers - function tokenBase(stream, state) { - // Handle scope changes - var leaving_expr = state.leaving_expr; - if(stream.sol()) { - leaving_expr = false; - } - state.leaving_expr = false; - if(leaving_expr) { - if(stream.match(/^'+/)) { - return 'operator'; - } - - } - - if(stream.match(/^\.{2,3}/)) { - return 'operator'; - } - - if (stream.eatSpace()) { - return null; - } - - var ch = stream.peek(); - // Handle Comments - if (ch === '#') { - stream.skipToEnd(); - return 'comment'; - } - if(ch==='[') { - state.scopes.push("["); - } - - if(ch==='{') { - state.scopes.push("{"); - } - - var scope=cur_scope(state); - - if(scope==='[' && ch===']') { - state.scopes.pop(); - state.leaving_expr=true; - } - - if(scope==='{' && ch==='}') { - state.scopes.pop(); - state.leaving_expr=true; - } - - if(ch===')') { - state.leaving_expr = true; - } - - var match; - if(!in_array(state) && (match=stream.match(openers, false))) { - state.scopes.push(match); - } - - if(!in_array(state) && stream.match(closers, false)) { - state.scopes.pop(); - } - - if(in_array(state)) { - if(stream.match(/^end/)) { - return 'number'; - } - - } - - if(stream.match(/^=>/)) { - return 'operator'; - } - - - // Handle Number Literals - if (stream.match(/^[0-9\.]/, false)) { - var imMatcher = RegExp(/^im\b/); - var floatLiteral = false; - // Floats - if (stream.match(/^\d*\.(?!\.)\d+([ef][\+\-]?\d+)?/i)) { floatLiteral = true; } - if (stream.match(/^\d+\.(?!\.)\d*/)) { floatLiteral = true; } - if (stream.match(/^\.\d+/)) { floatLiteral = true; } - if (floatLiteral) { - // Float literals may be "imaginary" - stream.match(imMatcher); - state.leaving_expr = true; - return 'number'; - } - // Integers - var intLiteral = false; - // Hex - if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; } - // Binary - if (stream.match(/^0b[01]+/i)) { intLiteral = true; } - // Octal - if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; } - // Decimal - if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) { - intLiteral = true; - } - // Zero by itself with no other piece of number. - if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; } - if (intLiteral) { - // Integer literals may be "long" - stream.match(imMatcher); - state.leaving_expr = true; - return 'number'; - } - } - - if(stream.match(/^(::)|(<:)/)) { - return 'operator'; - } - - // Handle symbols - if(!leaving_expr && stream.match(symbol)) { - return 'string'; - } - - // Handle operators and Delimiters - if (stream.match(operators)) { - return 'operator'; - } - - - // Handle Strings - if (stream.match(stringPrefixes)) { - state.tokenize = tokenStringFactory(stream.current()); - return state.tokenize(stream, state); - } - - if (stream.match(macro)) { - return 'meta'; - } - - - if (stream.match(delimiters)) { - return null; - } - - if (stream.match(keywords)) { - return 'keyword'; - } - - if (stream.match(builtins)) { - return 'builtin'; - } - - - if (stream.match(identifiers)) { - state.leaving_expr=true; - return 'variable'; - } - // Handle non-detected items - stream.next(); - return ERRORCLASS; - } - - function tokenStringFactory(delimiter) { - while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) { - delimiter = delimiter.substr(1); - } - var singleline = delimiter.length == 1; - var OUTCLASS = 'string'; - - function tokenString(stream, state) { - while (!stream.eol()) { - stream.eatWhile(/[^'"\\]/); - if (stream.eat('\\')) { - stream.next(); - if (singleline && stream.eol()) { - return OUTCLASS; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("julia", function (_conf, parserConf) { + var ERRORCLASS = 'error'; + + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b"); + } + + var operators = parserConf.operators || /^\.?[|&^\\%*+\-<>!=\/]=?|\?|~|:|\$|\.[<>]|<<=?|>>>?=?|\.[<>=]=|->?|\/\/|\bin\b/; + var delimiters = parserConf.delimiters || /^[;,()[\]{}]/; + var identifiers = parserConf.identifiers || /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*!*/; + var blockOpeners = ["begin", "function", "type", "immutable", "let", "macro", "for", "while", "quote", "if", "else", "elseif", "try", "finally", "catch", "do"]; + var blockClosers = ["end", "else", "elseif", "catch", "finally"]; + var keywordList = ['if', 'else', 'elseif', 'while', 'for', 'begin', 'let', 'end', 'do', 'try', 'catch', 'finally', 'return', 'break', 'continue', 'global', 'local', 'const', 'export', 'import', 'importall', 'using', 'function', 'macro', 'module', 'baremodule', 'type', 'immutable', 'quote', 'typealias', 'abstract', 'bitstype', 'ccall']; + var builtinList = ['true', 'false', 'enumerate', 'open', 'close', 'nothing', 'NaN', 'Inf', 'print', 'println', 'Int', 'Int8', 'Uint8', 'Int16', 'Uint16', 'Int32', 'Uint32', 'Int64', 'Uint64', 'Int128', 'Uint128', 'Bool', 'Char', 'Float16', 'Float32', 'Float64', 'Array', 'Vector', 'Matrix', 'String', 'UTF8String', 'ASCIIString', 'error', 'warn', 'info', '@printf']; + + //var stringPrefixes = new RegExp("^[br]?('|\")") + var stringPrefixes = /^(`|'|"{3}|([br]?"))/; + var keywords = wordRegexp(keywordList); + var builtins = wordRegexp(builtinList); + var openers = wordRegexp(blockOpeners); + var closers = wordRegexp(blockClosers); + var macro = /^@[_A-Za-z][_A-Za-z0-9]*/; + var symbol = /^:[_A-Za-z][_A-Za-z0-9]*/; + var indentInfo = null; + + function in_array(state) { + var ch = cur_scope(state); + if (ch == "[" || ch == "{") { + return true; + } else { + return false; } - } else if (stream.match(delimiter)) { - state.tokenize = tokenBase; - return OUTCLASS; - } else { - stream.eat(/['"]/); } - } - if (singleline) { - if (parserConf.singleLineStringErrors) { + + function cur_scope(state) { + if (state.scopes.length == 0) { + return null; + } + return state.scopes[state.scopes.length - 1]; + } + + // tokenizers + function tokenBase(stream, state) { + // Handle scope changes + var leaving_expr = state.leaving_expr; + if (stream.sol()) { + leaving_expr = false; + } + state.leaving_expr = false; + if (leaving_expr) { + if (stream.match(/^'+/)) { + return 'operator'; + } + + } + + if (stream.match(/^\.{2,3}/)) { + return 'operator'; + } + + if (stream.eatSpace()) { + return null; + } + + var ch = stream.peek(); + // Handle Comments + if (ch === '#') { + stream.skipToEnd(); + return 'comment'; + } + if (ch === '[') { + state.scopes.push("["); + } + + if (ch === '{') { + state.scopes.push("{"); + } + + var scope = cur_scope(state); + + if (scope === '[' && ch === ']') { + state.scopes.pop(); + state.leaving_expr = true; + } + + if (scope === '{' && ch === '}') { + state.scopes.pop(); + state.leaving_expr = true; + } + + if (ch === ')') { + state.leaving_expr = true; + } + + var match; + if (!in_array(state) && (match = stream.match(openers, false))) { + state.scopes.push(match); + } + + if (!in_array(state) && stream.match(closers, false)) { + state.scopes.pop(); + } + + if (in_array(state)) { + if (stream.match(/^end/)) { + return 'number'; + } + + } + + if (stream.match(/^=>/)) { + return 'operator'; + } + + + // Handle Number Literals + if (stream.match(/^[0-9\.]/, false)) { + var imMatcher = RegExp(/^im\b/); + var floatLiteral = false; + // Floats + if (stream.match(/^\d*\.(?!\.)\d+([ef][\+\-]?\d+)?/i)) { + floatLiteral = true; + } + if (stream.match(/^\d+\.(?!\.)\d*/)) { + floatLiteral = true; + } + if (stream.match(/^\.\d+/)) { + floatLiteral = true; + } + if (floatLiteral) { + // Float literals may be "imaginary" + stream.match(imMatcher); + state.leaving_expr = true; + return 'number'; + } + // Integers + var intLiteral = false; + // Hex + if (stream.match(/^0x[0-9a-f]+/i)) { + intLiteral = true; + } + // Binary + if (stream.match(/^0b[01]+/i)) { + intLiteral = true; + } + // Octal + if (stream.match(/^0o[0-7]+/i)) { + intLiteral = true; + } + // Decimal + if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) { + intLiteral = true; + } + // Zero by itself with no other piece of number. + if (stream.match(/^0(?![\dx])/i)) { + intLiteral = true; + } + if (intLiteral) { + // Integer literals may be "long" + stream.match(imMatcher); + state.leaving_expr = true; + return 'number'; + } + } + + if (stream.match(/^(::)|(<:)/)) { + return 'operator'; + } + + // Handle symbols + if (!leaving_expr && stream.match(symbol)) { + return 'string'; + } + + // Handle operators and Delimiters + if (stream.match(operators)) { + return 'operator'; + } + + + // Handle Strings + if (stream.match(stringPrefixes)) { + state.tokenize = tokenStringFactory(stream.current()); + return state.tokenize(stream, state); + } + + if (stream.match(macro)) { + return 'meta'; + } + + + if (stream.match(delimiters)) { + return null; + } + + if (stream.match(keywords)) { + return 'keyword'; + } + + if (stream.match(builtins)) { + return 'builtin'; + } + + + if (stream.match(identifiers)) { + state.leaving_expr = true; + return 'variable'; + } + // Handle non-detected items + stream.next(); return ERRORCLASS; - } else { - state.tokenize = tokenBase; } - } - return OUTCLASS; - } - tokenString.isString = true; - return tokenString; - } - - function tokenLexer(stream, state) { - indentInfo = null; - var style = state.tokenize(stream, state); - var current = stream.current(); - - // Handle '.' connected identifiers - if (current === '.') { - style = stream.match(identifiers, false) ? null : ERRORCLASS; - if (style === null && state.lastStyle === 'meta') { - // Apply 'meta' style to '.' connected identifiers when - // appropriate. - style = 'meta'; - } - return style; - } - - return style; - } - - var external = { - startState: function() { - return { - tokenize: tokenBase, - scopes: [], - leaving_expr: false - }; - }, - - token: function(stream, state) { - var style = tokenLexer(stream, state); - state.lastStyle = style; - return style; - }, - - indent: function(state, textAfter) { - var delta = 0; - if(textAfter=="end" || textAfter=="]" || textAfter=="}" || textAfter=="else" || textAfter=="elseif" || textAfter=="catch" || textAfter=="finally") { - delta = -1; - } - return (state.scopes.length + delta) * 4; - }, - - lineComment: "#", - fold: "indent", - electricChars: "edlsifyh]}" - }; - return external; -}); + function tokenStringFactory(delimiter) { + while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) { + delimiter = delimiter.substr(1); + } + var singleline = delimiter.length == 1; + var OUTCLASS = 'string'; + + function tokenString(stream, state) { + while (!stream.eol()) { + stream.eatWhile(/[^'"\\]/); + if (stream.eat('\\')) { + stream.next(); + if (singleline && stream.eol()) { + return OUTCLASS; + } + } else if (stream.match(delimiter)) { + state.tokenize = tokenBase; + return OUTCLASS; + } else { + stream.eat(/['"]/); + } + } + if (singleline) { + if (parserConf.singleLineStringErrors) { + return ERRORCLASS; + } else { + state.tokenize = tokenBase; + } + } + return OUTCLASS; + } + + tokenString.isString = true; + return tokenString; + } + + function tokenLexer(stream, state) { + indentInfo = null; + var style = state.tokenize(stream, state); + var current = stream.current(); + + // Handle '.' connected identifiers + if (current === '.') { + style = stream.match(identifiers, false) ? null : ERRORCLASS; + if (style === null && state.lastStyle === 'meta') { + // Apply 'meta' style to '.' connected identifiers when + // appropriate. + style = 'meta'; + } + return style; + } + + return style; + } -CodeMirror.defineMIME("text/x-julia", "julia"); + var external = { + startState: function () { + return { + tokenize: tokenBase, + scopes: [], + leaving_expr: false + }; + }, + + token: function (stream, state) { + var style = tokenLexer(stream, state); + state.lastStyle = style; + return style; + }, + + indent: function (state, textAfter) { + var delta = 0; + if (textAfter == "end" || textAfter == "]" || textAfter == "}" || textAfter == "else" || textAfter == "elseif" || textAfter == "catch" || textAfter == "finally") { + delta = -1; + } + return (state.scopes.length + delta) * 4; + }, + + lineComment: "#", + fold: "indent", + electricChars: "edlsifyh]}" + }; + return external; + }); + + + CodeMirror.defineMIME("text/x-julia", "julia"); }); diff --git a/web/editor.md/lib/codemirror/mode/kotlin/index.html b/web/editor.md/lib/codemirror/mode/kotlin/index.html index 859e109..0bfc904 100644 --- a/web/editor.md/lib/codemirror/mode/kotlin/index.html +++ b/web/editor.md/lib/codemirror/mode/kotlin/index.html @@ -2,31 +2,34 @@ CodeMirror: Kotlin mode - + - + - +
-

Kotlin mode

+

Kotlin mode

-

MIME types defined: text/x-livescript.

The LiveScript mode was written by Kenneth Bentley.

-
+
diff --git a/web/editor.md/lib/codemirror/mode/livescript/livescript.js b/web/editor.md/lib/codemirror/mode/livescript/livescript.js index 55882ef..7a40621 100644 --- a/web/editor.md/lib/codemirror/mode/livescript/livescript.js +++ b/web/editor.md/lib/codemirror/mode/livescript/livescript.js @@ -6,275 +6,275 @@ * https://github.com/duralog/CodeMirror */ -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; - CodeMirror.defineMode('livescript', function(){ - var tokenBase = function(stream, state) { - var next_rule = state.next || "start"; - if (next_rule) { - state.next = state.next; - var nr = Rules[next_rule]; - if (nr.splice) { - for (var i$ = 0; i$ < nr.length; ++i$) { - var r = nr[i$], m; - if (r.regex && (m = stream.match(r.regex))) { - state.next = r.next || state.next; - return r.token; + CodeMirror.defineMode('livescript', function () { + var tokenBase = function (stream, state) { + var next_rule = state.next || "start"; + if (next_rule) { + state.next = state.next; + var nr = Rules[next_rule]; + if (nr.splice) { + for (var i$ = 0; i$ < nr.length; ++i$) { + var r = nr[i$], m; + if (r.regex && (m = stream.match(r.regex))) { + state.next = r.next || state.next; + return r.token; + } + } + stream.next(); + return 'error'; + } + if (stream.match(r = Rules[next_rule])) { + if (r.regex && stream.match(r.regex)) { + state.next = r.next; + return r.token; + } else { + stream.next(); + return 'error'; + } + } } - } - stream.next(); - return 'error'; - } - if (stream.match(r = Rules[next_rule])) { - if (r.regex && stream.match(r.regex)) { - state.next = r.next; - return r.token; - } else { stream.next(); return 'error'; - } - } - } - stream.next(); - return 'error'; - }; - var external = { - startState: function(){ - return { - next: 'start', - lastToken: null }; - }, - token: function(stream, state){ - while (stream.pos == stream.start) - var style = tokenBase(stream, state); - state.lastToken = { - style: style, - indent: stream.indentation(), - content: stream.current() + var external = { + startState: function () { + return { + next: 'start', + lastToken: null + }; + }, + token: function (stream, state) { + while (stream.pos == stream.start) + var style = tokenBase(stream, state); + state.lastToken = { + style: style, + indent: stream.indentation(), + content: stream.current() + }; + return style.replace(/\./g, ' '); + }, + indent: function (state) { + var indentation = state.lastToken.indent; + if (state.lastToken.content.match(indenter)) { + indentation += 2; + } + return indentation; + } }; - return style.replace(/\./g, ' '); - }, - indent: function(state){ - var indentation = state.lastToken.indent; - if (state.lastToken.content.match(indenter)) { - indentation += 2; - } - return indentation; - } - }; - return external; - }); + return external; + }); - var identifier = '(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*'; - var indenter = RegExp('(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*' + identifier + ')?))\\s*$'); - var keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))'; - var stringfill = { - token: 'string', - regex: '.+' - }; - var Rules = { - start: [ - { - token: 'comment.doc', - regex: '/\\*', - next: 'comment' - }, { - token: 'comment', - regex: '#.*' - }, { - token: 'keyword', - regex: '(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)' + keywordend - }, { - token: 'constant.language', - regex: '(?:true|false|yes|no|on|off|null|void|undefined)' + keywordend - }, { - token: 'invalid.illegal', - regex: '(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)' + keywordend - }, { - token: 'language.support.class', - regex: '(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)' + keywordend - }, { - token: 'language.support.function', - regex: '(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)' + keywordend - }, { - token: 'variable.language', - regex: '(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)' + keywordend - }, { - token: 'identifier', - regex: identifier + '\\s*:(?![:=])' - }, { - token: 'variable', - regex: identifier - }, { - token: 'keyword.operator', - regex: '(?:\\.{3}|\\s+\\?)' - }, { - token: 'keyword.variable', - regex: '(?:@+|::|\\.\\.)', - next: 'key' - }, { - token: 'keyword.operator', - regex: '\\.\\s*', - next: 'key' - }, { + var identifier = '(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*'; + var indenter = RegExp('(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*' + identifier + ')?))\\s*$'); + var keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))'; + var stringfill = { token: 'string', - regex: '\\\\\\S[^\\s,;)}\\]]*' - }, { - token: 'string.doc', - regex: '\'\'\'', - next: 'qdoc' - }, { - token: 'string.doc', - regex: '"""', - next: 'qqdoc' - }, { - token: 'string', - regex: '\'', - next: 'qstring' - }, { - token: 'string', - regex: '"', - next: 'qqstring' - }, { - token: 'string', - regex: '`', - next: 'js' - }, { - token: 'string', - regex: '<\\[', - next: 'words' - }, { - token: 'string.regex', - regex: '//', - next: 'heregex' - }, { - token: 'string.regex', - regex: '\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}', - next: 'key' - }, { - token: 'constant.numeric', - regex: '(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)' - }, { - token: 'lparen', - regex: '[({[]' - }, { - token: 'rparen', - regex: '[)}\\]]', - next: 'key' - }, { - token: 'keyword.operator', - regex: '\\S+' - }, { - token: 'text', - regex: '\\s+' - } - ], - heregex: [ - { - token: 'string.regex', - regex: '.*?//[gimy$?]{0,4}', - next: 'start' - }, { - token: 'string.regex', - regex: '\\s*#{' - }, { - token: 'comment.regex', - regex: '\\s+(?:#.*)?' - }, { - token: 'string.regex', - regex: '\\S+' - } - ], - key: [ - { - token: 'keyword.operator', - regex: '[.?@!]+' - }, { - token: 'identifier', - regex: identifier, - next: 'start' - }, { - token: 'text', - regex: '', - next: 'start' - } - ], - comment: [ - { - token: 'comment.doc', - regex: '.*?\\*/', - next: 'start' - }, { - token: 'comment.doc', regex: '.+' - } - ], - qdoc: [ - { - token: 'string', - regex: ".*?'''", - next: 'key' - }, stringfill - ], - qqdoc: [ - { - token: 'string', - regex: '.*?"""', - next: 'key' - }, stringfill - ], - qstring: [ - { - token: 'string', - regex: '[^\\\\\']*(?:\\\\.[^\\\\\']*)*\'', - next: 'key' - }, stringfill - ], - qqstring: [ - { - token: 'string', - regex: '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"', - next: 'key' - }, stringfill - ], - js: [ - { - token: 'string', - regex: '[^\\\\`]*(?:\\\\.[^\\\\`]*)*`', - next: 'key' - }, stringfill - ], - words: [ - { - token: 'string', - regex: '.*?\\]>', - next: 'key' - }, stringfill - ] - }; - for (var idx in Rules) { - var r = Rules[idx]; - if (r.splice) { - for (var i = 0, len = r.length; i < len; ++i) { - var rr = r[i]; - if (typeof rr.regex === 'string') { - Rules[idx][i].regex = new RegExp('^' + rr.regex); + }; + var Rules = { + start: [ + { + token: 'comment.doc', + regex: '/\\*', + next: 'comment' + }, { + token: 'comment', + regex: '#.*' + }, { + token: 'keyword', + regex: '(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)' + keywordend + }, { + token: 'constant.language', + regex: '(?:true|false|yes|no|on|off|null|void|undefined)' + keywordend + }, { + token: 'invalid.illegal', + regex: '(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)' + keywordend + }, { + token: 'language.support.class', + regex: '(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)' + keywordend + }, { + token: 'language.support.function', + regex: '(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)' + keywordend + }, { + token: 'variable.language', + regex: '(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)' + keywordend + }, { + token: 'identifier', + regex: identifier + '\\s*:(?![:=])' + }, { + token: 'variable', + regex: identifier + }, { + token: 'keyword.operator', + regex: '(?:\\.{3}|\\s+\\?)' + }, { + token: 'keyword.variable', + regex: '(?:@+|::|\\.\\.)', + next: 'key' + }, { + token: 'keyword.operator', + regex: '\\.\\s*', + next: 'key' + }, { + token: 'string', + regex: '\\\\\\S[^\\s,;)}\\]]*' + }, { + token: 'string.doc', + regex: '\'\'\'', + next: 'qdoc' + }, { + token: 'string.doc', + regex: '"""', + next: 'qqdoc' + }, { + token: 'string', + regex: '\'', + next: 'qstring' + }, { + token: 'string', + regex: '"', + next: 'qqstring' + }, { + token: 'string', + regex: '`', + next: 'js' + }, { + token: 'string', + regex: '<\\[', + next: 'words' + }, { + token: 'string.regex', + regex: '//', + next: 'heregex' + }, { + token: 'string.regex', + regex: '\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}', + next: 'key' + }, { + token: 'constant.numeric', + regex: '(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)' + }, { + token: 'lparen', + regex: '[({[]' + }, { + token: 'rparen', + regex: '[)}\\]]', + next: 'key' + }, { + token: 'keyword.operator', + regex: '\\S+' + }, { + token: 'text', + regex: '\\s+' + } + ], + heregex: [ + { + token: 'string.regex', + regex: '.*?//[gimy$?]{0,4}', + next: 'start' + }, { + token: 'string.regex', + regex: '\\s*#{' + }, { + token: 'comment.regex', + regex: '\\s+(?:#.*)?' + }, { + token: 'string.regex', + regex: '\\S+' + } + ], + key: [ + { + token: 'keyword.operator', + regex: '[.?@!]+' + }, { + token: 'identifier', + regex: identifier, + next: 'start' + }, { + token: 'text', + regex: '', + next: 'start' + } + ], + comment: [ + { + token: 'comment.doc', + regex: '.*?\\*/', + next: 'start' + }, { + token: 'comment.doc', + regex: '.+' + } + ], + qdoc: [ + { + token: 'string', + regex: ".*?'''", + next: 'key' + }, stringfill + ], + qqdoc: [ + { + token: 'string', + regex: '.*?"""', + next: 'key' + }, stringfill + ], + qstring: [ + { + token: 'string', + regex: '[^\\\\\']*(?:\\\\.[^\\\\\']*)*\'', + next: 'key' + }, stringfill + ], + qqstring: [ + { + token: 'string', + regex: '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"', + next: 'key' + }, stringfill + ], + js: [ + { + token: 'string', + regex: '[^\\\\`]*(?:\\\\.[^\\\\`]*)*`', + next: 'key' + }, stringfill + ], + words: [ + { + token: 'string', + regex: '.*?\\]>', + next: 'key' + }, stringfill + ] + }; + for (var idx in Rules) { + var r = Rules[idx]; + if (r.splice) { + for (var i = 0, len = r.length; i < len; ++i) { + var rr = r[i]; + if (typeof rr.regex === 'string') { + Rules[idx][i].regex = new RegExp('^' + rr.regex); + } + } + } else if (typeof rr.regex === 'string') { + Rules[idx].regex = new RegExp('^' + r.regex); } - } - } else if (typeof rr.regex === 'string') { - Rules[idx].regex = new RegExp('^' + r.regex); } - } - CodeMirror.defineMIME('text/x-livescript', 'livescript'); + CodeMirror.defineMIME('text/x-livescript', 'livescript'); }); diff --git a/web/editor.md/lib/codemirror/mode/lua/index.html b/web/editor.md/lib/codemirror/mode/lua/index.html index fc98b94..d8cc311 100644 --- a/web/editor.md/lib/codemirror/mode/lua/index.html +++ b/web/editor.md/lib/codemirror/mode/lua/index.html @@ -2,31 +2,33 @@ CodeMirror: Lua mode - + - - + + - +
-

Lua mode

-

Loosely based on Franciszek - Wawrzak's CodeMirror - 1 mode. One configuration parameter is - supported, specials, to which you can provide an - array of strings to have those identifiers highlighted with - the lua-special style.

+ Wawrzak's CodeMirror + 1 mode. One configuration parameter is + supported, specials, to which you can provide an + array of strings to have those identifiers highlighted with + the lua-special style.

MIME types defined: text/x-lua.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/lua/lua.js b/web/editor.md/lib/codemirror/mode/lua/lua.js index 0b19abd..1beca97 100644 --- a/web/editor.md/lib/codemirror/mode/lua/lua.js +++ b/web/editor.md/lib/codemirror/mode/lua/lua.js @@ -5,155 +5,160 @@ // CodeMirror 1 mode. // highlights keywords, strings, comments (no leveling supported! ("[==[")), tokens, basic indenting -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("lua", function(config, parserConfig) { - var indentUnit = config.indentUnit; - - function prefixRE(words) { - return new RegExp("^(?:" + words.join("|") + ")", "i"); - } - function wordRE(words) { - return new RegExp("^(?:" + words.join("|") + ")$", "i"); - } - var specials = wordRE(parserConfig.specials || []); - - // long list of standard functions from lua manual - var builtins = wordRE([ - "_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load", - "loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require", - "select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall", - - "coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield", - - "debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable", - "debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable", - "debug.setupvalue","debug.traceback", - - "close","flush","lines","read","seek","setvbuf","write", - - "io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin", - "io.stdout","io.tmpfile","io.type","io.write", - - "math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg", - "math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max", - "math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh", - "math.sqrt","math.tan","math.tanh", - - "os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale", - "os.time","os.tmpname", - - "package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload", - "package.seeall", - - "string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub", - "string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper", - - "table.concat","table.insert","table.maxn","table.remove","table.sort" - ]); - var keywords = wordRE(["and","break","elseif","false","nil","not","or","return", - "true","function", "end", "if", "then", "else", "do", - "while", "repeat", "until", "for", "in", "local" ]); - - var indentTokens = wordRE(["function", "if","repeat","do", "\\(", "{"]); - var dedentTokens = wordRE(["end", "until", "\\)", "}"]); - var dedentPartial = prefixRE(["end", "until", "\\)", "}", "else", "elseif"]); - - function readBracket(stream) { - var level = 0; - while (stream.eat("=")) ++level; - stream.eat("["); - return level; - } - - function normal(stream, state) { - var ch = stream.next(); - if (ch == "-" && stream.eat("-")) { - if (stream.eat("[") && stream.eat("[")) - return (state.cur = bracketed(readBracket(stream), "comment"))(stream, state); - stream.skipToEnd(); - return "comment"; - } - if (ch == "\"" || ch == "'") - return (state.cur = string(ch))(stream, state); - if (ch == "[" && /[\[=]/.test(stream.peek())) - return (state.cur = bracketed(readBracket(stream), "string"))(stream, state); - if (/\d/.test(ch)) { - stream.eatWhile(/[\w.%]/); - return "number"; - } - if (/[\w_]/.test(ch)) { - stream.eatWhile(/[\w\\\-_.]/); - return "variable"; - } - return null; - } - - function bracketed(level, style) { - return function(stream, state) { - var curlev = null, ch; - while ((ch = stream.next()) != null) { - if (curlev == null) {if (ch == "]") curlev = 0;} - else if (ch == "=") ++curlev; - else if (ch == "]" && curlev == level) { state.cur = normal; break; } - else curlev = null; - } - return style; - }; - } - - function string(quote) { - return function(stream, state) { - var escaped = false, ch; - while ((ch = stream.next()) != null) { - if (ch == quote && !escaped) break; - escaped = !escaped && ch == "\\"; - } - if (!escaped) state.cur = normal; - return "string"; - }; - } - - return { - startState: function(basecol) { - return {basecol: basecol || 0, indentDepth: 0, cur: normal}; - }, - - token: function(stream, state) { - if (stream.eatSpace()) return null; - var style = state.cur(stream, state); - var word = stream.current(); - if (style == "variable") { - if (keywords.test(word)) style = "keyword"; - else if (builtins.test(word)) style = "builtin"; - else if (specials.test(word)) style = "variable-2"; - } - if ((style != "comment") && (style != "string")){ - if (indentTokens.test(word)) ++state.indentDepth; - else if (dedentTokens.test(word)) --state.indentDepth; - } - return style; - }, - - indent: function(state, textAfter) { - var closing = dedentPartial.test(textAfter); - return state.basecol + indentUnit * (state.indentDepth - (closing ? 1 : 0)); - }, - - lineComment: "--", - blockCommentStart: "--[[", - blockCommentEnd: "]]" - }; -}); - -CodeMirror.defineMIME("text/x-lua", "lua"); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("lua", function (config, parserConfig) { + var indentUnit = config.indentUnit; + + function prefixRE(words) { + return new RegExp("^(?:" + words.join("|") + ")", "i"); + } + + function wordRE(words) { + return new RegExp("^(?:" + words.join("|") + ")$", "i"); + } + + var specials = wordRE(parserConfig.specials || []); + + // long list of standard functions from lua manual + var builtins = wordRE([ + "_G", "_VERSION", "assert", "collectgarbage", "dofile", "error", "getfenv", "getmetatable", "ipairs", "load", + "loadfile", "loadstring", "module", "next", "pairs", "pcall", "print", "rawequal", "rawget", "rawset", "require", + "select", "setfenv", "setmetatable", "tonumber", "tostring", "type", "unpack", "xpcall", + + "coroutine.create", "coroutine.resume", "coroutine.running", "coroutine.status", "coroutine.wrap", "coroutine.yield", + + "debug.debug", "debug.getfenv", "debug.gethook", "debug.getinfo", "debug.getlocal", "debug.getmetatable", + "debug.getregistry", "debug.getupvalue", "debug.setfenv", "debug.sethook", "debug.setlocal", "debug.setmetatable", + "debug.setupvalue", "debug.traceback", + + "close", "flush", "lines", "read", "seek", "setvbuf", "write", + + "io.close", "io.flush", "io.input", "io.lines", "io.open", "io.output", "io.popen", "io.read", "io.stderr", "io.stdin", + "io.stdout", "io.tmpfile", "io.type", "io.write", + + "math.abs", "math.acos", "math.asin", "math.atan", "math.atan2", "math.ceil", "math.cos", "math.cosh", "math.deg", + "math.exp", "math.floor", "math.fmod", "math.frexp", "math.huge", "math.ldexp", "math.log", "math.log10", "math.max", + "math.min", "math.modf", "math.pi", "math.pow", "math.rad", "math.random", "math.randomseed", "math.sin", "math.sinh", + "math.sqrt", "math.tan", "math.tanh", + + "os.clock", "os.date", "os.difftime", "os.execute", "os.exit", "os.getenv", "os.remove", "os.rename", "os.setlocale", + "os.time", "os.tmpname", + + "package.cpath", "package.loaded", "package.loaders", "package.loadlib", "package.path", "package.preload", + "package.seeall", + + "string.byte", "string.char", "string.dump", "string.find", "string.format", "string.gmatch", "string.gsub", + "string.len", "string.lower", "string.match", "string.rep", "string.reverse", "string.sub", "string.upper", + + "table.concat", "table.insert", "table.maxn", "table.remove", "table.sort" + ]); + var keywords = wordRE(["and", "break", "elseif", "false", "nil", "not", "or", "return", + "true", "function", "end", "if", "then", "else", "do", + "while", "repeat", "until", "for", "in", "local"]); + + var indentTokens = wordRE(["function", "if", "repeat", "do", "\\(", "{"]); + var dedentTokens = wordRE(["end", "until", "\\)", "}"]); + var dedentPartial = prefixRE(["end", "until", "\\)", "}", "else", "elseif"]); + + function readBracket(stream) { + var level = 0; + while (stream.eat("=")) ++level; + stream.eat("["); + return level; + } + + function normal(stream, state) { + var ch = stream.next(); + if (ch == "-" && stream.eat("-")) { + if (stream.eat("[") && stream.eat("[")) + return (state.cur = bracketed(readBracket(stream), "comment"))(stream, state); + stream.skipToEnd(); + return "comment"; + } + if (ch == "\"" || ch == "'") + return (state.cur = string(ch))(stream, state); + if (ch == "[" && /[\[=]/.test(stream.peek())) + return (state.cur = bracketed(readBracket(stream), "string"))(stream, state); + if (/\d/.test(ch)) { + stream.eatWhile(/[\w.%]/); + return "number"; + } + if (/[\w_]/.test(ch)) { + stream.eatWhile(/[\w\\\-_.]/); + return "variable"; + } + return null; + } + + function bracketed(level, style) { + return function (stream, state) { + var curlev = null, ch; + while ((ch = stream.next()) != null) { + if (curlev == null) { + if (ch == "]") curlev = 0; + } else if (ch == "=") ++curlev; + else if (ch == "]" && curlev == level) { + state.cur = normal; + break; + } else curlev = null; + } + return style; + }; + } + + function string(quote) { + return function (stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) break; + escaped = !escaped && ch == "\\"; + } + if (!escaped) state.cur = normal; + return "string"; + }; + } + + return { + startState: function (basecol) { + return {basecol: basecol || 0, indentDepth: 0, cur: normal}; + }, + + token: function (stream, state) { + if (stream.eatSpace()) return null; + var style = state.cur(stream, state); + var word = stream.current(); + if (style == "variable") { + if (keywords.test(word)) style = "keyword"; + else if (builtins.test(word)) style = "builtin"; + else if (specials.test(word)) style = "variable-2"; + } + if ((style != "comment") && (style != "string")) { + if (indentTokens.test(word)) ++state.indentDepth; + else if (dedentTokens.test(word)) --state.indentDepth; + } + return style; + }, + + indent: function (state, textAfter) { + var closing = dedentPartial.test(textAfter); + return state.basecol + indentUnit * (state.indentDepth - (closing ? 1 : 0)); + }, + + lineComment: "--", + blockCommentStart: "--[[", + blockCommentEnd: "]]" + }; + }); + + CodeMirror.defineMIME("text/x-lua", "lua"); }); diff --git a/web/editor.md/lib/codemirror/mode/markdown/index.html b/web/editor.md/lib/codemirror/mode/markdown/index.html index c3bb8df..a76cc31 100644 --- a/web/editor.md/lib/codemirror/mode/markdown/index.html +++ b/web/editor.md/lib/codemirror/mode/markdown/index.html @@ -2,36 +2,49 @@ CodeMirror: Markdown mode - + - + + .CodeMirror { + border-top: 1px solid black; + border-bottom: 1px solid black; + } + + .cm-s-default .cm-trailing-space-a:before, + .cm-s-default .cm-trailing-space-b:before { + position: absolute; + content: "\00B7"; + color: #777; + } + + .cm-s-default .cm-trailing-space-new-line:before { + position: absolute; + content: "\21B5"; + color: #777; + } +
-

Markdown mode

-

Optionally depends on the XML mode for properly highlighted inline XML blocks.

MIME types defined: text/x-markdown.

-

Parsing/Highlighting Tests: normal, verbose.

+

Parsing/Highlighting Tests: normal, verbose.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/markdown/markdown.js b/web/editor.md/lib/codemirror/mode/markdown/markdown.js index 3c80311..b5728f6 100644 --- a/web/editor.md/lib/codemirror/mode/markdown/markdown.js +++ b/web/editor.md/lib/codemirror/mode/markdown/markdown.js @@ -1,765 +1,779 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../xml/xml"), require("../meta")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../xml/xml", "../meta"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { - - var htmlFound = CodeMirror.modes.hasOwnProperty("xml"); - var htmlMode = CodeMirror.getMode(cmCfg, htmlFound ? {name: "xml", htmlMode: true} : "text/plain"); - - function getMode(name) { - if (CodeMirror.findModeByName) { - var found = CodeMirror.findModeByName(name); - if (found) name = found.mime || found.mimes[0]; - } - var mode = CodeMirror.getMode(cmCfg, name); - return mode.name == "null" ? null : mode; - } - - // Should characters that affect highlighting be highlighted separate? - // Does not include characters that will be output (such as `1.` and `-` for lists) - if (modeCfg.highlightFormatting === undefined) - modeCfg.highlightFormatting = false; - - // Maximum number of nested blockquotes. Set to 0 for infinite nesting. - // Excess `>` will emit `error` token. - if (modeCfg.maxBlockquoteDepth === undefined) - modeCfg.maxBlockquoteDepth = 0; - - // Should underscores in words open/close em/strong? - if (modeCfg.underscoresBreakWords === undefined) - modeCfg.underscoresBreakWords = true; - - // Turn on fenced code blocks? ("```" to start/end) - if (modeCfg.fencedCodeBlocks === undefined) modeCfg.fencedCodeBlocks = false; - - // Turn on task lists? ("- [ ] " and "- [x] ") - if (modeCfg.taskLists === undefined) modeCfg.taskLists = false; - - // Turn on strikethrough syntax - if (modeCfg.strikethrough === undefined) - modeCfg.strikethrough = false; - - var codeDepth = 0; - - var header = 'header' - , code = 'comment' - , quote = 'quote' - , list1 = 'variable-2' - , list2 = 'variable-3' - , list3 = 'keyword' - , hr = 'hr' - , image = 'tag' - , formatting = 'formatting' - , linkinline = 'link' - , linkemail = 'link' - , linktext = 'link' - , linkhref = 'string' - , em = 'em' - , strong = 'strong' - , strikethrough = 'strikethrough'; - - var hrRE = /^([*\-=_])(?:\s*\1){2,}\s*$/ - , ulRE = /^[*\-+]\s+/ - , olRE = /^[0-9]+\.\s+/ - , taskListRE = /^\[(x| )\](?=\s)/ // Must follow ulRE or olRE - , atxHeaderRE = /^#+/ - , setextHeaderRE = /^(?:\={1,}|-{1,})$/ - , textRE = /^[^#!\[\]*_\\<>` "'(~]+/; - - function switchInline(stream, state, f) { - state.f = state.inline = f; - return f(stream, state); - } - - function switchBlock(stream, state, f) { - state.f = state.block = f; - return f(stream, state); - } - - - // Blocks - - function blankLine(state) { - // Reset linkTitle state - state.linkTitle = false; - // Reset EM state - state.em = false; - // Reset STRONG state - state.strong = false; - // Reset strikethrough state - state.strikethrough = false; - // Reset state.quote - state.quote = 0; - if (!htmlFound && state.f == htmlBlock) { - state.f = inlineNormal; - state.block = blockNormal; - } - // Reset state.trailingSpace - state.trailingSpace = 0; - state.trailingSpaceNewLine = false; - // Mark this line as blank - state.thisLineHasContent = false; - return null; - } - - function blockNormal(stream, state) { - - var sol = stream.sol(); - - var prevLineIsList = (state.list !== false); - if (state.list !== false && state.indentationDiff >= 0) { // Continued list - if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block - state.indentation -= state.indentationDiff; - } - state.list = null; - } else if (state.list !== false && state.indentation > 0) { - state.list = null; - state.listDepth = Math.floor(state.indentation / 4); - } else if (state.list !== false) { // No longer a list - state.list = false; - state.listDepth = 0; - } - - var match = null; - if (state.indentationDiff >= 4) { - state.indentation -= 4; - stream.skipToEnd(); - return code; - } else if (stream.eatSpace()) { - return null; - } else if (match = stream.match(atxHeaderRE)) { - state.header = match[0].length <= 6 ? match[0].length : 6; - if (modeCfg.highlightFormatting) state.formatting = "header"; - state.f = state.inline; - return getType(state); - } else if (state.prevLineHasContent && (match = stream.match(setextHeaderRE))) { - state.header = match[0].charAt(0) == '=' ? 1 : 2; - if (modeCfg.highlightFormatting) state.formatting = "header"; - state.f = state.inline; - return getType(state); - } else if (stream.eat('>')) { - state.indentation++; - state.quote = sol ? 1 : state.quote + 1; - if (modeCfg.highlightFormatting) state.formatting = "quote"; - stream.eatSpace(); - return getType(state); - } else if (stream.peek() === '[') { - return switchInline(stream, state, footnoteLink); - } else if (stream.match(hrRE, true)) { - return hr; - } else if ((!state.prevLineHasContent || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) { - var listType = null; - if (stream.match(ulRE, true)) { - listType = 'ul'; - } else { - stream.match(olRE, true); - listType = 'ol'; - } - state.indentation += 4; - state.list = true; - state.listDepth++; - if (modeCfg.taskLists && stream.match(taskListRE, false)) { - state.taskList = true; - } - state.f = state.inline; - if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType]; - return getType(state); - } else if (modeCfg.fencedCodeBlocks && stream.match(/^```[ \t]*([\w+#]*)/, true)) { - // try switching mode - state.localMode = getMode(RegExp.$1); - if (state.localMode) state.localState = state.localMode.startState(); - state.f = state.block = local; - if (modeCfg.highlightFormatting) state.formatting = "code-block"; - state.code = true; - return getType(state); - } - - return switchInline(stream, state, state.inline); - } - - function htmlBlock(stream, state) { - var style = htmlMode.token(stream, state.htmlState); - if ((htmlFound && state.htmlState.tagStart === null && !state.htmlState.context) || - (state.md_inside && stream.current().indexOf(">") > -1)) { - state.f = inlineNormal; - state.block = blockNormal; - state.htmlState = null; - } - return style; - } - - function local(stream, state) { - if (stream.sol() && stream.match("```", false)) { - state.localMode = state.localState = null; - state.f = state.block = leavingLocal; - return null; - } else if (state.localMode) { - return state.localMode.token(stream, state.localState); - } else { - stream.skipToEnd(); - return code; - } - } - - function leavingLocal(stream, state) { - stream.match("```"); - state.block = blockNormal; - state.f = inlineNormal; - if (modeCfg.highlightFormatting) state.formatting = "code-block"; - state.code = true; - var returnType = getType(state); - state.code = false; - return returnType; - } - - // Inline - function getType(state) { - var styles = []; - - if (state.formatting) { - styles.push(formatting); - - if (typeof state.formatting === "string") state.formatting = [state.formatting]; - - for (var i = 0; i < state.formatting.length; i++) { - styles.push(formatting + "-" + state.formatting[i]); - - if (state.formatting[i] === "header") { - styles.push(formatting + "-" + state.formatting[i] + "-" + state.header); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../xml/xml"), require("../meta")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../xml/xml", "../meta"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("markdown", function (cmCfg, modeCfg) { + + var htmlFound = CodeMirror.modes.hasOwnProperty("xml"); + var htmlMode = CodeMirror.getMode(cmCfg, htmlFound ? {name: "xml", htmlMode: true} : "text/plain"); + + function getMode(name) { + if (CodeMirror.findModeByName) { + var found = CodeMirror.findModeByName(name); + if (found) name = found.mime || found.mimes[0]; + } + var mode = CodeMirror.getMode(cmCfg, name); + return mode.name == "null" ? null : mode; } - // Add `formatting-quote` and `formatting-quote-#` for blockquotes - // Add `error` instead if the maximum blockquote nesting depth is passed - if (state.formatting[i] === "quote") { - if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) { - styles.push(formatting + "-" + state.formatting[i] + "-" + state.quote); - } else { - styles.push("error"); - } + // Should characters that affect highlighting be highlighted separate? + // Does not include characters that will be output (such as `1.` and `-` for lists) + if (modeCfg.highlightFormatting === undefined) + modeCfg.highlightFormatting = false; + + // Maximum number of nested blockquotes. Set to 0 for infinite nesting. + // Excess `>` will emit `error` token. + if (modeCfg.maxBlockquoteDepth === undefined) + modeCfg.maxBlockquoteDepth = 0; + + // Should underscores in words open/close em/strong? + if (modeCfg.underscoresBreakWords === undefined) + modeCfg.underscoresBreakWords = true; + + // Turn on fenced code blocks? ("```" to start/end) + if (modeCfg.fencedCodeBlocks === undefined) modeCfg.fencedCodeBlocks = false; + + // Turn on task lists? ("- [ ] " and "- [x] ") + if (modeCfg.taskLists === undefined) modeCfg.taskLists = false; + + // Turn on strikethrough syntax + if (modeCfg.strikethrough === undefined) + modeCfg.strikethrough = false; + + var codeDepth = 0; + + var header = 'header' + , code = 'comment' + , quote = 'quote' + , list1 = 'variable-2' + , list2 = 'variable-3' + , list3 = 'keyword' + , hr = 'hr' + , image = 'tag' + , formatting = 'formatting' + , linkinline = 'link' + , linkemail = 'link' + , linktext = 'link' + , linkhref = 'string' + , em = 'em' + , strong = 'strong' + , strikethrough = 'strikethrough'; + + var hrRE = /^([*\-=_])(?:\s*\1){2,}\s*$/ + , ulRE = /^[*\-+]\s+/ + , olRE = /^[0-9]+\.\s+/ + , taskListRE = /^\[(x| )\](?=\s)/ // Must follow ulRE or olRE + , atxHeaderRE = /^#+/ + , setextHeaderRE = /^(?:\={1,}|-{1,})$/ + , textRE = /^[^#!\[\]*_\\<>` "'(~]+/; + + function switchInline(stream, state, f) { + state.f = state.inline = f; + return f(stream, state); } - } - } - - if (state.taskOpen) { - styles.push("meta"); - return styles.length ? styles.join(' ') : null; - } - if (state.taskClosed) { - styles.push("property"); - return styles.length ? styles.join(' ') : null; - } - - if (state.linkHref) { - styles.push(linkhref); - return styles.length ? styles.join(' ') : null; - } - - if (state.strong) { styles.push(strong); } - if (state.em) { styles.push(em); } - if (state.strikethrough) { styles.push(strikethrough); } - - if (state.linkText) { styles.push(linktext); } - - if (state.code) { styles.push(code); } - - if (state.header) { styles.push(header); styles.push(header + "-" + state.header); } - - if (state.quote) { - styles.push(quote); - - // Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth - if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) { - styles.push(quote + "-" + state.quote); - } else { - styles.push(quote + "-" + modeCfg.maxBlockquoteDepth); - } - } - - if (state.list !== false) { - var listMod = (state.listDepth - 1) % 3; - if (!listMod) { - styles.push(list1); - } else if (listMod === 1) { - styles.push(list2); - } else { - styles.push(list3); - } - } - - if (state.trailingSpaceNewLine) { - styles.push("trailing-space-new-line"); - } else if (state.trailingSpace) { - styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b")); - } - - return styles.length ? styles.join(' ') : null; - } - - function handleText(stream, state) { - if (stream.match(textRE, true)) { - return getType(state); - } - return undefined; - } - - function inlineNormal(stream, state) { - var style = state.text(stream, state); - if (typeof style !== 'undefined') - return style; - - if (state.list) { // List marker (*, +, -, 1., etc) - state.list = null; - return getType(state); - } - - if (state.taskList) { - var taskOpen = stream.match(taskListRE, true)[1] !== "x"; - if (taskOpen) state.taskOpen = true; - else state.taskClosed = true; - if (modeCfg.highlightFormatting) state.formatting = "task"; - state.taskList = false; - return getType(state); - } - - state.taskOpen = false; - state.taskClosed = false; - - if (state.header && stream.match(/^#+$/, true)) { - if (modeCfg.highlightFormatting) state.formatting = "header"; - return getType(state); - } - - // Get sol() value now, before character is consumed - var sol = stream.sol(); - - var ch = stream.next(); - - if (ch === '\\') { - stream.next(); - if (modeCfg.highlightFormatting) { - var type = getType(state); - return type ? type + " formatting-escape" : "formatting-escape"; - } - } - - // Matches link titles present on next line - if (state.linkTitle) { - state.linkTitle = false; - var matchCh = ch; - if (ch === '(') { - matchCh = ')'; - } - matchCh = (matchCh+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); - var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh; - if (stream.match(new RegExp(regex), true)) { - return linkhref; - } - } - - // If this block is changed, it may need to be updated in GFM mode - if (ch === '`') { - var previousFormatting = state.formatting; - if (modeCfg.highlightFormatting) state.formatting = "code"; - var t = getType(state); - var before = stream.pos; - stream.eatWhile('`'); - var difference = 1 + stream.pos - before; - if (!state.code) { - codeDepth = difference; - state.code = true; - return getType(state); - } else { - if (difference === codeDepth) { // Must be exact - state.code = false; - return t; + + function switchBlock(stream, state, f) { + state.f = state.block = f; + return f(stream, state); + } + + + // Blocks + + function blankLine(state) { + // Reset linkTitle state + state.linkTitle = false; + // Reset EM state + state.em = false; + // Reset STRONG state + state.strong = false; + // Reset strikethrough state + state.strikethrough = false; + // Reset state.quote + state.quote = 0; + if (!htmlFound && state.f == htmlBlock) { + state.f = inlineNormal; + state.block = blockNormal; + } + // Reset state.trailingSpace + state.trailingSpace = 0; + state.trailingSpaceNewLine = false; + // Mark this line as blank + state.thisLineHasContent = false; + return null; + } + + function blockNormal(stream, state) { + + var sol = stream.sol(); + + var prevLineIsList = (state.list !== false); + if (state.list !== false && state.indentationDiff >= 0) { // Continued list + if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block + state.indentation -= state.indentationDiff; + } + state.list = null; + } else if (state.list !== false && state.indentation > 0) { + state.list = null; + state.listDepth = Math.floor(state.indentation / 4); + } else if (state.list !== false) { // No longer a list + state.list = false; + state.listDepth = 0; + } + + var match = null; + if (state.indentationDiff >= 4) { + state.indentation -= 4; + stream.skipToEnd(); + return code; + } else if (stream.eatSpace()) { + return null; + } else if (match = stream.match(atxHeaderRE)) { + state.header = match[0].length <= 6 ? match[0].length : 6; + if (modeCfg.highlightFormatting) state.formatting = "header"; + state.f = state.inline; + return getType(state); + } else if (state.prevLineHasContent && (match = stream.match(setextHeaderRE))) { + state.header = match[0].charAt(0) == '=' ? 1 : 2; + if (modeCfg.highlightFormatting) state.formatting = "header"; + state.f = state.inline; + return getType(state); + } else if (stream.eat('>')) { + state.indentation++; + state.quote = sol ? 1 : state.quote + 1; + if (modeCfg.highlightFormatting) state.formatting = "quote"; + stream.eatSpace(); + return getType(state); + } else if (stream.peek() === '[') { + return switchInline(stream, state, footnoteLink); + } else if (stream.match(hrRE, true)) { + return hr; + } else if ((!state.prevLineHasContent || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) { + var listType = null; + if (stream.match(ulRE, true)) { + listType = 'ul'; + } else { + stream.match(olRE, true); + listType = 'ol'; + } + state.indentation += 4; + state.list = true; + state.listDepth++; + if (modeCfg.taskLists && stream.match(taskListRE, false)) { + state.taskList = true; + } + state.f = state.inline; + if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType]; + return getType(state); + } else if (modeCfg.fencedCodeBlocks && stream.match(/^```[ \t]*([\w+#]*)/, true)) { + // try switching mode + state.localMode = getMode(RegExp.$1); + if (state.localMode) state.localState = state.localMode.startState(); + state.f = state.block = local; + if (modeCfg.highlightFormatting) state.formatting = "code-block"; + state.code = true; + return getType(state); + } + + return switchInline(stream, state, state.inline); } - state.formatting = previousFormatting; - return getType(state); - } - } else if (state.code) { - return getType(state); - } - - if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) { - stream.match(/\[[^\]]*\]/); - state.inline = state.f = linkHref; - return image; - } - - if (ch === '[' && stream.match(/.*\](\(.*\)| ?\[.*\])/, false)) { - state.linkText = true; - if (modeCfg.highlightFormatting) state.formatting = "link"; - return getType(state); - } - - if (ch === ']' && state.linkText && stream.match(/\(.*\)| ?\[.*\]/, false)) { - if (modeCfg.highlightFormatting) state.formatting = "link"; - var type = getType(state); - state.linkText = false; - state.inline = state.f = linkHref; - return type; - } - - if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) { - state.f = state.inline = linkInline; - if (modeCfg.highlightFormatting) state.formatting = "link"; - var type = getType(state); - if (type){ - type += " "; - } else { - type = ""; - } - return type + linkinline; - } - - if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) { - state.f = state.inline = linkInline; - if (modeCfg.highlightFormatting) state.formatting = "link"; - var type = getType(state); - if (type){ - type += " "; - } else { - type = ""; - } - return type + linkemail; - } - - if (ch === '<' && stream.match(/^\w/, false)) { - if (stream.string.indexOf(">") != -1) { - var atts = stream.string.substring(1,stream.string.indexOf(">")); - if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) { - state.md_inside = true; + + function htmlBlock(stream, state) { + var style = htmlMode.token(stream, state.htmlState); + if ((htmlFound && state.htmlState.tagStart === null && !state.htmlState.context) || + (state.md_inside && stream.current().indexOf(">") > -1)) { + state.f = inlineNormal; + state.block = blockNormal; + state.htmlState = null; + } + return style; + } + + function local(stream, state) { + if (stream.sol() && stream.match("```", false)) { + state.localMode = state.localState = null; + state.f = state.block = leavingLocal; + return null; + } else if (state.localMode) { + return state.localMode.token(stream, state.localState); + } else { + stream.skipToEnd(); + return code; + } } - } - stream.backUp(1); - state.htmlState = CodeMirror.startState(htmlMode); - return switchBlock(stream, state, htmlBlock); - } - - if (ch === '<' && stream.match(/^\/\w*?>/)) { - state.md_inside = false; - return "tag"; - } - - var ignoreUnderscore = false; - if (!modeCfg.underscoresBreakWords) { - if (ch === '_' && stream.peek() !== '_' && stream.match(/(\w)/, false)) { - var prevPos = stream.pos - 2; - if (prevPos >= 0) { - var prevCh = stream.string.charAt(prevPos); - if (prevCh !== '_' && prevCh.match(/(\w)/, false)) { - ignoreUnderscore = true; - } + + function leavingLocal(stream, state) { + stream.match("```"); + state.block = blockNormal; + state.f = inlineNormal; + if (modeCfg.highlightFormatting) state.formatting = "code-block"; + state.code = true; + var returnType = getType(state); + state.code = false; + return returnType; } - } - } - if (ch === '*' || (ch === '_' && !ignoreUnderscore)) { - if (sol && stream.peek() === ' ') { - // Do nothing, surrounded by newline and space - } else if (state.strong === ch && stream.eat(ch)) { // Remove STRONG - if (modeCfg.highlightFormatting) state.formatting = "strong"; - var t = getType(state); - state.strong = false; - return t; - } else if (!state.strong && stream.eat(ch)) { // Add STRONG - state.strong = ch; - if (modeCfg.highlightFormatting) state.formatting = "strong"; - return getType(state); - } else if (state.em === ch) { // Remove EM - if (modeCfg.highlightFormatting) state.formatting = "em"; - var t = getType(state); - state.em = false; - return t; - } else if (!state.em) { // Add EM - state.em = ch; - if (modeCfg.highlightFormatting) state.formatting = "em"; - return getType(state); - } - } else if (ch === ' ') { - if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces - if (stream.peek() === ' ') { // Surrounded by spaces, ignore - return getType(state); - } else { // Not surrounded by spaces, back up pointer - stream.backUp(1); + + // Inline + function getType(state) { + var styles = []; + + if (state.formatting) { + styles.push(formatting); + + if (typeof state.formatting === "string") state.formatting = [state.formatting]; + + for (var i = 0; i < state.formatting.length; i++) { + styles.push(formatting + "-" + state.formatting[i]); + + if (state.formatting[i] === "header") { + styles.push(formatting + "-" + state.formatting[i] + "-" + state.header); + } + + // Add `formatting-quote` and `formatting-quote-#` for blockquotes + // Add `error` instead if the maximum blockquote nesting depth is passed + if (state.formatting[i] === "quote") { + if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) { + styles.push(formatting + "-" + state.formatting[i] + "-" + state.quote); + } else { + styles.push("error"); + } + } + } + } + + if (state.taskOpen) { + styles.push("meta"); + return styles.length ? styles.join(' ') : null; + } + if (state.taskClosed) { + styles.push("property"); + return styles.length ? styles.join(' ') : null; + } + + if (state.linkHref) { + styles.push(linkhref); + return styles.length ? styles.join(' ') : null; + } + + if (state.strong) { + styles.push(strong); + } + if (state.em) { + styles.push(em); + } + if (state.strikethrough) { + styles.push(strikethrough); + } + + if (state.linkText) { + styles.push(linktext); + } + + if (state.code) { + styles.push(code); + } + + if (state.header) { + styles.push(header); + styles.push(header + "-" + state.header); + } + + if (state.quote) { + styles.push(quote); + + // Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth + if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) { + styles.push(quote + "-" + state.quote); + } else { + styles.push(quote + "-" + modeCfg.maxBlockquoteDepth); + } + } + + if (state.list !== false) { + var listMod = (state.listDepth - 1) % 3; + if (!listMod) { + styles.push(list1); + } else if (listMod === 1) { + styles.push(list2); + } else { + styles.push(list3); + } + } + + if (state.trailingSpaceNewLine) { + styles.push("trailing-space-new-line"); + } else if (state.trailingSpace) { + styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b")); + } + + return styles.length ? styles.join(' ') : null; } - } - } - - if (modeCfg.strikethrough) { - if (ch === '~' && stream.eatWhile(ch)) { - if (state.strikethrough) {// Remove strikethrough - if (modeCfg.highlightFormatting) state.formatting = "strikethrough"; - var t = getType(state); - state.strikethrough = false; - return t; - } else if (stream.match(/^[^\s]/, false)) {// Add strikethrough - state.strikethrough = true; - if (modeCfg.highlightFormatting) state.formatting = "strikethrough"; - return getType(state); + + function handleText(stream, state) { + if (stream.match(textRE, true)) { + return getType(state); + } + return undefined; } - } else if (ch === ' ') { - if (stream.match(/^~~/, true)) { // Probably surrounded by space - if (stream.peek() === ' ') { // Surrounded by spaces, ignore + + function inlineNormal(stream, state) { + var style = state.text(stream, state); + if (typeof style !== 'undefined') + return style; + + if (state.list) { // List marker (*, +, -, 1., etc) + state.list = null; + return getType(state); + } + + if (state.taskList) { + var taskOpen = stream.match(taskListRE, true)[1] !== "x"; + if (taskOpen) state.taskOpen = true; + else state.taskClosed = true; + if (modeCfg.highlightFormatting) state.formatting = "task"; + state.taskList = false; + return getType(state); + } + + state.taskOpen = false; + state.taskClosed = false; + + if (state.header && stream.match(/^#+$/, true)) { + if (modeCfg.highlightFormatting) state.formatting = "header"; + return getType(state); + } + + // Get sol() value now, before character is consumed + var sol = stream.sol(); + + var ch = stream.next(); + + if (ch === '\\') { + stream.next(); + if (modeCfg.highlightFormatting) { + var type = getType(state); + return type ? type + " formatting-escape" : "formatting-escape"; + } + } + + // Matches link titles present on next line + if (state.linkTitle) { + state.linkTitle = false; + var matchCh = ch; + if (ch === '(') { + matchCh = ')'; + } + matchCh = (matchCh + '').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); + var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh; + if (stream.match(new RegExp(regex), true)) { + return linkhref; + } + } + + // If this block is changed, it may need to be updated in GFM mode + if (ch === '`') { + var previousFormatting = state.formatting; + if (modeCfg.highlightFormatting) state.formatting = "code"; + var t = getType(state); + var before = stream.pos; + stream.eatWhile('`'); + var difference = 1 + stream.pos - before; + if (!state.code) { + codeDepth = difference; + state.code = true; + return getType(state); + } else { + if (difference === codeDepth) { // Must be exact + state.code = false; + return t; + } + state.formatting = previousFormatting; + return getType(state); + } + } else if (state.code) { + return getType(state); + } + + if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) { + stream.match(/\[[^\]]*\]/); + state.inline = state.f = linkHref; + return image; + } + + if (ch === '[' && stream.match(/.*\](\(.*\)| ?\[.*\])/, false)) { + state.linkText = true; + if (modeCfg.highlightFormatting) state.formatting = "link"; + return getType(state); + } + + if (ch === ']' && state.linkText && stream.match(/\(.*\)| ?\[.*\]/, false)) { + if (modeCfg.highlightFormatting) state.formatting = "link"; + var type = getType(state); + state.linkText = false; + state.inline = state.f = linkHref; + return type; + } + + if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) { + state.f = state.inline = linkInline; + if (modeCfg.highlightFormatting) state.formatting = "link"; + var type = getType(state); + if (type) { + type += " "; + } else { + type = ""; + } + return type + linkinline; + } + + if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) { + state.f = state.inline = linkInline; + if (modeCfg.highlightFormatting) state.formatting = "link"; + var type = getType(state); + if (type) { + type += " "; + } else { + type = ""; + } + return type + linkemail; + } + + if (ch === '<' && stream.match(/^\w/, false)) { + if (stream.string.indexOf(">") != -1) { + var atts = stream.string.substring(1, stream.string.indexOf(">")); + if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) { + state.md_inside = true; + } + } + stream.backUp(1); + state.htmlState = CodeMirror.startState(htmlMode); + return switchBlock(stream, state, htmlBlock); + } + + if (ch === '<' && stream.match(/^\/\w*?>/)) { + state.md_inside = false; + return "tag"; + } + + var ignoreUnderscore = false; + if (!modeCfg.underscoresBreakWords) { + if (ch === '_' && stream.peek() !== '_' && stream.match(/(\w)/, false)) { + var prevPos = stream.pos - 2; + if (prevPos >= 0) { + var prevCh = stream.string.charAt(prevPos); + if (prevCh !== '_' && prevCh.match(/(\w)/, false)) { + ignoreUnderscore = true; + } + } + } + } + if (ch === '*' || (ch === '_' && !ignoreUnderscore)) { + if (sol && stream.peek() === ' ') { + // Do nothing, surrounded by newline and space + } else if (state.strong === ch && stream.eat(ch)) { // Remove STRONG + if (modeCfg.highlightFormatting) state.formatting = "strong"; + var t = getType(state); + state.strong = false; + return t; + } else if (!state.strong && stream.eat(ch)) { // Add STRONG + state.strong = ch; + if (modeCfg.highlightFormatting) state.formatting = "strong"; + return getType(state); + } else if (state.em === ch) { // Remove EM + if (modeCfg.highlightFormatting) state.formatting = "em"; + var t = getType(state); + state.em = false; + return t; + } else if (!state.em) { // Add EM + state.em = ch; + if (modeCfg.highlightFormatting) state.formatting = "em"; + return getType(state); + } + } else if (ch === ' ') { + if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces + if (stream.peek() === ' ') { // Surrounded by spaces, ignore + return getType(state); + } else { // Not surrounded by spaces, back up pointer + stream.backUp(1); + } + } + } + + if (modeCfg.strikethrough) { + if (ch === '~' && stream.eatWhile(ch)) { + if (state.strikethrough) {// Remove strikethrough + if (modeCfg.highlightFormatting) state.formatting = "strikethrough"; + var t = getType(state); + state.strikethrough = false; + return t; + } else if (stream.match(/^[^\s]/, false)) {// Add strikethrough + state.strikethrough = true; + if (modeCfg.highlightFormatting) state.formatting = "strikethrough"; + return getType(state); + } + } else if (ch === ' ') { + if (stream.match(/^~~/, true)) { // Probably surrounded by space + if (stream.peek() === ' ') { // Surrounded by spaces, ignore + return getType(state); + } else { // Not surrounded by spaces, back up pointer + stream.backUp(2); + } + } + } + } + + if (ch === ' ') { + if (stream.match(/ +$/, false)) { + state.trailingSpace++; + } else if (state.trailingSpace) { + state.trailingSpaceNewLine = true; + } + } + return getType(state); - } else { // Not surrounded by spaces, back up pointer - stream.backUp(2); - } } - } - } - - if (ch === ' ') { - if (stream.match(/ +$/, false)) { - state.trailingSpace++; - } else if (state.trailingSpace) { - state.trailingSpaceNewLine = true; - } - } - - return getType(state); - } - - function linkInline(stream, state) { - var ch = stream.next(); - - if (ch === ">") { - state.f = state.inline = inlineNormal; - if (modeCfg.highlightFormatting) state.formatting = "link"; - var type = getType(state); - if (type){ - type += " "; - } else { - type = ""; - } - return type + linkinline; - } - - stream.match(/^[^>]+/, true); - - return linkinline; - } - - function linkHref(stream, state) { - // Check if space, and return NULL if so (to avoid marking the space) - if(stream.eatSpace()){ - return null; - } - var ch = stream.next(); - if (ch === '(' || ch === '[') { - state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]"); - if (modeCfg.highlightFormatting) state.formatting = "link-string"; - state.linkHref = true; - return getType(state); - } - return 'error'; - } - - function getLinkHrefInside(endChar) { - return function(stream, state) { - var ch = stream.next(); - - if (ch === endChar) { - state.f = state.inline = inlineNormal; - if (modeCfg.highlightFormatting) state.formatting = "link-string"; - var returnState = getType(state); - state.linkHref = false; - return returnState; - } - - if (stream.match(inlineRE(endChar), true)) { - stream.backUp(1); - } - - state.linkHref = true; - return getType(state); - }; - } - - function footnoteLink(stream, state) { - if (stream.match(/^[^\]]*\]:/, false)) { - state.f = footnoteLinkInside; - stream.next(); // Consume [ - if (modeCfg.highlightFormatting) state.formatting = "link"; - state.linkText = true; - return getType(state); - } - return switchInline(stream, state, inlineNormal); - } - - function footnoteLinkInside(stream, state) { - if (stream.match(/^\]:/, true)) { - state.f = state.inline = footnoteUrl; - if (modeCfg.highlightFormatting) state.formatting = "link"; - var returnType = getType(state); - state.linkText = false; - return returnType; - } - - stream.match(/^[^\]]+/, true); - - return linktext; - } - - function footnoteUrl(stream, state) { - // Check if space, and return NULL if so (to avoid marking the space) - if(stream.eatSpace()){ - return null; - } - // Match URL - stream.match(/^[^\s]+/, true); - // Check for link title - if (stream.peek() === undefined) { // End of line, set flag to check next line - state.linkTitle = true; - } else { // More content on line, check if link title - stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true); - } - state.f = state.inline = inlineNormal; - return linkhref; - } - - var savedInlineRE = []; - function inlineRE(endChar) { - if (!savedInlineRE[endChar]) { - // Escape endChar for RegExp (taken from http://stackoverflow.com/a/494122/526741) - endChar = (endChar+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); - // Match any non-endChar, escaped character, as well as the closing - // endChar. - savedInlineRE[endChar] = new RegExp('^(?:[^\\\\]|\\\\.)*?(' + endChar + ')'); - } - return savedInlineRE[endChar]; - } - - var mode = { - startState: function() { - return { - f: blockNormal, - - prevLineHasContent: false, - thisLineHasContent: false, - - block: blockNormal, - htmlState: null, - indentation: 0, - - inline: inlineNormal, - text: handleText, - - formatting: false, - linkText: false, - linkHref: false, - linkTitle: false, - em: false, - strong: false, - header: 0, - taskList: false, - list: false, - listDepth: 0, - quote: 0, - trailingSpace: 0, - trailingSpaceNewLine: false, - strikethrough: false - }; - }, - - copyState: function(s) { - return { - f: s.f, - - prevLineHasContent: s.prevLineHasContent, - thisLineHasContent: s.thisLineHasContent, - - block: s.block, - htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState), - indentation: s.indentation, - - localMode: s.localMode, - localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null, - - inline: s.inline, - text: s.text, - formatting: false, - linkTitle: s.linkTitle, - em: s.em, - strong: s.strong, - strikethrough: s.strikethrough, - header: s.header, - taskList: s.taskList, - list: s.list, - listDepth: s.listDepth, - quote: s.quote, - trailingSpace: s.trailingSpace, - trailingSpaceNewLine: s.trailingSpaceNewLine, - md_inside: s.md_inside - }; - }, - - token: function(stream, state) { - - // Reset state.formatting - state.formatting = false; - - if (stream.sol()) { - var forceBlankLine = !!state.header; - - // Reset state.header - state.header = 0; - - if (stream.match(/^\s*$/, true) || forceBlankLine) { - state.prevLineHasContent = false; - blankLine(state); - return forceBlankLine ? this.token(stream, state) : null; - } else { - state.prevLineHasContent = state.thisLineHasContent; - state.thisLineHasContent = true; + + function linkInline(stream, state) { + var ch = stream.next(); + + if (ch === ">") { + state.f = state.inline = inlineNormal; + if (modeCfg.highlightFormatting) state.formatting = "link"; + var type = getType(state); + if (type) { + type += " "; + } else { + type = ""; + } + return type + linkinline; + } + + stream.match(/^[^>]+/, true); + + return linkinline; } - // Reset state.taskList - state.taskList = false; + function linkHref(stream, state) { + // Check if space, and return NULL if so (to avoid marking the space) + if (stream.eatSpace()) { + return null; + } + var ch = stream.next(); + if (ch === '(' || ch === '[') { + state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]"); + if (modeCfg.highlightFormatting) state.formatting = "link-string"; + state.linkHref = true; + return getType(state); + } + return 'error'; + } - // Reset state.code - state.code = false; + function getLinkHrefInside(endChar) { + return function (stream, state) { + var ch = stream.next(); + + if (ch === endChar) { + state.f = state.inline = inlineNormal; + if (modeCfg.highlightFormatting) state.formatting = "link-string"; + var returnState = getType(state); + state.linkHref = false; + return returnState; + } + + if (stream.match(inlineRE(endChar), true)) { + stream.backUp(1); + } + + state.linkHref = true; + return getType(state); + }; + } - // Reset state.trailingSpace - state.trailingSpace = 0; - state.trailingSpaceNewLine = false; + function footnoteLink(stream, state) { + if (stream.match(/^[^\]]*\]:/, false)) { + state.f = footnoteLinkInside; + stream.next(); // Consume [ + if (modeCfg.highlightFormatting) state.formatting = "link"; + state.linkText = true; + return getType(state); + } + return switchInline(stream, state, inlineNormal); + } - state.f = state.block; - var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, ' ').length; - var difference = Math.floor((indentation - state.indentation) / 4) * 4; - if (difference > 4) difference = 4; - var adjustedIndentation = state.indentation + difference; - state.indentationDiff = adjustedIndentation - state.indentation; - state.indentation = adjustedIndentation; - if (indentation > 0) return null; - } - return state.f(stream, state); - }, + function footnoteLinkInside(stream, state) { + if (stream.match(/^\]:/, true)) { + state.f = state.inline = footnoteUrl; + if (modeCfg.highlightFormatting) state.formatting = "link"; + var returnType = getType(state); + state.linkText = false; + return returnType; + } - innerMode: function(state) { - if (state.block == htmlBlock) return {state: state.htmlState, mode: htmlMode}; - if (state.localState) return {state: state.localState, mode: state.localMode}; - return {state: state, mode: mode}; - }, + stream.match(/^[^\]]+/, true); - blankLine: blankLine, + return linktext; + } - getType: getType, + function footnoteUrl(stream, state) { + // Check if space, and return NULL if so (to avoid marking the space) + if (stream.eatSpace()) { + return null; + } + // Match URL + stream.match(/^[^\s]+/, true); + // Check for link title + if (stream.peek() === undefined) { // End of line, set flag to check next line + state.linkTitle = true; + } else { // More content on line, check if link title + stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true); + } + state.f = state.inline = inlineNormal; + return linkhref; + } - fold: "markdown" - }; - return mode; -}, "xml"); + var savedInlineRE = []; + + function inlineRE(endChar) { + if (!savedInlineRE[endChar]) { + // Escape endChar for RegExp (taken from http://stackoverflow.com/a/494122/526741) + endChar = (endChar + '').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); + // Match any non-endChar, escaped character, as well as the closing + // endChar. + savedInlineRE[endChar] = new RegExp('^(?:[^\\\\]|\\\\.)*?(' + endChar + ')'); + } + return savedInlineRE[endChar]; + } -CodeMirror.defineMIME("text/x-markdown", "markdown"); + var mode = { + startState: function () { + return { + f: blockNormal, + + prevLineHasContent: false, + thisLineHasContent: false, + + block: blockNormal, + htmlState: null, + indentation: 0, + + inline: inlineNormal, + text: handleText, + + formatting: false, + linkText: false, + linkHref: false, + linkTitle: false, + em: false, + strong: false, + header: 0, + taskList: false, + list: false, + listDepth: 0, + quote: 0, + trailingSpace: 0, + trailingSpaceNewLine: false, + strikethrough: false + }; + }, + + copyState: function (s) { + return { + f: s.f, + + prevLineHasContent: s.prevLineHasContent, + thisLineHasContent: s.thisLineHasContent, + + block: s.block, + htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState), + indentation: s.indentation, + + localMode: s.localMode, + localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null, + + inline: s.inline, + text: s.text, + formatting: false, + linkTitle: s.linkTitle, + em: s.em, + strong: s.strong, + strikethrough: s.strikethrough, + header: s.header, + taskList: s.taskList, + list: s.list, + listDepth: s.listDepth, + quote: s.quote, + trailingSpace: s.trailingSpace, + trailingSpaceNewLine: s.trailingSpaceNewLine, + md_inside: s.md_inside + }; + }, + + token: function (stream, state) { + + // Reset state.formatting + state.formatting = false; + + if (stream.sol()) { + var forceBlankLine = !!state.header; + + // Reset state.header + state.header = 0; + + if (stream.match(/^\s*$/, true) || forceBlankLine) { + state.prevLineHasContent = false; + blankLine(state); + return forceBlankLine ? this.token(stream, state) : null; + } else { + state.prevLineHasContent = state.thisLineHasContent; + state.thisLineHasContent = true; + } + + // Reset state.taskList + state.taskList = false; + + // Reset state.code + state.code = false; + + // Reset state.trailingSpace + state.trailingSpace = 0; + state.trailingSpaceNewLine = false; + + state.f = state.block; + var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, ' ').length; + var difference = Math.floor((indentation - state.indentation) / 4) * 4; + if (difference > 4) difference = 4; + var adjustedIndentation = state.indentation + difference; + state.indentationDiff = adjustedIndentation - state.indentation; + state.indentation = adjustedIndentation; + if (indentation > 0) return null; + } + return state.f(stream, state); + }, + + innerMode: function (state) { + if (state.block == htmlBlock) return {state: state.htmlState, mode: htmlMode}; + if (state.localState) return {state: state.localState, mode: state.localMode}; + return {state: state, mode: mode}; + }, + + blankLine: blankLine, + + getType: getType, + + fold: "markdown" + }; + return mode; + }, "xml"); + + CodeMirror.defineMIME("text/x-markdown", "markdown"); }); diff --git a/web/editor.md/lib/codemirror/mode/markdown/test.js b/web/editor.md/lib/codemirror/mode/markdown/test.js index 96ca1ae..82930a1 100644 --- a/web/editor.md/lib/codemirror/mode/markdown/test.js +++ b/web/editor.md/lib/codemirror/mode/markdown/test.js @@ -1,754 +1,761 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function() { - var mode = CodeMirror.getMode({tabSize: 4}, "markdown"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - var modeHighlightFormatting = CodeMirror.getMode({tabSize: 4}, {name: "markdown", highlightFormatting: true}); - function FT(name) { test.mode(name, modeHighlightFormatting, Array.prototype.slice.call(arguments, 1)); } +(function () { + var mode = CodeMirror.getMode({tabSize: 4}, "markdown"); - FT("formatting_emAsterisk", - "[em&formatting&formatting-em *][em foo][em&formatting&formatting-em *]"); + function MT(name) { + test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); + } - FT("formatting_emUnderscore", - "[em&formatting&formatting-em _][em foo][em&formatting&formatting-em _]"); - - FT("formatting_strongAsterisk", - "[strong&formatting&formatting-strong **][strong foo][strong&formatting&formatting-strong **]"); + var modeHighlightFormatting = CodeMirror.getMode({tabSize: 4}, {name: "markdown", highlightFormatting: true}); - FT("formatting_strongUnderscore", - "[strong&formatting&formatting-strong __][strong foo][strong&formatting&formatting-strong __]"); - - FT("formatting_codeBackticks", - "[comment&formatting&formatting-code `][comment foo][comment&formatting&formatting-code `]"); - - FT("formatting_doubleBackticks", - "[comment&formatting&formatting-code ``][comment foo ` bar][comment&formatting&formatting-code ``]"); - - FT("formatting_atxHeader", - "[header&header-1&formatting&formatting-header&formatting-header-1 #][header&header-1 foo # bar ][header&header-1&formatting&formatting-header&formatting-header-1 #]"); - - FT("formatting_setextHeader", - "foo", - "[header&header-1&formatting&formatting-header&formatting-header-1 =]"); - - FT("formatting_blockquote", - "[quote"e-1&formatting&formatting-quote&formatting-quote-1 > ][quote"e-1 foo]"); - - FT("formatting_list", - "[variable-2&formatting&formatting-list&formatting-list-ul - ][variable-2 foo]"); - FT("formatting_list", - "[variable-2&formatting&formatting-list&formatting-list-ol 1. ][variable-2 foo]"); - - FT("formatting_link", - "[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string (][string http://example.com/][string&formatting&formatting-link-string )]"); - - FT("formatting_linkReference", - "[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string [][string bar][string&formatting&formatting-link-string ]]]", - "[link&formatting&formatting-link [][link bar][link&formatting&formatting-link ]]:] [string http://example.com/]"); - - FT("formatting_linkWeb", - "[link&formatting&formatting-link <][link http://example.com/][link&formatting&formatting-link >]"); - - FT("formatting_linkEmail", - "[link&formatting&formatting-link <][link user@example.com][link&formatting&formatting-link >]"); - - FT("formatting_escape", - "[formatting-escape \\*]"); - - MT("plainText", - "foo"); - - // Don't style single trailing space - MT("trailingSpace1", - "foo "); + function FT(name) { + test.mode(name, modeHighlightFormatting, Array.prototype.slice.call(arguments, 1)); + } - // Two or more trailing spaces should be styled with line break character - MT("trailingSpace2", - "foo[trailing-space-a ][trailing-space-new-line ]"); + FT("formatting_emAsterisk", + "[em&formatting&formatting-em *][em foo][em&formatting&formatting-em *]"); - MT("trailingSpace3", - "foo[trailing-space-a ][trailing-space-b ][trailing-space-new-line ]"); - - MT("trailingSpace4", - "foo[trailing-space-a ][trailing-space-b ][trailing-space-a ][trailing-space-new-line ]"); - - // Code blocks using 4 spaces (regardless of CodeMirror.tabSize value) - MT("codeBlocksUsing4Spaces", - " [comment foo]"); - - // Code blocks using 4 spaces with internal indentation - MT("codeBlocksUsing4SpacesIndentation", - " [comment bar]", - " [comment hello]", - " [comment world]", - " [comment foo]", - "bar"); - - // Code blocks using 4 spaces with internal indentation - MT("codeBlocksUsing4SpacesIndentation", - " foo", - " [comment bar]", - " [comment hello]", - " [comment world]"); - - // Code blocks should end even after extra indented lines - MT("codeBlocksWithTrailingIndentedLine", - " [comment foo]", - " [comment bar]", - " [comment baz]", - " ", - "hello"); - - // Code blocks using 1 tab (regardless of CodeMirror.indentWithTabs value) - MT("codeBlocksUsing1Tab", - "\t[comment foo]"); - - // Inline code using backticks - MT("inlineCodeUsingBackticks", - "foo [comment `bar`]"); - - // Block code using single backtick (shouldn't work) - MT("blockCodeSingleBacktick", - "[comment `]", - "foo", - "[comment `]"); - - // Unclosed backticks - // Instead of simply marking as CODE, it would be nice to have an - // incomplete flag for CODE, that is styled slightly different. - MT("unclosedBackticks", - "foo [comment `bar]"); - - // Per documentation: "To include a literal backtick character within a - // code span, you can use multiple backticks as the opening and closing - // delimiters" - MT("doubleBackticks", - "[comment ``foo ` bar``]"); - - // Tests based on Dingus - // http://daringfireball.net/projects/markdown/dingus - // - // Multiple backticks within an inline code block - MT("consecutiveBackticks", - "[comment `foo```bar`]"); - - // Multiple backticks within an inline code block with a second code block - MT("consecutiveBackticks", - "[comment `foo```bar`] hello [comment `world`]"); - - // Unclosed with several different groups of backticks - MT("unclosedBackticks", - "[comment ``foo ``` bar` hello]"); - - // Closed with several different groups of backticks - MT("closedBackticks", - "[comment ``foo ``` bar` hello``] world"); - - // atx headers - // http://daringfireball.net/projects/markdown/syntax#header - - MT("atxH1", - "[header&header-1 # foo]"); - - MT("atxH2", - "[header&header-2 ## foo]"); - - MT("atxH3", - "[header&header-3 ### foo]"); - - MT("atxH4", - "[header&header-4 #### foo]"); - - MT("atxH5", - "[header&header-5 ##### foo]"); - - MT("atxH6", - "[header&header-6 ###### foo]"); - - // H6 - 7x '#' should still be H6, per Dingus - // http://daringfireball.net/projects/markdown/dingus - MT("atxH6NotH7", - "[header&header-6 ####### foo]"); - - // Inline styles should be parsed inside headers - MT("atxH1inline", - "[header&header-1 # foo ][header&header-1&em *bar*]"); - - // Setext headers - H1, H2 - // Per documentation, "Any number of underlining =’s or -’s will work." - // http://daringfireball.net/projects/markdown/syntax#header - // Ideally, the text would be marked as `header` as well, but this is - // not really feasible at the moment. So, instead, we're testing against - // what works today, to avoid any regressions. - // - // Check if single underlining = works - MT("setextH1", - "foo", - "[header&header-1 =]"); - - // Check if 3+ ='s work - MT("setextH1", - "foo", - "[header&header-1 ===]"); - - // Check if single underlining - works - MT("setextH2", - "foo", - "[header&header-2 -]"); - - // Check if 3+ -'s work - MT("setextH2", - "foo", - "[header&header-2 ---]"); - - // Single-line blockquote with trailing space - MT("blockquoteSpace", - "[quote"e-1 > foo]"); - - // Single-line blockquote - MT("blockquoteNoSpace", - "[quote"e-1 >foo]"); - - // No blank line before blockquote - MT("blockquoteNoBlankLine", - "foo", - "[quote"e-1 > bar]"); - - // Nested blockquote - MT("blockquoteSpace", - "[quote"e-1 > foo]", - "[quote"e-1 >][quote"e-2 > foo]", - "[quote"e-1 >][quote"e-2 >][quote"e-3 > foo]"); - - // Single-line blockquote followed by normal paragraph - MT("blockquoteThenParagraph", - "[quote"e-1 >foo]", - "", - "bar"); - - // Multi-line blockquote (lazy mode) - MT("multiBlockquoteLazy", - "[quote"e-1 >foo]", - "[quote"e-1 bar]"); - - // Multi-line blockquote followed by normal paragraph (lazy mode) - MT("multiBlockquoteLazyThenParagraph", - "[quote"e-1 >foo]", - "[quote"e-1 bar]", - "", - "hello"); - - // Multi-line blockquote (non-lazy mode) - MT("multiBlockquote", - "[quote"e-1 >foo]", - "[quote"e-1 >bar]"); - - // Multi-line blockquote followed by normal paragraph (non-lazy mode) - MT("multiBlockquoteThenParagraph", - "[quote"e-1 >foo]", - "[quote"e-1 >bar]", - "", - "hello"); - - // Check list types - - MT("listAsterisk", - "foo", - "bar", - "", - "[variable-2 * foo]", - "[variable-2 * bar]"); - - MT("listPlus", - "foo", - "bar", - "", - "[variable-2 + foo]", - "[variable-2 + bar]"); - - MT("listDash", - "foo", - "bar", - "", - "[variable-2 - foo]", - "[variable-2 - bar]"); - - MT("listNumber", - "foo", - "bar", - "", - "[variable-2 1. foo]", - "[variable-2 2. bar]"); - - // Lists require a preceding blank line (per Dingus) - MT("listBogus", - "foo", - "1. bar", - "2. hello"); - - // List after header - MT("listAfterHeader", - "[header&header-1 # foo]", - "[variable-2 - bar]"); - - // Formatting in lists (*) - MT("listAsteriskFormatting", - "[variable-2 * ][variable-2&em *foo*][variable-2 bar]", - "[variable-2 * ][variable-2&strong **foo**][variable-2 bar]", - "[variable-2 * ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]", - "[variable-2 * ][variable-2&comment `foo`][variable-2 bar]"); - - // Formatting in lists (+) - MT("listPlusFormatting", - "[variable-2 + ][variable-2&em *foo*][variable-2 bar]", - "[variable-2 + ][variable-2&strong **foo**][variable-2 bar]", - "[variable-2 + ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]", - "[variable-2 + ][variable-2&comment `foo`][variable-2 bar]"); - - // Formatting in lists (-) - MT("listDashFormatting", - "[variable-2 - ][variable-2&em *foo*][variable-2 bar]", - "[variable-2 - ][variable-2&strong **foo**][variable-2 bar]", - "[variable-2 - ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]", - "[variable-2 - ][variable-2&comment `foo`][variable-2 bar]"); - - // Formatting in lists (1.) - MT("listNumberFormatting", - "[variable-2 1. ][variable-2&em *foo*][variable-2 bar]", - "[variable-2 2. ][variable-2&strong **foo**][variable-2 bar]", - "[variable-2 3. ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]", - "[variable-2 4. ][variable-2&comment `foo`][variable-2 bar]"); - - // Paragraph lists - MT("listParagraph", - "[variable-2 * foo]", - "", - "[variable-2 * bar]"); - - // Multi-paragraph lists - // - // 4 spaces - MT("listMultiParagraph", - "[variable-2 * foo]", - "", - "[variable-2 * bar]", - "", - " [variable-2 hello]"); - - // 4 spaces, extra blank lines (should still be list, per Dingus) - MT("listMultiParagraphExtra", - "[variable-2 * foo]", - "", - "[variable-2 * bar]", - "", - "", - " [variable-2 hello]"); - - // 4 spaces, plus 1 space (should still be list, per Dingus) - MT("listMultiParagraphExtraSpace", - "[variable-2 * foo]", - "", - "[variable-2 * bar]", - "", - " [variable-2 hello]", - "", - " [variable-2 world]"); - - // 1 tab - MT("listTab", - "[variable-2 * foo]", - "", - "[variable-2 * bar]", - "", - "\t[variable-2 hello]"); - - // No indent - MT("listNoIndent", - "[variable-2 * foo]", - "", - "[variable-2 * bar]", - "", - "hello"); - - // Blockquote - MT("blockquote", - "[variable-2 * foo]", - "", - "[variable-2 * bar]", - "", - " [variable-2"e"e-1 > hello]"); - - // Code block - MT("blockquoteCode", - "[variable-2 * foo]", - "", - "[variable-2 * bar]", - "", - " [comment > hello]", - "", - " [variable-2 world]"); - - // Code block followed by text - MT("blockquoteCodeText", - "[variable-2 * foo]", - "", - " [variable-2 bar]", - "", - " [comment hello]", - "", - " [variable-2 world]"); - - // Nested list - - MT("listAsteriskNested", - "[variable-2 * foo]", - "", - " [variable-3 * bar]"); - - MT("listPlusNested", - "[variable-2 + foo]", - "", - " [variable-3 + bar]"); - - MT("listDashNested", - "[variable-2 - foo]", - "", - " [variable-3 - bar]"); - - MT("listNumberNested", - "[variable-2 1. foo]", - "", - " [variable-3 2. bar]"); - - MT("listMixed", - "[variable-2 * foo]", - "", - " [variable-3 + bar]", - "", - " [keyword - hello]", - "", - " [variable-2 1. world]"); - - MT("listBlockquote", - "[variable-2 * foo]", - "", - " [variable-3 + bar]", - "", - " [quote"e-1&variable-3 > hello]"); - - MT("listCode", - "[variable-2 * foo]", - "", - " [variable-3 + bar]", - "", - " [comment hello]"); - - // Code with internal indentation - MT("listCodeIndentation", - "[variable-2 * foo]", - "", - " [comment bar]", - " [comment hello]", - " [comment world]", - " [comment foo]", - " [variable-2 bar]"); - - // List nesting edge cases - MT("listNested", - "[variable-2 * foo]", - "", - " [variable-3 * bar]", - "", - " [variable-2 hello]" - ); - MT("listNested", - "[variable-2 * foo]", - "", - " [variable-3 * bar]", - "", - " [variable-3 * foo]" - ); - - // Code followed by text - MT("listCodeText", - "[variable-2 * foo]", - "", - " [comment bar]", - "", - "hello"); - - // Following tests directly from official Markdown documentation - // http://daringfireball.net/projects/markdown/syntax#hr - - MT("hrSpace", - "[hr * * *]"); - - MT("hr", - "[hr ***]"); - - MT("hrLong", - "[hr *****]"); - - MT("hrSpaceDash", - "[hr - - -]"); - - MT("hrDashLong", - "[hr ---------------------------------------]"); - - // Inline link with title - MT("linkTitle", - "[link [[foo]]][string (http://example.com/ \"bar\")] hello"); - - // Inline link without title - MT("linkNoTitle", - "[link [[foo]]][string (http://example.com/)] bar"); - - // Inline link with image - MT("linkImage", - "[link [[][tag ![[foo]]][string (http://example.com/)][link ]]][string (http://example.com/)] bar"); - - // Inline link with Em - MT("linkEm", - "[link [[][link&em *foo*][link ]]][string (http://example.com/)] bar"); - - // Inline link with Strong - MT("linkStrong", - "[link [[][link&strong **foo**][link ]]][string (http://example.com/)] bar"); - - // Inline link with EmStrong - MT("linkEmStrong", - "[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string (http://example.com/)] bar"); - - // Image with title - MT("imageTitle", - "[tag ![[foo]]][string (http://example.com/ \"bar\")] hello"); - - // Image without title - MT("imageNoTitle", - "[tag ![[foo]]][string (http://example.com/)] bar"); - - // Image with asterisks - MT("imageAsterisks", - "[tag ![[*foo*]]][string (http://example.com/)] bar"); - - // Not a link. Should be normal text due to square brackets being used - // regularly in text, especially in quoted material, and no space is allowed - // between square brackets and parentheses (per Dingus). - MT("notALink", - "[[foo]] (bar)"); - - // Reference-style links - MT("linkReference", - "[link [[foo]]][string [[bar]]] hello"); + FT("formatting_emUnderscore", + "[em&formatting&formatting-em _][em foo][em&formatting&formatting-em _]"); - // Reference-style links with Em - MT("linkReferenceEm", - "[link [[][link&em *foo*][link ]]][string [[bar]]] hello"); + FT("formatting_strongAsterisk", + "[strong&formatting&formatting-strong **][strong foo][strong&formatting&formatting-strong **]"); - // Reference-style links with Strong - MT("linkReferenceStrong", - "[link [[][link&strong **foo**][link ]]][string [[bar]]] hello"); + FT("formatting_strongUnderscore", + "[strong&formatting&formatting-strong __][strong foo][strong&formatting&formatting-strong __]"); - // Reference-style links with EmStrong - MT("linkReferenceEmStrong", - "[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string [[bar]]] hello"); + FT("formatting_codeBackticks", + "[comment&formatting&formatting-code `][comment foo][comment&formatting&formatting-code `]"); - // Reference-style links with optional space separator (per docuentation) - // "You can optionally use a space to separate the sets of brackets" - MT("linkReferenceSpace", - "[link [[foo]]] [string [[bar]]] hello"); + FT("formatting_doubleBackticks", + "[comment&formatting&formatting-code ``][comment foo ` bar][comment&formatting&formatting-code ``]"); - // Should only allow a single space ("...use *a* space...") - MT("linkReferenceDoubleSpace", - "[[foo]] [[bar]] hello"); + FT("formatting_atxHeader", + "[header&header-1&formatting&formatting-header&formatting-header-1 #][header&header-1 foo # bar ][header&header-1&formatting&formatting-header&formatting-header-1 #]"); - // Reference-style links with implicit link name - MT("linkImplicit", - "[link [[foo]]][string [[]]] hello"); + FT("formatting_setextHeader", + "foo", + "[header&header-1&formatting&formatting-header&formatting-header-1 =]"); + + FT("formatting_blockquote", + "[quote"e-1&formatting&formatting-quote&formatting-quote-1 > ][quote"e-1 foo]"); + + FT("formatting_list", + "[variable-2&formatting&formatting-list&formatting-list-ul - ][variable-2 foo]"); + FT("formatting_list", + "[variable-2&formatting&formatting-list&formatting-list-ol 1. ][variable-2 foo]"); + + FT("formatting_link", + "[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string (][string http://example.com/][string&formatting&formatting-link-string )]"); + + FT("formatting_linkReference", + "[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string [][string bar][string&formatting&formatting-link-string ]]]", + "[link&formatting&formatting-link [][link bar][link&formatting&formatting-link ]]:] [string http://example.com/]"); + + FT("formatting_linkWeb", + "[link&formatting&formatting-link <][link http://example.com/][link&formatting&formatting-link >]"); + + FT("formatting_linkEmail", + "[link&formatting&formatting-link <][link user@example.com][link&formatting&formatting-link >]"); - // @todo It would be nice if, at some point, the document was actually - // checked to see if the referenced link exists + FT("formatting_escape", + "[formatting-escape \\*]"); - // Link label, for reference-style links (taken from documentation) + MT("plainText", + "foo"); - MT("labelNoTitle", - "[link [[foo]]:] [string http://example.com/]"); + // Don't style single trailing space + MT("trailingSpace1", + "foo "); - MT("labelIndented", - " [link [[foo]]:] [string http://example.com/]"); + // Two or more trailing spaces should be styled with line break character + MT("trailingSpace2", + "foo[trailing-space-a ][trailing-space-new-line ]"); - MT("labelSpaceTitle", - "[link [[foo bar]]:] [string http://example.com/ \"hello\"]"); + MT("trailingSpace3", + "foo[trailing-space-a ][trailing-space-b ][trailing-space-new-line ]"); - MT("labelDoubleTitle", - "[link [[foo bar]]:] [string http://example.com/ \"hello\"] \"world\""); + MT("trailingSpace4", + "foo[trailing-space-a ][trailing-space-b ][trailing-space-a ][trailing-space-new-line ]"); - MT("labelTitleDoubleQuotes", - "[link [[foo]]:] [string http://example.com/ \"bar\"]"); + // Code blocks using 4 spaces (regardless of CodeMirror.tabSize value) + MT("codeBlocksUsing4Spaces", + " [comment foo]"); - MT("labelTitleSingleQuotes", - "[link [[foo]]:] [string http://example.com/ 'bar']"); + // Code blocks using 4 spaces with internal indentation + MT("codeBlocksUsing4SpacesIndentation", + " [comment bar]", + " [comment hello]", + " [comment world]", + " [comment foo]", + "bar"); + + // Code blocks using 4 spaces with internal indentation + MT("codeBlocksUsing4SpacesIndentation", + " foo", + " [comment bar]", + " [comment hello]", + " [comment world]"); + + // Code blocks should end even after extra indented lines + MT("codeBlocksWithTrailingIndentedLine", + " [comment foo]", + " [comment bar]", + " [comment baz]", + " ", + "hello"); + + // Code blocks using 1 tab (regardless of CodeMirror.indentWithTabs value) + MT("codeBlocksUsing1Tab", + "\t[comment foo]"); + + // Inline code using backticks + MT("inlineCodeUsingBackticks", + "foo [comment `bar`]"); + + // Block code using single backtick (shouldn't work) + MT("blockCodeSingleBacktick", + "[comment `]", + "foo", + "[comment `]"); + + // Unclosed backticks + // Instead of simply marking as CODE, it would be nice to have an + // incomplete flag for CODE, that is styled slightly different. + MT("unclosedBackticks", + "foo [comment `bar]"); + + // Per documentation: "To include a literal backtick character within a + // code span, you can use multiple backticks as the opening and closing + // delimiters" + MT("doubleBackticks", + "[comment ``foo ` bar``]"); + + // Tests based on Dingus + // http://daringfireball.net/projects/markdown/dingus + // + // Multiple backticks within an inline code block + MT("consecutiveBackticks", + "[comment `foo```bar`]"); + + // Multiple backticks within an inline code block with a second code block + MT("consecutiveBackticks", + "[comment `foo```bar`] hello [comment `world`]"); + + // Unclosed with several different groups of backticks + MT("unclosedBackticks", + "[comment ``foo ``` bar` hello]"); + + // Closed with several different groups of backticks + MT("closedBackticks", + "[comment ``foo ``` bar` hello``] world"); + + // atx headers + // http://daringfireball.net/projects/markdown/syntax#header + + MT("atxH1", + "[header&header-1 # foo]"); + + MT("atxH2", + "[header&header-2 ## foo]"); + + MT("atxH3", + "[header&header-3 ### foo]"); + + MT("atxH4", + "[header&header-4 #### foo]"); + + MT("atxH5", + "[header&header-5 ##### foo]"); + + MT("atxH6", + "[header&header-6 ###### foo]"); + + // H6 - 7x '#' should still be H6, per Dingus + // http://daringfireball.net/projects/markdown/dingus + MT("atxH6NotH7", + "[header&header-6 ####### foo]"); + + // Inline styles should be parsed inside headers + MT("atxH1inline", + "[header&header-1 # foo ][header&header-1&em *bar*]"); + + // Setext headers - H1, H2 + // Per documentation, "Any number of underlining =’s or -’s will work." + // http://daringfireball.net/projects/markdown/syntax#header + // Ideally, the text would be marked as `header` as well, but this is + // not really feasible at the moment. So, instead, we're testing against + // what works today, to avoid any regressions. + // + // Check if single underlining = works + MT("setextH1", + "foo", + "[header&header-1 =]"); + + // Check if 3+ ='s work + MT("setextH1", + "foo", + "[header&header-1 ===]"); + + // Check if single underlining - works + MT("setextH2", + "foo", + "[header&header-2 -]"); + + // Check if 3+ -'s work + MT("setextH2", + "foo", + "[header&header-2 ---]"); + + // Single-line blockquote with trailing space + MT("blockquoteSpace", + "[quote"e-1 > foo]"); + + // Single-line blockquote + MT("blockquoteNoSpace", + "[quote"e-1 >foo]"); + + // No blank line before blockquote + MT("blockquoteNoBlankLine", + "foo", + "[quote"e-1 > bar]"); + + // Nested blockquote + MT("blockquoteSpace", + "[quote"e-1 > foo]", + "[quote"e-1 >][quote"e-2 > foo]", + "[quote"e-1 >][quote"e-2 >][quote"e-3 > foo]"); + + // Single-line blockquote followed by normal paragraph + MT("blockquoteThenParagraph", + "[quote"e-1 >foo]", + "", + "bar"); + + // Multi-line blockquote (lazy mode) + MT("multiBlockquoteLazy", + "[quote"e-1 >foo]", + "[quote"e-1 bar]"); + + // Multi-line blockquote followed by normal paragraph (lazy mode) + MT("multiBlockquoteLazyThenParagraph", + "[quote"e-1 >foo]", + "[quote"e-1 bar]", + "", + "hello"); + + // Multi-line blockquote (non-lazy mode) + MT("multiBlockquote", + "[quote"e-1 >foo]", + "[quote"e-1 >bar]"); + + // Multi-line blockquote followed by normal paragraph (non-lazy mode) + MT("multiBlockquoteThenParagraph", + "[quote"e-1 >foo]", + "[quote"e-1 >bar]", + "", + "hello"); + + // Check list types + + MT("listAsterisk", + "foo", + "bar", + "", + "[variable-2 * foo]", + "[variable-2 * bar]"); + + MT("listPlus", + "foo", + "bar", + "", + "[variable-2 + foo]", + "[variable-2 + bar]"); + + MT("listDash", + "foo", + "bar", + "", + "[variable-2 - foo]", + "[variable-2 - bar]"); + + MT("listNumber", + "foo", + "bar", + "", + "[variable-2 1. foo]", + "[variable-2 2. bar]"); + + // Lists require a preceding blank line (per Dingus) + MT("listBogus", + "foo", + "1. bar", + "2. hello"); + + // List after header + MT("listAfterHeader", + "[header&header-1 # foo]", + "[variable-2 - bar]"); + + // Formatting in lists (*) + MT("listAsteriskFormatting", + "[variable-2 * ][variable-2&em *foo*][variable-2 bar]", + "[variable-2 * ][variable-2&strong **foo**][variable-2 bar]", + "[variable-2 * ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]", + "[variable-2 * ][variable-2&comment `foo`][variable-2 bar]"); + + // Formatting in lists (+) + MT("listPlusFormatting", + "[variable-2 + ][variable-2&em *foo*][variable-2 bar]", + "[variable-2 + ][variable-2&strong **foo**][variable-2 bar]", + "[variable-2 + ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]", + "[variable-2 + ][variable-2&comment `foo`][variable-2 bar]"); + + // Formatting in lists (-) + MT("listDashFormatting", + "[variable-2 - ][variable-2&em *foo*][variable-2 bar]", + "[variable-2 - ][variable-2&strong **foo**][variable-2 bar]", + "[variable-2 - ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]", + "[variable-2 - ][variable-2&comment `foo`][variable-2 bar]"); + + // Formatting in lists (1.) + MT("listNumberFormatting", + "[variable-2 1. ][variable-2&em *foo*][variable-2 bar]", + "[variable-2 2. ][variable-2&strong **foo**][variable-2 bar]", + "[variable-2 3. ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]", + "[variable-2 4. ][variable-2&comment `foo`][variable-2 bar]"); + + // Paragraph lists + MT("listParagraph", + "[variable-2 * foo]", + "", + "[variable-2 * bar]"); + + // Multi-paragraph lists + // + // 4 spaces + MT("listMultiParagraph", + "[variable-2 * foo]", + "", + "[variable-2 * bar]", + "", + " [variable-2 hello]"); + + // 4 spaces, extra blank lines (should still be list, per Dingus) + MT("listMultiParagraphExtra", + "[variable-2 * foo]", + "", + "[variable-2 * bar]", + "", + "", + " [variable-2 hello]"); + + // 4 spaces, plus 1 space (should still be list, per Dingus) + MT("listMultiParagraphExtraSpace", + "[variable-2 * foo]", + "", + "[variable-2 * bar]", + "", + " [variable-2 hello]", + "", + " [variable-2 world]"); + + // 1 tab + MT("listTab", + "[variable-2 * foo]", + "", + "[variable-2 * bar]", + "", + "\t[variable-2 hello]"); + + // No indent + MT("listNoIndent", + "[variable-2 * foo]", + "", + "[variable-2 * bar]", + "", + "hello"); + + // Blockquote + MT("blockquote", + "[variable-2 * foo]", + "", + "[variable-2 * bar]", + "", + " [variable-2"e"e-1 > hello]"); + + // Code block + MT("blockquoteCode", + "[variable-2 * foo]", + "", + "[variable-2 * bar]", + "", + " [comment > hello]", + "", + " [variable-2 world]"); + + // Code block followed by text + MT("blockquoteCodeText", + "[variable-2 * foo]", + "", + " [variable-2 bar]", + "", + " [comment hello]", + "", + " [variable-2 world]"); + + // Nested list + + MT("listAsteriskNested", + "[variable-2 * foo]", + "", + " [variable-3 * bar]"); + + MT("listPlusNested", + "[variable-2 + foo]", + "", + " [variable-3 + bar]"); + + MT("listDashNested", + "[variable-2 - foo]", + "", + " [variable-3 - bar]"); + + MT("listNumberNested", + "[variable-2 1. foo]", + "", + " [variable-3 2. bar]"); + + MT("listMixed", + "[variable-2 * foo]", + "", + " [variable-3 + bar]", + "", + " [keyword - hello]", + "", + " [variable-2 1. world]"); + + MT("listBlockquote", + "[variable-2 * foo]", + "", + " [variable-3 + bar]", + "", + " [quote"e-1&variable-3 > hello]"); + + MT("listCode", + "[variable-2 * foo]", + "", + " [variable-3 + bar]", + "", + " [comment hello]"); + + // Code with internal indentation + MT("listCodeIndentation", + "[variable-2 * foo]", + "", + " [comment bar]", + " [comment hello]", + " [comment world]", + " [comment foo]", + " [variable-2 bar]"); + + // List nesting edge cases + MT("listNested", + "[variable-2 * foo]", + "", + " [variable-3 * bar]", + "", + " [variable-2 hello]" + ); + MT("listNested", + "[variable-2 * foo]", + "", + " [variable-3 * bar]", + "", + " [variable-3 * foo]" + ); + + // Code followed by text + MT("listCodeText", + "[variable-2 * foo]", + "", + " [comment bar]", + "", + "hello"); + + // Following tests directly from official Markdown documentation + // http://daringfireball.net/projects/markdown/syntax#hr + + MT("hrSpace", + "[hr * * *]"); + + MT("hr", + "[hr ***]"); + + MT("hrLong", + "[hr *****]"); + + MT("hrSpaceDash", + "[hr - - -]"); + + MT("hrDashLong", + "[hr ---------------------------------------]"); + + // Inline link with title + MT("linkTitle", + "[link [[foo]]][string (http://example.com/ \"bar\")] hello"); + + // Inline link without title + MT("linkNoTitle", + "[link [[foo]]][string (http://example.com/)] bar"); + + // Inline link with image + MT("linkImage", + "[link [[][tag ![[foo]]][string (http://example.com/)][link ]]][string (http://example.com/)] bar"); + + // Inline link with Em + MT("linkEm", + "[link [[][link&em *foo*][link ]]][string (http://example.com/)] bar"); + + // Inline link with Strong + MT("linkStrong", + "[link [[][link&strong **foo**][link ]]][string (http://example.com/)] bar"); + + // Inline link with EmStrong + MT("linkEmStrong", + "[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string (http://example.com/)] bar"); + + // Image with title + MT("imageTitle", + "[tag ![[foo]]][string (http://example.com/ \"bar\")] hello"); + + // Image without title + MT("imageNoTitle", + "[tag ![[foo]]][string (http://example.com/)] bar"); + + // Image with asterisks + MT("imageAsterisks", + "[tag ![[*foo*]]][string (http://example.com/)] bar"); + + // Not a link. Should be normal text due to square brackets being used + // regularly in text, especially in quoted material, and no space is allowed + // between square brackets and parentheses (per Dingus). + MT("notALink", + "[[foo]] (bar)"); + + // Reference-style links + MT("linkReference", + "[link [[foo]]][string [[bar]]] hello"); - MT("labelTitleParenthese", - "[link [[foo]]:] [string http://example.com/ (bar)]"); + // Reference-style links with Em + MT("linkReferenceEm", + "[link [[][link&em *foo*][link ]]][string [[bar]]] hello"); - MT("labelTitleInvalid", - "[link [[foo]]:] [string http://example.com/] bar"); + // Reference-style links with Strong + MT("linkReferenceStrong", + "[link [[][link&strong **foo**][link ]]][string [[bar]]] hello"); - MT("labelLinkAngleBrackets", - "[link [[foo]]:] [string \"bar\"]"); + // Reference-style links with EmStrong + MT("linkReferenceEmStrong", + "[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string [[bar]]] hello"); - MT("labelTitleNextDoubleQuotes", - "[link [[foo]]:] [string http://example.com/]", - "[string \"bar\"] hello"); + // Reference-style links with optional space separator (per docuentation) + // "You can optionally use a space to separate the sets of brackets" + MT("linkReferenceSpace", + "[link [[foo]]] [string [[bar]]] hello"); - MT("labelTitleNextSingleQuotes", - "[link [[foo]]:] [string http://example.com/]", - "[string 'bar'] hello"); + // Should only allow a single space ("...use *a* space...") + MT("linkReferenceDoubleSpace", + "[[foo]] [[bar]] hello"); - MT("labelTitleNextParenthese", - "[link [[foo]]:] [string http://example.com/]", - "[string (bar)] hello"); + // Reference-style links with implicit link name + MT("linkImplicit", + "[link [[foo]]][string [[]]] hello"); - MT("labelTitleNextMixed", - "[link [[foo]]:] [string http://example.com/]", - "(bar\" hello"); + // @todo It would be nice if, at some point, the document was actually + // checked to see if the referenced link exists - MT("linkWeb", - "[link ] foo"); + // Link label, for reference-style links (taken from documentation) - MT("linkWebDouble", - "[link ] foo [link ]"); + MT("labelNoTitle", + "[link [[foo]]:] [string http://example.com/]"); - MT("linkEmail", - "[link ] foo"); + MT("labelIndented", + " [link [[foo]]:] [string http://example.com/]"); - MT("linkEmailDouble", - "[link ] foo [link ]"); + MT("labelSpaceTitle", + "[link [[foo bar]]:] [string http://example.com/ \"hello\"]"); - MT("emAsterisk", - "[em *foo*] bar"); + MT("labelDoubleTitle", + "[link [[foo bar]]:] [string http://example.com/ \"hello\"] \"world\""); - MT("emUnderscore", - "[em _foo_] bar"); + MT("labelTitleDoubleQuotes", + "[link [[foo]]:] [string http://example.com/ \"bar\"]"); - MT("emInWordAsterisk", - "foo[em *bar*]hello"); + MT("labelTitleSingleQuotes", + "[link [[foo]]:] [string http://example.com/ 'bar']"); - MT("emInWordUnderscore", - "foo[em _bar_]hello"); + MT("labelTitleParenthese", + "[link [[foo]]:] [string http://example.com/ (bar)]"); - // Per documentation: "...surround an * or _ with spaces, it’ll be - // treated as a literal asterisk or underscore." + MT("labelTitleInvalid", + "[link [[foo]]:] [string http://example.com/] bar"); - MT("emEscapedBySpaceIn", - "foo [em _bar _ hello_] world"); + MT("labelLinkAngleBrackets", + "[link [[foo]]:] [string \"bar\"]"); - MT("emEscapedBySpaceOut", - "foo _ bar[em _hello_]world"); + MT("labelTitleNextDoubleQuotes", + "[link [[foo]]:] [string http://example.com/]", + "[string \"bar\"] hello"); - MT("emEscapedByNewline", - "foo", - "_ bar[em _hello_]world"); + MT("labelTitleNextSingleQuotes", + "[link [[foo]]:] [string http://example.com/]", + "[string 'bar'] hello"); - // Unclosed emphasis characters - // Instead of simply marking as EM / STRONG, it would be nice to have an - // incomplete flag for EM and STRONG, that is styled slightly different. - MT("emIncompleteAsterisk", - "foo [em *bar]"); + MT("labelTitleNextParenthese", + "[link [[foo]]:] [string http://example.com/]", + "[string (bar)] hello"); - MT("emIncompleteUnderscore", - "foo [em _bar]"); + MT("labelTitleNextMixed", + "[link [[foo]]:] [string http://example.com/]", + "(bar\" hello"); - MT("strongAsterisk", - "[strong **foo**] bar"); + MT("linkWeb", + "[link ] foo"); - MT("strongUnderscore", - "[strong __foo__] bar"); + MT("linkWebDouble", + "[link ] foo [link ]"); - MT("emStrongAsterisk", - "[em *foo][em&strong **bar*][strong hello**] world"); + MT("linkEmail", + "[link ] foo"); - MT("emStrongUnderscore", - "[em _foo][em&strong __bar_][strong hello__] world"); + MT("linkEmailDouble", + "[link ] foo [link ]"); - // "...same character must be used to open and close an emphasis span."" - MT("emStrongMixed", - "[em _foo][em&strong **bar*hello__ world]"); + MT("emAsterisk", + "[em *foo*] bar"); - MT("emStrongMixed", - "[em *foo][em&strong __bar_hello** world]"); + MT("emUnderscore", + "[em _foo_] bar"); - // These characters should be escaped: - // \ backslash - // ` backtick - // * asterisk - // _ underscore - // {} curly braces - // [] square brackets - // () parentheses - // # hash mark - // + plus sign - // - minus sign (hyphen) - // . dot - // ! exclamation mark + MT("emInWordAsterisk", + "foo[em *bar*]hello"); - MT("escapeBacktick", - "foo \\`bar\\`"); + MT("emInWordUnderscore", + "foo[em _bar_]hello"); - MT("doubleEscapeBacktick", - "foo \\\\[comment `bar\\\\`]"); + // Per documentation: "...surround an * or _ with spaces, it’ll be + // treated as a literal asterisk or underscore." - MT("escapeAsterisk", - "foo \\*bar\\*"); + MT("emEscapedBySpaceIn", + "foo [em _bar _ hello_] world"); - MT("doubleEscapeAsterisk", - "foo \\\\[em *bar\\\\*]"); + MT("emEscapedBySpaceOut", + "foo _ bar[em _hello_]world"); - MT("escapeUnderscore", - "foo \\_bar\\_"); + MT("emEscapedByNewline", + "foo", + "_ bar[em _hello_]world"); - MT("doubleEscapeUnderscore", - "foo \\\\[em _bar\\\\_]"); + // Unclosed emphasis characters + // Instead of simply marking as EM / STRONG, it would be nice to have an + // incomplete flag for EM and STRONG, that is styled slightly different. + MT("emIncompleteAsterisk", + "foo [em *bar]"); - MT("escapeHash", - "\\# foo"); + MT("emIncompleteUnderscore", + "foo [em _bar]"); - MT("doubleEscapeHash", - "\\\\# foo"); + MT("strongAsterisk", + "[strong **foo**] bar"); - MT("escapeNewline", - "\\", - "[em *foo*]"); + MT("strongUnderscore", + "[strong __foo__] bar"); + MT("emStrongAsterisk", + "[em *foo][em&strong **bar*][strong hello**] world"); - // Tests to make sure GFM-specific things aren't getting through + MT("emStrongUnderscore", + "[em _foo][em&strong __bar_][strong hello__] world"); - MT("taskList", - "[variable-2 * [ ]] bar]"); + // "...same character must be used to open and close an emphasis span."" + MT("emStrongMixed", + "[em _foo][em&strong **bar*hello__ world]"); - MT("fencedCodeBlocks", - "[comment ```]", - "foo", - "[comment ```]"); + MT("emStrongMixed", + "[em *foo][em&strong __bar_hello** world]"); - // Tests that require XML mode + // These characters should be escaped: + // \ backslash + // ` backtick + // * asterisk + // _ underscore + // {} curly braces + // [] square brackets + // () parentheses + // # hash mark + // + plus sign + // - minus sign (hyphen) + // . dot + // ! exclamation mark - MT("xmlMode", - "[tag&bracket <][tag div][tag&bracket >]", - "*foo*", - "[tag&bracket <][tag http://github.com][tag&bracket />]", - "[tag&bracket ]", - "[link ]"); + MT("escapeBacktick", + "foo \\`bar\\`"); - MT("xmlModeWithMarkdownInside", - "[tag&bracket <][tag div] [attribute markdown]=[string 1][tag&bracket >]", - "[em *foo*]", - "[link ]", - "[tag
]", - "[link ]", - "[tag&bracket <][tag div][tag&bracket >]", - "[tag&bracket ]"); + MT("doubleEscapeBacktick", + "foo \\\\[comment `bar\\\\`]"); + + MT("escapeAsterisk", + "foo \\*bar\\*"); + + MT("doubleEscapeAsterisk", + "foo \\\\[em *bar\\\\*]"); + + MT("escapeUnderscore", + "foo \\_bar\\_"); + + MT("doubleEscapeUnderscore", + "foo \\\\[em _bar\\\\_]"); + + MT("escapeHash", + "\\# foo"); + + MT("doubleEscapeHash", + "\\\\# foo"); + + MT("escapeNewline", + "\\", + "[em *foo*]"); + + + // Tests to make sure GFM-specific things aren't getting through + + MT("taskList", + "[variable-2 * [ ]] bar]"); + + MT("fencedCodeBlocks", + "[comment ```]", + "foo", + "[comment ```]"); + + // Tests that require XML mode + + MT("xmlMode", + "[tag&bracket <][tag div][tag&bracket >]", + "*foo*", + "[tag&bracket <][tag http://github.com][tag&bracket />]", + "[tag&bracket ]", + "[link ]"); + + MT("xmlModeWithMarkdownInside", + "[tag&bracket <][tag div] [attribute markdown]=[string 1][tag&bracket >]", + "[em *foo*]", + "[link ]", + "[tag
]", + "[link ]", + "[tag&bracket <][tag div][tag&bracket >]", + "[tag&bracket ]"); })(); diff --git a/web/editor.md/lib/codemirror/mode/meta.js b/web/editor.md/lib/codemirror/mode/meta.js index e110288..d7c55c5 100644 --- a/web/editor.md/lib/codemirror/mode/meta.js +++ b/web/editor.md/lib/codemirror/mode/meta.js @@ -1,177 +1,229 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; - CodeMirror.modeInfo = [ - {name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]}, - {name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i}, - {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h"]}, - {name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]}, - {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]}, - {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp"]}, - {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj"]}, - {name: "CoffeeScript", mime: "text/x-coffeescript", mode: "coffeescript", ext: ["coffee"], alias: ["coffee", "coffee-script"]}, - {name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp", ext: ["cl", "lisp", "el"], alias: ["lisp"]}, - {name: "Cypher", mime: "application/x-cypher-query", mode: "cypher", ext: ["cyp", "cypher"]}, - {name: "Cython", mime: "text/x-cython", mode: "python", ext: ["pyx", "pxd", "pxi"]}, - {name: "CSS", mime: "text/css", mode: "css", ext: ["css"]}, - {name: "CQL", mime: "text/x-cassandra", mode: "sql", ext: ["cql"]}, - {name: "D", mime: "text/x-d", mode: "d", ext: ["d"]}, - {name: "Dart", mimes: ["application/dart", "text/x-dart"], mode: "dart", ext: ["dart"]}, - {name: "diff", mime: "text/x-diff", mode: "diff", ext: ["diff", "patch"]}, - {name: "Django", mime: "text/x-django", mode: "django"}, - {name: "Dockerfile", mime: "text/x-dockerfile", mode: "dockerfile", file: /^Dockerfile$/}, - {name: "DTD", mime: "application/xml-dtd", mode: "dtd", ext: ["dtd"]}, - {name: "Dylan", mime: "text/x-dylan", mode: "dylan", ext: ["dylan", "dyl", "intr"]}, - {name: "EBNF", mime: "text/x-ebnf", mode: "ebnf"}, - {name: "ECL", mime: "text/x-ecl", mode: "ecl", ext: ["ecl"]}, - {name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]}, - {name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]}, - {name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]}, - {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]}, - {name: "Forth", mime: "text/x-forth", mode: "forth", ext: ["forth", "fth", "4th"]}, - {name: "Fortran", mime: "text/x-fortran", mode: "fortran", ext: ["f", "for", "f77", "f90"]}, - {name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]}, - {name: "Gas", mime: "text/x-gas", mode: "gas", ext: ["s"]}, - {name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]}, - {name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm", file: /^(readme|contributing|history).md$/i}, - {name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]}, - {name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy"]}, - {name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]}, - {name: "Haskell", mime: "text/x-haskell", mode: "haskell", ext: ["hs"]}, - {name: "Haxe", mime: "text/x-haxe", mode: "haxe", ext: ["hx"]}, - {name: "HXML", mime: "text/x-hxml", mode: "haxe", ext: ["hxml"]}, - {name: "ASP.NET", mime: "application/x-aspx", mode: "htmlembedded", ext: ["aspx"], alias: ["asp", "aspx"]}, - {name: "HTML", mime: "text/html", mode: "htmlmixed", ext: ["html", "htm"], alias: ["xhtml"]}, - {name: "HTTP", mime: "message/http", mode: "http"}, - {name: "IDL", mime: "text/x-idl", mode: "idl", ext: ["pro"]}, - {name: "Jade", mime: "text/x-jade", mode: "jade", ext: ["jade"]}, - {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]}, - {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]}, - {name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript"], - mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]}, - {name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]}, - {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]}, - {name: "Jinja2", mime: "null", mode: "jinja2"}, - {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"]}, - {name: "Kotlin", mime: "text/x-kotlin", mode: "kotlin", ext: ["kt"]}, - {name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]}, - {name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"], alias: ["ls"]}, - {name: "Lua", mime: "text/x-lua", mode: "lua", ext: ["lua"]}, - {name: "Markdown", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]}, - {name: "mIRC", mime: "text/mirc", mode: "mirc"}, - {name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"}, - {name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]}, - {name: "MS SQL", mime: "text/x-mssql", mode: "sql"}, - {name: "MySQL", mime: "text/x-mysql", mode: "sql"}, - {name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx", file: /nginx.*\.conf$/i}, - {name: "NTriples", mime: "text/n-triples", mode: "ntriples", ext: ["nt"]}, - {name: "Objective C", mime: "text/x-objectivec", mode: "clike", ext: ["m", "mm"]}, - {name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]}, - {name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]}, - {name: "Pascal", mime: "text/x-pascal", mode: "pascal", ext: ["p", "pas"]}, - {name: "PEG.js", mime: "null", mode: "pegjs", ext: ["jsonld"]}, - {name: "Perl", mime: "text/x-perl", mode: "perl", ext: ["pl", "pm"]}, - {name: "PHP", mime: "application/x-httpd-php", mode: "php", ext: ["php", "php3", "php4", "php5", "phtml"]}, - {name: "Pig", mime: "text/x-pig", mode: "pig", ext: ["pig"]}, - {name: "Plain Text", mime: "text/plain", mode: "null", ext: ["txt", "text", "conf", "def", "list", "log"]}, - {name: "PLSQL", mime: "text/x-plsql", mode: "sql", ext: ["pls"]}, - {name: "Properties files", mime: "text/x-properties", mode: "properties", ext: ["properties", "ini", "in"], alias: ["ini", "properties"]}, - {name: "Python", mime: "text/x-python", mode: "python", ext: ["py", "pyw"]}, - {name: "Puppet", mime: "text/x-puppet", mode: "puppet", ext: ["pp"]}, - {name: "Q", mime: "text/x-q", mode: "q", ext: ["q"]}, - {name: "R", mime: "text/x-rsrc", mode: "r", ext: ["r"], alias: ["rscript"]}, - {name: "reStructuredText", mime: "text/x-rst", mode: "rst", ext: ["rst"], alias: ["rst"]}, - {name: "RPM Changes", mime: "text/x-rpm-changes", mode: "rpm"}, - {name: "RPM Spec", mime: "text/x-rpm-spec", mode: "rpm", ext: ["spec"]}, - {name: "Ruby", mime: "text/x-ruby", mode: "ruby", ext: ["rb"], alias: ["jruby", "macruby", "rake", "rb", "rbx"]}, - {name: "Rust", mime: "text/x-rustsrc", mode: "rust", ext: ["rs"]}, - {name: "Sass", mime: "text/x-sass", mode: "sass", ext: ["sass"]}, - {name: "Scala", mime: "text/x-scala", mode: "clike", ext: ["scala"]}, - {name: "Scheme", mime: "text/x-scheme", mode: "scheme", ext: ["scm", "ss"]}, - {name: "SCSS", mime: "text/x-scss", mode: "css", ext: ["scss"]}, - {name: "Shell", mime: "text/x-sh", mode: "shell", ext: ["sh", "ksh", "bash"], alias: ["bash", "sh", "zsh"]}, - {name: "Sieve", mime: "application/sieve", mode: "sieve", ext: ["siv", "sieve"]}, - {name: "Slim", mimes: ["text/x-slim", "application/x-slim"], mode: "slim", ext: ["slim"]}, - {name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk", ext: ["st"]}, - {name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]}, - {name: "SmartyMixed", mime: "text/x-smarty", mode: "smartymixed"}, - {name: "Solr", mime: "text/x-solr", mode: "solr"}, - {name: "Soy", mime: "text/x-soy", mode: "soy", ext: ["soy"], alias: ["closure template"]}, - {name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]}, - {name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]}, - {name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]}, - {name: "MariaDB", mime: "text/x-mariadb", mode: "sql"}, - {name: "sTeX", mime: "text/x-stex", mode: "stex"}, - {name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx"], alias: ["tex"]}, - {name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v"]}, - {name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]}, - {name: "Textile", mime: "text/x-textile", mode: "textile", ext: ["textile"]}, - {name: "TiddlyWiki ", mime: "text/x-tiddlywiki", mode: "tiddlywiki"}, - {name: "Tiki wiki", mime: "text/tiki", mode: "tiki"}, - {name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]}, - {name: "Tornado", mime: "text/x-tornado", mode: "tornado"}, - {name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]}, - {name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"], alias: ["ts"]}, - {name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]}, - {name: "VBScript", mime: "text/vbscript", mode: "vbscript", ext: ["vbs"]}, - {name: "Velocity", mime: "text/velocity", mode: "velocity", ext: ["vtl"]}, - {name: "Verilog", mime: "text/x-verilog", mode: "verilog", ext: ["v"]}, - {name: "XML", mimes: ["application/xml", "text/xml"], mode: "xml", ext: ["xml", "xsl", "xsd"], alias: ["rss", "wsdl", "xsd"]}, - {name: "XQuery", mime: "application/xquery", mode: "xquery", ext: ["xy", "xquery"]}, - {name: "YAML", mime: "text/x-yaml", mode: "yaml", ext: ["yaml"], alias: ["yml"]}, - {name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]} - ]; - // Ensure all modes have a mime property for backwards compatibility - for (var i = 0; i < CodeMirror.modeInfo.length; i++) { - var info = CodeMirror.modeInfo[i]; - if (info.mimes) info.mime = info.mimes[0]; - } - - CodeMirror.findModeByMIME = function(mime) { - mime = mime.toLowerCase(); + CodeMirror.modeInfo = [ + {name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]}, + {name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i}, + {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h"]}, + { + name: "C++", + mime: "text/x-c++src", + mode: "clike", + ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], + alias: ["cpp"] + }, + {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]}, + {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp"]}, + {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj"]}, + { + name: "CoffeeScript", + mime: "text/x-coffeescript", + mode: "coffeescript", + ext: ["coffee"], + alias: ["coffee", "coffee-script"] + }, + { + name: "Common Lisp", + mime: "text/x-common-lisp", + mode: "commonlisp", + ext: ["cl", "lisp", "el"], + alias: ["lisp"] + }, + {name: "Cypher", mime: "application/x-cypher-query", mode: "cypher", ext: ["cyp", "cypher"]}, + {name: "Cython", mime: "text/x-cython", mode: "python", ext: ["pyx", "pxd", "pxi"]}, + {name: "CSS", mime: "text/css", mode: "css", ext: ["css"]}, + {name: "CQL", mime: "text/x-cassandra", mode: "sql", ext: ["cql"]}, + {name: "D", mime: "text/x-d", mode: "d", ext: ["d"]}, + {name: "Dart", mimes: ["application/dart", "text/x-dart"], mode: "dart", ext: ["dart"]}, + {name: "diff", mime: "text/x-diff", mode: "diff", ext: ["diff", "patch"]}, + {name: "Django", mime: "text/x-django", mode: "django"}, + {name: "Dockerfile", mime: "text/x-dockerfile", mode: "dockerfile", file: /^Dockerfile$/}, + {name: "DTD", mime: "application/xml-dtd", mode: "dtd", ext: ["dtd"]}, + {name: "Dylan", mime: "text/x-dylan", mode: "dylan", ext: ["dylan", "dyl", "intr"]}, + {name: "EBNF", mime: "text/x-ebnf", mode: "ebnf"}, + {name: "ECL", mime: "text/x-ecl", mode: "ecl", ext: ["ecl"]}, + {name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]}, + {name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]}, + {name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]}, + {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]}, + {name: "Forth", mime: "text/x-forth", mode: "forth", ext: ["forth", "fth", "4th"]}, + {name: "Fortran", mime: "text/x-fortran", mode: "fortran", ext: ["f", "for", "f77", "f90"]}, + {name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]}, + {name: "Gas", mime: "text/x-gas", mode: "gas", ext: ["s"]}, + {name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]}, + { + name: "GitHub Flavored Markdown", + mime: "text/x-gfm", + mode: "gfm", + file: /^(readme|contributing|history).md$/i + }, + {name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]}, + {name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy"]}, + {name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]}, + {name: "Haskell", mime: "text/x-haskell", mode: "haskell", ext: ["hs"]}, + {name: "Haxe", mime: "text/x-haxe", mode: "haxe", ext: ["hx"]}, + {name: "HXML", mime: "text/x-hxml", mode: "haxe", ext: ["hxml"]}, + {name: "ASP.NET", mime: "application/x-aspx", mode: "htmlembedded", ext: ["aspx"], alias: ["asp", "aspx"]}, + {name: "HTML", mime: "text/html", mode: "htmlmixed", ext: ["html", "htm"], alias: ["xhtml"]}, + {name: "HTTP", mime: "message/http", mode: "http"}, + {name: "IDL", mime: "text/x-idl", mode: "idl", ext: ["pro"]}, + {name: "Jade", mime: "text/x-jade", mode: "jade", ext: ["jade"]}, + {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]}, + {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]}, + { + name: "JavaScript", + mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript"], + mode: "javascript", + ext: ["js"], + alias: ["ecmascript", "js", "node"] + }, + { + name: "JSON", + mimes: ["application/json", "application/x-json"], + mode: "javascript", + ext: ["json", "map"], + alias: ["json5"] + }, + {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]}, + {name: "Jinja2", mime: "null", mode: "jinja2"}, + {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"]}, + {name: "Kotlin", mime: "text/x-kotlin", mode: "kotlin", ext: ["kt"]}, + {name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]}, + {name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"], alias: ["ls"]}, + {name: "Lua", mime: "text/x-lua", mode: "lua", ext: ["lua"]}, + {name: "Markdown", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]}, + {name: "mIRC", mime: "text/mirc", mode: "mirc"}, + {name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"}, + {name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]}, + {name: "MS SQL", mime: "text/x-mssql", mode: "sql"}, + {name: "MySQL", mime: "text/x-mysql", mode: "sql"}, + {name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx", file: /nginx.*\.conf$/i}, + {name: "NTriples", mime: "text/n-triples", mode: "ntriples", ext: ["nt"]}, + {name: "Objective C", mime: "text/x-objectivec", mode: "clike", ext: ["m", "mm"]}, + {name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]}, + {name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]}, + {name: "Pascal", mime: "text/x-pascal", mode: "pascal", ext: ["p", "pas"]}, + {name: "PEG.js", mime: "null", mode: "pegjs", ext: ["jsonld"]}, + {name: "Perl", mime: "text/x-perl", mode: "perl", ext: ["pl", "pm"]}, + {name: "PHP", mime: "application/x-httpd-php", mode: "php", ext: ["php", "php3", "php4", "php5", "phtml"]}, + {name: "Pig", mime: "text/x-pig", mode: "pig", ext: ["pig"]}, + {name: "Plain Text", mime: "text/plain", mode: "null", ext: ["txt", "text", "conf", "def", "list", "log"]}, + {name: "PLSQL", mime: "text/x-plsql", mode: "sql", ext: ["pls"]}, + { + name: "Properties files", + mime: "text/x-properties", + mode: "properties", + ext: ["properties", "ini", "in"], + alias: ["ini", "properties"] + }, + {name: "Python", mime: "text/x-python", mode: "python", ext: ["py", "pyw"]}, + {name: "Puppet", mime: "text/x-puppet", mode: "puppet", ext: ["pp"]}, + {name: "Q", mime: "text/x-q", mode: "q", ext: ["q"]}, + {name: "R", mime: "text/x-rsrc", mode: "r", ext: ["r"], alias: ["rscript"]}, + {name: "reStructuredText", mime: "text/x-rst", mode: "rst", ext: ["rst"], alias: ["rst"]}, + {name: "RPM Changes", mime: "text/x-rpm-changes", mode: "rpm"}, + {name: "RPM Spec", mime: "text/x-rpm-spec", mode: "rpm", ext: ["spec"]}, + { + name: "Ruby", + mime: "text/x-ruby", + mode: "ruby", + ext: ["rb"], + alias: ["jruby", "macruby", "rake", "rb", "rbx"] + }, + {name: "Rust", mime: "text/x-rustsrc", mode: "rust", ext: ["rs"]}, + {name: "Sass", mime: "text/x-sass", mode: "sass", ext: ["sass"]}, + {name: "Scala", mime: "text/x-scala", mode: "clike", ext: ["scala"]}, + {name: "Scheme", mime: "text/x-scheme", mode: "scheme", ext: ["scm", "ss"]}, + {name: "SCSS", mime: "text/x-scss", mode: "css", ext: ["scss"]}, + {name: "Shell", mime: "text/x-sh", mode: "shell", ext: ["sh", "ksh", "bash"], alias: ["bash", "sh", "zsh"]}, + {name: "Sieve", mime: "application/sieve", mode: "sieve", ext: ["siv", "sieve"]}, + {name: "Slim", mimes: ["text/x-slim", "application/x-slim"], mode: "slim", ext: ["slim"]}, + {name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk", ext: ["st"]}, + {name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]}, + {name: "SmartyMixed", mime: "text/x-smarty", mode: "smartymixed"}, + {name: "Solr", mime: "text/x-solr", mode: "solr"}, + {name: "Soy", mime: "text/x-soy", mode: "soy", ext: ["soy"], alias: ["closure template"]}, + {name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]}, + {name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]}, + {name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]}, + {name: "MariaDB", mime: "text/x-mariadb", mode: "sql"}, + {name: "sTeX", mime: "text/x-stex", mode: "stex"}, + {name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx"], alias: ["tex"]}, + {name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v"]}, + {name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]}, + {name: "Textile", mime: "text/x-textile", mode: "textile", ext: ["textile"]}, + {name: "TiddlyWiki ", mime: "text/x-tiddlywiki", mode: "tiddlywiki"}, + {name: "Tiki wiki", mime: "text/tiki", mode: "tiki"}, + {name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]}, + {name: "Tornado", mime: "text/x-tornado", mode: "tornado"}, + {name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]}, + {name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"], alias: ["ts"]}, + {name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]}, + {name: "VBScript", mime: "text/vbscript", mode: "vbscript", ext: ["vbs"]}, + {name: "Velocity", mime: "text/velocity", mode: "velocity", ext: ["vtl"]}, + {name: "Verilog", mime: "text/x-verilog", mode: "verilog", ext: ["v"]}, + { + name: "XML", + mimes: ["application/xml", "text/xml"], + mode: "xml", + ext: ["xml", "xsl", "xsd"], + alias: ["rss", "wsdl", "xsd"] + }, + {name: "XQuery", mime: "application/xquery", mode: "xquery", ext: ["xy", "xquery"]}, + {name: "YAML", mime: "text/x-yaml", mode: "yaml", ext: ["yaml"], alias: ["yml"]}, + {name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]} + ]; + // Ensure all modes have a mime property for backwards compatibility for (var i = 0; i < CodeMirror.modeInfo.length; i++) { - var info = CodeMirror.modeInfo[i]; - if (info.mime == mime) return info; - if (info.mimes) for (var j = 0; j < info.mimes.length; j++) - if (info.mimes[j] == mime) return info; + var info = CodeMirror.modeInfo[i]; + if (info.mimes) info.mime = info.mimes[0]; } - }; - CodeMirror.findModeByExtension = function(ext) { - for (var i = 0; i < CodeMirror.modeInfo.length; i++) { - var info = CodeMirror.modeInfo[i]; - if (info.ext) for (var j = 0; j < info.ext.length; j++) - if (info.ext[j] == ext) return info; - } - }; + CodeMirror.findModeByMIME = function (mime) { + mime = mime.toLowerCase(); + for (var i = 0; i < CodeMirror.modeInfo.length; i++) { + var info = CodeMirror.modeInfo[i]; + if (info.mime == mime) return info; + if (info.mimes) for (var j = 0; j < info.mimes.length; j++) + if (info.mimes[j] == mime) return info; + } + }; - CodeMirror.findModeByFileName = function(filename) { - for (var i = 0; i < CodeMirror.modeInfo.length; i++) { - var info = CodeMirror.modeInfo[i]; - if (info.file && info.file.test(filename)) return info; - } - var dot = filename.lastIndexOf("."); - var ext = dot > -1 && filename.substring(dot + 1, filename.length); - if (ext) return CodeMirror.findModeByExtension(ext); - }; + CodeMirror.findModeByExtension = function (ext) { + for (var i = 0; i < CodeMirror.modeInfo.length; i++) { + var info = CodeMirror.modeInfo[i]; + if (info.ext) for (var j = 0; j < info.ext.length; j++) + if (info.ext[j] == ext) return info; + } + }; - CodeMirror.findModeByName = function(name) { - name = name.toLowerCase(); - for (var i = 0; i < CodeMirror.modeInfo.length; i++) { - var info = CodeMirror.modeInfo[i]; - if (info.name.toLowerCase() == name) return info; - if (info.alias) for (var j = 0; j < info.alias.length; j++) - if (info.alias[j].toLowerCase() == name) return info; - } - }; + CodeMirror.findModeByFileName = function (filename) { + for (var i = 0; i < CodeMirror.modeInfo.length; i++) { + var info = CodeMirror.modeInfo[i]; + if (info.file && info.file.test(filename)) return info; + } + var dot = filename.lastIndexOf("."); + var ext = dot > -1 && filename.substring(dot + 1, filename.length); + if (ext) return CodeMirror.findModeByExtension(ext); + }; + + CodeMirror.findModeByName = function (name) { + name = name.toLowerCase(); + for (var i = 0; i < CodeMirror.modeInfo.length; i++) { + var info = CodeMirror.modeInfo[i]; + if (info.name.toLowerCase() == name) return info; + if (info.alias) for (var j = 0; j < info.alias.length; j++) + if (info.alias[j].toLowerCase() == name) return info; + } + }; }); diff --git a/web/editor.md/lib/codemirror/mode/mirc/index.html b/web/editor.md/lib/codemirror/mode/mirc/index.html index fd2f34e..48e52c5 100644 --- a/web/editor.md/lib/codemirror/mode/mirc/index.html +++ b/web/editor.md/lib/codemirror/mode/mirc/index.html @@ -2,30 +2,32 @@ CodeMirror: mIRC mode - + - - + + - +
-

mIRC mode

-

MIME types defined: text/mirc.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/mirc/mirc.js b/web/editor.md/lib/codemirror/mode/mirc/mirc.js index f0d5c6a..43a9a32 100644 --- a/web/editor.md/lib/codemirror/mode/mirc/mirc.js +++ b/web/editor.md/lib/codemirror/mode/mirc/mirc.js @@ -3,191 +3,186 @@ //mIRC mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMIME("text/mirc", "mirc"); -CodeMirror.defineMode("mirc", function() { - function parseWords(str) { - var obj = {}, words = str.split(" "); - for (var i = 0; i < words.length; ++i) obj[words[i]] = true; - return obj; - } - var specials = parseWords("$! $$ $& $? $+ $abook $abs $active $activecid " + - "$activewid $address $addtok $agent $agentname $agentstat $agentver " + - "$alias $and $anick $ansi2mirc $aop $appactive $appstate $asc $asctime " + - "$asin $atan $avoice $away $awaymsg $awaytime $banmask $base $bfind " + - "$binoff $biton $bnick $bvar $bytes $calc $cb $cd $ceil $chan $chanmodes " + - "$chantypes $chat $chr $cid $clevel $click $cmdbox $cmdline $cnick $color " + - "$com $comcall $comchan $comerr $compact $compress $comval $cos $count " + - "$cr $crc $creq $crlf $ctime $ctimer $ctrlenter $date $day $daylight " + - "$dbuh $dbuw $dccignore $dccport $dde $ddename $debug $decode $decompress " + - "$deltok $devent $dialog $did $didreg $didtok $didwm $disk $dlevel $dll " + - "$dllcall $dname $dns $duration $ebeeps $editbox $emailaddr $encode $error " + - "$eval $event $exist $feof $ferr $fgetc $file $filename $filtered $finddir " + - "$finddirn $findfile $findfilen $findtok $fline $floor $fopen $fread $fserve " + - "$fulladdress $fulldate $fullname $fullscreen $get $getdir $getdot $gettok $gmt " + - "$group $halted $hash $height $hfind $hget $highlight $hnick $hotline " + - "$hotlinepos $ial $ialchan $ibl $idle $iel $ifmatch $ignore $iif $iil " + - "$inelipse $ini $inmidi $inpaste $inpoly $input $inrect $inroundrect " + - "$insong $instok $int $inwave $ip $isalias $isbit $isdde $isdir $isfile " + - "$isid $islower $istok $isupper $keychar $keyrpt $keyval $knick $lactive " + - "$lactivecid $lactivewid $left $len $level $lf $line $lines $link $lock " + - "$lock $locked $log $logstamp $logstampfmt $longfn $longip $lower $ltimer " + - "$maddress $mask $matchkey $matchtok $md5 $me $menu $menubar $menucontext " + - "$menutype $mid $middir $mircdir $mircexe $mircini $mklogfn $mnick $mode " + - "$modefirst $modelast $modespl $mouse $msfile $network $newnick $nick $nofile " + - "$nopath $noqt $not $notags $notify $null $numeric $numok $oline $onpoly " + - "$opnick $or $ord $os $passivedcc $pic $play $pnick $port $portable $portfree " + - "$pos $prefix $prop $protect $puttok $qt $query $rand $r $rawmsg $read $readomo " + - "$readn $regex $regml $regsub $regsubex $remove $remtok $replace $replacex " + - "$reptok $result $rgb $right $round $scid $scon $script $scriptdir $scriptline " + - "$sdir $send $server $serverip $sfile $sha1 $shortfn $show $signal $sin " + - "$site $sline $snick $snicks $snotify $sock $sockbr $sockerr $sockname " + - "$sorttok $sound $sqrt $ssl $sreq $sslready $status $strip $str $stripped " + - "$syle $submenu $switchbar $tan $target $ticks $time $timer $timestamp " + - "$timestampfmt $timezone $tip $titlebar $toolbar $treebar $trust $ulevel " + - "$ulist $upper $uptime $url $usermode $v1 $v2 $var $vcmd $vcmdstat $vcmdver " + - "$version $vnick $vol $wid $width $wildsite $wildtok $window $wrap $xor"); - var keywords = parseWords("abook ajinvite alias aline ame amsg anick aop auser autojoin avoice " + - "away background ban bcopy beep bread break breplace bset btrunc bunset bwrite " + - "channel clear clearall cline clipboard close cnick color comclose comopen " + - "comreg continue copy creq ctcpreply ctcps dcc dccserver dde ddeserver " + - "debug dec describe dialog did didtok disable disconnect dlevel dline dll " + - "dns dqwindow drawcopy drawdot drawfill drawline drawpic drawrect drawreplace " + - "drawrot drawsave drawscroll drawtext ebeeps echo editbox emailaddr enable " + - "events exit fclose filter findtext finger firewall flash flist flood flush " + - "flushini font fopen fseek fsend fserve fullname fwrite ghide gload gmove " + - "gopts goto gplay gpoint gqreq groups gshow gsize gstop gtalk gunload hadd " + - "halt haltdef hdec hdel help hfree hinc hload hmake hop hsave ial ialclear " + - "ialmark identd if ignore iline inc invite iuser join kick linesep links list " + - "load loadbuf localinfo log mdi me menubar mkdir mnick mode msg nick noop notice " + - "notify omsg onotice part partall pdcc perform play playctrl pop protect pvoice " + - "qme qmsg query queryn quit raw reload remini remote remove rename renwin " + - "reseterror resetidle return rlevel rline rmdir run ruser save savebuf saveini " + - "say scid scon server set showmirc signam sline sockaccept sockclose socklist " + - "socklisten sockmark sockopen sockpause sockread sockrename sockudp sockwrite " + - "sound speak splay sreq strip switchbar timer timestamp titlebar tnick tokenize " + - "toolbar topic tray treebar ulist unload unset unsetall updatenl url uwho " + - "var vcadd vcmd vcrem vol while whois window winhelp write writeint if isalnum " + - "isalpha isaop isavoice isban ischan ishop isignore isin isincs isletter islower " + - "isnotify isnum ison isop isprotect isreg isupper isvoice iswm iswmcs " + - "elseif else goto menu nicklist status title icon size option text edit " + - "button check radio box scroll list combo link tab item"); - var functions = parseWords("if elseif else and not or eq ne in ni for foreach while switch"); - var isOperatorChar = /[+\-*&%=<>!?^\/\|]/; - function chain(stream, state, f) { - state.tokenize = f; - return f(stream, state); - } - function tokenBase(stream, state) { - var beforeParams = state.beforeParams; - state.beforeParams = false; - var ch = stream.next(); - if (/[\[\]{}\(\),\.]/.test(ch)) { - if (ch == "(" && beforeParams) state.inParams = true; - else if (ch == ")") state.inParams = false; - return null; - } - else if (/\d/.test(ch)) { - stream.eatWhile(/[\w\.]/); - return "number"; - } - else if (ch == "\\") { - stream.eat("\\"); - stream.eat(/./); - return "number"; - } - else if (ch == "/" && stream.eat("*")) { - return chain(stream, state, tokenComment); - } - else if (ch == ";" && stream.match(/ *\( *\(/)) { - return chain(stream, state, tokenUnparsed); - } - else if (ch == ";" && !state.inParams) { - stream.skipToEnd(); - return "comment"; - } - else if (ch == '"') { - stream.eat(/"/); - return "keyword"; - } - else if (ch == "$") { - stream.eatWhile(/[$_a-z0-9A-Z\.:]/); - if (specials && specials.propertyIsEnumerable(stream.current().toLowerCase())) { - return "keyword"; - } - else { - state.beforeParams = true; - return "builtin"; - } - } - else if (ch == "%") { - stream.eatWhile(/[^,^\s^\(^\)]/); - state.beforeParams = true; - return "string"; - } - else if (isOperatorChar.test(ch)) { - stream.eatWhile(isOperatorChar); - return "operator"; - } - else { - stream.eatWhile(/[\w\$_{}]/); - var word = stream.current().toLowerCase(); - if (keywords && keywords.propertyIsEnumerable(word)) - return "keyword"; - if (functions && functions.propertyIsEnumerable(word)) { - state.beforeParams = true; - return "keyword"; - } - return null; - } - } - function tokenComment(stream, state) { - var maybeEnd = false, ch; - while (ch = stream.next()) { - if (ch == "/" && maybeEnd) { - state.tokenize = tokenBase; - break; - } - maybeEnd = (ch == "*"); - } - return "comment"; - } - function tokenUnparsed(stream, state) { - var maybeEnd = 0, ch; - while (ch = stream.next()) { - if (ch == ";" && maybeEnd == 2) { - state.tokenize = tokenBase; - break; - } - if (ch == ")") - maybeEnd++; - else if (ch != " ") - maybeEnd = 0; - } - return "meta"; - } - return { - startState: function() { - return { - tokenize: tokenBase, - beforeParams: false, - inParams: false - }; - }, - token: function(stream, state) { - if (stream.eatSpace()) return null; - return state.tokenize(stream, state); - } - }; -}); + CodeMirror.defineMIME("text/mirc", "mirc"); + CodeMirror.defineMode("mirc", function () { + function parseWords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + var specials = parseWords("$! $$ $& $? $+ $abook $abs $active $activecid " + + "$activewid $address $addtok $agent $agentname $agentstat $agentver " + + "$alias $and $anick $ansi2mirc $aop $appactive $appstate $asc $asctime " + + "$asin $atan $avoice $away $awaymsg $awaytime $banmask $base $bfind " + + "$binoff $biton $bnick $bvar $bytes $calc $cb $cd $ceil $chan $chanmodes " + + "$chantypes $chat $chr $cid $clevel $click $cmdbox $cmdline $cnick $color " + + "$com $comcall $comchan $comerr $compact $compress $comval $cos $count " + + "$cr $crc $creq $crlf $ctime $ctimer $ctrlenter $date $day $daylight " + + "$dbuh $dbuw $dccignore $dccport $dde $ddename $debug $decode $decompress " + + "$deltok $devent $dialog $did $didreg $didtok $didwm $disk $dlevel $dll " + + "$dllcall $dname $dns $duration $ebeeps $editbox $emailaddr $encode $error " + + "$eval $event $exist $feof $ferr $fgetc $file $filename $filtered $finddir " + + "$finddirn $findfile $findfilen $findtok $fline $floor $fopen $fread $fserve " + + "$fulladdress $fulldate $fullname $fullscreen $get $getdir $getdot $gettok $gmt " + + "$group $halted $hash $height $hfind $hget $highlight $hnick $hotline " + + "$hotlinepos $ial $ialchan $ibl $idle $iel $ifmatch $ignore $iif $iil " + + "$inelipse $ini $inmidi $inpaste $inpoly $input $inrect $inroundrect " + + "$insong $instok $int $inwave $ip $isalias $isbit $isdde $isdir $isfile " + + "$isid $islower $istok $isupper $keychar $keyrpt $keyval $knick $lactive " + + "$lactivecid $lactivewid $left $len $level $lf $line $lines $link $lock " + + "$lock $locked $log $logstamp $logstampfmt $longfn $longip $lower $ltimer " + + "$maddress $mask $matchkey $matchtok $md5 $me $menu $menubar $menucontext " + + "$menutype $mid $middir $mircdir $mircexe $mircini $mklogfn $mnick $mode " + + "$modefirst $modelast $modespl $mouse $msfile $network $newnick $nick $nofile " + + "$nopath $noqt $not $notags $notify $null $numeric $numok $oline $onpoly " + + "$opnick $or $ord $os $passivedcc $pic $play $pnick $port $portable $portfree " + + "$pos $prefix $prop $protect $puttok $qt $query $rand $r $rawmsg $read $readomo " + + "$readn $regex $regml $regsub $regsubex $remove $remtok $replace $replacex " + + "$reptok $result $rgb $right $round $scid $scon $script $scriptdir $scriptline " + + "$sdir $send $server $serverip $sfile $sha1 $shortfn $show $signal $sin " + + "$site $sline $snick $snicks $snotify $sock $sockbr $sockerr $sockname " + + "$sorttok $sound $sqrt $ssl $sreq $sslready $status $strip $str $stripped " + + "$syle $submenu $switchbar $tan $target $ticks $time $timer $timestamp " + + "$timestampfmt $timezone $tip $titlebar $toolbar $treebar $trust $ulevel " + + "$ulist $upper $uptime $url $usermode $v1 $v2 $var $vcmd $vcmdstat $vcmdver " + + "$version $vnick $vol $wid $width $wildsite $wildtok $window $wrap $xor"); + var keywords = parseWords("abook ajinvite alias aline ame amsg anick aop auser autojoin avoice " + + "away background ban bcopy beep bread break breplace bset btrunc bunset bwrite " + + "channel clear clearall cline clipboard close cnick color comclose comopen " + + "comreg continue copy creq ctcpreply ctcps dcc dccserver dde ddeserver " + + "debug dec describe dialog did didtok disable disconnect dlevel dline dll " + + "dns dqwindow drawcopy drawdot drawfill drawline drawpic drawrect drawreplace " + + "drawrot drawsave drawscroll drawtext ebeeps echo editbox emailaddr enable " + + "events exit fclose filter findtext finger firewall flash flist flood flush " + + "flushini font fopen fseek fsend fserve fullname fwrite ghide gload gmove " + + "gopts goto gplay gpoint gqreq groups gshow gsize gstop gtalk gunload hadd " + + "halt haltdef hdec hdel help hfree hinc hload hmake hop hsave ial ialclear " + + "ialmark identd if ignore iline inc invite iuser join kick linesep links list " + + "load loadbuf localinfo log mdi me menubar mkdir mnick mode msg nick noop notice " + + "notify omsg onotice part partall pdcc perform play playctrl pop protect pvoice " + + "qme qmsg query queryn quit raw reload remini remote remove rename renwin " + + "reseterror resetidle return rlevel rline rmdir run ruser save savebuf saveini " + + "say scid scon server set showmirc signam sline sockaccept sockclose socklist " + + "socklisten sockmark sockopen sockpause sockread sockrename sockudp sockwrite " + + "sound speak splay sreq strip switchbar timer timestamp titlebar tnick tokenize " + + "toolbar topic tray treebar ulist unload unset unsetall updatenl url uwho " + + "var vcadd vcmd vcrem vol while whois window winhelp write writeint if isalnum " + + "isalpha isaop isavoice isban ischan ishop isignore isin isincs isletter islower " + + "isnotify isnum ison isop isprotect isreg isupper isvoice iswm iswmcs " + + "elseif else goto menu nicklist status title icon size option text edit " + + "button check radio box scroll list combo link tab item"); + var functions = parseWords("if elseif else and not or eq ne in ni for foreach while switch"); + var isOperatorChar = /[+\-*&%=<>!?^\/\|]/; + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + + function tokenBase(stream, state) { + var beforeParams = state.beforeParams; + state.beforeParams = false; + var ch = stream.next(); + if (/[\[\]{}\(\),\.]/.test(ch)) { + if (ch == "(" && beforeParams) state.inParams = true; + else if (ch == ")") state.inParams = false; + return null; + } else if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } else if (ch == "\\") { + stream.eat("\\"); + stream.eat(/./); + return "number"; + } else if (ch == "/" && stream.eat("*")) { + return chain(stream, state, tokenComment); + } else if (ch == ";" && stream.match(/ *\( *\(/)) { + return chain(stream, state, tokenUnparsed); + } else if (ch == ";" && !state.inParams) { + stream.skipToEnd(); + return "comment"; + } else if (ch == '"') { + stream.eat(/"/); + return "keyword"; + } else if (ch == "$") { + stream.eatWhile(/[$_a-z0-9A-Z\.:]/); + if (specials && specials.propertyIsEnumerable(stream.current().toLowerCase())) { + return "keyword"; + } else { + state.beforeParams = true; + return "builtin"; + } + } else if (ch == "%") { + stream.eatWhile(/[^,^\s^\(^\)]/); + state.beforeParams = true; + return "string"; + } else if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } else { + stream.eatWhile(/[\w\$_{}]/); + var word = stream.current().toLowerCase(); + if (keywords && keywords.propertyIsEnumerable(word)) + return "keyword"; + if (functions && functions.propertyIsEnumerable(word)) { + state.beforeParams = true; + return "keyword"; + } + return null; + } + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function tokenUnparsed(stream, state) { + var maybeEnd = 0, ch; + while (ch = stream.next()) { + if (ch == ";" && maybeEnd == 2) { + state.tokenize = tokenBase; + break; + } + if (ch == ")") + maybeEnd++; + else if (ch != " ") + maybeEnd = 0; + } + return "meta"; + } + + return { + startState: function () { + return { + tokenize: tokenBase, + beforeParams: false, + inParams: false + }; + }, + token: function (stream, state) { + if (stream.eatSpace()) return null; + return state.tokenize(stream, state); + } + }; + }); }); diff --git a/web/editor.md/lib/codemirror/mode/mllike/index.html b/web/editor.md/lib/codemirror/mode/mllike/index.html index 5923af8..4661888 100644 --- a/web/editor.md/lib/codemirror/mode/mllike/index.html +++ b/web/editor.md/lib/codemirror/mode/mllike/index.html @@ -2,34 +2,37 @@ CodeMirror: ML-like mode - + - +
-

OCaml mode

+

OCaml mode

- -

F# mode

- - + var fsharpEditor = CodeMirror.fromTextArea(document.getElementById('fsharpCode'), { + mode: 'text/x-fsharp', + lineNumbers: true, + matchBrackets: true + }); + -

MIME types defined: text/x-ocaml (OCaml) and text/x-fsharp (F#).

+

MIME types defined: text/x-ocaml (OCaml) and text/x-fsharp (F#).

diff --git a/web/editor.md/lib/codemirror/mode/mllike/mllike.js b/web/editor.md/lib/codemirror/mode/mllike/mllike.js index 04ab1c9..1999f85 100644 --- a/web/editor.md/lib/codemirror/mode/mllike/mllike.js +++ b/web/editor.md/lib/codemirror/mode/mllike/mllike.js @@ -1,205 +1,207 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode('mllike', function(_config, parserConfig) { - var words = { - 'let': 'keyword', - 'rec': 'keyword', - 'in': 'keyword', - 'of': 'keyword', - 'and': 'keyword', - 'if': 'keyword', - 'then': 'keyword', - 'else': 'keyword', - 'for': 'keyword', - 'to': 'keyword', - 'while': 'keyword', - 'do': 'keyword', - 'done': 'keyword', - 'fun': 'keyword', - 'function': 'keyword', - 'val': 'keyword', - 'type': 'keyword', - 'mutable': 'keyword', - 'match': 'keyword', - 'with': 'keyword', - 'try': 'keyword', - 'open': 'builtin', - 'ignore': 'builtin', - 'begin': 'keyword', - 'end': 'keyword' - }; + CodeMirror.defineMode('mllike', function (_config, parserConfig) { + var words = { + 'let': 'keyword', + 'rec': 'keyword', + 'in': 'keyword', + 'of': 'keyword', + 'and': 'keyword', + 'if': 'keyword', + 'then': 'keyword', + 'else': 'keyword', + 'for': 'keyword', + 'to': 'keyword', + 'while': 'keyword', + 'do': 'keyword', + 'done': 'keyword', + 'fun': 'keyword', + 'function': 'keyword', + 'val': 'keyword', + 'type': 'keyword', + 'mutable': 'keyword', + 'match': 'keyword', + 'with': 'keyword', + 'try': 'keyword', + 'open': 'builtin', + 'ignore': 'builtin', + 'begin': 'keyword', + 'end': 'keyword' + }; - var extraWords = parserConfig.extraWords || {}; - for (var prop in extraWords) { - if (extraWords.hasOwnProperty(prop)) { - words[prop] = parserConfig.extraWords[prop]; - } - } + var extraWords = parserConfig.extraWords || {}; + for (var prop in extraWords) { + if (extraWords.hasOwnProperty(prop)) { + words[prop] = parserConfig.extraWords[prop]; + } + } - function tokenBase(stream, state) { - var ch = stream.next(); + function tokenBase(stream, state) { + var ch = stream.next(); - if (ch === '"') { - state.tokenize = tokenString; - return state.tokenize(stream, state); - } - if (ch === '(') { - if (stream.eat('*')) { - state.commentLevel++; - state.tokenize = tokenComment; - return state.tokenize(stream, state); - } - } - if (ch === '~') { - stream.eatWhile(/\w/); - return 'variable-2'; - } - if (ch === '`') { - stream.eatWhile(/\w/); - return 'quote'; - } - if (ch === '/' && parserConfig.slashComments && stream.eat('/')) { - stream.skipToEnd(); - return 'comment'; - } - if (/\d/.test(ch)) { - stream.eatWhile(/[\d]/); - if (stream.eat('.')) { - stream.eatWhile(/[\d]/); - } - return 'number'; - } - if ( /[+\-*&%=<>!?|]/.test(ch)) { - return 'operator'; - } - stream.eatWhile(/\w/); - var cur = stream.current(); - return words[cur] || 'variable'; - } + if (ch === '"') { + state.tokenize = tokenString; + return state.tokenize(stream, state); + } + if (ch === '(') { + if (stream.eat('*')) { + state.commentLevel++; + state.tokenize = tokenComment; + return state.tokenize(stream, state); + } + } + if (ch === '~') { + stream.eatWhile(/\w/); + return 'variable-2'; + } + if (ch === '`') { + stream.eatWhile(/\w/); + return 'quote'; + } + if (ch === '/' && parserConfig.slashComments && stream.eat('/')) { + stream.skipToEnd(); + return 'comment'; + } + if (/\d/.test(ch)) { + stream.eatWhile(/[\d]/); + if (stream.eat('.')) { + stream.eatWhile(/[\d]/); + } + return 'number'; + } + if (/[+\-*&%=<>!?|]/.test(ch)) { + return 'operator'; + } + stream.eatWhile(/\w/); + var cur = stream.current(); + return words[cur] || 'variable'; + } - function tokenString(stream, state) { - var next, end = false, escaped = false; - while ((next = stream.next()) != null) { - if (next === '"' && !escaped) { - end = true; - break; - } - escaped = !escaped && next === '\\'; - } - if (end && !escaped) { - state.tokenize = tokenBase; - } - return 'string'; - }; + function tokenString(stream, state) { + var next, end = false, escaped = false; + while ((next = stream.next()) != null) { + if (next === '"' && !escaped) { + end = true; + break; + } + escaped = !escaped && next === '\\'; + } + if (end && !escaped) { + state.tokenize = tokenBase; + } + return 'string'; + }; - function tokenComment(stream, state) { - var prev, next; - while(state.commentLevel > 0 && (next = stream.next()) != null) { - if (prev === '(' && next === '*') state.commentLevel++; - if (prev === '*' && next === ')') state.commentLevel--; - prev = next; - } - if (state.commentLevel <= 0) { - state.tokenize = tokenBase; - } - return 'comment'; - } + function tokenComment(stream, state) { + var prev, next; + while (state.commentLevel > 0 && (next = stream.next()) != null) { + if (prev === '(' && next === '*') state.commentLevel++; + if (prev === '*' && next === ')') state.commentLevel--; + prev = next; + } + if (state.commentLevel <= 0) { + state.tokenize = tokenBase; + } + return 'comment'; + } - return { - startState: function() {return {tokenize: tokenBase, commentLevel: 0};}, - token: function(stream, state) { - if (stream.eatSpace()) return null; - return state.tokenize(stream, state); - }, + return { + startState: function () { + return {tokenize: tokenBase, commentLevel: 0}; + }, + token: function (stream, state) { + if (stream.eatSpace()) return null; + return state.tokenize(stream, state); + }, - blockCommentStart: "(*", - blockCommentEnd: "*)", - lineComment: parserConfig.slashComments ? "//" : null - }; -}); + blockCommentStart: "(*", + blockCommentEnd: "*)", + lineComment: parserConfig.slashComments ? "//" : null + }; + }); -CodeMirror.defineMIME('text/x-ocaml', { - name: 'mllike', - extraWords: { - 'succ': 'keyword', - 'trace': 'builtin', - 'exit': 'builtin', - 'print_string': 'builtin', - 'print_endline': 'builtin', - 'true': 'atom', - 'false': 'atom', - 'raise': 'keyword' - } -}); + CodeMirror.defineMIME('text/x-ocaml', { + name: 'mllike', + extraWords: { + 'succ': 'keyword', + 'trace': 'builtin', + 'exit': 'builtin', + 'print_string': 'builtin', + 'print_endline': 'builtin', + 'true': 'atom', + 'false': 'atom', + 'raise': 'keyword' + } + }); -CodeMirror.defineMIME('text/x-fsharp', { - name: 'mllike', - extraWords: { - 'abstract': 'keyword', - 'as': 'keyword', - 'assert': 'keyword', - 'base': 'keyword', - 'class': 'keyword', - 'default': 'keyword', - 'delegate': 'keyword', - 'downcast': 'keyword', - 'downto': 'keyword', - 'elif': 'keyword', - 'exception': 'keyword', - 'extern': 'keyword', - 'finally': 'keyword', - 'global': 'keyword', - 'inherit': 'keyword', - 'inline': 'keyword', - 'interface': 'keyword', - 'internal': 'keyword', - 'lazy': 'keyword', - 'let!': 'keyword', - 'member' : 'keyword', - 'module': 'keyword', - 'namespace': 'keyword', - 'new': 'keyword', - 'null': 'keyword', - 'override': 'keyword', - 'private': 'keyword', - 'public': 'keyword', - 'return': 'keyword', - 'return!': 'keyword', - 'select': 'keyword', - 'static': 'keyword', - 'struct': 'keyword', - 'upcast': 'keyword', - 'use': 'keyword', - 'use!': 'keyword', - 'val': 'keyword', - 'when': 'keyword', - 'yield': 'keyword', - 'yield!': 'keyword', + CodeMirror.defineMIME('text/x-fsharp', { + name: 'mllike', + extraWords: { + 'abstract': 'keyword', + 'as': 'keyword', + 'assert': 'keyword', + 'base': 'keyword', + 'class': 'keyword', + 'default': 'keyword', + 'delegate': 'keyword', + 'downcast': 'keyword', + 'downto': 'keyword', + 'elif': 'keyword', + 'exception': 'keyword', + 'extern': 'keyword', + 'finally': 'keyword', + 'global': 'keyword', + 'inherit': 'keyword', + 'inline': 'keyword', + 'interface': 'keyword', + 'internal': 'keyword', + 'lazy': 'keyword', + 'let!': 'keyword', + 'member': 'keyword', + 'module': 'keyword', + 'namespace': 'keyword', + 'new': 'keyword', + 'null': 'keyword', + 'override': 'keyword', + 'private': 'keyword', + 'public': 'keyword', + 'return': 'keyword', + 'return!': 'keyword', + 'select': 'keyword', + 'static': 'keyword', + 'struct': 'keyword', + 'upcast': 'keyword', + 'use': 'keyword', + 'use!': 'keyword', + 'val': 'keyword', + 'when': 'keyword', + 'yield': 'keyword', + 'yield!': 'keyword', - 'List': 'builtin', - 'Seq': 'builtin', - 'Map': 'builtin', - 'Set': 'builtin', - 'int': 'builtin', - 'string': 'builtin', - 'raise': 'builtin', - 'failwith': 'builtin', - 'not': 'builtin', - 'true': 'builtin', - 'false': 'builtin' - }, - slashComments: true -}); + 'List': 'builtin', + 'Seq': 'builtin', + 'Map': 'builtin', + 'Set': 'builtin', + 'int': 'builtin', + 'string': 'builtin', + 'raise': 'builtin', + 'failwith': 'builtin', + 'not': 'builtin', + 'true': 'builtin', + 'false': 'builtin' + }, + slashComments: true + }); }); diff --git a/web/editor.md/lib/codemirror/mode/modelica/index.html b/web/editor.md/lib/codemirror/mode/modelica/index.html index 408c3b1..24745a2 100644 --- a/web/editor.md/lib/codemirror/mode/modelica/index.html +++ b/web/editor.md/lib/codemirror/mode/modelica/index.html @@ -2,33 +2,35 @@ CodeMirror: Modelica mode - + - + - + - +
-

Modelica mode

+

Modelica mode

-

Simple mode that tries to handle Modelica as well as it can.

MIME types defined: text/x-modelica - (Modlica code).

+ (Modlica code).

diff --git a/web/editor.md/lib/codemirror/mode/modelica/modelica.js b/web/editor.md/lib/codemirror/mode/modelica/modelica.js index 77ec7a3..ee20191 100644 --- a/web/editor.md/lib/codemirror/mode/modelica/modelica.js +++ b/web/editor.md/lib/codemirror/mode/modelica/modelica.js @@ -3,243 +3,245 @@ // Modelica support for CodeMirror, copyright (c) by Lennart Ochel -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); }) -(function(CodeMirror) { - "use strict"; +(function (CodeMirror) { + "use strict"; - CodeMirror.defineMode("modelica", function(config, parserConfig) { + CodeMirror.defineMode("modelica", function (config, parserConfig) { - var indentUnit = config.indentUnit; - var keywords = parserConfig.keywords || {}; - var builtin = parserConfig.builtin || {}; - var atoms = parserConfig.atoms || {}; + var indentUnit = config.indentUnit; + var keywords = parserConfig.keywords || {}; + var builtin = parserConfig.builtin || {}; + var atoms = parserConfig.atoms || {}; - var isSingleOperatorChar = /[;=\(:\),{}.*<>+\-\/^\[\]]/; - var isDoubleOperatorChar = /(:=|<=|>=|==|<>|\.\+|\.\-|\.\*|\.\/|\.\^)/; - var isDigit = /[0-9]/; - var isNonDigit = /[_a-zA-Z]/; + var isSingleOperatorChar = /[;=\(:\),{}.*<>+\-\/^\[\]]/; + var isDoubleOperatorChar = /(:=|<=|>=|==|<>|\.\+|\.\-|\.\*|\.\/|\.\^)/; + var isDigit = /[0-9]/; + var isNonDigit = /[_a-zA-Z]/; - function tokenLineComment(stream, state) { - stream.skipToEnd(); - state.tokenize = null; - return "comment"; - } - - function tokenBlockComment(stream, state) { - var maybeEnd = false, ch; - while (ch = stream.next()) { - if (maybeEnd && ch == "/") { - state.tokenize = null; - break; + function tokenLineComment(stream, state) { + stream.skipToEnd(); + state.tokenize = null; + return "comment"; } - maybeEnd = (ch == "*"); - } - return "comment"; - } - function tokenString(stream, state) { - var escaped = false, ch; - while ((ch = stream.next()) != null) { - if (ch == '"' && !escaped) { - state.tokenize = null; - state.sol = false; - break; + function tokenBlockComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (maybeEnd && ch == "/") { + state.tokenize = null; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; } - escaped = !escaped && ch == "\\"; - } - return "string"; - } + function tokenString(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == '"' && !escaped) { + state.tokenize = null; + state.sol = false; + break; + } + escaped = !escaped && ch == "\\"; + } + + return "string"; + } - function tokenIdent(stream, state) { - stream.eatWhile(isDigit); - while (stream.eat(isDigit) || stream.eat(isNonDigit)) { } + function tokenIdent(stream, state) { + stream.eatWhile(isDigit); + while (stream.eat(isDigit) || stream.eat(isNonDigit)) { + } - var cur = stream.current(); + var cur = stream.current(); - if(state.sol && (cur == "package" || cur == "model" || cur == "when" || cur == "connector")) state.level++; - else if(state.sol && cur == "end" && state.level > 0) state.level--; + if (state.sol && (cur == "package" || cur == "model" || cur == "when" || cur == "connector")) state.level++; + else if (state.sol && cur == "end" && state.level > 0) state.level--; - state.tokenize = null; - state.sol = false; + state.tokenize = null; + state.sol = false; - if (keywords.propertyIsEnumerable(cur)) return "keyword"; - else if (builtin.propertyIsEnumerable(cur)) return "builtin"; - else if (atoms.propertyIsEnumerable(cur)) return "atom"; - else return "variable"; - } + if (keywords.propertyIsEnumerable(cur)) return "keyword"; + else if (builtin.propertyIsEnumerable(cur)) return "builtin"; + else if (atoms.propertyIsEnumerable(cur)) return "atom"; + else return "variable"; + } - function tokenQIdent(stream, state) { - while (stream.eat(/[^']/)) { } + function tokenQIdent(stream, state) { + while (stream.eat(/[^']/)) { + } - state.tokenize = null; - state.sol = false; + state.tokenize = null; + state.sol = false; - if(stream.eat("'")) - return "variable"; - else - return "error"; - } + if (stream.eat("'")) + return "variable"; + else + return "error"; + } - function tokenUnsignedNuber(stream, state) { - stream.eatWhile(isDigit); - if (stream.eat('.')) { - stream.eatWhile(isDigit); - } - if (stream.eat('e') || stream.eat('E')) { - if (!stream.eat('-')) - stream.eat('+'); - stream.eatWhile(isDigit); - } - - state.tokenize = null; - state.sol = false; - return "number"; - } + function tokenUnsignedNuber(stream, state) { + stream.eatWhile(isDigit); + if (stream.eat('.')) { + stream.eatWhile(isDigit); + } + if (stream.eat('e') || stream.eat('E')) { + if (!stream.eat('-')) + stream.eat('+'); + stream.eatWhile(isDigit); + } + + state.tokenize = null; + state.sol = false; + return "number"; + } - // Interface - return { - startState: function() { + // Interface return { - tokenize: null, - level: 0, - sol: true + startState: function () { + return { + tokenize: null, + level: 0, + sol: true + }; + }, + + token: function (stream, state) { + if (state.tokenize != null) { + return state.tokenize(stream, state); + } + + if (stream.sol()) { + state.sol = true; + } + + // WHITESPACE + if (stream.eatSpace()) { + state.tokenize = null; + return null; + } + + var ch = stream.next(); + + // LINECOMMENT + if (ch == '/' && stream.eat('/')) { + state.tokenize = tokenLineComment; + } + // BLOCKCOMMENT + else if (ch == '/' && stream.eat('*')) { + state.tokenize = tokenBlockComment; + } + // TWO SYMBOL TOKENS + else if (isDoubleOperatorChar.test(ch + stream.peek())) { + stream.next(); + state.tokenize = null; + return "operator"; + } + // SINGLE SYMBOL TOKENS + else if (isSingleOperatorChar.test(ch)) { + state.tokenize = null; + return "operator"; + } + // IDENT + else if (isNonDigit.test(ch)) { + state.tokenize = tokenIdent; + } + // Q-IDENT + else if (ch == "'" && stream.peek() && stream.peek() != "'") { + state.tokenize = tokenQIdent; + } + // STRING + else if (ch == '"') { + state.tokenize = tokenString; + } + // UNSIGNED_NUBER + else if (isDigit.test(ch)) { + state.tokenize = tokenUnsignedNuber; + } + // ERROR + else { + state.tokenize = null; + return "error"; + } + + return state.tokenize(stream, state); + }, + + indent: function (state, textAfter) { + if (state.tokenize != null) return CodeMirror.Pass; + + var level = state.level; + if (/(algorithm)/.test(textAfter)) level--; + if (/(equation)/.test(textAfter)) level--; + if (/(initial algorithm)/.test(textAfter)) level--; + if (/(initial equation)/.test(textAfter)) level--; + if (/(end)/.test(textAfter)) level--; + + if (level > 0) + return indentUnit * level; + else + return 0; + }, + + blockCommentStart: "/*", + blockCommentEnd: "*/", + lineComment: "//" }; - }, + }); - token: function(stream, state) { - if(state.tokenize != null) { - return state.tokenize(stream, state); - } + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) + obj[words[i]] = true; + return obj; + } - if(stream.sol()) { - state.sol = true; - } + var modelicaKeywords = "algorithm and annotation assert block break class connect connector constant constrainedby der discrete each else elseif elsewhen encapsulated end enumeration equation expandable extends external false final flow for function if import impure in initial inner input loop model not operator or outer output package parameter partial protected public pure record redeclare replaceable return stream then true type when while within"; + var modelicaBuiltin = "abs acos actualStream asin atan atan2 cardinality ceil cos cosh delay div edge exp floor getInstanceName homotopy inStream integer log log10 mod pre reinit rem semiLinear sign sin sinh spatialDistribution sqrt tan tanh"; + var modelicaAtoms = "Real Boolean Integer String"; - // WHITESPACE - if(stream.eatSpace()) { - state.tokenize = null; - return null; - } + function def(mimes, mode) { + if (typeof mimes == "string") + mimes = [mimes]; - var ch = stream.next(); + var words = []; - // LINECOMMENT - if(ch == '/' && stream.eat('/')) { - state.tokenize = tokenLineComment; - } - // BLOCKCOMMENT - else if(ch == '/' && stream.eat('*')) { - state.tokenize = tokenBlockComment; - } - // TWO SYMBOL TOKENS - else if(isDoubleOperatorChar.test(ch+stream.peek())) { - stream.next(); - state.tokenize = null; - return "operator"; - } - // SINGLE SYMBOL TOKENS - else if(isSingleOperatorChar.test(ch)) { - state.tokenize = null; - return "operator"; - } - // IDENT - else if(isNonDigit.test(ch)) { - state.tokenize = tokenIdent; - } - // Q-IDENT - else if(ch == "'" && stream.peek() && stream.peek() != "'") { - state.tokenize = tokenQIdent; - } - // STRING - else if(ch == '"') { - state.tokenize = tokenString; - } - // UNSIGNED_NUBER - else if(isDigit.test(ch)) { - state.tokenize = tokenUnsignedNuber; - } - // ERROR - else { - state.tokenize = null; - return "error"; + function add(obj) { + if (obj) + for (var prop in obj) + if (obj.hasOwnProperty(prop)) + words.push(prop); } - return state.tokenize(stream, state); - }, - - indent: function(state, textAfter) { - if (state.tokenize != null) return CodeMirror.Pass; - - var level = state.level; - if(/(algorithm)/.test(textAfter)) level--; - if(/(equation)/.test(textAfter)) level--; - if(/(initial algorithm)/.test(textAfter)) level--; - if(/(initial equation)/.test(textAfter)) level--; - if(/(end)/.test(textAfter)) level--; - - if(level > 0) - return indentUnit*level; - else - return 0; - }, - - blockCommentStart: "/*", - blockCommentEnd: "*/", - lineComment: "//" - }; - }); - - function words(str) { - var obj = {}, words = str.split(" "); - for (var i=0; iCodeMirror: NGINX mode - + - + - - - + + + - +
-

NGINX mode

-

MIME types defined: text/nginx.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/nginx/nginx.js b/web/editor.md/lib/codemirror/mode/nginx/nginx.js index 135b9cc..3fb5ac4 100644 --- a/web/editor.md/lib/codemirror/mode/nginx/nginx.js +++ b/web/editor.md/lib/codemirror/mode/nginx/nginx.js @@ -1,178 +1,175 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("nginx", function(config) { - - function words(str) { - var obj = {}, words = str.split(" "); - for (var i = 0; i < words.length; ++i) obj[words[i]] = true; - return obj; - } - - var keywords = words( - /* ngxDirectiveControl */ "break return rewrite set" + - /* 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" - ); - - var keywords_block = words( - /* ngxDirectiveBlock */ "http mail events server types location upstream charset_map limit_except if geo map" - ); - - var keywords_important = words( - /* ngxDirectiveImportant */ "include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files" - ); - - var indentUnit = config.indentUnit, type; - function ret(style, tp) {type = tp; return style;} - - function tokenBase(stream, state) { - - - stream.eatWhile(/[\w\$_]/); - - var cur = stream.current(); - - - if (keywords.propertyIsEnumerable(cur)) { - return "keyword"; - } - else if (keywords_block.propertyIsEnumerable(cur)) { - return "variable-2"; - } - else if (keywords_important.propertyIsEnumerable(cur)) { - return "string-2"; - } - /**/ - - var ch = stream.next(); - if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());} - else if (ch == "/" && stream.eat("*")) { - state.tokenize = tokenCComment; - return tokenCComment(stream, state); - } - else if (ch == "<" && stream.eat("!")) { - state.tokenize = tokenSGMLComment; - return tokenSGMLComment(stream, state); - } - else if (ch == "=") ret(null, "compare"); - else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare"); - else if (ch == "\"" || ch == "'") { - state.tokenize = tokenString(ch); - return state.tokenize(stream, state); - } - else if (ch == "#") { - stream.skipToEnd(); - return ret("comment", "comment"); - } - else if (ch == "!") { - stream.match(/^\s*\w*/); - return ret("keyword", "important"); - } - else if (/\d/.test(ch)) { - stream.eatWhile(/[\w.%]/); - return ret("number", "unit"); - } - else if (/[,.+>*\/]/.test(ch)) { - return ret(null, "select-op"); - } - else if (/[;{}:\[\]]/.test(ch)) { - return ret(null, ch); - } - else { - stream.eatWhile(/[\w\\\-]/); - return ret("variable", "variable"); - } - } - - function tokenCComment(stream, state) { - var maybeEnd = false, ch; - while ((ch = stream.next()) != null) { - if (maybeEnd && ch == "/") { - state.tokenize = tokenBase; - break; - } - maybeEnd = (ch == "*"); - } - return ret("comment", "comment"); - } - - function tokenSGMLComment(stream, state) { - var dashes = 0, ch; - while ((ch = stream.next()) != null) { - if (dashes >= 2 && ch == ">") { - state.tokenize = tokenBase; - break; - } - dashes = (ch == "-") ? dashes + 1 : 0; - } - return ret("comment", "comment"); - } - - function tokenString(quote) { - return function(stream, state) { - var escaped = false, ch; - while ((ch = stream.next()) != null) { - if (ch == quote && !escaped) - break; - escaped = !escaped && ch == "\\"; - } - if (!escaped) state.tokenize = tokenBase; - return ret("string", "string"); - }; - } - - return { - startState: function(base) { - return {tokenize: tokenBase, - baseIndent: base || 0, - stack: []}; - }, - - token: function(stream, state) { - if (stream.eatSpace()) return null; - type = null; - var style = state.tokenize(stream, state); - - var context = state.stack[state.stack.length-1]; - if (type == "hash" && context == "rule") style = "atom"; - else if (style == "variable") { - if (context == "rule") style = "number"; - else if (!context || context == "@media{") style = "tag"; - } - - if (context == "rule" && /^[\{\};]$/.test(type)) - state.stack.pop(); - if (type == "{") { - if (context == "@media") state.stack[state.stack.length-1] = "@media{"; - else state.stack.push("{"); - } - else if (type == "}") state.stack.pop(); - else if (type == "@media") state.stack.push("@media"); - else if (context == "{" && type != "comment") state.stack.push("rule"); - return style; - }, - - indent: function(state, textAfter) { - var n = state.stack.length; - if (/^\}/.test(textAfter)) - n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1; - return state.baseIndent + n * indentUnit; - }, - - electricChars: "}" - }; -}); - -CodeMirror.defineMIME("text/nginx", "text/x-nginx-conf"); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("nginx", function (config) { + + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + var keywords = words( + /* ngxDirectiveControl */ "break return rewrite set" + + /* 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" + ); + + var keywords_block = words( + /* ngxDirectiveBlock */ "http mail events server types location upstream charset_map limit_except if geo map" + ); + + var keywords_important = words( + /* ngxDirectiveImportant */ "include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files" + ); + + var indentUnit = config.indentUnit, type; + + function ret(style, tp) { + type = tp; + return style; + } + + function tokenBase(stream, state) { + + + stream.eatWhile(/[\w\$_]/); + + var cur = stream.current(); + + + if (keywords.propertyIsEnumerable(cur)) { + return "keyword"; + } else if (keywords_block.propertyIsEnumerable(cur)) { + return "variable-2"; + } else if (keywords_important.propertyIsEnumerable(cur)) { + return "string-2"; + } + /**/ + + var ch = stream.next(); + if (ch == "@") { + stream.eatWhile(/[\w\\\-]/); + return ret("meta", stream.current()); + } else if (ch == "/" && stream.eat("*")) { + state.tokenize = tokenCComment; + return tokenCComment(stream, state); + } else if (ch == "<" && stream.eat("!")) { + state.tokenize = tokenSGMLComment; + return tokenSGMLComment(stream, state); + } else if (ch == "=") ret(null, "compare"); + else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare"); + else if (ch == "\"" || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } else if (ch == "#") { + stream.skipToEnd(); + return ret("comment", "comment"); + } else if (ch == "!") { + stream.match(/^\s*\w*/); + return ret("keyword", "important"); + } else if (/\d/.test(ch)) { + stream.eatWhile(/[\w.%]/); + return ret("number", "unit"); + } else if (/[,.+>*\/]/.test(ch)) { + return ret(null, "select-op"); + } else if (/[;{}:\[\]]/.test(ch)) { + return ret(null, ch); + } else { + stream.eatWhile(/[\w\\\-]/); + return ret("variable", "variable"); + } + } + + function tokenCComment(stream, state) { + var maybeEnd = false, ch; + while ((ch = stream.next()) != null) { + if (maybeEnd && ch == "/") { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return ret("comment", "comment"); + } + + function tokenSGMLComment(stream, state) { + var dashes = 0, ch; + while ((ch = stream.next()) != null) { + if (dashes >= 2 && ch == ">") { + state.tokenize = tokenBase; + break; + } + dashes = (ch == "-") ? dashes + 1 : 0; + } + return ret("comment", "comment"); + } + + function tokenString(quote) { + return function (stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) + break; + escaped = !escaped && ch == "\\"; + } + if (!escaped) state.tokenize = tokenBase; + return ret("string", "string"); + }; + } + + return { + startState: function (base) { + return { + tokenize: tokenBase, + baseIndent: base || 0, + stack: [] + }; + }, + + token: function (stream, state) { + if (stream.eatSpace()) return null; + type = null; + var style = state.tokenize(stream, state); + + var context = state.stack[state.stack.length - 1]; + if (type == "hash" && context == "rule") style = "atom"; + else if (style == "variable") { + if (context == "rule") style = "number"; + else if (!context || context == "@media{") style = "tag"; + } + + if (context == "rule" && /^[\{\};]$/.test(type)) + state.stack.pop(); + if (type == "{") { + if (context == "@media") state.stack[state.stack.length - 1] = "@media{"; + else state.stack.push("{"); + } else if (type == "}") state.stack.pop(); + else if (type == "@media") state.stack.push("@media"); + else if (context == "{" && type != "comment") state.stack.push("rule"); + return style; + }, + + indent: function (state, textAfter) { + var n = state.stack.length; + if (/^\}/.test(textAfter)) + n -= state.stack[state.stack.length - 1] == "rule" ? 2 : 1; + return state.baseIndent + n * indentUnit; + }, + + electricChars: "}" + }; + }); + + CodeMirror.defineMIME("text/nginx", "text/x-nginx-conf"); }); diff --git a/web/editor.md/lib/codemirror/mode/ntriples/index.html b/web/editor.md/lib/codemirror/mode/ntriples/index.html index 1355e71..6786c15 100644 --- a/web/editor.md/lib/codemirror/mode/ntriples/index.html +++ b/web/editor.md/lib/codemirror/mode/ntriples/index.html @@ -2,33 +2,33 @@ CodeMirror: NTriples mode - + - + + } +
-

NTriples mode

-
+

NTriples mode

+ -
+

MIME types defined: text/n-triples.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/ntriples/ntriples.js b/web/editor.md/lib/codemirror/mode/ntriples/ntriples.js index 0524b1e..be9df3d 100644 --- a/web/editor.md/lib/codemirror/mode/ntriples/ntriples.js +++ b/web/editor.md/lib/codemirror/mode/ntriples/ntriples.js @@ -2,11 +2,11 @@ // Distributed under an MIT license: http://codemirror.net/LICENSE /********************************************************** -* This script provides syntax highlighting support for -* the Ntriples format. -* Ntriples format specification: -* http://www.w3.org/TR/rdf-testcases/#ntriples -***********************************************************/ + * This script provides syntax highlighting support for + * the Ntriples format. + * Ntriples format specification: + * http://www.w3.org/TR/rdf-testcases/#ntriples + ***********************************************************/ /* The following expression defines the defined ASF grammar transitions. @@ -29,158 +29,191 @@ } */ -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("ntriples", function() { - - var Location = { - PRE_SUBJECT : 0, - WRITING_SUB_URI : 1, - WRITING_BNODE_URI : 2, - PRE_PRED : 3, - WRITING_PRED_URI : 4, - PRE_OBJ : 5, - WRITING_OBJ_URI : 6, - WRITING_OBJ_BNODE : 7, - WRITING_OBJ_LITERAL : 8, - WRITING_LIT_LANG : 9, - WRITING_LIT_TYPE : 10, - POST_OBJ : 11, - ERROR : 12 - }; - function transitState(currState, c) { - var currLocation = currState.location; - var ret; - - // Opening. - if (currLocation == Location.PRE_SUBJECT && c == '<') ret = Location.WRITING_SUB_URI; - else if(currLocation == Location.PRE_SUBJECT && c == '_') ret = Location.WRITING_BNODE_URI; - else if(currLocation == Location.PRE_PRED && c == '<') ret = Location.WRITING_PRED_URI; - else if(currLocation == Location.PRE_OBJ && c == '<') ret = Location.WRITING_OBJ_URI; - else if(currLocation == Location.PRE_OBJ && c == '_') ret = Location.WRITING_OBJ_BNODE; - else if(currLocation == Location.PRE_OBJ && c == '"') ret = Location.WRITING_OBJ_LITERAL; - - // Closing. - else if(currLocation == Location.WRITING_SUB_URI && c == '>') ret = Location.PRE_PRED; - else if(currLocation == Location.WRITING_BNODE_URI && c == ' ') ret = Location.PRE_PRED; - else if(currLocation == Location.WRITING_PRED_URI && c == '>') ret = Location.PRE_OBJ; - else if(currLocation == Location.WRITING_OBJ_URI && c == '>') ret = Location.POST_OBJ; - else if(currLocation == Location.WRITING_OBJ_BNODE && c == ' ') ret = Location.POST_OBJ; - else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '"') ret = Location.POST_OBJ; - else if(currLocation == Location.WRITING_LIT_LANG && c == ' ') ret = Location.POST_OBJ; - else if(currLocation == Location.WRITING_LIT_TYPE && c == '>') ret = Location.POST_OBJ; - - // Closing typed and language literal. - else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '@') ret = Location.WRITING_LIT_LANG; - else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '^') ret = Location.WRITING_LIT_TYPE; - - // Spaces. - else if( c == ' ' && - ( - currLocation == Location.PRE_SUBJECT || - currLocation == Location.PRE_PRED || - currLocation == Location.PRE_OBJ || - currLocation == Location.POST_OBJ - ) - ) ret = currLocation; - - // Reset. - else if(currLocation == Location.POST_OBJ && c == '.') ret = Location.PRE_SUBJECT; - - // Error - else ret = Location.ERROR; - - currState.location=ret; - } - - return { - startState: function() { - return { - location : Location.PRE_SUBJECT, - uris : [], - anchors : [], - bnodes : [], - langs : [], - types : [] - }; - }, - token: function(stream, state) { - var ch = stream.next(); - if(ch == '<') { - transitState(state, ch); - var parsedURI = ''; - stream.eatWhile( function(c) { if( c != '#' && c != '>' ) { parsedURI += c; return true; } return false;} ); - state.uris.push(parsedURI); - if( stream.match('#', false) ) return 'variable'; - stream.next(); - transitState(state, '>'); - return 'variable'; - } - if(ch == '#') { - var parsedAnchor = ''; - stream.eatWhile(function(c) { if(c != '>' && c != ' ') { parsedAnchor+= c; return true; } return false;}); - state.anchors.push(parsedAnchor); - return 'variable-2'; - } - if(ch == '>') { - transitState(state, '>'); - return 'variable'; - } - if(ch == '_') { - transitState(state, ch); - var parsedBNode = ''; - stream.eatWhile(function(c) { if( c != ' ' ) { parsedBNode += c; return true; } return false;}); - state.bnodes.push(parsedBNode); - stream.next(); - transitState(state, ' '); - return 'builtin'; - } - if(ch == '"') { - transitState(state, ch); - stream.eatWhile( function(c) { return c != '"'; } ); - stream.next(); - if( stream.peek() != '@' && stream.peek() != '^' ) { - transitState(state, '"'); - } - return 'string'; - } - if( ch == '@' ) { - transitState(state, '@'); - var parsedLang = ''; - stream.eatWhile(function(c) { if( c != ' ' ) { parsedLang += c; return true; } return false;}); - state.langs.push(parsedLang); - stream.next(); - transitState(state, ' '); - return 'string-2'; - } - if( ch == '^' ) { - stream.next(); - transitState(state, '^'); - var parsedType = ''; - stream.eatWhile(function(c) { if( c != '>' ) { parsedType += c; return true; } return false;} ); - state.types.push(parsedType); - stream.next(); - transitState(state, '>'); - return 'variable'; - } - if( ch == ' ' ) { - transitState(state, ch); - } - if( ch == '.' ) { - transitState(state, ch); - } - } - }; -}); - -CodeMirror.defineMIME("text/n-triples", "ntriples"); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("ntriples", function () { + + var Location = { + PRE_SUBJECT: 0, + WRITING_SUB_URI: 1, + WRITING_BNODE_URI: 2, + PRE_PRED: 3, + WRITING_PRED_URI: 4, + PRE_OBJ: 5, + WRITING_OBJ_URI: 6, + WRITING_OBJ_BNODE: 7, + WRITING_OBJ_LITERAL: 8, + WRITING_LIT_LANG: 9, + WRITING_LIT_TYPE: 10, + POST_OBJ: 11, + ERROR: 12 + }; + + function transitState(currState, c) { + var currLocation = currState.location; + var ret; + + // Opening. + if (currLocation == Location.PRE_SUBJECT && c == '<') ret = Location.WRITING_SUB_URI; + else if (currLocation == Location.PRE_SUBJECT && c == '_') ret = Location.WRITING_BNODE_URI; + else if (currLocation == Location.PRE_PRED && c == '<') ret = Location.WRITING_PRED_URI; + else if (currLocation == Location.PRE_OBJ && c == '<') ret = Location.WRITING_OBJ_URI; + else if (currLocation == Location.PRE_OBJ && c == '_') ret = Location.WRITING_OBJ_BNODE; + else if (currLocation == Location.PRE_OBJ && c == '"') ret = Location.WRITING_OBJ_LITERAL; + + // Closing. + else if (currLocation == Location.WRITING_SUB_URI && c == '>') ret = Location.PRE_PRED; + else if (currLocation == Location.WRITING_BNODE_URI && c == ' ') ret = Location.PRE_PRED; + else if (currLocation == Location.WRITING_PRED_URI && c == '>') ret = Location.PRE_OBJ; + else if (currLocation == Location.WRITING_OBJ_URI && c == '>') ret = Location.POST_OBJ; + else if (currLocation == Location.WRITING_OBJ_BNODE && c == ' ') ret = Location.POST_OBJ; + else if (currLocation == Location.WRITING_OBJ_LITERAL && c == '"') ret = Location.POST_OBJ; + else if (currLocation == Location.WRITING_LIT_LANG && c == ' ') ret = Location.POST_OBJ; + else if (currLocation == Location.WRITING_LIT_TYPE && c == '>') ret = Location.POST_OBJ; + + // Closing typed and language literal. + else if (currLocation == Location.WRITING_OBJ_LITERAL && c == '@') ret = Location.WRITING_LIT_LANG; + else if (currLocation == Location.WRITING_OBJ_LITERAL && c == '^') ret = Location.WRITING_LIT_TYPE; + + // Spaces. + else if (c == ' ' && + ( + currLocation == Location.PRE_SUBJECT || + currLocation == Location.PRE_PRED || + currLocation == Location.PRE_OBJ || + currLocation == Location.POST_OBJ + ) + ) ret = currLocation; + + // Reset. + else if (currLocation == Location.POST_OBJ && c == '.') ret = Location.PRE_SUBJECT; + + // Error + else ret = Location.ERROR; + + currState.location = ret; + } + + return { + startState: function () { + return { + location: Location.PRE_SUBJECT, + uris: [], + anchors: [], + bnodes: [], + langs: [], + types: [] + }; + }, + token: function (stream, state) { + var ch = stream.next(); + if (ch == '<') { + transitState(state, ch); + var parsedURI = ''; + stream.eatWhile(function (c) { + if (c != '#' && c != '>') { + parsedURI += c; + return true; + } + return false; + }); + state.uris.push(parsedURI); + if (stream.match('#', false)) return 'variable'; + stream.next(); + transitState(state, '>'); + return 'variable'; + } + if (ch == '#') { + var parsedAnchor = ''; + stream.eatWhile(function (c) { + if (c != '>' && c != ' ') { + parsedAnchor += c; + return true; + } + return false; + }); + state.anchors.push(parsedAnchor); + return 'variable-2'; + } + if (ch == '>') { + transitState(state, '>'); + return 'variable'; + } + if (ch == '_') { + transitState(state, ch); + var parsedBNode = ''; + stream.eatWhile(function (c) { + if (c != ' ') { + parsedBNode += c; + return true; + } + return false; + }); + state.bnodes.push(parsedBNode); + stream.next(); + transitState(state, ' '); + return 'builtin'; + } + if (ch == '"') { + transitState(state, ch); + stream.eatWhile(function (c) { + return c != '"'; + }); + stream.next(); + if (stream.peek() != '@' && stream.peek() != '^') { + transitState(state, '"'); + } + return 'string'; + } + if (ch == '@') { + transitState(state, '@'); + var parsedLang = ''; + stream.eatWhile(function (c) { + if (c != ' ') { + parsedLang += c; + return true; + } + return false; + }); + state.langs.push(parsedLang); + stream.next(); + transitState(state, ' '); + return 'string-2'; + } + if (ch == '^') { + stream.next(); + transitState(state, '^'); + var parsedType = ''; + stream.eatWhile(function (c) { + if (c != '>') { + parsedType += c; + return true; + } + return false; + }); + state.types.push(parsedType); + stream.next(); + transitState(state, '>'); + return 'variable'; + } + if (ch == ' ') { + transitState(state, ch); + } + if (ch == '.') { + transitState(state, ch); + } + } + }; + }); + + CodeMirror.defineMIME("text/n-triples", "ntriples"); }); diff --git a/web/editor.md/lib/codemirror/mode/octave/index.html b/web/editor.md/lib/codemirror/mode/octave/index.html index 79df581..40b1ad2 100644 --- a/web/editor.md/lib/codemirror/mode/octave/index.html +++ b/web/editor.md/lib/codemirror/mode/octave/index.html @@ -2,28 +2,31 @@ CodeMirror: Octave mode - + - + - +
-

Octave mode

+

Octave mode

MIME types defined: text/x-octave.

diff --git a/web/editor.md/lib/codemirror/mode/octave/octave.js b/web/editor.md/lib/codemirror/mode/octave/octave.js index a7bec03..48dcee6 100644 --- a/web/editor.md/lib/codemirror/mode/octave/octave.js +++ b/web/editor.md/lib/codemirror/mode/octave/octave.js @@ -1,135 +1,169 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("octave", function() { - function wordRegexp(words) { - return new RegExp("^((" + words.join(")|(") + "))\\b"); - } - - var singleOperators = new RegExp("^[\\+\\-\\*/&|\\^~<>!@'\\\\]"); - var singleDelimiters = new RegExp('^[\\(\\[\\{\\},:=;]'); - var doubleOperators = new RegExp("^((==)|(~=)|(<=)|(>=)|(<<)|(>>)|(\\.[\\+\\-\\*/\\^\\\\]))"); - var doubleDelimiters = new RegExp("^((!=)|(\\+=)|(\\-=)|(\\*=)|(/=)|(&=)|(\\|=)|(\\^=))"); - var tripleDelimiters = new RegExp("^((>>=)|(<<=))"); - var expressionEnd = new RegExp("^[\\]\\)]"); - var identifiers = new RegExp("^[_A-Za-z\xa1-\uffff][_A-Za-z0-9\xa1-\uffff]*"); - - var builtins = wordRegexp([ - 'error', 'eval', 'function', 'abs', 'acos', 'atan', 'asin', 'cos', - 'cosh', 'exp', 'log', 'prod', 'sum', 'log10', 'max', 'min', 'sign', 'sin', 'sinh', - 'sqrt', 'tan', 'reshape', 'break', 'zeros', 'default', 'margin', 'round', 'ones', - 'rand', 'syn', 'ceil', 'floor', 'size', 'clear', 'zeros', 'eye', 'mean', 'std', 'cov', - 'det', 'eig', 'inv', 'norm', 'rank', 'trace', 'expm', 'logm', 'sqrtm', 'linspace', 'plot', - 'title', 'xlabel', 'ylabel', 'legend', 'text', 'grid', 'meshgrid', 'mesh', 'num2str', - 'fft', 'ifft', 'arrayfun', 'cellfun', 'input', 'fliplr', 'flipud', 'ismember' - ]); - - var keywords = wordRegexp([ - 'return', 'case', 'switch', 'else', 'elseif', 'end', 'endif', 'endfunction', - 'if', 'otherwise', 'do', 'for', 'while', 'try', 'catch', 'classdef', 'properties', 'events', - 'methods', 'global', 'persistent', 'endfor', 'endwhile', 'printf', 'sprintf', 'disp', 'until', - 'continue', 'pkg' - ]); - - - // tokenizers - function tokenTranspose(stream, state) { - if (!stream.sol() && stream.peek() === '\'') { - stream.next(); - state.tokenize = tokenBase; - return 'operator'; - } - state.tokenize = tokenBase; - return tokenBase(stream, state); - } - - - function tokenComment(stream, state) { - if (stream.match(/^.*%}/)) { - state.tokenize = tokenBase; - return 'comment'; - }; - stream.skipToEnd(); - return 'comment'; - } - - function tokenBase(stream, state) { - // whitespaces - if (stream.eatSpace()) return null; - - // Handle one line Comments - if (stream.match('%{')){ - state.tokenize = tokenComment; - stream.skipToEnd(); - return 'comment'; - } - - if (stream.match(/^[%#]/)){ - stream.skipToEnd(); - return 'comment'; - } - - // Handle Number Literals - if (stream.match(/^[0-9\.+-]/, false)) { - if (stream.match(/^[+-]?0x[0-9a-fA-F]+[ij]?/)) { - stream.tokenize = tokenBase; - return 'number'; }; - if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?[ij]?/)) { return 'number'; }; - if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?[ij]?/)) { return 'number'; }; - } - if (stream.match(wordRegexp(['nan','NaN','inf','Inf']))) { return 'number'; }; - - // Handle Strings - if (stream.match(/^"([^"]|(""))*"/)) { return 'string'; } ; - if (stream.match(/^'([^']|(''))*'/)) { return 'string'; } ; - - // Handle words - if (stream.match(keywords)) { return 'keyword'; } ; - if (stream.match(builtins)) { return 'builtin'; } ; - if (stream.match(identifiers)) { return 'variable'; } ; - - if (stream.match(singleOperators) || stream.match(doubleOperators)) { return 'operator'; }; - if (stream.match(singleDelimiters) || stream.match(doubleDelimiters) || stream.match(tripleDelimiters)) { return null; }; - - if (stream.match(expressionEnd)) { - state.tokenize = tokenTranspose; - return null; - }; - - - // Handle non-detected items - stream.next(); - return 'error'; - }; - - - return { - startState: function() { - return { - tokenize: tokenBase - }; - }, - - token: function(stream, state) { - var style = state.tokenize(stream, state); - if (style === 'number' || style === 'variable'){ - state.tokenize = tokenTranspose; - } - return style; - } - }; -}); - -CodeMirror.defineMIME("text/x-octave", "octave"); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("octave", function () { + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b"); + } + + var singleOperators = new RegExp("^[\\+\\-\\*/&|\\^~<>!@'\\\\]"); + var singleDelimiters = new RegExp('^[\\(\\[\\{\\},:=;]'); + var doubleOperators = new RegExp("^((==)|(~=)|(<=)|(>=)|(<<)|(>>)|(\\.[\\+\\-\\*/\\^\\\\]))"); + var doubleDelimiters = new RegExp("^((!=)|(\\+=)|(\\-=)|(\\*=)|(/=)|(&=)|(\\|=)|(\\^=))"); + var tripleDelimiters = new RegExp("^((>>=)|(<<=))"); + var expressionEnd = new RegExp("^[\\]\\)]"); + var identifiers = new RegExp("^[_A-Za-z\xa1-\uffff][_A-Za-z0-9\xa1-\uffff]*"); + + var builtins = wordRegexp([ + 'error', 'eval', 'function', 'abs', 'acos', 'atan', 'asin', 'cos', + 'cosh', 'exp', 'log', 'prod', 'sum', 'log10', 'max', 'min', 'sign', 'sin', 'sinh', + 'sqrt', 'tan', 'reshape', 'break', 'zeros', 'default', 'margin', 'round', 'ones', + 'rand', 'syn', 'ceil', 'floor', 'size', 'clear', 'zeros', 'eye', 'mean', 'std', 'cov', + 'det', 'eig', 'inv', 'norm', 'rank', 'trace', 'expm', 'logm', 'sqrtm', 'linspace', 'plot', + 'title', 'xlabel', 'ylabel', 'legend', 'text', 'grid', 'meshgrid', 'mesh', 'num2str', + 'fft', 'ifft', 'arrayfun', 'cellfun', 'input', 'fliplr', 'flipud', 'ismember' + ]); + + var keywords = wordRegexp([ + 'return', 'case', 'switch', 'else', 'elseif', 'end', 'endif', 'endfunction', + 'if', 'otherwise', 'do', 'for', 'while', 'try', 'catch', 'classdef', 'properties', 'events', + 'methods', 'global', 'persistent', 'endfor', 'endwhile', 'printf', 'sprintf', 'disp', 'until', + 'continue', 'pkg' + ]); + + + // tokenizers + function tokenTranspose(stream, state) { + if (!stream.sol() && stream.peek() === '\'') { + stream.next(); + state.tokenize = tokenBase; + return 'operator'; + } + state.tokenize = tokenBase; + return tokenBase(stream, state); + } + + + function tokenComment(stream, state) { + if (stream.match(/^.*%}/)) { + state.tokenize = tokenBase; + return 'comment'; + } + ; + stream.skipToEnd(); + return 'comment'; + } + + function tokenBase(stream, state) { + // whitespaces + if (stream.eatSpace()) return null; + + // Handle one line Comments + if (stream.match('%{')) { + state.tokenize = tokenComment; + stream.skipToEnd(); + return 'comment'; + } + + if (stream.match(/^[%#]/)) { + stream.skipToEnd(); + return 'comment'; + } + + // Handle Number Literals + if (stream.match(/^[0-9\.+-]/, false)) { + if (stream.match(/^[+-]?0x[0-9a-fA-F]+[ij]?/)) { + stream.tokenize = tokenBase; + return 'number'; + } + ; + if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?[ij]?/)) { + return 'number'; + } + ; + if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?[ij]?/)) { + return 'number'; + } + ; + } + if (stream.match(wordRegexp(['nan', 'NaN', 'inf', 'Inf']))) { + return 'number'; + } + ; + + // Handle Strings + if (stream.match(/^"([^"]|(""))*"/)) { + return 'string'; + } + ; + if (stream.match(/^'([^']|(''))*'/)) { + return 'string'; + } + ; + + // Handle words + if (stream.match(keywords)) { + return 'keyword'; + } + ; + if (stream.match(builtins)) { + return 'builtin'; + } + ; + if (stream.match(identifiers)) { + return 'variable'; + } + ; + + if (stream.match(singleOperators) || stream.match(doubleOperators)) { + return 'operator'; + } + ; + if (stream.match(singleDelimiters) || stream.match(doubleDelimiters) || stream.match(tripleDelimiters)) { + return null; + } + ; + + if (stream.match(expressionEnd)) { + state.tokenize = tokenTranspose; + return null; + } + ; + + + // Handle non-detected items + stream.next(); + return 'error'; + }; + + + return { + startState: function () { + return { + tokenize: tokenBase + }; + }, + + token: function (stream, state) { + var style = state.tokenize(stream, state); + if (style === 'number' || style === 'variable') { + state.tokenize = tokenTranspose; + } + return style; + } + }; + }); + + CodeMirror.defineMIME("text/x-octave", "octave"); }); diff --git a/web/editor.md/lib/codemirror/mode/pascal/index.html b/web/editor.md/lib/codemirror/mode/pascal/index.html index f8a99ad..a70f515 100644 --- a/web/editor.md/lib/codemirror/mode/pascal/index.html +++ b/web/editor.md/lib/codemirror/mode/pascal/index.html @@ -2,31 +2,34 @@ CodeMirror: Pascal mode - + - + - +
-

Pascal mode

+

Pascal mode

-

MIME types defined: text/x-pascal.

-
+
diff --git a/web/editor.md/lib/codemirror/mode/pascal/pascal.js b/web/editor.md/lib/codemirror/mode/pascal/pascal.js index 2d0c3d4..8853ae0 100644 --- a/web/editor.md/lib/codemirror/mode/pascal/pascal.js +++ b/web/editor.md/lib/codemirror/mode/pascal/pascal.js @@ -1,109 +1,113 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("pascal", function() { - function words(str) { - var obj = {}, words = str.split(" "); - for (var i = 0; i < words.length; ++i) obj[words[i]] = true; - return obj; - } - var keywords = words("and array begin case const div do downto else end file for forward integer " + - "boolean char function goto if in label mod nil not of or packed procedure " + - "program record repeat set string then to type until var while with"); - var atoms = {"null": true}; + CodeMirror.defineMode("pascal", function () { + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } - var isOperatorChar = /[+\-*&%=<>!?|\/]/; + var keywords = words("and array begin case const div do downto else end file for forward integer " + + "boolean char function goto if in label mod nil not of or packed procedure " + + "program record repeat set string then to type until var while with"); + var atoms = {"null": true}; - function tokenBase(stream, state) { - var ch = stream.next(); - if (ch == "#" && state.startOfLine) { - stream.skipToEnd(); - return "meta"; - } - if (ch == '"' || ch == "'") { - state.tokenize = tokenString(ch); - return state.tokenize(stream, state); - } - if (ch == "(" && stream.eat("*")) { - state.tokenize = tokenComment; - return tokenComment(stream, state); - } - if (/[\[\]{}\(\),;\:\.]/.test(ch)) { - return null; - } - if (/\d/.test(ch)) { - stream.eatWhile(/[\w\.]/); - return "number"; - } - if (ch == "/") { - if (stream.eat("/")) { - stream.skipToEnd(); - return "comment"; - } - } - if (isOperatorChar.test(ch)) { - stream.eatWhile(isOperatorChar); - return "operator"; - } - stream.eatWhile(/[\w\$_]/); - var cur = stream.current(); - if (keywords.propertyIsEnumerable(cur)) return "keyword"; - if (atoms.propertyIsEnumerable(cur)) return "atom"; - return "variable"; - } + var isOperatorChar = /[+\-*&%=<>!?|\/]/; - function tokenString(quote) { - return function(stream, state) { - var escaped = false, next, end = false; - while ((next = stream.next()) != null) { - if (next == quote && !escaped) {end = true; break;} - escaped = !escaped && next == "\\"; - } - if (end || !escaped) state.tokenize = null; - return "string"; - }; - } + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == "#" && state.startOfLine) { + stream.skipToEnd(); + return "meta"; + } + if (ch == '"' || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + if (ch == "(" && stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (/[\[\]{}\(\),;\:\.]/.test(ch)) { + return null; + } + if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } + if (ch == "/") { + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + } + if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + stream.eatWhile(/[\w\$_]/); + var cur = stream.current(); + if (keywords.propertyIsEnumerable(cur)) return "keyword"; + if (atoms.propertyIsEnumerable(cur)) return "atom"; + return "variable"; + } - function tokenComment(stream, state) { - var maybeEnd = false, ch; - while (ch = stream.next()) { - if (ch == ")" && maybeEnd) { - state.tokenize = null; - break; - } - maybeEnd = (ch == "*"); - } - return "comment"; - } + function tokenString(quote) { + return function (stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) { + end = true; + break; + } + escaped = !escaped && next == "\\"; + } + if (end || !escaped) state.tokenize = null; + return "string"; + }; + } - // Interface + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == ")" && maybeEnd) { + state.tokenize = null; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } - return { - startState: function() { - return {tokenize: null}; - }, + // Interface - token: function(stream, state) { - if (stream.eatSpace()) return null; - var style = (state.tokenize || tokenBase)(stream, state); - if (style == "comment" || style == "meta") return style; - return style; - }, + return { + startState: function () { + return {tokenize: null}; + }, - electricChars: "{}" - }; -}); + token: function (stream, state) { + if (stream.eatSpace()) return null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment" || style == "meta") return style; + return style; + }, + + electricChars: "{}" + }; + }); -CodeMirror.defineMIME("text/x-pascal", "pascal"); + CodeMirror.defineMIME("text/x-pascal", "pascal"); }); diff --git a/web/editor.md/lib/codemirror/mode/pegjs/index.html b/web/editor.md/lib/codemirror/mode/pegjs/index.html index 0c74604..f7c414e 100644 --- a/web/editor.md/lib/codemirror/mode/pegjs/index.html +++ b/web/editor.md/lib/codemirror/mode/pegjs/index.html @@ -1,34 +1,37 @@ - + CodeMirror: PEG.js Mode - + - + - - - - -
-

PEG.js Mode

-
- -

The PEG.js Mode

-

Created by Forbes Lindesay.

-
- + +

The PEG.js Mode

+

Created by Forbes Lindesay.

+ + diff --git a/web/editor.md/lib/codemirror/mode/pegjs/pegjs.js b/web/editor.md/lib/codemirror/mode/pegjs/pegjs.js index 306e376..94227d9 100644 --- a/web/editor.md/lib/codemirror/mode/pegjs/pegjs.js +++ b/web/editor.md/lib/codemirror/mode/pegjs/pegjs.js @@ -1,114 +1,115 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../javascript/javascript")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../javascript/javascript"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../javascript/javascript")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../javascript/javascript"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("pegjs", function (config) { - var jsMode = CodeMirror.getMode(config, "javascript"); + CodeMirror.defineMode("pegjs", function (config) { + var jsMode = CodeMirror.getMode(config, "javascript"); - function identifier(stream) { - return stream.match(/^[a-zA-Z_][a-zA-Z0-9_]*/); - } + function identifier(stream) { + return stream.match(/^[a-zA-Z_][a-zA-Z0-9_]*/); + } - return { - startState: function () { - return { - inString: false, - stringType: null, - inComment: false, - inChracterClass: false, - braced: 0, - lhs: true, - localState: null - }; - }, - token: function (stream, state) { - if (stream) + return { + startState: function () { + return { + inString: false, + stringType: null, + inComment: false, + inChracterClass: false, + braced: 0, + lhs: true, + localState: null + }; + }, + token: function (stream, state) { + if (stream) - //check for state changes - if (!state.inString && !state.inComment && ((stream.peek() == '"') || (stream.peek() == "'"))) { - state.stringType = stream.peek(); - stream.next(); // Skip quote - state.inString = true; // Update state - } - if (!state.inString && !state.inComment && stream.match(/^\/\*/)) { - state.inComment = true; - } + //check for state changes + if (!state.inString && !state.inComment && ((stream.peek() == '"') || (stream.peek() == "'"))) { + state.stringType = stream.peek(); + stream.next(); // Skip quote + state.inString = true; // Update state + } + if (!state.inString && !state.inComment && stream.match(/^\/\*/)) { + state.inComment = true; + } - //return state - if (state.inString) { - while (state.inString && !stream.eol()) { - if (stream.peek() === state.stringType) { - stream.next(); // Skip quote - state.inString = false; // Clear flag - } else if (stream.peek() === '\\') { - stream.next(); - stream.next(); - } else { - stream.match(/^.[^\\\"\']*/); - } - } - return state.lhs ? "property string" : "string"; // Token style - } else if (state.inComment) { - while (state.inComment && !stream.eol()) { - if (stream.match(/\*\//)) { - state.inComment = false; // Clear flag - } else { - stream.match(/^.[^\*]*/); - } - } - return "comment"; - } else if (state.inChracterClass) { - while (state.inChracterClass && !stream.eol()) { - if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./))) { - state.inChracterClass = false; + //return state + if (state.inString) { + while (state.inString && !stream.eol()) { + if (stream.peek() === state.stringType) { + stream.next(); // Skip quote + state.inString = false; // Clear flag + } else if (stream.peek() === '\\') { + stream.next(); + stream.next(); + } else { + stream.match(/^.[^\\\"\']*/); + } + } + return state.lhs ? "property string" : "string"; // Token style + } else if (state.inComment) { + while (state.inComment && !stream.eol()) { + if (stream.match(/\*\//)) { + state.inComment = false; // Clear flag + } else { + stream.match(/^.[^\*]*/); + } + } + return "comment"; + } else if (state.inChracterClass) { + while (state.inChracterClass && !stream.eol()) { + if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./))) { + state.inChracterClass = false; + } + } + } else if (stream.peek() === '[') { + stream.next(); + state.inChracterClass = true; + return 'bracket'; + } else if (stream.match(/^\/\//)) { + stream.skipToEnd(); + return "comment"; + } else if (state.braced || stream.peek() === '{') { + if (state.localState === null) { + state.localState = jsMode.startState(); + } + var token = jsMode.token(stream, state.localState); + var text = stream.current(); + if (!token) { + for (var i = 0; i < text.length; i++) { + if (text[i] === '{') { + state.braced++; + } else if (text[i] === '}') { + state.braced--; + } + } + ; + } + return token; + } else if (identifier(stream)) { + if (stream.peek() === ':') { + return 'variable'; + } + return 'variable-2'; + } else if (['[', ']', '(', ')'].indexOf(stream.peek()) != -1) { + stream.next(); + return 'bracket'; + } else if (!stream.eatSpace()) { + stream.next(); + } + return null; } - } - } else if (stream.peek() === '[') { - stream.next(); - state.inChracterClass = true; - return 'bracket'; - } else if (stream.match(/^\/\//)) { - stream.skipToEnd(); - return "comment"; - } else if (state.braced || stream.peek() === '{') { - if (state.localState === null) { - state.localState = jsMode.startState(); - } - var token = jsMode.token(stream, state.localState); - var text = stream.current(); - if (!token) { - for (var i = 0; i < text.length; i++) { - if (text[i] === '{') { - state.braced++; - } else if (text[i] === '}') { - state.braced--; - } - }; - } - return token; - } else if (identifier(stream)) { - if (stream.peek() === ':') { - return 'variable'; - } - return 'variable-2'; - } else if (['[', ']', '(', ')'].indexOf(stream.peek()) != -1) { - stream.next(); - return 'bracket'; - } else if (!stream.eatSpace()) { - stream.next(); - } - return null; - } - }; -}, "javascript"); + }; + }, "javascript"); }); diff --git a/web/editor.md/lib/codemirror/mode/perl/index.html b/web/editor.md/lib/codemirror/mode/perl/index.html index 8c1021c..9bca507 100644 --- a/web/editor.md/lib/codemirror/mode/perl/index.html +++ b/web/editor.md/lib/codemirror/mode/perl/index.html @@ -2,31 +2,34 @@ CodeMirror: Perl mode - + - + - +
-

Perl mode

+

Perl mode

-

MIME types defined: text/x-perl.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/perl/perl.js b/web/editor.md/lib/codemirror/mode/perl/perl.js index bef62bc..e8f6c00 100644 --- a/web/editor.md/lib/codemirror/mode/perl/perl.js +++ b/web/editor.md/lib/codemirror/mode/perl/perl.js @@ -4,784 +4,860 @@ // CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08) // This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com) -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("perl",function(){ + CodeMirror.defineMode("perl", function () { // http://perldoc.perl.org - var PERL={ // null - magic touch - // 1 - keyword - // 2 - def - // 3 - atom - // 4 - operator - // 5 - variable-2 (predefined) - // [x,y] - x=1,2,3; y=must be defined if x{...} - // PERL operators - '->' : 4, - '++' : 4, - '--' : 4, - '**' : 4, - // ! ~ \ and unary + and - - '=~' : 4, - '!~' : 4, - '*' : 4, - '/' : 4, - '%' : 4, - 'x' : 4, - '+' : 4, - '-' : 4, - '.' : 4, - '<<' : 4, - '>>' : 4, - // named unary operators - '<' : 4, - '>' : 4, - '<=' : 4, - '>=' : 4, - 'lt' : 4, - 'gt' : 4, - 'le' : 4, - 'ge' : 4, - '==' : 4, - '!=' : 4, - '<=>' : 4, - 'eq' : 4, - 'ne' : 4, - 'cmp' : 4, - '~~' : 4, - '&' : 4, - '|' : 4, - '^' : 4, - '&&' : 4, - '||' : 4, - '//' : 4, - '..' : 4, - '...' : 4, - '?' : 4, - ':' : 4, - '=' : 4, - '+=' : 4, - '-=' : 4, - '*=' : 4, // etc. ??? - ',' : 4, - '=>' : 4, - '::' : 4, - // list operators (rightward) - 'not' : 4, - 'and' : 4, - 'or' : 4, - 'xor' : 4, - // PERL predefined variables (I know, what this is a paranoid idea, but may be needed for people, who learn PERL, and for me as well, ...and may be for you?;) - 'BEGIN' : [5,1], - 'END' : [5,1], - 'PRINT' : [5,1], - 'PRINTF' : [5,1], - 'GETC' : [5,1], - 'READ' : [5,1], - 'READLINE' : [5,1], - 'DESTROY' : [5,1], - 'TIE' : [5,1], - 'TIEHANDLE' : [5,1], - 'UNTIE' : [5,1], - 'STDIN' : 5, - 'STDIN_TOP' : 5, - 'STDOUT' : 5, - 'STDOUT_TOP' : 5, - 'STDERR' : 5, - 'STDERR_TOP' : 5, - '$ARG' : 5, - '$_' : 5, - '@ARG' : 5, - '@_' : 5, - '$LIST_SEPARATOR' : 5, - '$"' : 5, - '$PROCESS_ID' : 5, - '$PID' : 5, - '$$' : 5, - '$REAL_GROUP_ID' : 5, - '$GID' : 5, - '$(' : 5, - '$EFFECTIVE_GROUP_ID' : 5, - '$EGID' : 5, - '$)' : 5, - '$PROGRAM_NAME' : 5, - '$0' : 5, - '$SUBSCRIPT_SEPARATOR' : 5, - '$SUBSEP' : 5, - '$;' : 5, - '$REAL_USER_ID' : 5, - '$UID' : 5, - '$<' : 5, - '$EFFECTIVE_USER_ID' : 5, - '$EUID' : 5, - '$>' : 5, - '$a' : 5, - '$b' : 5, - '$COMPILING' : 5, - '$^C' : 5, - '$DEBUGGING' : 5, - '$^D' : 5, - '${^ENCODING}' : 5, - '$ENV' : 5, - '%ENV' : 5, - '$SYSTEM_FD_MAX' : 5, - '$^F' : 5, - '@F' : 5, - '${^GLOBAL_PHASE}' : 5, - '$^H' : 5, - '%^H' : 5, - '@INC' : 5, - '%INC' : 5, - '$INPLACE_EDIT' : 5, - '$^I' : 5, - '$^M' : 5, - '$OSNAME' : 5, - '$^O' : 5, - '${^OPEN}' : 5, - '$PERLDB' : 5, - '$^P' : 5, - '$SIG' : 5, - '%SIG' : 5, - '$BASETIME' : 5, - '$^T' : 5, - '${^TAINT}' : 5, - '${^UNICODE}' : 5, - '${^UTF8CACHE}' : 5, - '${^UTF8LOCALE}' : 5, - '$PERL_VERSION' : 5, - '$^V' : 5, - '${^WIN32_SLOPPY_STAT}' : 5, - '$EXECUTABLE_NAME' : 5, - '$^X' : 5, - '$1' : 5, // - regexp $1, $2... - '$MATCH' : 5, - '$&' : 5, - '${^MATCH}' : 5, - '$PREMATCH' : 5, - '$`' : 5, - '${^PREMATCH}' : 5, - '$POSTMATCH' : 5, - "$'" : 5, - '${^POSTMATCH}' : 5, - '$LAST_PAREN_MATCH' : 5, - '$+' : 5, - '$LAST_SUBMATCH_RESULT' : 5, - '$^N' : 5, - '@LAST_MATCH_END' : 5, - '@+' : 5, - '%LAST_PAREN_MATCH' : 5, - '%+' : 5, - '@LAST_MATCH_START' : 5, - '@-' : 5, - '%LAST_MATCH_START' : 5, - '%-' : 5, - '$LAST_REGEXP_CODE_RESULT' : 5, - '$^R' : 5, - '${^RE_DEBUG_FLAGS}' : 5, - '${^RE_TRIE_MAXBUF}' : 5, - '$ARGV' : 5, - '@ARGV' : 5, - 'ARGV' : 5, - 'ARGVOUT' : 5, - '$OUTPUT_FIELD_SEPARATOR' : 5, - '$OFS' : 5, - '$,' : 5, - '$INPUT_LINE_NUMBER' : 5, - '$NR' : 5, - '$.' : 5, - '$INPUT_RECORD_SEPARATOR' : 5, - '$RS' : 5, - '$/' : 5, - '$OUTPUT_RECORD_SEPARATOR' : 5, - '$ORS' : 5, - '$\\' : 5, - '$OUTPUT_AUTOFLUSH' : 5, - '$|' : 5, - '$ACCUMULATOR' : 5, - '$^A' : 5, - '$FORMAT_FORMFEED' : 5, - '$^L' : 5, - '$FORMAT_PAGE_NUMBER' : 5, - '$%' : 5, - '$FORMAT_LINES_LEFT' : 5, - '$-' : 5, - '$FORMAT_LINE_BREAK_CHARACTERS' : 5, - '$:' : 5, - '$FORMAT_LINES_PER_PAGE' : 5, - '$=' : 5, - '$FORMAT_TOP_NAME' : 5, - '$^' : 5, - '$FORMAT_NAME' : 5, - '$~' : 5, - '${^CHILD_ERROR_NATIVE}' : 5, - '$EXTENDED_OS_ERROR' : 5, - '$^E' : 5, - '$EXCEPTIONS_BEING_CAUGHT' : 5, - '$^S' : 5, - '$WARNING' : 5, - '$^W' : 5, - '${^WARNING_BITS}' : 5, - '$OS_ERROR' : 5, - '$ERRNO' : 5, - '$!' : 5, - '%OS_ERROR' : 5, - '%ERRNO' : 5, - '%!' : 5, - '$CHILD_ERROR' : 5, - '$?' : 5, - '$EVAL_ERROR' : 5, - '$@' : 5, - '$OFMT' : 5, - '$#' : 5, - '$*' : 5, - '$ARRAY_BASE' : 5, - '$[' : 5, - '$OLD_PERL_VERSION' : 5, - '$]' : 5, - // PERL blocks - 'if' :[1,1], - elsif :[1,1], - 'else' :[1,1], - 'while' :[1,1], - unless :[1,1], - 'for' :[1,1], - foreach :[1,1], - // PERL functions - 'abs' :1, // - absolute value function - accept :1, // - accept an incoming socket connect - alarm :1, // - schedule a SIGALRM - 'atan2' :1, // - arctangent of Y/X in the range -PI to PI - bind :1, // - binds an address to a socket - binmode :1, // - prepare binary files for I/O - bless :1, // - create an object - bootstrap :1, // - 'break' :1, // - break out of a "given" block - caller :1, // - get context of the current subroutine call - chdir :1, // - change your current working directory - chmod :1, // - changes the permissions on a list of files - chomp :1, // - remove a trailing record separator from a string - chop :1, // - remove the last character from a string - chown :1, // - change the owership on a list of files - chr :1, // - get character this number represents - chroot :1, // - make directory new root for path lookups - close :1, // - close file (or pipe or socket) handle - closedir :1, // - close directory handle - connect :1, // - connect to a remote socket - 'continue' :[1,1], // - optional trailing block in a while or foreach - 'cos' :1, // - cosine function - crypt :1, // - one-way passwd-style encryption - dbmclose :1, // - breaks binding on a tied dbm file - dbmopen :1, // - create binding on a tied dbm file - 'default' :1, // - defined :1, // - test whether a value, variable, or function is defined - 'delete' :1, // - deletes a value from a hash - die :1, // - raise an exception or bail out - 'do' :1, // - turn a BLOCK into a TERM - dump :1, // - create an immediate core dump - each :1, // - retrieve the next key/value pair from a hash - endgrent :1, // - be done using group file - endhostent :1, // - be done using hosts file - endnetent :1, // - be done using networks file - endprotoent :1, // - be done using protocols file - endpwent :1, // - be done using passwd file - endservent :1, // - be done using services file - eof :1, // - test a filehandle for its end - 'eval' :1, // - catch exceptions or compile and run code - 'exec' :1, // - abandon this program to run another - exists :1, // - test whether a hash key is present - exit :1, // - terminate this program - 'exp' :1, // - raise I to a power - fcntl :1, // - file control system call - fileno :1, // - return file descriptor from filehandle - flock :1, // - lock an entire file with an advisory lock - fork :1, // - create a new process just like this one - format :1, // - declare a picture format with use by the write() function - formline :1, // - internal function used for formats - getc :1, // - get the next character from the filehandle - getgrent :1, // - get next group record - getgrgid :1, // - get group record given group user ID - getgrnam :1, // - get group record given group name - gethostbyaddr :1, // - get host record given its address - gethostbyname :1, // - get host record given name - gethostent :1, // - get next hosts record - getlogin :1, // - return who logged in at this tty - getnetbyaddr :1, // - get network record given its address - getnetbyname :1, // - get networks record given name - getnetent :1, // - get next networks record - getpeername :1, // - find the other end of a socket connection - getpgrp :1, // - get process group - getppid :1, // - get parent process ID - getpriority :1, // - get current nice value - getprotobyname :1, // - get protocol record given name - getprotobynumber :1, // - get protocol record numeric protocol - getprotoent :1, // - get next protocols record - getpwent :1, // - get next passwd record - getpwnam :1, // - get passwd record given user login name - getpwuid :1, // - get passwd record given user ID - getservbyname :1, // - get services record given its name - getservbyport :1, // - get services record given numeric port - getservent :1, // - get next services record - getsockname :1, // - retrieve the sockaddr for a given socket - getsockopt :1, // - get socket options on a given socket - given :1, // - glob :1, // - expand filenames using wildcards - gmtime :1, // - convert UNIX time into record or string using Greenwich time - 'goto' :1, // - create spaghetti code - grep :1, // - locate elements in a list test true against a given criterion - hex :1, // - convert a string to a hexadecimal number - 'import' :1, // - patch a module's namespace into your own - index :1, // - find a substring within a string - 'int' :1, // - get the integer portion of a number - ioctl :1, // - system-dependent device control system call - 'join' :1, // - join a list into a string using a separator - keys :1, // - retrieve list of indices from a hash - kill :1, // - send a signal to a process or process group - last :1, // - exit a block prematurely - lc :1, // - return lower-case version of a string - lcfirst :1, // - return a string with just the next letter in lower case - length :1, // - return the number of bytes in a string - 'link' :1, // - create a hard link in the filesytem - listen :1, // - register your socket as a server - local : 2, // - create a temporary value for a global variable (dynamic scoping) - localtime :1, // - convert UNIX time into record or string using local time - lock :1, // - get a thread lock on a variable, subroutine, or method - 'log' :1, // - retrieve the natural logarithm for a number - lstat :1, // - stat a symbolic link - m :null, // - match a string with a regular expression pattern - map :1, // - apply a change to a list to get back a new list with the changes - mkdir :1, // - create a directory - msgctl :1, // - SysV IPC message control operations - msgget :1, // - get SysV IPC message queue - msgrcv :1, // - receive a SysV IPC message from a message queue - msgsnd :1, // - send a SysV IPC message to a message queue - my : 2, // - declare and assign a local variable (lexical scoping) - 'new' :1, // - next :1, // - iterate a block prematurely - no :1, // - unimport some module symbols or semantics at compile time - oct :1, // - convert a string to an octal number - open :1, // - open a file, pipe, or descriptor - opendir :1, // - open a directory - ord :1, // - find a character's numeric representation - our : 2, // - declare and assign a package variable (lexical scoping) - pack :1, // - convert a list into a binary representation - 'package' :1, // - declare a separate global namespace - pipe :1, // - open a pair of connected filehandles - pop :1, // - remove the last element from an array and return it - pos :1, // - find or set the offset for the last/next m//g search - print :1, // - output a list to a filehandle - printf :1, // - output a formatted list to a filehandle - prototype :1, // - get the prototype (if any) of a subroutine - push :1, // - append one or more elements to an array - q :null, // - singly quote a string - qq :null, // - doubly quote a string - qr :null, // - Compile pattern - quotemeta :null, // - quote regular expression magic characters - qw :null, // - quote a list of words - qx :null, // - backquote quote a string - rand :1, // - retrieve the next pseudorandom number - read :1, // - fixed-length buffered input from a filehandle - readdir :1, // - get a directory from a directory handle - readline :1, // - fetch a record from a file - readlink :1, // - determine where a symbolic link is pointing - readpipe :1, // - execute a system command and collect standard output - recv :1, // - receive a message over a Socket - redo :1, // - start this loop iteration over again - ref :1, // - find out the type of thing being referenced - rename :1, // - change a filename - require :1, // - load in external functions from a library at runtime - reset :1, // - clear all variables of a given name - 'return' :1, // - get out of a function early - reverse :1, // - flip a string or a list - rewinddir :1, // - reset directory handle - rindex :1, // - right-to-left substring search - rmdir :1, // - remove a directory - s :null, // - replace a pattern with a string - say :1, // - print with newline - scalar :1, // - force a scalar context - seek :1, // - reposition file pointer for random-access I/O - seekdir :1, // - reposition directory pointer - select :1, // - reset default output or do I/O multiplexing - semctl :1, // - SysV semaphore control operations - semget :1, // - get set of SysV semaphores - semop :1, // - SysV semaphore operations - send :1, // - send a message over a socket - setgrent :1, // - prepare group file for use - sethostent :1, // - prepare hosts file for use - setnetent :1, // - prepare networks file for use - setpgrp :1, // - set the process group of a process - setpriority :1, // - set a process's nice value - setprotoent :1, // - prepare protocols file for use - setpwent :1, // - prepare passwd file for use - setservent :1, // - prepare services file for use - setsockopt :1, // - set some socket options - shift :1, // - remove the first element of an array, and return it - shmctl :1, // - SysV shared memory operations - shmget :1, // - get SysV shared memory segment identifier - shmread :1, // - read SysV shared memory - shmwrite :1, // - write SysV shared memory - shutdown :1, // - close down just half of a socket connection - 'sin' :1, // - return the sine of a number - sleep :1, // - block for some number of seconds - socket :1, // - create a socket - socketpair :1, // - create a pair of sockets - 'sort' :1, // - sort a list of values - splice :1, // - add or remove elements anywhere in an array - 'split' :1, // - split up a string using a regexp delimiter - sprintf :1, // - formatted print into a string - 'sqrt' :1, // - square root function - srand :1, // - seed the random number generator - stat :1, // - get a file's status information - state :1, // - declare and assign a state variable (persistent lexical scoping) - study :1, // - optimize input data for repeated searches - 'sub' :1, // - declare a subroutine, possibly anonymously - 'substr' :1, // - get or alter a portion of a stirng - symlink :1, // - create a symbolic link to a file - syscall :1, // - execute an arbitrary system call - sysopen :1, // - open a file, pipe, or descriptor - sysread :1, // - fixed-length unbuffered input from a filehandle - sysseek :1, // - position I/O pointer on handle used with sysread and syswrite - system :1, // - run a separate program - syswrite :1, // - fixed-length unbuffered output to a filehandle - tell :1, // - get current seekpointer on a filehandle - telldir :1, // - get current seekpointer on a directory handle - tie :1, // - bind a variable to an object class - tied :1, // - get a reference to the object underlying a tied variable - time :1, // - return number of seconds since 1970 - times :1, // - return elapsed time for self and child processes - tr :null, // - transliterate a string - truncate :1, // - shorten a file - uc :1, // - return upper-case version of a string - ucfirst :1, // - return a string with just the next letter in upper case - umask :1, // - set file creation mode mask - undef :1, // - remove a variable or function definition - unlink :1, // - remove one link to a file - unpack :1, // - convert binary structure into normal perl variables - unshift :1, // - prepend more elements to the beginning of a list - untie :1, // - break a tie binding to a variable - use :1, // - load in a module at compile time - utime :1, // - set a file's last access and modify times - values :1, // - return a list of the values in a hash - vec :1, // - test or set particular bits in a string - wait :1, // - wait for any child process to die - waitpid :1, // - wait for a particular child process to die - wantarray :1, // - get void vs scalar vs list context of current subroutine call - warn :1, // - print debugging info - when :1, // - write :1, // - print a picture record - y :null}; // - transliterate a string + var PERL = { // null - magic touch + // 1 - keyword + // 2 - def + // 3 - atom + // 4 - operator + // 5 - variable-2 (predefined) + // [x,y] - x=1,2,3; y=must be defined if x{...} + // PERL operators + '->': 4, + '++': 4, + '--': 4, + '**': 4, + // ! ~ \ and unary + and - + '=~': 4, + '!~': 4, + '*': 4, + '/': 4, + '%': 4, + 'x': 4, + '+': 4, + '-': 4, + '.': 4, + '<<': 4, + '>>': 4, + // named unary operators + '<': 4, + '>': 4, + '<=': 4, + '>=': 4, + 'lt': 4, + 'gt': 4, + 'le': 4, + 'ge': 4, + '==': 4, + '!=': 4, + '<=>': 4, + 'eq': 4, + 'ne': 4, + 'cmp': 4, + '~~': 4, + '&': 4, + '|': 4, + '^': 4, + '&&': 4, + '||': 4, + '//': 4, + '..': 4, + '...': 4, + '?': 4, + ':': 4, + '=': 4, + '+=': 4, + '-=': 4, + '*=': 4, // etc. ??? + ',': 4, + '=>': 4, + '::': 4, + // list operators (rightward) + 'not': 4, + 'and': 4, + 'or': 4, + 'xor': 4, + // PERL predefined variables (I know, what this is a paranoid idea, but may be needed for people, who learn PERL, and for me as well, ...and may be for you?;) + 'BEGIN': [5, 1], + 'END': [5, 1], + 'PRINT': [5, 1], + 'PRINTF': [5, 1], + 'GETC': [5, 1], + 'READ': [5, 1], + 'READLINE': [5, 1], + 'DESTROY': [5, 1], + 'TIE': [5, 1], + 'TIEHANDLE': [5, 1], + 'UNTIE': [5, 1], + 'STDIN': 5, + 'STDIN_TOP': 5, + 'STDOUT': 5, + 'STDOUT_TOP': 5, + 'STDERR': 5, + 'STDERR_TOP': 5, + '$ARG': 5, + '$_': 5, + '@ARG': 5, + '@_': 5, + '$LIST_SEPARATOR': 5, + '$"': 5, + '$PROCESS_ID': 5, + '$PID': 5, + '$$': 5, + '$REAL_GROUP_ID': 5, + '$GID': 5, + '$(': 5, + '$EFFECTIVE_GROUP_ID': 5, + '$EGID': 5, + '$)': 5, + '$PROGRAM_NAME': 5, + '$0': 5, + '$SUBSCRIPT_SEPARATOR': 5, + '$SUBSEP': 5, + '$;': 5, + '$REAL_USER_ID': 5, + '$UID': 5, + '$<': 5, + '$EFFECTIVE_USER_ID': 5, + '$EUID': 5, + '$>': 5, + '$a': 5, + '$b': 5, + '$COMPILING': 5, + '$^C': 5, + '$DEBUGGING': 5, + '$^D': 5, + '${^ENCODING}': 5, + '$ENV': 5, + '%ENV': 5, + '$SYSTEM_FD_MAX': 5, + '$^F': 5, + '@F': 5, + '${^GLOBAL_PHASE}': 5, + '$^H': 5, + '%^H': 5, + '@INC': 5, + '%INC': 5, + '$INPLACE_EDIT': 5, + '$^I': 5, + '$^M': 5, + '$OSNAME': 5, + '$^O': 5, + '${^OPEN}': 5, + '$PERLDB': 5, + '$^P': 5, + '$SIG': 5, + '%SIG': 5, + '$BASETIME': 5, + '$^T': 5, + '${^TAINT}': 5, + '${^UNICODE}': 5, + '${^UTF8CACHE}': 5, + '${^UTF8LOCALE}': 5, + '$PERL_VERSION': 5, + '$^V': 5, + '${^WIN32_SLOPPY_STAT}': 5, + '$EXECUTABLE_NAME': 5, + '$^X': 5, + '$1': 5, // - regexp $1, $2... + '$MATCH': 5, + '$&': 5, + '${^MATCH}': 5, + '$PREMATCH': 5, + '$`': 5, + '${^PREMATCH}': 5, + '$POSTMATCH': 5, + "$'": 5, + '${^POSTMATCH}': 5, + '$LAST_PAREN_MATCH': 5, + '$+': 5, + '$LAST_SUBMATCH_RESULT': 5, + '$^N': 5, + '@LAST_MATCH_END': 5, + '@+': 5, + '%LAST_PAREN_MATCH': 5, + '%+': 5, + '@LAST_MATCH_START': 5, + '@-': 5, + '%LAST_MATCH_START': 5, + '%-': 5, + '$LAST_REGEXP_CODE_RESULT': 5, + '$^R': 5, + '${^RE_DEBUG_FLAGS}': 5, + '${^RE_TRIE_MAXBUF}': 5, + '$ARGV': 5, + '@ARGV': 5, + 'ARGV': 5, + 'ARGVOUT': 5, + '$OUTPUT_FIELD_SEPARATOR': 5, + '$OFS': 5, + '$,': 5, + '$INPUT_LINE_NUMBER': 5, + '$NR': 5, + '$.': 5, + '$INPUT_RECORD_SEPARATOR': 5, + '$RS': 5, + '$/': 5, + '$OUTPUT_RECORD_SEPARATOR': 5, + '$ORS': 5, + '$\\': 5, + '$OUTPUT_AUTOFLUSH': 5, + '$|': 5, + '$ACCUMULATOR': 5, + '$^A': 5, + '$FORMAT_FORMFEED': 5, + '$^L': 5, + '$FORMAT_PAGE_NUMBER': 5, + '$%': 5, + '$FORMAT_LINES_LEFT': 5, + '$-': 5, + '$FORMAT_LINE_BREAK_CHARACTERS': 5, + '$:': 5, + '$FORMAT_LINES_PER_PAGE': 5, + '$=': 5, + '$FORMAT_TOP_NAME': 5, + '$^': 5, + '$FORMAT_NAME': 5, + '$~': 5, + '${^CHILD_ERROR_NATIVE}': 5, + '$EXTENDED_OS_ERROR': 5, + '$^E': 5, + '$EXCEPTIONS_BEING_CAUGHT': 5, + '$^S': 5, + '$WARNING': 5, + '$^W': 5, + '${^WARNING_BITS}': 5, + '$OS_ERROR': 5, + '$ERRNO': 5, + '$!': 5, + '%OS_ERROR': 5, + '%ERRNO': 5, + '%!': 5, + '$CHILD_ERROR': 5, + '$?': 5, + '$EVAL_ERROR': 5, + '$@': 5, + '$OFMT': 5, + '$#': 5, + '$*': 5, + '$ARRAY_BASE': 5, + '$[': 5, + '$OLD_PERL_VERSION': 5, + '$]': 5, + // PERL blocks + 'if': [1, 1], + elsif: [1, 1], + 'else': [1, 1], + 'while': [1, 1], + unless: [1, 1], + 'for': [1, 1], + foreach: [1, 1], + // PERL functions + 'abs': 1, // - absolute value function + accept: 1, // - accept an incoming socket connect + alarm: 1, // - schedule a SIGALRM + 'atan2': 1, // - arctangent of Y/X in the range -PI to PI + bind: 1, // - binds an address to a socket + binmode: 1, // - prepare binary files for I/O + bless: 1, // - create an object + bootstrap: 1, // + 'break': 1, // - break out of a "given" block + caller: 1, // - get context of the current subroutine call + chdir: 1, // - change your current working directory + chmod: 1, // - changes the permissions on a list of files + chomp: 1, // - remove a trailing record separator from a string + chop: 1, // - remove the last character from a string + chown: 1, // - change the owership on a list of files + chr: 1, // - get character this number represents + chroot: 1, // - make directory new root for path lookups + close: 1, // - close file (or pipe or socket) handle + closedir: 1, // - close directory handle + connect: 1, // - connect to a remote socket + 'continue': [1, 1], // - optional trailing block in a while or foreach + 'cos': 1, // - cosine function + crypt: 1, // - one-way passwd-style encryption + dbmclose: 1, // - breaks binding on a tied dbm file + dbmopen: 1, // - create binding on a tied dbm file + 'default': 1, // + defined: 1, // - test whether a value, variable, or function is defined + 'delete': 1, // - deletes a value from a hash + die: 1, // - raise an exception or bail out + 'do': 1, // - turn a BLOCK into a TERM + dump: 1, // - create an immediate core dump + each: 1, // - retrieve the next key/value pair from a hash + endgrent: 1, // - be done using group file + endhostent: 1, // - be done using hosts file + endnetent: 1, // - be done using networks file + endprotoent: 1, // - be done using protocols file + endpwent: 1, // - be done using passwd file + endservent: 1, // - be done using services file + eof: 1, // - test a filehandle for its end + 'eval': 1, // - catch exceptions or compile and run code + 'exec': 1, // - abandon this program to run another + exists: 1, // - test whether a hash key is present + exit: 1, // - terminate this program + 'exp': 1, // - raise I to a power + fcntl: 1, // - file control system call + fileno: 1, // - return file descriptor from filehandle + flock: 1, // - lock an entire file with an advisory lock + fork: 1, // - create a new process just like this one + format: 1, // - declare a picture format with use by the write() function + formline: 1, // - internal function used for formats + getc: 1, // - get the next character from the filehandle + getgrent: 1, // - get next group record + getgrgid: 1, // - get group record given group user ID + getgrnam: 1, // - get group record given group name + gethostbyaddr: 1, // - get host record given its address + gethostbyname: 1, // - get host record given name + gethostent: 1, // - get next hosts record + getlogin: 1, // - return who logged in at this tty + getnetbyaddr: 1, // - get network record given its address + getnetbyname: 1, // - get networks record given name + getnetent: 1, // - get next networks record + getpeername: 1, // - find the other end of a socket connection + getpgrp: 1, // - get process group + getppid: 1, // - get parent process ID + getpriority: 1, // - get current nice value + getprotobyname: 1, // - get protocol record given name + getprotobynumber: 1, // - get protocol record numeric protocol + getprotoent: 1, // - get next protocols record + getpwent: 1, // - get next passwd record + getpwnam: 1, // - get passwd record given user login name + getpwuid: 1, // - get passwd record given user ID + getservbyname: 1, // - get services record given its name + getservbyport: 1, // - get services record given numeric port + getservent: 1, // - get next services record + getsockname: 1, // - retrieve the sockaddr for a given socket + getsockopt: 1, // - get socket options on a given socket + given: 1, // + glob: 1, // - expand filenames using wildcards + gmtime: 1, // - convert UNIX time into record or string using Greenwich time + 'goto': 1, // - create spaghetti code + grep: 1, // - locate elements in a list test true against a given criterion + hex: 1, // - convert a string to a hexadecimal number + 'import': 1, // - patch a module's namespace into your own + index: 1, // - find a substring within a string + 'int': 1, // - get the integer portion of a number + ioctl: 1, // - system-dependent device control system call + 'join': 1, // - join a list into a string using a separator + keys: 1, // - retrieve list of indices from a hash + kill: 1, // - send a signal to a process or process group + last: 1, // - exit a block prematurely + lc: 1, // - return lower-case version of a string + lcfirst: 1, // - return a string with just the next letter in lower case + length: 1, // - return the number of bytes in a string + 'link': 1, // - create a hard link in the filesytem + listen: 1, // - register your socket as a server + local: 2, // - create a temporary value for a global variable (dynamic scoping) + localtime: 1, // - convert UNIX time into record or string using local time + lock: 1, // - get a thread lock on a variable, subroutine, or method + 'log': 1, // - retrieve the natural logarithm for a number + lstat: 1, // - stat a symbolic link + m: null, // - match a string with a regular expression pattern + map: 1, // - apply a change to a list to get back a new list with the changes + mkdir: 1, // - create a directory + msgctl: 1, // - SysV IPC message control operations + msgget: 1, // - get SysV IPC message queue + msgrcv: 1, // - receive a SysV IPC message from a message queue + msgsnd: 1, // - send a SysV IPC message to a message queue + my: 2, // - declare and assign a local variable (lexical scoping) + 'new': 1, // + next: 1, // - iterate a block prematurely + no: 1, // - unimport some module symbols or semantics at compile time + oct: 1, // - convert a string to an octal number + open: 1, // - open a file, pipe, or descriptor + opendir: 1, // - open a directory + ord: 1, // - find a character's numeric representation + our: 2, // - declare and assign a package variable (lexical scoping) + pack: 1, // - convert a list into a binary representation + 'package': 1, // - declare a separate global namespace + pipe: 1, // - open a pair of connected filehandles + pop: 1, // - remove the last element from an array and return it + pos: 1, // - find or set the offset for the last/next m//g search + print: 1, // - output a list to a filehandle + printf: 1, // - output a formatted list to a filehandle + prototype: 1, // - get the prototype (if any) of a subroutine + push: 1, // - append one or more elements to an array + q: null, // - singly quote a string + qq: null, // - doubly quote a string + qr: null, // - Compile pattern + quotemeta: null, // - quote regular expression magic characters + qw: null, // - quote a list of words + qx: null, // - backquote quote a string + rand: 1, // - retrieve the next pseudorandom number + read: 1, // - fixed-length buffered input from a filehandle + readdir: 1, // - get a directory from a directory handle + readline: 1, // - fetch a record from a file + readlink: 1, // - determine where a symbolic link is pointing + readpipe: 1, // - execute a system command and collect standard output + recv: 1, // - receive a message over a Socket + redo: 1, // - start this loop iteration over again + ref: 1, // - find out the type of thing being referenced + rename: 1, // - change a filename + require: 1, // - load in external functions from a library at runtime + reset: 1, // - clear all variables of a given name + 'return': 1, // - get out of a function early + reverse: 1, // - flip a string or a list + rewinddir: 1, // - reset directory handle + rindex: 1, // - right-to-left substring search + rmdir: 1, // - remove a directory + s: null, // - replace a pattern with a string + say: 1, // - print with newline + scalar: 1, // - force a scalar context + seek: 1, // - reposition file pointer for random-access I/O + seekdir: 1, // - reposition directory pointer + select: 1, // - reset default output or do I/O multiplexing + semctl: 1, // - SysV semaphore control operations + semget: 1, // - get set of SysV semaphores + semop: 1, // - SysV semaphore operations + send: 1, // - send a message over a socket + setgrent: 1, // - prepare group file for use + sethostent: 1, // - prepare hosts file for use + setnetent: 1, // - prepare networks file for use + setpgrp: 1, // - set the process group of a process + setpriority: 1, // - set a process's nice value + setprotoent: 1, // - prepare protocols file for use + setpwent: 1, // - prepare passwd file for use + setservent: 1, // - prepare services file for use + setsockopt: 1, // - set some socket options + shift: 1, // - remove the first element of an array, and return it + shmctl: 1, // - SysV shared memory operations + shmget: 1, // - get SysV shared memory segment identifier + shmread: 1, // - read SysV shared memory + shmwrite: 1, // - write SysV shared memory + shutdown: 1, // - close down just half of a socket connection + 'sin': 1, // - return the sine of a number + sleep: 1, // - block for some number of seconds + socket: 1, // - create a socket + socketpair: 1, // - create a pair of sockets + 'sort': 1, // - sort a list of values + splice: 1, // - add or remove elements anywhere in an array + 'split': 1, // - split up a string using a regexp delimiter + sprintf: 1, // - formatted print into a string + 'sqrt': 1, // - square root function + srand: 1, // - seed the random number generator + stat: 1, // - get a file's status information + state: 1, // - declare and assign a state variable (persistent lexical scoping) + study: 1, // - optimize input data for repeated searches + 'sub': 1, // - declare a subroutine, possibly anonymously + 'substr': 1, // - get or alter a portion of a stirng + symlink: 1, // - create a symbolic link to a file + syscall: 1, // - execute an arbitrary system call + sysopen: 1, // - open a file, pipe, or descriptor + sysread: 1, // - fixed-length unbuffered input from a filehandle + sysseek: 1, // - position I/O pointer on handle used with sysread and syswrite + system: 1, // - run a separate program + syswrite: 1, // - fixed-length unbuffered output to a filehandle + tell: 1, // - get current seekpointer on a filehandle + telldir: 1, // - get current seekpointer on a directory handle + tie: 1, // - bind a variable to an object class + tied: 1, // - get a reference to the object underlying a tied variable + time: 1, // - return number of seconds since 1970 + times: 1, // - return elapsed time for self and child processes + tr: null, // - transliterate a string + truncate: 1, // - shorten a file + uc: 1, // - return upper-case version of a string + ucfirst: 1, // - return a string with just the next letter in upper case + umask: 1, // - set file creation mode mask + undef: 1, // - remove a variable or function definition + unlink: 1, // - remove one link to a file + unpack: 1, // - convert binary structure into normal perl variables + unshift: 1, // - prepend more elements to the beginning of a list + untie: 1, // - break a tie binding to a variable + use: 1, // - load in a module at compile time + utime: 1, // - set a file's last access and modify times + values: 1, // - return a list of the values in a hash + vec: 1, // - test or set particular bits in a string + wait: 1, // - wait for any child process to die + waitpid: 1, // - wait for a particular child process to die + wantarray: 1, // - get void vs scalar vs list context of current subroutine call + warn: 1, // - print debugging info + when: 1, // + write: 1, // - print a picture record + y: null + }; // - transliterate a string - var RXstyle="string-2"; - var RXmodifiers=/[goseximacplud]/; // NOTE: "m", "s", "y" and "tr" need to correct real modifiers for each regexp type + var RXstyle = "string-2"; + var RXmodifiers = /[goseximacplud]/; // NOTE: "m", "s", "y" and "tr" need to correct real modifiers for each regexp type - function tokenChain(stream,state,chain,style,tail){ // NOTE: chain.length > 2 is not working now (it's for s[...][...]geos;) - state.chain=null; // 12 3tail - state.style=null; - state.tail=null; - state.tokenize=function(stream,state){ - var e=false,c,i=0; - while(c=stream.next()){ - if(c===chain[i]&&!e){ - if(chain[++i]!==undefined){ - state.chain=chain[i]; - state.style=style; - state.tail=tail;} - else if(tail) - stream.eatWhile(tail); - state.tokenize=tokenPerl; - return style;} - e=!e&&c=="\\";} - return style;}; - return state.tokenize(stream,state);} + function tokenChain(stream, state, chain, style, tail) { // NOTE: chain.length > 2 is not working now (it's for s[...][...]geos;) + state.chain = null; // 12 3tail + state.style = null; + state.tail = null; + state.tokenize = function (stream, state) { + var e = false, c, i = 0; + while (c = stream.next()) { + if (c === chain[i] && !e) { + if (chain[++i] !== undefined) { + state.chain = chain[i]; + state.style = style; + state.tail = tail; + } else if (tail) + stream.eatWhile(tail); + state.tokenize = tokenPerl; + return style; + } + e = !e && c == "\\"; + } + return style; + }; + return state.tokenize(stream, state); + } - function tokenSOMETHING(stream,state,string){ - state.tokenize=function(stream,state){ - if(stream.string==string) - state.tokenize=tokenPerl; - stream.skipToEnd(); - return "string";}; - return state.tokenize(stream,state);} + function tokenSOMETHING(stream, state, string) { + state.tokenize = function (stream, state) { + if (stream.string == string) + state.tokenize = tokenPerl; + stream.skipToEnd(); + return "string"; + }; + return state.tokenize(stream, state); + } - function tokenPerl(stream,state){ - if(stream.eatSpace()) - return null; - if(state.chain) - return tokenChain(stream,state,state.chain,state.style,state.tail); - if(stream.match(/^\-?[\d\.]/,false)) - if(stream.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/)) - return 'number'; - if(stream.match(/^<<(?=\w)/)){ // NOTE: <"],RXstyle,RXmodifiers);} - if(/[\^'"!~\/]/.test(c)){ - eatSuffix(stream, 1); - return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers);}} - else if(c=="q"){ - c=look(stream, 1); - if(c=="("){ - eatSuffix(stream, 2); - return tokenChain(stream,state,[")"],"string");} - if(c=="["){ - eatSuffix(stream, 2); - return tokenChain(stream,state,["]"],"string");} - if(c=="{"){ - eatSuffix(stream, 2); - return tokenChain(stream,state,["}"],"string");} - if(c=="<"){ - eatSuffix(stream, 2); - return tokenChain(stream,state,[">"],"string");} - if(/[\^'"!~\/]/.test(c)){ - eatSuffix(stream, 1); - return tokenChain(stream,state,[stream.eat(c)],"string");}} - else if(c=="w"){ - c=look(stream, 1); - if(c=="("){ - eatSuffix(stream, 2); - return tokenChain(stream,state,[")"],"bracket");} - if(c=="["){ - eatSuffix(stream, 2); - return tokenChain(stream,state,["]"],"bracket");} - if(c=="{"){ - eatSuffix(stream, 2); - return tokenChain(stream,state,["}"],"bracket");} - if(c=="<"){ - eatSuffix(stream, 2); - return tokenChain(stream,state,[">"],"bracket");} - if(/[\^'"!~\/]/.test(c)){ - eatSuffix(stream, 1); - return tokenChain(stream,state,[stream.eat(c)],"bracket");}} - else if(c=="r"){ - c=look(stream, 1); - if(c=="("){ - eatSuffix(stream, 2); - return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);} - if(c=="["){ - eatSuffix(stream, 2); - return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);} - if(c=="{"){ - eatSuffix(stream, 2); - return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);} - if(c=="<"){ - eatSuffix(stream, 2); - return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);} - if(/[\^'"!~\/]/.test(c)){ - eatSuffix(stream, 1); - return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers);}} - else if(/[\^'"!~\/(\[{<]/.test(c)){ - if(c=="("){ - eatSuffix(stream, 1); - return tokenChain(stream,state,[")"],"string");} - if(c=="["){ - eatSuffix(stream, 1); - return tokenChain(stream,state,["]"],"string");} - if(c=="{"){ - eatSuffix(stream, 1); - return tokenChain(stream,state,["}"],"string");} - if(c=="<"){ - eatSuffix(stream, 1); - return tokenChain(stream,state,[">"],"string");} - if(/[\^'"!~\/]/.test(c)){ - return tokenChain(stream,state,[stream.eat(c)],"string");}}}} - if(ch=="m"){ - var c=look(stream, -2); - if(!(c&&/\w/.test(c))){ - c=stream.eat(/[(\[{<\^'"!~\/]/); - if(c){ - if(/[\^'"!~\/]/.test(c)){ - return tokenChain(stream,state,[c],RXstyle,RXmodifiers);} - if(c=="("){ - return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);} - if(c=="["){ - return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);} - if(c=="{"){ - return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);} - if(c=="<"){ - return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}}}} - if(ch=="s"){ - var c=/[\/>\]})\w]/.test(look(stream, -2)); - if(!c){ - c=stream.eat(/[(\[{<\^'"!~\/]/); - if(c){ - if(c=="[") - return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers); - if(c=="{") - return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers); - if(c=="<") - return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers); - if(c=="(") - return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers); - return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}} - if(ch=="y"){ - var c=/[\/>\]})\w]/.test(look(stream, -2)); - if(!c){ - c=stream.eat(/[(\[{<\^'"!~\/]/); - if(c){ - if(c=="[") - return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers); - if(c=="{") - return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers); - if(c=="<") - return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers); - if(c=="(") - return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers); - return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}} - if(ch=="t"){ - var c=/[\/>\]})\w]/.test(look(stream, -2)); - if(!c){ - c=stream.eat("r");if(c){ - c=stream.eat(/[(\[{<\^'"!~\/]/); - if(c){ - if(c=="[") - return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers); - if(c=="{") - return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers); - if(c=="<") - return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers); - if(c=="(") - return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers); - return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}}} - if(ch=="`"){ - return tokenChain(stream,state,[ch],"variable-2");} - if(ch=="/"){ - if(!/~\s*$/.test(prefix(stream))) - return "operator"; + function tokenPerl(stream, state) { + if (stream.eatSpace()) + return null; + if (state.chain) + return tokenChain(stream, state, state.chain, state.style, state.tail); + if (stream.match(/^\-?[\d\.]/, false)) + if (stream.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/)) + return 'number'; + if (stream.match(/^<<(?=\w)/)) { // NOTE: <"], RXstyle, RXmodifiers); + } + if (/[\^'"!~\/]/.test(c)) { + eatSuffix(stream, 1); + return tokenChain(stream, state, [stream.eat(c)], RXstyle, RXmodifiers); + } + } else if (c == "q") { + c = look(stream, 1); + if (c == "(") { + eatSuffix(stream, 2); + return tokenChain(stream, state, [")"], "string"); + } + if (c == "[") { + eatSuffix(stream, 2); + return tokenChain(stream, state, ["]"], "string"); + } + if (c == "{") { + eatSuffix(stream, 2); + return tokenChain(stream, state, ["}"], "string"); + } + if (c == "<") { + eatSuffix(stream, 2); + return tokenChain(stream, state, [">"], "string"); + } + if (/[\^'"!~\/]/.test(c)) { + eatSuffix(stream, 1); + return tokenChain(stream, state, [stream.eat(c)], "string"); + } + } else if (c == "w") { + c = look(stream, 1); + if (c == "(") { + eatSuffix(stream, 2); + return tokenChain(stream, state, [")"], "bracket"); + } + if (c == "[") { + eatSuffix(stream, 2); + return tokenChain(stream, state, ["]"], "bracket"); + } + if (c == "{") { + eatSuffix(stream, 2); + return tokenChain(stream, state, ["}"], "bracket"); + } + if (c == "<") { + eatSuffix(stream, 2); + return tokenChain(stream, state, [">"], "bracket"); + } + if (/[\^'"!~\/]/.test(c)) { + eatSuffix(stream, 1); + return tokenChain(stream, state, [stream.eat(c)], "bracket"); + } + } else if (c == "r") { + c = look(stream, 1); + if (c == "(") { + eatSuffix(stream, 2); + return tokenChain(stream, state, [")"], RXstyle, RXmodifiers); + } + if (c == "[") { + eatSuffix(stream, 2); + return tokenChain(stream, state, ["]"], RXstyle, RXmodifiers); + } + if (c == "{") { + eatSuffix(stream, 2); + return tokenChain(stream, state, ["}"], RXstyle, RXmodifiers); + } + if (c == "<") { + eatSuffix(stream, 2); + return tokenChain(stream, state, [">"], RXstyle, RXmodifiers); + } + if (/[\^'"!~\/]/.test(c)) { + eatSuffix(stream, 1); + return tokenChain(stream, state, [stream.eat(c)], RXstyle, RXmodifiers); + } + } else if (/[\^'"!~\/(\[{<]/.test(c)) { + if (c == "(") { + eatSuffix(stream, 1); + return tokenChain(stream, state, [")"], "string"); + } + if (c == "[") { + eatSuffix(stream, 1); + return tokenChain(stream, state, ["]"], "string"); + } + if (c == "{") { + eatSuffix(stream, 1); + return tokenChain(stream, state, ["}"], "string"); + } + if (c == "<") { + eatSuffix(stream, 1); + return tokenChain(stream, state, [">"], "string"); + } + if (/[\^'"!~\/]/.test(c)) { + return tokenChain(stream, state, [stream.eat(c)], "string"); + } + } + } + } + if (ch == "m") { + var c = look(stream, -2); + if (!(c && /\w/.test(c))) { + c = stream.eat(/[(\[{<\^'"!~\/]/); + if (c) { + if (/[\^'"!~\/]/.test(c)) { + return tokenChain(stream, state, [c], RXstyle, RXmodifiers); + } + if (c == "(") { + return tokenChain(stream, state, [")"], RXstyle, RXmodifiers); + } + if (c == "[") { + return tokenChain(stream, state, ["]"], RXstyle, RXmodifiers); + } + if (c == "{") { + return tokenChain(stream, state, ["}"], RXstyle, RXmodifiers); + } + if (c == "<") { + return tokenChain(stream, state, [">"], RXstyle, RXmodifiers); + } + } + } + } + if (ch == "s") { + var c = /[\/>\]})\w]/.test(look(stream, -2)); + if (!c) { + c = stream.eat(/[(\[{<\^'"!~\/]/); + if (c) { + if (c == "[") + return tokenChain(stream, state, ["]", "]"], RXstyle, RXmodifiers); + if (c == "{") + return tokenChain(stream, state, ["}", "}"], RXstyle, RXmodifiers); + if (c == "<") + return tokenChain(stream, state, [">", ">"], RXstyle, RXmodifiers); + if (c == "(") + return tokenChain(stream, state, [")", ")"], RXstyle, RXmodifiers); + return tokenChain(stream, state, [c, c], RXstyle, RXmodifiers); + } + } + } + if (ch == "y") { + var c = /[\/>\]})\w]/.test(look(stream, -2)); + if (!c) { + c = stream.eat(/[(\[{<\^'"!~\/]/); + if (c) { + if (c == "[") + return tokenChain(stream, state, ["]", "]"], RXstyle, RXmodifiers); + if (c == "{") + return tokenChain(stream, state, ["}", "}"], RXstyle, RXmodifiers); + if (c == "<") + return tokenChain(stream, state, [">", ">"], RXstyle, RXmodifiers); + if (c == "(") + return tokenChain(stream, state, [")", ")"], RXstyle, RXmodifiers); + return tokenChain(stream, state, [c, c], RXstyle, RXmodifiers); + } + } + } + if (ch == "t") { + var c = /[\/>\]})\w]/.test(look(stream, -2)); + if (!c) { + c = stream.eat("r"); + if (c) { + c = stream.eat(/[(\[{<\^'"!~\/]/); + if (c) { + if (c == "[") + return tokenChain(stream, state, ["]", "]"], RXstyle, RXmodifiers); + if (c == "{") + return tokenChain(stream, state, ["}", "}"], RXstyle, RXmodifiers); + if (c == "<") + return tokenChain(stream, state, [">", ">"], RXstyle, RXmodifiers); + if (c == "(") + return tokenChain(stream, state, [")", ")"], RXstyle, RXmodifiers); + return tokenChain(stream, state, [c, c], RXstyle, RXmodifiers); + } + } + } + } + if (ch == "`") { + return tokenChain(stream, state, [ch], "variable-2"); + } + if (ch == "/") { + if (!/~\s*$/.test(prefix(stream))) + return "operator"; + else + return tokenChain(stream, state, [ch], RXstyle, RXmodifiers); + } + if (ch == "$") { + var p = stream.pos; + if (stream.eatWhile(/\d/) || stream.eat("{") && stream.eatWhile(/\d/) && stream.eat("}")) + return "variable-2"; + else + stream.pos = p; + } + if (/[$@%]/.test(ch)) { + var p = stream.pos; + if (stream.eat("^") && stream.eat(/[A-Z]/) || !/[@$%&]/.test(look(stream, -2)) && stream.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)) { + var c = stream.current(); + if (PERL[c]) + return "variable-2"; + } + stream.pos = p; + } + if (/[$@%&]/.test(ch)) { + if (stream.eatWhile(/[\w$\[\]]/) || stream.eat("{") && stream.eatWhile(/[\w$\[\]]/) && stream.eat("}")) { + var c = stream.current(); + if (PERL[c]) + return "variable-2"; + else + return "variable"; + } + } + if (ch == "#") { + if (look(stream, -2) != "$") { + stream.skipToEnd(); + return "comment"; + } + } + if (/[:+\-\^*$&%@=<>!?|\/~\.]/.test(ch)) { + var p = stream.pos; + stream.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/); + if (PERL[stream.current()]) + return "operator"; + else + stream.pos = p; + } + if (ch == "_") { + if (stream.pos == 1) { + if (suffix(stream, 6) == "_END__") { + return tokenChain(stream, state, ['\0'], "comment"); + } else if (suffix(stream, 7) == "_DATA__") { + return tokenChain(stream, state, ['\0'], "variable-2"); + } else if (suffix(stream, 7) == "_C__") { + return tokenChain(stream, state, ['\0'], "string"); + } + } + } + if (/\w/.test(ch)) { + var p = stream.pos; + if (look(stream, -2) == "{" && (look(stream, 0) == "}" || stream.eatWhile(/\w/) && look(stream, 0) == "}")) + return "string"; + else + stream.pos = p; + } + if (/[A-Z]/.test(ch)) { + var l = look(stream, -2); + var p = stream.pos; + stream.eatWhile(/[A-Z_]/); + if (/[\da-z]/.test(look(stream, 0))) { + stream.pos = p; + } else { + var c = PERL[stream.current()]; + if (!c) + return "meta"; + if (c[1]) + c = c[0]; + if (l != ":") { + if (c == 1) + return "keyword"; + else if (c == 2) + return "def"; + else if (c == 3) + return "atom"; + else if (c == 4) + return "operator"; + else if (c == 5) + return "variable-2"; else - return tokenChain(stream,state,[ch],RXstyle,RXmodifiers);} - if(ch=="$"){ - var p=stream.pos; - if(stream.eatWhile(/\d/)||stream.eat("{")&&stream.eatWhile(/\d/)&&stream.eat("}")) - return "variable-2"; - else - stream.pos=p;} - if(/[$@%]/.test(ch)){ - var p=stream.pos; - if(stream.eat("^")&&stream.eat(/[A-Z]/)||!/[@$%&]/.test(look(stream, -2))&&stream.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){ - var c=stream.current(); - if(PERL[c]) - return "variable-2";} - stream.pos=p;} - if(/[$@%&]/.test(ch)){ - if(stream.eatWhile(/[\w$\[\]]/)||stream.eat("{")&&stream.eatWhile(/[\w$\[\]]/)&&stream.eat("}")){ - var c=stream.current(); - if(PERL[c]) - return "variable-2"; - else - return "variable";}} - if(ch=="#"){ - if(look(stream, -2)!="$"){ - stream.skipToEnd(); - return "comment";}} - if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(ch)){ - var p=stream.pos; - stream.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/); - if(PERL[stream.current()]) - return "operator"; - else - stream.pos=p;} - if(ch=="_"){ - if(stream.pos==1){ - if(suffix(stream, 6)=="_END__"){ - return tokenChain(stream,state,['\0'],"comment");} - else if(suffix(stream, 7)=="_DATA__"){ - return tokenChain(stream,state,['\0'],"variable-2");} - else if(suffix(stream, 7)=="_C__"){ - return tokenChain(stream,state,['\0'],"string");}}} - if(/\w/.test(ch)){ - var p=stream.pos; - if(look(stream, -2)=="{"&&(look(stream, 0)=="}"||stream.eatWhile(/\w/)&&look(stream, 0)=="}")) - return "string"; - else - stream.pos=p;} - if(/[A-Z]/.test(ch)){ - var l=look(stream, -2); - var p=stream.pos; - stream.eatWhile(/[A-Z_]/); - if(/[\da-z]/.test(look(stream, 0))){ - stream.pos=p;} - else{ - var c=PERL[stream.current()]; - if(!c) - return "meta"; - if(c[1]) - c=c[0]; - if(l!=":"){ - if(c==1) - return "keyword"; - else if(c==2) - return "def"; - else if(c==3) - return "atom"; - else if(c==4) - return "operator"; - else if(c==5) - return "variable-2"; - else - return "meta";} - else - return "meta";}} - if(/[a-zA-Z_]/.test(ch)){ - var l=look(stream, -2); - stream.eatWhile(/\w/); - var c=PERL[stream.current()]; - if(!c) - return "meta"; - if(c[1]) - c=c[0]; - if(l!=":"){ - if(c==1) - return "keyword"; - else if(c==2) - return "def"; - else if(c==3) - return "atom"; - else if(c==4) - return "operator"; - else if(c==5) - return "variable-2"; - else - return "meta";} - else - return "meta";} - return null;} + return "meta"; + } else + return "meta"; + } + } + if (/[a-zA-Z_]/.test(ch)) { + var l = look(stream, -2); + stream.eatWhile(/\w/); + var c = PERL[stream.current()]; + if (!c) + return "meta"; + if (c[1]) + c = c[0]; + if (l != ":") { + if (c == 1) + return "keyword"; + else if (c == 2) + return "def"; + else if (c == 3) + return "atom"; + else if (c == 4) + return "operator"; + else if (c == 5) + return "variable-2"; + else + return "meta"; + } else + return "meta"; + } + return null; + } return { - startState: function() { + startState: function () { return { tokenize: tokenPerl, chain: null, @@ -789,49 +865,49 @@ CodeMirror.defineMode("perl",function(){ tail: null }; }, - token: function(stream, state) { + token: function (stream, state) { return (state.tokenize || tokenPerl)(stream, state); }, lineComment: '#' }; -}); + }); -CodeMirror.registerHelper("wordChars", "perl", /[\w$]/); + CodeMirror.registerHelper("wordChars", "perl", /[\w$]/); -CodeMirror.defineMIME("text/x-perl", "perl"); + CodeMirror.defineMIME("text/x-perl", "perl"); // it's like "peek", but need for look-ahead or look-behind if index < 0 -function look(stream, c){ - return stream.string.charAt(stream.pos+(c||0)); -} + function look(stream, c) { + return stream.string.charAt(stream.pos + (c || 0)); + } // return a part of prefix of current stream from current position -function prefix(stream, c){ - if(c){ - var x=stream.pos-c; - return stream.string.substr((x>=0?x:0),c);} - else{ - return stream.string.substr(0,stream.pos-1); - } -} + function prefix(stream, c) { + if (c) { + var x = stream.pos - c; + return stream.string.substr((x >= 0 ? x : 0), c); + } else { + return stream.string.substr(0, stream.pos - 1); + } + } // return a part of suffix of current stream from current position -function suffix(stream, c){ - var y=stream.string.length; - var x=y-stream.pos+1; - return stream.string.substr(stream.pos,(c&&c=(y=stream.string.length-1)) - stream.pos=y; - else - stream.pos=x; -} + function eatSuffix(stream, c) { + var x = stream.pos + c; + var y; + if (x <= 0) + stream.pos = 0; + else if (x >= (y = stream.string.length - 1)) + stream.pos = y; + else + stream.pos = x; + } }); diff --git a/web/editor.md/lib/codemirror/mode/php/index.html b/web/editor.md/lib/codemirror/mode/php/index.html index adf6b1b..165f533 100644 --- a/web/editor.md/lib/codemirror/mode/php/index.html +++ b/web/editor.md/lib/codemirror/mode/php/index.html @@ -2,9 +2,9 @@ CodeMirror: PHP mode - + - + @@ -13,24 +13,27 @@ - +
-

PHP mode

-

Simple HTML/PHP mode based on - the C-like mode. Depends on XML, - JavaScript, CSS, HTMLMixed, and C-like modes.

+ the C-like mode. Depends on XML, + JavaScript, CSS, HTMLMixed, and C-like modes.

-

MIME types defined: application/x-httpd-php (HTML with PHP code), text/x-php (plain, non-wrapped PHP code).

-
+

MIME types defined: application/x-httpd-php (HTML with PHP code), + text/x-php (plain, non-wrapped PHP code).

+ diff --git a/web/editor.md/lib/codemirror/mode/php/php.js b/web/editor.md/lib/codemirror/mode/php/php.js index e112d91..ee98f2c 100644 --- a/web/editor.md/lib/codemirror/mode/php/php.js +++ b/web/editor.md/lib/codemirror/mode/php/php.js @@ -1,226 +1,238 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../clike/clike")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../clike/clike"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; - - function keywords(str) { - var obj = {}, words = str.split(" "); - for (var i = 0; i < words.length; ++i) obj[words[i]] = true; - return obj; - } - - // Helper for stringWithEscapes - function matchSequence(list, end) { - if (list.length == 0) return stringWithEscapes(end); - return function (stream, state) { - var patterns = list[0]; - for (var i = 0; i < patterns.length; i++) if (stream.match(patterns[i][0])) { - state.tokenize = matchSequence(list.slice(1), end); - return patterns[i][1]; - } - state.tokenize = stringWithEscapes(end); - return "string"; - }; - } - function stringWithEscapes(closing) { - return function(stream, state) { return stringWithEscapes_(stream, state, closing); }; - } - function stringWithEscapes_(stream, state, closing) { - // "Complex" syntax - if (stream.match("${", false) || stream.match("{$", false)) { - state.tokenize = null; - return "string"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../clike/clike")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../clike/clike"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + function keywords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; } - // Simple syntax - if (stream.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)) { - // After the variable name there may appear array or object operator. - if (stream.match("[", false)) { - // Match array operator - state.tokenize = matchSequence([ - [["[", null]], - [[/\d[\w\.]*/, "number"], - [/\$[a-zA-Z_][a-zA-Z0-9_]*/, "variable-2"], - [/[\w\$]+/, "variable"]], - [["]", null]] - ], closing); - } - if (stream.match(/\-\>\w/, false)) { - // Match object operator - state.tokenize = matchSequence([ - [["->", null]], - [[/[\w]+/, "variable"]] - ], closing); - } - return "variable-2"; + // Helper for stringWithEscapes + function matchSequence(list, end) { + if (list.length == 0) return stringWithEscapes(end); + return function (stream, state) { + var patterns = list[0]; + for (var i = 0; i < patterns.length; i++) if (stream.match(patterns[i][0])) { + state.tokenize = matchSequence(list.slice(1), end); + return patterns[i][1]; + } + state.tokenize = stringWithEscapes(end); + return "string"; + }; } - var escaped = false; - // Normal string - while (!stream.eol() && - (escaped || (!stream.match("{$", false) && - !stream.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false)))) { - if (!escaped && stream.match(closing)) { - state.tokenize = null; - state.tokStack.pop(); state.tokStack.pop(); - break; - } - escaped = stream.next() == "\\" && !escaped; + function stringWithEscapes(closing) { + return function (stream, state) { + return stringWithEscapes_(stream, state, closing); + }; } - return "string"; - } - - var phpKeywords = "abstract and array as break case catch class clone const continue declare default " + - "do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " + - "for foreach function global goto if implements interface instanceof namespace " + - "new or private protected public static switch throw trait try use var while xor " + - "die echo empty exit eval include include_once isset list require require_once return " + - "print unset __halt_compiler self static parent yield insteadof finally"; - var phpAtoms = "true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__"; - 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 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"; - CodeMirror.registerHelper("hintWords", "php", [phpKeywords, phpAtoms, phpBuiltin].join(" ").split(" ")); - CodeMirror.registerHelper("wordChars", "php", /[\w$]/); - - var phpConfig = { - name: "clike", - helperType: "php", - keywords: keywords(phpKeywords), - blockKeywords: keywords("catch do else elseif for foreach if switch try while finally"), - atoms: keywords(phpAtoms), - builtin: keywords(phpBuiltin), - multiLineStrings: true, - hooks: { - "$": function(stream) { - stream.eatWhile(/[\w\$_]/); - return "variable-2"; - }, - "<": function(stream, state) { - if (stream.match(/<", false)) stream.next(); - return "comment"; - }, - "/": function(stream) { - if (stream.eat("/")) { - while (!stream.eol() && !stream.match("?>", false)) stream.next(); - return "comment"; - } - return false; - }, - '"': function(_stream, state) { - (state.tokStack || (state.tokStack = [])).push('"', 0); - state.tokenize = stringWithEscapes('"'); - return "string"; - }, - "{": function(_stream, state) { - if (state.tokStack && state.tokStack.length) - state.tokStack[state.tokStack.length - 1]++; - return false; - }, - "}": function(_stream, state) { - if (state.tokStack && state.tokStack.length > 0 && - !--state.tokStack[state.tokStack.length - 1]) { - state.tokenize = stringWithEscapes(state.tokStack[state.tokStack.length - 2]); - } - return false; - } - } - }; - - CodeMirror.defineMode("php", function(config, parserConfig) { - var htmlMode = CodeMirror.getMode(config, "text/html"); - var phpMode = CodeMirror.getMode(config, phpConfig); - - function dispatch(stream, state) { - var isPHP = state.curMode == phpMode; - if (stream.sol() && state.pending && state.pending != '"' && state.pending != "'") state.pending = null; - if (!isPHP) { - if (stream.match(/^<\?\w*/)) { - state.curMode = phpMode; - state.curState = state.php; - return "meta"; } - if (state.pending == '"' || state.pending == "'") { - while (!stream.eol() && stream.next() != state.pending) {} - var style = "string"; - } else if (state.pending && stream.pos < state.pending.end) { - stream.pos = state.pending.end; - var style = state.pending.style; - } else { - var style = htmlMode.token(stream, state.curState); + + // Simple syntax + if (stream.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)) { + // After the variable name there may appear array or object operator. + if (stream.match("[", false)) { + // Match array operator + state.tokenize = matchSequence([ + [["[", null]], + [[/\d[\w\.]*/, "number"], + [/\$[a-zA-Z_][a-zA-Z0-9_]*/, "variable-2"], + [/[\w\$]+/, "variable"]], + [["]", null]] + ], closing); + } + if (stream.match(/\-\>\w/, false)) { + // Match object operator + state.tokenize = matchSequence([ + [["->", null]], + [[/[\w]+/, "variable"]] + ], closing); + } + return "variable-2"; } - if (state.pending) state.pending = null; - var cur = stream.current(), openPHP = cur.search(/<\?/), m; - if (openPHP != -1) { - if (style == "string" && (m = cur.match(/[\'\"]$/)) && !/\?>/.test(cur)) state.pending = m[0]; - else state.pending = {end: stream.pos, style: style}; - stream.backUp(cur.length - openPHP); + + var escaped = false; + // Normal string + while (!stream.eol() && + (escaped || (!stream.match("{$", false) && + !stream.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false)))) { + if (!escaped && stream.match(closing)) { + state.tokenize = null; + state.tokStack.pop(); + state.tokStack.pop(); + break; + } + escaped = stream.next() == "\\" && !escaped; } - return style; - } else if (isPHP && state.php.tokenize == null && stream.match("?>")) { - state.curMode = htmlMode; - state.curState = state.html; - return "meta"; - } else { - return phpMode.token(stream, state.curState); - } + return "string"; } - return { - startState: function() { - var html = CodeMirror.startState(htmlMode), php = CodeMirror.startState(phpMode); - return {html: html, - php: php, - curMode: parserConfig.startOpen ? phpMode : htmlMode, - curState: parserConfig.startOpen ? php : html, - pending: null}; - }, - - copyState: function(state) { - var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html), - php = state.php, phpNew = CodeMirror.copyState(phpMode, php), cur; - if (state.curMode == htmlMode) cur = htmlNew; - else cur = phpNew; - return {html: htmlNew, php: phpNew, curMode: state.curMode, curState: cur, - pending: state.pending}; - }, - - token: dispatch, - - indent: function(state, textAfter) { - if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) || - (state.curMode == phpMode && /^\?>/.test(textAfter))) - return htmlMode.indent(state.html, textAfter); - return state.curMode.indent(state.curState, textAfter); - }, - - blockCommentStart: "/*", - blockCommentEnd: "*/", - lineComment: "//", - - innerMode: function(state) { return {state: state.curState, mode: state.curMode}; } + var phpKeywords = "abstract and array as break case catch class clone const continue declare default " + + "do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " + + "for foreach function global goto if implements interface instanceof namespace " + + "new or private protected public static switch throw trait try use var while xor " + + "die echo empty exit eval include include_once isset list require require_once return " + + "print unset __halt_compiler self static parent yield insteadof finally"; + var phpAtoms = "true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__"; + 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 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"; + CodeMirror.registerHelper("hintWords", "php", [phpKeywords, phpAtoms, phpBuiltin].join(" ").split(" ")); + CodeMirror.registerHelper("wordChars", "php", /[\w$]/); + + var phpConfig = { + name: "clike", + helperType: "php", + keywords: keywords(phpKeywords), + blockKeywords: keywords("catch do else elseif for foreach if switch try while finally"), + atoms: keywords(phpAtoms), + builtin: keywords(phpBuiltin), + multiLineStrings: true, + hooks: { + "$": function (stream) { + stream.eatWhile(/[\w\$_]/); + return "variable-2"; + }, + "<": function (stream, state) { + if (stream.match(/<", false)) stream.next(); + return "comment"; + }, + "/": function (stream) { + if (stream.eat("/")) { + while (!stream.eol() && !stream.match("?>", false)) stream.next(); + return "comment"; + } + return false; + }, + '"': function (_stream, state) { + (state.tokStack || (state.tokStack = [])).push('"', 0); + state.tokenize = stringWithEscapes('"'); + return "string"; + }, + "{": function (_stream, state) { + if (state.tokStack && state.tokStack.length) + state.tokStack[state.tokStack.length - 1]++; + return false; + }, + "}": function (_stream, state) { + if (state.tokStack && state.tokStack.length > 0 && + !--state.tokStack[state.tokStack.length - 1]) { + state.tokenize = stringWithEscapes(state.tokStack[state.tokStack.length - 2]); + } + return false; + } + } }; - }, "htmlmixed", "clike"); - CodeMirror.defineMIME("application/x-httpd-php", "php"); - CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true}); - CodeMirror.defineMIME("text/x-php", phpConfig); + CodeMirror.defineMode("php", function (config, parserConfig) { + var htmlMode = CodeMirror.getMode(config, "text/html"); + var phpMode = CodeMirror.getMode(config, phpConfig); + + function dispatch(stream, state) { + var isPHP = state.curMode == phpMode; + if (stream.sol() && state.pending && state.pending != '"' && state.pending != "'") state.pending = null; + if (!isPHP) { + if (stream.match(/^<\?\w*/)) { + state.curMode = phpMode; + state.curState = state.php; + return "meta"; + } + if (state.pending == '"' || state.pending == "'") { + while (!stream.eol() && stream.next() != state.pending) { + } + var style = "string"; + } else if (state.pending && stream.pos < state.pending.end) { + stream.pos = state.pending.end; + var style = state.pending.style; + } else { + var style = htmlMode.token(stream, state.curState); + } + if (state.pending) state.pending = null; + var cur = stream.current(), openPHP = cur.search(/<\?/), m; + if (openPHP != -1) { + if (style == "string" && (m = cur.match(/[\'\"]$/)) && !/\?>/.test(cur)) state.pending = m[0]; + else state.pending = {end: stream.pos, style: style}; + stream.backUp(cur.length - openPHP); + } + return style; + } else if (isPHP && state.php.tokenize == null && stream.match("?>")) { + state.curMode = htmlMode; + state.curState = state.html; + return "meta"; + } else { + return phpMode.token(stream, state.curState); + } + } + + return { + startState: function () { + var html = CodeMirror.startState(htmlMode), php = CodeMirror.startState(phpMode); + return { + html: html, + php: php, + curMode: parserConfig.startOpen ? phpMode : htmlMode, + curState: parserConfig.startOpen ? php : html, + pending: null + }; + }, + + copyState: function (state) { + var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html), + php = state.php, phpNew = CodeMirror.copyState(phpMode, php), cur; + if (state.curMode == htmlMode) cur = htmlNew; + else cur = phpNew; + return { + html: htmlNew, php: phpNew, curMode: state.curMode, curState: cur, + pending: state.pending + }; + }, + + token: dispatch, + + indent: function (state, textAfter) { + if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) || + (state.curMode == phpMode && /^\?>/.test(textAfter))) + return htmlMode.indent(state.html, textAfter); + return state.curMode.indent(state.curState, textAfter); + }, + + blockCommentStart: "/*", + blockCommentEnd: "*/", + lineComment: "//", + + innerMode: function (state) { + return {state: state.curState, mode: state.curMode}; + } + }; + }, "htmlmixed", "clike"); + + CodeMirror.defineMIME("application/x-httpd-php", "php"); + CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true}); + CodeMirror.defineMIME("text/x-php", phpConfig); }); diff --git a/web/editor.md/lib/codemirror/mode/php/test.js b/web/editor.md/lib/codemirror/mode/php/test.js index e2ecefc..a4deaf8 100644 --- a/web/editor.md/lib/codemirror/mode/php/test.js +++ b/web/editor.md/lib/codemirror/mode/php/test.js @@ -1,154 +1,157 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function() { - var mode = CodeMirror.getMode({indentUnit: 2}, "php"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - - MT('simple_test', - '[meta ]'); - - MT('variable_interpolation_non_alphanumeric', - '[meta $/$\\$}$\\\"$:$;$?$|$[[$]]$+$=aaa"]', - '[meta ?>]'); - - MT('variable_interpolation_digits', - '[meta ]'); - - MT('variable_interpolation_simple_syntax_1', - '[meta ]'); - - MT('variable_interpolation_simple_syntax_2', - '[meta ]'); - - MT('variable_interpolation_simple_syntax_3', - '[meta [variable aaaaa][string .aaaaaa"];', - '[keyword echo] [string "aaa][variable-2 $aaaa][string ->][variable-2 $aaaaa][string .aaaaaa"];', - '[keyword echo] [string "aaa][variable-2 $aaaa]->[variable aaaaa][string [[2]].aaaaaa"];', - '[keyword echo] [string "aaa][variable-2 $aaaa]->[variable aaaaa][string ->aaaa2.aaaaaa"];', - '[meta ?>]'); - - MT('variable_interpolation_escaping', - '[meta aaa.aaa"];', - '[keyword echo] [string "aaa\\$aaaa[[2]]aaa.aaa"];', - '[keyword echo] [string "aaa\\$aaaa[[asd]]aaa.aaa"];', - '[keyword echo] [string "aaa{\\$aaaa->aaa.aaa"];', - '[keyword echo] [string "aaa{\\$aaaa[[2]]aaa.aaa"];', - '[keyword echo] [string "aaa{\\aaaaa[[asd]]aaa.aaa"];', - '[keyword echo] [string "aaa\\${aaaa->aaa.aaa"];', - '[keyword echo] [string "aaa\\${aaaa[[2]]aaa.aaa"];', - '[keyword echo] [string "aaa\\${aaaa[[asd]]aaa.aaa"];', - '[meta ?>]'); - - MT('variable_interpolation_complex_syntax_1', - '[meta aaa.aaa"];', - '[keyword echo] [string "aaa][variable-2 $]{[variable-2 $aaaa]}[string ->aaa.aaa"];', - '[keyword echo] [string "aaa][variable-2 $]{[variable-2 $aaaa][[',' [number 42]',']]}[string ->aaa.aaa"];', - '[keyword echo] [string "aaa][variable-2 $]{[variable aaaa][meta ?>]aaaaaa'); - - MT('variable_interpolation_complex_syntax_2', - '[meta } $aaaaaa.aaa"];', - '[keyword echo] [string "][variable-2 $]{[variable aaa][comment /*}?>*/][[',' [string "aaa][variable-2 $aaa][string {}][variable-2 $]{[variable aaa]}[string "]',']]}[string ->aaa.aaa"];', - '[keyword echo] [string "][variable-2 $]{[variable aaa][comment /*} } $aaa } */]}[string ->aaa.aaa"];'); - - - function build_recursive_monsters(nt, t, n){ - var monsters = [t]; - for (var i = 1; i <= n; ++i) - monsters[i] = nt.join(monsters[i - 1]); - return monsters; - } - - var m1 = build_recursive_monsters( - ['[string "][variable-2 $]{[variable aaa] [operator +] ', '}[string "]'], - '[comment /* }?>} */] [string "aaa][variable-2 $aaa][string .aaa"]', - 10 - ); - - MT('variable_interpolation_complex_syntax_3_1', - '[meta ]'); - - var m2 = build_recursive_monsters( - ['[string "a][variable-2 $]{[variable aaa] [operator +] ', ' [operator +] ', '}[string .a"]'], - '[comment /* }?>{{ */] [string "a?>}{{aa][variable-2 $aaa][string .a}a?>a"]', - 5 - ); - - MT('variable_interpolation_complex_syntax_3_2', - '[meta ]'); - - function build_recursive_monsters_2(mf1, mf2, nt, t, n){ - var monsters = [t]; - for (var i = 1; i <= n; ++i) - monsters[i] = nt[0] + mf1[i - 1] + nt[1] + mf2[i - 1] + nt[2] + monsters[i - 1] + nt[3]; - return monsters; - } - - var m3 = build_recursive_monsters_2( - m1, - m2, - ['[string "a][variable-2 $]{[variable aaa] [operator +] ', ' [operator +] ', ' [operator +] ', '}[string .a"]'], - '[comment /* }?>{{ */] [string "a?>}{{aa][variable-2 $aaa][string .a}a?>a"]', - 4 - ); - - MT('variable_interpolation_complex_syntax_3_3', - '[meta ]'); - - MT("variable_interpolation_heredoc", - "[meta ]'); + + MT('variable_interpolation_non_alphanumeric', + '[meta $/$\\$}$\\\"$:$;$?$|$[[$]]$+$=aaa"]', + '[meta ?>]'); + + MT('variable_interpolation_digits', + '[meta ]'); + + MT('variable_interpolation_simple_syntax_1', + '[meta ]'); + + MT('variable_interpolation_simple_syntax_2', + '[meta ]'); + + MT('variable_interpolation_simple_syntax_3', + '[meta [variable aaaaa][string .aaaaaa"];', + '[keyword echo] [string "aaa][variable-2 $aaaa][string ->][variable-2 $aaaaa][string .aaaaaa"];', + '[keyword echo] [string "aaa][variable-2 $aaaa]->[variable aaaaa][string [[2]].aaaaaa"];', + '[keyword echo] [string "aaa][variable-2 $aaaa]->[variable aaaaa][string ->aaaa2.aaaaaa"];', + '[meta ?>]'); + + MT('variable_interpolation_escaping', + '[meta aaa.aaa"];', + '[keyword echo] [string "aaa\\$aaaa[[2]]aaa.aaa"];', + '[keyword echo] [string "aaa\\$aaaa[[asd]]aaa.aaa"];', + '[keyword echo] [string "aaa{\\$aaaa->aaa.aaa"];', + '[keyword echo] [string "aaa{\\$aaaa[[2]]aaa.aaa"];', + '[keyword echo] [string "aaa{\\aaaaa[[asd]]aaa.aaa"];', + '[keyword echo] [string "aaa\\${aaaa->aaa.aaa"];', + '[keyword echo] [string "aaa\\${aaaa[[2]]aaa.aaa"];', + '[keyword echo] [string "aaa\\${aaaa[[asd]]aaa.aaa"];', + '[meta ?>]'); + + MT('variable_interpolation_complex_syntax_1', + '[meta aaa.aaa"];', + '[keyword echo] [string "aaa][variable-2 $]{[variable-2 $aaaa]}[string ->aaa.aaa"];', + '[keyword echo] [string "aaa][variable-2 $]{[variable-2 $aaaa][[', ' [number 42]', ']]}[string ->aaa.aaa"];', + '[keyword echo] [string "aaa][variable-2 $]{[variable aaaa][meta ?>]aaaaaa'); + + MT('variable_interpolation_complex_syntax_2', + '[meta } $aaaaaa.aaa"];', + '[keyword echo] [string "][variable-2 $]{[variable aaa][comment /*}?>*/][[', ' [string "aaa][variable-2 $aaa][string {}][variable-2 $]{[variable aaa]}[string "]', ']]}[string ->aaa.aaa"];', + '[keyword echo] [string "][variable-2 $]{[variable aaa][comment /*} } $aaa } */]}[string ->aaa.aaa"];'); + + + function build_recursive_monsters(nt, t, n) { + var monsters = [t]; + for (var i = 1; i <= n; ++i) + monsters[i] = nt.join(monsters[i - 1]); + return monsters; + } + + var m1 = build_recursive_monsters( + ['[string "][variable-2 $]{[variable aaa] [operator +] ', '}[string "]'], + '[comment /* }?>} */] [string "aaa][variable-2 $aaa][string .aaa"]', + 10 + ); + + MT('variable_interpolation_complex_syntax_3_1', + '[meta ]'); + + var m2 = build_recursive_monsters( + ['[string "a][variable-2 $]{[variable aaa] [operator +] ', ' [operator +] ', '}[string .a"]'], + '[comment /* }?>{{ */] [string "a?>}{{aa][variable-2 $aaa][string .a}a?>a"]', + 5 + ); + + MT('variable_interpolation_complex_syntax_3_2', + '[meta ]'); + + function build_recursive_monsters_2(mf1, mf2, nt, t, n) { + var monsters = [t]; + for (var i = 1; i <= n; ++i) + monsters[i] = nt[0] + mf1[i - 1] + nt[1] + mf2[i - 1] + nt[2] + monsters[i - 1] + nt[3]; + return monsters; + } + + var m3 = build_recursive_monsters_2( + m1, + m2, + ['[string "a][variable-2 $]{[variable aaa] [operator +] ', ' [operator +] ', ' [operator +] ', '}[string .a"]'], + '[comment /* }?>{{ */] [string "a?>}{{aa][variable-2 $aaa][string .a}a?>a"]', + 4 + ); + + MT('variable_interpolation_complex_syntax_3_3', + '[meta ]'); + + MT("variable_interpolation_heredoc", + "[meta CodeMirror: Pig Latin mode - + - + - +
-

Pig Latin mode

-

@@ -50,6 +52,6 @@

Pig Latin mode

MIME type defined: text/x-pig - (PIG code) - + (PIG code) +

diff --git a/web/editor.md/lib/codemirror/mode/pig/pig.js b/web/editor.md/lib/codemirror/mode/pig/pig.js index c74b2cc..7d7c380 100644 --- a/web/editor.md/lib/codemirror/mode/pig/pig.js +++ b/web/editor.md/lib/codemirror/mode/pig/pig.js @@ -7,182 +7,179 @@ * @link https://github.com/prasanthj/pig-codemirror-2 * This implementation is adapted from PL/SQL mode in CodeMirror 2. */ -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("pig", function(_config, parserConfig) { - var keywords = parserConfig.keywords, - builtins = parserConfig.builtins, - types = parserConfig.types, - multiLineStrings = parserConfig.multiLineStrings; - - var isOperatorChar = /[*+\-%<>=&?:\/!|]/; - - function chain(stream, state, f) { - state.tokenize = f; - return f(stream, state); - } - - var type; - function ret(tp, style) { - type = tp; - return style; - } - - function tokenComment(stream, state) { - var isEnd = false; - var ch; - while(ch = stream.next()) { - if(ch == "/" && isEnd) { - state.tokenize = tokenBase; - break; - } - isEnd = (ch == "*"); - } - return ret("comment", "comment"); - } - - function tokenString(quote) { - return function(stream, state) { - var escaped = false, next, end = false; - while((next = stream.next()) != null) { - if (next == quote && !escaped) { - end = true; break; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("pig", function (_config, parserConfig) { + var keywords = parserConfig.keywords, + builtins = parserConfig.builtins, + types = parserConfig.types, + multiLineStrings = parserConfig.multiLineStrings; + + var isOperatorChar = /[*+\-%<>=&?:\/!|]/; + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); } - escaped = !escaped && next == "\\"; - } - if (end || !(escaped || multiLineStrings)) - state.tokenize = tokenBase; - return ret("string", "error"); - }; - } - - function tokenBase(stream, state) { - var ch = stream.next(); - - // is a start of string? - if (ch == '"' || ch == "'") - return chain(stream, state, tokenString(ch)); - // is it one of the special chars - else if(/[\[\]{}\(\),;\.]/.test(ch)) - return ret(ch); - // is it a number? - else if(/\d/.test(ch)) { - stream.eatWhile(/[\w\.]/); - return ret("number", "number"); - } - // multi line comment or operator - else if (ch == "/") { - if (stream.eat("*")) { - return chain(stream, state, tokenComment); - } - else { - stream.eatWhile(isOperatorChar); - return ret("operator", "operator"); - } - } - // single line comment or operator - else if (ch=="-") { - if(stream.eat("-")){ - stream.skipToEnd(); - return ret("comment", "comment"); - } - else { - stream.eatWhile(isOperatorChar); - return ret("operator", "operator"); - } - } - // is it an operator - else if (isOperatorChar.test(ch)) { - stream.eatWhile(isOperatorChar); - return ret("operator", "operator"); - } - else { - // get the while word - stream.eatWhile(/[\w\$_]/); - // is it one of the listed keywords? - if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) { - if (stream.eat(")") || stream.eat(".")) { - //keywords can be used as variables like flatten(group), group.$0 etc.. + + var type; + + function ret(tp, style) { + type = tp; + return style; } - else { - return ("keyword", "keyword"); + + function tokenComment(stream, state) { + var isEnd = false; + var ch; + while (ch = stream.next()) { + if (ch == "/" && isEnd) { + state.tokenize = tokenBase; + break; + } + isEnd = (ch == "*"); + } + return ret("comment", "comment"); + } + + function tokenString(quote) { + return function (stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) { + end = true; + break; + } + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || multiLineStrings)) + state.tokenize = tokenBase; + return ret("string", "error"); + }; + } + + function tokenBase(stream, state) { + var ch = stream.next(); + + // is a start of string? + if (ch == '"' || ch == "'") + return chain(stream, state, tokenString(ch)); + // is it one of the special chars + else if (/[\[\]{}\(\),;\.]/.test(ch)) + return ret(ch); + // is it a number? + else if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return ret("number", "number"); + } + // multi line comment or operator + else if (ch == "/") { + if (stream.eat("*")) { + return chain(stream, state, tokenComment); + } else { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } + } + // single line comment or operator + else if (ch == "-") { + if (stream.eat("-")) { + stream.skipToEnd(); + return ret("comment", "comment"); + } else { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } + } + // is it an operator + else if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return ret("operator", "operator"); + } else { + // get the while word + stream.eatWhile(/[\w\$_]/); + // is it one of the listed keywords? + if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) { + if (stream.eat(")") || stream.eat(".")) { + //keywords can be used as variables like flatten(group), group.$0 etc.. + } else { + return ("keyword", "keyword"); + } + } + // is it one of the builtin functions? + if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase())) { + return ("keyword", "variable-2"); + } + // is it one of the listed types? + if (types && types.propertyIsEnumerable(stream.current().toUpperCase())) + return ("keyword", "variable-3"); + // default is a 'variable' + return ret("variable", "pig-word"); + } + } + + // Interface + return { + startState: function () { + return { + tokenize: tokenBase, + startOfLine: true + }; + }, + + token: function (stream, state) { + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + return style; + } + }; + }); + + (function () { + function keywords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; } - } - // is it one of the builtin functions? - if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase())) - { - return ("keyword", "variable-2"); - } - // is it one of the listed types? - if (types && types.propertyIsEnumerable(stream.current().toUpperCase())) - return ("keyword", "variable-3"); - // default is a 'variable' - return ret("variable", "pig-word"); - } - } - - // Interface - return { - startState: function() { - return { - tokenize: tokenBase, - startOfLine: true - }; - }, - - token: function(stream, state) { - if(stream.eatSpace()) return null; - var style = state.tokenize(stream, state); - return style; - } - }; -}); -(function() { - function keywords(str) { - var obj = {}, words = str.split(" "); - for (var i = 0; i < words.length; ++i) obj[words[i]] = true; - return obj; - } - - // builtin funcs taken from trunk revision 1303237 - var pBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL " - + "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS " - + "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG " - + "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN " - + "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER " - + "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS " - + "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA " - + "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE " - + "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG " - + "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER "; - - // taken from QueryLexer.g - var pKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP " - + "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL " - + "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE " - + "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE " - + "NEQ MATCHES TRUE FALSE DUMP"; - - // data types - var pTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP "; - - CodeMirror.defineMIME("text/x-pig", { - name: "pig", - builtins: keywords(pBuiltins), - keywords: keywords(pKeywords), - types: keywords(pTypes) - }); - - CodeMirror.registerHelper("hintWords", "pig", (pBuiltins + pTypes + pKeywords).split(" ")); -}()); + // builtin funcs taken from trunk revision 1303237 + var pBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL " + + "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS " + + "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG " + + "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN " + + "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER " + + "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS " + + "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA " + + "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE " + + "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG " + + "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER "; + + // taken from QueryLexer.g + var pKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP " + + "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL " + + "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE " + + "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE " + + "NEQ MATCHES TRUE FALSE DUMP"; + + // data types + var pTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP "; + + CodeMirror.defineMIME("text/x-pig", { + name: "pig", + builtins: keywords(pBuiltins), + keywords: keywords(pKeywords), + types: keywords(pTypes) + }); + + CodeMirror.registerHelper("hintWords", "pig", (pBuiltins + pTypes + pKeywords).split(" ")); + }()); }); diff --git a/web/editor.md/lib/codemirror/mode/properties/index.html b/web/editor.md/lib/codemirror/mode/properties/index.html index f885302..eb21f7e 100644 --- a/web/editor.md/lib/codemirror/mode/properties/index.html +++ b/web/editor.md/lib/codemirror/mode/properties/index.html @@ -2,29 +2,32 @@ CodeMirror: Properties files mode - + - + - +
-

Properties files mode

-

MIME types defined: text/x-properties, - text/x-ini.

+ text/x-ini.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/properties/properties.js b/web/editor.md/lib/codemirror/mode/properties/properties.js index 0740084..3b2bef9 100644 --- a/web/editor.md/lib/codemirror/mode/properties/properties.js +++ b/web/editor.md/lib/codemirror/mode/properties/properties.js @@ -1,78 +1,79 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("properties", function() { - return { - token: function(stream, state) { - var sol = stream.sol() || state.afterSection; - var eol = stream.eol(); + CodeMirror.defineMode("properties", function () { + return { + token: function (stream, state) { + var sol = stream.sol() || state.afterSection; + var eol = stream.eol(); - state.afterSection = false; + state.afterSection = false; - if (sol) { - if (state.nextMultiline) { - state.inMultiline = true; - state.nextMultiline = false; - } else { - state.position = "def"; - } - } + if (sol) { + if (state.nextMultiline) { + state.inMultiline = true; + state.nextMultiline = false; + } else { + state.position = "def"; + } + } - if (eol && ! state.nextMultiline) { - state.inMultiline = false; - state.position = "def"; - } + if (eol && !state.nextMultiline) { + state.inMultiline = false; + state.position = "def"; + } - if (sol) { - while(stream.eatSpace()); - } + if (sol) { + while (stream.eatSpace()) ; + } - var ch = stream.next(); + var ch = stream.next(); - if (sol && (ch === "#" || ch === "!" || ch === ";")) { - state.position = "comment"; - stream.skipToEnd(); - return "comment"; - } else if (sol && ch === "[") { - state.afterSection = true; - stream.skipTo("]"); stream.eat("]"); - return "header"; - } else if (ch === "=" || ch === ":") { - state.position = "quote"; - return null; - } else if (ch === "\\" && state.position === "quote") { - if (stream.next() !== "u") { // u = Unicode sequence \u1234 - // Multiline value - state.nextMultiline = true; - } - } + if (sol && (ch === "#" || ch === "!" || ch === ";")) { + state.position = "comment"; + stream.skipToEnd(); + return "comment"; + } else if (sol && ch === "[") { + state.afterSection = true; + stream.skipTo("]"); + stream.eat("]"); + return "header"; + } else if (ch === "=" || ch === ":") { + state.position = "quote"; + return null; + } else if (ch === "\\" && state.position === "quote") { + if (stream.next() !== "u") { // u = Unicode sequence \u1234 + // Multiline value + state.nextMultiline = true; + } + } - return state.position; - }, + return state.position; + }, - startState: function() { - return { - position : "def", // Current position, "def", "quote" or "comment" - nextMultiline : false, // Is the next line multiline value - inMultiline : false, // Is the current line a multiline value - afterSection : false // Did we just open a section - }; - } + startState: function () { + return { + position: "def", // Current position, "def", "quote" or "comment" + nextMultiline: false, // Is the next line multiline value + inMultiline: false, // Is the current line a multiline value + afterSection: false // Did we just open a section + }; + } - }; -}); + }; + }); -CodeMirror.defineMIME("text/x-properties", "properties"); -CodeMirror.defineMIME("text/x-ini", "properties"); + CodeMirror.defineMIME("text/x-properties", "properties"); + CodeMirror.defineMIME("text/x-ini", "properties"); }); diff --git a/web/editor.md/lib/codemirror/mode/puppet/index.html b/web/editor.md/lib/codemirror/mode/puppet/index.html index 5614c36..c9d2695 100644 --- a/web/editor.md/lib/codemirror/mode/puppet/index.html +++ b/web/editor.md/lib/codemirror/mode/puppet/index.html @@ -2,33 +2,39 @@ CodeMirror: Puppet mode - + - + + .CodeMirror { + border-top: 1px solid black; + border-bottom: 1px solid black; + } + + .cm-s-default span.cm-arrow { + color: red; + } +
-

Puppet mode

-

MIME types defined: text/x-puppet.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/puppet/puppet.js b/web/editor.md/lib/codemirror/mode/puppet/puppet.js index e7f799f..67e176b 100644 --- a/web/editor.md/lib/codemirror/mode/puppet/puppet.js +++ b/web/editor.md/lib/codemirror/mode/puppet/puppet.js @@ -1,220 +1,221 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("puppet", function () { - // Stores the words from the define method - var words = {}; - // Taken, mostly, from the Puppet official variable standards regex - var variable_regex = /({)?([a-z][a-z0-9_]*)?((::[a-z][a-z0-9_]*)*::)?[a-zA-Z0-9_]+(})?/; + CodeMirror.defineMode("puppet", function () { + // Stores the words from the define method + var words = {}; + // Taken, mostly, from the Puppet official variable standards regex + var variable_regex = /({)?([a-z][a-z0-9_]*)?((::[a-z][a-z0-9_]*)*::)?[a-zA-Z0-9_]+(})?/; - // Takes a string of words separated by spaces and adds them as - // keys with the value of the first argument 'style' - function define(style, string) { - var split = string.split(' '); - for (var i = 0; i < split.length; i++) { - words[split[i]] = style; - } - } + // Takes a string of words separated by spaces and adds them as + // keys with the value of the first argument 'style' + function define(style, string) { + var split = string.split(' '); + for (var i = 0; i < split.length; i++) { + words[split[i]] = style; + } + } - // Takes commonly known puppet types/words and classifies them to a style - define('keyword', 'class define site node include import inherits'); - define('keyword', 'case if else in and elsif default or'); - define('atom', 'false true running present absent file directory undef'); - define('builtin', 'action augeas burst chain computer cron destination dport exec ' + - 'file filebucket group host icmp iniface interface jump k5login limit log_level ' + - 'log_prefix macauthorization mailalias maillist mcx mount nagios_command ' + - 'nagios_contact nagios_contactgroup nagios_host nagios_hostdependency ' + - 'nagios_hostescalation nagios_hostextinfo nagios_hostgroup nagios_service ' + - 'nagios_servicedependency nagios_serviceescalation nagios_serviceextinfo ' + - 'nagios_servicegroup nagios_timeperiod name notify outiface package proto reject ' + - 'resources router schedule scheduled_task selboolean selmodule service source ' + - 'sport ssh_authorized_key sshkey stage state table tidy todest toports tosource ' + - 'user vlan yumrepo zfs zone zpool'); + // Takes commonly known puppet types/words and classifies them to a style + define('keyword', 'class define site node include import inherits'); + define('keyword', 'case if else in and elsif default or'); + define('atom', 'false true running present absent file directory undef'); + define('builtin', 'action augeas burst chain computer cron destination dport exec ' + + 'file filebucket group host icmp iniface interface jump k5login limit log_level ' + + 'log_prefix macauthorization mailalias maillist mcx mount nagios_command ' + + 'nagios_contact nagios_contactgroup nagios_host nagios_hostdependency ' + + 'nagios_hostescalation nagios_hostextinfo nagios_hostgroup nagios_service ' + + 'nagios_servicedependency nagios_serviceescalation nagios_serviceextinfo ' + + 'nagios_servicegroup nagios_timeperiod name notify outiface package proto reject ' + + 'resources router schedule scheduled_task selboolean selmodule service source ' + + 'sport ssh_authorized_key sshkey stage state table tidy todest toports tosource ' + + 'user vlan yumrepo zfs zone zpool'); - // After finding a start of a string ('|") this function attempts to find the end; - // If a variable is encountered along the way, we display it differently when it - // is encapsulated in a double-quoted string. - function tokenString(stream, state) { - var current, prev, found_var = false; - while (!stream.eol() && (current = stream.next()) != state.pending) { - if (current === '$' && prev != '\\' && state.pending == '"') { - found_var = true; - break; - } - prev = current; - } - if (found_var) { - stream.backUp(1); - } - if (current == state.pending) { - state.continueString = false; - } else { - state.continueString = true; - } - return "string"; - } + // After finding a start of a string ('|") this function attempts to find the end; + // If a variable is encountered along the way, we display it differently when it + // is encapsulated in a double-quoted string. + function tokenString(stream, state) { + var current, prev, found_var = false; + while (!stream.eol() && (current = stream.next()) != state.pending) { + if (current === '$' && prev != '\\' && state.pending == '"') { + found_var = true; + break; + } + prev = current; + } + if (found_var) { + stream.backUp(1); + } + if (current == state.pending) { + state.continueString = false; + } else { + state.continueString = true; + } + return "string"; + } - // Main function - function tokenize(stream, state) { - // Matches one whole word - var word = stream.match(/[\w]+/, false); - // Matches attributes (i.e. ensure => present ; 'ensure' would be matched) - var attribute = stream.match(/(\s+)?\w+\s+=>.*/, false); - // Matches non-builtin resource declarations - // (i.e. "apache::vhost {" or "mycustomclasss {" would be matched) - var resource = stream.match(/(\s+)?[\w:_]+(\s+)?{/, false); - // Matches virtual and exported resources (i.e. @@user { ; and the like) - var special_resource = stream.match(/(\s+)?[@]{1,2}[\w:_]+(\s+)?{/, false); + // Main function + function tokenize(stream, state) { + // Matches one whole word + var word = stream.match(/[\w]+/, false); + // Matches attributes (i.e. ensure => present ; 'ensure' would be matched) + var attribute = stream.match(/(\s+)?\w+\s+=>.*/, false); + // Matches non-builtin resource declarations + // (i.e. "apache::vhost {" or "mycustomclasss {" would be matched) + var resource = stream.match(/(\s+)?[\w:_]+(\s+)?{/, false); + // Matches virtual and exported resources (i.e. @@user { ; and the like) + var special_resource = stream.match(/(\s+)?[@]{1,2}[\w:_]+(\s+)?{/, false); - // Finally advance the stream - var ch = stream.next(); + // Finally advance the stream + var ch = stream.next(); - // Have we found a variable? - if (ch === '$') { - if (stream.match(variable_regex)) { - // If so, and its in a string, assign it a different color - return state.continueString ? 'variable-2' : 'variable'; - } - // Otherwise return an invalid variable - return "error"; - } - // Should we still be looking for the end of a string? - if (state.continueString) { - // If so, go through the loop again - stream.backUp(1); - return tokenString(stream, state); - } - // Are we in a definition (class, node, define)? - if (state.inDefinition) { - // If so, return def (i.e. for 'class myclass {' ; 'myclass' would be matched) - if (stream.match(/(\s+)?[\w:_]+(\s+)?/)) { - return 'def'; - } - // Match the rest it the next time around - stream.match(/\s+{/); - state.inDefinition = false; - } - // Are we in an 'include' statement? - if (state.inInclude) { - // Match and return the included class - stream.match(/(\s+)?\S+(\s+)?/); - state.inInclude = false; - return 'def'; - } - // Do we just have a function on our hands? - // In 'ensure_resource("myclass")', 'ensure_resource' is matched - if (stream.match(/(\s+)?\w+\(/)) { - stream.backUp(1); - return 'def'; - } - // Have we matched the prior attribute regex? - if (attribute) { - stream.match(/(\s+)?\w+/); - return 'tag'; - } - // Do we have Puppet specific words? - if (word && words.hasOwnProperty(word)) { - // Negates the initial next() - stream.backUp(1); - // Acutally move the stream - stream.match(/[\w]+/); - // We want to process these words differently - // do to the importance they have in Puppet - if (stream.match(/\s+\S+\s+{/, false)) { - state.inDefinition = true; - } - if (word == 'include') { - state.inInclude = true; - } - // Returns their value as state in the prior define methods - return words[word]; - } - // Is there a match on a reference? - if (/(^|\s+)[A-Z][\w:_]+/.test(word)) { - // Negate the next() - stream.backUp(1); - // Match the full reference - stream.match(/(^|\s+)[A-Z][\w:_]+/); - return 'def'; - } - // Have we matched the prior resource regex? - if (resource) { - stream.match(/(\s+)?[\w:_]+/); - return 'def'; - } - // Have we matched the prior special_resource regex? - if (special_resource) { - stream.match(/(\s+)?[@]{1,2}/); - return 'special'; - } - // Match all the comments. All of them. - if (ch == "#") { - stream.skipToEnd(); - return "comment"; - } - // Have we found a string? - if (ch == "'" || ch == '"') { - // Store the type (single or double) - state.pending = ch; - // Perform the looping function to find the end - return tokenString(stream, state); - } - // Match all the brackets - if (ch == '{' || ch == '}') { - return 'bracket'; - } - // Match characters that we are going to assume - // are trying to be regex - if (ch == '/') { - stream.match(/.*?\//); - return 'variable-3'; - } - // Match all the numbers - if (ch.match(/[0-9]/)) { - stream.eatWhile(/[0-9]+/); - return 'number'; - } - // Match the '=' and '=>' operators - if (ch == '=') { - if (stream.peek() == '>') { - stream.next(); - } - return "operator"; - } - // Keep advancing through all the rest - stream.eatWhile(/[\w-]/); - // Return a blank line for everything else - return null; - } - // Start it all - return { - startState: function () { - var state = {}; - state.inDefinition = false; - state.inInclude = false; - state.continueString = false; - state.pending = false; - return state; - }, - token: function (stream, state) { - // Strip the spaces, but regex will account for them eitherway - if (stream.eatSpace()) return null; - // Go through the main process - return tokenize(stream, state); - } - }; -}); + // Have we found a variable? + if (ch === '$') { + if (stream.match(variable_regex)) { + // If so, and its in a string, assign it a different color + return state.continueString ? 'variable-2' : 'variable'; + } + // Otherwise return an invalid variable + return "error"; + } + // Should we still be looking for the end of a string? + if (state.continueString) { + // If so, go through the loop again + stream.backUp(1); + return tokenString(stream, state); + } + // Are we in a definition (class, node, define)? + if (state.inDefinition) { + // If so, return def (i.e. for 'class myclass {' ; 'myclass' would be matched) + if (stream.match(/(\s+)?[\w:_]+(\s+)?/)) { + return 'def'; + } + // Match the rest it the next time around + stream.match(/\s+{/); + state.inDefinition = false; + } + // Are we in an 'include' statement? + if (state.inInclude) { + // Match and return the included class + stream.match(/(\s+)?\S+(\s+)?/); + state.inInclude = false; + return 'def'; + } + // Do we just have a function on our hands? + // In 'ensure_resource("myclass")', 'ensure_resource' is matched + if (stream.match(/(\s+)?\w+\(/)) { + stream.backUp(1); + return 'def'; + } + // Have we matched the prior attribute regex? + if (attribute) { + stream.match(/(\s+)?\w+/); + return 'tag'; + } + // Do we have Puppet specific words? + if (word && words.hasOwnProperty(word)) { + // Negates the initial next() + stream.backUp(1); + // Acutally move the stream + stream.match(/[\w]+/); + // We want to process these words differently + // do to the importance they have in Puppet + if (stream.match(/\s+\S+\s+{/, false)) { + state.inDefinition = true; + } + if (word == 'include') { + state.inInclude = true; + } + // Returns their value as state in the prior define methods + return words[word]; + } + // Is there a match on a reference? + if (/(^|\s+)[A-Z][\w:_]+/.test(word)) { + // Negate the next() + stream.backUp(1); + // Match the full reference + stream.match(/(^|\s+)[A-Z][\w:_]+/); + return 'def'; + } + // Have we matched the prior resource regex? + if (resource) { + stream.match(/(\s+)?[\w:_]+/); + return 'def'; + } + // Have we matched the prior special_resource regex? + if (special_resource) { + stream.match(/(\s+)?[@]{1,2}/); + return 'special'; + } + // Match all the comments. All of them. + if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } + // Have we found a string? + if (ch == "'" || ch == '"') { + // Store the type (single or double) + state.pending = ch; + // Perform the looping function to find the end + return tokenString(stream, state); + } + // Match all the brackets + if (ch == '{' || ch == '}') { + return 'bracket'; + } + // Match characters that we are going to assume + // are trying to be regex + if (ch == '/') { + stream.match(/.*?\//); + return 'variable-3'; + } + // Match all the numbers + if (ch.match(/[0-9]/)) { + stream.eatWhile(/[0-9]+/); + return 'number'; + } + // Match the '=' and '=>' operators + if (ch == '=') { + if (stream.peek() == '>') { + stream.next(); + } + return "operator"; + } + // Keep advancing through all the rest + stream.eatWhile(/[\w-]/); + // Return a blank line for everything else + return null; + } + + // Start it all + return { + startState: function () { + var state = {}; + state.inDefinition = false; + state.inInclude = false; + state.continueString = false; + state.pending = false; + return state; + }, + token: function (stream, state) { + // Strip the spaces, but regex will account for them eitherway + if (stream.eatSpace()) return null; + // Go through the main process + return tokenize(stream, state); + } + }; + }); -CodeMirror.defineMIME("text/x-puppet", "puppet"); + CodeMirror.defineMIME("text/x-puppet", "puppet"); }); diff --git a/web/editor.md/lib/codemirror/mode/python/index.html b/web/editor.md/lib/codemirror/mode/python/index.html index 86eb3d5..cb9704c 100644 --- a/web/editor.md/lib/codemirror/mode/python/index.html +++ b/web/editor.md/lib/codemirror/mode/python/index.html @@ -2,29 +2,32 @@ CodeMirror: Python mode - + - + - +
-

Python mode

+

Python mode

-

Cython mode

+

Cython mode

-

Configuration Options for Python mode:

    -
  • version - 2/3 - The version of Python to recognize. Default is 2.
  • -
  • singleLineStringErrors - true/false - If you have a single-line string that is not terminated at the end of the line, this will show subsequent lines as errors if true, otherwise it will consider the newline as the end of the string. Default is false.
  • -
  • hangingIndent - int - If you want to write long arguments to a function starting on a new line, how much that line should be indented. Defaults to one normal indentation unit.
  • +
  • version - 2/3 - The version of Python to recognize. Default is 2.
  • +
  • singleLineStringErrors - true/false - If you have a single-line string that is not terminated at the end of + the line, this will show subsequent lines as errors if true, otherwise it will consider the newline as the + end of the string. Default is false. +
  • +
  • hangingIndent - int - If you want to write long arguments to a function starting on a new line, how much + that line should be indented. Defaults to one normal indentation unit. +

Advanced Configuration Options:

-

Usefull for superset of python syntax like Enthought enaml, IPython magics and questionmark help

+

Usefull for superset of python syntax like Enthought enaml, IPython magics and questionmark help

    -
  • singleOperators - RegEx - Regular Expression for single operator matching, default :
    ^[\\+\\-\\*/%&|\\^~<>!]
    including
    @
    on Python 3
  • -
  • singleDelimiters - RegEx - Regular Expression for single delimiter matching, default :
    ^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]
  • -
  • doubleOperators - RegEx - Regular Expression for double operators matching, default :
    ^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))
  • -
  • doubleDelimiters - RegEx - Regular Expressoin for double delimiters matching, default :
    ^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))
  • -
  • tripleDelimiters - RegEx - Regular Expression for triple delimiters matching, default :
    ^((//=)|(>>=)|(<<=)|(\\*\\*=))
  • -
  • identifiers - RegEx - Regular Expression for identifier, default :
    ^[_A-Za-z][_A-Za-z0-9]*
    on Python 2 and
    ^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*
    on Python 3.
  • -
  • extra_keywords - list of string - List of extra words ton consider as keywords
  • -
  • extra_builtins - list of string - List of extra words ton consider as builtins
  • +
  • singleOperators - RegEx - Regular Expression for single operator matching, default : +
    ^[\\+\\-\\*/%&|\\^~<>!]
    + including +
    @
    + on Python 3 +
  • +
  • singleDelimiters - RegEx - Regular Expression for single delimiter matching, default : +
    ^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]
    +
  • +
  • doubleOperators - RegEx - Regular Expression for double operators matching, default : +
    ^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))
    +
  • +
  • doubleDelimiters - RegEx - Regular Expressoin for double delimiters matching, default : +
    ^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))
    +
  • +
  • tripleDelimiters - RegEx - Regular Expression for triple delimiters matching, default : +
    ^((//=)|(>>=)|(<<=)|(\\*\\*=))
    +
  • +
  • identifiers - RegEx - Regular Expression for identifier, default : +
    ^[_A-Za-z][_A-Za-z0-9]*
    + on Python 2 and +
    ^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*
    + on Python 3. +
  • +
  • extra_keywords - list of string - List of extra words ton consider as keywords
  • +
  • extra_builtins - list of string - List of extra words ton consider as builtins

MIME types defined: text/x-python and text/x-cython.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/python/python.js b/web/editor.md/lib/codemirror/mode/python/python.js index 98c0409..97555a1 100644 --- a/web/editor.md/lib/codemirror/mode/python/python.js +++ b/web/editor.md/lib/codemirror/mode/python/python.js @@ -1,359 +1,372 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; - - function wordRegexp(words) { - return new RegExp("^((" + words.join(")|(") + "))\\b"); - } - - var wordOperators = wordRegexp(["and", "or", "not", "is"]); - var commonKeywords = ["as", "assert", "break", "class", "continue", - "def", "del", "elif", "else", "except", "finally", - "for", "from", "global", "if", "import", - "lambda", "pass", "raise", "return", - "try", "while", "with", "yield", "in"]; - var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr", - "classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod", - "enumerate", "eval", "filter", "float", "format", "frozenset", - "getattr", "globals", "hasattr", "hash", "help", "hex", "id", - "input", "int", "isinstance", "issubclass", "iter", "len", - "list", "locals", "map", "max", "memoryview", "min", "next", - "object", "oct", "open", "ord", "pow", "property", "range", - "repr", "reversed", "round", "set", "setattr", "slice", - "sorted", "staticmethod", "str", "sum", "super", "tuple", - "type", "vars", "zip", "__import__", "NotImplemented", - "Ellipsis", "__debug__"]; - var py2 = {builtins: ["apply", "basestring", "buffer", "cmp", "coerce", "execfile", - "file", "intern", "long", "raw_input", "reduce", "reload", - "unichr", "unicode", "xrange", "False", "True", "None"], - keywords: ["exec", "print"]}; - var py3 = {builtins: ["ascii", "bytes", "exec", "print"], - keywords: ["nonlocal", "False", "True", "None"]}; - - CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins)); - - function top(state) { - return state.scopes[state.scopes.length - 1]; - } - - CodeMirror.defineMode("python", function(conf, parserConf) { - var ERRORCLASS = "error"; - - var singleDelimiters = parserConf.singleDelimiters || new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"); - var doubleOperators = parserConf.doubleOperators || new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"); - var doubleDelimiters = parserConf.doubleDelimiters || new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"); - var tripleDelimiters = parserConf.tripleDelimiters || new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"); - - if (parserConf.version && parseInt(parserConf.version, 10) == 3){ - // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator - var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!@]"); - var identifiers = parserConf.identifiers|| new RegExp("^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*"); - } else { - var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!]"); - var identifiers = parserConf.identifiers|| new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b"); } - var hangingIndent = parserConf.hangingIndent || conf.indentUnit; + var wordOperators = wordRegexp(["and", "or", "not", "is"]); + var commonKeywords = ["as", "assert", "break", "class", "continue", + "def", "del", "elif", "else", "except", "finally", + "for", "from", "global", "if", "import", + "lambda", "pass", "raise", "return", + "try", "while", "with", "yield", "in"]; + var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr", + "classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod", + "enumerate", "eval", "filter", "float", "format", "frozenset", + "getattr", "globals", "hasattr", "hash", "help", "hex", "id", + "input", "int", "isinstance", "issubclass", "iter", "len", + "list", "locals", "map", "max", "memoryview", "min", "next", + "object", "oct", "open", "ord", "pow", "property", "range", + "repr", "reversed", "round", "set", "setattr", "slice", + "sorted", "staticmethod", "str", "sum", "super", "tuple", + "type", "vars", "zip", "__import__", "NotImplemented", + "Ellipsis", "__debug__"]; + var py2 = { + builtins: ["apply", "basestring", "buffer", "cmp", "coerce", "execfile", + "file", "intern", "long", "raw_input", "reduce", "reload", + "unichr", "unicode", "xrange", "False", "True", "None"], + keywords: ["exec", "print"] + }; + var py3 = { + builtins: ["ascii", "bytes", "exec", "print"], + keywords: ["nonlocal", "False", "True", "None"] + }; - var myKeywords = commonKeywords, myBuiltins = commonBuiltins; - if(parserConf.extra_keywords != undefined){ - myKeywords = myKeywords.concat(parserConf.extra_keywords); - } - if(parserConf.extra_builtins != undefined){ - myBuiltins = myBuiltins.concat(parserConf.extra_builtins); - } - if (parserConf.version && parseInt(parserConf.version, 10) == 3) { - myKeywords = myKeywords.concat(py3.keywords); - myBuiltins = myBuiltins.concat(py3.builtins); - var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i"); - } else { - myKeywords = myKeywords.concat(py2.keywords); - myBuiltins = myBuiltins.concat(py2.builtins); - var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i"); + CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins)); + + function top(state) { + return state.scopes[state.scopes.length - 1]; } - var keywords = wordRegexp(myKeywords); - var builtins = wordRegexp(myBuiltins); - - // tokenizers - function tokenBase(stream, state) { - // Handle scope changes - if (stream.sol() && top(state).type == "py") { - var scopeOffset = top(state).offset; - if (stream.eatSpace()) { - var lineOffset = stream.indentation(); - if (lineOffset > scopeOffset) - pushScope(stream, state, "py"); - else if (lineOffset < scopeOffset && dedent(stream, state)) - state.errorToken = true; - return null; + + CodeMirror.defineMode("python", function (conf, parserConf) { + var ERRORCLASS = "error"; + + var singleDelimiters = parserConf.singleDelimiters || new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"); + var doubleOperators = parserConf.doubleOperators || new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"); + var doubleDelimiters = parserConf.doubleDelimiters || new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"); + var tripleDelimiters = parserConf.tripleDelimiters || new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"); + + if (parserConf.version && parseInt(parserConf.version, 10) == 3) { + // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator + var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!@]"); + var identifiers = parserConf.identifiers || new RegExp("^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*"); } else { - var style = tokenBaseInner(stream, state); - if (scopeOffset > 0 && dedent(stream, state)) - style += " " + ERRORCLASS; - return style; + var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!]"); + var identifiers = parserConf.identifiers || new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); } - } - return tokenBaseInner(stream, state); - } - function tokenBaseInner(stream, state) { - if (stream.eatSpace()) return null; - - var ch = stream.peek(); - - // Handle Comments - if (ch == "#") { - stream.skipToEnd(); - return "comment"; - } - - // Handle Number Literals - if (stream.match(/^[0-9\.]/, false)) { - var floatLiteral = false; - // Floats - if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; } - if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; } - if (stream.match(/^\.\d+/)) { floatLiteral = true; } - if (floatLiteral) { - // Float literals may be "imaginary" - stream.eat(/J/i); - return "number"; + var hangingIndent = parserConf.hangingIndent || conf.indentUnit; + + var myKeywords = commonKeywords, myBuiltins = commonBuiltins; + if (parserConf.extra_keywords != undefined) { + myKeywords = myKeywords.concat(parserConf.extra_keywords); } - // Integers - var intLiteral = false; - // Hex - if (stream.match(/^0x[0-9a-f]+/i)) intLiteral = true; - // Binary - if (stream.match(/^0b[01]+/i)) intLiteral = true; - // Octal - if (stream.match(/^0o[0-7]+/i)) intLiteral = true; - // Decimal - if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) { - // Decimal literals may be "imaginary" - stream.eat(/J/i); - // TODO - Can you have imaginary longs? - intLiteral = true; + if (parserConf.extra_builtins != undefined) { + myBuiltins = myBuiltins.concat(parserConf.extra_builtins); } - // Zero by itself with no other piece of number. - if (stream.match(/^0(?![\dx])/i)) intLiteral = true; - if (intLiteral) { - // Integer literals may be "long" - stream.eat(/L/i); - return "number"; + if (parserConf.version && parseInt(parserConf.version, 10) == 3) { + myKeywords = myKeywords.concat(py3.keywords); + myBuiltins = myBuiltins.concat(py3.builtins); + var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i"); + } else { + myKeywords = myKeywords.concat(py2.keywords); + myBuiltins = myBuiltins.concat(py2.builtins); + var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i"); + } + var keywords = wordRegexp(myKeywords); + var builtins = wordRegexp(myBuiltins); + + // tokenizers + function tokenBase(stream, state) { + // Handle scope changes + if (stream.sol() && top(state).type == "py") { + var scopeOffset = top(state).offset; + if (stream.eatSpace()) { + var lineOffset = stream.indentation(); + if (lineOffset > scopeOffset) + pushScope(stream, state, "py"); + else if (lineOffset < scopeOffset && dedent(stream, state)) + state.errorToken = true; + return null; + } else { + var style = tokenBaseInner(stream, state); + if (scopeOffset > 0 && dedent(stream, state)) + style += " " + ERRORCLASS; + return style; + } + } + return tokenBaseInner(stream, state); } - } - - // Handle Strings - if (stream.match(stringPrefixes)) { - state.tokenize = tokenStringFactory(stream.current()); - return state.tokenize(stream, state); - } - - // Handle operators and Delimiters - if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) - return null; - - if (stream.match(doubleOperators) - || stream.match(singleOperators) - || stream.match(wordOperators)) - return "operator"; - - if (stream.match(singleDelimiters)) - return null; - - if (stream.match(keywords)) - return "keyword"; - - if (stream.match(builtins)) - return "builtin"; - - if (stream.match(/^(self|cls)\b/)) - return "variable-2"; - - if (stream.match(identifiers)) { - if (state.lastToken == "def" || state.lastToken == "class") - return "def"; - return "variable"; - } - - // Handle non-detected items - stream.next(); - return ERRORCLASS; - } - - function tokenStringFactory(delimiter) { - while ("rub".indexOf(delimiter.charAt(0).toLowerCase()) >= 0) - delimiter = delimiter.substr(1); - - var singleline = delimiter.length == 1; - var OUTCLASS = "string"; - function tokenString(stream, state) { - while (!stream.eol()) { - stream.eatWhile(/[^'"\\]/); - if (stream.eat("\\")) { + function tokenBaseInner(stream, state) { + if (stream.eatSpace()) return null; + + var ch = stream.peek(); + + // Handle Comments + if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } + + // Handle Number Literals + if (stream.match(/^[0-9\.]/, false)) { + var floatLiteral = false; + // Floats + if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { + floatLiteral = true; + } + if (stream.match(/^\d+\.\d*/)) { + floatLiteral = true; + } + if (stream.match(/^\.\d+/)) { + floatLiteral = true; + } + if (floatLiteral) { + // Float literals may be "imaginary" + stream.eat(/J/i); + return "number"; + } + // Integers + var intLiteral = false; + // Hex + if (stream.match(/^0x[0-9a-f]+/i)) intLiteral = true; + // Binary + if (stream.match(/^0b[01]+/i)) intLiteral = true; + // Octal + if (stream.match(/^0o[0-7]+/i)) intLiteral = true; + // Decimal + if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) { + // Decimal literals may be "imaginary" + stream.eat(/J/i); + // TODO - Can you have imaginary longs? + intLiteral = true; + } + // Zero by itself with no other piece of number. + if (stream.match(/^0(?![\dx])/i)) intLiteral = true; + if (intLiteral) { + // Integer literals may be "long" + stream.eat(/L/i); + return "number"; + } + } + + // Handle Strings + if (stream.match(stringPrefixes)) { + state.tokenize = tokenStringFactory(stream.current()); + return state.tokenize(stream, state); + } + + // Handle operators and Delimiters + if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) + return null; + + if (stream.match(doubleOperators) + || stream.match(singleOperators) + || stream.match(wordOperators)) + return "operator"; + + if (stream.match(singleDelimiters)) + return null; + + if (stream.match(keywords)) + return "keyword"; + + if (stream.match(builtins)) + return "builtin"; + + if (stream.match(/^(self|cls)\b/)) + return "variable-2"; + + if (stream.match(identifiers)) { + if (state.lastToken == "def" || state.lastToken == "class") + return "def"; + return "variable"; + } + + // Handle non-detected items stream.next(); - if (singleline && stream.eol()) - return OUTCLASS; - } else if (stream.match(delimiter)) { - state.tokenize = tokenBase; - return OUTCLASS; - } else { - stream.eat(/['"]/); - } - } - if (singleline) { - if (parserConf.singleLineStringErrors) return ERRORCLASS; - else - state.tokenize = tokenBase; } - return OUTCLASS; - } - tokenString.isString = true; - return tokenString; - } - function pushScope(stream, state, type) { - var offset = 0, align = null; - if (type == "py") { - while (top(state).type != "py") - state.scopes.pop(); - } - offset = top(state).offset + (type == "py" ? conf.indentUnit : hangingIndent); - if (type != "py" && !stream.match(/^(\s|#.*)*$/, false)) - align = stream.column() + 1; - state.scopes.push({offset: offset, type: type, align: align}); - } + function tokenStringFactory(delimiter) { + while ("rub".indexOf(delimiter.charAt(0).toLowerCase()) >= 0) + delimiter = delimiter.substr(1); + + var singleline = delimiter.length == 1; + var OUTCLASS = "string"; + + function tokenString(stream, state) { + while (!stream.eol()) { + stream.eatWhile(/[^'"\\]/); + if (stream.eat("\\")) { + stream.next(); + if (singleline && stream.eol()) + return OUTCLASS; + } else if (stream.match(delimiter)) { + state.tokenize = tokenBase; + return OUTCLASS; + } else { + stream.eat(/['"]/); + } + } + if (singleline) { + if (parserConf.singleLineStringErrors) + return ERRORCLASS; + else + state.tokenize = tokenBase; + } + return OUTCLASS; + } + + tokenString.isString = true; + return tokenString; + } - function dedent(stream, state) { - var indented = stream.indentation(); - while (top(state).offset > indented) { - if (top(state).type != "py") return true; - state.scopes.pop(); - } - return top(state).offset != indented; - } + function pushScope(stream, state, type) { + var offset = 0, align = null; + if (type == "py") { + while (top(state).type != "py") + state.scopes.pop(); + } + offset = top(state).offset + (type == "py" ? conf.indentUnit : hangingIndent); + if (type != "py" && !stream.match(/^(\s|#.*)*$/, false)) + align = stream.column() + 1; + state.scopes.push({offset: offset, type: type, align: align}); + } - function tokenLexer(stream, state) { - var style = state.tokenize(stream, state); - var current = stream.current(); - - // Handle '.' connected identifiers - if (current == ".") { - style = stream.match(identifiers, false) ? null : ERRORCLASS; - if (style == null && state.lastStyle == "meta") { - // Apply 'meta' style to '.' connected identifiers when - // appropriate. - style = "meta"; + function dedent(stream, state) { + var indented = stream.indentation(); + while (top(state).offset > indented) { + if (top(state).type != "py") return true; + state.scopes.pop(); + } + return top(state).offset != indented; } - return style; - } - // Handle decorators - if (current == "@"){ - if(parserConf.version && parseInt(parserConf.version, 10) == 3){ - return stream.match(identifiers, false) ? "meta" : "operator"; - } else { - return stream.match(identifiers, false) ? "meta" : ERRORCLASS; + function tokenLexer(stream, state) { + var style = state.tokenize(stream, state); + var current = stream.current(); + + // Handle '.' connected identifiers + if (current == ".") { + style = stream.match(identifiers, false) ? null : ERRORCLASS; + if (style == null && state.lastStyle == "meta") { + // Apply 'meta' style to '.' connected identifiers when + // appropriate. + style = "meta"; + } + return style; + } + + // Handle decorators + if (current == "@") { + if (parserConf.version && parseInt(parserConf.version, 10) == 3) { + return stream.match(identifiers, false) ? "meta" : "operator"; + } else { + return stream.match(identifiers, false) ? "meta" : ERRORCLASS; + } + } + + if ((style == "variable" || style == "builtin") + && state.lastStyle == "meta") + style = "meta"; + + // Handle scope changes. + if (current == "pass" || current == "return") + state.dedent += 1; + + if (current == "lambda") state.lambda = true; + if (current == ":" && !state.lambda && top(state).type == "py") + pushScope(stream, state, "py"); + + var delimiter_index = current.length == 1 ? "[({".indexOf(current) : -1; + if (delimiter_index != -1) + pushScope(stream, state, "])}".slice(delimiter_index, delimiter_index + 1)); + + delimiter_index = "])}".indexOf(current); + if (delimiter_index != -1) { + if (top(state).type == current) state.scopes.pop(); + else return ERRORCLASS; + } + if (state.dedent > 0 && stream.eol() && top(state).type == "py") { + if (state.scopes.length > 1) state.scopes.pop(); + state.dedent -= 1; + } + + return style; } - } - - if ((style == "variable" || style == "builtin") - && state.lastStyle == "meta") - style = "meta"; - - // Handle scope changes. - if (current == "pass" || current == "return") - state.dedent += 1; - - if (current == "lambda") state.lambda = true; - if (current == ":" && !state.lambda && top(state).type == "py") - pushScope(stream, state, "py"); - - var delimiter_index = current.length == 1 ? "[({".indexOf(current) : -1; - if (delimiter_index != -1) - pushScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1)); - - delimiter_index = "])}".indexOf(current); - if (delimiter_index != -1) { - if (top(state).type == current) state.scopes.pop(); - else return ERRORCLASS; - } - if (state.dedent > 0 && stream.eol() && top(state).type == "py") { - if (state.scopes.length > 1) state.scopes.pop(); - state.dedent -= 1; - } - - return style; - } - var external = { - startState: function(basecolumn) { - return { - tokenize: tokenBase, - scopes: [{offset: basecolumn || 0, type: "py", align: null}], - lastStyle: null, - lastToken: null, - lambda: false, - dedent: 0 + var external = { + startState: function (basecolumn) { + return { + tokenize: tokenBase, + scopes: [{offset: basecolumn || 0, type: "py", align: null}], + lastStyle: null, + lastToken: null, + lambda: false, + dedent: 0 + }; + }, + + token: function (stream, state) { + var addErr = state.errorToken; + if (addErr) state.errorToken = false; + var style = tokenLexer(stream, state); + + state.lastStyle = style; + + var current = stream.current(); + if (current && style) + state.lastToken = current; + + if (stream.eol() && state.lambda) + state.lambda = false; + return addErr ? style + " " + ERRORCLASS : style; + }, + + indent: function (state, textAfter) { + if (state.tokenize != tokenBase) + return state.tokenize.isString ? CodeMirror.Pass : 0; + + var scope = top(state); + var closing = textAfter && textAfter.charAt(0) == scope.type; + if (scope.align != null) + return scope.align - (closing ? 1 : 0); + else if (closing && state.scopes.length > 1) + return state.scopes[state.scopes.length - 2].offset; + else + return scope.offset; + }, + + lineComment: "#", + fold: "indent" }; - }, - - token: function(stream, state) { - var addErr = state.errorToken; - if (addErr) state.errorToken = false; - var style = tokenLexer(stream, state); - - state.lastStyle = style; - - var current = stream.current(); - if (current && style) - state.lastToken = current; - - if (stream.eol() && state.lambda) - state.lambda = false; - return addErr ? style + " " + ERRORCLASS : style; - }, - - indent: function(state, textAfter) { - if (state.tokenize != tokenBase) - return state.tokenize.isString ? CodeMirror.Pass : 0; - - var scope = top(state); - var closing = textAfter && textAfter.charAt(0) == scope.type; - if (scope.align != null) - return scope.align - (closing ? 1 : 0); - else if (closing && state.scopes.length > 1) - return state.scopes[state.scopes.length - 2].offset; - else - return scope.offset; - }, - - lineComment: "#", - fold: "indent" - }; - return external; - }); + return external; + }); - CodeMirror.defineMIME("text/x-python", "python"); + CodeMirror.defineMIME("text/x-python", "python"); - var words = function(str) { return str.split(" "); }; + var words = function (str) { + return str.split(" "); + }; - CodeMirror.defineMIME("text/x-cython", { - name: "python", - extra_keywords: words("by cdef cimport cpdef ctypedef enum except"+ - "extern gil include nogil property public"+ - "readonly struct union DEF IF ELIF ELSE") - }); + CodeMirror.defineMIME("text/x-cython", { + name: "python", + extra_keywords: words("by cdef cimport cpdef ctypedef enum except" + + "extern gil include nogil property public" + + "readonly struct union DEF IF ELIF ELSE") + }); }); diff --git a/web/editor.md/lib/codemirror/mode/q/index.html b/web/editor.md/lib/codemirror/mode/q/index.html index 72785ba..39cb211 100644 --- a/web/editor.md/lib/codemirror/mode/q/index.html +++ b/web/editor.md/lib/codemirror/mode/q/index.html @@ -2,32 +2,35 @@ CodeMirror: Q mode - + - + - +
-

Q mode

+

Q mode

-

MIME type defined: text/x-q.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/q/q.js b/web/editor.md/lib/codemirror/mode/q/q.js index a4af938..ed1e21f 100644 --- a/web/editor.md/lib/codemirror/mode/q/q.js +++ b/web/editor.md/lib/codemirror/mode/q/q.js @@ -1,139 +1,161 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("q",function(config){ - var indentUnit=config.indentUnit, - curPunc, - keywords=buildRE(["abs","acos","aj","aj0","all","and","any","asc","asin","asof","atan","attr","avg","avgs","bin","by","ceiling","cols","cor","cos","count","cov","cross","csv","cut","delete","deltas","desc","dev","differ","distinct","div","do","each","ej","enlist","eval","except","exec","exit","exp","fby","fills","first","fkeys","flip","floor","from","get","getenv","group","gtime","hclose","hcount","hdel","hopen","hsym","iasc","idesc","if","ij","in","insert","inter","inv","key","keys","last","like","list","lj","load","log","lower","lsq","ltime","ltrim","mavg","max","maxs","mcount","md5","mdev","med","meta","min","mins","mmax","mmin","mmu","mod","msum","neg","next","not","null","or","over","parse","peach","pj","plist","prd","prds","prev","prior","rand","rank","ratios","raze","read0","read1","reciprocal","reverse","rload","rotate","rsave","rtrim","save","scan","select","set","setenv","show","signum","sin","sqrt","ss","ssr","string","sublist","sum","sums","sv","system","tables","tan","til","trim","txf","type","uj","ungroup","union","update","upper","upsert","value","var","view","views","vs","wavg","where","where","while","within","wj","wj1","wsum","xasc","xbar","xcol","xcols","xdesc","xexp","xgroup","xkey","xlog","xprev","xrank"]), - E=/[|/&^!+:\\\-*%$=~#;@><,?_\'\"\[\(\]\)\s{}]/; - function buildRE(w){return new RegExp("^("+w.join("|")+")$");} - function tokenBase(stream,state){ - var sol=stream.sol(),c=stream.next(); - curPunc=null; - if(sol) - if(c=="/") - return(state.tokenize=tokenLineComment)(stream,state); - else if(c=="\\"){ - if(stream.eol()||/\s/.test(stream.peek())) - return stream.skipToEnd(),/^\\\s*$/.test(stream.current())?(state.tokenize=tokenCommentToEOF)(stream, state):state.tokenize=tokenBase,"comment"; - else - return state.tokenize=tokenBase,"builtin"; - } - if(/\s/.test(c)) - return stream.peek()=="/"?(stream.skipToEnd(),"comment"):"whitespace"; - if(c=='"') - return(state.tokenize=tokenString)(stream,state); - if(c=='`') - return stream.eatWhile(/[A-Z|a-z|\d|_|:|\/|\.]/),"symbol"; - if(("."==c&&/\d/.test(stream.peek()))||/\d/.test(c)){ - var t=null; - stream.backUp(1); - if(stream.match(/^\d{4}\.\d{2}(m|\.\d{2}([D|T](\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)?)?)/) - || stream.match(/^\d+D(\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)/) - || stream.match(/^\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?/) - || stream.match(/^\d+[ptuv]{1}/)) - t="temporal"; - else if(stream.match(/^0[NwW]{1}/) - || stream.match(/^0x[\d|a-f|A-F]*/) - || stream.match(/^[0|1]+[b]{1}/) - || stream.match(/^\d+[chijn]{1}/) - || stream.match(/-?\d*(\.\d*)?(e[+\-]?\d+)?(e|f)?/)) - t="number"; - return(t&&(!(c=stream.peek())||E.test(c)))?t:(stream.next(),"error"); - } - if(/[A-Z|a-z]|\./.test(c)) - return stream.eatWhile(/[A-Z|a-z|\.|_|\d]/),keywords.test(stream.current())?"keyword":"variable"; - if(/[|/&^!+:\\\-*%$=~#;@><\.,?_\']/.test(c)) - return null; - if(/[{}\(\[\]\)]/.test(c)) - return null; - return"error"; - } - function tokenLineComment(stream,state){ - return stream.skipToEnd(),/\/\s*$/.test(stream.current())?(state.tokenize=tokenBlockComment)(stream,state):(state.tokenize=tokenBase),"comment"; - } - function tokenBlockComment(stream,state){ - var f=stream.sol()&&stream.peek()=="\\"; - stream.skipToEnd(); - if(f&&/^\\\s*$/.test(stream.current())) - state.tokenize=tokenBase; - return"comment"; - } - function tokenCommentToEOF(stream){return stream.skipToEnd(),"comment";} - function tokenString(stream,state){ - var escaped=false,next,end=false; - while((next=stream.next())){ - if(next=="\""&&!escaped){end=true;break;} - escaped=!escaped&&next=="\\"; - } - if(end)state.tokenize=tokenBase; - return"string"; - } - function pushContext(state,type,col){state.context={prev:state.context,indent:state.indent,col:col,type:type};} - function popContext(state){state.indent=state.context.indent;state.context=state.context.prev;} - return{ - startState:function(){ - return{tokenize:tokenBase, - context:null, - indent:0, - col:0}; - }, - token:function(stream,state){ - if(stream.sol()){ - if(state.context&&state.context.align==null) - state.context.align=false; - state.indent=stream.indentation(); - } - //if (stream.eatSpace()) return null; - var style=state.tokenize(stream,state); - if(style!="comment"&&state.context&&state.context.align==null&&state.context.type!="pattern"){ - state.context.align=true; - } - if(curPunc=="(")pushContext(state,")",stream.column()); - else if(curPunc=="[")pushContext(state,"]",stream.column()); - else if(curPunc=="{")pushContext(state,"}",stream.column()); - else if(/[\]\}\)]/.test(curPunc)){ - while(state.context&&state.context.type=="pattern")popContext(state); - if(state.context&&curPunc==state.context.type)popContext(state); - } - else if(curPunc=="."&&state.context&&state.context.type=="pattern")popContext(state); - else if(/atom|string|variable/.test(style)&&state.context){ - if(/[\}\]]/.test(state.context.type)) - pushContext(state,"pattern",stream.column()); - else if(state.context.type=="pattern"&&!state.context.align){ - state.context.align=true; - state.context.col=stream.column(); + CodeMirror.defineMode("q", function (config) { + var indentUnit = config.indentUnit, + curPunc, + keywords = buildRE(["abs", "acos", "aj", "aj0", "all", "and", "any", "asc", "asin", "asof", "atan", "attr", "avg", "avgs", "bin", "by", "ceiling", "cols", "cor", "cos", "count", "cov", "cross", "csv", "cut", "delete", "deltas", "desc", "dev", "differ", "distinct", "div", "do", "each", "ej", "enlist", "eval", "except", "exec", "exit", "exp", "fby", "fills", "first", "fkeys", "flip", "floor", "from", "get", "getenv", "group", "gtime", "hclose", "hcount", "hdel", "hopen", "hsym", "iasc", "idesc", "if", "ij", "in", "insert", "inter", "inv", "key", "keys", "last", "like", "list", "lj", "load", "log", "lower", "lsq", "ltime", "ltrim", "mavg", "max", "maxs", "mcount", "md5", "mdev", "med", "meta", "min", "mins", "mmax", "mmin", "mmu", "mod", "msum", "neg", "next", "not", "null", "or", "over", "parse", "peach", "pj", "plist", "prd", "prds", "prev", "prior", "rand", "rank", "ratios", "raze", "read0", "read1", "reciprocal", "reverse", "rload", "rotate", "rsave", "rtrim", "save", "scan", "select", "set", "setenv", "show", "signum", "sin", "sqrt", "ss", "ssr", "string", "sublist", "sum", "sums", "sv", "system", "tables", "tan", "til", "trim", "txf", "type", "uj", "ungroup", "union", "update", "upper", "upsert", "value", "var", "view", "views", "vs", "wavg", "where", "where", "while", "within", "wj", "wj1", "wsum", "xasc", "xbar", "xcol", "xcols", "xdesc", "xexp", "xgroup", "xkey", "xlog", "xprev", "xrank"]), + E = /[|/&^!+:\\\-*%$=~#;@><,?_\'\"\[\(\]\)\s{}]/; + + function buildRE(w) { + return new RegExp("^(" + w.join("|") + ")$"); } - } - return style; - }, - indent:function(state,textAfter){ - var firstChar=textAfter&&textAfter.charAt(0); - var context=state.context; - if(/[\]\}]/.test(firstChar)) - while (context&&context.type=="pattern")context=context.prev; - var closing=context&&firstChar==context.type; - if(!context) - return 0; - else if(context.type=="pattern") - return context.col; - else if(context.align) - return context.col+(closing?0:1); - else - return context.indent+(closing?0:indentUnit); - } - }; -}); -CodeMirror.defineMIME("text/x-q","q"); + + function tokenBase(stream, state) { + var sol = stream.sol(), c = stream.next(); + curPunc = null; + if (sol) + if (c == "/") + return (state.tokenize = tokenLineComment)(stream, state); + else if (c == "\\") { + if (stream.eol() || /\s/.test(stream.peek())) + return stream.skipToEnd(), /^\\\s*$/.test(stream.current()) ? (state.tokenize = tokenCommentToEOF)(stream, state) : state.tokenize = tokenBase, "comment"; + else + return state.tokenize = tokenBase, "builtin"; + } + if (/\s/.test(c)) + return stream.peek() == "/" ? (stream.skipToEnd(), "comment") : "whitespace"; + if (c == '"') + return (state.tokenize = tokenString)(stream, state); + if (c == '`') + return stream.eatWhile(/[A-Z|a-z|\d|_|:|\/|\.]/), "symbol"; + if (("." == c && /\d/.test(stream.peek())) || /\d/.test(c)) { + var t = null; + stream.backUp(1); + if (stream.match(/^\d{4}\.\d{2}(m|\.\d{2}([D|T](\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)?)?)/) + || stream.match(/^\d+D(\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)/) + || stream.match(/^\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?/) + || stream.match(/^\d+[ptuv]{1}/)) + t = "temporal"; + else if (stream.match(/^0[NwW]{1}/) + || stream.match(/^0x[\d|a-f|A-F]*/) + || stream.match(/^[0|1]+[b]{1}/) + || stream.match(/^\d+[chijn]{1}/) + || stream.match(/-?\d*(\.\d*)?(e[+\-]?\d+)?(e|f)?/)) + t = "number"; + return (t && (!(c = stream.peek()) || E.test(c))) ? t : (stream.next(), "error"); + } + if (/[A-Z|a-z]|\./.test(c)) + return stream.eatWhile(/[A-Z|a-z|\.|_|\d]/), keywords.test(stream.current()) ? "keyword" : "variable"; + if (/[|/&^!+:\\\-*%$=~#;@><\.,?_\']/.test(c)) + return null; + if (/[{}\(\[\]\)]/.test(c)) + return null; + return "error"; + } + + function tokenLineComment(stream, state) { + return stream.skipToEnd(), /\/\s*$/.test(stream.current()) ? (state.tokenize = tokenBlockComment)(stream, state) : (state.tokenize = tokenBase), "comment"; + } + + function tokenBlockComment(stream, state) { + var f = stream.sol() && stream.peek() == "\\"; + stream.skipToEnd(); + if (f && /^\\\s*$/.test(stream.current())) + state.tokenize = tokenBase; + return "comment"; + } + + function tokenCommentToEOF(stream) { + return stream.skipToEnd(), "comment"; + } + + function tokenString(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next())) { + if (next == "\"" && !escaped) { + end = true; + break; + } + escaped = !escaped && next == "\\"; + } + if (end) state.tokenize = tokenBase; + return "string"; + } + + function pushContext(state, type, col) { + state.context = {prev: state.context, indent: state.indent, col: col, type: type}; + } + + function popContext(state) { + state.indent = state.context.indent; + state.context = state.context.prev; + } + + return { + startState: function () { + return { + tokenize: tokenBase, + context: null, + indent: 0, + col: 0 + }; + }, + token: function (stream, state) { + if (stream.sol()) { + if (state.context && state.context.align == null) + state.context.align = false; + state.indent = stream.indentation(); + } + //if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") { + state.context.align = true; + } + if (curPunc == "(") pushContext(state, ")", stream.column()); + else if (curPunc == "[") pushContext(state, "]", stream.column()); + else if (curPunc == "{") pushContext(state, "}", stream.column()); + else if (/[\]\}\)]/.test(curPunc)) { + while (state.context && state.context.type == "pattern") popContext(state); + if (state.context && curPunc == state.context.type) popContext(state); + } else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state); + else if (/atom|string|variable/.test(style) && state.context) { + if (/[\}\]]/.test(state.context.type)) + pushContext(state, "pattern", stream.column()); + else if (state.context.type == "pattern" && !state.context.align) { + state.context.align = true; + state.context.col = stream.column(); + } + } + return style; + }, + indent: function (state, textAfter) { + var firstChar = textAfter && textAfter.charAt(0); + var context = state.context; + if (/[\]\}]/.test(firstChar)) + while (context && context.type == "pattern") context = context.prev; + var closing = context && firstChar == context.type; + if (!context) + return 0; + else if (context.type == "pattern") + return context.col; + else if (context.align) + return context.col + (closing ? 0 : 1); + else + return context.indent + (closing ? 0 : indentUnit); + } + }; + }); + CodeMirror.defineMIME("text/x-q", "q"); }); diff --git a/web/editor.md/lib/codemirror/mode/r/index.html b/web/editor.md/lib/codemirror/mode/r/index.html index 6dd9634..0fdb060 100644 --- a/web/editor.md/lib/codemirror/mode/r/index.html +++ b/web/editor.md/lib/codemirror/mode/r/index.html @@ -2,35 +2,52 @@ CodeMirror: R mode - + - + + .CodeMirror { + border-top: 1px solid silver; + border-bottom: 1px solid silver; + } + + .cm-s-default span.cm-semi { + color: blue; + font-weight: bold; + } + + .cm-s-default span.cm-dollar { + color: orange; + font-weight: bold; + } + + .cm-s-default span.cm-arrow { + color: brown; + } + + .cm-s-default span.cm-arg-is { + color: brown; + } +
-

R mode

-

MIME types defined: text/x-rsrc.

Development of the CodeMirror R mode was kindly sponsored - by Ubalo.

+ by Ubalo.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/r/r.js b/web/editor.md/lib/codemirror/mode/r/r.js index 1ab4a95..1c591f6 100644 --- a/web/editor.md/lib/codemirror/mode/r/r.js +++ b/web/editor.md/lib/codemirror/mode/r/r.js @@ -1,162 +1,175 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("r", function(config) { - function wordObj(str) { - var words = str.split(" "), res = {}; - for (var i = 0; i < words.length; ++i) res[words[i]] = true; - return res; - } - var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_"); - var builtins = wordObj("list quote bquote eval return call parse deparse"); - var keywords = wordObj("if else repeat while function for in next break"); - var blockkeywords = wordObj("if else repeat while function for"); - var opChars = /[+\-*\/^<>=!&|~$:]/; - var curPunc; + CodeMirror.defineMode("r", function (config) { + function wordObj(str) { + var words = str.split(" "), res = {}; + for (var i = 0; i < words.length; ++i) res[words[i]] = true; + return res; + } - function tokenBase(stream, state) { - curPunc = null; - var ch = stream.next(); - if (ch == "#") { - stream.skipToEnd(); - return "comment"; - } else if (ch == "0" && stream.eat("x")) { - stream.eatWhile(/[\da-f]/i); - return "number"; - } else if (ch == "." && stream.eat(/\d/)) { - stream.match(/\d*(?:e[+\-]?\d+)?/); - return "number"; - } else if (/\d/.test(ch)) { - stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/); - return "number"; - } else if (ch == "'" || ch == '"') { - state.tokenize = tokenString(ch); - return "string"; - } else if (ch == "." && stream.match(/.[.\d]+/)) { - return "keyword"; - } else if (/[\w\.]/.test(ch) && ch != "_") { - stream.eatWhile(/[\w\.]/); - var word = stream.current(); - if (atoms.propertyIsEnumerable(word)) return "atom"; - if (keywords.propertyIsEnumerable(word)) { - // Block keywords start new blocks, except 'else if', which only starts - // one new block for the 'if', no block for the 'else'. - if (blockkeywords.propertyIsEnumerable(word) && - !stream.match(/\s*if(\s+|$)/, false)) - curPunc = "block"; - return "keyword"; - } - if (builtins.propertyIsEnumerable(word)) return "builtin"; - return "variable"; - } else if (ch == "%") { - if (stream.skipTo("%")) stream.next(); - return "variable-2"; - } else if (ch == "<" && stream.eat("-")) { - return "arrow"; - } else if (ch == "=" && state.ctx.argList) { - return "arg-is"; - } else if (opChars.test(ch)) { - if (ch == "$") return "dollar"; - stream.eatWhile(opChars); - return "operator"; - } else if (/[\(\){}\[\];]/.test(ch)) { - curPunc = ch; - if (ch == ";") return "semi"; - return null; - } else { - return null; - } - } + var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_"); + var builtins = wordObj("list quote bquote eval return call parse deparse"); + var keywords = wordObj("if else repeat while function for in next break"); + var blockkeywords = wordObj("if else repeat while function for"); + var opChars = /[+\-*\/^<>=!&|~$:]/; + var curPunc; - function tokenString(quote) { - return function(stream, state) { - if (stream.eat("\\")) { - var ch = stream.next(); - if (ch == "x") stream.match(/^[a-f0-9]{2}/i); - else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next(); - else if (ch == "u") stream.match(/^[a-f0-9]{4}/i); - else if (ch == "U") stream.match(/^[a-f0-9]{8}/i); - else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/); - return "string-2"; - } else { - var next; - while ((next = stream.next()) != null) { - if (next == quote) { state.tokenize = tokenBase; break; } - if (next == "\\") { stream.backUp(1); break; } + function tokenBase(stream, state) { + curPunc = null; + var ch = stream.next(); + if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } else if (ch == "0" && stream.eat("x")) { + stream.eatWhile(/[\da-f]/i); + return "number"; + } else if (ch == "." && stream.eat(/\d/)) { + stream.match(/\d*(?:e[+\-]?\d+)?/); + return "number"; + } else if (/\d/.test(ch)) { + stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/); + return "number"; + } else if (ch == "'" || ch == '"') { + state.tokenize = tokenString(ch); + return "string"; + } else if (ch == "." && stream.match(/.[.\d]+/)) { + return "keyword"; + } else if (/[\w\.]/.test(ch) && ch != "_") { + stream.eatWhile(/[\w\.]/); + var word = stream.current(); + if (atoms.propertyIsEnumerable(word)) return "atom"; + if (keywords.propertyIsEnumerable(word)) { + // Block keywords start new blocks, except 'else if', which only starts + // one new block for the 'if', no block for the 'else'. + if (blockkeywords.propertyIsEnumerable(word) && + !stream.match(/\s*if(\s+|$)/, false)) + curPunc = "block"; + return "keyword"; + } + if (builtins.propertyIsEnumerable(word)) return "builtin"; + return "variable"; + } else if (ch == "%") { + if (stream.skipTo("%")) stream.next(); + return "variable-2"; + } else if (ch == "<" && stream.eat("-")) { + return "arrow"; + } else if (ch == "=" && state.ctx.argList) { + return "arg-is"; + } else if (opChars.test(ch)) { + if (ch == "$") return "dollar"; + stream.eatWhile(opChars); + return "operator"; + } else if (/[\(\){}\[\];]/.test(ch)) { + curPunc = ch; + if (ch == ";") return "semi"; + return null; + } else { + return null; + } } - return "string"; - } - }; - } - function push(state, type, stream) { - state.ctx = {type: type, - indent: state.indent, - align: null, - column: stream.column(), - prev: state.ctx}; - } - function pop(state) { - state.indent = state.ctx.indent; - state.ctx = state.ctx.prev; - } + function tokenString(quote) { + return function (stream, state) { + if (stream.eat("\\")) { + var ch = stream.next(); + if (ch == "x") stream.match(/^[a-f0-9]{2}/i); + else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next(); + else if (ch == "u") stream.match(/^[a-f0-9]{4}/i); + else if (ch == "U") stream.match(/^[a-f0-9]{8}/i); + else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/); + return "string-2"; + } else { + var next; + while ((next = stream.next()) != null) { + if (next == quote) { + state.tokenize = tokenBase; + break; + } + if (next == "\\") { + stream.backUp(1); + break; + } + } + return "string"; + } + }; + } - return { - startState: function() { - return {tokenize: tokenBase, - ctx: {type: "top", - indent: -config.indentUnit, - align: false}, - indent: 0, - afterIdent: false}; - }, + function push(state, type, stream) { + state.ctx = { + type: type, + indent: state.indent, + align: null, + column: stream.column(), + prev: state.ctx + }; + } - token: function(stream, state) { - if (stream.sol()) { - if (state.ctx.align == null) state.ctx.align = false; - state.indent = stream.indentation(); - } - if (stream.eatSpace()) return null; - var style = state.tokenize(stream, state); - if (style != "comment" && state.ctx.align == null) state.ctx.align = true; + function pop(state) { + state.indent = state.ctx.indent; + state.ctx = state.ctx.prev; + } - var ctype = state.ctx.type; - if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state); - if (curPunc == "{") push(state, "}", stream); - else if (curPunc == "(") { - push(state, ")", stream); - if (state.afterIdent) state.ctx.argList = true; - } - else if (curPunc == "[") push(state, "]", stream); - else if (curPunc == "block") push(state, "block", stream); - else if (curPunc == ctype) pop(state); - state.afterIdent = style == "variable" || style == "keyword"; - return style; - }, + return { + startState: function () { + return { + tokenize: tokenBase, + ctx: { + type: "top", + indent: -config.indentUnit, + align: false + }, + indent: 0, + afterIdent: false + }; + }, - indent: function(state, textAfter) { - if (state.tokenize != tokenBase) return 0; - var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx, - closing = firstChar == ctx.type; - if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit); - else if (ctx.align) return ctx.column + (closing ? 0 : 1); - else return ctx.indent + (closing ? 0 : config.indentUnit); - }, + token: function (stream, state) { + if (stream.sol()) { + if (state.ctx.align == null) state.ctx.align = false; + state.indent = stream.indentation(); + } + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + if (style != "comment" && state.ctx.align == null) state.ctx.align = true; - lineComment: "#" - }; -}); + var ctype = state.ctx.type; + if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state); + if (curPunc == "{") push(state, "}", stream); + else if (curPunc == "(") { + push(state, ")", stream); + if (state.afterIdent) state.ctx.argList = true; + } else if (curPunc == "[") push(state, "]", stream); + else if (curPunc == "block") push(state, "block", stream); + else if (curPunc == ctype) pop(state); + state.afterIdent = style == "variable" || style == "keyword"; + return style; + }, + + indent: function (state, textAfter) { + if (state.tokenize != tokenBase) return 0; + var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx, + closing = firstChar == ctx.type; + if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit); + else if (ctx.align) return ctx.column + (closing ? 0 : 1); + else return ctx.indent + (closing ? 0 : config.indentUnit); + }, + + lineComment: "#" + }; + }); -CodeMirror.defineMIME("text/x-rsrc", "r"); + CodeMirror.defineMIME("text/x-rsrc", "r"); }); diff --git a/web/editor.md/lib/codemirror/mode/rpm/changes/index.html b/web/editor.md/lib/codemirror/mode/rpm/changes/index.html index 6e5031b..606ce48 100644 --- a/web/editor.md/lib/codemirror/mode/rpm/changes/index.html +++ b/web/editor.md/lib/codemirror/mode/rpm/changes/index.html @@ -2,30 +2,33 @@ CodeMirror: RPM changes mode - + - - - - - + + + + +
-

RPM changes mode

+

RPM changes mode

MIME types defined: text/x-rpm-changes.

diff --git a/web/editor.md/lib/codemirror/mode/rpm/index.html b/web/editor.md/lib/codemirror/mode/rpm/index.html index 9a34e6d..28f2c81 100644 --- a/web/editor.md/lib/codemirror/mode/rpm/index.html +++ b/web/editor.md/lib/codemirror/mode/rpm/index.html @@ -2,30 +2,33 @@ CodeMirror: RPM changes mode - + - - - - - + + + + +
-

RPM changes mode

+

RPM changes mode

-

RPM spec mode

- +

RPM spec mode

+

MIME types defined: text/x-rpm-spec, text/x-rpm-changes.

diff --git a/web/editor.md/lib/codemirror/mode/rpm/rpm.js b/web/editor.md/lib/codemirror/mode/rpm/rpm.js index 3bb7cd2..e2f5a20 100644 --- a/web/editor.md/lib/codemirror/mode/rpm/rpm.js +++ b/web/editor.md/lib/codemirror/mode/rpm/rpm.js @@ -1,101 +1,134 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("rpm-changes", function() { - var headerSeperator = /^-+$/; - var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /; - var simpleEmail = /^[\w+.-]+@[\w.-]+/; - - return { - token: function(stream) { - if (stream.sol()) { - if (stream.match(headerSeperator)) { return 'tag'; } - if (stream.match(headerLine)) { return 'tag'; } - } - if (stream.match(simpleEmail)) { return 'string'; } - stream.next(); - return null; - } - }; -}); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("rpm-changes", function () { + var headerSeperator = /^-+$/; + var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /; + var simpleEmail = /^[\w+.-]+@[\w.-]+/; -CodeMirror.defineMIME("text/x-rpm-changes", "rpm-changes"); + return { + token: function (stream) { + if (stream.sol()) { + if (stream.match(headerSeperator)) { + return 'tag'; + } + if (stream.match(headerLine)) { + return 'tag'; + } + } + if (stream.match(simpleEmail)) { + return 'string'; + } + stream.next(); + return null; + } + }; + }); + + CodeMirror.defineMIME("text/x-rpm-changes", "rpm-changes"); // Quick and dirty spec file highlighting -CodeMirror.defineMode("rpm-spec", function() { - var arch = /^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/; + CodeMirror.defineMode("rpm-spec", function () { + var arch = /^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/; - var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildRequires|BuildRoot|AutoReqProv|Provides|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|ExclusiveArch|NoSource|Supplements):/; - var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pre|post|triggerin|triggerun|pretrans|posttrans|verifyscript|check|triggerpostun|triggerprein|trigger)/; - var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros - var control_flow_simple = /^%(else|endif)/; // rpm control flow macros - var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros + var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildRequires|BuildRoot|AutoReqProv|Provides|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|ExclusiveArch|NoSource|Supplements):/; + var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pre|post|triggerin|triggerun|pretrans|posttrans|verifyscript|check|triggerpostun|triggerprein|trigger)/; + var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros + var control_flow_simple = /^%(else|endif)/; // rpm control flow macros + var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros - return { - startState: function () { return { - controlFlow: false, - macroParameters: false, - section: false + startState: function () { + return { + controlFlow: false, + macroParameters: false, + section: false + }; + }, + token: function (stream, state) { + var ch = stream.peek(); + if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } + + if (stream.sol()) { + if (stream.match(preamble)) { + return "preamble"; + } + if (stream.match(section)) { + return "section"; + } + } + + if (stream.match(/^\$\w+/)) { + return "def"; + } // Variables like '$RPM_BUILD_ROOT' + if (stream.match(/^\$\{\w+\}/)) { + return "def"; + } // Variables like '${RPM_BUILD_ROOT}' + + if (stream.match(control_flow_simple)) { + return "keyword"; + } + if (stream.match(control_flow_complex)) { + state.controlFlow = true; + return "keyword"; + } + if (state.controlFlow) { + if (stream.match(operators)) { + return "operator"; + } + if (stream.match(/^(\d+)/)) { + return "number"; + } + if (stream.eol()) { + state.controlFlow = false; + } + } + + if (stream.match(arch)) { + return "number"; + } + + // Macros like '%make_install' or '%attr(0775,root,root)' + if (stream.match(/^%[\w]+/)) { + if (stream.match(/^\(/)) { + state.macroParameters = true; + } + return "macro"; + } + if (state.macroParameters) { + if (stream.match(/^\d+/)) { + return "number"; + } + if (stream.match(/^\)/)) { + state.macroParameters = false; + return "macro"; + } + } + if (stream.match(/^%\{\??[\w \-]+\}/)) { + return "macro"; + } // Macros like '%{defined fedora}' + + //TODO: Include bash script sub-parser (CodeMirror supports that) + stream.next(); + return null; + } }; - }, - token: function (stream, state) { - var ch = stream.peek(); - if (ch == "#") { stream.skipToEnd(); return "comment"; } - - if (stream.sol()) { - if (stream.match(preamble)) { return "preamble"; } - if (stream.match(section)) { return "section"; } - } - - if (stream.match(/^\$\w+/)) { return "def"; } // Variables like '$RPM_BUILD_ROOT' - if (stream.match(/^\$\{\w+\}/)) { return "def"; } // Variables like '${RPM_BUILD_ROOT}' - - if (stream.match(control_flow_simple)) { return "keyword"; } - if (stream.match(control_flow_complex)) { - state.controlFlow = true; - return "keyword"; - } - if (state.controlFlow) { - if (stream.match(operators)) { return "operator"; } - if (stream.match(/^(\d+)/)) { return "number"; } - if (stream.eol()) { state.controlFlow = false; } - } - - if (stream.match(arch)) { return "number"; } - - // Macros like '%make_install' or '%attr(0775,root,root)' - if (stream.match(/^%[\w]+/)) { - if (stream.match(/^\(/)) { state.macroParameters = true; } - return "macro"; - } - if (state.macroParameters) { - if (stream.match(/^\d+/)) { return "number";} - if (stream.match(/^\)/)) { - state.macroParameters = false; - return "macro"; - } - } - if (stream.match(/^%\{\??[\w \-]+\}/)) { return "macro"; } // Macros like '%{defined fedora}' - - //TODO: Include bash script sub-parser (CodeMirror supports that) - stream.next(); - return null; - } - }; -}); + }); -CodeMirror.defineMIME("text/x-rpm-spec", "rpm-spec"); + CodeMirror.defineMIME("text/x-rpm-spec", "rpm-spec"); }); diff --git a/web/editor.md/lib/codemirror/mode/rst/index.html b/web/editor.md/lib/codemirror/mode/rst/index.html index 2902dea..ae1d59e 100644 --- a/web/editor.md/lib/codemirror/mode/rst/index.html +++ b/web/editor.md/lib/codemirror/mode/rst/index.html @@ -2,30 +2,33 @@ CodeMirror: reStructuredText mode - + - + - +
-

reStructuredText mode

-

The python mode will be used for highlighting blocks @@ -532,4 +535,4 @@

reStructuredText mode

MIME types defined: text/x-rst.

-
+
diff --git a/web/editor.md/lib/codemirror/mode/rst/rst.js b/web/editor.md/lib/codemirror/mode/rst/rst.js index bcf110c..4306f1a 100644 --- a/web/editor.md/lib/codemirror/mode/rst/rst.js +++ b/web/editor.md/lib/codemirror/mode/rst/rst.js @@ -1,555 +1,554 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../python/python"), require("../stex/stex"), require("../../addon/mode/overlay")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../python/python", "../stex/stex", "../../addon/mode/overlay"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode('rst', function (config, options) { - - var rx_strong = /^\*\*[^\*\s](?:[^\*]*[^\*\s])?\*\*/; - var rx_emphasis = /^\*[^\*\s](?:[^\*]*[^\*\s])?\*/; - var rx_literal = /^``[^`\s](?:[^`]*[^`\s])``/; - - var rx_number = /^(?:[\d]+(?:[\.,]\d+)*)/; - var rx_positive = /^(?:\s\+[\d]+(?:[\.,]\d+)*)/; - var rx_negative = /^(?:\s\-[\d]+(?:[\.,]\d+)*)/; - - var rx_uri_protocol = "[Hh][Tt][Tt][Pp][Ss]?://"; - var rx_uri_domain = "(?:[\\d\\w.-]+)\\.(?:\\w{2,6})"; - var rx_uri_path = "(?:/[\\d\\w\\#\\%\\&\\-\\.\\,\\/\\:\\=\\?\\~]+)*"; - var rx_uri = new RegExp("^" + rx_uri_protocol + rx_uri_domain + rx_uri_path); - - var overlay = { - token: function (stream) { - - if (stream.match(rx_strong) && stream.match (/\W+|$/, false)) - return 'strong'; - if (stream.match(rx_emphasis) && stream.match (/\W+|$/, false)) - return 'em'; - if (stream.match(rx_literal) && stream.match (/\W+|$/, false)) - return 'string-2'; - if (stream.match(rx_number)) - return 'number'; - if (stream.match(rx_positive)) - return 'positive'; - if (stream.match(rx_negative)) - return 'negative'; - if (stream.match(rx_uri)) - return 'link'; - - while (stream.next() != null) { - if (stream.match(rx_strong, false)) break; - if (stream.match(rx_emphasis, false)) break; - if (stream.match(rx_literal, false)) break; - if (stream.match(rx_number, false)) break; - if (stream.match(rx_positive, false)) break; - if (stream.match(rx_negative, false)) break; - if (stream.match(rx_uri, false)) break; - } - - return null; - } - }; - - var mode = CodeMirror.getMode( - config, options.backdrop || 'rst-base' - ); - - return CodeMirror.overlayMode(mode, overlay, true); // combine -}, 'python', 'stex'); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../python/python"), require("../stex/stex"), require("../../addon/mode/overlay")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../python/python", "../stex/stex", "../../addon/mode/overlay"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode('rst', function (config, options) { + + var rx_strong = /^\*\*[^\*\s](?:[^\*]*[^\*\s])?\*\*/; + var rx_emphasis = /^\*[^\*\s](?:[^\*]*[^\*\s])?\*/; + var rx_literal = /^``[^`\s](?:[^`]*[^`\s])``/; + + var rx_number = /^(?:[\d]+(?:[\.,]\d+)*)/; + var rx_positive = /^(?:\s\+[\d]+(?:[\.,]\d+)*)/; + var rx_negative = /^(?:\s\-[\d]+(?:[\.,]\d+)*)/; + + var rx_uri_protocol = "[Hh][Tt][Tt][Pp][Ss]?://"; + var rx_uri_domain = "(?:[\\d\\w.-]+)\\.(?:\\w{2,6})"; + var rx_uri_path = "(?:/[\\d\\w\\#\\%\\&\\-\\.\\,\\/\\:\\=\\?\\~]+)*"; + var rx_uri = new RegExp("^" + rx_uri_protocol + rx_uri_domain + rx_uri_path); + + var overlay = { + token: function (stream) { + + if (stream.match(rx_strong) && stream.match(/\W+|$/, false)) + return 'strong'; + if (stream.match(rx_emphasis) && stream.match(/\W+|$/, false)) + return 'em'; + if (stream.match(rx_literal) && stream.match(/\W+|$/, false)) + return 'string-2'; + if (stream.match(rx_number)) + return 'number'; + if (stream.match(rx_positive)) + return 'positive'; + if (stream.match(rx_negative)) + return 'negative'; + if (stream.match(rx_uri)) + return 'link'; + + while (stream.next() != null) { + if (stream.match(rx_strong, false)) break; + if (stream.match(rx_emphasis, false)) break; + if (stream.match(rx_literal, false)) break; + if (stream.match(rx_number, false)) break; + if (stream.match(rx_positive, false)) break; + if (stream.match(rx_negative, false)) break; + if (stream.match(rx_uri, false)) break; + } + + return null; + } + }; + + var mode = CodeMirror.getMode( + config, options.backdrop || 'rst-base' + ); + + return CodeMirror.overlayMode(mode, overlay, true); // combine + }, 'python', 'stex'); /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -CodeMirror.defineMode('rst-base', function (config) { - - /////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////// - - function format(string) { - var args = Array.prototype.slice.call(arguments, 1); - return string.replace(/{(\d+)}/g, function (match, n) { - return typeof args[n] != 'undefined' ? args[n] : match; - }); - } - - /////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////// - - var mode_python = CodeMirror.getMode(config, 'python'); - var mode_stex = CodeMirror.getMode(config, 'stex'); - - /////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////// - - var SEPA = "\\s+"; - var TAIL = "(?:\\s*|\\W|$)", - rx_TAIL = new RegExp(format('^{0}', TAIL)); - - var NAME = - "(?:[^\\W\\d_](?:[\\w!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)", - rx_NAME = new RegExp(format('^{0}', NAME)); - var NAME_WWS = - "(?:[^\\W\\d_](?:[\\w\\s!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)"; - var REF_NAME = format('(?:{0}|`{1}`)', NAME, NAME_WWS); - - var TEXT1 = "(?:[^\\s\\|](?:[^\\|]*[^\\s\\|])?)"; - var TEXT2 = "(?:[^\\`]+)", - rx_TEXT2 = new RegExp(format('^{0}', TEXT2)); - - var rx_section = new RegExp( - "^([!'#$%&\"()*+,-./:;<=>?@\\[\\\\\\]^_`{|}~])\\1{3,}\\s*$"); - var rx_explicit = new RegExp( - format('^\\.\\.{0}', SEPA)); - var rx_link = new RegExp( - format('^_{0}:{1}|^__:{1}', REF_NAME, TAIL)); - var rx_directive = new RegExp( - format('^{0}::{1}', REF_NAME, TAIL)); - var rx_substitution = new RegExp( - format('^\\|{0}\\|{1}{2}::{3}', TEXT1, SEPA, REF_NAME, TAIL)); - var rx_footnote = new RegExp( - format('^\\[(?:\\d+|#{0}?|\\*)]{1}', REF_NAME, TAIL)); - var rx_citation = new RegExp( - format('^\\[{0}\\]{1}', REF_NAME, TAIL)); - - var rx_substitution_ref = new RegExp( - format('^\\|{0}\\|', TEXT1)); - var rx_footnote_ref = new RegExp( - format('^\\[(?:\\d+|#{0}?|\\*)]_', REF_NAME)); - var rx_citation_ref = new RegExp( - format('^\\[{0}\\]_', REF_NAME)); - var rx_link_ref1 = new RegExp( - format('^{0}__?', REF_NAME)); - var rx_link_ref2 = new RegExp( - format('^`{0}`_', TEXT2)); - - var rx_role_pre = new RegExp( - format('^:{0}:`{1}`{2}', NAME, TEXT2, TAIL)); - var rx_role_suf = new RegExp( - format('^`{1}`:{0}:{2}', NAME, TEXT2, TAIL)); - var rx_role = new RegExp( - format('^:{0}:{1}', NAME, TAIL)); - - var rx_directive_name = new RegExp(format('^{0}', REF_NAME)); - var rx_directive_tail = new RegExp(format('^::{0}', TAIL)); - var rx_substitution_text = new RegExp(format('^\\|{0}\\|', TEXT1)); - var rx_substitution_sepa = new RegExp(format('^{0}', SEPA)); - var rx_substitution_name = new RegExp(format('^{0}', REF_NAME)); - var rx_substitution_tail = new RegExp(format('^::{0}', TAIL)); - var rx_link_head = new RegExp("^_"); - var rx_link_name = new RegExp(format('^{0}|_', REF_NAME)); - var rx_link_tail = new RegExp(format('^:{0}', TAIL)); - - var rx_verbatim = new RegExp('^::\\s*$'); - var rx_examples = new RegExp('^\\s+(?:>>>|In \\[\\d+\\]:)\\s'); - - /////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////// - - function to_normal(stream, state) { - var token = null; - - if (stream.sol() && stream.match(rx_examples, false)) { - change(state, to_mode, { - mode: mode_python, local: CodeMirror.startState(mode_python) - }); - } else if (stream.sol() && stream.match(rx_explicit)) { - change(state, to_explicit); - token = 'meta'; - } else if (stream.sol() && stream.match(rx_section)) { - change(state, to_normal); - token = 'header'; - } else if (phase(state) == rx_role_pre || - stream.match(rx_role_pre, false)) { - - switch (stage(state)) { - case 0: - change(state, to_normal, context(rx_role_pre, 1)); - stream.match(/^:/); - token = 'meta'; - break; - case 1: - change(state, to_normal, context(rx_role_pre, 2)); - stream.match(rx_NAME); - token = 'keyword'; - - if (stream.current().match(/^(?:math|latex)/)) { - state.tmp_stex = true; + CodeMirror.defineMode('rst-base', function (config) { + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + function format(string) { + var args = Array.prototype.slice.call(arguments, 1); + return string.replace(/{(\d+)}/g, function (match, n) { + return typeof args[n] != 'undefined' ? args[n] : match; + }); + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + var mode_python = CodeMirror.getMode(config, 'python'); + var mode_stex = CodeMirror.getMode(config, 'stex'); + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + var SEPA = "\\s+"; + var TAIL = "(?:\\s*|\\W|$)", + rx_TAIL = new RegExp(format('^{0}', TAIL)); + + var NAME = + "(?:[^\\W\\d_](?:[\\w!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)", + rx_NAME = new RegExp(format('^{0}', NAME)); + var NAME_WWS = + "(?:[^\\W\\d_](?:[\\w\\s!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)"; + var REF_NAME = format('(?:{0}|`{1}`)', NAME, NAME_WWS); + + var TEXT1 = "(?:[^\\s\\|](?:[^\\|]*[^\\s\\|])?)"; + var TEXT2 = "(?:[^\\`]+)", + rx_TEXT2 = new RegExp(format('^{0}', TEXT2)); + + var rx_section = new RegExp( + "^([!'#$%&\"()*+,-./:;<=>?@\\[\\\\\\]^_`{|}~])\\1{3,}\\s*$"); + var rx_explicit = new RegExp( + format('^\\.\\.{0}', SEPA)); + var rx_link = new RegExp( + format('^_{0}:{1}|^__:{1}', REF_NAME, TAIL)); + var rx_directive = new RegExp( + format('^{0}::{1}', REF_NAME, TAIL)); + var rx_substitution = new RegExp( + format('^\\|{0}\\|{1}{2}::{3}', TEXT1, SEPA, REF_NAME, TAIL)); + var rx_footnote = new RegExp( + format('^\\[(?:\\d+|#{0}?|\\*)]{1}', REF_NAME, TAIL)); + var rx_citation = new RegExp( + format('^\\[{0}\\]{1}', REF_NAME, TAIL)); + + var rx_substitution_ref = new RegExp( + format('^\\|{0}\\|', TEXT1)); + var rx_footnote_ref = new RegExp( + format('^\\[(?:\\d+|#{0}?|\\*)]_', REF_NAME)); + var rx_citation_ref = new RegExp( + format('^\\[{0}\\]_', REF_NAME)); + var rx_link_ref1 = new RegExp( + format('^{0}__?', REF_NAME)); + var rx_link_ref2 = new RegExp( + format('^`{0}`_', TEXT2)); + + var rx_role_pre = new RegExp( + format('^:{0}:`{1}`{2}', NAME, TEXT2, TAIL)); + var rx_role_suf = new RegExp( + format('^`{1}`:{0}:{2}', NAME, TEXT2, TAIL)); + var rx_role = new RegExp( + format('^:{0}:{1}', NAME, TAIL)); + + var rx_directive_name = new RegExp(format('^{0}', REF_NAME)); + var rx_directive_tail = new RegExp(format('^::{0}', TAIL)); + var rx_substitution_text = new RegExp(format('^\\|{0}\\|', TEXT1)); + var rx_substitution_sepa = new RegExp(format('^{0}', SEPA)); + var rx_substitution_name = new RegExp(format('^{0}', REF_NAME)); + var rx_substitution_tail = new RegExp(format('^::{0}', TAIL)); + var rx_link_head = new RegExp("^_"); + var rx_link_name = new RegExp(format('^{0}|_', REF_NAME)); + var rx_link_tail = new RegExp(format('^:{0}', TAIL)); + + var rx_verbatim = new RegExp('^::\\s*$'); + var rx_examples = new RegExp('^\\s+(?:>>>|In \\[\\d+\\]:)\\s'); + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + function to_normal(stream, state) { + var token = null; + + if (stream.sol() && stream.match(rx_examples, false)) { + change(state, to_mode, { + mode: mode_python, local: CodeMirror.startState(mode_python) + }); + } else if (stream.sol() && stream.match(rx_explicit)) { + change(state, to_explicit); + token = 'meta'; + } else if (stream.sol() && stream.match(rx_section)) { + change(state, to_normal); + token = 'header'; + } else if (phase(state) == rx_role_pre || + stream.match(rx_role_pre, false)) { + + switch (stage(state)) { + case 0: + change(state, to_normal, context(rx_role_pre, 1)); + stream.match(/^:/); + token = 'meta'; + break; + case 1: + change(state, to_normal, context(rx_role_pre, 2)); + stream.match(rx_NAME); + token = 'keyword'; + + if (stream.current().match(/^(?:math|latex)/)) { + state.tmp_stex = true; + } + break; + case 2: + change(state, to_normal, context(rx_role_pre, 3)); + stream.match(/^:`/); + token = 'meta'; + break; + case 3: + if (state.tmp_stex) { + state.tmp_stex = undefined; + state.tmp = { + mode: mode_stex, local: CodeMirror.startState(mode_stex) + }; + } + + if (state.tmp) { + if (stream.peek() == '`') { + change(state, to_normal, context(rx_role_pre, 4)); + state.tmp = undefined; + break; + } + + token = state.tmp.mode.token(stream, state.tmp.local); + break; + } + + change(state, to_normal, context(rx_role_pre, 4)); + stream.match(rx_TEXT2); + token = 'string'; + break; + case 4: + change(state, to_normal, context(rx_role_pre, 5)); + stream.match(/^`/); + token = 'meta'; + break; + case 5: + change(state, to_normal, context(rx_role_pre, 6)); + stream.match(rx_TAIL); + break; + default: + change(state, to_normal); + } + } else if (phase(state) == rx_role_suf || + stream.match(rx_role_suf, false)) { + + switch (stage(state)) { + case 0: + change(state, to_normal, context(rx_role_suf, 1)); + stream.match(/^`/); + token = 'meta'; + break; + case 1: + change(state, to_normal, context(rx_role_suf, 2)); + stream.match(rx_TEXT2); + token = 'string'; + break; + case 2: + change(state, to_normal, context(rx_role_suf, 3)); + stream.match(/^`:/); + token = 'meta'; + break; + case 3: + change(state, to_normal, context(rx_role_suf, 4)); + stream.match(rx_NAME); + token = 'keyword'; + break; + case 4: + change(state, to_normal, context(rx_role_suf, 5)); + stream.match(/^:/); + token = 'meta'; + break; + case 5: + change(state, to_normal, context(rx_role_suf, 6)); + stream.match(rx_TAIL); + break; + default: + change(state, to_normal); + } + } else if (phase(state) == rx_role || stream.match(rx_role, false)) { + + switch (stage(state)) { + case 0: + change(state, to_normal, context(rx_role, 1)); + stream.match(/^:/); + token = 'meta'; + break; + case 1: + change(state, to_normal, context(rx_role, 2)); + stream.match(rx_NAME); + token = 'keyword'; + break; + case 2: + change(state, to_normal, context(rx_role, 3)); + stream.match(/^:/); + token = 'meta'; + break; + case 3: + change(state, to_normal, context(rx_role, 4)); + stream.match(rx_TAIL); + break; + default: + change(state, to_normal); + } + } else if (phase(state) == rx_substitution_ref || + stream.match(rx_substitution_ref, false)) { + + switch (stage(state)) { + case 0: + change(state, to_normal, context(rx_substitution_ref, 1)); + stream.match(rx_substitution_text); + token = 'variable-2'; + break; + case 1: + change(state, to_normal, context(rx_substitution_ref, 2)); + if (stream.match(/^_?_?/)) token = 'link'; + break; + default: + change(state, to_normal); + } + } else if (stream.match(rx_footnote_ref)) { + change(state, to_normal); + token = 'quote'; + } else if (stream.match(rx_citation_ref)) { + change(state, to_normal); + token = 'quote'; + } else if (stream.match(rx_link_ref1)) { + change(state, to_normal); + if (!stream.peek() || stream.peek().match(/^\W$/)) { + token = 'link'; + } + } else if (phase(state) == rx_link_ref2 || + stream.match(rx_link_ref2, false)) { + + switch (stage(state)) { + case 0: + if (!stream.peek() || stream.peek().match(/^\W$/)) { + change(state, to_normal, context(rx_link_ref2, 1)); + } else { + stream.match(rx_link_ref2); + } + break; + case 1: + change(state, to_normal, context(rx_link_ref2, 2)); + stream.match(/^`/); + token = 'link'; + break; + case 2: + change(state, to_normal, context(rx_link_ref2, 3)); + stream.match(rx_TEXT2); + break; + case 3: + change(state, to_normal, context(rx_link_ref2, 4)); + stream.match(/^`_/); + token = 'link'; + break; + default: + change(state, to_normal); + } + } else if (stream.match(rx_verbatim)) { + change(state, to_verbatim); + } else { + if (stream.next()) change(state, to_normal); + } + + return token; + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + function to_explicit(stream, state) { + var token = null; + + if (phase(state) == rx_substitution || + stream.match(rx_substitution, false)) { + + switch (stage(state)) { + case 0: + change(state, to_explicit, context(rx_substitution, 1)); + stream.match(rx_substitution_text); + token = 'variable-2'; + break; + case 1: + change(state, to_explicit, context(rx_substitution, 2)); + stream.match(rx_substitution_sepa); + break; + case 2: + change(state, to_explicit, context(rx_substitution, 3)); + stream.match(rx_substitution_name); + token = 'keyword'; + break; + case 3: + change(state, to_explicit, context(rx_substitution, 4)); + stream.match(rx_substitution_tail); + token = 'meta'; + break; + default: + change(state, to_normal); + } + } else if (phase(state) == rx_directive || + stream.match(rx_directive, false)) { + + switch (stage(state)) { + case 0: + change(state, to_explicit, context(rx_directive, 1)); + stream.match(rx_directive_name); + token = 'keyword'; + + if (stream.current().match(/^(?:math|latex)/)) + state.tmp_stex = true; + else if (stream.current().match(/^python/)) + state.tmp_py = true; + break; + case 1: + change(state, to_explicit, context(rx_directive, 2)); + stream.match(rx_directive_tail); + token = 'meta'; + + if (stream.match(/^latex\s*$/) || state.tmp_stex) { + state.tmp_stex = undefined; + change(state, to_mode, { + mode: mode_stex, local: CodeMirror.startState(mode_stex) + }); + } + break; + case 2: + change(state, to_explicit, context(rx_directive, 3)); + if (stream.match(/^python\s*$/) || state.tmp_py) { + state.tmp_py = undefined; + change(state, to_mode, { + mode: mode_python, local: CodeMirror.startState(mode_python) + }); + } + break; + default: + change(state, to_normal); + } + } else if (phase(state) == rx_link || stream.match(rx_link, false)) { + + switch (stage(state)) { + case 0: + change(state, to_explicit, context(rx_link, 1)); + stream.match(rx_link_head); + stream.match(rx_link_name); + token = 'link'; + break; + case 1: + change(state, to_explicit, context(rx_link, 2)); + stream.match(rx_link_tail); + token = 'meta'; + break; + default: + change(state, to_normal); + } + } else if (stream.match(rx_footnote)) { + change(state, to_normal); + token = 'quote'; + } else if (stream.match(rx_citation)) { + change(state, to_normal); + token = 'quote'; + } else { + stream.eatSpace(); + if (stream.eol()) { + change(state, to_normal); + } else { + stream.skipToEnd(); + change(state, to_comment); + token = 'comment'; + } + } + + return token; + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + function to_comment(stream, state) { + return as_block(stream, state, 'comment'); + } + + function to_verbatim(stream, state) { + return as_block(stream, state, 'meta'); } - break; - case 2: - change(state, to_normal, context(rx_role_pre, 3)); - stream.match(/^:`/); - token = 'meta'; - break; - case 3: - if (state.tmp_stex) { - state.tmp_stex = undefined; state.tmp = { - mode: mode_stex, local: CodeMirror.startState(mode_stex) - }; + + function as_block(stream, state, token) { + if (stream.eol() || stream.eatSpace()) { + stream.skipToEnd(); + return token; + } else { + change(state, to_normal); + return null; + } } - if (state.tmp) { - if (stream.peek() == '`') { - change(state, to_normal, context(rx_role_pre, 4)); - state.tmp = undefined; - break; - } + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + function to_mode(stream, state) { + + if (state.ctx.mode && state.ctx.local) { - token = state.tmp.mode.token(stream, state.tmp.local); - break; + if (stream.sol()) { + if (!stream.eatSpace()) change(state, to_normal); + return null; + } + + return state.ctx.mode.token(stream, state.ctx.local); + } + + change(state, to_normal); + return null; } - change(state, to_normal, context(rx_role_pre, 4)); - stream.match(rx_TEXT2); - token = 'string'; - break; - case 4: - change(state, to_normal, context(rx_role_pre, 5)); - stream.match(/^`/); - token = 'meta'; - break; - case 5: - change(state, to_normal, context(rx_role_pre, 6)); - stream.match(rx_TAIL); - break; - default: - change(state, to_normal); - } - } else if (phase(state) == rx_role_suf || - stream.match(rx_role_suf, false)) { - - switch (stage(state)) { - case 0: - change(state, to_normal, context(rx_role_suf, 1)); - stream.match(/^`/); - token = 'meta'; - break; - case 1: - change(state, to_normal, context(rx_role_suf, 2)); - stream.match(rx_TEXT2); - token = 'string'; - break; - case 2: - change(state, to_normal, context(rx_role_suf, 3)); - stream.match(/^`:/); - token = 'meta'; - break; - case 3: - change(state, to_normal, context(rx_role_suf, 4)); - stream.match(rx_NAME); - token = 'keyword'; - break; - case 4: - change(state, to_normal, context(rx_role_suf, 5)); - stream.match(/^:/); - token = 'meta'; - break; - case 5: - change(state, to_normal, context(rx_role_suf, 6)); - stream.match(rx_TAIL); - break; - default: - change(state, to_normal); - } - } else if (phase(state) == rx_role || stream.match(rx_role, false)) { - - switch (stage(state)) { - case 0: - change(state, to_normal, context(rx_role, 1)); - stream.match(/^:/); - token = 'meta'; - break; - case 1: - change(state, to_normal, context(rx_role, 2)); - stream.match(rx_NAME); - token = 'keyword'; - break; - case 2: - change(state, to_normal, context(rx_role, 3)); - stream.match(/^:/); - token = 'meta'; - break; - case 3: - change(state, to_normal, context(rx_role, 4)); - stream.match(rx_TAIL); - break; - default: - change(state, to_normal); - } - } else if (phase(state) == rx_substitution_ref || - stream.match(rx_substitution_ref, false)) { - - switch (stage(state)) { - case 0: - change(state, to_normal, context(rx_substitution_ref, 1)); - stream.match(rx_substitution_text); - token = 'variable-2'; - break; - case 1: - change(state, to_normal, context(rx_substitution_ref, 2)); - if (stream.match(/^_?_?/)) token = 'link'; - break; - default: - change(state, to_normal); - } - } else if (stream.match(rx_footnote_ref)) { - change(state, to_normal); - token = 'quote'; - } else if (stream.match(rx_citation_ref)) { - change(state, to_normal); - token = 'quote'; - } else if (stream.match(rx_link_ref1)) { - change(state, to_normal); - if (!stream.peek() || stream.peek().match(/^\W$/)) { - token = 'link'; - } - } else if (phase(state) == rx_link_ref2 || - stream.match(rx_link_ref2, false)) { - - switch (stage(state)) { - case 0: - if (!stream.peek() || stream.peek().match(/^\W$/)) { - change(state, to_normal, context(rx_link_ref2, 1)); - } else { - stream.match(rx_link_ref2); + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + function context(phase, stage, mode, local) { + return {phase: phase, stage: stage, mode: mode, local: local}; } - break; - case 1: - change(state, to_normal, context(rx_link_ref2, 2)); - stream.match(/^`/); - token = 'link'; - break; - case 2: - change(state, to_normal, context(rx_link_ref2, 3)); - stream.match(rx_TEXT2); - break; - case 3: - change(state, to_normal, context(rx_link_ref2, 4)); - stream.match(/^`_/); - token = 'link'; - break; - default: - change(state, to_normal); - } - } else if (stream.match(rx_verbatim)) { - change(state, to_verbatim); - } - - else { - if (stream.next()) change(state, to_normal); - } - - return token; - } - - /////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////// - - function to_explicit(stream, state) { - var token = null; - - if (phase(state) == rx_substitution || - stream.match(rx_substitution, false)) { - - switch (stage(state)) { - case 0: - change(state, to_explicit, context(rx_substitution, 1)); - stream.match(rx_substitution_text); - token = 'variable-2'; - break; - case 1: - change(state, to_explicit, context(rx_substitution, 2)); - stream.match(rx_substitution_sepa); - break; - case 2: - change(state, to_explicit, context(rx_substitution, 3)); - stream.match(rx_substitution_name); - token = 'keyword'; - break; - case 3: - change(state, to_explicit, context(rx_substitution, 4)); - stream.match(rx_substitution_tail); - token = 'meta'; - break; - default: - change(state, to_normal); - } - } else if (phase(state) == rx_directive || - stream.match(rx_directive, false)) { - - switch (stage(state)) { - case 0: - change(state, to_explicit, context(rx_directive, 1)); - stream.match(rx_directive_name); - token = 'keyword'; - - if (stream.current().match(/^(?:math|latex)/)) - state.tmp_stex = true; - else if (stream.current().match(/^python/)) - state.tmp_py = true; - break; - case 1: - change(state, to_explicit, context(rx_directive, 2)); - stream.match(rx_directive_tail); - token = 'meta'; - - if (stream.match(/^latex\s*$/) || state.tmp_stex) { - state.tmp_stex = undefined; change(state, to_mode, { - mode: mode_stex, local: CodeMirror.startState(mode_stex) - }); + + function change(state, tok, ctx) { + state.tok = tok; + state.ctx = ctx || {}; } - break; - case 2: - change(state, to_explicit, context(rx_directive, 3)); - if (stream.match(/^python\s*$/) || state.tmp_py) { - state.tmp_py = undefined; change(state, to_mode, { - mode: mode_python, local: CodeMirror.startState(mode_python) - }); + + function stage(state) { + return state.ctx.stage || 0; } - break; - default: - change(state, to_normal); - } - } else if (phase(state) == rx_link || stream.match(rx_link, false)) { - - switch (stage(state)) { - case 0: - change(state, to_explicit, context(rx_link, 1)); - stream.match(rx_link_head); - stream.match(rx_link_name); - token = 'link'; - break; - case 1: - change(state, to_explicit, context(rx_link, 2)); - stream.match(rx_link_tail); - token = 'meta'; - break; - default: - change(state, to_normal); - } - } else if (stream.match(rx_footnote)) { - change(state, to_normal); - token = 'quote'; - } else if (stream.match(rx_citation)) { - change(state, to_normal); - token = 'quote'; - } - - else { - stream.eatSpace(); - if (stream.eol()) { - change(state, to_normal); - } else { - stream.skipToEnd(); - change(state, to_comment); - token = 'comment'; - } - } - - return token; - } - - /////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////// - - function to_comment(stream, state) { - return as_block(stream, state, 'comment'); - } - - function to_verbatim(stream, state) { - return as_block(stream, state, 'meta'); - } - - function as_block(stream, state, token) { - if (stream.eol() || stream.eatSpace()) { - stream.skipToEnd(); - return token; - } else { - change(state, to_normal); - return null; - } - } - - /////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////// - - function to_mode(stream, state) { - - if (state.ctx.mode && state.ctx.local) { - - if (stream.sol()) { - if (!stream.eatSpace()) change(state, to_normal); - return null; - } - - return state.ctx.mode.token(stream, state.ctx.local); - } - - change(state, to_normal); - return null; - } - - /////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////// - - function context(phase, stage, mode, local) { - return {phase: phase, stage: stage, mode: mode, local: local}; - } - - function change(state, tok, ctx) { - state.tok = tok; - state.ctx = ctx || {}; - } - - function stage(state) { - return state.ctx.stage || 0; - } - - function phase(state) { - return state.ctx.phase; - } - - /////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////// - - return { - startState: function () { - return {tok: to_normal, ctx: context(undefined, 0)}; - }, - - copyState: function (state) { - var ctx = state.ctx, tmp = state.tmp; - if (ctx.local) - ctx = {mode: ctx.mode, local: CodeMirror.copyState(ctx.mode, ctx.local)}; - if (tmp) - tmp = {mode: tmp.mode, local: CodeMirror.copyState(tmp.mode, tmp.local)}; - return {tok: state.tok, ctx: ctx, tmp: tmp}; - }, - - innerMode: function (state) { - return state.tmp ? {state: state.tmp.local, mode: state.tmp.mode} - : state.ctx.mode ? {state: state.ctx.local, mode: state.ctx.mode} - : null; - }, - - token: function (stream, state) { - return state.tok(stream, state); - } - }; -}, 'python', 'stex'); + + function phase(state) { + return state.ctx.phase; + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + return { + startState: function () { + return {tok: to_normal, ctx: context(undefined, 0)}; + }, + + copyState: function (state) { + var ctx = state.ctx, tmp = state.tmp; + if (ctx.local) + ctx = {mode: ctx.mode, local: CodeMirror.copyState(ctx.mode, ctx.local)}; + if (tmp) + tmp = {mode: tmp.mode, local: CodeMirror.copyState(tmp.mode, tmp.local)}; + return {tok: state.tok, ctx: ctx, tmp: tmp}; + }, + + innerMode: function (state) { + return state.tmp ? {state: state.tmp.local, mode: state.tmp.mode} + : state.ctx.mode ? {state: state.ctx.local, mode: state.ctx.mode} + : null; + }, + + token: function (stream, state) { + return state.tok(stream, state); + } + }; + }, 'python', 'stex'); /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -CodeMirror.defineMIME('text/x-rst', 'rst'); + CodeMirror.defineMIME('text/x-rst', 'rst'); /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/web/editor.md/lib/codemirror/mode/ruby/index.html b/web/editor.md/lib/codemirror/mode/ruby/index.html index 97544ba..4bcf24f 100644 --- a/web/editor.md/lib/codemirror/mode/ruby/index.html +++ b/web/editor.md/lib/codemirror/mode/ruby/index.html @@ -2,33 +2,39 @@ CodeMirror: Ruby mode - + - + + .CodeMirror { + border-top: 1px solid black; + border-bottom: 1px solid black; + } + + .cm-s-default span.cm-arrow { + color: red; + } +
-

Ruby mode

-

MIME types defined: text/x-ruby.

Development of the CodeMirror Ruby mode was kindly sponsored - by Ubalo.

+ by Ubalo.

-
+
diff --git a/web/editor.md/lib/codemirror/mode/ruby/ruby.js b/web/editor.md/lib/codemirror/mode/ruby/ruby.js index eab9d9d..c8d2ba6 100644 --- a/web/editor.md/lib/codemirror/mode/ruby/ruby.js +++ b/web/editor.md/lib/codemirror/mode/ruby/ruby.js @@ -1,285 +1,296 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("ruby", function(config) { - function wordObj(words) { - var o = {}; - for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true; - return o; - } - var keywords = wordObj([ - "alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else", - "elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or", - "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless", - "until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc", - "caller", "lambda", "proc", "public", "protected", "private", "require", "load", - "require_relative", "extend", "autoload", "__END__", "__FILE__", "__LINE__", "__dir__" - ]); - var indentWords = wordObj(["def", "class", "case", "for", "while", "module", "then", - "catch", "loop", "proc", "begin"]); - var dedentWords = wordObj(["end", "until"]); - var matching = {"[": "]", "{": "}", "(": ")"}; - var curPunc; + CodeMirror.defineMode("ruby", function (config) { + function wordObj(words) { + var o = {}; + for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true; + return o; + } - function chain(newtok, stream, state) { - state.tokenize.push(newtok); - return newtok(stream, state); - } + var keywords = wordObj([ + "alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else", + "elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or", + "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless", + "until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc", + "caller", "lambda", "proc", "public", "protected", "private", "require", "load", + "require_relative", "extend", "autoload", "__END__", "__FILE__", "__LINE__", "__dir__" + ]); + var indentWords = wordObj(["def", "class", "case", "for", "while", "module", "then", + "catch", "loop", "proc", "begin"]); + var dedentWords = wordObj(["end", "until"]); + var matching = {"[": "]", "{": "}", "(": ")"}; + var curPunc; - function tokenBase(stream, state) { - curPunc = null; - if (stream.sol() && stream.match("=begin") && stream.eol()) { - state.tokenize.push(readBlockComment); - return "comment"; - } - if (stream.eatSpace()) return null; - var ch = stream.next(), m; - if (ch == "`" || ch == "'" || ch == '"') { - return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state); - } else if (ch == "/") { - var currentIndex = stream.current().length; - if (stream.skipTo("/")) { - var search_till = stream.current().length; - stream.backUp(stream.current().length - currentIndex); - var balance = 0; // balance brackets - while (stream.current().length < search_till) { - var chchr = stream.next(); - if (chchr == "(") balance += 1; - else if (chchr == ")") balance -= 1; - if (balance < 0) break; + function chain(newtok, stream, state) { + state.tokenize.push(newtok); + return newtok(stream, state); } - stream.backUp(stream.current().length - currentIndex); - if (balance == 0) - return chain(readQuoted(ch, "string-2", true), stream, state); - } - return "operator"; - } else if (ch == "%") { - var style = "string", embed = true; - if (stream.eat("s")) style = "atom"; - else if (stream.eat(/[WQ]/)) style = "string"; - else if (stream.eat(/[r]/)) style = "string-2"; - else if (stream.eat(/[wxq]/)) { style = "string"; embed = false; } - var delim = stream.eat(/[^\w\s=]/); - if (!delim) return "operator"; - if (matching.propertyIsEnumerable(delim)) delim = matching[delim]; - return chain(readQuoted(delim, style, embed, true), stream, state); - } else if (ch == "#") { - stream.skipToEnd(); - return "comment"; - } else if (ch == "<" && (m = stream.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/))) { - return chain(readHereDoc(m[1]), stream, state); - } else if (ch == "0") { - if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/); - else if (stream.eat("b")) stream.eatWhile(/[01]/); - else stream.eatWhile(/[0-7]/); - return "number"; - } else if (/\d/.test(ch)) { - stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/); - return "number"; - } else if (ch == "?") { - while (stream.match(/^\\[CM]-/)) {} - if (stream.eat("\\")) stream.eatWhile(/\w/); - else stream.next(); - return "string"; - } else if (ch == ":") { - if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state); - if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state); - // :> :>> :< :<< are valid symbols - if (stream.eat(/[\<\>]/)) { - stream.eat(/[\<\>]/); - return "atom"; - } + function tokenBase(stream, state) { + curPunc = null; + if (stream.sol() && stream.match("=begin") && stream.eol()) { + state.tokenize.push(readBlockComment); + return "comment"; + } + if (stream.eatSpace()) return null; + var ch = stream.next(), m; + if (ch == "`" || ch == "'" || ch == '"') { + return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state); + } else if (ch == "/") { + var currentIndex = stream.current().length; + if (stream.skipTo("/")) { + var search_till = stream.current().length; + stream.backUp(stream.current().length - currentIndex); + var balance = 0; // balance brackets + while (stream.current().length < search_till) { + var chchr = stream.next(); + if (chchr == "(") balance += 1; + else if (chchr == ")") balance -= 1; + if (balance < 0) break; + } + stream.backUp(stream.current().length - currentIndex); + if (balance == 0) + return chain(readQuoted(ch, "string-2", true), stream, state); + } + return "operator"; + } else if (ch == "%") { + var style = "string", embed = true; + if (stream.eat("s")) style = "atom"; + else if (stream.eat(/[WQ]/)) style = "string"; + else if (stream.eat(/[r]/)) style = "string-2"; + else if (stream.eat(/[wxq]/)) { + style = "string"; + embed = false; + } + var delim = stream.eat(/[^\w\s=]/); + if (!delim) return "operator"; + if (matching.propertyIsEnumerable(delim)) delim = matching[delim]; + return chain(readQuoted(delim, style, embed, true), stream, state); + } else if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } else if (ch == "<" && (m = stream.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/))) { + return chain(readHereDoc(m[1]), stream, state); + } else if (ch == "0") { + if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/); + else if (stream.eat("b")) stream.eatWhile(/[01]/); + else stream.eatWhile(/[0-7]/); + return "number"; + } else if (/\d/.test(ch)) { + stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/); + return "number"; + } else if (ch == "?") { + while (stream.match(/^\\[CM]-/)) { + } + if (stream.eat("\\")) stream.eatWhile(/\w/); + else stream.next(); + return "string"; + } else if (ch == ":") { + if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state); + if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state); - // :+ :- :/ :* :| :& :! are valid symbols - if (stream.eat(/[\+\-\*\/\&\|\:\!]/)) { - return "atom"; - } + // :> :>> :< :<< are valid symbols + if (stream.eat(/[\<\>]/)) { + stream.eat(/[\<\>]/); + return "atom"; + } - // Symbols can't start by a digit - if (stream.eat(/[a-zA-Z$@_\xa1-\uffff]/)) { - stream.eatWhile(/[\w$\xa1-\uffff]/); - // Only one ? ! = is allowed and only as the last character - stream.eat(/[\?\!\=]/); - return "atom"; - } - return "operator"; - } else if (ch == "@" && stream.match(/^@?[a-zA-Z_\xa1-\uffff]/)) { - stream.eat("@"); - stream.eatWhile(/[\w\xa1-\uffff]/); - return "variable-2"; - } else if (ch == "$") { - if (stream.eat(/[a-zA-Z_]/)) { - stream.eatWhile(/[\w]/); - } else if (stream.eat(/\d/)) { - stream.eat(/\d/); - } else { - stream.next(); // Must be a special global like $: or $! - } - return "variable-3"; - } else if (/[a-zA-Z_\xa1-\uffff]/.test(ch)) { - stream.eatWhile(/[\w\xa1-\uffff]/); - stream.eat(/[\?\!]/); - if (stream.eat(":")) return "atom"; - return "ident"; - } else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) { - curPunc = "|"; - return null; - } else if (/[\(\)\[\]{}\\;]/.test(ch)) { - curPunc = ch; - return null; - } else if (ch == "-" && stream.eat(">")) { - return "arrow"; - } else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) { - var more = stream.eatWhile(/[=+\-\/*:\.^%<>~|]/); - if (ch == "." && !more) curPunc = "."; - return "operator"; - } else { - return null; - } - } + // :+ :- :/ :* :| :& :! are valid symbols + if (stream.eat(/[\+\-\*\/\&\|\:\!]/)) { + return "atom"; + } - function tokenBaseUntilBrace(depth) { - if (!depth) depth = 1; - return function(stream, state) { - if (stream.peek() == "}") { - if (depth == 1) { - state.tokenize.pop(); - return state.tokenize[state.tokenize.length-1](stream, state); - } else { - state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth - 1); + // Symbols can't start by a digit + if (stream.eat(/[a-zA-Z$@_\xa1-\uffff]/)) { + stream.eatWhile(/[\w$\xa1-\uffff]/); + // Only one ? ! = is allowed and only as the last character + stream.eat(/[\?\!\=]/); + return "atom"; + } + return "operator"; + } else if (ch == "@" && stream.match(/^@?[a-zA-Z_\xa1-\uffff]/)) { + stream.eat("@"); + stream.eatWhile(/[\w\xa1-\uffff]/); + return "variable-2"; + } else if (ch == "$") { + if (stream.eat(/[a-zA-Z_]/)) { + stream.eatWhile(/[\w]/); + } else if (stream.eat(/\d/)) { + stream.eat(/\d/); + } else { + stream.next(); // Must be a special global like $: or $! + } + return "variable-3"; + } else if (/[a-zA-Z_\xa1-\uffff]/.test(ch)) { + stream.eatWhile(/[\w\xa1-\uffff]/); + stream.eat(/[\?\!]/); + if (stream.eat(":")) return "atom"; + return "ident"; + } else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) { + curPunc = "|"; + return null; + } else if (/[\(\)\[\]{}\\;]/.test(ch)) { + curPunc = ch; + return null; + } else if (ch == "-" && stream.eat(">")) { + return "arrow"; + } else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) { + var more = stream.eatWhile(/[=+\-\/*:\.^%<>~|]/); + if (ch == "." && !more) curPunc = "."; + return "operator"; + } else { + return null; + } } - } else if (stream.peek() == "{") { - state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth + 1); - } - return tokenBase(stream, state); - }; - } - function tokenBaseOnce() { - var alreadyCalled = false; - return function(stream, state) { - if (alreadyCalled) { - state.tokenize.pop(); - return state.tokenize[state.tokenize.length-1](stream, state); - } - alreadyCalled = true; - return tokenBase(stream, state); - }; - } - function readQuoted(quote, style, embed, unescaped) { - return function(stream, state) { - var escaped = false, ch; - if (state.context.type === 'read-quoted-paused') { - state.context = state.context.prev; - stream.eat("}"); - } + function tokenBaseUntilBrace(depth) { + if (!depth) depth = 1; + return function (stream, state) { + if (stream.peek() == "}") { + if (depth == 1) { + state.tokenize.pop(); + return state.tokenize[state.tokenize.length - 1](stream, state); + } else { + state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth - 1); + } + } else if (stream.peek() == "{") { + state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth + 1); + } + return tokenBase(stream, state); + }; + } - while ((ch = stream.next()) != null) { - if (ch == quote && (unescaped || !escaped)) { - state.tokenize.pop(); - break; + function tokenBaseOnce() { + var alreadyCalled = false; + return function (stream, state) { + if (alreadyCalled) { + state.tokenize.pop(); + return state.tokenize[state.tokenize.length - 1](stream, state); + } + alreadyCalled = true; + return tokenBase(stream, state); + }; } - if (embed && ch == "#" && !escaped) { - if (stream.eat("{")) { - if (quote == "}") { - state.context = {prev: state.context, type: 'read-quoted-paused'}; - } - state.tokenize.push(tokenBaseUntilBrace()); - break; - } else if (/[@\$]/.test(stream.peek())) { - state.tokenize.push(tokenBaseOnce()); - break; - } + + function readQuoted(quote, style, embed, unescaped) { + return function (stream, state) { + var escaped = false, ch; + + if (state.context.type === 'read-quoted-paused') { + state.context = state.context.prev; + stream.eat("}"); + } + + while ((ch = stream.next()) != null) { + if (ch == quote && (unescaped || !escaped)) { + state.tokenize.pop(); + break; + } + if (embed && ch == "#" && !escaped) { + if (stream.eat("{")) { + if (quote == "}") { + state.context = {prev: state.context, type: 'read-quoted-paused'}; + } + state.tokenize.push(tokenBaseUntilBrace()); + break; + } else if (/[@\$]/.test(stream.peek())) { + state.tokenize.push(tokenBaseOnce()); + break; + } + } + escaped = !escaped && ch == "\\"; + } + return style; + }; } - escaped = !escaped && ch == "\\"; - } - return style; - }; - } - function readHereDoc(phrase) { - return function(stream, state) { - if (stream.match(phrase)) state.tokenize.pop(); - else stream.skipToEnd(); - return "string"; - }; - } - function readBlockComment(stream, state) { - if (stream.sol() && stream.match("=end") && stream.eol()) - state.tokenize.pop(); - stream.skipToEnd(); - return "comment"; - } - return { - startState: function() { - return {tokenize: [tokenBase], - indented: 0, - context: {type: "top", indented: -config.indentUnit}, - continuedLine: false, - lastTok: null, - varList: false}; - }, + function readHereDoc(phrase) { + return function (stream, state) { + if (stream.match(phrase)) state.tokenize.pop(); + else stream.skipToEnd(); + return "string"; + }; + } - token: function(stream, state) { - if (stream.sol()) state.indented = stream.indentation(); - var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype; - var thisTok = curPunc; - if (style == "ident") { - var word = stream.current(); - style = state.lastTok == "." ? "property" - : keywords.propertyIsEnumerable(stream.current()) ? "keyword" - : /^[A-Z]/.test(word) ? "tag" - : (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def" - : "variable"; - if (style == "keyword") { - thisTok = word; - if (indentWords.propertyIsEnumerable(word)) kwtype = "indent"; - else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent"; - else if ((word == "if" || word == "unless") && stream.column() == stream.indentation()) - kwtype = "indent"; - else if (word == "do" && state.context.indented < state.indented) - kwtype = "indent"; + function readBlockComment(stream, state) { + if (stream.sol() && stream.match("=end") && stream.eol()) + state.tokenize.pop(); + stream.skipToEnd(); + return "comment"; } - } - if (curPunc || (style && style != "comment")) state.lastTok = thisTok; - if (curPunc == "|") state.varList = !state.varList; - if (kwtype == "indent" || /[\(\[\{]/.test(curPunc)) - state.context = {prev: state.context, type: curPunc || style, indented: state.indented}; - else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev) - state.context = state.context.prev; + return { + startState: function () { + return { + tokenize: [tokenBase], + indented: 0, + context: {type: "top", indented: -config.indentUnit}, + continuedLine: false, + lastTok: null, + varList: false + }; + }, - if (stream.eol()) - state.continuedLine = (curPunc == "\\" || style == "operator"); - return style; - }, + token: function (stream, state) { + if (stream.sol()) state.indented = stream.indentation(); + var style = state.tokenize[state.tokenize.length - 1](stream, state), kwtype; + var thisTok = curPunc; + if (style == "ident") { + var word = stream.current(); + style = state.lastTok == "." ? "property" + : keywords.propertyIsEnumerable(stream.current()) ? "keyword" + : /^[A-Z]/.test(word) ? "tag" + : (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def" + : "variable"; + if (style == "keyword") { + thisTok = word; + if (indentWords.propertyIsEnumerable(word)) kwtype = "indent"; + else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent"; + else if ((word == "if" || word == "unless") && stream.column() == stream.indentation()) + kwtype = "indent"; + else if (word == "do" && state.context.indented < state.indented) + kwtype = "indent"; + } + } + if (curPunc || (style && style != "comment")) state.lastTok = thisTok; + if (curPunc == "|") state.varList = !state.varList; - indent: function(state, textAfter) { - if (state.tokenize[state.tokenize.length-1] != tokenBase) return 0; - var firstChar = textAfter && textAfter.charAt(0); - var ct = state.context; - var closing = ct.type == matching[firstChar] || - ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter); - return ct.indented + (closing ? 0 : config.indentUnit) + - (state.continuedLine ? config.indentUnit : 0); - }, + if (kwtype == "indent" || /[\(\[\{]/.test(curPunc)) + state.context = {prev: state.context, type: curPunc || style, indented: state.indented}; + else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev) + state.context = state.context.prev; - electricChars: "}de", // enD and rescuE - lineComment: "#" - }; -}); + if (stream.eol()) + state.continuedLine = (curPunc == "\\" || style == "operator"); + return style; + }, + + indent: function (state, textAfter) { + if (state.tokenize[state.tokenize.length - 1] != tokenBase) return 0; + var firstChar = textAfter && textAfter.charAt(0); + var ct = state.context; + var closing = ct.type == matching[firstChar] || + ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter); + return ct.indented + (closing ? 0 : config.indentUnit) + + (state.continuedLine ? config.indentUnit : 0); + }, + + electricChars: "}de", // enD and rescuE + lineComment: "#" + }; + }); -CodeMirror.defineMIME("text/x-ruby", "ruby"); + CodeMirror.defineMIME("text/x-ruby", "ruby"); }); diff --git a/web/editor.md/lib/codemirror/mode/ruby/test.js b/web/editor.md/lib/codemirror/mode/ruby/test.js index cade864..c569277 100644 --- a/web/editor.md/lib/codemirror/mode/ruby/test.js +++ b/web/editor.md/lib/codemirror/mode/ruby/test.js @@ -1,14 +1,17 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function() { - var mode = CodeMirror.getMode({indentUnit: 2}, "ruby"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } +(function () { + var mode = CodeMirror.getMode({indentUnit: 2}, "ruby"); - MT("divide_equal_operator", - "[variable bar] [operator /=] [variable foo]"); + function MT(name) { + test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); + } - MT("divide_equal_operator_no_spacing", - "[variable foo][operator /=][number 42]"); + MT("divide_equal_operator", + "[variable bar] [operator /=] [variable foo]"); + + MT("divide_equal_operator_no_spacing", + "[variable foo][operator /=][number 42]"); })(); diff --git a/web/editor.md/lib/codemirror/mode/rust/index.html b/web/editor.md/lib/codemirror/mode/rust/index.html index 407e84f..a6a083a 100644 --- a/web/editor.md/lib/codemirror/mode/rust/index.html +++ b/web/editor.md/lib/codemirror/mode/rust/index.html @@ -2,31 +2,34 @@ CodeMirror: Rust mode - + - + - +
-

Rust mode

+

Rust mode

-

MIME types defined: text/x-rustsrc.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/rust/rust.js b/web/editor.md/lib/codemirror/mode/rust/rust.js index 2bffa9a..09fa18a 100644 --- a/web/editor.md/lib/codemirror/mode/rust/rust.js +++ b/web/editor.md/lib/codemirror/mode/rust/rust.js @@ -1,451 +1,570 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("rust", function() { - var indentUnit = 4, altIndentUnit = 2; - var valKeywords = { - "if": "if-style", "while": "if-style", "loop": "else-style", "else": "else-style", - "do": "else-style", "ret": "else-style", "fail": "else-style", - "break": "atom", "cont": "atom", "const": "let", "resource": "fn", - "let": "let", "fn": "fn", "for": "for", "alt": "alt", "iface": "iface", - "impl": "impl", "type": "type", "enum": "enum", "mod": "mod", - "as": "op", "true": "atom", "false": "atom", "assert": "op", "check": "op", - "claim": "op", "native": "ignore", "unsafe": "ignore", "import": "else-style", - "export": "else-style", "copy": "op", "log": "op", "log_err": "op", - "use": "op", "bind": "op", "self": "atom", "struct": "enum" - }; - var typeKeywords = function() { - var keywords = {"fn": "fn", "block": "fn", "obj": "obj"}; - var atoms = "bool uint int i8 i16 i32 i64 u8 u16 u32 u64 float f32 f64 str char".split(" "); - for (var i = 0, e = atoms.length; i < e; ++i) keywords[atoms[i]] = "atom"; - return keywords; - }(); - var operatorChar = /[+\-*&%=<>!?|\.@]/; - - // Tokenizer - - // Used as scratch variable to communicate multiple values without - // consing up tons of objects. - var tcat, content; - function r(tc, style) { - tcat = tc; - return style; - } - - function tokenBase(stream, state) { - var ch = stream.next(); - if (ch == '"') { - state.tokenize = tokenString; - return state.tokenize(stream, state); - } - if (ch == "'") { - tcat = "atom"; - if (stream.eat("\\")) { - if (stream.skipTo("'")) { stream.next(); return "string"; } - else { return "error"; } - } else { - stream.next(); - return stream.eat("'") ? "string" : "error"; - } - } - if (ch == "/") { - if (stream.eat("/")) { stream.skipToEnd(); return "comment"; } - if (stream.eat("*")) { - state.tokenize = tokenComment(1); - return state.tokenize(stream, state); - } - } - if (ch == "#") { - if (stream.eat("[")) { tcat = "open-attr"; return null; } - stream.eatWhile(/\w/); - return r("macro", "meta"); - } - if (ch == ":" && stream.match(":<")) { - return r("op", null); - } - if (ch.match(/\d/) || (ch == "." && stream.eat(/\d/))) { - var flp = false; - if (!stream.match(/^x[\da-f]+/i) && !stream.match(/^b[01]+/)) { - stream.eatWhile(/\d/); - if (stream.eat(".")) { flp = true; stream.eatWhile(/\d/); } - if (stream.match(/^e[+\-]?\d+/i)) { flp = true; } - } - if (flp) stream.match(/^f(?:32|64)/); - else stream.match(/^[ui](?:8|16|32|64)/); - return r("atom", "number"); - } - if (ch.match(/[()\[\]{}:;,]/)) return r(ch, null); - if (ch == "-" && stream.eat(">")) return r("->", null); - if (ch.match(operatorChar)) { - stream.eatWhile(operatorChar); - return r("op", null); - } - stream.eatWhile(/\w/); - content = stream.current(); - if (stream.match(/^::\w/)) { - stream.backUp(1); - return r("prefix", "variable-2"); - } - if (state.keywords.propertyIsEnumerable(content)) - return r(state.keywords[content], content.match(/true|false/) ? "atom" : "keyword"); - return r("name", "variable"); - } - - function tokenString(stream, state) { - var ch, escaped = false; - while (ch = stream.next()) { - if (ch == '"' && !escaped) { - state.tokenize = tokenBase; - return r("atom", "string"); - } - escaped = !escaped && ch == "\\"; - } - // Hack to not confuse the parser when a string is split in - // pieces. - return r("op", "string"); - } - - function tokenComment(depth) { - return function(stream, state) { - var lastCh = null, ch; - while (ch = stream.next()) { - if (ch == "/" && lastCh == "*") { - if (depth == 1) { - state.tokenize = tokenBase; - break; - } else { - state.tokenize = tokenComment(depth - 1); - return state.tokenize(stream, state); - } - } - if (ch == "*" && lastCh == "/") { - state.tokenize = tokenComment(depth + 1); - return state.tokenize(stream, state); - } - lastCh = ch; - } - return "comment"; - }; - } - - // Parser - - var cx = {state: null, stream: null, marked: null, cc: null}; - function pass() { - for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); - } - function cont() { - pass.apply(null, arguments); - return true; - } - - function pushlex(type, info) { - var result = function() { - var state = cx.state; - state.lexical = {indented: state.indented, column: cx.stream.column(), - type: type, prev: state.lexical, info: info}; - }; - result.lex = true; - return result; - } - function poplex() { - var state = cx.state; - if (state.lexical.prev) { - if (state.lexical.type == ")") - state.indented = state.lexical.indented; - state.lexical = state.lexical.prev; - } - } - function typecx() { cx.state.keywords = typeKeywords; } - function valcx() { cx.state.keywords = valKeywords; } - poplex.lex = typecx.lex = valcx.lex = true; - - function commasep(comb, end) { - function more(type) { - if (type == ",") return cont(comb, more); - if (type == end) return cont(); - return cont(more); - } - return function(type) { - if (type == end) return cont(); - return pass(comb, more); - }; - } - - function stat_of(comb, tag) { - return cont(pushlex("stat", tag), comb, poplex, block); - } - function block(type) { - if (type == "}") return cont(); - if (type == "let") return stat_of(letdef1, "let"); - if (type == "fn") return stat_of(fndef); - if (type == "type") return cont(pushlex("stat"), tydef, endstatement, poplex, block); - if (type == "enum") return stat_of(enumdef); - if (type == "mod") return stat_of(mod); - if (type == "iface") return stat_of(iface); - if (type == "impl") return stat_of(impl); - if (type == "open-attr") return cont(pushlex("]"), commasep(expression, "]"), poplex); - if (type == "ignore" || type.match(/[\]\);,]/)) return cont(block); - return pass(pushlex("stat"), expression, poplex, endstatement, block); - } - function endstatement(type) { - if (type == ";") return cont(); - return pass(); - } - function expression(type) { - if (type == "atom" || type == "name") return cont(maybeop); - if (type == "{") return cont(pushlex("}"), exprbrace, poplex); - if (type.match(/[\[\(]/)) return matchBrackets(type, expression); - if (type.match(/[\]\)\};,]/)) return pass(); - if (type == "if-style") return cont(expression, expression); - if (type == "else-style" || type == "op") return cont(expression); - if (type == "for") return cont(pattern, maybetype, inop, expression, expression); - if (type == "alt") return cont(expression, altbody); - if (type == "fn") return cont(fndef); - if (type == "macro") return cont(macro); - return cont(); - } - function maybeop(type) { - if (content == ".") return cont(maybeprop); - if (content == "::<"){return cont(typarams, maybeop);} - if (type == "op" || content == ":") return cont(expression); - if (type == "(" || type == "[") return matchBrackets(type, expression); - return pass(); - } - function maybeprop() { - if (content.match(/^\w+$/)) {cx.marked = "variable"; return cont(maybeop);} - return pass(expression); - } - function exprbrace(type) { - if (type == "op") { - if (content == "|") return cont(blockvars, poplex, pushlex("}", "block"), block); - if (content == "||") return cont(poplex, pushlex("}", "block"), block); - } - if (content == "mutable" || (content.match(/^\w+$/) && cx.stream.peek() == ":" - && !cx.stream.match("::", false))) - return pass(record_of(expression)); - return pass(block); - } - function record_of(comb) { - function ro(type) { - if (content == "mutable" || content == "with") {cx.marked = "keyword"; return cont(ro);} - if (content.match(/^\w*$/)) {cx.marked = "variable"; return cont(ro);} - if (type == ":") return cont(comb, ro); - if (type == "}") return cont(); - return cont(ro); - } - return ro; - } - function blockvars(type) { - if (type == "name") {cx.marked = "def"; return cont(blockvars);} - if (type == "op" && content == "|") return cont(); - return cont(blockvars); - } - - function letdef1(type) { - if (type.match(/[\]\)\};]/)) return cont(); - if (content == "=") return cont(expression, letdef2); - if (type == ",") return cont(letdef1); - return pass(pattern, maybetype, letdef1); - } - function letdef2(type) { - if (type.match(/[\]\)\};,]/)) return pass(letdef1); - else return pass(expression, letdef2); - } - function maybetype(type) { - if (type == ":") return cont(typecx, rtype, valcx); - return pass(); - } - function inop(type) { - if (type == "name" && content == "in") {cx.marked = "keyword"; return cont();} - return pass(); - } - function fndef(type) { - if (content == "@" || content == "~") {cx.marked = "keyword"; return cont(fndef);} - if (type == "name") {cx.marked = "def"; return cont(fndef);} - if (content == "<") return cont(typarams, fndef); - if (type == "{") return pass(expression); - if (type == "(") return cont(pushlex(")"), commasep(argdef, ")"), poplex, fndef); - if (type == "->") return cont(typecx, rtype, valcx, fndef); - if (type == ";") return cont(); - return cont(fndef); - } - function tydef(type) { - if (type == "name") {cx.marked = "def"; return cont(tydef);} - if (content == "<") return cont(typarams, tydef); - if (content == "=") return cont(typecx, rtype, valcx); - return cont(tydef); - } - function enumdef(type) { - if (type == "name") {cx.marked = "def"; return cont(enumdef);} - if (content == "<") return cont(typarams, enumdef); - if (content == "=") return cont(typecx, rtype, valcx, endstatement); - if (type == "{") return cont(pushlex("}"), typecx, enumblock, valcx, poplex); - return cont(enumdef); - } - function enumblock(type) { - if (type == "}") return cont(); - if (type == "(") return cont(pushlex(")"), commasep(rtype, ")"), poplex, enumblock); - if (content.match(/^\w+$/)) cx.marked = "def"; - return cont(enumblock); - } - function mod(type) { - if (type == "name") {cx.marked = "def"; return cont(mod);} - if (type == "{") return cont(pushlex("}"), block, poplex); - return pass(); - } - function iface(type) { - if (type == "name") {cx.marked = "def"; return cont(iface);} - if (content == "<") return cont(typarams, iface); - if (type == "{") return cont(pushlex("}"), block, poplex); - return pass(); - } - function impl(type) { - if (content == "<") return cont(typarams, impl); - if (content == "of" || content == "for") {cx.marked = "keyword"; return cont(rtype, impl);} - if (type == "name") {cx.marked = "def"; return cont(impl);} - if (type == "{") return cont(pushlex("}"), block, poplex); - return pass(); - } - function typarams() { - if (content == ">") return cont(); - if (content == ",") return cont(typarams); - if (content == ":") return cont(rtype, typarams); - return pass(rtype, typarams); - } - function argdef(type) { - if (type == "name") {cx.marked = "def"; return cont(argdef);} - if (type == ":") return cont(typecx, rtype, valcx); - return pass(); - } - function rtype(type) { - if (type == "name") {cx.marked = "variable-3"; return cont(rtypemaybeparam); } - if (content == "mutable") {cx.marked = "keyword"; return cont(rtype);} - if (type == "atom") return cont(rtypemaybeparam); - if (type == "op" || type == "obj") return cont(rtype); - if (type == "fn") return cont(fntype); - if (type == "{") return cont(pushlex("{"), record_of(rtype), poplex); - return matchBrackets(type, rtype); - } - function rtypemaybeparam() { - if (content == "<") return cont(typarams); - return pass(); - } - function fntype(type) { - if (type == "(") return cont(pushlex("("), commasep(rtype, ")"), poplex, fntype); - if (type == "->") return cont(rtype); - return pass(); - } - function pattern(type) { - if (type == "name") {cx.marked = "def"; return cont(patternmaybeop);} - if (type == "atom") return cont(patternmaybeop); - if (type == "op") return cont(pattern); - if (type.match(/[\]\)\};,]/)) return pass(); - return matchBrackets(type, pattern); - } - function patternmaybeop(type) { - if (type == "op" && content == ".") return cont(); - if (content == "to") {cx.marked = "keyword"; return cont(pattern);} - else return pass(); - } - function altbody(type) { - if (type == "{") return cont(pushlex("}", "alt"), altblock1, poplex); - return pass(); - } - function altblock1(type) { - if (type == "}") return cont(); - if (type == "|") return cont(altblock1); - if (content == "when") {cx.marked = "keyword"; return cont(expression, altblock2);} - if (type.match(/[\]\);,]/)) return cont(altblock1); - return pass(pattern, altblock2); - } - function altblock2(type) { - if (type == "{") return cont(pushlex("}", "alt"), block, poplex, altblock1); - else return pass(altblock1); - } - - function macro(type) { - if (type.match(/[\[\(\{]/)) return matchBrackets(type, expression); - return pass(); - } - function matchBrackets(type, comb) { - if (type == "[") return cont(pushlex("]"), commasep(comb, "]"), poplex); - if (type == "(") return cont(pushlex(")"), commasep(comb, ")"), poplex); - if (type == "{") return cont(pushlex("}"), commasep(comb, "}"), poplex); - return cont(); - } - - function parse(state, stream, style) { - var cc = state.cc; - // Communicate our context to the combinators. - // (Less wasteful than consing up a hundred closures on every call.) - cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; - - while (true) { - var combinator = cc.length ? cc.pop() : block; - if (combinator(tcat)) { - while(cc.length && cc[cc.length - 1].lex) - cc.pop()(); - return cx.marked || style; - } - } - } - - return { - startState: function() { - return { - tokenize: tokenBase, - cc: [], - lexical: {indented: -indentUnit, column: 0, type: "top", align: false}, - keywords: valKeywords, - indented: 0 - }; - }, - - token: function(stream, state) { - if (stream.sol()) { - if (!state.lexical.hasOwnProperty("align")) - state.lexical.align = false; - state.indented = stream.indentation(); - } - if (stream.eatSpace()) return null; - tcat = content = null; - var style = state.tokenize(stream, state); - if (style == "comment") return style; - if (!state.lexical.hasOwnProperty("align")) - state.lexical.align = true; - if (tcat == "prefix") return style; - if (!content) content = stream.current(); - return parse(state, stream, style); - }, - - indent: function(state, textAfter) { - if (state.tokenize != tokenBase) return 0; - var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, - type = lexical.type, closing = firstChar == type; - if (type == "stat") return lexical.indented + indentUnit; - if (lexical.align) return lexical.column + (closing ? 0 : 1); - return lexical.indented + (closing ? 0 : (lexical.info == "alt" ? altIndentUnit : indentUnit)); - }, - - electricChars: "{}", - blockCommentStart: "/*", - blockCommentEnd: "*/", - lineComment: "//", - fold: "brace" - }; -}); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("rust", function () { + var indentUnit = 4, altIndentUnit = 2; + var valKeywords = { + "if": "if-style", "while": "if-style", "loop": "else-style", "else": "else-style", + "do": "else-style", "ret": "else-style", "fail": "else-style", + "break": "atom", "cont": "atom", "const": "let", "resource": "fn", + "let": "let", "fn": "fn", "for": "for", "alt": "alt", "iface": "iface", + "impl": "impl", "type": "type", "enum": "enum", "mod": "mod", + "as": "op", "true": "atom", "false": "atom", "assert": "op", "check": "op", + "claim": "op", "native": "ignore", "unsafe": "ignore", "import": "else-style", + "export": "else-style", "copy": "op", "log": "op", "log_err": "op", + "use": "op", "bind": "op", "self": "atom", "struct": "enum" + }; + var typeKeywords = function () { + var keywords = {"fn": "fn", "block": "fn", "obj": "obj"}; + var atoms = "bool uint int i8 i16 i32 i64 u8 u16 u32 u64 float f32 f64 str char".split(" "); + for (var i = 0, e = atoms.length; i < e; ++i) keywords[atoms[i]] = "atom"; + return keywords; + }(); + var operatorChar = /[+\-*&%=<>!?|\.@]/; + + // Tokenizer + + // Used as scratch variable to communicate multiple values without + // consing up tons of objects. + var tcat, content; + + function r(tc, style) { + tcat = tc; + return style; + } + + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == '"') { + state.tokenize = tokenString; + return state.tokenize(stream, state); + } + if (ch == "'") { + tcat = "atom"; + if (stream.eat("\\")) { + if (stream.skipTo("'")) { + stream.next(); + return "string"; + } else { + return "error"; + } + } else { + stream.next(); + return stream.eat("'") ? "string" : "error"; + } + } + if (ch == "/") { + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + if (stream.eat("*")) { + state.tokenize = tokenComment(1); + return state.tokenize(stream, state); + } + } + if (ch == "#") { + if (stream.eat("[")) { + tcat = "open-attr"; + return null; + } + stream.eatWhile(/\w/); + return r("macro", "meta"); + } + if (ch == ":" && stream.match(":<")) { + return r("op", null); + } + if (ch.match(/\d/) || (ch == "." && stream.eat(/\d/))) { + var flp = false; + if (!stream.match(/^x[\da-f]+/i) && !stream.match(/^b[01]+/)) { + stream.eatWhile(/\d/); + if (stream.eat(".")) { + flp = true; + stream.eatWhile(/\d/); + } + if (stream.match(/^e[+\-]?\d+/i)) { + flp = true; + } + } + if (flp) stream.match(/^f(?:32|64)/); + else stream.match(/^[ui](?:8|16|32|64)/); + return r("atom", "number"); + } + if (ch.match(/[()\[\]{}:;,]/)) return r(ch, null); + if (ch == "-" && stream.eat(">")) return r("->", null); + if (ch.match(operatorChar)) { + stream.eatWhile(operatorChar); + return r("op", null); + } + stream.eatWhile(/\w/); + content = stream.current(); + if (stream.match(/^::\w/)) { + stream.backUp(1); + return r("prefix", "variable-2"); + } + if (state.keywords.propertyIsEnumerable(content)) + return r(state.keywords[content], content.match(/true|false/) ? "atom" : "keyword"); + return r("name", "variable"); + } + + function tokenString(stream, state) { + var ch, escaped = false; + while (ch = stream.next()) { + if (ch == '"' && !escaped) { + state.tokenize = tokenBase; + return r("atom", "string"); + } + escaped = !escaped && ch == "\\"; + } + // Hack to not confuse the parser when a string is split in + // pieces. + return r("op", "string"); + } + + function tokenComment(depth) { + return function (stream, state) { + var lastCh = null, ch; + while (ch = stream.next()) { + if (ch == "/" && lastCh == "*") { + if (depth == 1) { + state.tokenize = tokenBase; + break; + } else { + state.tokenize = tokenComment(depth - 1); + return state.tokenize(stream, state); + } + } + if (ch == "*" && lastCh == "/") { + state.tokenize = tokenComment(depth + 1); + return state.tokenize(stream, state); + } + lastCh = ch; + } + return "comment"; + }; + } + + // Parser + + var cx = {state: null, stream: null, marked: null, cc: null}; + + function pass() { + for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); + } + + function cont() { + pass.apply(null, arguments); + return true; + } + + function pushlex(type, info) { + var result = function () { + var state = cx.state; + state.lexical = { + indented: state.indented, column: cx.stream.column(), + type: type, prev: state.lexical, info: info + }; + }; + result.lex = true; + return result; + } + + function poplex() { + var state = cx.state; + if (state.lexical.prev) { + if (state.lexical.type == ")") + state.indented = state.lexical.indented; + state.lexical = state.lexical.prev; + } + } + + function typecx() { + cx.state.keywords = typeKeywords; + } + + function valcx() { + cx.state.keywords = valKeywords; + } + + poplex.lex = typecx.lex = valcx.lex = true; + + function commasep(comb, end) { + function more(type) { + if (type == ",") return cont(comb, more); + if (type == end) return cont(); + return cont(more); + } + + return function (type) { + if (type == end) return cont(); + return pass(comb, more); + }; + } + + function stat_of(comb, tag) { + return cont(pushlex("stat", tag), comb, poplex, block); + } + + function block(type) { + if (type == "}") return cont(); + if (type == "let") return stat_of(letdef1, "let"); + if (type == "fn") return stat_of(fndef); + if (type == "type") return cont(pushlex("stat"), tydef, endstatement, poplex, block); + if (type == "enum") return stat_of(enumdef); + if (type == "mod") return stat_of(mod); + if (type == "iface") return stat_of(iface); + if (type == "impl") return stat_of(impl); + if (type == "open-attr") return cont(pushlex("]"), commasep(expression, "]"), poplex); + if (type == "ignore" || type.match(/[\]\);,]/)) return cont(block); + return pass(pushlex("stat"), expression, poplex, endstatement, block); + } + + function endstatement(type) { + if (type == ";") return cont(); + return pass(); + } + + function expression(type) { + if (type == "atom" || type == "name") return cont(maybeop); + if (type == "{") return cont(pushlex("}"), exprbrace, poplex); + if (type.match(/[\[\(]/)) return matchBrackets(type, expression); + if (type.match(/[\]\)\};,]/)) return pass(); + if (type == "if-style") return cont(expression, expression); + if (type == "else-style" || type == "op") return cont(expression); + if (type == "for") return cont(pattern, maybetype, inop, expression, expression); + if (type == "alt") return cont(expression, altbody); + if (type == "fn") return cont(fndef); + if (type == "macro") return cont(macro); + return cont(); + } + + function maybeop(type) { + if (content == ".") return cont(maybeprop); + if (content == "::<") { + return cont(typarams, maybeop); + } + if (type == "op" || content == ":") return cont(expression); + if (type == "(" || type == "[") return matchBrackets(type, expression); + return pass(); + } + + function maybeprop() { + if (content.match(/^\w+$/)) { + cx.marked = "variable"; + return cont(maybeop); + } + return pass(expression); + } + + function exprbrace(type) { + if (type == "op") { + if (content == "|") return cont(blockvars, poplex, pushlex("}", "block"), block); + if (content == "||") return cont(poplex, pushlex("}", "block"), block); + } + if (content == "mutable" || (content.match(/^\w+$/) && cx.stream.peek() == ":" + && !cx.stream.match("::", false))) + return pass(record_of(expression)); + return pass(block); + } + + function record_of(comb) { + function ro(type) { + if (content == "mutable" || content == "with") { + cx.marked = "keyword"; + return cont(ro); + } + if (content.match(/^\w*$/)) { + cx.marked = "variable"; + return cont(ro); + } + if (type == ":") return cont(comb, ro); + if (type == "}") return cont(); + return cont(ro); + } + + return ro; + } + + function blockvars(type) { + if (type == "name") { + cx.marked = "def"; + return cont(blockvars); + } + if (type == "op" && content == "|") return cont(); + return cont(blockvars); + } + + function letdef1(type) { + if (type.match(/[\]\)\};]/)) return cont(); + if (content == "=") return cont(expression, letdef2); + if (type == ",") return cont(letdef1); + return pass(pattern, maybetype, letdef1); + } + + function letdef2(type) { + if (type.match(/[\]\)\};,]/)) return pass(letdef1); + else return pass(expression, letdef2); + } + + function maybetype(type) { + if (type == ":") return cont(typecx, rtype, valcx); + return pass(); + } + + function inop(type) { + if (type == "name" && content == "in") { + cx.marked = "keyword"; + return cont(); + } + return pass(); + } + + function fndef(type) { + if (content == "@" || content == "~") { + cx.marked = "keyword"; + return cont(fndef); + } + if (type == "name") { + cx.marked = "def"; + return cont(fndef); + } + if (content == "<") return cont(typarams, fndef); + if (type == "{") return pass(expression); + if (type == "(") return cont(pushlex(")"), commasep(argdef, ")"), poplex, fndef); + if (type == "->") return cont(typecx, rtype, valcx, fndef); + if (type == ";") return cont(); + return cont(fndef); + } + + function tydef(type) { + if (type == "name") { + cx.marked = "def"; + return cont(tydef); + } + if (content == "<") return cont(typarams, tydef); + if (content == "=") return cont(typecx, rtype, valcx); + return cont(tydef); + } + + function enumdef(type) { + if (type == "name") { + cx.marked = "def"; + return cont(enumdef); + } + if (content == "<") return cont(typarams, enumdef); + if (content == "=") return cont(typecx, rtype, valcx, endstatement); + if (type == "{") return cont(pushlex("}"), typecx, enumblock, valcx, poplex); + return cont(enumdef); + } + + function enumblock(type) { + if (type == "}") return cont(); + if (type == "(") return cont(pushlex(")"), commasep(rtype, ")"), poplex, enumblock); + if (content.match(/^\w+$/)) cx.marked = "def"; + return cont(enumblock); + } + + function mod(type) { + if (type == "name") { + cx.marked = "def"; + return cont(mod); + } + if (type == "{") return cont(pushlex("}"), block, poplex); + return pass(); + } + + function iface(type) { + if (type == "name") { + cx.marked = "def"; + return cont(iface); + } + if (content == "<") return cont(typarams, iface); + if (type == "{") return cont(pushlex("}"), block, poplex); + return pass(); + } + + function impl(type) { + if (content == "<") return cont(typarams, impl); + if (content == "of" || content == "for") { + cx.marked = "keyword"; + return cont(rtype, impl); + } + if (type == "name") { + cx.marked = "def"; + return cont(impl); + } + if (type == "{") return cont(pushlex("}"), block, poplex); + return pass(); + } + + function typarams() { + if (content == ">") return cont(); + if (content == ",") return cont(typarams); + if (content == ":") return cont(rtype, typarams); + return pass(rtype, typarams); + } + + function argdef(type) { + if (type == "name") { + cx.marked = "def"; + return cont(argdef); + } + if (type == ":") return cont(typecx, rtype, valcx); + return pass(); + } + + function rtype(type) { + if (type == "name") { + cx.marked = "variable-3"; + return cont(rtypemaybeparam); + } + if (content == "mutable") { + cx.marked = "keyword"; + return cont(rtype); + } + if (type == "atom") return cont(rtypemaybeparam); + if (type == "op" || type == "obj") return cont(rtype); + if (type == "fn") return cont(fntype); + if (type == "{") return cont(pushlex("{"), record_of(rtype), poplex); + return matchBrackets(type, rtype); + } + + function rtypemaybeparam() { + if (content == "<") return cont(typarams); + return pass(); + } + + function fntype(type) { + if (type == "(") return cont(pushlex("("), commasep(rtype, ")"), poplex, fntype); + if (type == "->") return cont(rtype); + return pass(); + } + + function pattern(type) { + if (type == "name") { + cx.marked = "def"; + return cont(patternmaybeop); + } + if (type == "atom") return cont(patternmaybeop); + if (type == "op") return cont(pattern); + if (type.match(/[\]\)\};,]/)) return pass(); + return matchBrackets(type, pattern); + } + + function patternmaybeop(type) { + if (type == "op" && content == ".") return cont(); + if (content == "to") { + cx.marked = "keyword"; + return cont(pattern); + } else return pass(); + } + + function altbody(type) { + if (type == "{") return cont(pushlex("}", "alt"), altblock1, poplex); + return pass(); + } + + function altblock1(type) { + if (type == "}") return cont(); + if (type == "|") return cont(altblock1); + if (content == "when") { + cx.marked = "keyword"; + return cont(expression, altblock2); + } + if (type.match(/[\]\);,]/)) return cont(altblock1); + return pass(pattern, altblock2); + } + + function altblock2(type) { + if (type == "{") return cont(pushlex("}", "alt"), block, poplex, altblock1); + else return pass(altblock1); + } + + function macro(type) { + if (type.match(/[\[\(\{]/)) return matchBrackets(type, expression); + return pass(); + } + + function matchBrackets(type, comb) { + if (type == "[") return cont(pushlex("]"), commasep(comb, "]"), poplex); + if (type == "(") return cont(pushlex(")"), commasep(comb, ")"), poplex); + if (type == "{") return cont(pushlex("}"), commasep(comb, "}"), poplex); + return cont(); + } + + function parse(state, stream, style) { + var cc = state.cc; + // Communicate our context to the combinators. + // (Less wasteful than consing up a hundred closures on every call.) + cx.state = state; + cx.stream = stream; + cx.marked = null, cx.cc = cc; + + while (true) { + var combinator = cc.length ? cc.pop() : block; + if (combinator(tcat)) { + while (cc.length && cc[cc.length - 1].lex) + cc.pop()(); + return cx.marked || style; + } + } + } + + return { + startState: function () { + return { + tokenize: tokenBase, + cc: [], + lexical: {indented: -indentUnit, column: 0, type: "top", align: false}, + keywords: valKeywords, + indented: 0 + }; + }, + + token: function (stream, state) { + if (stream.sol()) { + if (!state.lexical.hasOwnProperty("align")) + state.lexical.align = false; + state.indented = stream.indentation(); + } + if (stream.eatSpace()) return null; + tcat = content = null; + var style = state.tokenize(stream, state); + if (style == "comment") return style; + if (!state.lexical.hasOwnProperty("align")) + state.lexical.align = true; + if (tcat == "prefix") return style; + if (!content) content = stream.current(); + return parse(state, stream, style); + }, + + indent: function (state, textAfter) { + if (state.tokenize != tokenBase) return 0; + var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, + type = lexical.type, closing = firstChar == type; + if (type == "stat") return lexical.indented + indentUnit; + if (lexical.align) return lexical.column + (closing ? 0 : 1); + return lexical.indented + (closing ? 0 : (lexical.info == "alt" ? altIndentUnit : indentUnit)); + }, + + electricChars: "{}", + blockCommentStart: "/*", + blockCommentEnd: "*/", + lineComment: "//", + fold: "brace" + }; + }); -CodeMirror.defineMIME("text/x-rustsrc", "rust"); + CodeMirror.defineMIME("text/x-rustsrc", "rust"); }); diff --git a/web/editor.md/lib/codemirror/mode/sass/index.html b/web/editor.md/lib/codemirror/mode/sass/index.html index 9f4a790..2802089 100644 --- a/web/editor.md/lib/codemirror/mode/sass/index.html +++ b/web/editor.md/lib/codemirror/mode/sass/index.html @@ -2,30 +2,34 @@ CodeMirror: Sass mode - + - + - +
-

Sass mode

-

MIME types defined: text/x-sass.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/sass/sass.js b/web/editor.md/lib/codemirror/mode/sass/sass.js index 52a6682..6d9c871 100644 --- a/web/editor.md/lib/codemirror/mode/sass/sass.js +++ b/web/editor.md/lib/codemirror/mode/sass/sass.js @@ -1,414 +1,416 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("sass", function(config) { - function tokenRegexp(words) { - return new RegExp("^" + words.join("|")); - } - - var keywords = ["true", "false", "null", "auto"]; - var keywordsRegexp = new RegExp("^" + keywords.join("|")); - - var operators = ["\\(", "\\)", "=", ">", "<", "==", ">=", "<=", "\\+", "-", - "\\!=", "/", "\\*", "%", "and", "or", "not", ";","\\{","\\}",":"]; - var opRegexp = tokenRegexp(operators); - - var pseudoElementsRegexp = /^::?[a-zA-Z_][\w\-]*/; - - function urlTokens(stream, state) { - var ch = stream.peek(); - - if (ch === ")") { - stream.next(); - state.tokenizer = tokenBase; - return "operator"; - } else if (ch === "(") { - stream.next(); - stream.eatSpace(); - - return "operator"; - } else if (ch === "'" || ch === '"') { - state.tokenizer = buildStringTokenizer(stream.next()); - return "string"; - } else { - state.tokenizer = buildStringTokenizer(")", false); - return "string"; - } - } - function comment(indentation, multiLine) { - return function(stream, state) { - if (stream.sol() && stream.indentation() <= indentation) { - state.tokenizer = tokenBase; - return tokenBase(stream, state); - } - - if (multiLine && stream.skipTo("*/")) { - stream.next(); - stream.next(); - state.tokenizer = tokenBase; - } else { - stream.skipToEnd(); - } - - return "comment"; - }; - } - - function buildStringTokenizer(quote, greedy) { - if (greedy == null) { greedy = true; } - - function stringTokenizer(stream, state) { - var nextChar = stream.next(); - var peekChar = stream.peek(); - var previousChar = stream.string.charAt(stream.pos-2); - - var endingString = ((nextChar !== "\\" && peekChar === quote) || (nextChar === quote && previousChar !== "\\")); - - if (endingString) { - if (nextChar !== quote && greedy) { stream.next(); } - state.tokenizer = tokenBase; - return "string"; - } else if (nextChar === "#" && peekChar === "{") { - state.tokenizer = buildInterpolationTokenizer(stringTokenizer); - stream.next(); - return "operator"; - } else { - return "string"; - } - } - - return stringTokenizer; - } - - function buildInterpolationTokenizer(currentTokenizer) { - return function(stream, state) { - if (stream.peek() === "}") { - stream.next(); - state.tokenizer = currentTokenizer; - return "operator"; - } else { - return tokenBase(stream, state); - } - }; - } - - function indent(state) { - if (state.indentCount == 0) { - state.indentCount++; - var lastScopeOffset = state.scopes[0].offset; - var currentOffset = lastScopeOffset + config.indentUnit; - state.scopes.unshift({ offset:currentOffset }); - } - } - - function dedent(state) { - if (state.scopes.length == 1) return; - - state.scopes.shift(); - } - - function tokenBase(stream, state) { - var ch = stream.peek(); - - // Comment - if (stream.match("/*")) { - state.tokenizer = comment(stream.indentation(), true); - return state.tokenizer(stream, state); - } - if (stream.match("//")) { - state.tokenizer = comment(stream.indentation(), false); - return state.tokenizer(stream, state); - } - - // Interpolation - if (stream.match("#{")) { - state.tokenizer = buildInterpolationTokenizer(tokenBase); - return "operator"; - } - - // Strings - if (ch === '"' || ch === "'") { - stream.next(); - state.tokenizer = buildStringTokenizer(ch); - return "string"; - } - - if(!state.cursorHalf){// state.cursorHalf === 0 - // first half i.e. before : for key-value pairs - // including selectors - - if (ch === ".") { - stream.next(); - if (stream.match(/^[\w-]+/)) { - indent(state); - return "atom"; - } else if (stream.peek() === "#") { - indent(state); - return "atom"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("sass", function (config) { + function tokenRegexp(words) { + return new RegExp("^" + words.join("|")); } - } - - if (ch === "#") { - stream.next(); - // ID selectors - if (stream.match(/^[\w-]+/)) { - indent(state); - return "atom"; - } - if (stream.peek() === "#") { - indent(state); - return "atom"; - } - } - - // Variables - if (ch === "$") { - stream.next(); - stream.eatWhile(/[\w-]/); - return "variable-2"; - } - - // Numbers - if (stream.match(/^-?[0-9\.]+/)) - return "number"; - - // Units - if (stream.match(/^(px|em|in)\b/)) - return "unit"; - - if (stream.match(keywordsRegexp)) - return "keyword"; - - if (stream.match(/^url/) && stream.peek() === "(") { - state.tokenizer = urlTokens; - return "atom"; - } - - if (ch === "=") { - // Match shortcut mixin definition - if (stream.match(/^=[\w-]+/)) { - indent(state); - return "meta"; - } - } - if (ch === "+") { - // Match shortcut mixin definition - if (stream.match(/^\+[\w-]+/)){ - return "variable-3"; + var keywords = ["true", "false", "null", "auto"]; + var keywordsRegexp = new RegExp("^" + keywords.join("|")); + + var operators = ["\\(", "\\)", "=", ">", "<", "==", ">=", "<=", "\\+", "-", + "\\!=", "/", "\\*", "%", "and", "or", "not", ";", "\\{", "\\}", ":"]; + var opRegexp = tokenRegexp(operators); + + var pseudoElementsRegexp = /^::?[a-zA-Z_][\w\-]*/; + + function urlTokens(stream, state) { + var ch = stream.peek(); + + if (ch === ")") { + stream.next(); + state.tokenizer = tokenBase; + return "operator"; + } else if (ch === "(") { + stream.next(); + stream.eatSpace(); + + return "operator"; + } else if (ch === "'" || ch === '"') { + state.tokenizer = buildStringTokenizer(stream.next()); + return "string"; + } else { + state.tokenizer = buildStringTokenizer(")", false); + return "string"; + } } - } - if(ch === "@"){ - if(stream.match(/@extend/)){ - if(!stream.match(/\s*[\w]/)) - dedent(state); + function comment(indentation, multiLine) { + return function (stream, state) { + if (stream.sol() && stream.indentation() <= indentation) { + state.tokenizer = tokenBase; + return tokenBase(stream, state); + } + + if (multiLine && stream.skipTo("*/")) { + stream.next(); + stream.next(); + state.tokenizer = tokenBase; + } else { + stream.skipToEnd(); + } + + return "comment"; + }; } - } - - // Indent Directives - if (stream.match(/^@(else if|if|media|else|for|each|while|mixin|function)/)) { - indent(state); - return "meta"; - } - - // Other Directives - if (ch === "@") { - stream.next(); - stream.eatWhile(/[\w-]/); - return "meta"; - } - - if (stream.eatWhile(/[\w-]/)){ - if(stream.match(/ *: *[\w-\+\$#!\("']/,false)){ - return "propery"; - } - else if(stream.match(/ *:/,false)){ - indent(state); - state.cursorHalf = 1; - return "atom"; + function buildStringTokenizer(quote, greedy) { + if (greedy == null) { + greedy = true; + } + + function stringTokenizer(stream, state) { + var nextChar = stream.next(); + var peekChar = stream.peek(); + var previousChar = stream.string.charAt(stream.pos - 2); + + var endingString = ((nextChar !== "\\" && peekChar === quote) || (nextChar === quote && previousChar !== "\\")); + + if (endingString) { + if (nextChar !== quote && greedy) { + stream.next(); + } + state.tokenizer = tokenBase; + return "string"; + } else if (nextChar === "#" && peekChar === "{") { + state.tokenizer = buildInterpolationTokenizer(stringTokenizer); + stream.next(); + return "operator"; + } else { + return "string"; + } + } + + return stringTokenizer; } - else if(stream.match(/ *,/,false)){ - return "atom"; - } - else{ - indent(state); - return "atom"; - } - } - if(ch === ":"){ - if (stream.match(pseudoElementsRegexp)){ // could be a pseudo-element - return "keyword"; + function buildInterpolationTokenizer(currentTokenizer) { + return function (stream, state) { + if (stream.peek() === "}") { + stream.next(); + state.tokenizer = currentTokenizer; + return "operator"; + } else { + return tokenBase(stream, state); + } + }; } - stream.next(); - state.cursorHalf=1; - return "operator"; - } - - } // cursorHalf===0 ends here - else{ - - if (ch === "#") { - stream.next(); - // Hex numbers - if (stream.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)){ - if(!stream.peek()){ - state.cursorHalf = 0; - } - return "number"; - } - } - // Numbers - if (stream.match(/^-?[0-9\.]+/)){ - if(!stream.peek()){ - state.cursorHalf = 0; + function indent(state) { + if (state.indentCount == 0) { + state.indentCount++; + var lastScopeOffset = state.scopes[0].offset; + var currentOffset = lastScopeOffset + config.indentUnit; + state.scopes.unshift({offset: currentOffset}); + } } - return "number"; - } - // Units - if (stream.match(/^(px|em|in)\b/)){ - if(!stream.peek()){ - state.cursorHalf = 0; - } - return "unit"; - } + function dedent(state) { + if (state.scopes.length == 1) return; - if (stream.match(keywordsRegexp)){ - if(!stream.peek()){ - state.cursorHalf = 0; + state.scopes.shift(); } - return "keyword"; - } - if (stream.match(/^url/) && stream.peek() === "(") { - state.tokenizer = urlTokens; - if(!stream.peek()){ - state.cursorHalf = 0; + function tokenBase(stream, state) { + var ch = stream.peek(); + + // Comment + if (stream.match("/*")) { + state.tokenizer = comment(stream.indentation(), true); + return state.tokenizer(stream, state); + } + if (stream.match("//")) { + state.tokenizer = comment(stream.indentation(), false); + return state.tokenizer(stream, state); + } + + // Interpolation + if (stream.match("#{")) { + state.tokenizer = buildInterpolationTokenizer(tokenBase); + return "operator"; + } + + // Strings + if (ch === '"' || ch === "'") { + stream.next(); + state.tokenizer = buildStringTokenizer(ch); + return "string"; + } + + if (!state.cursorHalf) {// state.cursorHalf === 0 + // first half i.e. before : for key-value pairs + // including selectors + + if (ch === ".") { + stream.next(); + if (stream.match(/^[\w-]+/)) { + indent(state); + return "atom"; + } else if (stream.peek() === "#") { + indent(state); + return "atom"; + } + } + + if (ch === "#") { + stream.next(); + // ID selectors + if (stream.match(/^[\w-]+/)) { + indent(state); + return "atom"; + } + if (stream.peek() === "#") { + indent(state); + return "atom"; + } + } + + // Variables + if (ch === "$") { + stream.next(); + stream.eatWhile(/[\w-]/); + return "variable-2"; + } + + // Numbers + if (stream.match(/^-?[0-9\.]+/)) + return "number"; + + // Units + if (stream.match(/^(px|em|in)\b/)) + return "unit"; + + if (stream.match(keywordsRegexp)) + return "keyword"; + + if (stream.match(/^url/) && stream.peek() === "(") { + state.tokenizer = urlTokens; + return "atom"; + } + + if (ch === "=") { + // Match shortcut mixin definition + if (stream.match(/^=[\w-]+/)) { + indent(state); + return "meta"; + } + } + + if (ch === "+") { + // Match shortcut mixin definition + if (stream.match(/^\+[\w-]+/)) { + return "variable-3"; + } + } + + if (ch === "@") { + if (stream.match(/@extend/)) { + if (!stream.match(/\s*[\w]/)) + dedent(state); + } + } + + + // Indent Directives + if (stream.match(/^@(else if|if|media|else|for|each|while|mixin|function)/)) { + indent(state); + return "meta"; + } + + // Other Directives + if (ch === "@") { + stream.next(); + stream.eatWhile(/[\w-]/); + return "meta"; + } + + if (stream.eatWhile(/[\w-]/)) { + if (stream.match(/ *: *[\w-\+\$#!\("']/, false)) { + return "propery"; + } else if (stream.match(/ *:/, false)) { + indent(state); + state.cursorHalf = 1; + return "atom"; + } else if (stream.match(/ *,/, false)) { + return "atom"; + } else { + indent(state); + return "atom"; + } + } + + if (ch === ":") { + if (stream.match(pseudoElementsRegexp)) { // could be a pseudo-element + return "keyword"; + } + stream.next(); + state.cursorHalf = 1; + return "operator"; + } + + } // cursorHalf===0 ends here + else { + + if (ch === "#") { + stream.next(); + // Hex numbers + if (stream.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)) { + if (!stream.peek()) { + state.cursorHalf = 0; + } + return "number"; + } + } + + // Numbers + if (stream.match(/^-?[0-9\.]+/)) { + if (!stream.peek()) { + state.cursorHalf = 0; + } + return "number"; + } + + // Units + if (stream.match(/^(px|em|in)\b/)) { + if (!stream.peek()) { + state.cursorHalf = 0; + } + return "unit"; + } + + if (stream.match(keywordsRegexp)) { + if (!stream.peek()) { + state.cursorHalf = 0; + } + return "keyword"; + } + + if (stream.match(/^url/) && stream.peek() === "(") { + state.tokenizer = urlTokens; + if (!stream.peek()) { + state.cursorHalf = 0; + } + return "atom"; + } + + // Variables + if (ch === "$") { + stream.next(); + stream.eatWhile(/[\w-]/); + if (!stream.peek()) { + state.cursorHalf = 0; + } + return "variable-3"; + } + + // bang character for !important, !default, etc. + if (ch === "!") { + stream.next(); + if (!stream.peek()) { + state.cursorHalf = 0; + } + return stream.match(/^[\w]+/) ? "keyword" : "operator"; + } + + if (stream.match(opRegexp)) { + if (!stream.peek()) { + state.cursorHalf = 0; + } + return "operator"; + } + + // attributes + if (stream.eatWhile(/[\w-]/)) { + if (!stream.peek()) { + state.cursorHalf = 0; + } + return "attribute"; + } + + //stream.eatSpace(); + if (!stream.peek()) { + state.cursorHalf = 0; + return null; + } + + } // else ends here + + if (stream.match(opRegexp)) + return "operator"; + + // If we haven't returned by now, we move 1 character + // and return an error + stream.next(); + return null; } - return "atom"; - } - - // Variables - if (ch === "$") { - stream.next(); - stream.eatWhile(/[\w-]/); - if(!stream.peek()){ - state.cursorHalf = 0; - } - return "variable-3"; - } - - // bang character for !important, !default, etc. - if (ch === "!") { - stream.next(); - if(!stream.peek()){ - state.cursorHalf = 0; - } - return stream.match(/^[\w]+/) ? "keyword": "operator"; - } - if (stream.match(opRegexp)){ - if(!stream.peek()){ - state.cursorHalf = 0; - } - return "operator"; - } + function tokenLexer(stream, state) { + if (stream.sol()) state.indentCount = 0; + var style = state.tokenizer(stream, state); + var current = stream.current(); - // attributes - if (stream.eatWhile(/[\w-]/)) { - if(!stream.peek()){ - state.cursorHalf = 0; - } - return "attribute"; - } - - //stream.eatSpace(); - if(!stream.peek()){ - state.cursorHalf = 0; - return null; - } - - } // else ends here - - if (stream.match(opRegexp)) - return "operator"; - - // If we haven't returned by now, we move 1 character - // and return an error - stream.next(); - return null; - } - - function tokenLexer(stream, state) { - if (stream.sol()) state.indentCount = 0; - var style = state.tokenizer(stream, state); - var current = stream.current(); - - if (current === "@return" || current === "}"){ - dedent(state); - } + if (current === "@return" || current === "}") { + dedent(state); + } - if (style !== null) { - var startOfToken = stream.pos - current.length; + if (style !== null) { + var startOfToken = stream.pos - current.length; - var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount); + var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount); - var newScopes = []; + var newScopes = []; - for (var i = 0; i < state.scopes.length; i++) { - var scope = state.scopes[i]; + for (var i = 0; i < state.scopes.length; i++) { + var scope = state.scopes[i]; - if (scope.offset <= withCurrentIndent) - newScopes.push(scope); - } + if (scope.offset <= withCurrentIndent) + newScopes.push(scope); + } - state.scopes = newScopes; - } + state.scopes = newScopes; + } - return style; - } - - return { - startState: function() { - return { - tokenizer: tokenBase, - scopes: [{offset: 0, type: "sass"}], - indentCount: 0, - cursorHalf: 0, // cursor half tells us if cursor lies after (1) - // or before (0) colon (well... more or less) - definedVars: [], - definedMixins: [] - }; - }, - token: function(stream, state) { - var style = tokenLexer(stream, state); - - state.lastToken = { style: style, content: stream.current() }; - - return style; - }, - - indent: function(state) { - return state.scopes[0].offset; - } - }; -}); + return style; + } -CodeMirror.defineMIME("text/x-sass", "sass"); + return { + startState: function () { + return { + tokenizer: tokenBase, + scopes: [{offset: 0, type: "sass"}], + indentCount: 0, + cursorHalf: 0, // cursor half tells us if cursor lies after (1) + // or before (0) colon (well... more or less) + definedVars: [], + definedMixins: [] + }; + }, + token: function (stream, state) { + var style = tokenLexer(stream, state); + + state.lastToken = {style: style, content: stream.current()}; + + return style; + }, + + indent: function (state) { + return state.scopes[0].offset; + } + }; + }); + + CodeMirror.defineMIME("text/x-sass", "sass"); }); diff --git a/web/editor.md/lib/codemirror/mode/scheme/index.html b/web/editor.md/lib/codemirror/mode/scheme/index.html index 04d5c6a..d97e157 100644 --- a/web/editor.md/lib/codemirror/mode/scheme/index.html +++ b/web/editor.md/lib/codemirror/mode/scheme/index.html @@ -2,29 +2,31 @@ CodeMirror: Scheme mode - + - + - +
-

Scheme mode

-

MIME types defined: text/x-scheme.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/scheme/scheme.js b/web/editor.md/lib/codemirror/mode/scheme/scheme.js index 979edc0..f33a47d 100644 --- a/web/editor.md/lib/codemirror/mode/scheme/scheme.js +++ b/web/editor.md/lib/codemirror/mode/scheme/scheme.js @@ -5,244 +5,245 @@ * Author: Koh Zi Han, based on implementation by Koh Zi Chun */ -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("scheme", function () { - var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", - ATOM = "atom", NUMBER = "number", BRACKET = "bracket"; - var INDENT_WORD_SKIP = 2; - - function makeKeywords(str) { - var obj = {}, words = str.split(" "); - for (var i = 0; i < words.length; ++i) obj[words[i]] = true; - return obj; - } - - var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?"); - var indentKeys = makeKeywords("define let letrec let* lambda"); - - function stateStack(indent, type, prev) { // represents a state stack object - this.indent = indent; - this.type = type; - this.prev = prev; - } - - function pushStack(state, indent, type) { - state.indentStack = new stateStack(indent, type, state.indentStack); - } - - function popStack(state) { - state.indentStack = state.indentStack.prev; - } - - var binaryMatcher = new RegExp(/^(?:[-+]i|[-+][01]+#*(?:\/[01]+#*)?i|[-+]?[01]+#*(?:\/[01]+#*)?@[-+]?[01]+#*(?:\/[01]+#*)?|[-+]?[01]+#*(?:\/[01]+#*)?[-+](?:[01]+#*(?:\/[01]+#*)?)?i|[-+]?[01]+#*(?:\/[01]+#*)?)(?=[()\s;"]|$)/i); - var octalMatcher = new RegExp(/^(?:[-+]i|[-+][0-7]+#*(?:\/[0-7]+#*)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?@[-+]?[0-7]+#*(?:\/[0-7]+#*)?|[-+]?[0-7]+#*(?:\/[0-7]+#*)?[-+](?:[0-7]+#*(?:\/[0-7]+#*)?)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?)(?=[()\s;"]|$)/i); - var hexMatcher = new RegExp(/^(?:[-+]i|[-+][\da-f]+#*(?:\/[\da-f]+#*)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?@[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?[-+](?:[\da-f]+#*(?:\/[\da-f]+#*)?)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?)(?=[()\s;"]|$)/i); - var decimalMatcher = new RegExp(/^(?:[-+]i|[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)i|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)@[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)?i|(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*))(?=[()\s;"]|$)/i); - - function isBinaryNumber (stream) { - return stream.match(binaryMatcher); - } - - function isOctalNumber (stream) { - return stream.match(octalMatcher); - } - - function isDecimalNumber (stream, backup) { - if (backup === true) { - stream.backUp(1); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("scheme", function () { + var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", + ATOM = "atom", NUMBER = "number", BRACKET = "bracket"; + var INDENT_WORD_SKIP = 2; + + function makeKeywords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?"); + var indentKeys = makeKeywords("define let letrec let* lambda"); + + function stateStack(indent, type, prev) { // represents a state stack object + this.indent = indent; + this.type = type; + this.prev = prev; + } + + function pushStack(state, indent, type) { + state.indentStack = new stateStack(indent, type, state.indentStack); } - return stream.match(decimalMatcher); - } - - function isHexNumber (stream) { - return stream.match(hexMatcher); - } - - return { - startState: function () { - return { - indentStack: null, - indentation: 0, - mode: false, - sExprComment: false - }; - }, - - token: function (stream, state) { - if (state.indentStack == null && stream.sol()) { - // update indentation, but only if indentStack is empty - state.indentation = stream.indentation(); - } - // skip spaces - if (stream.eatSpace()) { - return null; + function popStack(state) { + state.indentStack = state.indentStack.prev; + } + + var binaryMatcher = new RegExp(/^(?:[-+]i|[-+][01]+#*(?:\/[01]+#*)?i|[-+]?[01]+#*(?:\/[01]+#*)?@[-+]?[01]+#*(?:\/[01]+#*)?|[-+]?[01]+#*(?:\/[01]+#*)?[-+](?:[01]+#*(?:\/[01]+#*)?)?i|[-+]?[01]+#*(?:\/[01]+#*)?)(?=[()\s;"]|$)/i); + var octalMatcher = new RegExp(/^(?:[-+]i|[-+][0-7]+#*(?:\/[0-7]+#*)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?@[-+]?[0-7]+#*(?:\/[0-7]+#*)?|[-+]?[0-7]+#*(?:\/[0-7]+#*)?[-+](?:[0-7]+#*(?:\/[0-7]+#*)?)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?)(?=[()\s;"]|$)/i); + var hexMatcher = new RegExp(/^(?:[-+]i|[-+][\da-f]+#*(?:\/[\da-f]+#*)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?@[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?[-+](?:[\da-f]+#*(?:\/[\da-f]+#*)?)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?)(?=[()\s;"]|$)/i); + var decimalMatcher = new RegExp(/^(?:[-+]i|[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)i|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)@[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)?i|(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*))(?=[()\s;"]|$)/i); + + function isBinaryNumber(stream) { + return stream.match(binaryMatcher); + } + + function isOctalNumber(stream) { + return stream.match(octalMatcher); + } + + function isDecimalNumber(stream, backup) { + if (backup === true) { + stream.backUp(1); } - var returnType = null; + return stream.match(decimalMatcher); + } - switch(state.mode){ - case "string": // multi-line string parsing mode - var next, escaped = false; - while ((next = stream.next()) != null) { - if (next == "\"" && !escaped) { + function isHexNumber(stream) { + return stream.match(hexMatcher); + } - state.mode = false; - break; + return { + startState: function () { + return { + indentStack: null, + indentation: 0, + mode: false, + sExprComment: false + }; + }, + + token: function (stream, state) { + if (state.indentStack == null && stream.sol()) { + // update indentation, but only if indentStack is empty + state.indentation = stream.indentation(); + } + + // skip spaces + if (stream.eatSpace()) { + return null; + } + var returnType = null; + + switch (state.mode) { + case "string": // multi-line string parsing mode + var next, escaped = false; + while ((next = stream.next()) != null) { + if (next == "\"" && !escaped) { + + state.mode = false; + break; + } + escaped = !escaped && next == "\\"; } - escaped = !escaped && next == "\\"; - } - returnType = STRING; // continue on in scheme-string mode - break; - case "comment": // comment parsing mode - var next, maybeEnd = false; - while ((next = stream.next()) != null) { - if (next == "#" && maybeEnd) { - - state.mode = false; - break; + returnType = STRING; // continue on in scheme-string mode + break; + case "comment": // comment parsing mode + var next, maybeEnd = false; + while ((next = stream.next()) != null) { + if (next == "#" && maybeEnd) { + + state.mode = false; + break; + } + maybeEnd = (next == "|"); } - maybeEnd = (next == "|"); - } - returnType = COMMENT; - break; - case "s-expr-comment": // s-expr commenting mode - state.mode = false; - if(stream.peek() == "(" || stream.peek() == "["){ - // actually start scheme s-expr commenting mode - state.sExprComment = 0; - }else{ - // if not we just comment the entire of the next token - stream.eatWhile(/[^/s]/); // eat non spaces returnType = COMMENT; break; - } - default: // default parsing mode - var ch = stream.next(); - - if (ch == "\"") { - state.mode = "string"; - returnType = STRING; - - } else if (ch == "'") { - returnType = ATOM; - } else if (ch == '#') { - if (stream.eat("|")) { // Multi-line comment - state.mode = "comment"; // toggle to comment mode + case "s-expr-comment": // s-expr commenting mode + state.mode = false; + if (stream.peek() == "(" || stream.peek() == "[") { + // actually start scheme s-expr commenting mode + state.sExprComment = 0; + } else { + // if not we just comment the entire of the next token + stream.eatWhile(/[^/s]/); // eat non spaces returnType = COMMENT; - } else if (stream.eat(/[tf]/i)) { // #t/#f (atom) + break; + } + default: // default parsing mode + var ch = stream.next(); + + if (ch == "\"") { + state.mode = "string"; + returnType = STRING; + + } else if (ch == "'") { returnType = ATOM; - } else if (stream.eat(';')) { // S-Expr comment - state.mode = "s-expr-comment"; - returnType = COMMENT; - } else { - var numTest = null, hasExactness = false, hasRadix = true; - if (stream.eat(/[ei]/i)) { - hasExactness = true; + } else if (ch == '#') { + if (stream.eat("|")) { // Multi-line comment + state.mode = "comment"; // toggle to comment mode + returnType = COMMENT; + } else if (stream.eat(/[tf]/i)) { // #t/#f (atom) + returnType = ATOM; + } else if (stream.eat(';')) { // S-Expr comment + state.mode = "s-expr-comment"; + returnType = COMMENT; } else { - stream.backUp(1); // must be radix specifier - } - if (stream.match(/^#b/i)) { - numTest = isBinaryNumber; - } else if (stream.match(/^#o/i)) { - numTest = isOctalNumber; - } else if (stream.match(/^#x/i)) { - numTest = isHexNumber; - } else if (stream.match(/^#d/i)) { - numTest = isDecimalNumber; - } else if (stream.match(/^[-+0-9.]/, false)) { - hasRadix = false; - numTest = isDecimalNumber; - // re-consume the intial # if all matches failed - } else if (!hasExactness) { - stream.eat('#'); - } - if (numTest != null) { - if (hasRadix && !hasExactness) { - // consume optional exactness after radix - stream.match(/^#[ei]/i); + var numTest = null, hasExactness = false, hasRadix = true; + if (stream.eat(/[ei]/i)) { + hasExactness = true; + } else { + stream.backUp(1); // must be radix specifier + } + if (stream.match(/^#b/i)) { + numTest = isBinaryNumber; + } else if (stream.match(/^#o/i)) { + numTest = isOctalNumber; + } else if (stream.match(/^#x/i)) { + numTest = isHexNumber; + } else if (stream.match(/^#d/i)) { + numTest = isDecimalNumber; + } else if (stream.match(/^[-+0-9.]/, false)) { + hasRadix = false; + numTest = isDecimalNumber; + // re-consume the intial # if all matches failed + } else if (!hasExactness) { + stream.eat('#'); + } + if (numTest != null) { + if (hasRadix && !hasExactness) { + // consume optional exactness after radix + stream.match(/^#[ei]/i); + } + if (numTest(stream)) + returnType = NUMBER; } - if (numTest(stream)) - returnType = NUMBER; } - } - } else if (/^[-+0-9.]/.test(ch) && isDecimalNumber(stream, true)) { // match non-prefixed number, must be decimal - returnType = NUMBER; - } else if (ch == ";") { // comment - stream.skipToEnd(); // rest of the line is a comment - returnType = COMMENT; - } else if (ch == "(" || ch == "[") { - var keyWord = ''; var indentTemp = stream.column(), letter; - /** - Either - (indent-word .. - (non-indent-word .. - (;something else, bracket, etc. - */ - - while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) { - keyWord += letter; - } - - if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word + } else if (/^[-+0-9.]/.test(ch) && isDecimalNumber(stream, true)) { // match non-prefixed number, must be decimal + returnType = NUMBER; + } else if (ch == ";") { // comment + stream.skipToEnd(); // rest of the line is a comment + returnType = COMMENT; + } else if (ch == "(" || ch == "[") { + var keyWord = ''; + var indentTemp = stream.column(), letter; + /** + Either + (indent-word .. + (non-indent-word .. + (;something else, bracket, etc. + */ + + while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) { + keyWord += letter; + } - pushStack(state, indentTemp + INDENT_WORD_SKIP, ch); - } else { // non-indent word - // we continue eating the spaces - stream.eatSpace(); - if (stream.eol() || stream.peek() == ";") { - // nothing significant after - // we restart indentation 1 space after - pushStack(state, indentTemp + 1, ch); - } else { - pushStack(state, indentTemp + stream.current().length, ch); // else we match + if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word + + pushStack(state, indentTemp + INDENT_WORD_SKIP, ch); + } else { // non-indent word + // we continue eating the spaces + stream.eatSpace(); + if (stream.eol() || stream.peek() == ";") { + // nothing significant after + // we restart indentation 1 space after + pushStack(state, indentTemp + 1, ch); + } else { + pushStack(state, indentTemp + stream.current().length, ch); // else we match + } } - } - stream.backUp(stream.current().length - 1); // undo all the eating + stream.backUp(stream.current().length - 1); // undo all the eating - if(typeof state.sExprComment == "number") state.sExprComment++; + if (typeof state.sExprComment == "number") state.sExprComment++; - returnType = BRACKET; - } else if (ch == ")" || ch == "]") { - returnType = BRACKET; - if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) { - popStack(state); + returnType = BRACKET; + } else if (ch == ")" || ch == "]") { + returnType = BRACKET; + if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) { + popStack(state); - if(typeof state.sExprComment == "number"){ - if(--state.sExprComment == 0){ - returnType = COMMENT; // final closing bracket - state.sExprComment = false; // turn off s-expr commenting mode + if (typeof state.sExprComment == "number") { + if (--state.sExprComment == 0) { + returnType = COMMENT; // final closing bracket + state.sExprComment = false; // turn off s-expr commenting mode + } } } - } - } else { - stream.eatWhile(/[\w\$_\-!$%&*+\.\/:<=>?@\^~]/); + } else { + stream.eatWhile(/[\w\$_\-!$%&*+\.\/:<=>?@\^~]/); - if (keywords && keywords.propertyIsEnumerable(stream.current())) { - returnType = BUILTIN; - } else returnType = "variable"; - } - } - return (typeof state.sExprComment == "number") ? COMMENT : returnType; - }, + if (keywords && keywords.propertyIsEnumerable(stream.current())) { + returnType = BUILTIN; + } else returnType = "variable"; + } + } + return (typeof state.sExprComment == "number") ? COMMENT : returnType; + }, - indent: function (state) { - if (state.indentStack == null) return state.indentation; - return state.indentStack.indent; - }, + indent: function (state) { + if (state.indentStack == null) return state.indentation; + return state.indentStack.indent; + }, - lineComment: ";;" - }; -}); + lineComment: ";;" + }; + }); -CodeMirror.defineMIME("text/x-scheme", "scheme"); + CodeMirror.defineMIME("text/x-scheme", "scheme"); }); diff --git a/web/editor.md/lib/codemirror/mode/shell/index.html b/web/editor.md/lib/codemirror/mode/shell/index.html index 0b56300..c530104 100644 --- a/web/editor.md/lib/codemirror/mode/shell/index.html +++ b/web/editor.md/lib/codemirror/mode/shell/index.html @@ -2,34 +2,37 @@ CodeMirror: Shell mode - + - +
-

Shell mode

+

Shell mode

- - + -

MIME types defined: text/x-sh.

+

MIME types defined: text/x-sh.

diff --git a/web/editor.md/lib/codemirror/mode/shell/shell.js b/web/editor.md/lib/codemirror/mode/shell/shell.js index a684e8c..519dcd8 100644 --- a/web/editor.md/lib/codemirror/mode/shell/shell.js +++ b/web/editor.md/lib/codemirror/mode/shell/shell.js @@ -1,139 +1,142 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode('shell', function() { - - var words = {}; - function define(style, string) { - var split = string.split(' '); - for(var i = 0; i < split.length; i++) { - words[split[i]] = style; - } - }; - - // Atoms - define('atom', 'true false'); - - // Keywords - define('keyword', 'if then do else elif while until for in esac fi fin ' + - 'fil done exit set unset export function'); - - // Commands - define('builtin', 'ab awk bash beep cat cc cd chown chmod chroot clear cp ' + - 'curl cut diff echo find gawk gcc get git grep kill killall ln ls make ' + - 'mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh ' + - 'shopt shred source sort sleep ssh start stop su sudo tee telnet top ' + - 'touch vi vim wall wc wget who write yes zsh'); - - function tokenBase(stream, state) { - if (stream.eatSpace()) return null; - - var sol = stream.sol(); - var ch = stream.next(); - - if (ch === '\\') { - stream.next(); - return null; - } - if (ch === '\'' || ch === '"' || ch === '`') { - state.tokens.unshift(tokenString(ch)); - return tokenize(stream, state); - } - if (ch === '#') { - if (sol && stream.eat('!')) { - stream.skipToEnd(); - return 'meta'; // 'comment'? - } - stream.skipToEnd(); - return 'comment'; - } - if (ch === '$') { - state.tokens.unshift(tokenDollar); - return tokenize(stream, state); - } - if (ch === '+' || ch === '=') { - return 'operator'; - } - if (ch === '-') { - stream.eat('-'); - stream.eatWhile(/\w/); - return 'attribute'; - } - if (/\d/.test(ch)) { - stream.eatWhile(/\d/); - if(stream.eol() || !/\w/.test(stream.peek())) { - return 'number'; - } - } - stream.eatWhile(/[\w-]/); - var cur = stream.current(); - if (stream.peek() === '=' && /\w+/.test(cur)) return 'def'; - return words.hasOwnProperty(cur) ? words[cur] : null; - } - - function tokenString(quote) { - return function(stream, state) { - var next, end = false, escaped = false; - while ((next = stream.next()) != null) { - if (next === quote && !escaped) { - end = true; - break; - } - if (next === '$' && !escaped && quote !== '\'') { - escaped = true; - stream.backUp(1); - state.tokens.unshift(tokenDollar); - break; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode('shell', function () { + + var words = {}; + + function define(style, string) { + var split = string.split(' '); + for (var i = 0; i < split.length; i++) { + words[split[i]] = style; + } + }; + + // Atoms + define('atom', 'true false'); + + // Keywords + define('keyword', 'if then do else elif while until for in esac fi fin ' + + 'fil done exit set unset export function'); + + // Commands + define('builtin', 'ab awk bash beep cat cc cd chown chmod chroot clear cp ' + + 'curl cut diff echo find gawk gcc get git grep kill killall ln ls make ' + + 'mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh ' + + 'shopt shred source sort sleep ssh start stop su sudo tee telnet top ' + + 'touch vi vim wall wc wget who write yes zsh'); + + function tokenBase(stream, state) { + if (stream.eatSpace()) return null; + + var sol = stream.sol(); + var ch = stream.next(); + + if (ch === '\\') { + stream.next(); + return null; + } + if (ch === '\'' || ch === '"' || ch === '`') { + state.tokens.unshift(tokenString(ch)); + return tokenize(stream, state); + } + if (ch === '#') { + if (sol && stream.eat('!')) { + stream.skipToEnd(); + return 'meta'; // 'comment'? + } + stream.skipToEnd(); + return 'comment'; + } + if (ch === '$') { + state.tokens.unshift(tokenDollar); + return tokenize(stream, state); + } + if (ch === '+' || ch === '=') { + return 'operator'; + } + if (ch === '-') { + stream.eat('-'); + stream.eatWhile(/\w/); + return 'attribute'; + } + if (/\d/.test(ch)) { + stream.eatWhile(/\d/); + if (stream.eol() || !/\w/.test(stream.peek())) { + return 'number'; + } + } + stream.eatWhile(/[\w-]/); + var cur = stream.current(); + if (stream.peek() === '=' && /\w+/.test(cur)) return 'def'; + return words.hasOwnProperty(cur) ? words[cur] : null; } - escaped = !escaped && next === '\\'; - } - if (end || !escaped) { - state.tokens.shift(); - } - return (quote === '`' || quote === ')' ? 'quote' : 'string'); - }; - }; - - var tokenDollar = function(stream, state) { - if (state.tokens.length > 1) stream.eat('$'); - var ch = stream.next(), hungry = /\w/; - if (ch === '{') hungry = /[^}]/; - if (ch === '(') { - state.tokens[0] = tokenString(')'); - return tokenize(stream, state); - } - if (!/\d/.test(ch)) { - stream.eatWhile(hungry); - stream.eat('}'); - } - state.tokens.shift(); - return 'def'; - }; - - function tokenize(stream, state) { - return (state.tokens[0] || tokenBase) (stream, state); - }; - - return { - startState: function() {return {tokens:[]};}, - token: function(stream, state) { - return tokenize(stream, state); - }, - lineComment: '#', - fold: "brace" - }; -}); -CodeMirror.defineMIME('text/x-sh', 'shell'); + function tokenString(quote) { + return function (stream, state) { + var next, end = false, escaped = false; + while ((next = stream.next()) != null) { + if (next === quote && !escaped) { + end = true; + break; + } + if (next === '$' && !escaped && quote !== '\'') { + escaped = true; + stream.backUp(1); + state.tokens.unshift(tokenDollar); + break; + } + escaped = !escaped && next === '\\'; + } + if (end || !escaped) { + state.tokens.shift(); + } + return (quote === '`' || quote === ')' ? 'quote' : 'string'); + }; + }; + + var tokenDollar = function (stream, state) { + if (state.tokens.length > 1) stream.eat('$'); + var ch = stream.next(), hungry = /\w/; + if (ch === '{') hungry = /[^}]/; + if (ch === '(') { + state.tokens[0] = tokenString(')'); + return tokenize(stream, state); + } + if (!/\d/.test(ch)) { + stream.eatWhile(hungry); + stream.eat('}'); + } + state.tokens.shift(); + return 'def'; + }; + + function tokenize(stream, state) { + return (state.tokens[0] || tokenBase)(stream, state); + }; + + return { + startState: function () { + return {tokens: []}; + }, + token: function (stream, state) { + return tokenize(stream, state); + }, + lineComment: '#', + fold: "brace" + }; + }); + + CodeMirror.defineMIME('text/x-sh', 'shell'); }); diff --git a/web/editor.md/lib/codemirror/mode/shell/test.js b/web/editor.md/lib/codemirror/mode/shell/test.js index a413b5a..3877480 100644 --- a/web/editor.md/lib/codemirror/mode/shell/test.js +++ b/web/editor.md/lib/codemirror/mode/shell/test.js @@ -1,58 +1,61 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function() { - var mode = CodeMirror.getMode({}, "shell"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - - MT("var", - "text [def $var] text"); - MT("varBraces", - "text[def ${var}]text"); - MT("varVar", - "text [def $a$b] text"); - MT("varBracesVarBraces", - "text[def ${a}${b}]text"); - - MT("singleQuotedVar", - "[string 'text $var text']"); - MT("singleQuotedVarBraces", - "[string 'text ${var} text']"); - - MT("doubleQuotedVar", - '[string "text ][def $var][string text"]'); - MT("doubleQuotedVarBraces", - '[string "text][def ${var}][string text"]'); - MT("doubleQuotedVarPunct", - '[string "text ][def $@][string text"]'); - MT("doubleQuotedVarVar", - '[string "][def $a$b][string "]'); - MT("doubleQuotedVarBracesVarBraces", - '[string "][def ${a}${b}][string "]'); - - MT("notAString", - "text\\'text"); - MT("escapes", - "outside\\'\\\"\\`\\\\[string \"inside\\`\\'\\\"\\\\`\\$notAVar\"]outside\\$\\(notASubShell\\)"); - - MT("subshell", - "[builtin echo] [quote $(whoami)] s log, stardate [quote `date`]."); - MT("doubleQuotedSubshell", - "[builtin echo] [string \"][quote $(whoami)][string 's log, stardate `date`.\"]"); - - MT("hashbang", - "[meta #!/bin/bash]"); - MT("comment", - "text [comment # Blurb]"); - - MT("numbers", - "[number 0] [number 1] [number 2]"); - MT("keywords", - "[keyword while] [atom true]; [keyword do]", - " [builtin sleep] [number 3]", - "[keyword done]"); - MT("options", - "[builtin ls] [attribute -l] [attribute --human-readable]"); - MT("operator", - "[def var][operator =]value"); +(function () { + var mode = CodeMirror.getMode({}, "shell"); + + function MT(name) { + test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); + } + + MT("var", + "text [def $var] text"); + MT("varBraces", + "text[def ${var}]text"); + MT("varVar", + "text [def $a$b] text"); + MT("varBracesVarBraces", + "text[def ${a}${b}]text"); + + MT("singleQuotedVar", + "[string 'text $var text']"); + MT("singleQuotedVarBraces", + "[string 'text ${var} text']"); + + MT("doubleQuotedVar", + '[string "text ][def $var][string text"]'); + MT("doubleQuotedVarBraces", + '[string "text][def ${var}][string text"]'); + MT("doubleQuotedVarPunct", + '[string "text ][def $@][string text"]'); + MT("doubleQuotedVarVar", + '[string "][def $a$b][string "]'); + MT("doubleQuotedVarBracesVarBraces", + '[string "][def ${a}${b}][string "]'); + + MT("notAString", + "text\\'text"); + MT("escapes", + "outside\\'\\\"\\`\\\\[string \"inside\\`\\'\\\"\\\\`\\$notAVar\"]outside\\$\\(notASubShell\\)"); + + MT("subshell", + "[builtin echo] [quote $(whoami)] s log, stardate [quote `date`]."); + MT("doubleQuotedSubshell", + "[builtin echo] [string \"][quote $(whoami)][string 's log, stardate `date`.\"]"); + + MT("hashbang", + "[meta #!/bin/bash]"); + MT("comment", + "text [comment # Blurb]"); + + MT("numbers", + "[number 0] [number 1] [number 2]"); + MT("keywords", + "[keyword while] [atom true]; [keyword do]", + " [builtin sleep] [number 3]", + "[keyword done]"); + MT("options", + "[builtin ls] [attribute -l] [attribute --human-readable]"); + MT("operator", + "[def var][operator =]value"); })(); diff --git a/web/editor.md/lib/codemirror/mode/sieve/index.html b/web/editor.md/lib/codemirror/mode/sieve/index.html index 6f029b6..204d604 100644 --- a/web/editor.md/lib/codemirror/mode/sieve/index.html +++ b/web/editor.md/lib/codemirror/mode/sieve/index.html @@ -2,29 +2,31 @@ CodeMirror: Sieve (RFC5228) mode - + - + - +
-

Sieve (RFC5228) mode

-

MIME types defined: application/sieve.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/sieve/sieve.js b/web/editor.md/lib/codemirror/mode/sieve/sieve.js index f67db2f..347fc4b 100644 --- a/web/editor.md/lib/codemirror/mode/sieve/sieve.js +++ b/web/editor.md/lib/codemirror/mode/sieve/sieve.js @@ -1,193 +1,193 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("sieve", function(config) { - function words(str) { - var obj = {}, words = str.split(" "); - for (var i = 0; i < words.length; ++i) obj[words[i]] = true; - return obj; - } - - var keywords = words("if elsif else stop require"); - var atoms = words("true false not"); - var indentUnit = config.indentUnit; - - function tokenBase(stream, state) { - - var ch = stream.next(); - if (ch == "/" && stream.eat("*")) { - state.tokenize = tokenCComment; - return tokenCComment(stream, state); - } - - if (ch === '#') { - stream.skipToEnd(); - return "comment"; - } - - if (ch == "\"") { - state.tokenize = tokenString(ch); - return state.tokenize(stream, state); - } - - if (ch == "(") { - state._indent.push("("); - // add virtual angel wings so that editor behaves... - // ...more sane incase of broken brackets - state._indent.push("{"); - return null; - } - - if (ch === "{") { - state._indent.push("{"); - return null; - } - - if (ch == ")") { - state._indent.pop(); - state._indent.pop(); - } - - if (ch === "}") { - state._indent.pop(); - return null; - } - - if (ch == ",") - return null; - - if (ch == ";") - return null; - - - if (/[{}\(\),;]/.test(ch)) - return null; - - // 1*DIGIT "K" / "M" / "G" - if (/\d/.test(ch)) { - stream.eatWhile(/[\d]/); - stream.eat(/[KkMmGg]/); - return "number"; - } - - // ":" (ALPHA / "_") *(ALPHA / DIGIT / "_") - if (ch == ":") { - stream.eatWhile(/[a-zA-Z_]/); - stream.eatWhile(/[a-zA-Z0-9_]/); - - return "operator"; - } - - stream.eatWhile(/\w/); - var cur = stream.current(); - - // "text:" *(SP / HTAB) (hash-comment / CRLF) - // *(multiline-literal / multiline-dotstart) - // "." CRLF - if ((cur == "text") && stream.eat(":")) - { - state.tokenize = tokenMultiLineString; - return "string"; - } - - if (keywords.propertyIsEnumerable(cur)) - return "keyword"; - - if (atoms.propertyIsEnumerable(cur)) - return "atom"; - - return null; - } - - function tokenMultiLineString(stream, state) - { - state._multiLineString = true; - // the first line is special it may contain a comment - if (!stream.sol()) { - stream.eatSpace(); - - if (stream.peek() == "#") { - stream.skipToEnd(); - return "comment"; - } - - stream.skipToEnd(); - return "string"; - } - - if ((stream.next() == ".") && (stream.eol())) - { - state._multiLineString = false; - state.tokenize = tokenBase; - } - - return "string"; - } - - function tokenCComment(stream, state) { - var maybeEnd = false, ch; - while ((ch = stream.next()) != null) { - if (maybeEnd && ch == "/") { - state.tokenize = tokenBase; - break; - } - maybeEnd = (ch == "*"); - } - return "comment"; - } - - function tokenString(quote) { - return function(stream, state) { - var escaped = false, ch; - while ((ch = stream.next()) != null) { - if (ch == quote && !escaped) - break; - escaped = !escaped && ch == "\\"; - } - if (!escaped) state.tokenize = tokenBase; - return "string"; - }; - } - - return { - startState: function(base) { - return {tokenize: tokenBase, - baseIndent: base || 0, - _indent: []}; - }, - - token: function(stream, state) { - if (stream.eatSpace()) - return null; - - return (state.tokenize || tokenBase)(stream, state);; - }, - - indent: function(state, _textAfter) { - var length = state._indent.length; - if (_textAfter && (_textAfter[0] == "}")) - length--; - - if (length <0) - length = 0; - - return length * indentUnit; - }, - - electricChars: "}" - }; -}); - -CodeMirror.defineMIME("application/sieve", "sieve"); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("sieve", function (config) { + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + var keywords = words("if elsif else stop require"); + var atoms = words("true false not"); + var indentUnit = config.indentUnit; + + function tokenBase(stream, state) { + + var ch = stream.next(); + if (ch == "/" && stream.eat("*")) { + state.tokenize = tokenCComment; + return tokenCComment(stream, state); + } + + if (ch === '#') { + stream.skipToEnd(); + return "comment"; + } + + if (ch == "\"") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + + if (ch == "(") { + state._indent.push("("); + // add virtual angel wings so that editor behaves... + // ...more sane incase of broken brackets + state._indent.push("{"); + return null; + } + + if (ch === "{") { + state._indent.push("{"); + return null; + } + + if (ch == ")") { + state._indent.pop(); + state._indent.pop(); + } + + if (ch === "}") { + state._indent.pop(); + return null; + } + + if (ch == ",") + return null; + + if (ch == ";") + return null; + + + if (/[{}\(\),;]/.test(ch)) + return null; + + // 1*DIGIT "K" / "M" / "G" + if (/\d/.test(ch)) { + stream.eatWhile(/[\d]/); + stream.eat(/[KkMmGg]/); + return "number"; + } + + // ":" (ALPHA / "_") *(ALPHA / DIGIT / "_") + if (ch == ":") { + stream.eatWhile(/[a-zA-Z_]/); + stream.eatWhile(/[a-zA-Z0-9_]/); + + return "operator"; + } + + stream.eatWhile(/\w/); + var cur = stream.current(); + + // "text:" *(SP / HTAB) (hash-comment / CRLF) + // *(multiline-literal / multiline-dotstart) + // "." CRLF + if ((cur == "text") && stream.eat(":")) { + state.tokenize = tokenMultiLineString; + return "string"; + } + + if (keywords.propertyIsEnumerable(cur)) + return "keyword"; + + if (atoms.propertyIsEnumerable(cur)) + return "atom"; + + return null; + } + + function tokenMultiLineString(stream, state) { + state._multiLineString = true; + // the first line is special it may contain a comment + if (!stream.sol()) { + stream.eatSpace(); + + if (stream.peek() == "#") { + stream.skipToEnd(); + return "comment"; + } + + stream.skipToEnd(); + return "string"; + } + + if ((stream.next() == ".") && (stream.eol())) { + state._multiLineString = false; + state.tokenize = tokenBase; + } + + return "string"; + } + + function tokenCComment(stream, state) { + var maybeEnd = false, ch; + while ((ch = stream.next()) != null) { + if (maybeEnd && ch == "/") { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function tokenString(quote) { + return function (stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) + break; + escaped = !escaped && ch == "\\"; + } + if (!escaped) state.tokenize = tokenBase; + return "string"; + }; + } + + return { + startState: function (base) { + return { + tokenize: tokenBase, + baseIndent: base || 0, + _indent: [] + }; + }, + + token: function (stream, state) { + if (stream.eatSpace()) + return null; + + return (state.tokenize || tokenBase)(stream, state); + ; + }, + + indent: function (state, _textAfter) { + var length = state._indent.length; + if (_textAfter && (_textAfter[0] == "}")) + length--; + + if (length < 0) + length = 0; + + return length * indentUnit; + }, + + electricChars: "}" + }; + }); + + CodeMirror.defineMIME("application/sieve", "sieve"); }); diff --git a/web/editor.md/lib/codemirror/mode/slim/index.html b/web/editor.md/lib/codemirror/mode/slim/index.html index 7fa4e50..3803c42 100644 --- a/web/editor.md/lib/codemirror/mode/slim/index.html +++ b/web/editor.md/lib/codemirror/mode/slim/index.html @@ -2,13 +2,13 @@ CodeMirror: SLIM mode - + - - + + - + @@ -18,24 +18,26 @@ - +
-

SLIM mode

-
- + -

MIME types defined: application/x-slim.

+

MIME types defined: application/x-slim.

-

- Parsing/Highlighting Tests: - normal, - verbose. -

+

+ Parsing/Highlighting Tests: + normal, + verbose. +

diff --git a/web/editor.md/lib/codemirror/mode/slim/slim.js b/web/editor.md/lib/codemirror/mode/slim/slim.js index 164464d..7600ec0 100644 --- a/web/editor.md/lib/codemirror/mode/slim/slim.js +++ b/web/editor.md/lib/codemirror/mode/slim/slim.js @@ -3,573 +3,587 @@ // Slim Highlighting for CodeMirror copyright (c) HicknHack Software Gmbh -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../ruby/ruby")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../ruby/ruby"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - - CodeMirror.defineMode("slim", function(config) { - var htmlMode = CodeMirror.getMode(config, {name: "htmlmixed"}); - var rubyMode = CodeMirror.getMode(config, "ruby"); - var modes = { html: htmlMode, ruby: rubyMode }; - var embedded = { - ruby: "ruby", - javascript: "javascript", - css: "text/css", - sass: "text/x-sass", - scss: "text/x-scss", - less: "text/x-less", - styl: "text/x-styl", // no highlighting so far - coffee: "coffeescript", - asciidoc: "text/x-asciidoc", - markdown: "text/x-markdown", - textile: "text/x-textile", // no highlighting so far - creole: "text/x-creole", // no highlighting so far - wiki: "text/x-wiki", // no highlighting so far - mediawiki: "text/x-mediawiki", // no highlighting so far - rdoc: "text/x-rdoc", // no highlighting so far - builder: "text/x-builder", // no highlighting so far - nokogiri: "text/x-nokogiri", // no highlighting so far - erb: "application/x-erb" - }; - var embeddedRegexp = function(map){ - var arr = []; - for(var key in map) arr.push(key); - return new RegExp("^("+arr.join('|')+"):"); - }(embedded); - - var styleMap = { - "commentLine": "comment", - "slimSwitch": "operator special", - "slimTag": "tag", - "slimId": "attribute def", - "slimClass": "attribute qualifier", - "slimAttribute": "attribute", - "slimSubmode": "keyword special", - "closeAttributeTag": null, - "slimDoctype": null, - "lineContinuation": null - }; - var closing = { - "{": "}", - "[": "]", - "(": ")" - }; - - var nameStartChar = "_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD"; - var nameChar = nameStartChar + "\\-0-9\xB7\u0300-\u036F\u203F-\u2040"; - var nameRegexp = new RegExp("^[:"+nameStartChar+"](?::["+nameChar+"]|["+nameChar+"]*)"); - var attributeNameRegexp = new RegExp("^[:"+nameStartChar+"][:\\."+nameChar+"]*(?=\\s*=)"); - var wrappedAttributeNameRegexp = new RegExp("^[:"+nameStartChar+"][:\\."+nameChar+"]*"); - var classNameRegexp = /^\.-?[_a-zA-Z]+[\w\-]*/; - var classIdRegexp = /^#[_a-zA-Z]+[\w\-]*/; - - function backup(pos, tokenize, style) { - var restore = function(stream, state) { - state.tokenize = tokenize; - if (stream.pos < pos) { - stream.pos = pos; - return style; - } - return state.tokenize(stream, state); - }; - return function(stream, state) { - state.tokenize = restore; - return tokenize(stream, state); - }; - } - - function maybeBackup(stream, state, pat, offset, style) { - var cur = stream.current(); - var idx = cur.search(pat); - if (idx > -1) { - state.tokenize = backup(stream.pos, state.tokenize, style); - stream.backUp(cur.length - idx - offset); - } - return style; - } - - function continueLine(state, column) { - state.stack = { - parent: state.stack, - style: "continuation", - indented: column, - tokenize: state.line - }; - state.line = state.tokenize; - } - function finishContinue(state) { - if (state.line == state.tokenize) { - state.line = state.stack.tokenize; - state.stack = state.stack.parent; - } - } - - function lineContinuable(column, tokenize) { - return function(stream, state) { - finishContinue(state); - if (stream.match(/^\\$/)) { - continueLine(state, column); - return "lineContinuation"; - } - var style = tokenize(stream, state); - if (stream.eol() && stream.current().match(/(?:^|[^\\])(?:\\\\)*\\$/)) { - stream.backUp(1); - } - return style; - }; - } - function commaContinuable(column, tokenize) { - return function(stream, state) { - finishContinue(state); - var style = tokenize(stream, state); - if (stream.eol() && stream.current().match(/,$/)) { - continueLine(state, column); - } - return style; - }; - } - - function rubyInQuote(endQuote, tokenize) { - // TODO: add multi line support - return function(stream, state) { - var ch = stream.peek(); - if (ch == endQuote && state.rubyState.tokenize.length == 1) { - // step out of ruby context as it seems to complete processing all the braces - stream.next(); - state.tokenize = tokenize; - return "closeAttributeTag"; - } else { - return ruby(stream, state); - } - }; - } - function startRubySplat(tokenize) { - var rubyState; - var runSplat = function(stream, state) { - if (state.rubyState.tokenize.length == 1 && !state.rubyState.context.prev) { - stream.backUp(1); - if (stream.eatSpace()) { - state.rubyState = rubyState; - state.tokenize = tokenize; - return tokenize(stream, state); - } - stream.next(); - } - return ruby(stream, state); - }; - return function(stream, state) { - rubyState = state.rubyState; - state.rubyState = rubyMode.startState(); - state.tokenize = runSplat; - return ruby(stream, state); - }; - } - - function ruby(stream, state) { - return rubyMode.token(stream, state.rubyState); - } - - function htmlLine(stream, state) { - if (stream.match(/^\\$/)) { - return "lineContinuation"; - } - return html(stream, state); - } - function html(stream, state) { - if (stream.match(/^#\{/)) { - state.tokenize = rubyInQuote("}", state.tokenize); - return null; - } - return maybeBackup(stream, state, /[^\\]#\{/, 1, htmlMode.token(stream, state.htmlState)); - } - - function startHtmlLine(lastTokenize) { - return function(stream, state) { - var style = htmlLine(stream, state); - if (stream.eol()) state.tokenize = lastTokenize; - return style; - }; - } - - function startHtmlMode(stream, state, offset) { - state.stack = { - parent: state.stack, - style: "html", - indented: stream.column() + offset, // pipe + space - tokenize: state.line - }; - state.line = state.tokenize = html; - return null; - } - - function comment(stream, state) { - stream.skipToEnd(); - return state.stack.style; - } - - function commentMode(stream, state) { - state.stack = { - parent: state.stack, - style: "comment", - indented: state.indented + 1, - tokenize: state.line - }; - state.line = comment; - return comment(stream, state); - } - - function attributeWrapper(stream, state) { - if (stream.eat(state.stack.endQuote)) { - state.line = state.stack.line; - state.tokenize = state.stack.tokenize; - state.stack = state.stack.parent; - return null; - } - if (stream.match(wrappedAttributeNameRegexp)) { - state.tokenize = attributeWrapperAssign; - return "slimAttribute"; - } - stream.next(); - return null; - } - function attributeWrapperAssign(stream, state) { - if (stream.match(/^==?/)) { - state.tokenize = attributeWrapperValue; - return null; - } - return attributeWrapper(stream, state); - } - function attributeWrapperValue(stream, state) { - var ch = stream.peek(); - if (ch == '"' || ch == "\'") { - state.tokenize = readQuoted(ch, "string", true, false, attributeWrapper); - stream.next(); - return state.tokenize(stream, state); - } - if (ch == '[') { - return startRubySplat(attributeWrapper)(stream, state); - } - if (stream.match(/^(true|false|nil)\b/)) { - state.tokenize = attributeWrapper; - return "keyword"; - } - return startRubySplat(attributeWrapper)(stream, state); - } - - function startAttributeWrapperMode(state, endQuote, tokenize) { - state.stack = { - parent: state.stack, - style: "wrapper", - indented: state.indented + 1, - tokenize: tokenize, - line: state.line, - endQuote: endQuote - }; - state.line = state.tokenize = attributeWrapper; - return null; - } - - function sub(stream, state) { - if (stream.match(/^#\{/)) { - state.tokenize = rubyInQuote("}", state.tokenize); - return null; - } - var subStream = new CodeMirror.StringStream(stream.string.slice(state.stack.indented), stream.tabSize); - subStream.pos = stream.pos - state.stack.indented; - subStream.start = stream.start - state.stack.indented; - subStream.lastColumnPos = stream.lastColumnPos - state.stack.indented; - subStream.lastColumnValue = stream.lastColumnValue - state.stack.indented; - var style = state.subMode.token(subStream, state.subState); - stream.pos = subStream.pos + state.stack.indented; - return style; - } - function firstSub(stream, state) { - state.stack.indented = stream.column(); - state.line = state.tokenize = sub; - return state.tokenize(stream, state); - } - - function createMode(mode) { - var query = embedded[mode]; - var spec = CodeMirror.mimeModes[query]; - if (spec) { - return CodeMirror.getMode(config, spec); - } - var factory = CodeMirror.modes[query]; - if (factory) { - return factory(config, {name: query}); - } - return CodeMirror.getMode(config, "null"); - } - - function getMode(mode) { - if (!modes.hasOwnProperty(mode)) { - return modes[mode] = createMode(mode); - } - return modes[mode]; - } - - function startSubMode(mode, state) { - var subMode = getMode(mode); - var subState = subMode.startState && subMode.startState(); - - state.subMode = subMode; - state.subState = subState; - - state.stack = { - parent: state.stack, - style: "sub", - indented: state.indented + 1, - tokenize: state.line - }; - state.line = state.tokenize = firstSub; - return "slimSubmode"; - } - - function doctypeLine(stream, _state) { - stream.skipToEnd(); - return "slimDoctype"; - } - - function startLine(stream, state) { - var ch = stream.peek(); - if (ch == '<') { - return (state.tokenize = startHtmlLine(state.tokenize))(stream, state); - } - if (stream.match(/^[|']/)) { - return startHtmlMode(stream, state, 1); - } - if (stream.match(/^\/(!|\[\w+])?/)) { - return commentMode(stream, state); - } - if (stream.match(/^(-|==?[<>]?)/)) { - state.tokenize = lineContinuable(stream.column(), commaContinuable(stream.column(), ruby)); - return "slimSwitch"; - } - if (stream.match(/^doctype\b/)) { - state.tokenize = doctypeLine; - return "keyword"; - } - - var m = stream.match(embeddedRegexp); - if (m) { - return startSubMode(m[1], state); - } - - return slimTag(stream, state); - } - - function slim(stream, state) { - if (state.startOfLine) { - return startLine(stream, state); - } - return slimTag(stream, state); - } - - function slimTag(stream, state) { - if (stream.eat('*')) { - state.tokenize = startRubySplat(slimTagExtras); - return null; - } - if (stream.match(nameRegexp)) { - state.tokenize = slimTagExtras; - return "slimTag"; - } - return slimClass(stream, state); - } - function slimTagExtras(stream, state) { - if (stream.match(/^(<>?|> state.indented && state.last != "slimSubmode") { - state.line = state.tokenize = state.stack.tokenize; - state.stack = state.stack.parent; - state.subMode = null; - state.subState = null; - } - } - if (stream.eatSpace()) return null; - var style = state.tokenize(stream, state); - state.startOfLine = false; - if (style) state.last = style; - return styleMap.hasOwnProperty(style) ? styleMap[style] : style; - }, - - blankLine: function(state) { - if (state.subMode && state.subMode.blankLine) { - return state.subMode.blankLine(state.subState); - } - }, - - innerMode: function(state) { - if (state.subMode) return {state: state.subState, mode: state.subMode}; - return {state: state, mode: mode}; - } - - //indent: function(state) { - // return state.indented; - //} - }; - return mode; - }, "htmlmixed", "ruby"); - - CodeMirror.defineMIME("text/x-slim", "slim"); - CodeMirror.defineMIME("application/x-slim", "slim"); + var closing = { + "{": "}", + "[": "]", + "(": ")" + }; + + var nameStartChar = "_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD"; + var nameChar = nameStartChar + "\\-0-9\xB7\u0300-\u036F\u203F-\u2040"; + var nameRegexp = new RegExp("^[:" + nameStartChar + "](?::[" + nameChar + "]|[" + nameChar + "]*)"); + var attributeNameRegexp = new RegExp("^[:" + nameStartChar + "][:\\." + nameChar + "]*(?=\\s*=)"); + var wrappedAttributeNameRegexp = new RegExp("^[:" + nameStartChar + "][:\\." + nameChar + "]*"); + var classNameRegexp = /^\.-?[_a-zA-Z]+[\w\-]*/; + var classIdRegexp = /^#[_a-zA-Z]+[\w\-]*/; + + function backup(pos, tokenize, style) { + var restore = function (stream, state) { + state.tokenize = tokenize; + if (stream.pos < pos) { + stream.pos = pos; + return style; + } + return state.tokenize(stream, state); + }; + return function (stream, state) { + state.tokenize = restore; + return tokenize(stream, state); + }; + } + + function maybeBackup(stream, state, pat, offset, style) { + var cur = stream.current(); + var idx = cur.search(pat); + if (idx > -1) { + state.tokenize = backup(stream.pos, state.tokenize, style); + stream.backUp(cur.length - idx - offset); + } + return style; + } + + function continueLine(state, column) { + state.stack = { + parent: state.stack, + style: "continuation", + indented: column, + tokenize: state.line + }; + state.line = state.tokenize; + } + + function finishContinue(state) { + if (state.line == state.tokenize) { + state.line = state.stack.tokenize; + state.stack = state.stack.parent; + } + } + + function lineContinuable(column, tokenize) { + return function (stream, state) { + finishContinue(state); + if (stream.match(/^\\$/)) { + continueLine(state, column); + return "lineContinuation"; + } + var style = tokenize(stream, state); + if (stream.eol() && stream.current().match(/(?:^|[^\\])(?:\\\\)*\\$/)) { + stream.backUp(1); + } + return style; + }; + } + + function commaContinuable(column, tokenize) { + return function (stream, state) { + finishContinue(state); + var style = tokenize(stream, state); + if (stream.eol() && stream.current().match(/,$/)) { + continueLine(state, column); + } + return style; + }; + } + + function rubyInQuote(endQuote, tokenize) { + // TODO: add multi line support + return function (stream, state) { + var ch = stream.peek(); + if (ch == endQuote && state.rubyState.tokenize.length == 1) { + // step out of ruby context as it seems to complete processing all the braces + stream.next(); + state.tokenize = tokenize; + return "closeAttributeTag"; + } else { + return ruby(stream, state); + } + }; + } + + function startRubySplat(tokenize) { + var rubyState; + var runSplat = function (stream, state) { + if (state.rubyState.tokenize.length == 1 && !state.rubyState.context.prev) { + stream.backUp(1); + if (stream.eatSpace()) { + state.rubyState = rubyState; + state.tokenize = tokenize; + return tokenize(stream, state); + } + stream.next(); + } + return ruby(stream, state); + }; + return function (stream, state) { + rubyState = state.rubyState; + state.rubyState = rubyMode.startState(); + state.tokenize = runSplat; + return ruby(stream, state); + }; + } + + function ruby(stream, state) { + return rubyMode.token(stream, state.rubyState); + } + + function htmlLine(stream, state) { + if (stream.match(/^\\$/)) { + return "lineContinuation"; + } + return html(stream, state); + } + + function html(stream, state) { + if (stream.match(/^#\{/)) { + state.tokenize = rubyInQuote("}", state.tokenize); + return null; + } + return maybeBackup(stream, state, /[^\\]#\{/, 1, htmlMode.token(stream, state.htmlState)); + } + + function startHtmlLine(lastTokenize) { + return function (stream, state) { + var style = htmlLine(stream, state); + if (stream.eol()) state.tokenize = lastTokenize; + return style; + }; + } + + function startHtmlMode(stream, state, offset) { + state.stack = { + parent: state.stack, + style: "html", + indented: stream.column() + offset, // pipe + space + tokenize: state.line + }; + state.line = state.tokenize = html; + return null; + } + + function comment(stream, state) { + stream.skipToEnd(); + return state.stack.style; + } + + function commentMode(stream, state) { + state.stack = { + parent: state.stack, + style: "comment", + indented: state.indented + 1, + tokenize: state.line + }; + state.line = comment; + return comment(stream, state); + } + + function attributeWrapper(stream, state) { + if (stream.eat(state.stack.endQuote)) { + state.line = state.stack.line; + state.tokenize = state.stack.tokenize; + state.stack = state.stack.parent; + return null; + } + if (stream.match(wrappedAttributeNameRegexp)) { + state.tokenize = attributeWrapperAssign; + return "slimAttribute"; + } + stream.next(); + return null; + } + + function attributeWrapperAssign(stream, state) { + if (stream.match(/^==?/)) { + state.tokenize = attributeWrapperValue; + return null; + } + return attributeWrapper(stream, state); + } + + function attributeWrapperValue(stream, state) { + var ch = stream.peek(); + if (ch == '"' || ch == "\'") { + state.tokenize = readQuoted(ch, "string", true, false, attributeWrapper); + stream.next(); + return state.tokenize(stream, state); + } + if (ch == '[') { + return startRubySplat(attributeWrapper)(stream, state); + } + if (stream.match(/^(true|false|nil)\b/)) { + state.tokenize = attributeWrapper; + return "keyword"; + } + return startRubySplat(attributeWrapper)(stream, state); + } + + function startAttributeWrapperMode(state, endQuote, tokenize) { + state.stack = { + parent: state.stack, + style: "wrapper", + indented: state.indented + 1, + tokenize: tokenize, + line: state.line, + endQuote: endQuote + }; + state.line = state.tokenize = attributeWrapper; + return null; + } + + function sub(stream, state) { + if (stream.match(/^#\{/)) { + state.tokenize = rubyInQuote("}", state.tokenize); + return null; + } + var subStream = new CodeMirror.StringStream(stream.string.slice(state.stack.indented), stream.tabSize); + subStream.pos = stream.pos - state.stack.indented; + subStream.start = stream.start - state.stack.indented; + subStream.lastColumnPos = stream.lastColumnPos - state.stack.indented; + subStream.lastColumnValue = stream.lastColumnValue - state.stack.indented; + var style = state.subMode.token(subStream, state.subState); + stream.pos = subStream.pos + state.stack.indented; + return style; + } + + function firstSub(stream, state) { + state.stack.indented = stream.column(); + state.line = state.tokenize = sub; + return state.tokenize(stream, state); + } + + function createMode(mode) { + var query = embedded[mode]; + var spec = CodeMirror.mimeModes[query]; + if (spec) { + return CodeMirror.getMode(config, spec); + } + var factory = CodeMirror.modes[query]; + if (factory) { + return factory(config, {name: query}); + } + return CodeMirror.getMode(config, "null"); + } + + function getMode(mode) { + if (!modes.hasOwnProperty(mode)) { + return modes[mode] = createMode(mode); + } + return modes[mode]; + } + + function startSubMode(mode, state) { + var subMode = getMode(mode); + var subState = subMode.startState && subMode.startState(); + + state.subMode = subMode; + state.subState = subState; + + state.stack = { + parent: state.stack, + style: "sub", + indented: state.indented + 1, + tokenize: state.line + }; + state.line = state.tokenize = firstSub; + return "slimSubmode"; + } + + function doctypeLine(stream, _state) { + stream.skipToEnd(); + return "slimDoctype"; + } + + function startLine(stream, state) { + var ch = stream.peek(); + if (ch == '<') { + return (state.tokenize = startHtmlLine(state.tokenize))(stream, state); + } + if (stream.match(/^[|']/)) { + return startHtmlMode(stream, state, 1); + } + if (stream.match(/^\/(!|\[\w+])?/)) { + return commentMode(stream, state); + } + if (stream.match(/^(-|==?[<>]?)/)) { + state.tokenize = lineContinuable(stream.column(), commaContinuable(stream.column(), ruby)); + return "slimSwitch"; + } + if (stream.match(/^doctype\b/)) { + state.tokenize = doctypeLine; + return "keyword"; + } + + var m = stream.match(embeddedRegexp); + if (m) { + return startSubMode(m[1], state); + } + + return slimTag(stream, state); + } + + function slim(stream, state) { + if (state.startOfLine) { + return startLine(stream, state); + } + return slimTag(stream, state); + } + + function slimTag(stream, state) { + if (stream.eat('*')) { + state.tokenize = startRubySplat(slimTagExtras); + return null; + } + if (stream.match(nameRegexp)) { + state.tokenize = slimTagExtras; + return "slimTag"; + } + return slimClass(stream, state); + } + + function slimTagExtras(stream, state) { + if (stream.match(/^(<>?|> state.indented && state.last != "slimSubmode") { + state.line = state.tokenize = state.stack.tokenize; + state.stack = state.stack.parent; + state.subMode = null; + state.subState = null; + } + } + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + state.startOfLine = false; + if (style) state.last = style; + return styleMap.hasOwnProperty(style) ? styleMap[style] : style; + }, + + blankLine: function (state) { + if (state.subMode && state.subMode.blankLine) { + return state.subMode.blankLine(state.subState); + } + }, + + innerMode: function (state) { + if (state.subMode) return {state: state.subState, mode: state.subMode}; + return {state: state, mode: mode}; + } + + //indent: function(state) { + // return state.indented; + //} + }; + return mode; + }, "htmlmixed", "ruby"); + + CodeMirror.defineMIME("text/x-slim", "slim"); + CodeMirror.defineMIME("application/x-slim", "slim"); }); diff --git a/web/editor.md/lib/codemirror/mode/slim/test.js b/web/editor.md/lib/codemirror/mode/slim/test.js index be4ddac..94969b3 100644 --- a/web/editor.md/lib/codemirror/mode/slim/test.js +++ b/web/editor.md/lib/codemirror/mode/slim/test.js @@ -3,94 +3,97 @@ // Slim Highlighting for CodeMirror copyright (c) HicknHack Software Gmbh -(function() { - var mode = CodeMirror.getMode({tabSize: 4, indentUnit: 2}, "slim"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } +(function () { + var mode = CodeMirror.getMode({tabSize: 4, indentUnit: 2}, "slim"); - // Requires at least one media query - MT("elementName", - "[tag h1] Hey There"); + function MT(name) { + test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); + } - MT("oneElementPerLine", - "[tag h1] Hey There .h2"); + // Requires at least one media query + MT("elementName", + "[tag h1] Hey There"); - MT("idShortcut", - "[attribute&def #test] Hey There"); + MT("oneElementPerLine", + "[tag h1] Hey There .h2"); - MT("tagWithIdShortcuts", - "[tag h1][attribute&def #test] Hey There"); + MT("idShortcut", + "[attribute&def #test] Hey There"); - MT("classShortcut", - "[attribute&qualifier .hello] Hey There"); + MT("tagWithIdShortcuts", + "[tag h1][attribute&def #test] Hey There"); - MT("tagWithIdAndClassShortcuts", - "[tag h1][attribute&def #test][attribute&qualifier .hello] Hey There"); + MT("classShortcut", + "[attribute&qualifier .hello] Hey There"); - MT("docType", - "[keyword doctype] xml"); + MT("tagWithIdAndClassShortcuts", + "[tag h1][attribute&def #test][attribute&qualifier .hello] Hey There"); - MT("comment", - "[comment / Hello WORLD]"); + MT("docType", + "[keyword doctype] xml"); - MT("notComment", - "[tag h1] This is not a / comment "); + MT("comment", + "[comment / Hello WORLD]"); - MT("attributes", - "[tag a]([attribute title]=[string \"test\"]) [attribute href]=[string \"link\"]}"); + MT("notComment", + "[tag h1] This is not a / comment "); - MT("multiLineAttributes", - "[tag a]([attribute title]=[string \"test\"]", - " ) [attribute href]=[string \"link\"]}"); + MT("attributes", + "[tag a]([attribute title]=[string \"test\"]) [attribute href]=[string \"link\"]}"); - MT("htmlCode", - "[tag&bracket <][tag h1][tag&bracket >]Title[tag&bracket ]"); + MT("multiLineAttributes", + "[tag a]([attribute title]=[string \"test\"]", + " ) [attribute href]=[string \"link\"]}"); - MT("rubyBlock", - "[operator&special =][variable-2 @item]"); + MT("htmlCode", + "[tag&bracket <][tag h1][tag&bracket >]Title[tag&bracket ]"); - MT("selectorRubyBlock", - "[tag a][attribute&qualifier .test][operator&special =] [variable-2 @item]"); + MT("rubyBlock", + "[operator&special =][variable-2 @item]"); - MT("nestedRubyBlock", - "[tag a]", - " [operator&special =][variable puts] [string \"test\"]"); + MT("selectorRubyBlock", + "[tag a][attribute&qualifier .test][operator&special =] [variable-2 @item]"); - MT("multilinePlaintext", - "[tag p]", - " | Hello,", - " World"); + MT("nestedRubyBlock", + "[tag a]", + " [operator&special =][variable puts] [string \"test\"]"); - MT("multilineRuby", - "[tag p]", - " [comment /# this is a comment]", - " [comment and this is a comment too]", - " | Date/Time", - " [operator&special -] [variable now] [operator =] [tag DateTime][operator .][property now]", - " [tag strong][operator&special =] [variable now]", - " [operator&special -] [keyword if] [variable now] [operator >] [tag DateTime][operator .][property parse]([string \"December 31, 2006\"])", - " [operator&special =][string \"Happy\"]", - " [operator&special =][string \"Belated\"]", - " [operator&special =][string \"Birthday\"]"); + MT("multilinePlaintext", + "[tag p]", + " | Hello,", + " World"); - MT("multilineComment", - "[comment /]", - " [comment Multiline]", - " [comment Comment]"); + MT("multilineRuby", + "[tag p]", + " [comment /# this is a comment]", + " [comment and this is a comment too]", + " | Date/Time", + " [operator&special -] [variable now] [operator =] [tag DateTime][operator .][property now]", + " [tag strong][operator&special =] [variable now]", + " [operator&special -] [keyword if] [variable now] [operator >] [tag DateTime][operator .][property parse]([string \"December 31, 2006\"])", + " [operator&special =][string \"Happy\"]", + " [operator&special =][string \"Belated\"]", + " [operator&special =][string \"Birthday\"]"); - MT("hamlAfterRubyTag", - "[attribute&qualifier .block]", - " [tag strong][operator&special =] [variable now]", - " [attribute&qualifier .test]", - " [operator&special =][variable now]", - " [attribute&qualifier .right]"); + MT("multilineComment", + "[comment /]", + " [comment Multiline]", + " [comment Comment]"); - MT("stretchedRuby", - "[operator&special =] [variable puts] [string \"Hello\"],", - " [string \"World\"]"); + MT("hamlAfterRubyTag", + "[attribute&qualifier .block]", + " [tag strong][operator&special =] [variable now]", + " [attribute&qualifier .test]", + " [operator&special =][variable now]", + " [attribute&qualifier .right]"); - MT("interpolationInHashAttribute", - "[tag div]{[attribute id] = [string \"]#{[variable test]}[string _]#{[variable ting]}[string \"]} test"); + MT("stretchedRuby", + "[operator&special =] [variable puts] [string \"Hello\"],", + " [string \"World\"]"); - MT("interpolationInHTMLAttribute", - "[tag div]([attribute title]=[string \"]#{[variable test]}[string _]#{[variable ting]()}[string \"]) Test"); + MT("interpolationInHashAttribute", + "[tag div]{[attribute id] = [string \"]#{[variable test]}[string _]#{[variable ting]}[string \"]} test"); + + MT("interpolationInHTMLAttribute", + "[tag div]([attribute title]=[string \"]#{[variable test]}[string _]#{[variable ting]()}[string \"]) Test"); })(); diff --git a/web/editor.md/lib/codemirror/mode/smalltalk/index.html b/web/editor.md/lib/codemirror/mode/smalltalk/index.html index 2155ebc..cfa061e 100644 --- a/web/editor.md/lib/codemirror/mode/smalltalk/index.html +++ b/web/editor.md/lib/codemirror/mode/smalltalk/index.html @@ -2,34 +2,45 @@ CodeMirror: Smalltalk mode - + - + + .CodeMirror { + border: 2px solid #dee; + border-right-width: 10px; + } + + .CodeMirror-gutter { + border: none; + background: #dee; + } + + .CodeMirror-gutter pre { + color: white; + font-weight: bold; + } +
-

Smalltalk mode

-

Simple Smalltalk mode.

MIME types defined: text/x-stsrc.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/smalltalk/smalltalk.js b/web/editor.md/lib/codemirror/mode/smalltalk/smalltalk.js index bb510ba..f1bc18a 100644 --- a/web/editor.md/lib/codemirror/mode/smalltalk/smalltalk.js +++ b/web/editor.md/lib/codemirror/mode/smalltalk/smalltalk.js @@ -1,168 +1,168 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode('smalltalk', function(config) { - - var specialChars = /[+\-\/\\*~<>=@%|&?!.,:;^]/; - var keywords = /true|false|nil|self|super|thisContext/; - - var Context = function(tokenizer, parent) { - this.next = tokenizer; - this.parent = parent; - }; - - var Token = function(name, context, eos) { - this.name = name; - this.context = context; - this.eos = eos; - }; - - var State = function() { - this.context = new Context(next, null); - this.expectVariable = true; - this.indentation = 0; - this.userIndentationDelta = 0; - }; - - State.prototype.userIndent = function(indentation) { - this.userIndentationDelta = indentation > 0 ? (indentation / config.indentUnit - this.indentation) : 0; - }; - - var next = function(stream, context, state) { - var token = new Token(null, context, false); - var aChar = stream.next(); - - if (aChar === '"') { - token = nextComment(stream, new Context(nextComment, context)); - - } else if (aChar === '\'') { - token = nextString(stream, new Context(nextString, context)); - - } else if (aChar === '#') { - if (stream.peek() === '\'') { - stream.next(); - token = nextSymbol(stream, new Context(nextSymbol, context)); - } else { - if (stream.eatWhile(/[^\s.{}\[\]()]/)) - token.name = 'string-2'; - else - token.name = 'meta'; - } - - } else if (aChar === '$') { - if (stream.next() === '<') { - stream.eatWhile(/[^\s>]/); - stream.next(); - } - token.name = 'string-2'; - - } else if (aChar === '|' && state.expectVariable) { - token.context = new Context(nextTemporaries, context); - - } else if (/[\[\]{}()]/.test(aChar)) { - token.name = 'bracket'; - token.eos = /[\[{(]/.test(aChar); - - if (aChar === '[') { - state.indentation++; - } else if (aChar === ']') { - state.indentation = Math.max(0, state.indentation - 1); - } - - } else if (specialChars.test(aChar)) { - stream.eatWhile(specialChars); - token.name = 'operator'; - token.eos = aChar !== ';'; // ; cascaded message expression - - } else if (/\d/.test(aChar)) { - stream.eatWhile(/[\w\d]/); - token.name = 'number'; - - } else if (/[\w_]/.test(aChar)) { - stream.eatWhile(/[\w\d_]/); - token.name = state.expectVariable ? (keywords.test(stream.current()) ? 'keyword' : 'variable') : null; - - } else { - token.eos = state.expectVariable; - } - - return token; - }; - - var nextComment = function(stream, context) { - stream.eatWhile(/[^"]/); - return new Token('comment', stream.eat('"') ? context.parent : context, true); - }; - - var nextString = function(stream, context) { - stream.eatWhile(/[^']/); - return new Token('string', stream.eat('\'') ? context.parent : context, false); - }; - - var nextSymbol = function(stream, context) { - stream.eatWhile(/[^']/); - return new Token('string-2', stream.eat('\'') ? context.parent : context, false); - }; - - var nextTemporaries = function(stream, context) { - var token = new Token(null, context, false); - var aChar = stream.next(); - - if (aChar === '|') { - token.context = context.parent; - token.eos = true; - - } else { - stream.eatWhile(/[^|]/); - token.name = 'variable'; - } - - return token; - }; - - return { - startState: function() { - return new State; - }, - - token: function(stream, state) { - state.userIndent(stream.indentation()); - - if (stream.eatSpace()) { - return null; - } - - var token = state.context.next(stream, state.context, state); - state.context = token.context; - state.expectVariable = token.eos; - - return token.name; - }, - - blankLine: function(state) { - state.userIndent(0); - }, - - indent: function(state, textAfter) { - var i = state.context.next === next && textAfter && textAfter.charAt(0) === ']' ? -1 : state.userIndentationDelta; - return (state.indentation + i) * config.indentUnit; - }, - - electricChars: ']' - }; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode('smalltalk', function (config) { + + var specialChars = /[+\-\/\\*~<>=@%|&?!.,:;^]/; + var keywords = /true|false|nil|self|super|thisContext/; + + var Context = function (tokenizer, parent) { + this.next = tokenizer; + this.parent = parent; + }; + + var Token = function (name, context, eos) { + this.name = name; + this.context = context; + this.eos = eos; + }; + + var State = function () { + this.context = new Context(next, null); + this.expectVariable = true; + this.indentation = 0; + this.userIndentationDelta = 0; + }; + + State.prototype.userIndent = function (indentation) { + this.userIndentationDelta = indentation > 0 ? (indentation / config.indentUnit - this.indentation) : 0; + }; + + var next = function (stream, context, state) { + var token = new Token(null, context, false); + var aChar = stream.next(); + + if (aChar === '"') { + token = nextComment(stream, new Context(nextComment, context)); + + } else if (aChar === '\'') { + token = nextString(stream, new Context(nextString, context)); + + } else if (aChar === '#') { + if (stream.peek() === '\'') { + stream.next(); + token = nextSymbol(stream, new Context(nextSymbol, context)); + } else { + if (stream.eatWhile(/[^\s.{}\[\]()]/)) + token.name = 'string-2'; + else + token.name = 'meta'; + } + + } else if (aChar === '$') { + if (stream.next() === '<') { + stream.eatWhile(/[^\s>]/); + stream.next(); + } + token.name = 'string-2'; + + } else if (aChar === '|' && state.expectVariable) { + token.context = new Context(nextTemporaries, context); + + } else if (/[\[\]{}()]/.test(aChar)) { + token.name = 'bracket'; + token.eos = /[\[{(]/.test(aChar); + + if (aChar === '[') { + state.indentation++; + } else if (aChar === ']') { + state.indentation = Math.max(0, state.indentation - 1); + } + + } else if (specialChars.test(aChar)) { + stream.eatWhile(specialChars); + token.name = 'operator'; + token.eos = aChar !== ';'; // ; cascaded message expression + + } else if (/\d/.test(aChar)) { + stream.eatWhile(/[\w\d]/); + token.name = 'number'; + + } else if (/[\w_]/.test(aChar)) { + stream.eatWhile(/[\w\d_]/); + token.name = state.expectVariable ? (keywords.test(stream.current()) ? 'keyword' : 'variable') : null; + + } else { + token.eos = state.expectVariable; + } + + return token; + }; + + var nextComment = function (stream, context) { + stream.eatWhile(/[^"]/); + return new Token('comment', stream.eat('"') ? context.parent : context, true); + }; + + var nextString = function (stream, context) { + stream.eatWhile(/[^']/); + return new Token('string', stream.eat('\'') ? context.parent : context, false); + }; + + var nextSymbol = function (stream, context) { + stream.eatWhile(/[^']/); + return new Token('string-2', stream.eat('\'') ? context.parent : context, false); + }; + + var nextTemporaries = function (stream, context) { + var token = new Token(null, context, false); + var aChar = stream.next(); + + if (aChar === '|') { + token.context = context.parent; + token.eos = true; + + } else { + stream.eatWhile(/[^|]/); + token.name = 'variable'; + } + + return token; + }; + + return { + startState: function () { + return new State; + }, + + token: function (stream, state) { + state.userIndent(stream.indentation()); + + if (stream.eatSpace()) { + return null; + } + + var token = state.context.next(stream, state.context, state); + state.context = token.context; + state.expectVariable = token.eos; + + return token.name; + }, + + blankLine: function (state) { + state.userIndent(0); + }, + + indent: function (state, textAfter) { + var i = state.context.next === next && textAfter && textAfter.charAt(0) === ']' ? -1 : state.userIndentationDelta; + return (state.indentation + i) * config.indentUnit; + }, -}); + electricChars: ']' + }; + + }); -CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'}); + CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'}); }); diff --git a/web/editor.md/lib/codemirror/mode/smarty/index.html b/web/editor.md/lib/codemirror/mode/smarty/index.html index 8d88c9a..ab1cec1 100644 --- a/web/editor.md/lib/codemirror/mode/smarty/index.html +++ b/web/editor.md/lib/codemirror/mode/smarty/index.html @@ -2,29 +2,32 @@ CodeMirror: Smarty mode - + - + - +
-

Smarty mode

-
-
+
-

Smarty 2, custom delimiters

+

Smarty 2, custom delimiters

-
+
-

Smarty 3

+

Smarty 3

- - +

A plain text/Smarty version 2 or 3 mode, which allows for custom delimiter tags.

MIME types defined: text/x-smarty

-
+ diff --git a/web/editor.md/lib/codemirror/mode/smarty/smarty.js b/web/editor.md/lib/codemirror/mode/smarty/smarty.js index bb05324..82998b4 100644 --- a/web/editor.md/lib/codemirror/mode/smarty/smarty.js +++ b/web/editor.md/lib/codemirror/mode/smarty/smarty.js @@ -5,217 +5,218 @@ * Smarty 2 and 3 mode. */ -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("smarty", function(config) { - "use strict"; - - // our default settings; check to see if they're overridden - var settings = { - rightDelimiter: '}', - leftDelimiter: '{', - smartyVersion: 2 // for backward compatibility - }; - if (config.hasOwnProperty("leftDelimiter")) { - settings.leftDelimiter = config.leftDelimiter; - } - if (config.hasOwnProperty("rightDelimiter")) { - settings.rightDelimiter = config.rightDelimiter; - } - if (config.hasOwnProperty("smartyVersion") && config.smartyVersion === 3) { - settings.smartyVersion = 3; - } - - var keyFunctions = ["debug", "extends", "function", "include", "literal"]; - var last; - var regs = { - operatorChars: /[+\-*&%=<>!?]/, - validIdentifier: /[a-zA-Z0-9_]/, - stringChar: /['"]/ - }; - - var helpers = { - cont: function(style, lastType) { - last = lastType; - return style; - }, - chain: function(stream, state, parser) { - state.tokenize = parser; - return parser(stream, state); - } - }; - - - // our various parsers - var parsers = { - - // the main tokenizer - tokenizer: function(stream, state) { - if (stream.match(settings.leftDelimiter, true)) { - if (stream.eat("*")) { - return helpers.chain(stream, state, parsers.inBlock("comment", "*" + settings.rightDelimiter)); - } else { - // Smarty 3 allows { and } surrounded by whitespace to NOT slip into Smarty mode - state.depth++; - var isEol = stream.eol(); - var isFollowedByWhitespace = /\s/.test(stream.peek()); - if (settings.smartyVersion === 3 && settings.leftDelimiter === "{" && (isEol || isFollowedByWhitespace)) { - state.depth--; - return null; - } else { - state.tokenize = parsers.smarty; - last = "startTag"; - return "tag"; - } +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("smarty", function (config) { + "use strict"; + + // our default settings; check to see if they're overridden + var settings = { + rightDelimiter: '}', + leftDelimiter: '{', + smartyVersion: 2 // for backward compatibility + }; + if (config.hasOwnProperty("leftDelimiter")) { + settings.leftDelimiter = config.leftDelimiter; } - } else { - stream.next(); - return null; - } - }, - - // parsing Smarty content - smarty: function(stream, state) { - if (stream.match(settings.rightDelimiter, true)) { - if (settings.smartyVersion === 3) { - state.depth--; - if (state.depth <= 0) { - state.tokenize = parsers.tokenizer; - } - } else { - state.tokenize = parsers.tokenizer; + if (config.hasOwnProperty("rightDelimiter")) { + settings.rightDelimiter = config.rightDelimiter; } - return helpers.cont("tag", null); - } - - if (stream.match(settings.leftDelimiter, true)) { - state.depth++; - return helpers.cont("tag", "startTag"); - } - - var ch = stream.next(); - if (ch == "$") { - stream.eatWhile(regs.validIdentifier); - return helpers.cont("variable-2", "variable"); - } else if (ch == "|") { - return helpers.cont("operator", "pipe"); - } else if (ch == ".") { - return helpers.cont("operator", "property"); - } else if (regs.stringChar.test(ch)) { - state.tokenize = parsers.inAttribute(ch); - return helpers.cont("string", "string"); - } else if (regs.operatorChars.test(ch)) { - stream.eatWhile(regs.operatorChars); - return helpers.cont("operator", "operator"); - } else if (ch == "[" || ch == "]") { - return helpers.cont("bracket", "bracket"); - } else if (ch == "(" || ch == ")") { - return helpers.cont("bracket", "operator"); - } else if (/\d/.test(ch)) { - stream.eatWhile(/\d/); - return helpers.cont("number", "number"); - } else { - - if (state.last == "variable") { - if (ch == "@") { - stream.eatWhile(regs.validIdentifier); - return helpers.cont("property", "property"); - } else if (ch == "|") { - stream.eatWhile(regs.validIdentifier); - return helpers.cont("qualifier", "modifier"); - } - } else if (state.last == "pipe") { - stream.eatWhile(regs.validIdentifier); - return helpers.cont("qualifier", "modifier"); - } else if (state.last == "whitespace") { - stream.eatWhile(regs.validIdentifier); - return helpers.cont("attribute", "modifier"); - } if (state.last == "property") { - stream.eatWhile(regs.validIdentifier); - return helpers.cont("property", null); - } else if (/\s/.test(ch)) { - last = "whitespace"; - return null; + if (config.hasOwnProperty("smartyVersion") && config.smartyVersion === 3) { + settings.smartyVersion = 3; } - var str = ""; - if (ch != "/") { - str += ch; - } - var c = null; - while (c = stream.eat(regs.validIdentifier)) { - str += c; - } - for (var i=0, j=keyFunctions.length; i!?]/, + validIdentifier: /[a-zA-Z0-9_]/, + stringChar: /['"]/ + }; + + var helpers = { + cont: function (style, lastType) { + last = lastType; + return style; + }, + chain: function (stream, state, parser) { + state.tokenize = parser; + return parser(stream, state); + } + }; + + + // our various parsers + var parsers = { + + // the main tokenizer + tokenizer: function (stream, state) { + if (stream.match(settings.leftDelimiter, true)) { + if (stream.eat("*")) { + return helpers.chain(stream, state, parsers.inBlock("comment", "*" + settings.rightDelimiter)); + } else { + // Smarty 3 allows { and } surrounded by whitespace to NOT slip into Smarty mode + state.depth++; + var isEol = stream.eol(); + var isFollowedByWhitespace = /\s/.test(stream.peek()); + if (settings.smartyVersion === 3 && settings.leftDelimiter === "{" && (isEol || isFollowedByWhitespace)) { + state.depth--; + return null; + } else { + state.tokenize = parsers.smarty; + last = "startTag"; + return "tag"; + } + } + } else { + stream.next(); + return null; + } + }, + + // parsing Smarty content + smarty: function (stream, state) { + if (stream.match(settings.rightDelimiter, true)) { + if (settings.smartyVersion === 3) { + state.depth--; + if (state.depth <= 0) { + state.tokenize = parsers.tokenizer; + } + } else { + state.tokenize = parsers.tokenizer; + } + return helpers.cont("tag", null); + } + + if (stream.match(settings.leftDelimiter, true)) { + state.depth++; + return helpers.cont("tag", "startTag"); + } + + var ch = stream.next(); + if (ch == "$") { + stream.eatWhile(regs.validIdentifier); + return helpers.cont("variable-2", "variable"); + } else if (ch == "|") { + return helpers.cont("operator", "pipe"); + } else if (ch == ".") { + return helpers.cont("operator", "property"); + } else if (regs.stringChar.test(ch)) { + state.tokenize = parsers.inAttribute(ch); + return helpers.cont("string", "string"); + } else if (regs.operatorChars.test(ch)) { + stream.eatWhile(regs.operatorChars); + return helpers.cont("operator", "operator"); + } else if (ch == "[" || ch == "]") { + return helpers.cont("bracket", "bracket"); + } else if (ch == "(" || ch == ")") { + return helpers.cont("bracket", "operator"); + } else if (/\d/.test(ch)) { + stream.eatWhile(/\d/); + return helpers.cont("number", "number"); + } else { + + if (state.last == "variable") { + if (ch == "@") { + stream.eatWhile(regs.validIdentifier); + return helpers.cont("property", "property"); + } else if (ch == "|") { + stream.eatWhile(regs.validIdentifier); + return helpers.cont("qualifier", "modifier"); + } + } else if (state.last == "pipe") { + stream.eatWhile(regs.validIdentifier); + return helpers.cont("qualifier", "modifier"); + } else if (state.last == "whitespace") { + stream.eatWhile(regs.validIdentifier); + return helpers.cont("attribute", "modifier"); + } + if (state.last == "property") { + stream.eatWhile(regs.validIdentifier); + return helpers.cont("property", null); + } else if (/\s/.test(ch)) { + last = "whitespace"; + return null; + } + + var str = ""; + if (ch != "/") { + str += ch; + } + var c = null; + while (c = stream.eat(regs.validIdentifier)) { + str += c; + } + for (var i = 0, j = keyFunctions.length; i < j; i++) { + if (keyFunctions[i] == str) { + return helpers.cont("keyword", "keyword"); + } + } + if (/\s/.test(ch)) { + return null; + } + return helpers.cont("tag", "tag"); + } + }, + + inAttribute: function (quote) { + return function (stream, state) { + var prevChar = null; + var currChar = null; + while (!stream.eol()) { + currChar = stream.peek(); + if (stream.next() == quote && prevChar !== '\\') { + state.tokenize = parsers.smarty; + break; + } + prevChar = currChar; + } + return "string"; + }; + }, + + inBlock: function (style, terminator) { + return function (stream, state) { + while (!stream.eol()) { + if (stream.match(terminator)) { + state.tokenize = parsers.tokenizer; + break; + } + stream.next(); + } + return style; + }; + } + }; + + + // the public API for CodeMirror + return { + startState: function () { + return { + tokenize: parsers.tokenizer, + mode: "smarty", + last: null, + depth: 0 + }; + }, + token: function (stream, state) { + var style = state.tokenize(stream, state); + state.last = last; + return style; + }, + electricChars: "" + }; + }); + + CodeMirror.defineMIME("text/x-smarty", "smarty"); }); diff --git a/web/editor.md/lib/codemirror/mode/smartymixed/index.html b/web/editor.md/lib/codemirror/mode/smartymixed/index.html index 3a216ab..17ceb27 100644 --- a/web/editor.md/lib/codemirror/mode/smartymixed/index.html +++ b/web/editor.md/lib/codemirror/mode/smartymixed/index.html @@ -2,9 +2,9 @@ CodeMirror: Smarty mixed mode - + - + @@ -13,22 +13,22 @@
-

Smarty mixed mode

-

The Smarty mixed mode depends on the Smarty and HTML mixed modes. HTML - mixed mode itself depends on XML, JavaScript, and CSS modes.

+ mixed mode itself depends on XML, JavaScript, and CSS modes.

It takes the same options, as Smarty and HTML mixed modes.

MIME types defined: text/x-smarty.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/smartymixed/smartymixed.js b/web/editor.md/lib/codemirror/mode/smartymixed/smartymixed.js index 4fc7ca4..54b9c9a 100644 --- a/web/editor.md/lib/codemirror/mode/smartymixed/smartymixed.js +++ b/web/editor.md/lib/codemirror/mode/smartymixed/smartymixed.js @@ -2,196 +2,198 @@ // Distributed under an MIT license: http://codemirror.net/LICENSE /** -* @file smartymixed.js -* @brief Smarty Mixed Codemirror mode (Smarty + Mixed HTML) -* @author Ruslan Osmanov -* @version 3.0 -* @date 05.07.2013 -*/ + * @file smartymixed.js + * @brief Smarty Mixed Codemirror mode (Smarty + Mixed HTML) + * @author Ruslan Osmanov + * @version 3.0 + * @date 05.07.2013 + */ // Warning: Don't base other modes on this one. This here is a // terrible way to write a mixed mode. -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../smarty/smarty")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../smarty/smarty"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("smartymixed", function(config) { - var htmlMixedMode = CodeMirror.getMode(config, "htmlmixed"); - var smartyMode = CodeMirror.getMode(config, "smarty"); - - var settings = { - rightDelimiter: '}', - leftDelimiter: '{' - }; - - if (config.hasOwnProperty("leftDelimiter")) { - settings.leftDelimiter = config.leftDelimiter; - } - if (config.hasOwnProperty("rightDelimiter")) { - settings.rightDelimiter = config.rightDelimiter; - } - - function reEsc(str) { return str.replace(/[^\s\w]/g, "\\$&"); } - - var reLeft = reEsc(settings.leftDelimiter), reRight = reEsc(settings.rightDelimiter); - var regs = { - smartyComment: new RegExp("^" + reRight + "\\*"), - literalOpen: new RegExp(reLeft + "literal" + reRight), - literalClose: new RegExp(reLeft + "\/literal" + reRight), - hasLeftDelimeter: new RegExp(".*" + reLeft), - htmlHasLeftDelimeter: new RegExp("[^<>]*" + reLeft) - }; - - var helpers = { - chain: function(stream, state, parser) { - state.tokenize = parser; - return parser(stream, state); - }, - - cleanChain: function(stream, state, parser) { - state.tokenize = null; - state.localState = null; - state.localMode = null; - return (typeof parser == "string") ? (parser ? parser : null) : parser(stream, state); - }, - - maybeBackup: function(stream, pat, style) { - var cur = stream.current(); - var close = cur.search(pat), - m; - if (close > - 1) stream.backUp(cur.length - close); - else if (m = cur.match(/<\/?$/)) { - stream.backUp(cur.length); - if (!stream.match(pat, false)) stream.match(cur[0]); - } - return style; - } - }; - - var parsers = { - html: function(stream, state) { - var htmlTagName = state.htmlMixedState.htmlState.context && state.htmlMixedState.htmlState.context.tagName - ? state.htmlMixedState.htmlState.context.tagName - : null; - - if (!state.inLiteral && stream.match(regs.htmlHasLeftDelimeter, false) && htmlTagName === null) { - state.tokenize = parsers.smarty; - state.localMode = smartyMode; - state.localState = smartyMode.startState(htmlMixedMode.indent(state.htmlMixedState, "")); - return helpers.maybeBackup(stream, settings.leftDelimiter, smartyMode.token(stream, state.localState)); - } else if (!state.inLiteral && stream.match(settings.leftDelimiter, false)) { - state.tokenize = parsers.smarty; - state.localMode = smartyMode; - state.localState = smartyMode.startState(htmlMixedMode.indent(state.htmlMixedState, "")); - return helpers.maybeBackup(stream, settings.leftDelimiter, smartyMode.token(stream, state.localState)); - } - return htmlMixedMode.token(stream, state.htmlMixedState); - }, - - smarty: function(stream, state) { - if (stream.match(settings.leftDelimiter, false)) { - if (stream.match(regs.smartyComment, false)) { - return helpers.chain(stream, state, parsers.inBlock("comment", "*" + settings.rightDelimiter)); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../smarty/smarty")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../smarty/smarty"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("smartymixed", function (config) { + var htmlMixedMode = CodeMirror.getMode(config, "htmlmixed"); + var smartyMode = CodeMirror.getMode(config, "smarty"); + + var settings = { + rightDelimiter: '}', + leftDelimiter: '{' + }; + + if (config.hasOwnProperty("leftDelimiter")) { + settings.leftDelimiter = config.leftDelimiter; } - } else if (stream.match(settings.rightDelimiter, false)) { - stream.eat(settings.rightDelimiter); - state.tokenize = parsers.html; - state.localMode = htmlMixedMode; - state.localState = state.htmlMixedState; - return "tag"; - } - - return helpers.maybeBackup(stream, settings.rightDelimiter, smartyMode.token(stream, state.localState)); - }, - - inBlock: function(style, terminator) { - return function(stream, state) { - while (!stream.eol()) { - if (stream.match(terminator)) { - helpers.cleanChain(stream, state, ""); - break; - } - stream.next(); + if (config.hasOwnProperty("rightDelimiter")) { + settings.rightDelimiter = config.rightDelimiter; } - return style; - }; - } - }; - - return { - startState: function() { - var state = htmlMixedMode.startState(); - return { - token: parsers.html, - localMode: null, - localState: null, - htmlMixedState: state, - tokenize: null, - inLiteral: false - }; - }, - - copyState: function(state) { - var local = null, tok = (state.tokenize || state.token); - if (state.localState) { - local = CodeMirror.copyState((tok != parsers.html ? smartyMode : htmlMixedMode), state.localState); - } - return { - token: state.token, - tokenize: state.tokenize, - localMode: state.localMode, - localState: local, - htmlMixedState: CodeMirror.copyState(htmlMixedMode, state.htmlMixedState), - inLiteral: state.inLiteral - }; - }, - - token: function(stream, state) { - if (stream.match(settings.leftDelimiter, false)) { - if (!state.inLiteral && stream.match(regs.literalOpen, true)) { - state.inLiteral = true; - return "keyword"; - } else if (state.inLiteral && stream.match(regs.literalClose, true)) { - state.inLiteral = false; - return "keyword"; + + function reEsc(str) { + return str.replace(/[^\s\w]/g, "\\$&"); } - } - if (state.inLiteral && state.localState != state.htmlMixedState) { - state.tokenize = parsers.html; - state.localMode = htmlMixedMode; - state.localState = state.htmlMixedState; - } - - var style = (state.tokenize || state.token)(stream, state); - return style; - }, - - indent: function(state, textAfter) { - if (state.localMode == smartyMode - || (state.inLiteral && !state.localMode) - || regs.hasLeftDelimeter.test(textAfter)) { - return CodeMirror.Pass; - } - return htmlMixedMode.indent(state.htmlMixedState, textAfter); - }, - - innerMode: function(state) { - return { - state: state.localState || state.htmlMixedState, - mode: state.localMode || htmlMixedMode - }; - } - }; -}, "htmlmixed", "smarty"); - -CodeMirror.defineMIME("text/x-smarty", "smartymixed"); + + var reLeft = reEsc(settings.leftDelimiter), reRight = reEsc(settings.rightDelimiter); + var regs = { + smartyComment: new RegExp("^" + reRight + "\\*"), + literalOpen: new RegExp(reLeft + "literal" + reRight), + literalClose: new RegExp(reLeft + "\/literal" + reRight), + hasLeftDelimeter: new RegExp(".*" + reLeft), + htmlHasLeftDelimeter: new RegExp("[^<>]*" + reLeft) + }; + + var helpers = { + chain: function (stream, state, parser) { + state.tokenize = parser; + return parser(stream, state); + }, + + cleanChain: function (stream, state, parser) { + state.tokenize = null; + state.localState = null; + state.localMode = null; + return (typeof parser == "string") ? (parser ? parser : null) : parser(stream, state); + }, + + maybeBackup: function (stream, pat, style) { + var cur = stream.current(); + var close = cur.search(pat), + m; + if (close > -1) stream.backUp(cur.length - close); + else if (m = cur.match(/<\/?$/)) { + stream.backUp(cur.length); + if (!stream.match(pat, false)) stream.match(cur[0]); + } + return style; + } + }; + + var parsers = { + html: function (stream, state) { + var htmlTagName = state.htmlMixedState.htmlState.context && state.htmlMixedState.htmlState.context.tagName + ? state.htmlMixedState.htmlState.context.tagName + : null; + + if (!state.inLiteral && stream.match(regs.htmlHasLeftDelimeter, false) && htmlTagName === null) { + state.tokenize = parsers.smarty; + state.localMode = smartyMode; + state.localState = smartyMode.startState(htmlMixedMode.indent(state.htmlMixedState, "")); + return helpers.maybeBackup(stream, settings.leftDelimiter, smartyMode.token(stream, state.localState)); + } else if (!state.inLiteral && stream.match(settings.leftDelimiter, false)) { + state.tokenize = parsers.smarty; + state.localMode = smartyMode; + state.localState = smartyMode.startState(htmlMixedMode.indent(state.htmlMixedState, "")); + return helpers.maybeBackup(stream, settings.leftDelimiter, smartyMode.token(stream, state.localState)); + } + return htmlMixedMode.token(stream, state.htmlMixedState); + }, + + smarty: function (stream, state) { + if (stream.match(settings.leftDelimiter, false)) { + if (stream.match(regs.smartyComment, false)) { + return helpers.chain(stream, state, parsers.inBlock("comment", "*" + settings.rightDelimiter)); + } + } else if (stream.match(settings.rightDelimiter, false)) { + stream.eat(settings.rightDelimiter); + state.tokenize = parsers.html; + state.localMode = htmlMixedMode; + state.localState = state.htmlMixedState; + return "tag"; + } + + return helpers.maybeBackup(stream, settings.rightDelimiter, smartyMode.token(stream, state.localState)); + }, + + inBlock: function (style, terminator) { + return function (stream, state) { + while (!stream.eol()) { + if (stream.match(terminator)) { + helpers.cleanChain(stream, state, ""); + break; + } + stream.next(); + } + return style; + }; + } + }; + + return { + startState: function () { + var state = htmlMixedMode.startState(); + return { + token: parsers.html, + localMode: null, + localState: null, + htmlMixedState: state, + tokenize: null, + inLiteral: false + }; + }, + + copyState: function (state) { + var local = null, tok = (state.tokenize || state.token); + if (state.localState) { + local = CodeMirror.copyState((tok != parsers.html ? smartyMode : htmlMixedMode), state.localState); + } + return { + token: state.token, + tokenize: state.tokenize, + localMode: state.localMode, + localState: local, + htmlMixedState: CodeMirror.copyState(htmlMixedMode, state.htmlMixedState), + inLiteral: state.inLiteral + }; + }, + + token: function (stream, state) { + if (stream.match(settings.leftDelimiter, false)) { + if (!state.inLiteral && stream.match(regs.literalOpen, true)) { + state.inLiteral = true; + return "keyword"; + } else if (state.inLiteral && stream.match(regs.literalClose, true)) { + state.inLiteral = false; + return "keyword"; + } + } + if (state.inLiteral && state.localState != state.htmlMixedState) { + state.tokenize = parsers.html; + state.localMode = htmlMixedMode; + state.localState = state.htmlMixedState; + } + + var style = (state.tokenize || state.token)(stream, state); + return style; + }, + + indent: function (state, textAfter) { + if (state.localMode == smartyMode + || (state.inLiteral && !state.localMode) + || regs.hasLeftDelimeter.test(textAfter)) { + return CodeMirror.Pass; + } + return htmlMixedMode.indent(state.htmlMixedState, textAfter); + }, + + innerMode: function (state) { + return { + state: state.localState || state.htmlMixedState, + mode: state.localMode || htmlMixedMode + }; + } + }; + }, "htmlmixed", "smarty"); + + CodeMirror.defineMIME("text/x-smarty", "smartymixed"); // vim: et ts=2 sts=2 sw=2 }); diff --git a/web/editor.md/lib/codemirror/mode/solr/index.html b/web/editor.md/lib/codemirror/mode/solr/index.html index 4b18c25..9838d9b 100644 --- a/web/editor.md/lib/codemirror/mode/solr/index.html +++ b/web/editor.md/lib/codemirror/mode/solr/index.html @@ -2,39 +2,39 @@ CodeMirror: Solr mode - + - +
-

Solr mode

+

Solr mode

-
+
-
+
- + -

MIME types defined: text/x-solr.

+

MIME types defined: text/x-solr.

diff --git a/web/editor.md/lib/codemirror/mode/solr/solr.js b/web/editor.md/lib/codemirror/mode/solr/solr.js index f7f7087..20affc8 100644 --- a/web/editor.md/lib/codemirror/mode/solr/solr.js +++ b/web/editor.md/lib/codemirror/mode/solr/solr.js @@ -1,104 +1,104 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("solr", function() { - "use strict"; - - var isStringChar = /[^\s\|\!\+\-\*\?\~\^\&\:\(\)\[\]\{\}\^\"\\]/; - var isOperatorChar = /[\|\!\+\-\*\?\~\^\&]/; - var isOperatorString = /^(OR|AND|NOT|TO)$/i; - - function isNumber(word) { - return parseFloat(word, 10).toString() === word; - } - - function tokenString(quote) { - return function(stream, state) { - var escaped = false, next; - while ((next = stream.next()) != null) { - if (next == quote && !escaped) break; - escaped = !escaped && next == "\\"; - } - - if (!escaped) state.tokenize = tokenBase; - return "string"; - }; - } - - function tokenOperator(operator) { - return function(stream, state) { - var style = "operator"; - if (operator == "+") - style += " positive"; - else if (operator == "-") - style += " negative"; - else if (operator == "|") - stream.eat(/\|/); - else if (operator == "&") - stream.eat(/\&/); - else if (operator == "^") - style += " boost"; - - state.tokenize = tokenBase; - return style; - }; - } - - function tokenWord(ch) { - return function(stream, state) { - var word = ch; - while ((ch = stream.peek()) && ch.match(isStringChar) != null) { - word += stream.next(); - } - - state.tokenize = tokenBase; - if (isOperatorString.test(word)) - return "operator"; - else if (isNumber(word)) - return "number"; - else if (stream.peek() == ":") - return "field"; - else - return "string"; - }; - } - - function tokenBase(stream, state) { - var ch = stream.next(); - if (ch == '"') - state.tokenize = tokenString(ch); - else if (isOperatorChar.test(ch)) - state.tokenize = tokenOperator(ch); - else if (isStringChar.test(ch)) - state.tokenize = tokenWord(ch); - - return (state.tokenize != tokenBase) ? state.tokenize(stream, state) : null; - } - - return { - startState: function() { - return { - tokenize: tokenBase - }; - }, - - token: function(stream, state) { - if (stream.eatSpace()) return null; - return state.tokenize(stream, state); - } - }; -}); - -CodeMirror.defineMIME("text/x-solr", "solr"); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("solr", function () { + "use strict"; + + var isStringChar = /[^\s\|\!\+\-\*\?\~\^\&\:\(\)\[\]\{\}\^\"\\]/; + var isOperatorChar = /[\|\!\+\-\*\?\~\^\&]/; + var isOperatorString = /^(OR|AND|NOT|TO)$/i; + + function isNumber(word) { + return parseFloat(word, 10).toString() === word; + } + + function tokenString(quote) { + return function (stream, state) { + var escaped = false, next; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) break; + escaped = !escaped && next == "\\"; + } + + if (!escaped) state.tokenize = tokenBase; + return "string"; + }; + } + + function tokenOperator(operator) { + return function (stream, state) { + var style = "operator"; + if (operator == "+") + style += " positive"; + else if (operator == "-") + style += " negative"; + else if (operator == "|") + stream.eat(/\|/); + else if (operator == "&") + stream.eat(/\&/); + else if (operator == "^") + style += " boost"; + + state.tokenize = tokenBase; + return style; + }; + } + + function tokenWord(ch) { + return function (stream, state) { + var word = ch; + while ((ch = stream.peek()) && ch.match(isStringChar) != null) { + word += stream.next(); + } + + state.tokenize = tokenBase; + if (isOperatorString.test(word)) + return "operator"; + else if (isNumber(word)) + return "number"; + else if (stream.peek() == ":") + return "field"; + else + return "string"; + }; + } + + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == '"') + state.tokenize = tokenString(ch); + else if (isOperatorChar.test(ch)) + state.tokenize = tokenOperator(ch); + else if (isStringChar.test(ch)) + state.tokenize = tokenWord(ch); + + return (state.tokenize != tokenBase) ? state.tokenize(stream, state) : null; + } + + return { + startState: function () { + return { + tokenize: tokenBase + }; + }, + + token: function (stream, state) { + if (stream.eatSpace()) return null; + return state.tokenize(stream, state); + } + }; + }); + + CodeMirror.defineMIME("text/x-solr", "solr"); }); diff --git a/web/editor.md/lib/codemirror/mode/soy/index.html b/web/editor.md/lib/codemirror/mode/soy/index.html index f0216f0..0ce3e34 100644 --- a/web/editor.md/lib/codemirror/mode/soy/index.html +++ b/web/editor.md/lib/codemirror/mode/soy/index.html @@ -2,9 +2,9 @@ CodeMirror: Soy (Closure Template) mode - + - + @@ -12,24 +12,27 @@ - +
-

Soy (Closure Template) mode

-

A mode for Closure Templates (Soy).

MIME type defined: text/x-soy.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/soy/soy.js b/web/editor.md/lib/codemirror/mode/soy/soy.js index 7e81e8d..8690b31 100644 --- a/web/editor.md/lib/codemirror/mode/soy/soy.js +++ b/web/editor.md/lib/codemirror/mode/soy/soy.js @@ -1,198 +1,202 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../htmlmixed/htmlmixed"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; - - var indentingTags = ["template", "literal", "msg", "fallbackmsg", "let", "if", "elseif", - "else", "switch", "case", "default", "foreach", "ifempty", "for", - "call", "param", "deltemplate", "delcall", "log"]; - - CodeMirror.defineMode("soy", function(config) { - var textMode = CodeMirror.getMode(config, "text/plain"); - var modes = { - html: CodeMirror.getMode(config, {name: "text/html", multilineTagIndentFactor: 2, multilineTagIndentPastTag: false}), - attributes: textMode, - text: textMode, - uri: textMode, - css: CodeMirror.getMode(config, "text/css"), - js: CodeMirror.getMode(config, {name: "text/javascript", statementIndent: 2 * config.indentUnit}) - }; - - function last(array) { - return array[array.length - 1]; - } - - function tokenUntil(stream, state, untilRegExp) { - var oldString = stream.string; - var match = untilRegExp.exec(oldString.substr(stream.pos)); - if (match) { - // We don't use backUp because it backs up just the position, not the state. - // This uses an undocumented API. - stream.string = oldString.substr(0, stream.pos + match.index); - } - var result = stream.hideFirstChars(state.indent, function() { - return state.localMode.token(stream, state.localState); - }); - stream.string = oldString; - return result; - } - - return { - startState: function() { - return { - kind: [], - kindTag: [], - soyState: [], - indent: 0, - localMode: modes.html, - localState: CodeMirror.startState(modes.html) - }; - }, - - copyState: function(state) { - return { - tag: state.tag, // Last seen Soy tag. - kind: state.kind.concat([]), // Values of kind="" attributes. - kindTag: state.kindTag.concat([]), // Opened tags with kind="" attributes. - soyState: state.soyState.concat([]), - indent: state.indent, // Indentation of the following line. - localMode: state.localMode, - localState: CodeMirror.copyState(state.localMode, state.localState) +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../htmlmixed/htmlmixed"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + var indentingTags = ["template", "literal", "msg", "fallbackmsg", "let", "if", "elseif", + "else", "switch", "case", "default", "foreach", "ifempty", "for", + "call", "param", "deltemplate", "delcall", "log"]; + + CodeMirror.defineMode("soy", function (config) { + var textMode = CodeMirror.getMode(config, "text/plain"); + var modes = { + html: CodeMirror.getMode(config, { + name: "text/html", + multilineTagIndentFactor: 2, + multilineTagIndentPastTag: false + }), + attributes: textMode, + text: textMode, + uri: textMode, + css: CodeMirror.getMode(config, "text/css"), + js: CodeMirror.getMode(config, {name: "text/javascript", statementIndent: 2 * config.indentUnit}) }; - }, - - token: function(stream, state) { - var match; - - switch (last(state.soyState)) { - case "comment": - if (stream.match(/^.*?\*\//)) { - state.soyState.pop(); - } else { - stream.skipToEnd(); - } - return "comment"; - - case "variable": - if (stream.match(/^}/)) { - state.indent -= 2 * config.indentUnit; - state.soyState.pop(); - return "variable-2"; - } - stream.next(); - return null; - - case "tag": - if (stream.match(/^\/?}/)) { - if (state.tag == "/template" || state.tag == "/deltemplate") state.indent = 0; - else state.indent -= (stream.current() == "/}" || indentingTags.indexOf(state.tag) == -1 ? 2 : 1) * config.indentUnit; - state.soyState.pop(); - return "keyword"; - } else if (stream.match(/^(\w+)(?==)/)) { - if (stream.current() == "kind" && (match = stream.match(/^="([^"]+)/, false))) { - var kind = match[1]; - state.kind.push(kind); - state.kindTag.push(state.tag); - state.localMode = modes[kind] || modes.html; - state.localState = CodeMirror.startState(state.localMode); - } - return "attribute"; - } else if (stream.match(/^"/)) { - state.soyState.push("string"); - return "string"; - } - stream.next(); - return null; - - case "literal": - if (stream.match(/^(?=\{\/literal})/)) { - state.indent -= config.indentUnit; - state.soyState.pop(); - return this.token(stream, state); - } - return tokenUntil(stream, state, /\{\/literal}/); - case "string": - if (stream.match(/^.*?"/)) { - state.soyState.pop(); - } else { - stream.skipToEnd(); - } - return "string"; + function last(array) { + return array[array.length - 1]; } - if (stream.match(/^\/\*/)) { - state.soyState.push("comment"); - return "comment"; - } else if (stream.match(stream.sol() ? /^\s*\/\/.*/ : /^\s+\/\/.*/)) { - return "comment"; - } else if (stream.match(/^\{\$\w*/)) { - state.indent += 2 * config.indentUnit; - state.soyState.push("variable"); - return "variable-2"; - } else if (stream.match(/^\{literal}/)) { - state.indent += config.indentUnit; - state.soyState.push("literal"); - return "keyword"; - } else if (match = stream.match(/^\{([\/@\\]?\w*)/)) { - if (match[1] != "/switch") - state.indent += (/^(\/|(else|elseif|case|default)$)/.test(match[1]) && state.tag != "switch" ? 1 : 2) * config.indentUnit; - state.tag = match[1]; - if (state.tag == "/" + last(state.kindTag)) { - // We found the tag that opened the current kind="". - state.kind.pop(); - state.kindTag.pop(); - state.localMode = modes[last(state.kind)] || modes.html; - state.localState = CodeMirror.startState(state.localMode); - } - state.soyState.push("tag"); - return "keyword"; + function tokenUntil(stream, state, untilRegExp) { + var oldString = stream.string; + var match = untilRegExp.exec(oldString.substr(stream.pos)); + if (match) { + // We don't use backUp because it backs up just the position, not the state. + // This uses an undocumented API. + stream.string = oldString.substr(0, stream.pos + match.index); + } + var result = stream.hideFirstChars(state.indent, function () { + return state.localMode.token(stream, state.localState); + }); + stream.string = oldString; + return result; } - return tokenUntil(stream, state, /\{|\s+\/\/|\/\*/); - }, + return { + startState: function () { + return { + kind: [], + kindTag: [], + soyState: [], + indent: 0, + localMode: modes.html, + localState: CodeMirror.startState(modes.html) + }; + }, + + copyState: function (state) { + return { + tag: state.tag, // Last seen Soy tag. + kind: state.kind.concat([]), // Values of kind="" attributes. + kindTag: state.kindTag.concat([]), // Opened tags with kind="" attributes. + soyState: state.soyState.concat([]), + indent: state.indent, // Indentation of the following line. + localMode: state.localMode, + localState: CodeMirror.copyState(state.localMode, state.localState) + }; + }, + + token: function (stream, state) { + var match; + + switch (last(state.soyState)) { + case "comment": + if (stream.match(/^.*?\*\//)) { + state.soyState.pop(); + } else { + stream.skipToEnd(); + } + return "comment"; + + case "variable": + if (stream.match(/^}/)) { + state.indent -= 2 * config.indentUnit; + state.soyState.pop(); + return "variable-2"; + } + stream.next(); + return null; + + case "tag": + if (stream.match(/^\/?}/)) { + if (state.tag == "/template" || state.tag == "/deltemplate") state.indent = 0; + else state.indent -= (stream.current() == "/}" || indentingTags.indexOf(state.tag) == -1 ? 2 : 1) * config.indentUnit; + state.soyState.pop(); + return "keyword"; + } else if (stream.match(/^(\w+)(?==)/)) { + if (stream.current() == "kind" && (match = stream.match(/^="([^"]+)/, false))) { + var kind = match[1]; + state.kind.push(kind); + state.kindTag.push(state.tag); + state.localMode = modes[kind] || modes.html; + state.localState = CodeMirror.startState(state.localMode); + } + return "attribute"; + } else if (stream.match(/^"/)) { + state.soyState.push("string"); + return "string"; + } + stream.next(); + return null; + + case "literal": + if (stream.match(/^(?=\{\/literal})/)) { + state.indent -= config.indentUnit; + state.soyState.pop(); + return this.token(stream, state); + } + return tokenUntil(stream, state, /\{\/literal}/); + + case "string": + if (stream.match(/^.*?"/)) { + state.soyState.pop(); + } else { + stream.skipToEnd(); + } + return "string"; + } + + if (stream.match(/^\/\*/)) { + state.soyState.push("comment"); + return "comment"; + } else if (stream.match(stream.sol() ? /^\s*\/\/.*/ : /^\s+\/\/.*/)) { + return "comment"; + } else if (stream.match(/^\{\$\w*/)) { + state.indent += 2 * config.indentUnit; + state.soyState.push("variable"); + return "variable-2"; + } else if (stream.match(/^\{literal}/)) { + state.indent += config.indentUnit; + state.soyState.push("literal"); + return "keyword"; + } else if (match = stream.match(/^\{([\/@\\]?\w*)/)) { + if (match[1] != "/switch") + state.indent += (/^(\/|(else|elseif|case|default)$)/.test(match[1]) && state.tag != "switch" ? 1 : 2) * config.indentUnit; + state.tag = match[1]; + if (state.tag == "/" + last(state.kindTag)) { + // We found the tag that opened the current kind="". + state.kind.pop(); + state.kindTag.pop(); + state.localMode = modes[last(state.kind)] || modes.html; + state.localState = CodeMirror.startState(state.localMode); + } + state.soyState.push("tag"); + return "keyword"; + } + + return tokenUntil(stream, state, /\{|\s+\/\/|\/\*/); + }, + + indent: function (state, textAfter) { + var indent = state.indent, top = last(state.soyState); + if (top == "comment") return CodeMirror.Pass; + + if (top == "literal") { + if (/^\{\/literal}/.test(textAfter)) indent -= config.indentUnit; + } else { + if (/^\s*\{\/(template|deltemplate)\b/.test(textAfter)) return 0; + if (/^\{(\/|(fallbackmsg|elseif|else|ifempty)\b)/.test(textAfter)) indent -= config.indentUnit; + if (state.tag != "switch" && /^\{(case|default)\b/.test(textAfter)) indent -= config.indentUnit; + if (/^\{\/switch\b/.test(textAfter)) indent -= config.indentUnit; + } + if (indent && state.localMode.indent) + indent += state.localMode.indent(state.localState, textAfter); + return indent; + }, + + innerMode: function (state) { + if (state.soyState.length && last(state.soyState) != "literal") return null; + else return {state: state.localState, mode: state.localMode}; + }, + + electricInput: /^\s*\{(\/|\/template|\/deltemplate|\/switch|fallbackmsg|elseif|else|case|default|ifempty|\/literal\})$/, + lineComment: "//", + blockCommentStart: "/*", + blockCommentEnd: "*/", + blockCommentContinue: " * ", + fold: "indent" + }; + }, "htmlmixed"); - indent: function(state, textAfter) { - var indent = state.indent, top = last(state.soyState); - if (top == "comment") return CodeMirror.Pass; + CodeMirror.registerHelper("hintWords", "soy", indentingTags.concat( + ["delpackage", "namespace", "alias", "print", "css", "debugger"])); - if (top == "literal") { - if (/^\{\/literal}/.test(textAfter)) indent -= config.indentUnit; - } else { - if (/^\s*\{\/(template|deltemplate)\b/.test(textAfter)) return 0; - if (/^\{(\/|(fallbackmsg|elseif|else|ifempty)\b)/.test(textAfter)) indent -= config.indentUnit; - if (state.tag != "switch" && /^\{(case|default)\b/.test(textAfter)) indent -= config.indentUnit; - if (/^\{\/switch\b/.test(textAfter)) indent -= config.indentUnit; - } - if (indent && state.localMode.indent) - indent += state.localMode.indent(state.localState, textAfter); - return indent; - }, - - innerMode: function(state) { - if (state.soyState.length && last(state.soyState) != "literal") return null; - else return {state: state.localState, mode: state.localMode}; - }, - - electricInput: /^\s*\{(\/|\/template|\/deltemplate|\/switch|fallbackmsg|elseif|else|case|default|ifempty|\/literal\})$/, - lineComment: "//", - blockCommentStart: "/*", - blockCommentEnd: "*/", - blockCommentContinue: " * ", - fold: "indent" - }; - }, "htmlmixed"); - - CodeMirror.registerHelper("hintWords", "soy", indentingTags.concat( - ["delpackage", "namespace", "alias", "print", "css", "debugger"])); - - CodeMirror.defineMIME("text/x-soy", "soy"); + CodeMirror.defineMIME("text/x-soy", "soy"); }); diff --git a/web/editor.md/lib/codemirror/mode/sparql/index.html b/web/editor.md/lib/codemirror/mode/sparql/index.html index 84ef4d3..4f2d417 100644 --- a/web/editor.md/lib/codemirror/mode/sparql/index.html +++ b/web/editor.md/lib/codemirror/mode/sparql/index.html @@ -2,30 +2,33 @@ CodeMirror: SPARQL mode - + - + - +
-

SPARQL mode

-

MIME types defined: application/sparql-query.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/sparql/sparql.js b/web/editor.md/lib/codemirror/mode/sparql/sparql.js index bbf8a76..675e54d 100644 --- a/web/editor.md/lib/codemirror/mode/sparql/sparql.js +++ b/web/editor.md/lib/codemirror/mode/sparql/sparql.js @@ -1,174 +1,169 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("sparql", function(config) { - var indentUnit = config.indentUnit; - var curPunc; - - function wordRegexp(words) { - return new RegExp("^(?:" + words.join("|") + ")$", "i"); - } - var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri", - "iri", "uri", "bnode", "count", "sum", "min", "max", "avg", "sample", - "group_concat", "rand", "abs", "ceil", "floor", "round", "concat", "substr", "strlen", - "replace", "ucase", "lcase", "encode_for_uri", "contains", "strstarts", "strends", - "strbefore", "strafter", "year", "month", "day", "hours", "minutes", "seconds", - "timezone", "tz", "now", "uuid", "struuid", "md5", "sha1", "sha256", "sha384", - "sha512", "coalesce", "if", "strlang", "strdt", "isnumeric", "regex", "exists", - "isblank", "isliteral", "a"]); - var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe", - "ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional", - "graph", "by", "asc", "desc", "as", "having", "undef", "values", "group", - "minus", "in", "not", "service", "silent", "using", "insert", "delete", "union", - "true", "false", "with", - "data", "copy", "to", "move", "add", "create", "drop", "clear", "load"]); - var operatorChars = /[*+\-<>=&|\^\/!\?]/; - - function tokenBase(stream, state) { - var ch = stream.next(); - curPunc = null; - if (ch == "$" || ch == "?") { - if(ch == "?" && stream.match(/\s/, false)){ - return "operator"; - } - stream.match(/^[\w\d]*/); - return "variable-2"; - } - else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) { - stream.match(/^[^\s\u00a0>]*>?/); - return "atom"; - } - else if (ch == "\"" || ch == "'") { - state.tokenize = tokenLiteral(ch); - return state.tokenize(stream, state); - } - else if (/[{}\(\),\.;\[\]]/.test(ch)) { - curPunc = ch; - return "bracket"; - } - else if (ch == "#") { - stream.skipToEnd(); - return "comment"; - } - else if (operatorChars.test(ch)) { - stream.eatWhile(operatorChars); - return "operator"; - } - else if (ch == ":") { - stream.eatWhile(/[\w\d\._\-]/); - return "atom"; - } - else if (ch == "@") { - stream.eatWhile(/[a-z\d\-]/i); - return "meta"; - } - else { - stream.eatWhile(/[_\w\d]/); - if (stream.eat(":")) { - stream.eatWhile(/[\w\d_\-]/); - return "atom"; - } - var word = stream.current(); - if (ops.test(word)) - return "builtin"; - else if (keywords.test(word)) - return "keyword"; - else - return "variable"; - } - } - - function tokenLiteral(quote) { - return function(stream, state) { - var escaped = false, ch; - while ((ch = stream.next()) != null) { - if (ch == quote && !escaped) { - state.tokenize = tokenBase; - break; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("sparql", function (config) { + var indentUnit = config.indentUnit; + var curPunc; + + function wordRegexp(words) { + return new RegExp("^(?:" + words.join("|") + ")$", "i"); } - escaped = !escaped && ch == "\\"; - } - return "string"; - }; - } - - function pushContext(state, type, col) { - state.context = {prev: state.context, indent: state.indent, col: col, type: type}; - } - function popContext(state) { - state.indent = state.context.indent; - state.context = state.context.prev; - } - - return { - startState: function() { - return {tokenize: tokenBase, - context: null, - indent: 0, - col: 0}; - }, - - token: function(stream, state) { - if (stream.sol()) { - if (state.context && state.context.align == null) state.context.align = false; - state.indent = stream.indentation(); - } - if (stream.eatSpace()) return null; - var style = state.tokenize(stream, state); - - if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") { - state.context.align = true; - } - - if (curPunc == "(") pushContext(state, ")", stream.column()); - else if (curPunc == "[") pushContext(state, "]", stream.column()); - else if (curPunc == "{") pushContext(state, "}", stream.column()); - else if (/[\]\}\)]/.test(curPunc)) { - while (state.context && state.context.type == "pattern") popContext(state); - if (state.context && curPunc == state.context.type) popContext(state); - } - else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state); - else if (/atom|string|variable/.test(style) && state.context) { - if (/[\}\]]/.test(state.context.type)) - pushContext(state, "pattern", stream.column()); - else if (state.context.type == "pattern" && !state.context.align) { - state.context.align = true; - state.context.col = stream.column(); + + var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri", + "iri", "uri", "bnode", "count", "sum", "min", "max", "avg", "sample", + "group_concat", "rand", "abs", "ceil", "floor", "round", "concat", "substr", "strlen", + "replace", "ucase", "lcase", "encode_for_uri", "contains", "strstarts", "strends", + "strbefore", "strafter", "year", "month", "day", "hours", "minutes", "seconds", + "timezone", "tz", "now", "uuid", "struuid", "md5", "sha1", "sha256", "sha384", + "sha512", "coalesce", "if", "strlang", "strdt", "isnumeric", "regex", "exists", + "isblank", "isliteral", "a"]); + var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe", + "ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional", + "graph", "by", "asc", "desc", "as", "having", "undef", "values", "group", + "minus", "in", "not", "service", "silent", "using", "insert", "delete", "union", + "true", "false", "with", + "data", "copy", "to", "move", "add", "create", "drop", "clear", "load"]); + var operatorChars = /[*+\-<>=&|\^\/!\?]/; + + function tokenBase(stream, state) { + var ch = stream.next(); + curPunc = null; + if (ch == "$" || ch == "?") { + if (ch == "?" && stream.match(/\s/, false)) { + return "operator"; + } + stream.match(/^[\w\d]*/); + return "variable-2"; + } else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) { + stream.match(/^[^\s\u00a0>]*>?/); + return "atom"; + } else if (ch == "\"" || ch == "'") { + state.tokenize = tokenLiteral(ch); + return state.tokenize(stream, state); + } else if (/[{}\(\),\.;\[\]]/.test(ch)) { + curPunc = ch; + return "bracket"; + } else if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } else if (operatorChars.test(ch)) { + stream.eatWhile(operatorChars); + return "operator"; + } else if (ch == ":") { + stream.eatWhile(/[\w\d\._\-]/); + return "atom"; + } else if (ch == "@") { + stream.eatWhile(/[a-z\d\-]/i); + return "meta"; + } else { + stream.eatWhile(/[_\w\d]/); + if (stream.eat(":")) { + stream.eatWhile(/[\w\d_\-]/); + return "atom"; + } + var word = stream.current(); + if (ops.test(word)) + return "builtin"; + else if (keywords.test(word)) + return "keyword"; + else + return "variable"; + } } - } - - return style; - }, - - indent: function(state, textAfter) { - var firstChar = textAfter && textAfter.charAt(0); - var context = state.context; - if (/[\]\}]/.test(firstChar)) - while (context && context.type == "pattern") context = context.prev; - - var closing = context && firstChar == context.type; - if (!context) - return 0; - else if (context.type == "pattern") - return context.col; - else if (context.align) - return context.col + (closing ? 0 : 1); - else - return context.indent + (closing ? 0 : indentUnit); - } - }; -}); -CodeMirror.defineMIME("application/sparql-query", "sparql"); + function tokenLiteral(quote) { + return function (stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) { + state.tokenize = tokenBase; + break; + } + escaped = !escaped && ch == "\\"; + } + return "string"; + }; + } + + function pushContext(state, type, col) { + state.context = {prev: state.context, indent: state.indent, col: col, type: type}; + } + + function popContext(state) { + state.indent = state.context.indent; + state.context = state.context.prev; + } + + return { + startState: function () { + return { + tokenize: tokenBase, + context: null, + indent: 0, + col: 0 + }; + }, + + token: function (stream, state) { + if (stream.sol()) { + if (state.context && state.context.align == null) state.context.align = false; + state.indent = stream.indentation(); + } + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + + if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") { + state.context.align = true; + } + + if (curPunc == "(") pushContext(state, ")", stream.column()); + else if (curPunc == "[") pushContext(state, "]", stream.column()); + else if (curPunc == "{") pushContext(state, "}", stream.column()); + else if (/[\]\}\)]/.test(curPunc)) { + while (state.context && state.context.type == "pattern") popContext(state); + if (state.context && curPunc == state.context.type) popContext(state); + } else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state); + else if (/atom|string|variable/.test(style) && state.context) { + if (/[\}\]]/.test(state.context.type)) + pushContext(state, "pattern", stream.column()); + else if (state.context.type == "pattern" && !state.context.align) { + state.context.align = true; + state.context.col = stream.column(); + } + } + + return style; + }, + + indent: function (state, textAfter) { + var firstChar = textAfter && textAfter.charAt(0); + var context = state.context; + if (/[\]\}]/.test(firstChar)) + while (context && context.type == "pattern") context = context.prev; + + var closing = context && firstChar == context.type; + if (!context) + return 0; + else if (context.type == "pattern") + return context.col; + else if (context.align) + return context.col + (closing ? 0 : 1); + else + return context.indent + (closing ? 0 : indentUnit); + } + }; + }); + + CodeMirror.defineMIME("application/sparql-query", "sparql"); }); diff --git a/web/editor.md/lib/codemirror/mode/spreadsheet/index.html b/web/editor.md/lib/codemirror/mode/spreadsheet/index.html index a52f76f..39ab041 100644 --- a/web/editor.md/lib/codemirror/mode/spreadsheet/index.html +++ b/web/editor.md/lib/codemirror/mode/spreadsheet/index.html @@ -2,41 +2,44 @@ CodeMirror: Spreadsheet mode - + - + - +
-

Spreadsheet mode

-
+

Spreadsheet mode

+
- + -

MIME types defined: text/x-spreadsheet.

- -

The Spreadsheet Mode

-

Created by Robert Plummer

+

MIME types defined: text/x-spreadsheet.

+ +

The Spreadsheet Mode

+

Created by Robert Plummer

diff --git a/web/editor.md/lib/codemirror/mode/spreadsheet/spreadsheet.js b/web/editor.md/lib/codemirror/mode/spreadsheet/spreadsheet.js index 6fab00f..defe199 100644 --- a/web/editor.md/lib/codemirror/mode/spreadsheet/spreadsheet.js +++ b/web/editor.md/lib/codemirror/mode/spreadsheet/spreadsheet.js @@ -1,109 +1,109 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; - CodeMirror.defineMode("spreadsheet", function () { - return { - startState: function () { + CodeMirror.defineMode("spreadsheet", function () { return { - stringType: null, - stack: [] - }; - }, - token: function (stream, state) { - if (!stream) return; + startState: function () { + return { + stringType: null, + stack: [] + }; + }, + token: function (stream, state) { + if (!stream) return; - //check for state changes - if (state.stack.length === 0) { - //strings - if ((stream.peek() == '"') || (stream.peek() == "'")) { - state.stringType = stream.peek(); - stream.next(); // Skip quote - state.stack.unshift("string"); - } - } + //check for state changes + if (state.stack.length === 0) { + //strings + if ((stream.peek() == '"') || (stream.peek() == "'")) { + state.stringType = stream.peek(); + stream.next(); // Skip quote + state.stack.unshift("string"); + } + } - //return state - //stack has - switch (state.stack[0]) { - case "string": - while (state.stack[0] === "string" && !stream.eol()) { - if (stream.peek() === state.stringType) { - stream.next(); // Skip quote - state.stack.shift(); // Clear flag - } else if (stream.peek() === "\\") { - stream.next(); - stream.next(); - } else { - stream.match(/^.[^\\\"\']*/); - } - } - return "string"; + //return state + //stack has + switch (state.stack[0]) { + case "string": + while (state.stack[0] === "string" && !stream.eol()) { + if (stream.peek() === state.stringType) { + stream.next(); // Skip quote + state.stack.shift(); // Clear flag + } else if (stream.peek() === "\\") { + stream.next(); + stream.next(); + } else { + stream.match(/^.[^\\\"\']*/); + } + } + return "string"; - case "characterClass": - while (state.stack[0] === "characterClass" && !stream.eol()) { - if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./))) - state.stack.shift(); - } - return "operator"; - } + case "characterClass": + while (state.stack[0] === "characterClass" && !stream.eol()) { + if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./))) + state.stack.shift(); + } + return "operator"; + } - var peek = stream.peek(); + var peek = stream.peek(); - //no stack - switch (peek) { - case "[": - stream.next(); - state.stack.unshift("characterClass"); - return "bracket"; - case ":": - stream.next(); - return "operator"; - case "\\": - if (stream.match(/\\[a-z]+/)) return "string-2"; - else return null; - case ".": - case ",": - case ";": - case "*": - case "-": - case "+": - case "^": - case "<": - case "/": - case "=": - stream.next(); - return "atom"; - case "$": - stream.next(); - return "builtin"; - } + //no stack + switch (peek) { + case "[": + stream.next(); + state.stack.unshift("characterClass"); + return "bracket"; + case ":": + stream.next(); + return "operator"; + case "\\": + if (stream.match(/\\[a-z]+/)) return "string-2"; + else return null; + case ".": + case ",": + case ";": + case "*": + case "-": + case "+": + case "^": + case "<": + case "/": + case "=": + stream.next(); + return "atom"; + case "$": + stream.next(); + return "builtin"; + } - if (stream.match(/\d+/)) { - if (stream.match(/^\w+/)) return "error"; - return "number"; - } else if (stream.match(/^[a-zA-Z_]\w*/)) { - if (stream.match(/(?=[\(.])/, false)) return "keyword"; - return "variable-2"; - } else if (["[", "]", "(", ")", "{", "}"].indexOf(peek) != -1) { - stream.next(); - return "bracket"; - } else if (!stream.eatSpace()) { - stream.next(); - } - return null; - } - }; - }); + if (stream.match(/\d+/)) { + if (stream.match(/^\w+/)) return "error"; + return "number"; + } else if (stream.match(/^[a-zA-Z_]\w*/)) { + if (stream.match(/(?=[\(.])/, false)) return "keyword"; + return "variable-2"; + } else if (["[", "]", "(", ")", "{", "}"].indexOf(peek) != -1) { + stream.next(); + return "bracket"; + } else if (!stream.eatSpace()) { + stream.next(); + } + return null; + } + }; + }); - CodeMirror.defineMIME("text/x-spreadsheet", "spreadsheet"); + CodeMirror.defineMIME("text/x-spreadsheet", "spreadsheet"); }); diff --git a/web/editor.md/lib/codemirror/mode/sql/index.html b/web/editor.md/lib/codemirror/mode/sql/index.html index a0d8d9e..c64a3a6 100644 --- a/web/editor.md/lib/codemirror/mode/sql/index.html +++ b/web/editor.md/lib/codemirror/mode/sql/index.html @@ -2,37 +2,37 @@ CodeMirror: SQL Mode for CodeMirror - + - + - + + .CodeMirror { + border-top: 1px solid black; + border-bottom: 1px solid black; + } +
-

SQL Mode for CodeMirror

-
+

SQL Mode for CodeMirror

+ -
-

MIME types defined: - text/x-sql, - text/x-mysql, - text/x-mariadb, - text/x-cassandra, - text/x-plsql, - text/x-mssql, - text/x-hive. -

- + +

MIME types defined: + text/x-sql, + text/x-mysql, + text/x-mariadb, + text/x-cassandra, + text/x-plsql, + text/x-mssql, + text/x-hive. +

+
diff --git a/web/editor.md/lib/codemirror/mode/sql/sql.js b/web/editor.md/lib/codemirror/mode/sql/sql.js index ee6c194..61d64b6 100644 --- a/web/editor.md/lib/codemirror/mode/sql/sql.js +++ b/web/editor.md/lib/codemirror/mode/sql/sql.js @@ -1,363 +1,364 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("sql", function(config, parserConfig) { - "use strict"; - - var client = parserConfig.client || {}, - atoms = parserConfig.atoms || {"false": true, "true": true, "null": true}, - builtin = parserConfig.builtin || {}, - keywords = parserConfig.keywords || {}, - operatorChars = parserConfig.operatorChars || /^[*+\-%<>!=&|~^]/, - support = parserConfig.support || {}, - hooks = parserConfig.hooks || {}, - dateSQL = parserConfig.dateSQL || {"date" : true, "time" : true, "timestamp" : true}; - - function tokenBase(stream, state) { - var ch = stream.next(); - - // call hooks from the mime type - if (hooks[ch]) { - var result = hooks[ch](stream, state); - if (result !== false) return result; - } - - if (support.hexNumber == true && - ((ch == "0" && stream.match(/^[xX][0-9a-fA-F]+/)) - || (ch == "x" || ch == "X") && stream.match(/^'[0-9a-fA-F]+'/))) { - // hex - // ref: http://dev.mysql.com/doc/refman/5.5/en/hexadecimal-literals.html - return "number"; - } else if (support.binaryNumber == true && - (((ch == "b" || ch == "B") && stream.match(/^'[01]+'/)) - || (ch == "0" && stream.match(/^b[01]+/)))) { - // bitstring - // ref: http://dev.mysql.com/doc/refman/5.5/en/bit-field-literals.html - return "number"; - } else if (ch.charCodeAt(0) > 47 && ch.charCodeAt(0) < 58) { - // numbers - // ref: http://dev.mysql.com/doc/refman/5.5/en/number-literals.html - stream.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/); - support.decimallessFloat == true && stream.eat('.'); - return "number"; - } else if (ch == "?" && (stream.eatSpace() || stream.eol() || stream.eat(";"))) { - // placeholders - return "variable-3"; - } else if (ch == "'" || (ch == '"' && support.doubleQuote)) { - // strings - // ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html - state.tokenize = tokenLiteral(ch); - return state.tokenize(stream, state); - } else if ((((support.nCharCast == true && (ch == "n" || ch == "N")) - || (support.charsetCast == true && ch == "_" && stream.match(/[a-z][a-z0-9]*/i))) - && (stream.peek() == "'" || stream.peek() == '"'))) { - // charset casting: _utf8'str', N'str', n'str' - // ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html - return "keyword"; - } else if (/^[\(\),\;\[\]]/.test(ch)) { - // no highlightning - return null; - } else if (support.commentSlashSlash && ch == "/" && stream.eat("/")) { - // 1-line comment - stream.skipToEnd(); - return "comment"; - } else if ((support.commentHash && ch == "#") - || (ch == "-" && stream.eat("-") && (!support.commentSpaceRequired || stream.eat(" ")))) { - // 1-line comments - // ref: https://kb.askmonty.org/en/comment-syntax/ - stream.skipToEnd(); - return "comment"; - } else if (ch == "/" && stream.eat("*")) { - // multi-line comments - // ref: https://kb.askmonty.org/en/comment-syntax/ - state.tokenize = tokenComment; - return state.tokenize(stream, state); - } else if (ch == ".") { - // .1 for 0.1 - if (support.zerolessFloat == true && stream.match(/^(?:\d+(?:e[+-]?\d+)?)/i)) { - return "number"; - } - // .table_name (ODBC) - // // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html - if (support.ODBCdotTable == true && stream.match(/^[a-zA-Z_]+/)) { - return "variable-2"; - } - } else if (operatorChars.test(ch)) { - // operators - stream.eatWhile(operatorChars); - return null; - } else if (ch == '{' && - (stream.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/) || stream.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/))) { - // dates (weird ODBC syntax) - // ref: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html - return "number"; - } else { - stream.eatWhile(/^[_\w\d]/); - var word = stream.current().toLowerCase(); - // dates (standard SQL syntax) - // ref: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html - if (dateSQL.hasOwnProperty(word) && (stream.match(/^( )+'[^']*'/) || stream.match(/^( )+"[^"]*"/))) - return "number"; - if (atoms.hasOwnProperty(word)) return "atom"; - if (builtin.hasOwnProperty(word)) return "builtin"; - if (keywords.hasOwnProperty(word)) return "keyword"; - if (client.hasOwnProperty(word)) return "string-2"; - return null; - } - } - - // 'string', with char specified in quote escaped by '\' - function tokenLiteral(quote) { - return function(stream, state) { - var escaped = false, ch; - while ((ch = stream.next()) != null) { - if (ch == quote && !escaped) { - state.tokenize = tokenBase; - break; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("sql", function (config, parserConfig) { + "use strict"; + + var client = parserConfig.client || {}, + atoms = parserConfig.atoms || {"false": true, "true": true, "null": true}, + builtin = parserConfig.builtin || {}, + keywords = parserConfig.keywords || {}, + operatorChars = parserConfig.operatorChars || /^[*+\-%<>!=&|~^]/, + support = parserConfig.support || {}, + hooks = parserConfig.hooks || {}, + dateSQL = parserConfig.dateSQL || {"date": true, "time": true, "timestamp": true}; + + function tokenBase(stream, state) { + var ch = stream.next(); + + // call hooks from the mime type + if (hooks[ch]) { + var result = hooks[ch](stream, state); + if (result !== false) return result; + } + + if (support.hexNumber == true && + ((ch == "0" && stream.match(/^[xX][0-9a-fA-F]+/)) + || (ch == "x" || ch == "X") && stream.match(/^'[0-9a-fA-F]+'/))) { + // hex + // ref: http://dev.mysql.com/doc/refman/5.5/en/hexadecimal-literals.html + return "number"; + } else if (support.binaryNumber == true && + (((ch == "b" || ch == "B") && stream.match(/^'[01]+'/)) + || (ch == "0" && stream.match(/^b[01]+/)))) { + // bitstring + // ref: http://dev.mysql.com/doc/refman/5.5/en/bit-field-literals.html + return "number"; + } else if (ch.charCodeAt(0) > 47 && ch.charCodeAt(0) < 58) { + // numbers + // ref: http://dev.mysql.com/doc/refman/5.5/en/number-literals.html + stream.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/); + support.decimallessFloat == true && stream.eat('.'); + return "number"; + } else if (ch == "?" && (stream.eatSpace() || stream.eol() || stream.eat(";"))) { + // placeholders + return "variable-3"; + } else if (ch == "'" || (ch == '"' && support.doubleQuote)) { + // strings + // ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html + state.tokenize = tokenLiteral(ch); + return state.tokenize(stream, state); + } else if ((((support.nCharCast == true && (ch == "n" || ch == "N")) + || (support.charsetCast == true && ch == "_" && stream.match(/[a-z][a-z0-9]*/i))) + && (stream.peek() == "'" || stream.peek() == '"'))) { + // charset casting: _utf8'str', N'str', n'str' + // ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html + return "keyword"; + } else if (/^[\(\),\;\[\]]/.test(ch)) { + // no highlightning + return null; + } else if (support.commentSlashSlash && ch == "/" && stream.eat("/")) { + // 1-line comment + stream.skipToEnd(); + return "comment"; + } else if ((support.commentHash && ch == "#") + || (ch == "-" && stream.eat("-") && (!support.commentSpaceRequired || stream.eat(" ")))) { + // 1-line comments + // ref: https://kb.askmonty.org/en/comment-syntax/ + stream.skipToEnd(); + return "comment"; + } else if (ch == "/" && stream.eat("*")) { + // multi-line comments + // ref: https://kb.askmonty.org/en/comment-syntax/ + state.tokenize = tokenComment; + return state.tokenize(stream, state); + } else if (ch == ".") { + // .1 for 0.1 + if (support.zerolessFloat == true && stream.match(/^(?:\d+(?:e[+-]?\d+)?)/i)) { + return "number"; + } + // .table_name (ODBC) + // // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html + if (support.ODBCdotTable == true && stream.match(/^[a-zA-Z_]+/)) { + return "variable-2"; + } + } else if (operatorChars.test(ch)) { + // operators + stream.eatWhile(operatorChars); + return null; + } else if (ch == '{' && + (stream.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/) || stream.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/))) { + // dates (weird ODBC syntax) + // ref: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html + return "number"; + } else { + stream.eatWhile(/^[_\w\d]/); + var word = stream.current().toLowerCase(); + // dates (standard SQL syntax) + // ref: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html + if (dateSQL.hasOwnProperty(word) && (stream.match(/^( )+'[^']*'/) || stream.match(/^( )+"[^"]*"/))) + return "number"; + if (atoms.hasOwnProperty(word)) return "atom"; + if (builtin.hasOwnProperty(word)) return "builtin"; + if (keywords.hasOwnProperty(word)) return "keyword"; + if (client.hasOwnProperty(word)) return "string-2"; + return null; + } } - escaped = !escaped && ch == "\\"; - } - return "string"; - }; - } - function tokenComment(stream, state) { - while (true) { - if (stream.skipTo("*")) { - stream.next(); - if (stream.eat("/")) { - state.tokenize = tokenBase; - break; + + // 'string', with char specified in quote escaped by '\' + function tokenLiteral(quote) { + return function (stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) { + state.tokenize = tokenBase; + break; + } + escaped = !escaped && ch == "\\"; + } + return "string"; + }; + } + + function tokenComment(stream, state) { + while (true) { + if (stream.skipTo("*")) { + stream.next(); + if (stream.eat("/")) { + state.tokenize = tokenBase; + break; + } + } else { + stream.skipToEnd(); + break; + } + } + return "comment"; + } + + function pushContext(stream, state, type) { + state.context = { + prev: state.context, + indent: stream.indentation(), + col: stream.column(), + type: type + }; + } + + function popContext(state) { + state.indent = state.context.indent; + state.context = state.context.prev; + } + + return { + startState: function () { + return {tokenize: tokenBase, context: null}; + }, + + token: function (stream, state) { + if (stream.sol()) { + if (state.context && state.context.align == null) + state.context.align = false; + } + if (stream.eatSpace()) return null; + + var style = state.tokenize(stream, state); + if (style == "comment") return style; + + if (state.context && state.context.align == null) + state.context.align = true; + + var tok = stream.current(); + if (tok == "(") + pushContext(stream, state, ")"); + else if (tok == "[") + pushContext(stream, state, "]"); + else if (state.context && state.context.type == tok) + popContext(state); + return style; + }, + + indent: function (state, textAfter) { + var cx = state.context; + if (!cx) return CodeMirror.Pass; + var closing = textAfter.charAt(0) == cx.type; + if (cx.align) return cx.col + (closing ? 0 : 1); + else return cx.indent + (closing ? 0 : config.indentUnit); + }, + + blockCommentStart: "/*", + blockCommentEnd: "*/", + lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : null + }; + }); + + (function () { + "use strict"; + + // `identifier` + function hookIdentifier(stream) { + // MySQL/MariaDB identifiers + // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html + var ch; + while ((ch = stream.next()) != null) { + if (ch == "`" && !stream.eat("`")) return "variable-2"; + } + stream.backUp(stream.current().length - 1); + return stream.eatWhile(/\w/) ? "variable-2" : null; + } + + // variable token + function hookVar(stream) { + // variables + // @@prefix.varName @varName + // varName can be quoted with ` or ' or " + // ref: http://dev.mysql.com/doc/refman/5.5/en/user-variables.html + if (stream.eat("@")) { + stream.match(/^session\./); + stream.match(/^local\./); + stream.match(/^global\./); + } + + if (stream.eat("'")) { + stream.match(/^.*'/); + return "variable-2"; + } else if (stream.eat('"')) { + stream.match(/^.*"/); + return "variable-2"; + } else if (stream.eat("`")) { + stream.match(/^.*`/); + return "variable-2"; + } else if (stream.match(/^[0-9a-zA-Z$\.\_]+/)) { + return "variable-2"; + } + return null; + }; + + // short client keyword token + function hookClient(stream) { + // \N means NULL + // ref: http://dev.mysql.com/doc/refman/5.5/en/null-values.html + if (stream.eat("N")) { + return "atom"; + } + // \g, etc + // ref: http://dev.mysql.com/doc/refman/5.5/en/mysql-commands.html + return stream.match(/^[a-zA-Z.#!?]/) ? "variable-2" : null; + } + + // these keywords are used by all SQL dialects (however, a mode can still overwrite it) + var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where "; + + // turn a space-separated list into an array + function set(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; } - } else { - stream.skipToEnd(); - break; - } - } - return "comment"; - } - - function pushContext(stream, state, type) { - state.context = { - prev: state.context, - indent: stream.indentation(), - col: stream.column(), - type: type - }; - } - - function popContext(state) { - state.indent = state.context.indent; - state.context = state.context.prev; - } - - return { - startState: function() { - return {tokenize: tokenBase, context: null}; - }, - - token: function(stream, state) { - if (stream.sol()) { - if (state.context && state.context.align == null) - state.context.align = false; - } - if (stream.eatSpace()) return null; - - var style = state.tokenize(stream, state); - if (style == "comment") return style; - - if (state.context && state.context.align == null) - state.context.align = true; - - var tok = stream.current(); - if (tok == "(") - pushContext(stream, state, ")"); - else if (tok == "[") - pushContext(stream, state, "]"); - else if (state.context && state.context.type == tok) - popContext(state); - return style; - }, - - indent: function(state, textAfter) { - var cx = state.context; - if (!cx) return CodeMirror.Pass; - var closing = textAfter.charAt(0) == cx.type; - if (cx.align) return cx.col + (closing ? 0 : 1); - else return cx.indent + (closing ? 0 : config.indentUnit); - }, - - blockCommentStart: "/*", - blockCommentEnd: "*/", - lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : null - }; -}); -(function() { - "use strict"; - - // `identifier` - function hookIdentifier(stream) { - // MySQL/MariaDB identifiers - // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html - var ch; - while ((ch = stream.next()) != null) { - if (ch == "`" && !stream.eat("`")) return "variable-2"; - } - stream.backUp(stream.current().length - 1); - return stream.eatWhile(/\w/) ? "variable-2" : null; - } - - // variable token - function hookVar(stream) { - // variables - // @@prefix.varName @varName - // varName can be quoted with ` or ' or " - // ref: http://dev.mysql.com/doc/refman/5.5/en/user-variables.html - if (stream.eat("@")) { - stream.match(/^session\./); - stream.match(/^local\./); - stream.match(/^global\./); - } - - if (stream.eat("'")) { - stream.match(/^.*'/); - return "variable-2"; - } else if (stream.eat('"')) { - stream.match(/^.*"/); - return "variable-2"; - } else if (stream.eat("`")) { - stream.match(/^.*`/); - return "variable-2"; - } else if (stream.match(/^[0-9a-zA-Z$\.\_]+/)) { - return "variable-2"; - } - return null; - }; - - // short client keyword token - function hookClient(stream) { - // \N means NULL - // ref: http://dev.mysql.com/doc/refman/5.5/en/null-values.html - if (stream.eat("N")) { - return "atom"; - } - // \g, etc - // ref: http://dev.mysql.com/doc/refman/5.5/en/mysql-commands.html - return stream.match(/^[a-zA-Z.#!?]/) ? "variable-2" : null; - } - - // these keywords are used by all SQL dialects (however, a mode can still overwrite it) - var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where "; - - // turn a space-separated list into an array - function set(str) { - var obj = {}, words = str.split(" "); - for (var i = 0; i < words.length; ++i) obj[words[i]] = true; - return obj; - } - - // A generic SQL Mode. It's not a standard, it just try to support what is generally supported - CodeMirror.defineMIME("text/x-sql", { - name: "sql", - keywords: set(sqlKeywords + "begin"), - builtin: set("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"), - atoms: set("false true null unknown"), - operatorChars: /^[*+\-%<>!=]/, - dateSQL: set("date time timestamp"), - support: set("ODBCdotTable doubleQuote binaryNumber hexNumber") - }); - - CodeMirror.defineMIME("text/x-mssql", { - name: "sql", - client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), - keywords: set(sqlKeywords + "begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered"), - builtin: set("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "), - atoms: set("false true null unknown"), - operatorChars: /^[*+\-%<>!=]/, - dateSQL: set("date datetimeoffset datetime2 smalldatetime datetime time"), - hooks: { - "@": hookVar - } - }); - - CodeMirror.defineMIME("text/x-mysql", { - name: "sql", - client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), - keywords: set(sqlKeywords + "accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"), - builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"), - atoms: set("false true null unknown"), - operatorChars: /^[*+\-%<>!=&|^]/, - dateSQL: set("date time timestamp"), - support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"), - hooks: { - "@": hookVar, - "`": hookIdentifier, - "\\": hookClient - } - }); - - CodeMirror.defineMIME("text/x-mariadb", { - name: "sql", - client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), - keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"), - builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"), - atoms: set("false true null unknown"), - operatorChars: /^[*+\-%<>!=&|^]/, - dateSQL: set("date time timestamp"), - support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"), - hooks: { - "@": hookVar, - "`": hookIdentifier, - "\\": hookClient - } - }); - - // the query language used by Apache Cassandra is called CQL, but this mime type - // is called Cassandra to avoid confusion with Contextual Query Language - CodeMirror.defineMIME("text/x-cassandra", { - name: "sql", - client: { }, - keywords: set("use select from using consistency where limit first reversed first and in insert into values using consistency ttl update set delete truncate begin batch apply create keyspace with columnfamily primary key index on drop alter type add any one quorum all local_quorum each_quorum"), - builtin: set("ascii bigint blob boolean counter decimal double float int text timestamp uuid varchar varint"), - atoms: set("false true"), - operatorChars: /^[<>=]/, - dateSQL: { }, - support: set("commentSlashSlash decimallessFloat"), - hooks: { } - }); - - // this is based on Peter Raganitsch's 'plsql' mode - CodeMirror.defineMIME("text/x-plsql", { - name: "sql", - client: set("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"), - keywords: set("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"), - builtin: set("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"), - operatorChars: /^[*+\-%<>!=~]/, - dateSQL: set("date time timestamp"), - support: set("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber") - }); - - // Created to support specific hive keywords - CodeMirror.defineMIME("text/x-hive", { - name: "sql", - keywords: set("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"), - builtin: set("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"), - atoms: set("false true null unknown"), - operatorChars: /^[*+\-%<>!=]/, - dateSQL: set("date timestamp"), - support: set("ODBCdotTable doubleQuote binaryNumber hexNumber") - }); -}()); + // A generic SQL Mode. It's not a standard, it just try to support what is generally supported + CodeMirror.defineMIME("text/x-sql", { + name: "sql", + keywords: set(sqlKeywords + "begin"), + builtin: set("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"), + atoms: set("false true null unknown"), + operatorChars: /^[*+\-%<>!=]/, + dateSQL: set("date time timestamp"), + support: set("ODBCdotTable doubleQuote binaryNumber hexNumber") + }); + + CodeMirror.defineMIME("text/x-mssql", { + name: "sql", + client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), + keywords: set(sqlKeywords + "begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered"), + builtin: set("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "), + atoms: set("false true null unknown"), + operatorChars: /^[*+\-%<>!=]/, + dateSQL: set("date datetimeoffset datetime2 smalldatetime datetime time"), + hooks: { + "@": hookVar + } + }); + + CodeMirror.defineMIME("text/x-mysql", { + name: "sql", + client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), + keywords: set(sqlKeywords + "accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"), + builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"), + atoms: set("false true null unknown"), + operatorChars: /^[*+\-%<>!=&|^]/, + dateSQL: set("date time timestamp"), + support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"), + hooks: { + "@": hookVar, + "`": hookIdentifier, + "\\": hookClient + } + }); + + CodeMirror.defineMIME("text/x-mariadb", { + name: "sql", + client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), + keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"), + builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"), + atoms: set("false true null unknown"), + operatorChars: /^[*+\-%<>!=&|^]/, + dateSQL: set("date time timestamp"), + support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"), + hooks: { + "@": hookVar, + "`": hookIdentifier, + "\\": hookClient + } + }); + + // the query language used by Apache Cassandra is called CQL, but this mime type + // is called Cassandra to avoid confusion with Contextual Query Language + CodeMirror.defineMIME("text/x-cassandra", { + name: "sql", + client: {}, + keywords: set("use select from using consistency where limit first reversed first and in insert into values using consistency ttl update set delete truncate begin batch apply create keyspace with columnfamily primary key index on drop alter type add any one quorum all local_quorum each_quorum"), + builtin: set("ascii bigint blob boolean counter decimal double float int text timestamp uuid varchar varint"), + atoms: set("false true"), + operatorChars: /^[<>=]/, + dateSQL: {}, + support: set("commentSlashSlash decimallessFloat"), + hooks: {} + }); + + // this is based on Peter Raganitsch's 'plsql' mode + CodeMirror.defineMIME("text/x-plsql", { + name: "sql", + client: set("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"), + keywords: set("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"), + builtin: set("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"), + operatorChars: /^[*+\-%<>!=~]/, + dateSQL: set("date time timestamp"), + support: set("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber") + }); + + // Created to support specific hive keywords + CodeMirror.defineMIME("text/x-hive", { + name: "sql", + keywords: set("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"), + builtin: set("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"), + atoms: set("false true null unknown"), + operatorChars: /^[*+\-%<>!=]/, + dateSQL: set("date timestamp"), + support: set("ODBCdotTable doubleQuote binaryNumber hexNumber") + }); + }()); }); diff --git a/web/editor.md/lib/codemirror/mode/stex/index.html b/web/editor.md/lib/codemirror/mode/stex/index.html index 14679da..1625bda 100644 --- a/web/editor.md/lib/codemirror/mode/stex/index.html +++ b/web/editor.md/lib/codemirror/mode/stex/index.html @@ -2,29 +2,31 @@ CodeMirror: sTeX mode - + - + - +
-

sTeX mode

-

MIME types defined: text/x-stex.

-

Parsing/Highlighting Tests: normal, verbose.

+

Parsing/Highlighting Tests: normal, verbose.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/stex/stex.js b/web/editor.md/lib/codemirror/mode/stex/stex.js index 835ed46..7a9f34d 100644 --- a/web/editor.md/lib/codemirror/mode/stex/stex.js +++ b/web/editor.md/lib/codemirror/mode/stex/stex.js @@ -6,246 +6,258 @@ * Licence: MIT */ -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; - - CodeMirror.defineMode("stex", function() { +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { "use strict"; - function pushCommand(state, command) { - state.cmdState.push(command); - } - - function peekCommand(state) { - if (state.cmdState.length > 0) { - return state.cmdState[state.cmdState.length - 1]; - } else { - return null; - } - } - - function popCommand(state) { - var plug = state.cmdState.pop(); - if (plug) { - plug.closeBracket(); - } - } - - // returns the non-default plugin closest to the end of the list - function getMostPowerful(state) { - var context = state.cmdState; - for (var i = context.length - 1; i >= 0; i--) { - var plug = context[i]; - if (plug.name == "DEFAULT") { - continue; + CodeMirror.defineMode("stex", function () { + "use strict"; + + function pushCommand(state, command) { + state.cmdState.push(command); } - return plug; - } - return { styleIdentifier: function() { return null; } }; - } - - function addPluginPattern(pluginName, cmdStyle, styles) { - return function () { - this.name = pluginName; - this.bracketNo = 0; - this.style = cmdStyle; - this.styles = styles; - this.argument = null; // \begin and \end have arguments that follow. These are stored in the plugin - - this.styleIdentifier = function() { - return this.styles[this.bracketNo - 1] || null; - }; - this.openBracket = function() { - this.bracketNo++; - return "bracket"; - }; - this.closeBracket = function() {}; - }; - } - - var plugins = {}; - - plugins["importmodule"] = addPluginPattern("importmodule", "tag", ["string", "builtin"]); - plugins["documentclass"] = addPluginPattern("documentclass", "tag", ["", "atom"]); - plugins["usepackage"] = addPluginPattern("usepackage", "tag", ["atom"]); - plugins["begin"] = addPluginPattern("begin", "tag", ["atom"]); - plugins["end"] = addPluginPattern("end", "tag", ["atom"]); - - plugins["DEFAULT"] = function () { - this.name = "DEFAULT"; - this.style = "tag"; - - this.styleIdentifier = this.openBracket = this.closeBracket = function() {}; - }; - - function setState(state, f) { - state.f = f; - } - - // called when in a normal (no environment) context - function normal(source, state) { - var plug; - // Do we look like '\command' ? If so, attempt to apply the plugin 'command' - if (source.match(/^\\[a-zA-Z@]+/)) { - var cmdName = source.current().slice(1); - plug = plugins[cmdName] || plugins["DEFAULT"]; - plug = new plug(); - pushCommand(state, plug); - setState(state, beginParams); - return plug.style; - } - - // escape characters - if (source.match(/^\\[$&%#{}_]/)) { - return "tag"; - } - - // white space control characters - if (source.match(/^\\[,;!\/\\]/)) { - return "tag"; - } - - // find if we're starting various math modes - if (source.match("\\[")) { - setState(state, function(source, state){ return inMathMode(source, state, "\\]"); }); - return "keyword"; - } - if (source.match("$$")) { - setState(state, function(source, state){ return inMathMode(source, state, "$$"); }); - return "keyword"; - } - if (source.match("$")) { - setState(state, function(source, state){ return inMathMode(source, state, "$"); }); - return "keyword"; - } - - var ch = source.next(); - if (ch == "%") { - source.skipToEnd(); - return "comment"; - } else if (ch == '}' || ch == ']') { - plug = peekCommand(state); - if (plug) { - plug.closeBracket(ch); - setState(state, beginParams); - } else { - return "error"; + + function peekCommand(state) { + if (state.cmdState.length > 0) { + return state.cmdState[state.cmdState.length - 1]; + } else { + return null; + } } - return "bracket"; - } else if (ch == '{' || ch == '[') { - plug = plugins["DEFAULT"]; - plug = new plug(); - pushCommand(state, plug); - return "bracket"; - } else if (/\d/.test(ch)) { - source.eatWhile(/[\w.%]/); - return "atom"; - } else { - source.eatWhile(/[\w\-_]/); - plug = getMostPowerful(state); - if (plug.name == 'begin') { - plug.argument = source.current(); + + function popCommand(state) { + var plug = state.cmdState.pop(); + if (plug) { + plug.closeBracket(); + } } - return plug.styleIdentifier(); - } - } - - function inMathMode(source, state, endModeSeq) { - if (source.eatSpace()) { - return null; - } - if (source.match(endModeSeq)) { - setState(state, normal); - return "keyword"; - } - if (source.match(/^\\[a-zA-Z@]+/)) { - return "tag"; - } - if (source.match(/^[a-zA-Z]+/)) { - return "variable-2"; - } - // escape characters - if (source.match(/^\\[$&%#{}_]/)) { - return "tag"; - } - // white space control characters - if (source.match(/^\\[,;!\/]/)) { - return "tag"; - } - // special math-mode characters - if (source.match(/^[\^_&]/)) { - return "tag"; - } - // non-special characters - if (source.match(/^[+\-<>|=,\/@!*:;'"`~#?]/)) { - return null; - } - if (source.match(/^(\d+\.\d*|\d*\.\d+|\d+)/)) { - return "number"; - } - var ch = source.next(); - if (ch == "{" || ch == "}" || ch == "[" || ch == "]" || ch == "(" || ch == ")") { - return "bracket"; - } - - if (ch == "%") { - source.skipToEnd(); - return "comment"; - } - return "error"; - } - - function beginParams(source, state) { - var ch = source.peek(), lastPlug; - if (ch == '{' || ch == '[') { - lastPlug = peekCommand(state); - lastPlug.openBracket(ch); - source.eat(ch); - setState(state, normal); - return "bracket"; - } - if (/[ \t\r]/.test(ch)) { - source.eat(ch); - return null; - } - setState(state, normal); - popCommand(state); - - return normal(source, state); - } - - return { - startState: function() { - return { - cmdState: [], - f: normal + + // returns the non-default plugin closest to the end of the list + function getMostPowerful(state) { + var context = state.cmdState; + for (var i = context.length - 1; i >= 0; i--) { + var plug = context[i]; + if (plug.name == "DEFAULT") { + continue; + } + return plug; + } + return { + styleIdentifier: function () { + return null; + } + }; + } + + function addPluginPattern(pluginName, cmdStyle, styles) { + return function () { + this.name = pluginName; + this.bracketNo = 0; + this.style = cmdStyle; + this.styles = styles; + this.argument = null; // \begin and \end have arguments that follow. These are stored in the plugin + + this.styleIdentifier = function () { + return this.styles[this.bracketNo - 1] || null; + }; + this.openBracket = function () { + this.bracketNo++; + return "bracket"; + }; + this.closeBracket = function () { + }; + }; + } + + var plugins = {}; + + plugins["importmodule"] = addPluginPattern("importmodule", "tag", ["string", "builtin"]); + plugins["documentclass"] = addPluginPattern("documentclass", "tag", ["", "atom"]); + plugins["usepackage"] = addPluginPattern("usepackage", "tag", ["atom"]); + plugins["begin"] = addPluginPattern("begin", "tag", ["atom"]); + plugins["end"] = addPluginPattern("end", "tag", ["atom"]); + + plugins["DEFAULT"] = function () { + this.name = "DEFAULT"; + this.style = "tag"; + + this.styleIdentifier = this.openBracket = this.closeBracket = function () { + }; }; - }, - copyState: function(s) { + + function setState(state, f) { + state.f = f; + } + + // called when in a normal (no environment) context + function normal(source, state) { + var plug; + // Do we look like '\command' ? If so, attempt to apply the plugin 'command' + if (source.match(/^\\[a-zA-Z@]+/)) { + var cmdName = source.current().slice(1); + plug = plugins[cmdName] || plugins["DEFAULT"]; + plug = new plug(); + pushCommand(state, plug); + setState(state, beginParams); + return plug.style; + } + + // escape characters + if (source.match(/^\\[$&%#{}_]/)) { + return "tag"; + } + + // white space control characters + if (source.match(/^\\[,;!\/\\]/)) { + return "tag"; + } + + // find if we're starting various math modes + if (source.match("\\[")) { + setState(state, function (source, state) { + return inMathMode(source, state, "\\]"); + }); + return "keyword"; + } + if (source.match("$$")) { + setState(state, function (source, state) { + return inMathMode(source, state, "$$"); + }); + return "keyword"; + } + if (source.match("$")) { + setState(state, function (source, state) { + return inMathMode(source, state, "$"); + }); + return "keyword"; + } + + var ch = source.next(); + if (ch == "%") { + source.skipToEnd(); + return "comment"; + } else if (ch == '}' || ch == ']') { + plug = peekCommand(state); + if (plug) { + plug.closeBracket(ch); + setState(state, beginParams); + } else { + return "error"; + } + return "bracket"; + } else if (ch == '{' || ch == '[') { + plug = plugins["DEFAULT"]; + plug = new plug(); + pushCommand(state, plug); + return "bracket"; + } else if (/\d/.test(ch)) { + source.eatWhile(/[\w.%]/); + return "atom"; + } else { + source.eatWhile(/[\w\-_]/); + plug = getMostPowerful(state); + if (plug.name == 'begin') { + plug.argument = source.current(); + } + return plug.styleIdentifier(); + } + } + + function inMathMode(source, state, endModeSeq) { + if (source.eatSpace()) { + return null; + } + if (source.match(endModeSeq)) { + setState(state, normal); + return "keyword"; + } + if (source.match(/^\\[a-zA-Z@]+/)) { + return "tag"; + } + if (source.match(/^[a-zA-Z]+/)) { + return "variable-2"; + } + // escape characters + if (source.match(/^\\[$&%#{}_]/)) { + return "tag"; + } + // white space control characters + if (source.match(/^\\[,;!\/]/)) { + return "tag"; + } + // special math-mode characters + if (source.match(/^[\^_&]/)) { + return "tag"; + } + // non-special characters + if (source.match(/^[+\-<>|=,\/@!*:;'"`~#?]/)) { + return null; + } + if (source.match(/^(\d+\.\d*|\d*\.\d+|\d+)/)) { + return "number"; + } + var ch = source.next(); + if (ch == "{" || ch == "}" || ch == "[" || ch == "]" || ch == "(" || ch == ")") { + return "bracket"; + } + + if (ch == "%") { + source.skipToEnd(); + return "comment"; + } + return "error"; + } + + function beginParams(source, state) { + var ch = source.peek(), lastPlug; + if (ch == '{' || ch == '[') { + lastPlug = peekCommand(state); + lastPlug.openBracket(ch); + source.eat(ch); + setState(state, normal); + return "bracket"; + } + if (/[ \t\r]/.test(ch)) { + source.eat(ch); + return null; + } + setState(state, normal); + popCommand(state); + + return normal(source, state); + } + return { - cmdState: s.cmdState.slice(), - f: s.f + startState: function () { + return { + cmdState: [], + f: normal + }; + }, + copyState: function (s) { + return { + cmdState: s.cmdState.slice(), + f: s.f + }; + }, + token: function (stream, state) { + return state.f(stream, state); + }, + blankLine: function (state) { + state.f = normal; + state.cmdState.length = 0; + }, + lineComment: "%" }; - }, - token: function(stream, state) { - return state.f(stream, state); - }, - blankLine: function(state) { - state.f = normal; - state.cmdState.length = 0; - }, - lineComment: "%" - }; - }); - - CodeMirror.defineMIME("text/x-stex", "stex"); - CodeMirror.defineMIME("text/x-latex", "stex"); + }); + + CodeMirror.defineMIME("text/x-stex", "stex"); + CodeMirror.defineMIME("text/x-latex", "stex"); }); diff --git a/web/editor.md/lib/codemirror/mode/stex/test.js b/web/editor.md/lib/codemirror/mode/stex/test.js index 22f027e..83fa272 100644 --- a/web/editor.md/lib/codemirror/mode/stex/test.js +++ b/web/editor.md/lib/codemirror/mode/stex/test.js @@ -1,123 +1,126 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function() { - var mode = CodeMirror.getMode({tabSize: 4}, "stex"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } +(function () { + var mode = CodeMirror.getMode({tabSize: 4}, "stex"); - MT("word", - "foo"); + function MT(name) { + test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); + } - MT("twoWords", - "foo bar"); + MT("word", + "foo"); - MT("beginEndDocument", - "[tag \\begin][bracket {][atom document][bracket }]", - "[tag \\end][bracket {][atom document][bracket }]"); + MT("twoWords", + "foo bar"); - MT("beginEndEquation", - "[tag \\begin][bracket {][atom equation][bracket }]", - " E=mc^2", - "[tag \\end][bracket {][atom equation][bracket }]"); + MT("beginEndDocument", + "[tag \\begin][bracket {][atom document][bracket }]", + "[tag \\end][bracket {][atom document][bracket }]"); - MT("beginModule", - "[tag \\begin][bracket {][atom module][bracket }[[]]]"); + MT("beginEndEquation", + "[tag \\begin][bracket {][atom equation][bracket }]", + " E=mc^2", + "[tag \\end][bracket {][atom equation][bracket }]"); - MT("beginModuleId", - "[tag \\begin][bracket {][atom module][bracket }[[]id=bbt-size[bracket ]]]"); + MT("beginModule", + "[tag \\begin][bracket {][atom module][bracket }[[]]]"); - MT("importModule", - "[tag \\importmodule][bracket [[][string b-b-t][bracket ]]{][builtin b-b-t][bracket }]"); + MT("beginModuleId", + "[tag \\begin][bracket {][atom module][bracket }[[]id=bbt-size[bracket ]]]"); - MT("importModulePath", - "[tag \\importmodule][bracket [[][tag \\KWARCslides][bracket {][string dmath/en/cardinality][bracket }]]{][builtin card][bracket }]"); + MT("importModule", + "[tag \\importmodule][bracket [[][string b-b-t][bracket ]]{][builtin b-b-t][bracket }]"); - MT("psForPDF", - "[tag \\PSforPDF][bracket [[][atom 1][bracket ]]{]#1[bracket }]"); + MT("importModulePath", + "[tag \\importmodule][bracket [[][tag \\KWARCslides][bracket {][string dmath/en/cardinality][bracket }]]{][builtin card][bracket }]"); - MT("comment", - "[comment % foo]"); + MT("psForPDF", + "[tag \\PSforPDF][bracket [[][atom 1][bracket ]]{]#1[bracket }]"); - MT("tagComment", - "[tag \\item][comment % bar]"); + MT("comment", + "[comment % foo]"); - MT("commentTag", - " [comment % \\item]"); + MT("tagComment", + "[tag \\item][comment % bar]"); - MT("commentLineBreak", - "[comment %]", - "foo"); + MT("commentTag", + " [comment % \\item]"); - MT("tagErrorCurly", - "[tag \\begin][error }][bracket {]"); + MT("commentLineBreak", + "[comment %]", + "foo"); - MT("tagErrorSquare", - "[tag \\item][error ]]][bracket {]"); + MT("tagErrorCurly", + "[tag \\begin][error }][bracket {]"); - MT("commentCurly", - "[comment % }]"); + MT("tagErrorSquare", + "[tag \\item][error ]]][bracket {]"); - MT("tagHash", - "the [tag \\#] key"); + MT("commentCurly", + "[comment % }]"); - MT("tagNumber", - "a [tag \\$][atom 5] stetson"); + MT("tagHash", + "the [tag \\#] key"); - MT("tagPercent", - "[atom 100][tag \\%] beef"); + MT("tagNumber", + "a [tag \\$][atom 5] stetson"); - MT("tagAmpersand", - "L [tag \\&] N"); + MT("tagPercent", + "[atom 100][tag \\%] beef"); - MT("tagUnderscore", - "foo[tag \\_]bar"); + MT("tagAmpersand", + "L [tag \\&] N"); - MT("tagBracketOpen", - "[tag \\emph][bracket {][tag \\{][bracket }]"); + MT("tagUnderscore", + "foo[tag \\_]bar"); - MT("tagBracketClose", - "[tag \\emph][bracket {][tag \\}][bracket }]"); + MT("tagBracketOpen", + "[tag \\emph][bracket {][tag \\{][bracket }]"); - MT("tagLetterNumber", - "section [tag \\S][atom 1]"); + MT("tagBracketClose", + "[tag \\emph][bracket {][tag \\}][bracket }]"); - MT("textTagNumber", - "para [tag \\P][atom 2]"); + MT("tagLetterNumber", + "section [tag \\S][atom 1]"); - MT("thinspace", - "x[tag \\,]y"); + MT("textTagNumber", + "para [tag \\P][atom 2]"); - MT("thickspace", - "x[tag \\;]y"); + MT("thinspace", + "x[tag \\,]y"); - MT("negativeThinspace", - "x[tag \\!]y"); + MT("thickspace", + "x[tag \\;]y"); - MT("periodNotSentence", - "J.\\ L.\\ is"); + MT("negativeThinspace", + "x[tag \\!]y"); - MT("periodSentence", - "X[tag \\@]. The"); + MT("periodNotSentence", + "J.\\ L.\\ is"); - MT("italicCorrection", - "[bracket {][tag \\em] If[tag \\/][bracket }] I"); + MT("periodSentence", + "X[tag \\@]. The"); - MT("tagBracket", - "[tag \\newcommand][bracket {][tag \\pop][bracket }]"); + MT("italicCorrection", + "[bracket {][tag \\em] If[tag \\/][bracket }] I"); - MT("inlineMathTagFollowedByNumber", - "[keyword $][tag \\pi][number 2][keyword $]"); + MT("tagBracket", + "[tag \\newcommand][bracket {][tag \\pop][bracket }]"); - MT("inlineMath", - "[keyword $][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword $] other text"); + MT("inlineMathTagFollowedByNumber", + "[keyword $][tag \\pi][number 2][keyword $]"); - MT("displayMath", - "More [keyword $$]\t[variable-2 S][tag ^][variable-2 n][tag \\sum] [variable-2 i][keyword $$] other text"); + MT("inlineMath", + "[keyword $][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword $] other text"); - MT("mathWithComment", - "[keyword $][variable-2 x] [comment % $]", - "[variable-2 y][keyword $] other text"); + MT("displayMath", + "More [keyword $$]\t[variable-2 S][tag ^][variable-2 n][tag \\sum] [variable-2 i][keyword $$] other text"); - MT("lineBreakArgument", - "[tag \\\\][bracket [[][atom 1cm][bracket ]]]"); + MT("mathWithComment", + "[keyword $][variable-2 x] [comment % $]", + "[variable-2 y][keyword $] other text"); + + MT("lineBreakArgument", + "[tag \\\\][bracket [[][atom 1cm][bracket ]]]"); })(); diff --git a/web/editor.md/lib/codemirror/mode/stylus/index.html b/web/editor.md/lib/codemirror/mode/stylus/index.html index 354bf30..1493301 100644 --- a/web/editor.md/lib/codemirror/mode/stylus/index.html +++ b/web/editor.md/lib/codemirror/mode/stylus/index.html @@ -2,31 +2,37 @@ CodeMirror: Stylus mode - - - + + + - +
-

Stylus mode

-
-
- + + -

MIME types defined: text/x-styl.

+

MIME types defined: text/x-styl.

diff --git a/web/editor.md/lib/codemirror/mode/stylus/stylus.js b/web/editor.md/lib/codemirror/mode/stylus/stylus.js index 6f7c754..a64ba1b 100644 --- a/web/editor.md/lib/codemirror/mode/stylus/stylus.js +++ b/web/editor.md/lib/codemirror/mode/stylus/stylus.js @@ -1,444 +1,446 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; - - CodeMirror.defineMode("stylus", function(config) { - - var operatorsRegexp = /^(\?:?|\+[+=]?|-[\-=]?|\*[\*=]?|\/=?|[=!:\?]?=|<=?|>=?|%=?|&&|\|=?|\~|!|\^|\\)/, - delimitersRegexp = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/, - wordOperatorsRegexp = wordRegexp(wordOperators), - commonKeywordsRegexp = wordRegexp(commonKeywords), - commonAtomsRegexp = wordRegexp(commonAtoms), - commonDefRegexp = wordRegexp(commonDef), - vendorPrefixesRegexp = new RegExp(/^\-(moz|ms|o|webkit)-/), - cssValuesWithBracketsRegexp = new RegExp("^(" + cssValuesWithBrackets_.join("|") + ")\\([\\w\-\\#\\,\\.\\%\\s\\(\\)]*\\)"); - - var tokenBase = function(stream, state) { - - if (stream.eatSpace()) return null; - - var ch = stream.peek(); - - // Single line Comment - if (stream.match('//')) { - stream.skipToEnd(); - return "comment"; - } - - // Multiline Comment - if (stream.match('/*')) { - state.tokenizer = multilineComment; - return state.tokenizer(stream, state); - } - - // Strings - if (ch === '"' || ch === "'") { - stream.next(); - state.tokenizer = buildStringTokenizer(ch); - return "string"; - } - - // Def - if (ch === "@") { - stream.next(); - if (stream.match(/extend/)) { - dedent(state); // remove indentation after selectors - } else if (stream.match(/media[\w-\s]*[\w-]/)) { - indent(state); - } else if(stream.eatWhile(/[\w-]/)) { - if(stream.current().match(commonDefRegexp)) { - indent(state); - } - } - return "def"; - } - - // Number - if (stream.match(/^-?[0-9\.]/, false)) { - - // Floats - if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i) || stream.match(/^-?\d+\.\d*/)) { - - // Prevent from getting extra . on 1.. - if (stream.peek() == ".") { - stream.backUp(1); - } - // Units - stream.eatWhile(/[a-z%]/i); - return "number"; - } - // Integers - if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/) || stream.match(/^-?0(?![\dx])/i)) { - // Units - stream.eatWhile(/[a-z%]/i); - return "number"; - } - } +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("stylus", function (config) { + + var operatorsRegexp = /^(\?:?|\+[+=]?|-[\-=]?|\*[\*=]?|\/=?|[=!:\?]?=|<=?|>=?|%=?|&&|\|=?|\~|!|\^|\\)/, + delimitersRegexp = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/, + wordOperatorsRegexp = wordRegexp(wordOperators), + commonKeywordsRegexp = wordRegexp(commonKeywords), + commonAtomsRegexp = wordRegexp(commonAtoms), + commonDefRegexp = wordRegexp(commonDef), + vendorPrefixesRegexp = new RegExp(/^\-(moz|ms|o|webkit)-/), + cssValuesWithBracketsRegexp = new RegExp("^(" + cssValuesWithBrackets_.join("|") + ")\\([\\w\-\\#\\,\\.\\%\\s\\(\\)]*\\)"); + + var tokenBase = function (stream, state) { + + if (stream.eatSpace()) return null; + + var ch = stream.peek(); + + // Single line Comment + if (stream.match('//')) { + stream.skipToEnd(); + return "comment"; + } + + // Multiline Comment + if (stream.match('/*')) { + state.tokenizer = multilineComment; + return state.tokenizer(stream, state); + } + + // Strings + if (ch === '"' || ch === "'") { + stream.next(); + state.tokenizer = buildStringTokenizer(ch); + return "string"; + } + + // Def + if (ch === "@") { + stream.next(); + if (stream.match(/extend/)) { + dedent(state); // remove indentation after selectors + } else if (stream.match(/media[\w-\s]*[\w-]/)) { + indent(state); + } else if (stream.eatWhile(/[\w-]/)) { + if (stream.current().match(commonDefRegexp)) { + indent(state); + } + } + return "def"; + } + + // Number + if (stream.match(/^-?[0-9\.]/, false)) { + + // Floats + if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i) || stream.match(/^-?\d+\.\d*/)) { + + // Prevent from getting extra . on 1.. + if (stream.peek() == ".") { + stream.backUp(1); + } + // Units + stream.eatWhile(/[a-z%]/i); + return "number"; + } + // Integers + if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/) || stream.match(/^-?0(?![\dx])/i)) { + // Units + stream.eatWhile(/[a-z%]/i); + return "number"; + } + } + + // Hex color and id selector + if (ch === "#") { + stream.next(); + + // Hex color + if (stream.match(/^[0-9a-f]{6}|[0-9a-f]{3}/i)) { + return "atom"; + } + + // ID selector + if (stream.match(/^[\w-]+/i)) { + indent(state); + return "builtin"; + } + } + + // Vendor prefixes + if (stream.match(vendorPrefixesRegexp)) { + return "meta"; + } + + // Gradients and animation as CSS value + if (stream.match(cssValuesWithBracketsRegexp)) { + return "atom"; + } + + // Mixins / Functions with indentation + if (stream.sol() && stream.match(/^\.?[a-z][\w-]*\(/i)) { + stream.backUp(1); + indent(state); + return "keyword"; + } + + // Mixins / Functions + if (stream.match(/^\.?[a-z][\w-]*\(/i)) { + stream.backUp(1); + return "keyword"; + } + + // +Block mixins + if (stream.match(/^(\+|\-)[a-z][\w-]+\(/i)) { + stream.backUp(1); + indent(state); + return "keyword"; + } + + // url tokens + if (stream.match(/^url/) && stream.peek() === "(") { + state.tokenizer = urlTokens; + if (!stream.peek()) { + state.cursorHalf = 0; + } + return "atom"; + } + + // Class + if (stream.match(/^\.[a-z][\w-]*/i)) { + indent(state); + return "qualifier"; + } + + // & Parent Reference with BEM naming + if (stream.match(/^(_|__|-|--)[a-z0-9-]+/)) { + return "qualifier"; + } + + // Pseudo elements/classes + if (ch == ':' && stream.match(/^::?[\w-]+/)) { + indent(state); + return "variable-3"; + } + + // Conditionals + if (stream.match(wordRegexp(["for", "if", "else", "unless"]))) { + indent(state); + return "keyword"; + } + + // Keywords + if (stream.match(commonKeywordsRegexp)) { + return "keyword"; + } + + // Atoms + if (stream.match(commonAtomsRegexp)) { + return "atom"; + } + + // Variables + if (stream.match(/^\$?[a-z][\w-]+\s?=(\s|[\w-'"\$])/i)) { + stream.backUp(2); + var cssPropertie = stream.current().toLowerCase().match(/[\w-]+/)[0]; + return cssProperties[cssPropertie] === undefined ? "variable-2" : "property"; + } else if (stream.match(/\$[\w-\.]+/i)) { + return "variable-2"; + } else if (stream.match(/\$?[\w-]+\.[\w-]+/i)) { + var cssTypeSelector = stream.current().toLowerCase().match(/[\w]+/)[0]; + if (cssTypeSelectors[cssTypeSelector] === undefined) { + return "variable-2"; + } else stream.backUp(stream.current().length); + } + + // !important + if (ch === "!") { + stream.next(); + return stream.match(/^[\w]+/) ? "keyword" : "operator"; + } + + // / Root Reference + if (stream.match(/^\/(:|\.|#|[a-z])/)) { + stream.backUp(1); + return "variable-3"; + } + + // Operators and delimiters + if (stream.match(operatorsRegexp) || stream.match(wordOperatorsRegexp)) { + return "operator"; + } + if (stream.match(delimitersRegexp)) { + return null; + } + + // & Parent Reference + if (ch === "&") { + stream.next(); + return "variable-3"; + } + + // Font family + if (stream.match(/^[A-Z][a-z0-9-]+/)) { + return "string"; + } + + // CSS rule + // NOTE: Some css selectors and property values have the same name + // (embed, menu, pre, progress, sub, table), + // so they will have the same color (.cm-atom). + if (stream.match(/[\w-]*/i)) { + + var word = stream.current().toLowerCase(); + + if (cssProperties[word] !== undefined) { + // CSS property + if (!stream.eol()) + return "property"; + else + return "variable-2"; + + } else if (cssValues[word] !== undefined) { + // CSS value + return "atom"; + + } else if (cssTypeSelectors[word] !== undefined) { + // CSS type selectors + indent(state); + return "tag"; + + } else if (word) { + // By default variable-2 + return "variable-2"; + } + } + + // Handle non-detected items + stream.next(); + return null; - // Hex color and id selector - if (ch === "#") { - stream.next(); + }; - // Hex color - if (stream.match(/^[0-9a-f]{6}|[0-9a-f]{3}/i)) { - return "atom"; - } + var tokenLexer = function (stream, state) { - // ID selector - if (stream.match(/^[\w-]+/i)) { - indent(state); - return "builtin"; - } - } - - // Vendor prefixes - if (stream.match(vendorPrefixesRegexp)) { - return "meta"; - } - - // Gradients and animation as CSS value - if (stream.match(cssValuesWithBracketsRegexp)) { - return "atom"; - } - - // Mixins / Functions with indentation - if (stream.sol() && stream.match(/^\.?[a-z][\w-]*\(/i)) { - stream.backUp(1); - indent(state); - return "keyword"; - } - - // Mixins / Functions - if (stream.match(/^\.?[a-z][\w-]*\(/i)) { - stream.backUp(1); - return "keyword"; - } - - // +Block mixins - if (stream.match(/^(\+|\-)[a-z][\w-]+\(/i)) { - stream.backUp(1); - indent(state); - return "keyword"; - } - - // url tokens - if (stream.match(/^url/) && stream.peek() === "(") { - state.tokenizer = urlTokens; - if(!stream.peek()) { - state.cursorHalf = 0; - } - return "atom"; - } - - // Class - if (stream.match(/^\.[a-z][\w-]*/i)) { - indent(state); - return "qualifier"; - } - - // & Parent Reference with BEM naming - if (stream.match(/^(_|__|-|--)[a-z0-9-]+/)) { - return "qualifier"; - } - - // Pseudo elements/classes - if (ch == ':' && stream.match(/^::?[\w-]+/)) { - indent(state); - return "variable-3"; - } - - // Conditionals - if (stream.match(wordRegexp(["for", "if", "else", "unless"]))) { - indent(state); - return "keyword"; - } - - // Keywords - if (stream.match(commonKeywordsRegexp)) { - return "keyword"; - } - - // Atoms - if (stream.match(commonAtomsRegexp)) { - return "atom"; - } - - // Variables - if (stream.match(/^\$?[a-z][\w-]+\s?=(\s|[\w-'"\$])/i)) { - stream.backUp(2); - var cssPropertie = stream.current().toLowerCase().match(/[\w-]+/)[0]; - return cssProperties[cssPropertie] === undefined ? "variable-2" : "property"; - } else if (stream.match(/\$[\w-\.]+/i)) { - return "variable-2"; - } else if (stream.match(/\$?[\w-]+\.[\w-]+/i)) { - var cssTypeSelector = stream.current().toLowerCase().match(/[\w]+/)[0]; - if(cssTypeSelectors[cssTypeSelector] === undefined) { - return "variable-2"; - } else stream.backUp(stream.current().length); - } - - // !important - if (ch === "!") { - stream.next(); - return stream.match(/^[\w]+/) ? "keyword": "operator"; - } - - // / Root Reference - if (stream.match(/^\/(:|\.|#|[a-z])/)) { - stream.backUp(1); - return "variable-3"; - } - - // Operators and delimiters - if (stream.match(operatorsRegexp) || stream.match(wordOperatorsRegexp)) { - return "operator"; - } - if (stream.match(delimitersRegexp)) { - return null; - } - - // & Parent Reference - if (ch === "&") { - stream.next(); - return "variable-3"; - } - - // Font family - if (stream.match(/^[A-Z][a-z0-9-]+/)) { - return "string"; - } - - // CSS rule - // NOTE: Some css selectors and property values have the same name - // (embed, menu, pre, progress, sub, table), - // so they will have the same color (.cm-atom). - if (stream.match(/[\w-]*/i)) { - - var word = stream.current().toLowerCase(); - - if(cssProperties[word] !== undefined) { - // CSS property - if(!stream.eol()) - return "property"; - else - return "variable-2"; - - } else if(cssValues[word] !== undefined) { - // CSS value - return "atom"; - - } else if(cssTypeSelectors[word] !== undefined) { - // CSS type selectors - indent(state); - return "tag"; - - } else if(word) { - // By default variable-2 - return "variable-2"; - } - } + if (stream.sol()) { + state.indentCount = 0; + } - // Handle non-detected items - stream.next(); - return null; + var style = state.tokenizer(stream, state); + var current = stream.current(); - }; + if (stream.eol() && (current === "}" || current === ",")) { + dedent(state); + } - var tokenLexer = function(stream, state) { + if (style !== null) { + var startOfToken = stream.pos - current.length; + var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount); - if (stream.sol()) { - state.indentCount = 0; - } + var newScopes = []; - var style = state.tokenizer(stream, state); - var current = stream.current(); + for (var i = 0; i < state.scopes.length; i++) { + var scope = state.scopes[i]; - if (stream.eol() && (current === "}" || current === ",")) { - dedent(state); - } + if (scope.offset <= withCurrentIndent) { + newScopes.push(scope); + } + } - if (style !== null) { - var startOfToken = stream.pos - current.length; - var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount); + state.scopes = newScopes; + } - var newScopes = []; + return style; + }; - for (var i = 0; i < state.scopes.length; i++) { - var scope = state.scopes[i]; + return { + startState: function () { + return { + tokenizer: tokenBase, + scopes: [{offset: 0, type: 'styl'}] + }; + }, + + token: function (stream, state) { + var style = tokenLexer(stream, state); + state.lastToken = {style: style, content: stream.current()}; + return style; + }, + + indent: function (state) { + return state.scopes[0].offset; + }, + + lineComment: "//", + fold: "indent" - if (scope.offset <= withCurrentIndent) { - newScopes.push(scope); - } - } + }; - state.scopes = newScopes; - } + function urlTokens(stream, state) { + var ch = stream.peek(); + + if (ch === ")") { + stream.next(); + state.tokenizer = tokenBase; + return "operator"; + } else if (ch === "(") { + stream.next(); + stream.eatSpace(); + + return "operator"; + } else if (ch === "'" || ch === '"') { + state.tokenizer = buildStringTokenizer(stream.next()); + return "string"; + } else { + state.tokenizer = buildStringTokenizer(")", false); + return "string"; + } + } - return style; - }; + function multilineComment(stream, state) { + if (stream.skipTo("*/")) { + stream.next(); + stream.next(); + state.tokenizer = tokenBase; + } else { + stream.next(); + } + return "comment"; + } - return { - startState: function() { - return { - tokenizer: tokenBase, - scopes: [{offset: 0, type: 'styl'}] - }; - }, + function buildStringTokenizer(quote, greedy) { + + if (greedy == null) { + greedy = true; + } + + function stringTokenizer(stream, state) { + var nextChar = stream.next(); + var peekChar = stream.peek(); + var previousChar = stream.string.charAt(stream.pos - 2); + + var endingString = ((nextChar !== "\\" && peekChar === quote) || + (nextChar === quote && previousChar !== "\\")); + + if (endingString) { + if (nextChar !== quote && greedy) { + stream.next(); + } + state.tokenizer = tokenBase; + return "string"; + } else if (nextChar === "#" && peekChar === "{") { + state.tokenizer = buildInterpolationTokenizer(stringTokenizer); + stream.next(); + return "operator"; + } else { + return "string"; + } + } + + return stringTokenizer; + } - token: function(stream, state) { - var style = tokenLexer(stream, state); - state.lastToken = { style: style, content: stream.current() }; - return style; - }, + function buildInterpolationTokenizer(currentTokenizer) { + return function (stream, state) { + if (stream.peek() === "}") { + stream.next(); + state.tokenizer = currentTokenizer; + return "operator"; + } else { + return tokenBase(stream, state); + } + }; + } - indent: function(state) { - return state.scopes[0].offset; - }, + function indent(state) { + if (state.indentCount == 0) { + state.indentCount++; + var lastScopeOffset = state.scopes[0].offset; + var currentOffset = lastScopeOffset + config.indentUnit; + state.scopes.unshift({offset: currentOffset}); + } + } - lineComment: "//", - fold: "indent" + function dedent(state) { + if (state.scopes.length == 1) { + return true; + } + state.scopes.shift(); + } + }); + + // https://developer.mozilla.org/en-US/docs/Web/HTML/Element + var cssTypeSelectors_ = ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "bgsound", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr"]; + // https://github.com/csscomb/csscomb.js/blob/master/config/zen.json + var cssProperties_ = ["position", "top", "right", "bottom", "left", "z-index", "display", "visibility", "flex-direction", "flex-order", "flex-pack", "float", "clear", "flex-align", "overflow", "overflow-x", "overflow-y", "overflow-scrolling", "clip", "box-sizing", "margin", "margin-top", "margin-right", "margin-bottom", "margin-left", "padding", "padding-top", "padding-right", "padding-bottom", "padding-left", "min-width", "min-height", "max-width", "max-height", "width", "height", "outline", "outline-width", "outline-style", "outline-color", "outline-offset", "border", "border-spacing", "border-collapse", "border-width", "border-style", "border-color", "border-top", "border-top-width", "border-top-style", "border-top-color", "border-right", "border-right-width", "border-right-style", "border-right-color", "border-bottom", "border-bottom-width", "border-bottom-style", "border-bottom-color", "border-left", "border-left-width", "border-left-style", "border-left-color", "border-radius", "border-top-left-radius", "border-top-right-radius", "border-bottom-right-radius", "border-bottom-left-radius", "border-image", "border-image-source", "border-image-slice", "border-image-width", "border-image-outset", "border-image-repeat", "border-top-image", "border-right-image", "border-bottom-image", "border-left-image", "border-corner-image", "border-top-left-image", "border-top-right-image", "border-bottom-right-image", "border-bottom-left-image", "background", "filter:progid:DXImageTransform\\.Microsoft\\.AlphaImageLoader", "background-color", "background-image", "background-attachment", "background-position", "background-position-x", "background-position-y", "background-clip", "background-origin", "background-size", "background-repeat", "box-decoration-break", "box-shadow", "color", "table-layout", "caption-side", "empty-cells", "list-style", "list-style-position", "list-style-type", "list-style-image", "quotes", "content", "counter-increment", "counter-reset", "writing-mode", "vertical-align", "text-align", "text-align-last", "text-decoration", "text-emphasis", "text-emphasis-position", "text-emphasis-style", "text-emphasis-color", "text-indent", "-ms-text-justify", "text-justify", "text-outline", "text-transform", "text-wrap", "text-overflow", "text-overflow-ellipsis", "text-overflow-mode", "text-size-adjust", "text-shadow", "white-space", "word-spacing", "word-wrap", "word-break", "tab-size", "hyphens", "letter-spacing", "font", "font-weight", "font-style", "font-variant", "font-size-adjust", "font-stretch", "font-size", "font-family", "src", "line-height", "opacity", "filter:\\\\\\\\'progid:DXImageTransform.Microsoft.Alpha", "filter:progid:DXImageTransform.Microsoft.Alpha\\(Opacity", "interpolation-mode", "filter", "resize", "cursor", "nav-index", "nav-up", "nav-right", "nav-down", "nav-left", "transition", "transition-delay", "transition-timing-function", "transition-duration", "transition-property", "transform", "transform-origin", "animation", "animation-name", "animation-duration", "animation-play-state", "animation-timing-function", "animation-delay", "animation-iteration-count", "animation-direction", "pointer-events", "unicode-bidi", "direction", "columns", "column-span", "column-width", "column-count", "column-fill", "column-gap", "column-rule", "column-rule-width", "column-rule-style", "column-rule-color", "break-before", "break-inside", "break-after", "page-break-before", "page-break-inside", "page-break-after", "orphans", "widows", "zoom", "max-zoom", "min-zoom", "user-zoom", "orientation", "text-rendering", "speak", "animation-fill-mode", "backface-visibility", "user-drag", "user-select", "appearance"]; + // https://github.com/codemirror/CodeMirror/blob/master/mode/css/css.js#L501 + var cssValues_ = ["above", "absolute", "activeborder", "activecaption", "afar", "after-white-space", "ahead", "alias", "all", "all-scroll", "alternate", "always", "amharic", "amharic-abegede", "antialiased", "appworkspace", "arabic-indic", "armenian", "asterisks", "auto", "avoid", "avoid-column", "avoid-page", "avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary", "bengali", "block", "block-axis", "bold", "bolder", "border", "border-box", "both", "bottom", "break", "break-all", "break-word", "button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "cambodian", "capitalize", "caps-lock-indicator", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote", "col-resize", "collapse", "column", "compact", "condensed", "contain", "content", "content-box", "context-menu", "continuous", "copy", "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal", "decimal-leading-zero", "default", "default-button", "destination-atop", "destination-in", "destination-out", "destination-over", "devanagari", "disc", "discard", "document", "dot-dash", "dot-dot-dash", "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er", "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", "ethiopic-halehame-aa-et", "ethiopic-halehame-am-et", "ethiopic-halehame-gez", "ethiopic-halehame-om-et", "ethiopic-halehame-sid-et", "ethiopic-halehame-so-et", "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ew-resize", "expanded", "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "footnotes", "forwards", "from", "geometricPrecision", "georgian", "graytext", "groove", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew", "help", "hidden", "hide", "higher", "highlight", "highlighttext", "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore", "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "kannada", "katakana", "katakana-iroha", "keep-all", "khmer", "landscape", "lao", "large", "larger", "left", "level", "lighter", "line-through", "linear", "lines", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian", "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian", "lower-roman", "lowercase", "ltr", "malayalam", "match", "media-controls-background", "media-current-time-display", "media-fullscreen-button", "media-mute-button", "media-play-button", "media-return-to-realtime-button", "media-rewind-button", "media-seek-back-button", "media-seek-forward-button", "media-slider", "media-sliderthumb", "media-time-remaining-display", "media-volume-slider", "media-volume-slider-container", "media-volume-sliderthumb", "medium", "menu", "menulist", "menulist-button", "menulist-text", "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", "mix", "mongolian", "monospace", "move", "multiple", "myanmar", "n-resize", "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap", "ns-resize", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote", "optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset", "outside", "outside-shape", "overlay", "overline", "padding", "padding-box", "painted", "page", "paused", "persian", "plus-darker", "plus-lighter", "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "push-button", "radio", "read-only", "read-write", "read-write-plaintext-only", "rectangle", "region", "relative", "repeat", "repeat-x", "repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "round", "row-resize", "rtl", "run-in", "running", "s-resize", "sans-serif", "scroll", "scrollbar", "se-resize", "searchfield", "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button", "searchfield-results-decoration", "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama", "single", "skip-white-space", "slide", "slider-horizontal", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow", "small-caps", "small-caption", "smaller", "solid", "somali", "source-atop", "source-in", "source-out", "source-over", "space", "square", "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", "subpixel-antialiased", "super", "sw-resize", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row", "table-row-group", "telugu", "text", "text-bottom", "text-top", "textfield", "thai", "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er", "tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top", "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal", "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted", "visibleStroke", "visual", "w-resize", "wait", "wave", "wider", "window", "windowframe", "windowtext", "x-large", "x-small", "xor", "xx-large", "xx-small", "bicubic", "optimizespeed", "grayscale"]; + var cssColorValues_ = ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"]; + var cssValuesWithBrackets_ = ["gradient", "linear-gradient", "radial-gradient", "repeating-linear-gradient", "repeating-radial-gradient", "cubic-bezier", "translateX", "translateY", "translate3d", "rotate3d", "scale", "scale3d", "perspective", "skewX"]; + + var wordOperators = ["in", "and", "or", "not", "is a", "is", "isnt", "defined", "if unless"], + commonKeywords = ["for", "if", "else", "unless", "return"], + commonAtoms = ["null", "true", "false", "href", "title", "type", "not-allowed", "readonly", "disabled"], + commonDef = ["@font-face", "@keyframes", "@media", "@viewport", "@page", "@host", "@supports", "@block", "@css"], + cssTypeSelectors = keySet(cssTypeSelectors_), + cssProperties = keySet(cssProperties_), + cssValues = keySet(cssValues_.concat(cssColorValues_)), + hintWords = wordOperators.concat(commonKeywords, + commonAtoms, + commonDef, + cssTypeSelectors_, + cssProperties_, + cssValues_, + cssValuesWithBrackets_, + cssColorValues_); + + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b"); }; - function urlTokens(stream, state) { - var ch = stream.peek(); - - if (ch === ")") { - stream.next(); - state.tokenizer = tokenBase; - return "operator"; - } else if (ch === "(") { - stream.next(); - stream.eatSpace(); - - return "operator"; - } else if (ch === "'" || ch === '"') { - state.tokenizer = buildStringTokenizer(stream.next()); - return "string"; - } else { - state.tokenizer = buildStringTokenizer(")", false); - return "string"; - } - } - - function multilineComment(stream, state) { - if (stream.skipTo("*/")) { - stream.next(); - stream.next(); - state.tokenizer = tokenBase; - } else { - stream.next(); - } - return "comment"; - } - - function buildStringTokenizer(quote, greedy) { - - if(greedy == null) { - greedy = true; - } - - function stringTokenizer(stream, state) { - var nextChar = stream.next(); - var peekChar = stream.peek(); - var previousChar = stream.string.charAt(stream.pos-2); - - var endingString = ((nextChar !== "\\" && peekChar === quote) || - (nextChar === quote && previousChar !== "\\")); - - if (endingString) { - if (nextChar !== quote && greedy) { - stream.next(); - } - state.tokenizer = tokenBase; - return "string"; - } else if (nextChar === "#" && peekChar === "{") { - state.tokenizer = buildInterpolationTokenizer(stringTokenizer); - stream.next(); - return "operator"; - } else { - return "string"; + function keySet(array) { + var keys = {}; + for (var i = 0; i < array.length; ++i) { + keys[array[i]] = true; } - } - - return stringTokenizer; - } - - function buildInterpolationTokenizer(currentTokenizer) { - return function(stream, state) { - if (stream.peek() === "}") { - stream.next(); - state.tokenizer = currentTokenizer; - return "operator"; - } else { - return tokenBase(stream, state); - } - }; - } - - function indent(state) { - if (state.indentCount == 0) { - state.indentCount++; - var lastScopeOffset = state.scopes[0].offset; - var currentOffset = lastScopeOffset + config.indentUnit; - state.scopes.unshift({ offset:currentOffset }); - } - } - - function dedent(state) { - if (state.scopes.length == 1) { return true; } - state.scopes.shift(); - } - - }); - - // https://developer.mozilla.org/en-US/docs/Web/HTML/Element - var cssTypeSelectors_ = ["a","abbr","address","area","article","aside","audio", "b", "base","bdi","bdo","bgsound","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","nobr","noframes","noscript","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]; - // https://github.com/csscomb/csscomb.js/blob/master/config/zen.json - var cssProperties_ = ["position","top","right","bottom","left","z-index","display","visibility","flex-direction","flex-order","flex-pack","float","clear","flex-align","overflow","overflow-x","overflow-y","overflow-scrolling","clip","box-sizing","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","min-width","min-height","max-width","max-height","width","height","outline","outline-width","outline-style","outline-color","outline-offset","border","border-spacing","border-collapse","border-width","border-style","border-color","border-top","border-top-width","border-top-style","border-top-color","border-right","border-right-width","border-right-style","border-right-color","border-bottom","border-bottom-width","border-bottom-style","border-bottom-color","border-left","border-left-width","border-left-style","border-left-color","border-radius","border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius","border-image","border-image-source","border-image-slice","border-image-width","border-image-outset","border-image-repeat","border-top-image","border-right-image","border-bottom-image","border-left-image","border-corner-image","border-top-left-image","border-top-right-image","border-bottom-right-image","border-bottom-left-image","background","filter:progid:DXImageTransform\\.Microsoft\\.AlphaImageLoader","background-color","background-image","background-attachment","background-position","background-position-x","background-position-y","background-clip","background-origin","background-size","background-repeat","box-decoration-break","box-shadow","color","table-layout","caption-side","empty-cells","list-style","list-style-position","list-style-type","list-style-image","quotes","content","counter-increment","counter-reset","writing-mode","vertical-align","text-align","text-align-last","text-decoration","text-emphasis","text-emphasis-position","text-emphasis-style","text-emphasis-color","text-indent","-ms-text-justify","text-justify","text-outline","text-transform","text-wrap","text-overflow","text-overflow-ellipsis","text-overflow-mode","text-size-adjust","text-shadow","white-space","word-spacing","word-wrap","word-break","tab-size","hyphens","letter-spacing","font","font-weight","font-style","font-variant","font-size-adjust","font-stretch","font-size","font-family","src","line-height","opacity","filter:\\\\\\\\'progid:DXImageTransform.Microsoft.Alpha","filter:progid:DXImageTransform.Microsoft.Alpha\\(Opacity","interpolation-mode","filter","resize","cursor","nav-index","nav-up","nav-right","nav-down","nav-left","transition","transition-delay","transition-timing-function","transition-duration","transition-property","transform","transform-origin","animation","animation-name","animation-duration","animation-play-state","animation-timing-function","animation-delay","animation-iteration-count","animation-direction","pointer-events","unicode-bidi","direction","columns","column-span","column-width","column-count","column-fill","column-gap","column-rule","column-rule-width","column-rule-style","column-rule-color","break-before","break-inside","break-after","page-break-before","page-break-inside","page-break-after","orphans","widows","zoom","max-zoom","min-zoom","user-zoom","orientation","text-rendering","speak","animation-fill-mode","backface-visibility","user-drag","user-select","appearance"]; - // https://github.com/codemirror/CodeMirror/blob/master/mode/css/css.js#L501 - var cssValues_ = ["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale"]; - var cssColorValues_ = ["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]; - var cssValuesWithBrackets_ = ["gradient","linear-gradient","radial-gradient","repeating-linear-gradient","repeating-radial-gradient","cubic-bezier","translateX","translateY","translate3d","rotate3d","scale","scale3d","perspective","skewX"]; - - var wordOperators = ["in", "and", "or", "not", "is a", "is", "isnt", "defined", "if unless"], - commonKeywords = ["for", "if", "else", "unless", "return"], - commonAtoms = ["null", "true", "false", "href", "title", "type", "not-allowed", "readonly", "disabled"], - commonDef = ["@font-face", "@keyframes", "@media", "@viewport", "@page", "@host", "@supports", "@block", "@css"], - cssTypeSelectors = keySet(cssTypeSelectors_), - cssProperties = keySet(cssProperties_), - cssValues = keySet(cssValues_.concat(cssColorValues_)), - hintWords = wordOperators.concat(commonKeywords, - commonAtoms, - commonDef, - cssTypeSelectors_, - cssProperties_, - cssValues_, - cssValuesWithBrackets_, - cssColorValues_); - - function wordRegexp(words) { - return new RegExp("^((" + words.join(")|(") + "))\\b"); - }; - - function keySet(array) { - var keys = {}; - for (var i = 0; i < array.length; ++i) { - keys[array[i]] = true; - } - return keys; - }; - - CodeMirror.registerHelper("hintWords", "stylus", hintWords); - CodeMirror.defineMIME("text/x-styl", "stylus"); + return keys; + }; + + CodeMirror.registerHelper("hintWords", "stylus", hintWords); + CodeMirror.defineMIME("text/x-styl", "stylus"); }); diff --git a/web/editor.md/lib/codemirror/mode/tcl/index.html b/web/editor.md/lib/codemirror/mode/tcl/index.html index ce4ad34..5ed9463 100644 --- a/web/editor.md/lib/codemirror/mode/tcl/index.html +++ b/web/editor.md/lib/codemirror/mode/tcl/index.html @@ -2,30 +2,30 @@ CodeMirror: Tcl mode - + - - + +
-

Tcl mode

-

MIME types defined: text/x-tcl.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/tcl/tcl.js b/web/editor.md/lib/codemirror/mode/tcl/tcl.js index 056accb..9f51b80 100644 --- a/web/editor.md/lib/codemirror/mode/tcl/tcl.js +++ b/web/editor.md/lib/codemirror/mode/tcl/tcl.js @@ -3,145 +3,144 @@ //tcl mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("tcl", function() { - function parseWords(str) { - var obj = {}, words = str.split(" "); - for (var i = 0; i < words.length; ++i) obj[words[i]] = true; - return obj; - } - var keywords = parseWords("Tcl safe after append array auto_execok auto_import auto_load " + - "auto_mkindex auto_mkindex_old auto_qualify auto_reset bgerror " + - "binary break catch cd close concat continue dde eof encoding error " + - "eval exec exit expr fblocked fconfigure fcopy file fileevent filename " + - "filename flush for foreach format gets glob global history http if " + - "incr info interp join lappend lindex linsert list llength load lrange " + - "lreplace lsearch lset lsort memory msgcat namespace open package parray " + - "pid pkg::create pkg_mkIndex proc puts pwd re_syntax read regex regexp " + - "registry regsub rename resource return scan seek set socket source split " + - "string subst switch tcl_endOfWord tcl_findLibrary tcl_startOfNextWord " + - "tcl_wordBreakAfter tcl_startOfPreviousWord tcl_wordBreakBefore tcltest " + - "tclvars tell time trace unknown unset update uplevel upvar variable " + - "vwait"); - var functions = parseWords("if elseif else and not or eq ne in ni for foreach while switch"); - var isOperatorChar = /[+\-*&%=<>!?^\/\|]/; - function chain(stream, state, f) { - state.tokenize = f; - return f(stream, state); - } - function tokenBase(stream, state) { - var beforeParams = state.beforeParams; - state.beforeParams = false; - var ch = stream.next(); - if ((ch == '"' || ch == "'") && state.inParams) - return chain(stream, state, tokenString(ch)); - else if (/[\[\]{}\(\),;\.]/.test(ch)) { - if (ch == "(" && beforeParams) state.inParams = true; - else if (ch == ")") state.inParams = false; - return null; - } - else if (/\d/.test(ch)) { - stream.eatWhile(/[\w\.]/); - return "number"; - } - else if (ch == "#" && stream.eat("*")) { - return chain(stream, state, tokenComment); - } - else if (ch == "#" && stream.match(/ *\[ *\[/)) { - return chain(stream, state, tokenUnparsed); - } - else if (ch == "#" && stream.eat("#")) { - stream.skipToEnd(); - return "comment"; - } - else if (ch == '"') { - stream.skipTo(/"/); - return "comment"; - } - else if (ch == "$") { - stream.eatWhile(/[$_a-z0-9A-Z\.{:]/); - stream.eatWhile(/}/); - state.beforeParams = true; - return "builtin"; - } - else if (isOperatorChar.test(ch)) { - stream.eatWhile(isOperatorChar); - return "comment"; - } - else { - stream.eatWhile(/[\w\$_{}\xa1-\uffff]/); - var word = stream.current().toLowerCase(); - if (keywords && keywords.propertyIsEnumerable(word)) - return "keyword"; - if (functions && functions.propertyIsEnumerable(word)) { - state.beforeParams = true; - return "keyword"; + CodeMirror.defineMode("tcl", function () { + function parseWords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; } - return null; - } - } - function tokenString(quote) { - return function(stream, state) { - var escaped = false, next, end = false; - while ((next = stream.next()) != null) { - if (next == quote && !escaped) { - end = true; - break; + + var keywords = parseWords("Tcl safe after append array auto_execok auto_import auto_load " + + "auto_mkindex auto_mkindex_old auto_qualify auto_reset bgerror " + + "binary break catch cd close concat continue dde eof encoding error " + + "eval exec exit expr fblocked fconfigure fcopy file fileevent filename " + + "filename flush for foreach format gets glob global history http if " + + "incr info interp join lappend lindex linsert list llength load lrange " + + "lreplace lsearch lset lsort memory msgcat namespace open package parray " + + "pid pkg::create pkg_mkIndex proc puts pwd re_syntax read regex regexp " + + "registry regsub rename resource return scan seek set socket source split " + + "string subst switch tcl_endOfWord tcl_findLibrary tcl_startOfNextWord " + + "tcl_wordBreakAfter tcl_startOfPreviousWord tcl_wordBreakBefore tcltest " + + "tclvars tell time trace unknown unset update uplevel upvar variable " + + "vwait"); + var functions = parseWords("if elseif else and not or eq ne in ni for foreach while switch"); + var isOperatorChar = /[+\-*&%=<>!?^\/\|]/; + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + + function tokenBase(stream, state) { + var beforeParams = state.beforeParams; + state.beforeParams = false; + var ch = stream.next(); + if ((ch == '"' || ch == "'") && state.inParams) + return chain(stream, state, tokenString(ch)); + else if (/[\[\]{}\(\),;\.]/.test(ch)) { + if (ch == "(" && beforeParams) state.inParams = true; + else if (ch == ")") state.inParams = false; + return null; + } else if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } else if (ch == "#" && stream.eat("*")) { + return chain(stream, state, tokenComment); + } else if (ch == "#" && stream.match(/ *\[ *\[/)) { + return chain(stream, state, tokenUnparsed); + } else if (ch == "#" && stream.eat("#")) { + stream.skipToEnd(); + return "comment"; + } else if (ch == '"') { + stream.skipTo(/"/); + return "comment"; + } else if (ch == "$") { + stream.eatWhile(/[$_a-z0-9A-Z\.{:]/); + stream.eatWhile(/}/); + state.beforeParams = true; + return "builtin"; + } else if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "comment"; + } else { + stream.eatWhile(/[\w\$_{}\xa1-\uffff]/); + var word = stream.current().toLowerCase(); + if (keywords && keywords.propertyIsEnumerable(word)) + return "keyword"; + if (functions && functions.propertyIsEnumerable(word)) { + state.beforeParams = true; + return "keyword"; + } + return null; + } + } + + function tokenString(quote) { + return function (stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) { + end = true; + break; + } + escaped = !escaped && next == "\\"; + } + if (end) state.tokenize = tokenBase; + return "string"; + }; } - escaped = !escaped && next == "\\"; - } - if (end) state.tokenize = tokenBase; - return "string"; - }; - } - function tokenComment(stream, state) { - var maybeEnd = false, ch; - while (ch = stream.next()) { - if (ch == "#" && maybeEnd) { - state.tokenize = tokenBase; - break; + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "#" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; } - maybeEnd = (ch == "*"); - } - return "comment"; - } - function tokenUnparsed(stream, state) { - var maybeEnd = 0, ch; - while (ch = stream.next()) { - if (ch == "#" && maybeEnd == 2) { - state.tokenize = tokenBase; - break; + + function tokenUnparsed(stream, state) { + var maybeEnd = 0, ch; + while (ch = stream.next()) { + if (ch == "#" && maybeEnd == 2) { + state.tokenize = tokenBase; + break; + } + if (ch == "]") + maybeEnd++; + else if (ch != " ") + maybeEnd = 0; + } + return "meta"; } - if (ch == "]") - maybeEnd++; - else if (ch != " ") - maybeEnd = 0; - } - return "meta"; - } - return { - startState: function() { + return { - tokenize: tokenBase, - beforeParams: false, - inParams: false + startState: function () { + return { + tokenize: tokenBase, + beforeParams: false, + inParams: false + }; + }, + token: function (stream, state) { + if (stream.eatSpace()) return null; + return state.tokenize(stream, state); + } }; - }, - token: function(stream, state) { - if (stream.eatSpace()) return null; - return state.tokenize(stream, state); - } - }; -}); -CodeMirror.defineMIME("text/x-tcl", "tcl"); + }); + CodeMirror.defineMIME("text/x-tcl", "tcl"); }); diff --git a/web/editor.md/lib/codemirror/mode/textile/index.html b/web/editor.md/lib/codemirror/mode/textile/index.html index 42b156b..6ce17af 100644 --- a/web/editor.md/lib/codemirror/mode/textile/index.html +++ b/web/editor.md/lib/codemirror/mode/textile/index.html @@ -2,24 +2,26 @@ CodeMirror: Textile mode - + - + - +
@@ -186,6 +188,7 @@

Title

MIME types defined: text/x-textile.

-

Parsing/Highlighting Tests: normal, verbose.

+

Parsing/Highlighting Tests: normal, verbose.

diff --git a/web/editor.md/lib/codemirror/mode/textile/test.js b/web/editor.md/lib/codemirror/mode/textile/test.js index 49cdaf9..c6468d0 100644 --- a/web/editor.md/lib/codemirror/mode/textile/test.js +++ b/web/editor.md/lib/codemirror/mode/textile/test.js @@ -1,417 +1,420 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function() { - var mode = CodeMirror.getMode({tabSize: 4}, 'textile'); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } +(function () { + var mode = CodeMirror.getMode({tabSize: 4}, 'textile'); - MT('simpleParagraphs', - 'Some text.', - '', - 'Some more text.'); + function MT(name) { + test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); + } - /* - * Phrase Modifiers - */ + MT('simpleParagraphs', + 'Some text.', + '', + 'Some more text.'); - MT('em', - 'foo [em _bar_]'); + /* + * Phrase Modifiers + */ - MT('emBoogus', - 'code_mirror'); + MT('em', + 'foo [em _bar_]'); - MT('strong', - 'foo [strong *bar*]'); + MT('emBoogus', + 'code_mirror'); - MT('strongBogus', - '3 * 3 = 9'); + MT('strong', + 'foo [strong *bar*]'); - MT('italic', - 'foo [em __bar__]'); + MT('strongBogus', + '3 * 3 = 9'); - MT('italicBogus', - 'code__mirror'); + MT('italic', + 'foo [em __bar__]'); - MT('bold', - 'foo [strong **bar**]'); + MT('italicBogus', + 'code__mirror'); - MT('boldBogus', - '3 ** 3 = 27'); + MT('bold', + 'foo [strong **bar**]'); - MT('simpleLink', - '[link "CodeMirror":http://codemirror.net]'); + MT('boldBogus', + '3 ** 3 = 27'); - MT('referenceLink', - '[link "CodeMirror":code_mirror]', - 'Normal Text.', - '[link [[code_mirror]]http://codemirror.net]'); + MT('simpleLink', + '[link "CodeMirror":http://codemirror.net]'); - MT('footCite', - 'foo bar[qualifier [[1]]]'); + MT('referenceLink', + '[link "CodeMirror":code_mirror]', + 'Normal Text.', + '[link [[code_mirror]]http://codemirror.net]'); - MT('footCiteBogus', - 'foo bar[[1a2]]'); + MT('footCite', + 'foo bar[qualifier [[1]]]'); - MT('special-characters', - 'Registered [tag (r)], ' + - 'Trademark [tag (tm)], and ' + - 'Copyright [tag (c)] 2008'); + MT('footCiteBogus', + 'foo bar[[1a2]]'); - MT('cite', - "A book is [keyword ??The Count of Monte Cristo??] by Dumas."); + MT('special-characters', + 'Registered [tag (r)], ' + + 'Trademark [tag (tm)], and ' + + 'Copyright [tag (c)] 2008'); - MT('additionAndDeletion', - 'The news networks declared [negative -Al Gore-] ' + + MT('cite', + "A book is [keyword ??The Count of Monte Cristo??] by Dumas."); + + MT('additionAndDeletion', + 'The news networks declared [negative -Al Gore-] ' + '[positive +George W. Bush+] the winner in Florida.'); - MT('subAndSup', - 'f(x, n) = log [builtin ~4~] x [builtin ^n^]'); + MT('subAndSup', + 'f(x, n) = log [builtin ~4~] x [builtin ^n^]'); - MT('spanAndCode', - 'A [quote %span element%] and [atom @code element@]'); + MT('spanAndCode', + 'A [quote %span element%] and [atom @code element@]'); - MT('spanBogus', - 'Percentage 25% is not a span.'); + MT('spanBogus', + 'Percentage 25% is not a span.'); - MT('citeBogus', - 'Question? is not a citation.'); + MT('citeBogus', + 'Question? is not a citation.'); - MT('codeBogus', - 'user@example.com'); + MT('codeBogus', + 'user@example.com'); - MT('subBogus', - '~username'); + MT('subBogus', + '~username'); - MT('supBogus', - 'foo ^ bar'); + MT('supBogus', + 'foo ^ bar'); - MT('deletionBogus', - '3 - 3 = 0'); + MT('deletionBogus', + '3 - 3 = 0'); - MT('additionBogus', - '3 + 3 = 6'); + MT('additionBogus', + '3 + 3 = 6'); - MT('image', - 'An image: [string !http://www.example.com/image.png!]'); + MT('image', + 'An image: [string !http://www.example.com/image.png!]'); - MT('imageWithAltText', - 'An image: [string !http://www.example.com/image.png (Alt Text)!]'); + MT('imageWithAltText', + 'An image: [string !http://www.example.com/image.png (Alt Text)!]'); - MT('imageWithUrl', - 'An image: [string !http://www.example.com/image.png!:http://www.example.com/]'); + MT('imageWithUrl', + 'An image: [string !http://www.example.com/image.png!:http://www.example.com/]'); - /* - * Headers - */ + /* + * Headers + */ - MT('h1', - '[header&header-1 h1. foo]'); + MT('h1', + '[header&header-1 h1. foo]'); - MT('h2', - '[header&header-2 h2. foo]'); + MT('h2', + '[header&header-2 h2. foo]'); - MT('h3', - '[header&header-3 h3. foo]'); + MT('h3', + '[header&header-3 h3. foo]'); - MT('h4', - '[header&header-4 h4. foo]'); + MT('h4', + '[header&header-4 h4. foo]'); - MT('h5', - '[header&header-5 h5. foo]'); + MT('h5', + '[header&header-5 h5. foo]'); - MT('h6', - '[header&header-6 h6. foo]'); + MT('h6', + '[header&header-6 h6. foo]'); - MT('h7Bogus', - 'h7. foo'); + MT('h7Bogus', + 'h7. foo'); - MT('multipleHeaders', - '[header&header-1 h1. Heading 1]', - '', - 'Some text.', - '', - '[header&header-2 h2. Heading 2]', - '', - 'More text.'); + MT('multipleHeaders', + '[header&header-1 h1. Heading 1]', + '', + 'Some text.', + '', + '[header&header-2 h2. Heading 2]', + '', + 'More text.'); - MT('h1inline', - '[header&header-1 h1. foo ][header&header-1&em _bar_][header&header-1 baz]'); + MT('h1inline', + '[header&header-1 h1. foo ][header&header-1&em _bar_][header&header-1 baz]'); - /* - * Lists - */ + /* + * Lists + */ - MT('ul', - 'foo', - 'bar', - '', - '[variable-2 * foo]', - '[variable-2 * bar]'); + MT('ul', + 'foo', + 'bar', + '', + '[variable-2 * foo]', + '[variable-2 * bar]'); - MT('ulNoBlank', - 'foo', - 'bar', - '[variable-2 * foo]', - '[variable-2 * bar]'); + MT('ulNoBlank', + 'foo', + 'bar', + '[variable-2 * foo]', + '[variable-2 * bar]'); - MT('ol', - 'foo', - 'bar', - '', - '[variable-2 # foo]', - '[variable-2 # bar]'); + MT('ol', + 'foo', + 'bar', + '', + '[variable-2 # foo]', + '[variable-2 # bar]'); - MT('olNoBlank', - 'foo', - 'bar', - '[variable-2 # foo]', - '[variable-2 # bar]'); + MT('olNoBlank', + 'foo', + 'bar', + '[variable-2 # foo]', + '[variable-2 # bar]'); - MT('ulFormatting', - '[variable-2 * ][variable-2&em _foo_][variable-2 bar]', - '[variable-2 * ][variable-2&strong *][variable-2&em&strong _foo_]' + + MT('ulFormatting', + '[variable-2 * ][variable-2&em _foo_][variable-2 bar]', + '[variable-2 * ][variable-2&strong *][variable-2&em&strong _foo_]' + '[variable-2&strong *][variable-2 bar]', - '[variable-2 * ][variable-2&strong *foo*][variable-2 bar]'); + '[variable-2 * ][variable-2&strong *foo*][variable-2 bar]'); - MT('olFormatting', - '[variable-2 # ][variable-2&em _foo_][variable-2 bar]', - '[variable-2 # ][variable-2&strong *][variable-2&em&strong _foo_]' + + MT('olFormatting', + '[variable-2 # ][variable-2&em _foo_][variable-2 bar]', + '[variable-2 # ][variable-2&strong *][variable-2&em&strong _foo_]' + '[variable-2&strong *][variable-2 bar]', - '[variable-2 # ][variable-2&strong *foo*][variable-2 bar]'); - - MT('ulNested', - '[variable-2 * foo]', - '[variable-3 ** bar]', - '[keyword *** bar]', - '[variable-2 **** bar]', - '[variable-3 ** bar]'); - - MT('olNested', - '[variable-2 # foo]', - '[variable-3 ## bar]', - '[keyword ### bar]', - '[variable-2 #### bar]', - '[variable-3 ## bar]'); - - MT('ulNestedWithOl', - '[variable-2 * foo]', - '[variable-3 ## bar]', - '[keyword *** bar]', - '[variable-2 #### bar]', - '[variable-3 ** bar]'); - - MT('olNestedWithUl', - '[variable-2 # foo]', - '[variable-3 ** bar]', - '[keyword ### bar]', - '[variable-2 **** bar]', - '[variable-3 ## bar]'); - - MT('definitionList', - '[number - coffee := Hot ][number&em _and_][number black]', - '', - 'Normal text.'); - - MT('definitionListSpan', - '[number - coffee :=]', - '', - '[number Hot ][number&em _and_][number black =:]', - '', - 'Normal text.'); - - MT('boo', - '[number - dog := woof woof]', - '[number - cat := meow meow]', - '[number - whale :=]', - '[number Whale noises.]', - '', - '[number Also, ][number&em _splashing_][number . =:]'); - - /* - * Attributes - */ - - MT('divWithAttribute', - '[punctuation div][punctuation&attribute (#my-id)][punctuation . foo bar]'); - - MT('divWithAttributeAnd2emRightPadding', - '[punctuation div][punctuation&attribute (#my-id)((][punctuation . foo bar]'); - - MT('divWithClassAndId', - '[punctuation div][punctuation&attribute (my-class#my-id)][punctuation . foo bar]'); - - MT('paragraphWithCss', - 'p[attribute {color:red;}]. foo bar'); - - MT('paragraphNestedStyles', - 'p. [strong *foo ][strong&em _bar_][strong *]'); - - MT('paragraphWithLanguage', - 'p[attribute [[fr]]]. Parlez-vous français?'); - - MT('paragraphLeftAlign', - 'p[attribute <]. Left'); - - MT('paragraphRightAlign', - 'p[attribute >]. Right'); - - MT('paragraphRightAlign', - 'p[attribute =]. Center'); - - MT('paragraphJustified', - 'p[attribute <>]. Justified'); - - MT('paragraphWithLeftIndent1em', - 'p[attribute (]. Left'); - - MT('paragraphWithRightIndent1em', - 'p[attribute )]. Right'); - - MT('paragraphWithLeftIndent2em', - 'p[attribute ((]. Left'); - - MT('paragraphWithRightIndent2em', - 'p[attribute ))]. Right'); - - MT('paragraphWithLeftIndent3emRightIndent2em', - 'p[attribute ((())]. Right'); - - MT('divFormatting', - '[punctuation div. ][punctuation&strong *foo ]' + + '[variable-2 # ][variable-2&strong *foo*][variable-2 bar]'); + + MT('ulNested', + '[variable-2 * foo]', + '[variable-3 ** bar]', + '[keyword *** bar]', + '[variable-2 **** bar]', + '[variable-3 ** bar]'); + + MT('olNested', + '[variable-2 # foo]', + '[variable-3 ## bar]', + '[keyword ### bar]', + '[variable-2 #### bar]', + '[variable-3 ## bar]'); + + MT('ulNestedWithOl', + '[variable-2 * foo]', + '[variable-3 ## bar]', + '[keyword *** bar]', + '[variable-2 #### bar]', + '[variable-3 ** bar]'); + + MT('olNestedWithUl', + '[variable-2 # foo]', + '[variable-3 ** bar]', + '[keyword ### bar]', + '[variable-2 **** bar]', + '[variable-3 ## bar]'); + + MT('definitionList', + '[number - coffee := Hot ][number&em _and_][number black]', + '', + 'Normal text.'); + + MT('definitionListSpan', + '[number - coffee :=]', + '', + '[number Hot ][number&em _and_][number black =:]', + '', + 'Normal text.'); + + MT('boo', + '[number - dog := woof woof]', + '[number - cat := meow meow]', + '[number - whale :=]', + '[number Whale noises.]', + '', + '[number Also, ][number&em _splashing_][number . =:]'); + + /* + * Attributes + */ + + MT('divWithAttribute', + '[punctuation div][punctuation&attribute (#my-id)][punctuation . foo bar]'); + + MT('divWithAttributeAnd2emRightPadding', + '[punctuation div][punctuation&attribute (#my-id)((][punctuation . foo bar]'); + + MT('divWithClassAndId', + '[punctuation div][punctuation&attribute (my-class#my-id)][punctuation . foo bar]'); + + MT('paragraphWithCss', + 'p[attribute {color:red;}]. foo bar'); + + MT('paragraphNestedStyles', + 'p. [strong *foo ][strong&em _bar_][strong *]'); + + MT('paragraphWithLanguage', + 'p[attribute [[fr]]]. Parlez-vous français?'); + + MT('paragraphLeftAlign', + 'p[attribute <]. Left'); + + MT('paragraphRightAlign', + 'p[attribute >]. Right'); + + MT('paragraphRightAlign', + 'p[attribute =]. Center'); + + MT('paragraphJustified', + 'p[attribute <>]. Justified'); + + MT('paragraphWithLeftIndent1em', + 'p[attribute (]. Left'); + + MT('paragraphWithRightIndent1em', + 'p[attribute )]. Right'); + + MT('paragraphWithLeftIndent2em', + 'p[attribute ((]. Left'); + + MT('paragraphWithRightIndent2em', + 'p[attribute ))]. Right'); + + MT('paragraphWithLeftIndent3emRightIndent2em', + 'p[attribute ((())]. Right'); + + MT('divFormatting', + '[punctuation div. ][punctuation&strong *foo ]' + '[punctuation&strong&em _bar_][punctuation&strong *]'); - MT('phraseModifierAttributes', - 'p[attribute (my-class)]. This is a paragraph that has a class and' + - ' this [em _][em&attribute (#special-phrase)][em emphasized phrase_]' + - ' has an id.'); - - MT('linkWithClass', - '[link "(my-class). This is a link with class":http://redcloth.org]'); - - /* - * Layouts - */ - - MT('paragraphLayouts', - 'p. This is one paragraph.', - '', - 'p. This is another.'); - - MT('div', - '[punctuation div. foo bar]'); - - MT('pre', - '[operator pre. Text]'); - - MT('bq.', - '[bracket bq. foo bar]', - '', - 'Normal text.'); - - MT('footnote', - '[variable fn123. foo ][variable&strong *bar*]'); - - /* - * Spanning Layouts - */ - - MT('bq..ThenParagraph', - '[bracket bq.. foo bar]', - '', - '[bracket More quote.]', - 'p. Normal Text'); - - MT('bq..ThenH1', - '[bracket bq.. foo bar]', - '', - '[bracket More quote.]', - '[header&header-1 h1. Header Text]'); - - MT('bc..ThenParagraph', - '[atom bc.. # Some ruby code]', - '[atom obj = {foo: :bar}]', - '[atom puts obj]', - '', - '[atom obj[[:love]] = "*love*"]', - '[atom puts obj.love.upcase]', - '', - 'p. Normal text.'); - - MT('fn1..ThenParagraph', - '[variable fn1.. foo bar]', - '', - '[variable More.]', - 'p. Normal Text'); - - MT('pre..ThenParagraph', - '[operator pre.. foo bar]', - '', - '[operator More.]', - 'p. Normal Text'); - - /* - * Tables - */ - - MT('table', - '[variable-3&operator |_. name |_. age|]', - '[variable-3 |][variable-3&strong *Walter*][variable-3 | 5 |]', - '[variable-3 |Florence| 6 |]', - '', - 'p. Normal text.'); - - MT('tableWithAttributes', - '[variable-3&operator |_. name |_. age|]', - '[variable-3 |][variable-3&attribute /2.][variable-3 Jim |]', - '[variable-3 |][variable-3&attribute \\2{color: red}.][variable-3 Sam |]'); - - /* - * HTML - */ - - MT('html', - '[comment
]', - '[comment
]', - '', - '[header&header-1 h1. Welcome]', - '', - '[variable-2 * Item one]', - '[variable-2 * Item two]', - '', - '[comment Example]', - '', - '[comment
]', - '[comment
]'); - - MT('inlineHtml', - 'I can use HTML directly in my [comment Textile].'); - - /* - * No-Textile - */ - - MT('notextile', - '[string-2 notextile. *No* formatting]'); - - MT('notextileInline', - 'Use [string-2 ==*asterisks*==] for [strong *strong*] text.'); - - MT('notextileWithPre', - '[operator pre. *No* formatting]'); - - MT('notextileWithSpanningPre', - '[operator pre.. *No* formatting]', - '', - '[operator *No* formatting]'); - - /* Only toggling phrases between non-word chars. */ - - MT('phrase-in-word', - 'foo_bar_baz'); - - MT('phrase-non-word', - '[negative -x-] aaa-bbb ccc-ddd [negative -eee-] fff [negative -ggg-]'); - - MT('phrase-lone-dash', - 'foo - bar - baz'); + MT('phraseModifierAttributes', + 'p[attribute (my-class)]. This is a paragraph that has a class and' + + ' this [em _][em&attribute (#special-phrase)][em emphasized phrase_]' + + ' has an id.'); + + MT('linkWithClass', + '[link "(my-class). This is a link with class":http://redcloth.org]'); + + /* + * Layouts + */ + + MT('paragraphLayouts', + 'p. This is one paragraph.', + '', + 'p. This is another.'); + + MT('div', + '[punctuation div. foo bar]'); + + MT('pre', + '[operator pre. Text]'); + + MT('bq.', + '[bracket bq. foo bar]', + '', + 'Normal text.'); + + MT('footnote', + '[variable fn123. foo ][variable&strong *bar*]'); + + /* + * Spanning Layouts + */ + + MT('bq..ThenParagraph', + '[bracket bq.. foo bar]', + '', + '[bracket More quote.]', + 'p. Normal Text'); + + MT('bq..ThenH1', + '[bracket bq.. foo bar]', + '', + '[bracket More quote.]', + '[header&header-1 h1. Header Text]'); + + MT('bc..ThenParagraph', + '[atom bc.. # Some ruby code]', + '[atom obj = {foo: :bar}]', + '[atom puts obj]', + '', + '[atom obj[[:love]] = "*love*"]', + '[atom puts obj.love.upcase]', + '', + 'p. Normal text.'); + + MT('fn1..ThenParagraph', + '[variable fn1.. foo bar]', + '', + '[variable More.]', + 'p. Normal Text'); + + MT('pre..ThenParagraph', + '[operator pre.. foo bar]', + '', + '[operator More.]', + 'p. Normal Text'); + + /* + * Tables + */ + + MT('table', + '[variable-3&operator |_. name |_. age|]', + '[variable-3 |][variable-3&strong *Walter*][variable-3 | 5 |]', + '[variable-3 |Florence| 6 |]', + '', + 'p. Normal text.'); + + MT('tableWithAttributes', + '[variable-3&operator |_. name |_. age|]', + '[variable-3 |][variable-3&attribute /2.][variable-3 Jim |]', + '[variable-3 |][variable-3&attribute \\2{color: red}.][variable-3 Sam |]'); + + /* + * HTML + */ + + MT('html', + '[comment
]', + '[comment
]', + '', + '[header&header-1 h1. Welcome]', + '', + '[variable-2 * Item one]', + '[variable-2 * Item two]', + '', + '[comment Example]', + '', + '[comment
]', + '[comment
]'); + + MT('inlineHtml', + 'I can use HTML directly in my [comment Textile].'); + + /* + * No-Textile + */ + + MT('notextile', + '[string-2 notextile. *No* formatting]'); + + MT('notextileInline', + 'Use [string-2 ==*asterisks*==] for [strong *strong*] text.'); + + MT('notextileWithPre', + '[operator pre. *No* formatting]'); + + MT('notextileWithSpanningPre', + '[operator pre.. *No* formatting]', + '', + '[operator *No* formatting]'); + + /* Only toggling phrases between non-word chars. */ + + MT('phrase-in-word', + 'foo_bar_baz'); + + MT('phrase-non-word', + '[negative -x-] aaa-bbb ccc-ddd [negative -eee-] fff [negative -ggg-]'); + + MT('phrase-lone-dash', + 'foo - bar - baz'); })(); diff --git a/web/editor.md/lib/codemirror/mode/textile/textile.js b/web/editor.md/lib/codemirror/mode/textile/textile.js index a6f7576..c65db6c 100644 --- a/web/editor.md/lib/codemirror/mode/textile/textile.js +++ b/web/editor.md/lib/codemirror/mode/textile/textile.js @@ -1,469 +1,469 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") { // CommonJS - mod(require("../../lib/codemirror")); - } else if (typeof define == "function" && define.amd) { // AMD - define(["../../lib/codemirror"], mod); - } else { // Plain browser env - mod(CodeMirror); - } -})(function(CodeMirror) { - "use strict"; - - var TOKEN_STYLES = { - addition: "positive", - attributes: "attribute", - bold: "strong", - cite: "keyword", - code: "atom", - definitionList: "number", - deletion: "negative", - div: "punctuation", - em: "em", - footnote: "variable", - footCite: "qualifier", - header: "header", - html: "comment", - image: "string", - italic: "em", - link: "link", - linkDefinition: "link", - list1: "variable-2", - list2: "variable-3", - list3: "keyword", - notextile: "string-2", - pre: "operator", - p: "property", - quote: "bracket", - span: "quote", - specialChar: "tag", - strong: "strong", - sub: "builtin", - sup: "builtin", - table: "variable-3", - tableHeading: "operator" - }; - - function startNewLine(stream, state) { - state.mode = Modes.newLayout; - state.tableHeading = false; - - if (state.layoutType === "definitionList" && state.spanningLayout && - stream.match(RE("definitionListEnd"), false)) - state.spanningLayout = false; - } - - function handlePhraseModifier(stream, state, ch) { - if (ch === "_") { - if (stream.eat("_")) - return togglePhraseModifier(stream, state, "italic", /__/, 2); - else - return togglePhraseModifier(stream, state, "em", /_/, 1); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") { // CommonJS + mod(require("../../lib/codemirror")); + } else if (typeof define == "function" && define.amd) { // AMD + define(["../../lib/codemirror"], mod); + } else { // Plain browser env + mod(CodeMirror); } +})(function (CodeMirror) { + "use strict"; + + var TOKEN_STYLES = { + addition: "positive", + attributes: "attribute", + bold: "strong", + cite: "keyword", + code: "atom", + definitionList: "number", + deletion: "negative", + div: "punctuation", + em: "em", + footnote: "variable", + footCite: "qualifier", + header: "header", + html: "comment", + image: "string", + italic: "em", + link: "link", + linkDefinition: "link", + list1: "variable-2", + list2: "variable-3", + list3: "keyword", + notextile: "string-2", + pre: "operator", + p: "property", + quote: "bracket", + span: "quote", + specialChar: "tag", + strong: "strong", + sub: "builtin", + sup: "builtin", + table: "variable-3", + tableHeading: "operator" + }; - if (ch === "*") { - if (stream.eat("*")) { - return togglePhraseModifier(stream, state, "bold", /\*\*/, 2); - } - return togglePhraseModifier(stream, state, "strong", /\*/, 1); - } + function startNewLine(stream, state) { + state.mode = Modes.newLayout; + state.tableHeading = false; - if (ch === "[") { - if (stream.match(/\d+\]/)) state.footCite = true; - return tokenStyles(state); + if (state.layoutType === "definitionList" && state.spanningLayout && + stream.match(RE("definitionListEnd"), false)) + state.spanningLayout = false; } - if (ch === "(") { - var spec = stream.match(/^(r|tm|c)\)/); - if (spec) - return tokenStylesWith(state, TOKEN_STYLES.specialChar); - } + function handlePhraseModifier(stream, state, ch) { + if (ch === "_") { + if (stream.eat("_")) + return togglePhraseModifier(stream, state, "italic", /__/, 2); + else + return togglePhraseModifier(stream, state, "em", /_/, 1); + } - if (ch === "<" && stream.match(/(\w+)[^>]+>[^<]+<\/\1>/)) - return tokenStylesWith(state, TOKEN_STYLES.html); + if (ch === "*") { + if (stream.eat("*")) { + return togglePhraseModifier(stream, state, "bold", /\*\*/, 2); + } + return togglePhraseModifier(stream, state, "strong", /\*/, 1); + } - if (ch === "?" && stream.eat("?")) - return togglePhraseModifier(stream, state, "cite", /\?\?/, 2); + if (ch === "[") { + if (stream.match(/\d+\]/)) state.footCite = true; + return tokenStyles(state); + } - if (ch === "=" && stream.eat("=")) - return togglePhraseModifier(stream, state, "notextile", /==/, 2); + if (ch === "(") { + var spec = stream.match(/^(r|tm|c)\)/); + if (spec) + return tokenStylesWith(state, TOKEN_STYLES.specialChar); + } - if (ch === "-" && !stream.eat("-")) - return togglePhraseModifier(stream, state, "deletion", /-/, 1); + if (ch === "<" && stream.match(/(\w+)[^>]+>[^<]+<\/\1>/)) + return tokenStylesWith(state, TOKEN_STYLES.html); - if (ch === "+") - return togglePhraseModifier(stream, state, "addition", /\+/, 1); + if (ch === "?" && stream.eat("?")) + return togglePhraseModifier(stream, state, "cite", /\?\?/, 2); - if (ch === "~") - return togglePhraseModifier(stream, state, "sub", /~/, 1); + if (ch === "=" && stream.eat("=")) + return togglePhraseModifier(stream, state, "notextile", /==/, 2); - if (ch === "^") - return togglePhraseModifier(stream, state, "sup", /\^/, 1); + if (ch === "-" && !stream.eat("-")) + return togglePhraseModifier(stream, state, "deletion", /-/, 1); - if (ch === "%") - return togglePhraseModifier(stream, state, "span", /%/, 1); + if (ch === "+") + return togglePhraseModifier(stream, state, "addition", /\+/, 1); - if (ch === "@") - return togglePhraseModifier(stream, state, "code", /@/, 1); + if (ch === "~") + return togglePhraseModifier(stream, state, "sub", /~/, 1); - if (ch === "!") { - var type = togglePhraseModifier(stream, state, "image", /(?:\([^\)]+\))?!/, 1); - stream.match(/^:\S+/); // optional Url portion - return type; - } - return tokenStyles(state); - } - - function togglePhraseModifier(stream, state, phraseModifier, closeRE, openSize) { - var charBefore = stream.pos > openSize ? stream.string.charAt(stream.pos - openSize - 1) : null; - var charAfter = stream.peek(); - if (state[phraseModifier]) { - if ((!charAfter || /\W/.test(charAfter)) && charBefore && /\S/.test(charBefore)) { - var type = tokenStyles(state); - state[phraseModifier] = false; - return type; - } - } else if ((!charBefore || /\W/.test(charBefore)) && charAfter && /\S/.test(charAfter) && - stream.match(new RegExp("^.*\\S" + closeRE.source + "(?:\\W|$)"), false)) { - state[phraseModifier] = true; - state.mode = Modes.attributes; + if (ch === "^") + return togglePhraseModifier(stream, state, "sup", /\^/, 1); + + if (ch === "%") + return togglePhraseModifier(stream, state, "span", /%/, 1); + + if (ch === "@") + return togglePhraseModifier(stream, state, "code", /@/, 1); + + if (ch === "!") { + var type = togglePhraseModifier(stream, state, "image", /(?:\([^\)]+\))?!/, 1); + stream.match(/^:\S+/); // optional Url portion + return type; + } + return tokenStyles(state); } - return tokenStyles(state); - }; - - function tokenStyles(state) { - var disabled = textileDisabled(state); - if (disabled) return disabled; - - var styles = []; - if (state.layoutType) styles.push(TOKEN_STYLES[state.layoutType]); - - styles = styles.concat(activeStyles( - state, "addition", "bold", "cite", "code", "deletion", "em", "footCite", - "image", "italic", "link", "span", "strong", "sub", "sup", "table", "tableHeading")); - - if (state.layoutType === "header") - styles.push(TOKEN_STYLES.header + "-" + state.header); - - return styles.length ? styles.join(" ") : null; - } - - function textileDisabled(state) { - var type = state.layoutType; - - switch(type) { - case "notextile": - case "code": - case "pre": - return TOKEN_STYLES[type]; - default: - if (state.notextile) - return TOKEN_STYLES.notextile + (type ? (" " + TOKEN_STYLES[type]) : ""); - return null; + + function togglePhraseModifier(stream, state, phraseModifier, closeRE, openSize) { + var charBefore = stream.pos > openSize ? stream.string.charAt(stream.pos - openSize - 1) : null; + var charAfter = stream.peek(); + if (state[phraseModifier]) { + if ((!charAfter || /\W/.test(charAfter)) && charBefore && /\S/.test(charBefore)) { + var type = tokenStyles(state); + state[phraseModifier] = false; + return type; + } + } else if ((!charBefore || /\W/.test(charBefore)) && charAfter && /\S/.test(charAfter) && + stream.match(new RegExp("^.*\\S" + closeRE.source + "(?:\\W|$)"), false)) { + state[phraseModifier] = true; + state.mode = Modes.attributes; + } + return tokenStyles(state); + }; + + function tokenStyles(state) { + var disabled = textileDisabled(state); + if (disabled) return disabled; + + var styles = []; + if (state.layoutType) styles.push(TOKEN_STYLES[state.layoutType]); + + styles = styles.concat(activeStyles( + state, "addition", "bold", "cite", "code", "deletion", "em", "footCite", + "image", "italic", "link", "span", "strong", "sub", "sup", "table", "tableHeading")); + + if (state.layoutType === "header") + styles.push(TOKEN_STYLES.header + "-" + state.header); + + return styles.length ? styles.join(" ") : null; } - } - - function tokenStylesWith(state, extraStyles) { - var disabled = textileDisabled(state); - if (disabled) return disabled; - - var type = tokenStyles(state); - if (extraStyles) - return type ? (type + " " + extraStyles) : extraStyles; - else - return type; - } - - function activeStyles(state) { - var styles = []; - for (var i = 1; i < arguments.length; ++i) { - if (state[arguments[i]]) - styles.push(TOKEN_STYLES[arguments[i]]); + + function textileDisabled(state) { + var type = state.layoutType; + + switch (type) { + case "notextile": + case "code": + case "pre": + return TOKEN_STYLES[type]; + default: + if (state.notextile) + return TOKEN_STYLES.notextile + (type ? (" " + TOKEN_STYLES[type]) : ""); + return null; + } } - return styles; - } - function blankLine(state) { - var spanningLayout = state.spanningLayout, type = state.layoutType; + function tokenStylesWith(state, extraStyles) { + var disabled = textileDisabled(state); + if (disabled) return disabled; - for (var key in state) if (state.hasOwnProperty(key)) - delete state[key]; + var type = tokenStyles(state); + if (extraStyles) + return type ? (type + " " + extraStyles) : extraStyles; + else + return type; + } - state.mode = Modes.newLayout; - if (spanningLayout) { - state.layoutType = type; - state.spanningLayout = true; + function activeStyles(state) { + var styles = []; + for (var i = 1; i < arguments.length; ++i) { + if (state[arguments[i]]) + styles.push(TOKEN_STYLES[arguments[i]]); + } + return styles; } - } - - var REs = { - cache: {}, - single: { - bc: "bc", - bq: "bq", - definitionList: /- [^(?::=)]+:=+/, - definitionListEnd: /.*=:\s*$/, - div: "div", - drawTable: /\|.*\|/, - foot: /fn\d+/, - header: /h[1-6]/, - html: /\s*<(?:\/)?(\w+)(?:[^>]+)?>(?:[^<]+<\/\1>)?/, - link: /[^"]+":\S/, - linkDefinition: /\[[^\s\]]+\]\S+/, - list: /(?:#+|\*+)/, - notextile: "notextile", - para: "p", - pre: "pre", - table: "table", - tableCellAttributes: /[\/\\]\d+/, - tableHeading: /\|_\./, - tableText: /[^"_\*\[\(\?\+~\^%@|-]+/, - text: /[^!"_=\*\[\(<\?\+~\^%@-]+/ - }, - attributes: { - align: /(?:<>|<|>|=)/, - selector: /\([^\(][^\)]+\)/, - lang: /\[[^\[\]]+\]/, - pad: /(?:\(+|\)+){1,2}/, - css: /\{[^\}]+\}/ - }, - createRe: function(name) { - switch (name) { - case "drawTable": - return REs.makeRe("^", REs.single.drawTable, "$"); - case "html": - return REs.makeRe("^", REs.single.html, "(?:", REs.single.html, ")*", "$"); - case "linkDefinition": - return REs.makeRe("^", REs.single.linkDefinition, "$"); - case "listLayout": - return REs.makeRe("^", REs.single.list, RE("allAttributes"), "*\\s+"); - case "tableCellAttributes": - return REs.makeRe("^", REs.choiceRe(REs.single.tableCellAttributes, - RE("allAttributes")), "+\\."); - case "type": - return REs.makeRe("^", RE("allTypes")); - case "typeLayout": - return REs.makeRe("^", RE("allTypes"), RE("allAttributes"), - "*\\.\\.?", "(\\s+|$)"); - case "attributes": - return REs.makeRe("^", RE("allAttributes"), "+"); - - case "allTypes": - return REs.choiceRe(REs.single.div, REs.single.foot, - REs.single.header, REs.single.bc, REs.single.bq, - REs.single.notextile, REs.single.pre, REs.single.table, - REs.single.para); - - case "allAttributes": - return REs.choiceRe(REs.attributes.selector, REs.attributes.css, - REs.attributes.lang, REs.attributes.align, REs.attributes.pad); - - default: - return REs.makeRe("^", REs.single[name]); - } - }, - makeRe: function() { - var pattern = ""; - for (var i = 0; i < arguments.length; ++i) { - var arg = arguments[i]; - pattern += (typeof arg === "string") ? arg : arg.source; - } - return new RegExp(pattern); - }, - choiceRe: function() { - var parts = [arguments[0]]; - for (var i = 1; i < arguments.length; ++i) { - parts[i * 2 - 1] = "|"; - parts[i * 2] = arguments[i]; - } - - parts.unshift("(?:"); - parts.push(")"); - return REs.makeRe.apply(null, parts); + + function blankLine(state) { + var spanningLayout = state.spanningLayout, type = state.layoutType; + + for (var key in state) if (state.hasOwnProperty(key)) + delete state[key]; + + state.mode = Modes.newLayout; + if (spanningLayout) { + state.layoutType = type; + state.spanningLayout = true; + } } - }; - - function RE(name) { - return (REs.cache[name] || (REs.cache[name] = REs.createRe(name))); - } - - var Modes = { - newLayout: function(stream, state) { - if (stream.match(RE("typeLayout"), false)) { - state.spanningLayout = false; - return (state.mode = Modes.blockType)(stream, state); - } - var newMode; - if (!textileDisabled(state)) { - if (stream.match(RE("listLayout"), false)) - newMode = Modes.list; - else if (stream.match(RE("drawTable"), false)) - newMode = Modes.table; - else if (stream.match(RE("linkDefinition"), false)) - newMode = Modes.linkDefinition; - else if (stream.match(RE("definitionList"))) - newMode = Modes.definitionList; - else if (stream.match(RE("html"), false)) - newMode = Modes.html; - } - return (state.mode = (newMode || Modes.text))(stream, state); - }, - - blockType: function(stream, state) { - var match, type; - state.layoutType = null; - - if (match = stream.match(RE("type"))) - type = match[0]; - else - return (state.mode = Modes.text)(stream, state); - - if (match = type.match(RE("header"))) { - state.layoutType = "header"; - state.header = parseInt(match[0][1]); - } else if (type.match(RE("bq"))) { - state.layoutType = "quote"; - } else if (type.match(RE("bc"))) { - state.layoutType = "code"; - } else if (type.match(RE("foot"))) { - state.layoutType = "footnote"; - } else if (type.match(RE("notextile"))) { - state.layoutType = "notextile"; - } else if (type.match(RE("pre"))) { - state.layoutType = "pre"; - } else if (type.match(RE("div"))) { - state.layoutType = "div"; - } else if (type.match(RE("table"))) { - state.layoutType = "table"; - } - - state.mode = Modes.attributes; - return tokenStyles(state); - }, - - text: function(stream, state) { - if (stream.match(RE("text"))) return tokenStyles(state); - - var ch = stream.next(); - if (ch === '"') - return (state.mode = Modes.link)(stream, state); - return handlePhraseModifier(stream, state, ch); - }, - - attributes: function(stream, state) { - state.mode = Modes.layoutLength; - - if (stream.match(RE("attributes"))) - return tokenStylesWith(state, TOKEN_STYLES.attributes); - else - return tokenStyles(state); - }, - - layoutLength: function(stream, state) { - if (stream.eat(".") && stream.eat(".")) - state.spanningLayout = true; - - state.mode = Modes.text; - return tokenStyles(state); - }, - - list: function(stream, state) { - var match = stream.match(RE("list")); - state.listDepth = match[0].length; - var listMod = (state.listDepth - 1) % 3; - if (!listMod) - state.layoutType = "list1"; - else if (listMod === 1) - state.layoutType = "list2"; - else - state.layoutType = "list3"; - - state.mode = Modes.attributes; - return tokenStyles(state); - }, - - link: function(stream, state) { - state.mode = Modes.text; - if (stream.match(RE("link"))) { - stream.match(/\S+/); - return tokenStylesWith(state, TOKEN_STYLES.link); - } - return tokenStyles(state); - }, - - linkDefinition: function(stream, state) { - stream.skipToEnd(); - return tokenStylesWith(state, TOKEN_STYLES.linkDefinition); - }, - - definitionList: function(stream, state) { - stream.match(RE("definitionList")); - - state.layoutType = "definitionList"; - - if (stream.match(/\s*$/)) - state.spanningLayout = true; - else - state.mode = Modes.attributes; - - return tokenStyles(state); - }, - - html: function(stream, state) { - stream.skipToEnd(); - return tokenStylesWith(state, TOKEN_STYLES.html); - }, - - table: function(stream, state) { - state.layoutType = "table"; - return (state.mode = Modes.tableCell)(stream, state); - }, - - tableCell: function(stream, state) { - if (stream.match(RE("tableHeading"))) - state.tableHeading = true; - else - stream.eat("|"); - - state.mode = Modes.tableCellAttributes; - return tokenStyles(state); - }, - - tableCellAttributes: function(stream, state) { - state.mode = Modes.tableText; - - if (stream.match(RE("tableCellAttributes"))) - return tokenStylesWith(state, TOKEN_STYLES.attributes); - else - return tokenStyles(state); - }, - tableText: function(stream, state) { - if (stream.match(RE("tableText"))) - return tokenStyles(state); + var REs = { + cache: {}, + single: { + bc: "bc", + bq: "bq", + definitionList: /- [^(?::=)]+:=+/, + definitionListEnd: /.*=:\s*$/, + div: "div", + drawTable: /\|.*\|/, + foot: /fn\d+/, + header: /h[1-6]/, + html: /\s*<(?:\/)?(\w+)(?:[^>]+)?>(?:[^<]+<\/\1>)?/, + link: /[^"]+":\S/, + linkDefinition: /\[[^\s\]]+\]\S+/, + list: /(?:#+|\*+)/, + notextile: "notextile", + para: "p", + pre: "pre", + table: "table", + tableCellAttributes: /[\/\\]\d+/, + tableHeading: /\|_\./, + tableText: /[^"_\*\[\(\?\+~\^%@|-]+/, + text: /[^!"_=\*\[\(<\?\+~\^%@-]+/ + }, + attributes: { + align: /(?:<>|<|>|=)/, + selector: /\([^\(][^\)]+\)/, + lang: /\[[^\[\]]+\]/, + pad: /(?:\(+|\)+){1,2}/, + css: /\{[^\}]+\}/ + }, + createRe: function (name) { + switch (name) { + case "drawTable": + return REs.makeRe("^", REs.single.drawTable, "$"); + case "html": + return REs.makeRe("^", REs.single.html, "(?:", REs.single.html, ")*", "$"); + case "linkDefinition": + return REs.makeRe("^", REs.single.linkDefinition, "$"); + case "listLayout": + return REs.makeRe("^", REs.single.list, RE("allAttributes"), "*\\s+"); + case "tableCellAttributes": + return REs.makeRe("^", REs.choiceRe(REs.single.tableCellAttributes, + RE("allAttributes")), "+\\."); + case "type": + return REs.makeRe("^", RE("allTypes")); + case "typeLayout": + return REs.makeRe("^", RE("allTypes"), RE("allAttributes"), + "*\\.\\.?", "(\\s+|$)"); + case "attributes": + return REs.makeRe("^", RE("allAttributes"), "+"); + + case "allTypes": + return REs.choiceRe(REs.single.div, REs.single.foot, + REs.single.header, REs.single.bc, REs.single.bq, + REs.single.notextile, REs.single.pre, REs.single.table, + REs.single.para); + + case "allAttributes": + return REs.choiceRe(REs.attributes.selector, REs.attributes.css, + REs.attributes.lang, REs.attributes.align, REs.attributes.pad); + + default: + return REs.makeRe("^", REs.single[name]); + } + }, + makeRe: function () { + var pattern = ""; + for (var i = 0; i < arguments.length; ++i) { + var arg = arguments[i]; + pattern += (typeof arg === "string") ? arg : arg.source; + } + return new RegExp(pattern); + }, + choiceRe: function () { + var parts = [arguments[0]]; + for (var i = 1; i < arguments.length; ++i) { + parts[i * 2 - 1] = "|"; + parts[i * 2] = arguments[i]; + } + + parts.unshift("(?:"); + parts.push(")"); + return REs.makeRe.apply(null, parts); + } + }; - if (stream.peek() === "|") { // end of cell - state.mode = Modes.tableCell; - return tokenStyles(state); - } - return handlePhraseModifier(stream, state, stream.next()); + function RE(name) { + return (REs.cache[name] || (REs.cache[name] = REs.createRe(name))); } - }; - - CodeMirror.defineMode("textile", function() { - return { - startState: function() { - return { mode: Modes.newLayout }; - }, - token: function(stream, state) { - if (stream.sol()) startNewLine(stream, state); - return state.mode(stream, state); - }, - blankLine: blankLine + + var Modes = { + newLayout: function (stream, state) { + if (stream.match(RE("typeLayout"), false)) { + state.spanningLayout = false; + return (state.mode = Modes.blockType)(stream, state); + } + var newMode; + if (!textileDisabled(state)) { + if (stream.match(RE("listLayout"), false)) + newMode = Modes.list; + else if (stream.match(RE("drawTable"), false)) + newMode = Modes.table; + else if (stream.match(RE("linkDefinition"), false)) + newMode = Modes.linkDefinition; + else if (stream.match(RE("definitionList"))) + newMode = Modes.definitionList; + else if (stream.match(RE("html"), false)) + newMode = Modes.html; + } + return (state.mode = (newMode || Modes.text))(stream, state); + }, + + blockType: function (stream, state) { + var match, type; + state.layoutType = null; + + if (match = stream.match(RE("type"))) + type = match[0]; + else + return (state.mode = Modes.text)(stream, state); + + if (match = type.match(RE("header"))) { + state.layoutType = "header"; + state.header = parseInt(match[0][1]); + } else if (type.match(RE("bq"))) { + state.layoutType = "quote"; + } else if (type.match(RE("bc"))) { + state.layoutType = "code"; + } else if (type.match(RE("foot"))) { + state.layoutType = "footnote"; + } else if (type.match(RE("notextile"))) { + state.layoutType = "notextile"; + } else if (type.match(RE("pre"))) { + state.layoutType = "pre"; + } else if (type.match(RE("div"))) { + state.layoutType = "div"; + } else if (type.match(RE("table"))) { + state.layoutType = "table"; + } + + state.mode = Modes.attributes; + return tokenStyles(state); + }, + + text: function (stream, state) { + if (stream.match(RE("text"))) return tokenStyles(state); + + var ch = stream.next(); + if (ch === '"') + return (state.mode = Modes.link)(stream, state); + return handlePhraseModifier(stream, state, ch); + }, + + attributes: function (stream, state) { + state.mode = Modes.layoutLength; + + if (stream.match(RE("attributes"))) + return tokenStylesWith(state, TOKEN_STYLES.attributes); + else + return tokenStyles(state); + }, + + layoutLength: function (stream, state) { + if (stream.eat(".") && stream.eat(".")) + state.spanningLayout = true; + + state.mode = Modes.text; + return tokenStyles(state); + }, + + list: function (stream, state) { + var match = stream.match(RE("list")); + state.listDepth = match[0].length; + var listMod = (state.listDepth - 1) % 3; + if (!listMod) + state.layoutType = "list1"; + else if (listMod === 1) + state.layoutType = "list2"; + else + state.layoutType = "list3"; + + state.mode = Modes.attributes; + return tokenStyles(state); + }, + + link: function (stream, state) { + state.mode = Modes.text; + if (stream.match(RE("link"))) { + stream.match(/\S+/); + return tokenStylesWith(state, TOKEN_STYLES.link); + } + return tokenStyles(state); + }, + + linkDefinition: function (stream, state) { + stream.skipToEnd(); + return tokenStylesWith(state, TOKEN_STYLES.linkDefinition); + }, + + definitionList: function (stream, state) { + stream.match(RE("definitionList")); + + state.layoutType = "definitionList"; + + if (stream.match(/\s*$/)) + state.spanningLayout = true; + else + state.mode = Modes.attributes; + + return tokenStyles(state); + }, + + html: function (stream, state) { + stream.skipToEnd(); + return tokenStylesWith(state, TOKEN_STYLES.html); + }, + + table: function (stream, state) { + state.layoutType = "table"; + return (state.mode = Modes.tableCell)(stream, state); + }, + + tableCell: function (stream, state) { + if (stream.match(RE("tableHeading"))) + state.tableHeading = true; + else + stream.eat("|"); + + state.mode = Modes.tableCellAttributes; + return tokenStyles(state); + }, + + tableCellAttributes: function (stream, state) { + state.mode = Modes.tableText; + + if (stream.match(RE("tableCellAttributes"))) + return tokenStylesWith(state, TOKEN_STYLES.attributes); + else + return tokenStyles(state); + }, + + tableText: function (stream, state) { + if (stream.match(RE("tableText"))) + return tokenStyles(state); + + if (stream.peek() === "|") { // end of cell + state.mode = Modes.tableCell; + return tokenStyles(state); + } + return handlePhraseModifier(stream, state, stream.next()); + } }; - }); - CodeMirror.defineMIME("text/x-textile", "textile"); + CodeMirror.defineMode("textile", function () { + return { + startState: function () { + return {mode: Modes.newLayout}; + }, + token: function (stream, state) { + if (stream.sol()) startNewLine(stream, state); + return state.mode(stream, state); + }, + blankLine: blankLine + }; + }); + + CodeMirror.defineMIME("text/x-textile", "textile"); }); diff --git a/web/editor.md/lib/codemirror/mode/tiddlywiki/index.html b/web/editor.md/lib/codemirror/mode/tiddlywiki/index.html index 77dd045..fafd4cb 100644 --- a/web/editor.md/lib/codemirror/mode/tiddlywiki/index.html +++ b/web/editor.md/lib/codemirror/mode/tiddlywiki/index.html @@ -2,33 +2,36 @@ CodeMirror: TiddlyWiki mode - + - - + + - +
-

TiddlyWiki mode

+

TiddlyWiki mode

-

TiddlyWiki mode supports a single configuration.

MIME types defined: text/x-tiddlywiki.

-
+ diff --git a/web/editor.md/lib/codemirror/mode/tiddlywiki/tiddlywiki.css b/web/editor.md/lib/codemirror/mode/tiddlywiki/tiddlywiki.css index 9a69b63..db80ad8 100644 --- a/web/editor.md/lib/codemirror/mode/tiddlywiki/tiddlywiki.css +++ b/web/editor.md/lib/codemirror/mode/tiddlywiki/tiddlywiki.css @@ -1,14 +1,17 @@ span.cm-underlined { - text-decoration: underline; + text-decoration: underline; } + span.cm-strikethrough { - text-decoration: line-through; + text-decoration: line-through; } + span.cm-brace { - color: #170; - font-weight: bold; + color: #170; + font-weight: bold; } + span.cm-table { - color: blue; - font-weight: bold; + color: blue; + font-weight: bold; } diff --git a/web/editor.md/lib/codemirror/mode/tiddlywiki/tiddlywiki.js b/web/editor.md/lib/codemirror/mode/tiddlywiki/tiddlywiki.js index 88c9768..adadc8f 100644 --- a/web/editor.md/lib/codemirror/mode/tiddlywiki/tiddlywiki.js +++ b/web/editor.md/lib/codemirror/mode/tiddlywiki/tiddlywiki.js @@ -2,368 +2,366 @@ // Distributed under an MIT license: http://codemirror.net/LICENSE /*** - |''Name''|tiddlywiki.js| - |''Description''|Enables TiddlyWikiy syntax highlighting using CodeMirror| - |''Author''|PMario| - |''Version''|0.1.7| - |''Status''|''stable''| - |''Source''|[[GitHub|https://github.com/pmario/CodeMirror2/blob/tw-syntax/mode/tiddlywiki]]| - |''Documentation''|http://codemirror.tiddlyspace.com/| - |''License''|[[MIT License|http://www.opensource.org/licenses/mit-license.php]]| - |''CoreVersion''|2.5.0| - |''Requires''|codemirror.js| - |''Keywords''|syntax highlighting color code mirror codemirror| - ! Info - CoreVersion parameter is needed for TiddlyWiki only! -***/ + |''Name''|tiddlywiki.js| + |''Description''|Enables TiddlyWikiy syntax highlighting using CodeMirror| + |''Author''|PMario| + |''Version''|0.1.7| + |''Status''|''stable''| + |''Source''|[[GitHub|https://github.com/pmario/CodeMirror2/blob/tw-syntax/mode/tiddlywiki]]| + |''Documentation''|http://codemirror.tiddlyspace.com/| + |''License''|[[MIT License|http://www.opensource.org/licenses/mit-license.php]]| + |''CoreVersion''|2.5.0| + |''Requires''|codemirror.js| + |''Keywords''|syntax highlighting color code mirror codemirror| + ! Info + CoreVersion parameter is needed for TiddlyWiki only! + ***/ //{{{ -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("tiddlywiki", function () { - // Tokenizer - var textwords = {}; - - var keywords = function () { - function kw(type) { - return { type: type, style: "macro"}; - } - return { - "allTags": kw('allTags'), "closeAll": kw('closeAll'), "list": kw('list'), - "newJournal": kw('newJournal'), "newTiddler": kw('newTiddler'), - "permaview": kw('permaview'), "saveChanges": kw('saveChanges'), - "search": kw('search'), "slider": kw('slider'), "tabs": kw('tabs'), - "tag": kw('tag'), "tagging": kw('tagging'), "tags": kw('tags'), - "tiddler": kw('tiddler'), "timeline": kw('timeline'), - "today": kw('today'), "version": kw('version'), "option": kw('option'), - - "with": kw('with'), - "filter": kw('filter') - }; - }(); - - var isSpaceName = /[\w_\-]/i, - reHR = /^\-\-\-\-+$/, //
- reWikiCommentStart = /^\/\*\*\*$/, // /*** - reWikiCommentStop = /^\*\*\*\/$/, // ***/ - reBlockQuote = /^<<<$/, - - reJsCodeStart = /^\/\/\{\{\{$/, // //{{{ js block start - reJsCodeStop = /^\/\/\}\}\}$/, // //}}} js stop - reXmlCodeStart = /^$/, // xml block start - reXmlCodeStop = /^$/, // xml stop - - reCodeBlockStart = /^\{\{\{$/, // {{{ TW text div block start - reCodeBlockStop = /^\}\}\}$/, // }}} TW text stop - - reUntilCodeStop = /.*?\}\}\}/; - - function chain(stream, state, f) { - state.tokenize = f; - return f(stream, state); - } - - // Used as scratch variables to communicate multiple values without - // consing up tons of objects. - var type, content; - - function ret(tp, style, cont) { - type = tp; - content = cont; - return style; - } - - function jsTokenBase(stream, state) { - var sol = stream.sol(), ch; - - state.block = false; // indicates the start of a code block. - - ch = stream.peek(); // don't eat, to make matching simpler - - // check start of blocks - if (sol && /[<\/\*{}\-]/.test(ch)) { - if (stream.match(reCodeBlockStart)) { - state.block = true; - return chain(stream, state, twTokenCode); - } - if (stream.match(reBlockQuote)) { - return ret('quote', 'quote'); - } - if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop)) { - return ret('code', 'comment'); - } - if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop)) { - return ret('code', 'comment'); - } - if (stream.match(reHR)) { - return ret('hr', 'hr'); - } - } // sol - ch = stream.next(); - - if (sol && /[\/\*!#;:>|]/.test(ch)) { - if (ch == "!") { // tw header - stream.skipToEnd(); - return ret("header", "header"); - } - if (ch == "*") { // tw list - stream.eatWhile('*'); - return ret("list", "comment"); - } - if (ch == "#") { // tw numbered list - stream.eatWhile('#'); - return ret("list", "comment"); - } - if (ch == ";") { // definition list, term - stream.eatWhile(';'); - return ret("list", "comment"); - } - if (ch == ":") { // definition list, description - stream.eatWhile(':'); - return ret("list", "comment"); - } - if (ch == ">") { // single line quote - stream.eatWhile(">"); - return ret("quote", "quote"); - } - if (ch == '|') { - return ret('table', 'header'); - } - } - - if (ch == '{' && stream.match(/\{\{/)) { - return chain(stream, state, twTokenCode); - } - - // rudimentary html:// file:// link matching. TW knows much more ... - if (/[hf]/i.test(ch)) { - if (/[ti]/i.test(stream.peek()) && stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i)) { - return ret("link", "link"); - } - } - // just a little string indicator, don't want to have the whole string covered - if (ch == '"') { - return ret('string', 'string'); - } - if (ch == '~') { // _no_ CamelCase indicator should be bold - return ret('text', 'brace'); - } - if (/[\[\]]/.test(ch)) { // check for [[..]] - if (stream.peek() == ch) { - stream.next(); - return ret('brace', 'brace'); - } - } - if (ch == "@") { // check for space link. TODO fix @@...@@ highlighting - stream.eatWhile(isSpaceName); - return ret("link", "link"); - } - if (/\d/.test(ch)) { // numbers - stream.eatWhile(/\d/); - return ret("number", "number"); - } - if (ch == "/") { // tw invisible comment - if (stream.eat("%")) { - return chain(stream, state, twTokenComment); - } - else if (stream.eat("/")) { // - return chain(stream, state, twTokenEm); - } - } - if (ch == "_") { // tw underline - if (stream.eat("_")) { - return chain(stream, state, twTokenUnderline); - } - } - // strikethrough and mdash handling - if (ch == "-") { - if (stream.eat("-")) { - // if strikethrough looks ugly, change CSS. - if (stream.peek() != ' ') - return chain(stream, state, twTokenStrike); - // mdash - if (stream.peek() == ' ') - return ret('text', 'brace'); - } - } - if (ch == "'") { // tw bold - if (stream.eat("'")) { - return chain(stream, state, twTokenStrong); - } - } - if (ch == "<") { // tw macro - if (stream.eat("<")) { - return chain(stream, state, twTokenMacro); - } - } - else { - return ret(ch); - } - - // core macro handling - stream.eatWhile(/[\w\$_]/); - var word = stream.current(), - known = textwords.propertyIsEnumerable(word) && textwords[word]; - - return known ? ret(known.type, known.style, word) : ret("text", null, word); - - } // jsTokenBase() - - // tw invisible comment - function twTokenComment(stream, state) { - var maybeEnd = false, - ch; - while (ch = stream.next()) { - if (ch == "/" && maybeEnd) { - state.tokenize = jsTokenBase; - break; - } - maybeEnd = (ch == "%"); - } - return ret("comment", "comment"); - } - - // tw strong / bold - function twTokenStrong(stream, state) { - var maybeEnd = false, - ch; - while (ch = stream.next()) { - if (ch == "'" && maybeEnd) { - state.tokenize = jsTokenBase; - break; - } - maybeEnd = (ch == "'"); - } - return ret("text", "strong"); - } - - // tw code - function twTokenCode(stream, state) { - var ch, sb = state.block; - - if (sb && stream.current()) { - return ret("code", "comment"); - } - - if (!sb && stream.match(reUntilCodeStop)) { - state.tokenize = jsTokenBase; - return ret("code", "comment"); - } - - if (sb && stream.sol() && stream.match(reCodeBlockStop)) { - state.tokenize = jsTokenBase; - return ret("code", "comment"); - } - - ch = stream.next(); - return (sb) ? ret("code", "comment") : ret("code", "comment"); - } - - // tw em / italic - function twTokenEm(stream, state) { - var maybeEnd = false, - ch; - while (ch = stream.next()) { - if (ch == "/" && maybeEnd) { - state.tokenize = jsTokenBase; - break; - } - maybeEnd = (ch == "/"); - } - return ret("text", "em"); - } - - // tw underlined text - function twTokenUnderline(stream, state) { - var maybeEnd = false, - ch; - while (ch = stream.next()) { - if (ch == "_" && maybeEnd) { - state.tokenize = jsTokenBase; - break; - } - maybeEnd = (ch == "_"); - } - return ret("text", "underlined"); - } - - // tw strike through text looks ugly - // change CSS if needed - function twTokenStrike(stream, state) { - var maybeEnd = false, ch; - - while (ch = stream.next()) { - if (ch == "-" && maybeEnd) { - state.tokenize = jsTokenBase; - break; - } - maybeEnd = (ch == "-"); - } - return ret("text", "strikethrough"); - } - - // macro - function twTokenMacro(stream, state) { - var ch, word, known; - - if (stream.current() == '<<') { - return ret('brace', 'macro'); - } - - ch = stream.next(); - if (!ch) { - state.tokenize = jsTokenBase; - return ret(ch); - } - if (ch == ">") { - if (stream.peek() == '>') { - stream.next(); - state.tokenize = jsTokenBase; - return ret("brace", "macro"); - } - } - - stream.eatWhile(/[\w\$_]/); - word = stream.current(); - known = keywords.propertyIsEnumerable(word) && keywords[word]; - - if (known) { - return ret(known.type, known.style, word); - } - else { - return ret("macro", null, word); - } - } - - // Interface - return { - startState: function () { - return { - tokenize: jsTokenBase, - indented: 0, - level: 0 - }; - }, - - token: function (stream, state) { - if (stream.eatSpace()) return null; - var style = state.tokenize(stream, state); - return style; - }, - - electricChars: "" - }; -}); - -CodeMirror.defineMIME("text/x-tiddlywiki", "tiddlywiki"); +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("tiddlywiki", function () { + // Tokenizer + var textwords = {}; + + var keywords = function () { + function kw(type) { + return {type: type, style: "macro"}; + } + + return { + "allTags": kw('allTags'), "closeAll": kw('closeAll'), "list": kw('list'), + "newJournal": kw('newJournal'), "newTiddler": kw('newTiddler'), + "permaview": kw('permaview'), "saveChanges": kw('saveChanges'), + "search": kw('search'), "slider": kw('slider'), "tabs": kw('tabs'), + "tag": kw('tag'), "tagging": kw('tagging'), "tags": kw('tags'), + "tiddler": kw('tiddler'), "timeline": kw('timeline'), + "today": kw('today'), "version": kw('version'), "option": kw('option'), + + "with": kw('with'), + "filter": kw('filter') + }; + }(); + + var isSpaceName = /[\w_\-]/i, + reHR = /^\-\-\-\-+$/, //
+ reWikiCommentStart = /^\/\*\*\*$/, // /*** + reWikiCommentStop = /^\*\*\*\/$/, // ***/ + reBlockQuote = /^<<<$/, + + reJsCodeStart = /^\/\/\{\{\{$/, // //{{{ js block start + reJsCodeStop = /^\/\/\}\}\}$/, // //}}} js stop + reXmlCodeStart = /^$/, // xml block start + reXmlCodeStop = /^$/, // xml stop + + reCodeBlockStart = /^\{\{\{$/, // {{{ TW text div block start + reCodeBlockStop = /^\}\}\}$/, // }}} TW text stop + + reUntilCodeStop = /.*?\}\}\}/; + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + + // Used as scratch variables to communicate multiple values without + // consing up tons of objects. + var type, content; + + function ret(tp, style, cont) { + type = tp; + content = cont; + return style; + } + + function jsTokenBase(stream, state) { + var sol = stream.sol(), ch; + + state.block = false; // indicates the start of a code block. + + ch = stream.peek(); // don't eat, to make matching simpler + + // check start of blocks + if (sol && /[<\/\*{}\-]/.test(ch)) { + if (stream.match(reCodeBlockStart)) { + state.block = true; + return chain(stream, state, twTokenCode); + } + if (stream.match(reBlockQuote)) { + return ret('quote', 'quote'); + } + if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop)) { + return ret('code', 'comment'); + } + if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop)) { + return ret('code', 'comment'); + } + if (stream.match(reHR)) { + return ret('hr', 'hr'); + } + } // sol + ch = stream.next(); + + if (sol && /[\/\*!#;:>|]/.test(ch)) { + if (ch == "!") { // tw header + stream.skipToEnd(); + return ret("header", "header"); + } + if (ch == "*") { // tw list + stream.eatWhile('*'); + return ret("list", "comment"); + } + if (ch == "#") { // tw numbered list + stream.eatWhile('#'); + return ret("list", "comment"); + } + if (ch == ";") { // definition list, term + stream.eatWhile(';'); + return ret("list", "comment"); + } + if (ch == ":") { // definition list, description + stream.eatWhile(':'); + return ret("list", "comment"); + } + if (ch == ">") { // single line quote + stream.eatWhile(">"); + return ret("quote", "quote"); + } + if (ch == '|') { + return ret('table', 'header'); + } + } + + if (ch == '{' && stream.match(/\{\{/)) { + return chain(stream, state, twTokenCode); + } + + // rudimentary html:// file:// link matching. TW knows much more ... + if (/[hf]/i.test(ch)) { + if (/[ti]/i.test(stream.peek()) && stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i)) { + return ret("link", "link"); + } + } + // just a little string indicator, don't want to have the whole string covered + if (ch == '"') { + return ret('string', 'string'); + } + if (ch == '~') { // _no_ CamelCase indicator should be bold + return ret('text', 'brace'); + } + if (/[\[\]]/.test(ch)) { // check for [[..]] + if (stream.peek() == ch) { + stream.next(); + return ret('brace', 'brace'); + } + } + if (ch == "@") { // check for space link. TODO fix @@...@@ highlighting + stream.eatWhile(isSpaceName); + return ret("link", "link"); + } + if (/\d/.test(ch)) { // numbers + stream.eatWhile(/\d/); + return ret("number", "number"); + } + if (ch == "/") { // tw invisible comment + if (stream.eat("%")) { + return chain(stream, state, twTokenComment); + } else if (stream.eat("/")) { // + return chain(stream, state, twTokenEm); + } + } + if (ch == "_") { // tw underline + if (stream.eat("_")) { + return chain(stream, state, twTokenUnderline); + } + } + // strikethrough and mdash handling + if (ch == "-") { + if (stream.eat("-")) { + // if strikethrough looks ugly, change CSS. + if (stream.peek() != ' ') + return chain(stream, state, twTokenStrike); + // mdash + if (stream.peek() == ' ') + return ret('text', 'brace'); + } + } + if (ch == "'") { // tw bold + if (stream.eat("'")) { + return chain(stream, state, twTokenStrong); + } + } + if (ch == "<") { // tw macro + if (stream.eat("<")) { + return chain(stream, state, twTokenMacro); + } + } else { + return ret(ch); + } + + // core macro handling + stream.eatWhile(/[\w\$_]/); + var word = stream.current(), + known = textwords.propertyIsEnumerable(word) && textwords[word]; + + return known ? ret(known.type, known.style, word) : ret("text", null, word); + + } // jsTokenBase() + + // tw invisible comment + function twTokenComment(stream, state) { + var maybeEnd = false, + ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "%"); + } + return ret("comment", "comment"); + } + + // tw strong / bold + function twTokenStrong(stream, state) { + var maybeEnd = false, + ch; + while (ch = stream.next()) { + if (ch == "'" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "'"); + } + return ret("text", "strong"); + } + + // tw code + function twTokenCode(stream, state) { + var ch, sb = state.block; + + if (sb && stream.current()) { + return ret("code", "comment"); + } + + if (!sb && stream.match(reUntilCodeStop)) { + state.tokenize = jsTokenBase; + return ret("code", "comment"); + } + + if (sb && stream.sol() && stream.match(reCodeBlockStop)) { + state.tokenize = jsTokenBase; + return ret("code", "comment"); + } + + ch = stream.next(); + return (sb) ? ret("code", "comment") : ret("code", "comment"); + } + + // tw em / italic + function twTokenEm(stream, state) { + var maybeEnd = false, + ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "/"); + } + return ret("text", "em"); + } + + // tw underlined text + function twTokenUnderline(stream, state) { + var maybeEnd = false, + ch; + while (ch = stream.next()) { + if (ch == "_" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "_"); + } + return ret("text", "underlined"); + } + + // tw strike through text looks ugly + // change CSS if needed + function twTokenStrike(stream, state) { + var maybeEnd = false, ch; + + while (ch = stream.next()) { + if (ch == "-" && maybeEnd) { + state.tokenize = jsTokenBase; + break; + } + maybeEnd = (ch == "-"); + } + return ret("text", "strikethrough"); + } + + // macro + function twTokenMacro(stream, state) { + var ch, word, known; + + if (stream.current() == '<<') { + return ret('brace', 'macro'); + } + + ch = stream.next(); + if (!ch) { + state.tokenize = jsTokenBase; + return ret(ch); + } + if (ch == ">") { + if (stream.peek() == '>') { + stream.next(); + state.tokenize = jsTokenBase; + return ret("brace", "macro"); + } + } + + stream.eatWhile(/[\w\$_]/); + word = stream.current(); + known = keywords.propertyIsEnumerable(word) && keywords[word]; + + if (known) { + return ret(known.type, known.style, word); + } else { + return ret("macro", null, word); + } + } + + // Interface + return { + startState: function () { + return { + tokenize: jsTokenBase, + indented: 0, + level: 0 + }; + }, + + token: function (stream, state) { + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + return style; + }, + + electricChars: "" + }; + }); + + CodeMirror.defineMIME("text/x-tiddlywiki", "tiddlywiki"); }); //}}} diff --git a/web/editor.md/lib/codemirror/mode/tiki/index.html b/web/editor.md/lib/codemirror/mode/tiki/index.html index 091c5fb..5019b90 100644 --- a/web/editor.md/lib/codemirror/mode/tiki/index.html +++ b/web/editor.md/lib/codemirror/mode/tiki/index.html @@ -2,32 +2,35 @@ CodeMirror: Tiki wiki mode - + - - + + - +
-

Tiki wiki mode

+

Tiki wiki mode

-
- +
diff --git a/web/editor.md/lib/codemirror/mode/tiki/tiki.css b/web/editor.md/lib/codemirror/mode/tiki/tiki.css index 0dbc3ea..56d7c0a 100644 --- a/web/editor.md/lib/codemirror/mode/tiki/tiki.css +++ b/web/editor.md/lib/codemirror/mode/tiki/tiki.css @@ -1,26 +1,27 @@ .cm-tw-syntaxerror { - color: #FFF; - background-color: #900; + color: #FFF; + background-color: #900; } .cm-tw-deleted { - text-decoration: line-through; + text-decoration: line-through; } .cm-tw-header5 { - font-weight: bold; + font-weight: bold; } + .cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/ - padding-left: 10px; + padding-left: 10px; } .cm-tw-box { - border-top-width: 0px ! important; - border-style: solid; - border-width: 1px; - border-color: inherit; + border-top-width: 0px ! important; + border-style: solid; + border-width: 1px; + border-color: inherit; } .cm-tw-underline { - text-decoration: underline; + text-decoration: underline; } \ No newline at end of file diff --git a/web/editor.md/lib/codemirror/mode/tiki/tiki.js b/web/editor.md/lib/codemirror/mode/tiki/tiki.js index c90aac9..4e01c09 100644 --- a/web/editor.md/lib/codemirror/mode/tiki/tiki.js +++ b/web/editor.md/lib/codemirror/mode/tiki/tiki.js @@ -1,323 +1,337 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode('tiki', function(config) { - function inBlock(style, terminator, returnTokenizer) { - return function(stream, state) { - while (!stream.eol()) { - if (stream.match(terminator)) { - state.tokenize = inText; - break; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode('tiki', function (config) { + function inBlock(style, terminator, returnTokenizer) { + return function (stream, state) { + while (!stream.eol()) { + if (stream.match(terminator)) { + state.tokenize = inText; + break; + } + stream.next(); + } + + if (returnTokenizer) state.tokenize = returnTokenizer; + + return style; + }; } - stream.next(); - } - - if (returnTokenizer) state.tokenize = returnTokenizer; - - return style; - }; - } - - function inLine(style) { - return function(stream, state) { - while(!stream.eol()) { - stream.next(); - } - state.tokenize = inText; - return style; - }; - } - - function inText(stream, state) { - function chain(parser) { - state.tokenize = parser; - return parser(stream, state); - } - - var sol = stream.sol(); - var ch = stream.next(); - - //non start of line - switch (ch) { //switch is generally much faster than if, so it is used here - case "{": //plugin - stream.eat("/"); - stream.eatSpace(); - var tagName = ""; - var c; - while ((c = stream.eat(/[^\s\u00a0=\"\'\/?(}]/))) tagName += c; - state.tokenize = inPlugin; - return "tag"; - break; - case "_": //bold - if (stream.eat("_")) { - return chain(inBlock("strong", "__", inText)); - } - break; - case "'": //italics - if (stream.eat("'")) { - // Italic text - return chain(inBlock("em", "''", inText)); - } - break; - case "(":// Wiki Link - if (stream.eat("(")) { - return chain(inBlock("variable-2", "))", inText)); - } - break; - case "[":// Weblink - return chain(inBlock("variable-3", "]", inText)); - break; - case "|": //table - if (stream.eat("|")) { - return chain(inBlock("comment", "||")); - } - break; - case "-": - if (stream.eat("=")) {//titleBar - return chain(inBlock("header string", "=-", inText)); - } else if (stream.eat("-")) {//deleted - return chain(inBlock("error tw-deleted", "--", inText)); - } - break; - case "=": //underline - if (stream.match("==")) { - return chain(inBlock("tw-underline", "===", inText)); - } - break; - case ":": - if (stream.eat(":")) { - return chain(inBlock("comment", "::")); - } - break; - case "^": //box - return chain(inBlock("tw-box", "^")); - break; - case "~": //np - if (stream.match("np~")) { - return chain(inBlock("meta", "~/np~")); - } - break; - } - - //start of line types - if (sol) { - switch (ch) { - case "!": //header at start of line - if (stream.match('!!!!!')) { - return chain(inLine("header string")); - } else if (stream.match('!!!!')) { - return chain(inLine("header string")); - } else if (stream.match('!!!')) { - return chain(inLine("header string")); - } else if (stream.match('!!')) { - return chain(inLine("header string")); - } else { - return chain(inLine("header string")); + + function inLine(style) { + return function (stream, state) { + while (!stream.eol()) { + stream.next(); + } + state.tokenize = inText; + return style; + }; } - break; - case "*": //unordered list line item, or
  • at start of line - case "#": //ordered list line item, or
  • at start of line - case "+": //ordered list line item, or
  • at start of line - return chain(inLine("tw-listitem bracket")); - break; - } - } - - //stream.eatWhile(/[&{]/); was eating up plugins, turned off to act less like html and more like tiki - return null; - } - - var indentUnit = config.indentUnit; - - // Return variables for tokenizers - var pluginName, type; - function inPlugin(stream, state) { - var ch = stream.next(); - var peek = stream.peek(); - - if (ch == "}") { - state.tokenize = inText; - //type = ch == ")" ? "endPlugin" : "selfclosePlugin"; inPlugin - return "tag"; - } else if (ch == "(" || ch == ")") { - return "bracket"; - } else if (ch == "=") { - type = "equals"; - - if (peek == ">") { - ch = stream.next(); - peek = stream.peek(); - } - - //here we detect values directly after equal character with no quotes - if (!/[\'\"]/.test(peek)) { - state.tokenize = inAttributeNoQuote(); - } - //end detect values - - return "operator"; - } else if (/[\'\"]/.test(ch)) { - state.tokenize = inAttribute(ch); - return state.tokenize(stream, state); - } else { - stream.eatWhile(/[^\s\u00a0=\"\'\/?]/); - return "keyword"; - } - } - - function inAttribute(quote) { - return function(stream, state) { - while (!stream.eol()) { - if (stream.next() == quote) { - state.tokenize = inPlugin; - break; + + function inText(stream, state) { + function chain(parser) { + state.tokenize = parser; + return parser(stream, state); + } + + var sol = stream.sol(); + var ch = stream.next(); + + //non start of line + switch (ch) { //switch is generally much faster than if, so it is used here + case "{": //plugin + stream.eat("/"); + stream.eatSpace(); + var tagName = ""; + var c; + while ((c = stream.eat(/[^\s\u00a0=\"\'\/?(}]/))) tagName += c; + state.tokenize = inPlugin; + return "tag"; + break; + case "_": //bold + if (stream.eat("_")) { + return chain(inBlock("strong", "__", inText)); + } + break; + case "'": //italics + if (stream.eat("'")) { + // Italic text + return chain(inBlock("em", "''", inText)); + } + break; + case "(":// Wiki Link + if (stream.eat("(")) { + return chain(inBlock("variable-2", "))", inText)); + } + break; + case "[":// Weblink + return chain(inBlock("variable-3", "]", inText)); + break; + case "|": //table + if (stream.eat("|")) { + return chain(inBlock("comment", "||")); + } + break; + case "-": + if (stream.eat("=")) {//titleBar + return chain(inBlock("header string", "=-", inText)); + } else if (stream.eat("-")) {//deleted + return chain(inBlock("error tw-deleted", "--", inText)); + } + break; + case "=": //underline + if (stream.match("==")) { + return chain(inBlock("tw-underline", "===", inText)); + } + break; + case ":": + if (stream.eat(":")) { + return chain(inBlock("comment", "::")); + } + break; + case "^": //box + return chain(inBlock("tw-box", "^")); + break; + case "~": //np + if (stream.match("np~")) { + return chain(inBlock("meta", "~/np~")); + } + break; + } + + //start of line types + if (sol) { + switch (ch) { + case "!": //header at start of line + if (stream.match('!!!!!')) { + return chain(inLine("header string")); + } else if (stream.match('!!!!')) { + return chain(inLine("header string")); + } else if (stream.match('!!!')) { + return chain(inLine("header string")); + } else if (stream.match('!!')) { + return chain(inLine("header string")); + } else { + return chain(inLine("header string")); + } + break; + case "*": //unordered list line item, or
  • at start of line + case "#": //ordered list line item, or
  • at start of line + case "+": //ordered list line item, or
  • at start of line + return chain(inLine("tw-listitem bracket")); + break; + } + } + + //stream.eatWhile(/[&{]/); was eating up plugins, turned off to act less like html and more like tiki + return null; } - } - return "string"; - }; - } - - function inAttributeNoQuote() { - return function(stream, state) { - while (!stream.eol()) { - var ch = stream.next(); - var peek = stream.peek(); - if (ch == " " || ch == "," || /[ )}]/.test(peek)) { - state.tokenize = inPlugin; - break; - } - } - return "string"; -}; - } - -var curState, setStyle; -function pass() { - for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]); -} - -function cont() { - pass.apply(null, arguments); - return true; -} - -function pushContext(pluginName, startOfLine) { - var noIndent = curState.context && curState.context.noIndent; - curState.context = { - prev: curState.context, - pluginName: pluginName, - indent: curState.indented, - startOfLine: startOfLine, - noIndent: noIndent - }; -} - -function popContext() { - if (curState.context) curState.context = curState.context.prev; -} - -function element(type) { - if (type == "openPlugin") {curState.pluginName = pluginName; return cont(attributes, endplugin(curState.startOfLine));} - else if (type == "closePlugin") { - var err = false; - if (curState.context) { - err = curState.context.pluginName != pluginName; - popContext(); - } else { - err = true; - } - if (err) setStyle = "error"; - return cont(endcloseplugin(err)); - } - else if (type == "string") { - if (!curState.context || curState.context.name != "!cdata") pushContext("!cdata"); - if (curState.tokenize == inText) popContext(); - return cont(); - } - else return cont(); -} - -function endplugin(startOfLine) { - return function(type) { - if ( - type == "selfclosePlugin" || - type == "endPlugin" - ) - return cont(); - if (type == "endPlugin") {pushContext(curState.pluginName, startOfLine); return cont();} - return cont(); - }; -} - -function endcloseplugin(err) { - return function(type) { - if (err) setStyle = "error"; - if (type == "endPlugin") return cont(); - return pass(); - }; -} - -function attributes(type) { - if (type == "keyword") {setStyle = "attribute"; return cont(attributes);} - if (type == "equals") return cont(attvalue, attributes); - return pass(); -} -function attvalue(type) { - if (type == "keyword") {setStyle = "string"; return cont();} - if (type == "string") return cont(attvaluemaybe); - return pass(); -} -function attvaluemaybe(type) { - if (type == "string") return cont(attvaluemaybe); - else return pass(); -} -return { - startState: function() { - return {tokenize: inText, cc: [], indented: 0, startOfLine: true, pluginName: null, context: null}; - }, - token: function(stream, state) { - if (stream.sol()) { - state.startOfLine = true; - state.indented = stream.indentation(); - } - if (stream.eatSpace()) return null; - - setStyle = type = pluginName = null; - var style = state.tokenize(stream, state); - if ((style || type) && style != "comment") { - curState = state; - while (true) { - var comb = state.cc.pop() || element; - if (comb(type || style)) break; - } - } - state.startOfLine = false; - return setStyle || style; - }, - indent: function(state, textAfter) { - var context = state.context; - if (context && context.noIndent) return 0; - if (context && /^{\//.test(textAfter)) - context = context.prev; - while (context && !context.startOfLine) - context = context.prev; - if (context) return context.indent + indentUnit; - else return 0; - }, - electricChars: "/" - }; -}); -CodeMirror.defineMIME("text/tiki", "tiki"); + var indentUnit = config.indentUnit; + + // Return variables for tokenizers + var pluginName, type; + + function inPlugin(stream, state) { + var ch = stream.next(); + var peek = stream.peek(); + + if (ch == "}") { + state.tokenize = inText; + //type = ch == ")" ? "endPlugin" : "selfclosePlugin"; inPlugin + return "tag"; + } else if (ch == "(" || ch == ")") { + return "bracket"; + } else if (ch == "=") { + type = "equals"; + + if (peek == ">") { + ch = stream.next(); + peek = stream.peek(); + } + + //here we detect values directly after equal character with no quotes + if (!/[\'\"]/.test(peek)) { + state.tokenize = inAttributeNoQuote(); + } + //end detect values + + return "operator"; + } else if (/[\'\"]/.test(ch)) { + state.tokenize = inAttribute(ch); + return state.tokenize(stream, state); + } else { + stream.eatWhile(/[^\s\u00a0=\"\'\/?]/); + return "keyword"; + } + } + + function inAttribute(quote) { + return function (stream, state) { + while (!stream.eol()) { + if (stream.next() == quote) { + state.tokenize = inPlugin; + break; + } + } + return "string"; + }; + } + + function inAttributeNoQuote() { + return function (stream, state) { + while (!stream.eol()) { + var ch = stream.next(); + var peek = stream.peek(); + if (ch == " " || ch == "," || /[ )}]/.test(peek)) { + state.tokenize = inPlugin; + break; + } + } + return "string"; + }; + } + + var curState, setStyle; + + function pass() { + for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]); + } + + function cont() { + pass.apply(null, arguments); + return true; + } + + function pushContext(pluginName, startOfLine) { + var noIndent = curState.context && curState.context.noIndent; + curState.context = { + prev: curState.context, + pluginName: pluginName, + indent: curState.indented, + startOfLine: startOfLine, + noIndent: noIndent + }; + } + + function popContext() { + if (curState.context) curState.context = curState.context.prev; + } + + function element(type) { + if (type == "openPlugin") { + curState.pluginName = pluginName; + return cont(attributes, endplugin(curState.startOfLine)); + } else if (type == "closePlugin") { + var err = false; + if (curState.context) { + err = curState.context.pluginName != pluginName; + popContext(); + } else { + err = true; + } + if (err) setStyle = "error"; + return cont(endcloseplugin(err)); + } else if (type == "string") { + if (!curState.context || curState.context.name != "!cdata") pushContext("!cdata"); + if (curState.tokenize == inText) popContext(); + return cont(); + } else return cont(); + } + + function endplugin(startOfLine) { + return function (type) { + if ( + type == "selfclosePlugin" || + type == "endPlugin" + ) + return cont(); + if (type == "endPlugin") { + pushContext(curState.pluginName, startOfLine); + return cont(); + } + return cont(); + }; + } + + function endcloseplugin(err) { + return function (type) { + if (err) setStyle = "error"; + if (type == "endPlugin") return cont(); + return pass(); + }; + } + + function attributes(type) { + if (type == "keyword") { + setStyle = "attribute"; + return cont(attributes); + } + if (type == "equals") return cont(attvalue, attributes); + return pass(); + } + + function attvalue(type) { + if (type == "keyword") { + setStyle = "string"; + return cont(); + } + if (type == "string") return cont(attvaluemaybe); + return pass(); + } + + function attvaluemaybe(type) { + if (type == "string") return cont(attvaluemaybe); + else return pass(); + } + + return { + startState: function () { + return {tokenize: inText, cc: [], indented: 0, startOfLine: true, pluginName: null, context: null}; + }, + token: function (stream, state) { + if (stream.sol()) { + state.startOfLine = true; + state.indented = stream.indentation(); + } + if (stream.eatSpace()) return null; + + setStyle = type = pluginName = null; + var style = state.tokenize(stream, state); + if ((style || type) && style != "comment") { + curState = state; + while (true) { + var comb = state.cc.pop() || element; + if (comb(type || style)) break; + } + } + state.startOfLine = false; + return setStyle || style; + }, + indent: function (state, textAfter) { + var context = state.context; + if (context && context.noIndent) return 0; + if (context && /^{\//.test(textAfter)) + context = context.prev; + while (context && !context.startOfLine) + context = context.prev; + if (context) return context.indent + indentUnit; + else return 0; + }, + electricChars: "/" + }; + }); + + CodeMirror.defineMIME("text/tiki", "tiki"); }); diff --git a/web/editor.md/lib/codemirror/mode/toml/index.html b/web/editor.md/lib/codemirror/mode/toml/index.html index 90a2a02..437a122 100644 --- a/web/editor.md/lib/codemirror/mode/toml/index.html +++ b/web/editor.md/lib/codemirror/mode/toml/index.html @@ -2,29 +2,32 @@ CodeMirror: TOML Mode - + - + - +
    -

    TOML Mode

    -

    The TOML Mode

    -

    Created by Forbes Lindesay.

    +

    Created by Forbes Lindesay.

    MIME type defined: text/x-toml.

    -
    + diff --git a/web/editor.md/lib/codemirror/mode/toml/toml.js b/web/editor.md/lib/codemirror/mode/toml/toml.js index baeca15..b57a488 100644 --- a/web/editor.md/lib/codemirror/mode/toml/toml.js +++ b/web/editor.md/lib/codemirror/mode/toml/toml.js @@ -1,88 +1,90 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("toml", function () { - return { - startState: function () { - return { - inString: false, - stringType: "", - lhs: true, - inArray: 0 - }; - }, - token: function (stream, state) { - //check for state changes - if (!state.inString && ((stream.peek() == '"') || (stream.peek() == "'"))) { - state.stringType = stream.peek(); - stream.next(); // Skip quote - state.inString = true; // Update state - } - if (stream.sol() && state.inArray === 0) { - state.lhs = true; - } - //return state - if (state.inString) { - while (state.inString && !stream.eol()) { - if (stream.peek() === state.stringType) { - stream.next(); // Skip quote - state.inString = false; // Clear flag - } else if (stream.peek() === '\\') { - stream.next(); - stream.next(); - } else { - stream.match(/^.[^\\\"\']*/); - } - } - return state.lhs ? "property string" : "string"; // Token style - } else if (state.inArray && stream.peek() === ']') { - stream.next(); - state.inArray--; - return 'bracket'; - } else if (state.lhs && stream.peek() === '[' && stream.skipTo(']')) { - stream.next();//skip closing ] - // array of objects has an extra open & close [] - if (stream.peek() === ']') stream.next(); - return "atom"; - } else if (stream.peek() === "#") { - stream.skipToEnd(); - return "comment"; - } else if (stream.eatSpace()) { - return null; - } else if (state.lhs && stream.eatWhile(function (c) { return c != '=' && c != ' '; })) { - return "property"; - } else if (state.lhs && stream.peek() === "=") { - stream.next(); - state.lhs = false; - return null; - } else if (!state.lhs && stream.match(/^\d\d\d\d[\d\-\:\.T]*Z/)) { - return 'atom'; //date - } else if (!state.lhs && (stream.match('true') || stream.match('false'))) { - return 'atom'; - } else if (!state.lhs && stream.peek() === '[') { - state.inArray++; - stream.next(); - return 'bracket'; - } else if (!state.lhs && stream.match(/^\-?\d+(?:\.\d+)?/)) { - return 'number'; - } else if (!stream.eatSpace()) { - stream.next(); - } - return null; - } - }; -}); + CodeMirror.defineMode("toml", function () { + return { + startState: function () { + return { + inString: false, + stringType: "", + lhs: true, + inArray: 0 + }; + }, + token: function (stream, state) { + //check for state changes + if (!state.inString && ((stream.peek() == '"') || (stream.peek() == "'"))) { + state.stringType = stream.peek(); + stream.next(); // Skip quote + state.inString = true; // Update state + } + if (stream.sol() && state.inArray === 0) { + state.lhs = true; + } + //return state + if (state.inString) { + while (state.inString && !stream.eol()) { + if (stream.peek() === state.stringType) { + stream.next(); // Skip quote + state.inString = false; // Clear flag + } else if (stream.peek() === '\\') { + stream.next(); + stream.next(); + } else { + stream.match(/^.[^\\\"\']*/); + } + } + return state.lhs ? "property string" : "string"; // Token style + } else if (state.inArray && stream.peek() === ']') { + stream.next(); + state.inArray--; + return 'bracket'; + } else if (state.lhs && stream.peek() === '[' && stream.skipTo(']')) { + stream.next();//skip closing ] + // array of objects has an extra open & close [] + if (stream.peek() === ']') stream.next(); + return "atom"; + } else if (stream.peek() === "#") { + stream.skipToEnd(); + return "comment"; + } else if (stream.eatSpace()) { + return null; + } else if (state.lhs && stream.eatWhile(function (c) { + return c != '=' && c != ' '; + })) { + return "property"; + } else if (state.lhs && stream.peek() === "=") { + stream.next(); + state.lhs = false; + return null; + } else if (!state.lhs && stream.match(/^\d\d\d\d[\d\-\:\.T]*Z/)) { + return 'atom'; //date + } else if (!state.lhs && (stream.match('true') || stream.match('false'))) { + return 'atom'; + } else if (!state.lhs && stream.peek() === '[') { + state.inArray++; + stream.next(); + return 'bracket'; + } else if (!state.lhs && stream.match(/^\-?\d+(?:\.\d+)?/)) { + return 'number'; + } else if (!stream.eatSpace()) { + stream.next(); + } + return null; + } + }; + }); -CodeMirror.defineMIME('text/x-toml', 'toml'); + CodeMirror.defineMIME('text/x-toml', 'toml'); }); diff --git a/web/editor.md/lib/codemirror/mode/tornado/index.html b/web/editor.md/lib/codemirror/mode/tornado/index.html index 8ee7ef5..1067566 100644 --- a/web/editor.md/lib/codemirror/mode/tornado/index.html +++ b/web/editor.md/lib/codemirror/mode/tornado/index.html @@ -2,32 +2,35 @@ CodeMirror: Tornado template mode - + - + - +
    -

    Tornado template mode

    -

    Mode for HTML with embedded Tornado template markup.

    MIME types defined: text/x-tornado

    -
    + diff --git a/web/editor.md/lib/codemirror/mode/tornado/tornado.js b/web/editor.md/lib/codemirror/mode/tornado/tornado.js index dbfbc34..e3054c0 100644 --- a/web/editor.md/lib/codemirror/mode/tornado/tornado.js +++ b/web/editor.md/lib/codemirror/mode/tornado/tornado.js @@ -1,68 +1,70 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), - require("../../addon/mode/overlay")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror", "../htmlmixed/htmlmixed", +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), + require("../../addon/mode/overlay")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../../addon/mode/overlay"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - "use strict"; + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; - CodeMirror.defineMode("tornado:inner", function() { - var keywords = ["and","as","assert","autoescape","block","break","class","comment","context", - "continue","datetime","def","del","elif","else","end","escape","except", - "exec","extends","false","finally","for","from","global","if","import","in", - "include","is","json_encode","lambda","length","linkify","load","module", - "none","not","or","pass","print","put","raise","raw","return","self","set", - "squeeze","super","true","try","url_escape","while","with","without","xhtml_escape","yield"]; - keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b"); + CodeMirror.defineMode("tornado:inner", function () { + var keywords = ["and", "as", "assert", "autoescape", "block", "break", "class", "comment", "context", + "continue", "datetime", "def", "del", "elif", "else", "end", "escape", "except", + "exec", "extends", "false", "finally", "for", "from", "global", "if", "import", "in", + "include", "is", "json_encode", "lambda", "length", "linkify", "load", "module", + "none", "not", "or", "pass", "print", "put", "raise", "raw", "return", "self", "set", + "squeeze", "super", "true", "try", "url_escape", "while", "with", "without", "xhtml_escape", "yield"]; + keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b"); - function tokenBase (stream, state) { - stream.eatWhile(/[^\{]/); - var ch = stream.next(); - if (ch == "{") { - if (ch = stream.eat(/\{|%|#/)) { - state.tokenize = inTag(ch); - return "tag"; + function tokenBase(stream, state) { + stream.eatWhile(/[^\{]/); + var ch = stream.next(); + if (ch == "{") { + if (ch = stream.eat(/\{|%|#/)) { + state.tokenize = inTag(ch); + return "tag"; + } + } } - } - } - function inTag (close) { - if (close == "{") { - close = "}"; - } - return function (stream, state) { - var ch = stream.next(); - if ((ch == close) && stream.eat("}")) { - state.tokenize = tokenBase; - return "tag"; - } - if (stream.match(keywords)) { - return "keyword"; + + function inTag(close) { + if (close == "{") { + close = "}"; + } + return function (stream, state) { + var ch = stream.next(); + if ((ch == close) && stream.eat("}")) { + state.tokenize = tokenBase; + return "tag"; + } + if (stream.match(keywords)) { + return "keyword"; + } + return close == "#" ? "comment" : "string"; + }; } - return close == "#" ? "comment" : "string"; - }; - } - return { - startState: function () { - return {tokenize: tokenBase}; - }, - token: function (stream, state) { - return state.tokenize(stream, state); - } - }; - }); - CodeMirror.defineMode("tornado", function(config) { - var htmlBase = CodeMirror.getMode(config, "text/html"); - var tornadoInner = CodeMirror.getMode(config, "tornado:inner"); - return CodeMirror.overlayMode(htmlBase, tornadoInner); - }); + return { + startState: function () { + return {tokenize: tokenBase}; + }, + token: function (stream, state) { + return state.tokenize(stream, state); + } + }; + }); + + CodeMirror.defineMode("tornado", function (config) { + var htmlBase = CodeMirror.getMode(config, "text/html"); + var tornadoInner = CodeMirror.getMode(config, "tornado:inner"); + return CodeMirror.overlayMode(htmlBase, tornadoInner); + }); - CodeMirror.defineMIME("text/x-tornado", "tornado"); + CodeMirror.defineMIME("text/x-tornado", "tornado"); }); diff --git a/web/editor.md/lib/codemirror/mode/turtle/index.html b/web/editor.md/lib/codemirror/mode/turtle/index.html index a4962b6..68aaebf 100644 --- a/web/editor.md/lib/codemirror/mode/turtle/index.html +++ b/web/editor.md/lib/codemirror/mode/turtle/index.html @@ -2,29 +2,32 @@ CodeMirror: Turtle mode - + - + - +
    -

    Turtle mode

    -

    MIME types defined: text/turtle.

    -
    + diff --git a/web/editor.md/lib/codemirror/mode/turtle/turtle.js b/web/editor.md/lib/codemirror/mode/turtle/turtle.js index 0988f0a..eab1d77 100644 --- a/web/editor.md/lib/codemirror/mode/turtle/turtle.js +++ b/web/editor.md/lib/codemirror/mode/turtle/turtle.js @@ -1,162 +1,160 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("turtle", function(config) { - var indentUnit = config.indentUnit; - var curPunc; - - function wordRegexp(words) { - return new RegExp("^(?:" + words.join("|") + ")$", "i"); - } - var ops = wordRegexp([]); - var keywords = wordRegexp(["@prefix", "@base", "a"]); - var operatorChars = /[*+\-<>=&|]/; - - function tokenBase(stream, state) { - var ch = stream.next(); - curPunc = null; - if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) { - stream.match(/^[^\s\u00a0>]*>?/); - return "atom"; - } - else if (ch == "\"" || ch == "'") { - state.tokenize = tokenLiteral(ch); - return state.tokenize(stream, state); - } - else if (/[{}\(\),\.;\[\]]/.test(ch)) { - curPunc = ch; - return null; - } - else if (ch == "#") { - stream.skipToEnd(); - return "comment"; - } - else if (operatorChars.test(ch)) { - stream.eatWhile(operatorChars); - return null; - } - else if (ch == ":") { - return "operator"; - } else { - stream.eatWhile(/[_\w\d]/); - if(stream.peek() == ":") { - return "variable-3"; - } else { - var word = stream.current(); - - if(keywords.test(word)) { +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("turtle", function (config) { + var indentUnit = config.indentUnit; + var curPunc; + + function wordRegexp(words) { + return new RegExp("^(?:" + words.join("|") + ")$", "i"); + } + + var ops = wordRegexp([]); + var keywords = wordRegexp(["@prefix", "@base", "a"]); + var operatorChars = /[*+\-<>=&|]/; + + function tokenBase(stream, state) { + var ch = stream.next(); + curPunc = null; + if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) { + stream.match(/^[^\s\u00a0>]*>?/); + return "atom"; + } else if (ch == "\"" || ch == "'") { + state.tokenize = tokenLiteral(ch); + return state.tokenize(stream, state); + } else if (/[{}\(\),\.;\[\]]/.test(ch)) { + curPunc = ch; + return null; + } else if (ch == "#") { + stream.skipToEnd(); + return "comment"; + } else if (operatorChars.test(ch)) { + stream.eatWhile(operatorChars); + return null; + } else if (ch == ":") { + return "operator"; + } else { + stream.eatWhile(/[_\w\d]/); + if (stream.peek() == ":") { + return "variable-3"; + } else { + var word = stream.current(); + + if (keywords.test(word)) { return "meta"; - } + } - if(ch >= "A" && ch <= "Z") { - return "comment"; - } else { + if (ch >= "A" && ch <= "Z") { + return "comment"; + } else { return "keyword"; - } - } - var word = stream.current(); - if (ops.test(word)) - return null; - else if (keywords.test(word)) - return "meta"; - else - return "variable"; - } - } - - function tokenLiteral(quote) { - return function(stream, state) { - var escaped = false, ch; - while ((ch = stream.next()) != null) { - if (ch == quote && !escaped) { - state.tokenize = tokenBase; - break; + } + } + var word = stream.current(); + if (ops.test(word)) + return null; + else if (keywords.test(word)) + return "meta"; + else + return "variable"; + } } - escaped = !escaped && ch == "\\"; - } - return "string"; - }; - } - - function pushContext(state, type, col) { - state.context = {prev: state.context, indent: state.indent, col: col, type: type}; - } - function popContext(state) { - state.indent = state.context.indent; - state.context = state.context.prev; - } - - return { - startState: function() { - return {tokenize: tokenBase, - context: null, - indent: 0, - col: 0}; - }, - - token: function(stream, state) { - if (stream.sol()) { - if (state.context && state.context.align == null) state.context.align = false; - state.indent = stream.indentation(); - } - if (stream.eatSpace()) return null; - var style = state.tokenize(stream, state); - - if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") { - state.context.align = true; - } - - if (curPunc == "(") pushContext(state, ")", stream.column()); - else if (curPunc == "[") pushContext(state, "]", stream.column()); - else if (curPunc == "{") pushContext(state, "}", stream.column()); - else if (/[\]\}\)]/.test(curPunc)) { - while (state.context && state.context.type == "pattern") popContext(state); - if (state.context && curPunc == state.context.type) popContext(state); - } - else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state); - else if (/atom|string|variable/.test(style) && state.context) { - if (/[\}\]]/.test(state.context.type)) - pushContext(state, "pattern", stream.column()); - else if (state.context.type == "pattern" && !state.context.align) { - state.context.align = true; - state.context.col = stream.column(); + + function tokenLiteral(quote) { + return function (stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) { + state.tokenize = tokenBase; + break; + } + escaped = !escaped && ch == "\\"; + } + return "string"; + }; + } + + function pushContext(state, type, col) { + state.context = {prev: state.context, indent: state.indent, col: col, type: type}; + } + + function popContext(state) { + state.indent = state.context.indent; + state.context = state.context.prev; } - } - - return style; - }, - - indent: function(state, textAfter) { - var firstChar = textAfter && textAfter.charAt(0); - var context = state.context; - if (/[\]\}]/.test(firstChar)) - while (context && context.type == "pattern") context = context.prev; - - var closing = context && firstChar == context.type; - if (!context) - return 0; - else if (context.type == "pattern") - return context.col; - else if (context.align) - return context.col + (closing ? 0 : 1); - else - return context.indent + (closing ? 0 : indentUnit); - }, - - lineComment: "#" - }; -}); -CodeMirror.defineMIME("text/turtle", "turtle"); + return { + startState: function () { + return { + tokenize: tokenBase, + context: null, + indent: 0, + col: 0 + }; + }, + + token: function (stream, state) { + if (stream.sol()) { + if (state.context && state.context.align == null) state.context.align = false; + state.indent = stream.indentation(); + } + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + + if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") { + state.context.align = true; + } + + if (curPunc == "(") pushContext(state, ")", stream.column()); + else if (curPunc == "[") pushContext(state, "]", stream.column()); + else if (curPunc == "{") pushContext(state, "}", stream.column()); + else if (/[\]\}\)]/.test(curPunc)) { + while (state.context && state.context.type == "pattern") popContext(state); + if (state.context && curPunc == state.context.type) popContext(state); + } else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state); + else if (/atom|string|variable/.test(style) && state.context) { + if (/[\}\]]/.test(state.context.type)) + pushContext(state, "pattern", stream.column()); + else if (state.context.type == "pattern" && !state.context.align) { + state.context.align = true; + state.context.col = stream.column(); + } + } + + return style; + }, + + indent: function (state, textAfter) { + var firstChar = textAfter && textAfter.charAt(0); + var context = state.context; + if (/[\]\}]/.test(firstChar)) + while (context && context.type == "pattern") context = context.prev; + + var closing = context && firstChar == context.type; + if (!context) + return 0; + else if (context.type == "pattern") + return context.col; + else if (context.align) + return context.col + (closing ? 0 : 1); + else + return context.indent + (closing ? 0 : indentUnit); + }, + + lineComment: "#" + }; + }); + + CodeMirror.defineMIME("text/turtle", "turtle"); }); diff --git a/web/editor.md/lib/codemirror/mode/vb/index.html b/web/editor.md/lib/codemirror/mode/vb/index.html index adcc44f..3833ce2 100644 --- a/web/editor.md/lib/codemirror/mode/vb/index.html +++ b/web/editor.md/lib/codemirror/mode/vb/index.html @@ -2,101 +2,123 @@ CodeMirror: VB.NET mode - + - + - + + .CodeMirror { + border: 1px solid #aaa; + height: 210px; + height: auto; + } + + .CodeMirror-scroll { + overflow-x: auto; + overflow-y: hidden; + } + + .CodeMirror pre { + font-family: Inconsolata; + font-size: 14px + } +
    -

    VB.NET mode

    - - - -
    - -
    -
    
    -  

    MIME type defined: text/x-vb.

    +

    VB.NET mode

    + + + +
    + +
    +
    
    +    

    MIME type defined: text/x-vb.

    diff --git a/web/editor.md/lib/codemirror/mode/vb/vb.js b/web/editor.md/lib/codemirror/mode/vb/vb.js index 902203e..2206826 100644 --- a/web/editor.md/lib/codemirror/mode/vb/vb.js +++ b/web/editor.md/lib/codemirror/mode/vb/vb.js @@ -1,274 +1,282 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("vb", function(conf, parserConf) { - var ERRORCLASS = 'error'; - - function wordRegexp(words) { - return new RegExp("^((" + words.join(")|(") + "))\\b", "i"); - } - - var singleOperators = new RegExp("^[\\+\\-\\*/%&\\\\|\\^~<>!]"); - var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]'); - var doubleOperators = new RegExp("^((==)|(<>)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"); - var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"); - var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"); - var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); - - var openingKeywords = ['class','module', 'sub','enum','select','while','if','function', 'get','set','property', 'try']; - var middleKeywords = ['else','elseif','case', 'catch']; - var endKeywords = ['next','loop']; - - var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'in']); - var commonkeywords = ['as', 'dim', 'break', 'continue','optional', 'then', 'until', - 'goto', 'byval','byref','new','handles','property', 'return', - 'const','private', 'protected', 'friend', 'public', 'shared', 'static', 'true','false']; - var commontypes = ['integer','string','double','decimal','boolean','short','char', 'float','single']; - - var keywords = wordRegexp(commonkeywords); - var types = wordRegexp(commontypes); - var stringPrefixes = '"'; - - var opening = wordRegexp(openingKeywords); - var middle = wordRegexp(middleKeywords); - var closing = wordRegexp(endKeywords); - var doubleClosing = wordRegexp(['end']); - var doOpening = wordRegexp(['do']); - - var indentInfo = null; - - - - - function indent(_stream, state) { - state.currentIndent++; - } - - function dedent(_stream, state) { - state.currentIndent--; - } - // tokenizers - function tokenBase(stream, state) { - if (stream.eatSpace()) { - return null; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("vb", function (conf, parserConf) { + var ERRORCLASS = 'error'; + + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b", "i"); } - var ch = stream.peek(); + var singleOperators = new RegExp("^[\\+\\-\\*/%&\\\\|\\^~<>!]"); + var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]'); + var doubleOperators = new RegExp("^((==)|(<>)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"); + var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"); + var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"); + var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); - // Handle Comments - if (ch === "'") { - stream.skipToEnd(); - return 'comment'; - } + var openingKeywords = ['class', 'module', 'sub', 'enum', 'select', 'while', 'if', 'function', 'get', 'set', 'property', 'try']; + var middleKeywords = ['else', 'elseif', 'case', 'catch']; + var endKeywords = ['next', 'loop']; + var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'in']); + var commonkeywords = ['as', 'dim', 'break', 'continue', 'optional', 'then', 'until', + 'goto', 'byval', 'byref', 'new', 'handles', 'property', 'return', + 'const', 'private', 'protected', 'friend', 'public', 'shared', 'static', 'true', 'false']; + var commontypes = ['integer', 'string', 'double', 'decimal', 'boolean', 'short', 'char', 'float', 'single']; - // Handle Number Literals - if (stream.match(/^((&H)|(&O))?[0-9\.a-f]/i, false)) { - var floatLiteral = false; - // Floats - if (stream.match(/^\d*\.\d+F?/i)) { floatLiteral = true; } - else if (stream.match(/^\d+\.\d*F?/)) { floatLiteral = true; } - else if (stream.match(/^\.\d+F?/)) { floatLiteral = true; } + var keywords = wordRegexp(commonkeywords); + var types = wordRegexp(commontypes); + var stringPrefixes = '"'; - if (floatLiteral) { - // Float literals may be "imaginary" - stream.eat(/J/i); - return 'number'; - } - // Integers - var intLiteral = false; - // Hex - if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; } - // Octal - else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; } - // Decimal - else if (stream.match(/^[1-9]\d*F?/)) { - // Decimal literals may be "imaginary" - stream.eat(/J/i); - // TODO - Can you have imaginary longs? - intLiteral = true; - } - // Zero by itself with no other piece of number. - else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; } - if (intLiteral) { - // Integer literals may be "long" - stream.eat(/L/i); - return 'number'; - } - } + var opening = wordRegexp(openingKeywords); + var middle = wordRegexp(middleKeywords); + var closing = wordRegexp(endKeywords); + var doubleClosing = wordRegexp(['end']); + var doOpening = wordRegexp(['do']); - // Handle Strings - if (stream.match(stringPrefixes)) { - state.tokenize = tokenStringFactory(stream.current()); - return state.tokenize(stream, state); - } + var indentInfo = null; - // Handle operators and Delimiters - if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) { - return null; - } - if (stream.match(doubleOperators) - || stream.match(singleOperators) - || stream.match(wordOperators)) { - return 'operator'; - } - if (stream.match(singleDelimiters)) { - return null; - } - if (stream.match(doOpening)) { - indent(stream,state); - state.doInCurrentLine = true; - return 'keyword'; - } - if (stream.match(opening)) { - if (! state.doInCurrentLine) - indent(stream,state); - else - state.doInCurrentLine = false; - return 'keyword'; - } - if (stream.match(middle)) { - return 'keyword'; - } - if (stream.match(doubleClosing)) { - dedent(stream,state); - dedent(stream,state); - return 'keyword'; - } - if (stream.match(closing)) { - dedent(stream,state); - return 'keyword'; + function indent(_stream, state) { + state.currentIndent++; } - if (stream.match(types)) { - return 'keyword'; + function dedent(_stream, state) { + state.currentIndent--; } - if (stream.match(keywords)) { - return 'keyword'; - } + // tokenizers + function tokenBase(stream, state) { + if (stream.eatSpace()) { + return null; + } - if (stream.match(identifiers)) { - return 'variable'; - } + var ch = stream.peek(); - // Handle non-detected items - stream.next(); - return ERRORCLASS; - } - - function tokenStringFactory(delimiter) { - var singleline = delimiter.length == 1; - var OUTCLASS = 'string'; - - return function(stream, state) { - while (!stream.eol()) { - stream.eatWhile(/[^'"]/); - if (stream.match(delimiter)) { - state.tokenize = tokenBase; - return OUTCLASS; - } else { - stream.eat(/['"]/); - } + // Handle Comments + if (ch === "'") { + stream.skipToEnd(); + return 'comment'; } - if (singleline) { - if (parserConf.singleLineStringErrors) { - return ERRORCLASS; - } else { - state.tokenize = tokenBase; + + + // Handle Number Literals + if (stream.match(/^((&H)|(&O))?[0-9\.a-f]/i, false)) { + var floatLiteral = false; + // Floats + if (stream.match(/^\d*\.\d+F?/i)) { + floatLiteral = true; + } else if (stream.match(/^\d+\.\d*F?/)) { + floatLiteral = true; + } else if (stream.match(/^\.\d+F?/)) { + floatLiteral = true; + } + + if (floatLiteral) { + // Float literals may be "imaginary" + stream.eat(/J/i); + return 'number'; + } + // Integers + var intLiteral = false; + // Hex + if (stream.match(/^&H[0-9a-f]+/i)) { + intLiteral = true; + } + // Octal + else if (stream.match(/^&O[0-7]+/i)) { + intLiteral = true; + } + // Decimal + else if (stream.match(/^[1-9]\d*F?/)) { + // Decimal literals may be "imaginary" + stream.eat(/J/i); + // TODO - Can you have imaginary longs? + intLiteral = true; + } + // Zero by itself with no other piece of number. + else if (stream.match(/^0(?![\dx])/i)) { + intLiteral = true; + } + if (intLiteral) { + // Integer literals may be "long" + stream.eat(/L/i); + return 'number'; } } - return OUTCLASS; - }; - } + // Handle Strings + if (stream.match(stringPrefixes)) { + state.tokenize = tokenStringFactory(stream.current()); + return state.tokenize(stream, state); + } - function tokenLexer(stream, state) { - var style = state.tokenize(stream, state); - var current = stream.current(); + // Handle operators and Delimiters + if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) { + return null; + } + if (stream.match(doubleOperators) + || stream.match(singleOperators) + || stream.match(wordOperators)) { + return 'operator'; + } + if (stream.match(singleDelimiters)) { + return null; + } + if (stream.match(doOpening)) { + indent(stream, state); + state.doInCurrentLine = true; + return 'keyword'; + } + if (stream.match(opening)) { + if (!state.doInCurrentLine) + indent(stream, state); + else + state.doInCurrentLine = false; + return 'keyword'; + } + if (stream.match(middle)) { + return 'keyword'; + } - // Handle '.' connected identifiers - if (current === '.') { - style = state.tokenize(stream, state); - current = stream.current(); - if (style === 'variable') { - return 'variable'; - } else { - return ERRORCLASS; + if (stream.match(doubleClosing)) { + dedent(stream, state); + dedent(stream, state); + return 'keyword'; + } + if (stream.match(closing)) { + dedent(stream, state); + return 'keyword'; } - } + if (stream.match(types)) { + return 'keyword'; + } - var delimiter_index = '[({'.indexOf(current); - if (delimiter_index !== -1) { - indent(stream, state ); - } - if (indentInfo === 'dedent') { - if (dedent(stream, state)) { - return ERRORCLASS; + if (stream.match(keywords)) { + return 'keyword'; } - } - delimiter_index = '])}'.indexOf(current); - if (delimiter_index !== -1) { - if (dedent(stream, state)) { - return ERRORCLASS; + + if (stream.match(identifiers)) { + return 'variable'; } + + // Handle non-detected items + stream.next(); + return ERRORCLASS; + } + + function tokenStringFactory(delimiter) { + var singleline = delimiter.length == 1; + var OUTCLASS = 'string'; + + return function (stream, state) { + while (!stream.eol()) { + stream.eatWhile(/[^'"]/); + if (stream.match(delimiter)) { + state.tokenize = tokenBase; + return OUTCLASS; + } else { + stream.eat(/['"]/); + } + } + if (singleline) { + if (parserConf.singleLineStringErrors) { + return ERRORCLASS; + } else { + state.tokenize = tokenBase; + } + } + return OUTCLASS; + }; } - return style; - } - var external = { - electricChars:"dDpPtTfFeE ", - startState: function() { - return { - tokenize: tokenBase, - lastToken: null, - currentIndent: 0, - nextLineIndent: 0, - doInCurrentLine: false + function tokenLexer(stream, state) { + var style = state.tokenize(stream, state); + var current = stream.current(); + // Handle '.' connected identifiers + if (current === '.') { + style = state.tokenize(stream, state); + current = stream.current(); + if (style === 'variable') { + return 'variable'; + } else { + return ERRORCLASS; + } + } - }; - }, - token: function(stream, state) { - if (stream.sol()) { - state.currentIndent += state.nextLineIndent; - state.nextLineIndent = 0; - state.doInCurrentLine = 0; + var delimiter_index = '[({'.indexOf(current); + if (delimiter_index !== -1) { + indent(stream, state); + } + if (indentInfo === 'dedent') { + if (dedent(stream, state)) { + return ERRORCLASS; + } + } + delimiter_index = '])}'.indexOf(current); + if (delimiter_index !== -1) { + if (dedent(stream, state)) { + return ERRORCLASS; + } } - var style = tokenLexer(stream, state); - state.lastToken = {style:style, content: stream.current()}; + return style; + } + var external = { + electricChars: "dDpPtTfFeE ", + startState: function () { + return { + tokenize: tokenBase, + lastToken: null, + currentIndent: 0, + nextLineIndent: 0, + doInCurrentLine: false + + + }; + }, + + token: function (stream, state) { + if (stream.sol()) { + state.currentIndent += state.nextLineIndent; + state.nextLineIndent = 0; + state.doInCurrentLine = 0; + } + var style = tokenLexer(stream, state); + state.lastToken = {style: style, content: stream.current()}; - return style; - }, - indent: function(state, textAfter) { - var trueText = textAfter.replace(/^\s+|\s+$/g, '') ; - if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit*(state.currentIndent-1); - if(state.currentIndent < 0) return 0; - return state.currentIndent * conf.indentUnit; - } + return style; + }, - }; - return external; -}); + indent: function (state, textAfter) { + var trueText = textAfter.replace(/^\s+|\s+$/g, ''); + if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit * (state.currentIndent - 1); + if (state.currentIndent < 0) return 0; + return state.currentIndent * conf.indentUnit; + } + + }; + return external; + }); -CodeMirror.defineMIME("text/x-vb", "vb"); + CodeMirror.defineMIME("text/x-vb", "vb"); }); diff --git a/web/editor.md/lib/codemirror/mode/vbscript/index.html b/web/editor.md/lib/codemirror/mode/vbscript/index.html index ad7532d..4fdd4fa 100644 --- a/web/editor.md/lib/codemirror/mode/vbscript/index.html +++ b/web/editor.md/lib/codemirror/mode/vbscript/index.html @@ -2,31 +2,34 @@ CodeMirror: VBScript mode - + - + - +
    -

    VBScript mode

    +

    VBScript mode

    -

    MIME types defined: text/vbscript.

    -
    + diff --git a/web/editor.md/lib/codemirror/mode/vbscript/vbscript.js b/web/editor.md/lib/codemirror/mode/vbscript/vbscript.js index b66df22..ce6b064 100644 --- a/web/editor.md/lib/codemirror/mode/vbscript/vbscript.js +++ b/web/editor.md/lib/codemirror/mode/vbscript/vbscript.js @@ -12,339 +12,351 @@ E.G.: }); */ -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("vbscript", function(conf, parserConf) { - var ERRORCLASS = 'error'; - - function wordRegexp(words) { - return new RegExp("^((" + words.join(")|(") + "))\\b", "i"); - } - - var singleOperators = new RegExp("^[\\+\\-\\*/&\\\\\\^<>=]"); - var doubleOperators = new RegExp("^((<>)|(<=)|(>=))"); - var singleDelimiters = new RegExp('^[\\.,]'); - var brakets = new RegExp('^[\\(\\)]'); - var identifiers = new RegExp("^[A-Za-z][_A-Za-z0-9]*"); - - var openingKeywords = ['class','sub','select','while','if','function', 'property', 'with', 'for']; - var middleKeywords = ['else','elseif','case']; - var endKeywords = ['next','loop','wend']; - - var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'is', 'mod', 'eqv', 'imp']); - var commonkeywords = ['dim', 'redim', 'then', 'until', 'randomize', - 'byval','byref','new','property', 'exit', 'in', - 'const','private', 'public', - 'get','set','let', 'stop', 'on error resume next', 'on error goto 0', 'option explicit', 'call', 'me']; - - //This list was from: http://msdn.microsoft.com/en-us/library/f8tbc79x(v=vs.84).aspx - var atomWords = ['true', 'false', 'nothing', 'empty', 'null']; - //This list was from: http://msdn.microsoft.com/en-us/library/3ca8tfek(v=vs.84).aspx - var builtinFuncsWords = ['abs', 'array', 'asc', 'atn', 'cbool', 'cbyte', 'ccur', 'cdate', 'cdbl', 'chr', 'cint', 'clng', 'cos', 'csng', 'cstr', 'date', 'dateadd', 'datediff', 'datepart', - 'dateserial', 'datevalue', 'day', 'escape', 'eval', 'execute', 'exp', 'filter', 'formatcurrency', 'formatdatetime', 'formatnumber', 'formatpercent', 'getlocale', 'getobject', - 'getref', 'hex', 'hour', 'inputbox', 'instr', 'instrrev', 'int', 'fix', 'isarray', 'isdate', 'isempty', 'isnull', 'isnumeric', 'isobject', 'join', 'lbound', 'lcase', 'left', - 'len', 'loadpicture', 'log', 'ltrim', 'rtrim', 'trim', 'maths', 'mid', 'minute', 'month', 'monthname', 'msgbox', 'now', 'oct', 'replace', 'rgb', 'right', 'rnd', 'round', - 'scriptengine', 'scriptenginebuildversion', 'scriptenginemajorversion', 'scriptengineminorversion', 'second', 'setlocale', 'sgn', 'sin', 'space', 'split', 'sqr', 'strcomp', - 'string', 'strreverse', 'tan', 'time', 'timer', 'timeserial', 'timevalue', 'typename', 'ubound', 'ucase', 'unescape', 'vartype', 'weekday', 'weekdayname', 'year']; - - //This list was from: http://msdn.microsoft.com/en-us/library/ydz4cfk3(v=vs.84).aspx - var builtinConsts = ['vbBlack', 'vbRed', 'vbGreen', 'vbYellow', 'vbBlue', 'vbMagenta', 'vbCyan', 'vbWhite', 'vbBinaryCompare', 'vbTextCompare', - 'vbSunday', 'vbMonday', 'vbTuesday', 'vbWednesday', 'vbThursday', 'vbFriday', 'vbSaturday', 'vbUseSystemDayOfWeek', 'vbFirstJan1', 'vbFirstFourDays', 'vbFirstFullWeek', - 'vbGeneralDate', 'vbLongDate', 'vbShortDate', 'vbLongTime', 'vbShortTime', 'vbObjectError', - 'vbOKOnly', 'vbOKCancel', 'vbAbortRetryIgnore', 'vbYesNoCancel', 'vbYesNo', 'vbRetryCancel', 'vbCritical', 'vbQuestion', 'vbExclamation', 'vbInformation', 'vbDefaultButton1', 'vbDefaultButton2', - 'vbDefaultButton3', 'vbDefaultButton4', 'vbApplicationModal', 'vbSystemModal', 'vbOK', 'vbCancel', 'vbAbort', 'vbRetry', 'vbIgnore', 'vbYes', 'vbNo', - 'vbCr', 'VbCrLf', 'vbFormFeed', 'vbLf', 'vbNewLine', 'vbNullChar', 'vbNullString', 'vbTab', 'vbVerticalTab', 'vbUseDefault', 'vbTrue', 'vbFalse', - 'vbEmpty', 'vbNull', 'vbInteger', 'vbLong', 'vbSingle', 'vbDouble', 'vbCurrency', 'vbDate', 'vbString', 'vbObject', 'vbError', 'vbBoolean', 'vbVariant', 'vbDataObject', 'vbDecimal', 'vbByte', 'vbArray']; - //This list was from: http://msdn.microsoft.com/en-us/library/hkc375ea(v=vs.84).aspx - var builtinObjsWords = ['WScript', 'err', 'debug', 'RegExp']; - var knownProperties = ['description', 'firstindex', 'global', 'helpcontext', 'helpfile', 'ignorecase', 'length', 'number', 'pattern', 'source', 'value', 'count']; - var knownMethods = ['clear', 'execute', 'raise', 'replace', 'test', 'write', 'writeline', 'close', 'open', 'state', 'eof', 'update', 'addnew', 'end', 'createobject', 'quit']; - - var aspBuiltinObjsWords = ['server', 'response', 'request', 'session', 'application']; - var aspKnownProperties = ['buffer', 'cachecontrol', 'charset', 'contenttype', 'expires', 'expiresabsolute', 'isclientconnected', 'pics', 'status', //response - 'clientcertificate', 'cookies', 'form', 'querystring', 'servervariables', 'totalbytes', //request - 'contents', 'staticobjects', //application - 'codepage', 'lcid', 'sessionid', 'timeout', //session - 'scripttimeout']; //server - var aspKnownMethods = ['addheader', 'appendtolog', 'binarywrite', 'end', 'flush', 'redirect', //response - 'binaryread', //request - 'remove', 'removeall', 'lock', 'unlock', //application - 'abandon', //session - 'getlasterror', 'htmlencode', 'mappath', 'transfer', 'urlencode']; //server - - var knownWords = knownMethods.concat(knownProperties); - - builtinObjsWords = builtinObjsWords.concat(builtinConsts); - - if (conf.isASP){ - builtinObjsWords = builtinObjsWords.concat(aspBuiltinObjsWords); - knownWords = knownWords.concat(aspKnownMethods, aspKnownProperties); - }; - - var keywords = wordRegexp(commonkeywords); - var atoms = wordRegexp(atomWords); - var builtinFuncs = wordRegexp(builtinFuncsWords); - var builtinObjs = wordRegexp(builtinObjsWords); - var known = wordRegexp(knownWords); - var stringPrefixes = '"'; - - var opening = wordRegexp(openingKeywords); - var middle = wordRegexp(middleKeywords); - var closing = wordRegexp(endKeywords); - var doubleClosing = wordRegexp(['end']); - var doOpening = wordRegexp(['do']); - var noIndentWords = wordRegexp(['on error resume next', 'exit']); - var comment = wordRegexp(['rem']); - - - function indent(_stream, state) { - state.currentIndent++; - } - - function dedent(_stream, state) { - state.currentIndent--; - } - // tokenizers - function tokenBase(stream, state) { - if (stream.eatSpace()) { - return 'space'; - //return null; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("vbscript", function (conf, parserConf) { + var ERRORCLASS = 'error'; + + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b", "i"); } - var ch = stream.peek(); - - // Handle Comments - if (ch === "'") { - stream.skipToEnd(); - return 'comment'; + var singleOperators = new RegExp("^[\\+\\-\\*/&\\\\\\^<>=]"); + var doubleOperators = new RegExp("^((<>)|(<=)|(>=))"); + var singleDelimiters = new RegExp('^[\\.,]'); + var brakets = new RegExp('^[\\(\\)]'); + var identifiers = new RegExp("^[A-Za-z][_A-Za-z0-9]*"); + + var openingKeywords = ['class', 'sub', 'select', 'while', 'if', 'function', 'property', 'with', 'for']; + var middleKeywords = ['else', 'elseif', 'case']; + var endKeywords = ['next', 'loop', 'wend']; + + var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'is', 'mod', 'eqv', 'imp']); + var commonkeywords = ['dim', 'redim', 'then', 'until', 'randomize', + 'byval', 'byref', 'new', 'property', 'exit', 'in', + 'const', 'private', 'public', + 'get', 'set', 'let', 'stop', 'on error resume next', 'on error goto 0', 'option explicit', 'call', 'me']; + + //This list was from: http://msdn.microsoft.com/en-us/library/f8tbc79x(v=vs.84).aspx + var atomWords = ['true', 'false', 'nothing', 'empty', 'null']; + //This list was from: http://msdn.microsoft.com/en-us/library/3ca8tfek(v=vs.84).aspx + var builtinFuncsWords = ['abs', 'array', 'asc', 'atn', 'cbool', 'cbyte', 'ccur', 'cdate', 'cdbl', 'chr', 'cint', 'clng', 'cos', 'csng', 'cstr', 'date', 'dateadd', 'datediff', 'datepart', + 'dateserial', 'datevalue', 'day', 'escape', 'eval', 'execute', 'exp', 'filter', 'formatcurrency', 'formatdatetime', 'formatnumber', 'formatpercent', 'getlocale', 'getobject', + 'getref', 'hex', 'hour', 'inputbox', 'instr', 'instrrev', 'int', 'fix', 'isarray', 'isdate', 'isempty', 'isnull', 'isnumeric', 'isobject', 'join', 'lbound', 'lcase', 'left', + 'len', 'loadpicture', 'log', 'ltrim', 'rtrim', 'trim', 'maths', 'mid', 'minute', 'month', 'monthname', 'msgbox', 'now', 'oct', 'replace', 'rgb', 'right', 'rnd', 'round', + 'scriptengine', 'scriptenginebuildversion', 'scriptenginemajorversion', 'scriptengineminorversion', 'second', 'setlocale', 'sgn', 'sin', 'space', 'split', 'sqr', 'strcomp', + 'string', 'strreverse', 'tan', 'time', 'timer', 'timeserial', 'timevalue', 'typename', 'ubound', 'ucase', 'unescape', 'vartype', 'weekday', 'weekdayname', 'year']; + + //This list was from: http://msdn.microsoft.com/en-us/library/ydz4cfk3(v=vs.84).aspx + var builtinConsts = ['vbBlack', 'vbRed', 'vbGreen', 'vbYellow', 'vbBlue', 'vbMagenta', 'vbCyan', 'vbWhite', 'vbBinaryCompare', 'vbTextCompare', + 'vbSunday', 'vbMonday', 'vbTuesday', 'vbWednesday', 'vbThursday', 'vbFriday', 'vbSaturday', 'vbUseSystemDayOfWeek', 'vbFirstJan1', 'vbFirstFourDays', 'vbFirstFullWeek', + 'vbGeneralDate', 'vbLongDate', 'vbShortDate', 'vbLongTime', 'vbShortTime', 'vbObjectError', + 'vbOKOnly', 'vbOKCancel', 'vbAbortRetryIgnore', 'vbYesNoCancel', 'vbYesNo', 'vbRetryCancel', 'vbCritical', 'vbQuestion', 'vbExclamation', 'vbInformation', 'vbDefaultButton1', 'vbDefaultButton2', + 'vbDefaultButton3', 'vbDefaultButton4', 'vbApplicationModal', 'vbSystemModal', 'vbOK', 'vbCancel', 'vbAbort', 'vbRetry', 'vbIgnore', 'vbYes', 'vbNo', + 'vbCr', 'VbCrLf', 'vbFormFeed', 'vbLf', 'vbNewLine', 'vbNullChar', 'vbNullString', 'vbTab', 'vbVerticalTab', 'vbUseDefault', 'vbTrue', 'vbFalse', + 'vbEmpty', 'vbNull', 'vbInteger', 'vbLong', 'vbSingle', 'vbDouble', 'vbCurrency', 'vbDate', 'vbString', 'vbObject', 'vbError', 'vbBoolean', 'vbVariant', 'vbDataObject', 'vbDecimal', 'vbByte', 'vbArray']; + //This list was from: http://msdn.microsoft.com/en-us/library/hkc375ea(v=vs.84).aspx + var builtinObjsWords = ['WScript', 'err', 'debug', 'RegExp']; + var knownProperties = ['description', 'firstindex', 'global', 'helpcontext', 'helpfile', 'ignorecase', 'length', 'number', 'pattern', 'source', 'value', 'count']; + var knownMethods = ['clear', 'execute', 'raise', 'replace', 'test', 'write', 'writeline', 'close', 'open', 'state', 'eof', 'update', 'addnew', 'end', 'createobject', 'quit']; + + var aspBuiltinObjsWords = ['server', 'response', 'request', 'session', 'application']; + var aspKnownProperties = ['buffer', 'cachecontrol', 'charset', 'contenttype', 'expires', 'expiresabsolute', 'isclientconnected', 'pics', 'status', //response + 'clientcertificate', 'cookies', 'form', 'querystring', 'servervariables', 'totalbytes', //request + 'contents', 'staticobjects', //application + 'codepage', 'lcid', 'sessionid', 'timeout', //session + 'scripttimeout']; //server + var aspKnownMethods = ['addheader', 'appendtolog', 'binarywrite', 'end', 'flush', 'redirect', //response + 'binaryread', //request + 'remove', 'removeall', 'lock', 'unlock', //application + 'abandon', //session + 'getlasterror', 'htmlencode', 'mappath', 'transfer', 'urlencode']; //server + + var knownWords = knownMethods.concat(knownProperties); + + builtinObjsWords = builtinObjsWords.concat(builtinConsts); + + if (conf.isASP) { + builtinObjsWords = builtinObjsWords.concat(aspBuiltinObjsWords); + knownWords = knownWords.concat(aspKnownMethods, aspKnownProperties); } - if (stream.match(comment)){ - stream.skipToEnd(); - return 'comment'; + ; + + var keywords = wordRegexp(commonkeywords); + var atoms = wordRegexp(atomWords); + var builtinFuncs = wordRegexp(builtinFuncsWords); + var builtinObjs = wordRegexp(builtinObjsWords); + var known = wordRegexp(knownWords); + var stringPrefixes = '"'; + + var opening = wordRegexp(openingKeywords); + var middle = wordRegexp(middleKeywords); + var closing = wordRegexp(endKeywords); + var doubleClosing = wordRegexp(['end']); + var doOpening = wordRegexp(['do']); + var noIndentWords = wordRegexp(['on error resume next', 'exit']); + var comment = wordRegexp(['rem']); + + + function indent(_stream, state) { + state.currentIndent++; } + function dedent(_stream, state) { + state.currentIndent--; + } - // Handle Number Literals - if (stream.match(/^((&H)|(&O))?[0-9\.]/i, false) && !stream.match(/^((&H)|(&O))?[0-9\.]+[a-z_]/i, false)) { - var floatLiteral = false; - // Floats - if (stream.match(/^\d*\.\d+/i)) { floatLiteral = true; } - else if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; } - else if (stream.match(/^\.\d+/)) { floatLiteral = true; } + // tokenizers + function tokenBase(stream, state) { + if (stream.eatSpace()) { + return 'space'; + //return null; + } - if (floatLiteral) { - // Float literals may be "imaginary" - stream.eat(/J/i); - return 'number'; + var ch = stream.peek(); + + // Handle Comments + if (ch === "'") { + stream.skipToEnd(); + return 'comment'; } - // Integers - var intLiteral = false; - // Hex - if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; } - // Octal - else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; } - // Decimal - else if (stream.match(/^[1-9]\d*F?/)) { - // Decimal literals may be "imaginary" - stream.eat(/J/i); - // TODO - Can you have imaginary longs? - intLiteral = true; + if (stream.match(comment)) { + stream.skipToEnd(); + return 'comment'; } - // Zero by itself with no other piece of number. - else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; } - if (intLiteral) { - // Integer literals may be "long" - stream.eat(/L/i); - return 'number'; + + + // Handle Number Literals + if (stream.match(/^((&H)|(&O))?[0-9\.]/i, false) && !stream.match(/^((&H)|(&O))?[0-9\.]+[a-z_]/i, false)) { + var floatLiteral = false; + // Floats + if (stream.match(/^\d*\.\d+/i)) { + floatLiteral = true; + } else if (stream.match(/^\d+\.\d*/)) { + floatLiteral = true; + } else if (stream.match(/^\.\d+/)) { + floatLiteral = true; + } + + if (floatLiteral) { + // Float literals may be "imaginary" + stream.eat(/J/i); + return 'number'; + } + // Integers + var intLiteral = false; + // Hex + if (stream.match(/^&H[0-9a-f]+/i)) { + intLiteral = true; + } + // Octal + else if (stream.match(/^&O[0-7]+/i)) { + intLiteral = true; + } + // Decimal + else if (stream.match(/^[1-9]\d*F?/)) { + // Decimal literals may be "imaginary" + stream.eat(/J/i); + // TODO - Can you have imaginary longs? + intLiteral = true; + } + // Zero by itself with no other piece of number. + else if (stream.match(/^0(?![\dx])/i)) { + intLiteral = true; + } + if (intLiteral) { + // Integer literals may be "long" + stream.eat(/L/i); + return 'number'; + } } - } - // Handle Strings - if (stream.match(stringPrefixes)) { - state.tokenize = tokenStringFactory(stream.current()); - return state.tokenize(stream, state); - } + // Handle Strings + if (stream.match(stringPrefixes)) { + state.tokenize = tokenStringFactory(stream.current()); + return state.tokenize(stream, state); + } - // Handle operators and Delimiters - if (stream.match(doubleOperators) - || stream.match(singleOperators) - || stream.match(wordOperators)) { - return 'operator'; - } - if (stream.match(singleDelimiters)) { - return null; - } + // Handle operators and Delimiters + if (stream.match(doubleOperators) + || stream.match(singleOperators) + || stream.match(wordOperators)) { + return 'operator'; + } + if (stream.match(singleDelimiters)) { + return null; + } - if (stream.match(brakets)) { - return "bracket"; - } + if (stream.match(brakets)) { + return "bracket"; + } - if (stream.match(noIndentWords)) { - state.doInCurrentLine = true; + if (stream.match(noIndentWords)) { + state.doInCurrentLine = true; - return 'keyword'; - } + return 'keyword'; + } - if (stream.match(doOpening)) { - indent(stream,state); - state.doInCurrentLine = true; + if (stream.match(doOpening)) { + indent(stream, state); + state.doInCurrentLine = true; - return 'keyword'; - } - if (stream.match(opening)) { - if (! state.doInCurrentLine) - indent(stream,state); - else - state.doInCurrentLine = false; + return 'keyword'; + } + if (stream.match(opening)) { + if (!state.doInCurrentLine) + indent(stream, state); + else + state.doInCurrentLine = false; - return 'keyword'; - } - if (stream.match(middle)) { - return 'keyword'; - } + return 'keyword'; + } + if (stream.match(middle)) { + return 'keyword'; + } - if (stream.match(doubleClosing)) { - dedent(stream,state); - dedent(stream,state); + if (stream.match(doubleClosing)) { + dedent(stream, state); + dedent(stream, state); - return 'keyword'; - } - if (stream.match(closing)) { - if (! state.doInCurrentLine) - dedent(stream,state); - else - state.doInCurrentLine = false; + return 'keyword'; + } + if (stream.match(closing)) { + if (!state.doInCurrentLine) + dedent(stream, state); + else + state.doInCurrentLine = false; - return 'keyword'; - } + return 'keyword'; + } - if (stream.match(keywords)) { - return 'keyword'; - } + if (stream.match(keywords)) { + return 'keyword'; + } - if (stream.match(atoms)) { - return 'atom'; - } + if (stream.match(atoms)) { + return 'atom'; + } - if (stream.match(known)) { - return 'variable-2'; - } + if (stream.match(known)) { + return 'variable-2'; + } - if (stream.match(builtinFuncs)) { - return 'builtin'; - } + if (stream.match(builtinFuncs)) { + return 'builtin'; + } - if (stream.match(builtinObjs)){ - return 'variable-2'; - } + if (stream.match(builtinObjs)) { + return 'variable-2'; + } + + if (stream.match(identifiers)) { + return 'variable'; + } - if (stream.match(identifiers)) { - return 'variable'; + // Handle non-detected items + stream.next(); + return ERRORCLASS; } - // Handle non-detected items - stream.next(); - return ERRORCLASS; - } - - function tokenStringFactory(delimiter) { - var singleline = delimiter.length == 1; - var OUTCLASS = 'string'; - - return function(stream, state) { - while (!stream.eol()) { - stream.eatWhile(/[^'"]/); - if (stream.match(delimiter)) { - state.tokenize = tokenBase; - return OUTCLASS; - } else { - stream.eat(/['"]/); + function tokenStringFactory(delimiter) { + var singleline = delimiter.length == 1; + var OUTCLASS = 'string'; + + return function (stream, state) { + while (!stream.eol()) { + stream.eatWhile(/[^'"]/); + if (stream.match(delimiter)) { + state.tokenize = tokenBase; + return OUTCLASS; + } else { + stream.eat(/['"]/); + } } - } - if (singleline) { - if (parserConf.singleLineStringErrors) { - return ERRORCLASS; - } else { - state.tokenize = tokenBase; + if (singleline) { + if (parserConf.singleLineStringErrors) { + return ERRORCLASS; + } else { + state.tokenize = tokenBase; + } } - } - return OUTCLASS; - }; - } + return OUTCLASS; + }; + } - function tokenLexer(stream, state) { - var style = state.tokenize(stream, state); - var current = stream.current(); + function tokenLexer(stream, state) { + var style = state.tokenize(stream, state); + var current = stream.current(); - // Handle '.' connected identifiers - if (current === '.') { - style = state.tokenize(stream, state); + // Handle '.' connected identifiers + if (current === '.') { + style = state.tokenize(stream, state); - current = stream.current(); - if (style && (style.substr(0, 8) === 'variable' || style==='builtin' || style==='keyword')){//|| knownWords.indexOf(current.substring(1)) > -1) { - if (style === 'builtin' || style === 'keyword') style='variable'; - if (knownWords.indexOf(current.substr(1)) > -1) style='variable-2'; + current = stream.current(); + if (style && (style.substr(0, 8) === 'variable' || style === 'builtin' || style === 'keyword')) {//|| knownWords.indexOf(current.substring(1)) > -1) { + if (style === 'builtin' || style === 'keyword') style = 'variable'; + if (knownWords.indexOf(current.substr(1)) > -1) style = 'variable-2'; - return style; - } else { - return ERRORCLASS; + return style; + } else { + return ERRORCLASS; + } } + + return style; } - return style; - } - - var external = { - electricChars:"dDpPtTfFeE ", - startState: function() { - return { - tokenize: tokenBase, - lastToken: null, - currentIndent: 0, - nextLineIndent: 0, - doInCurrentLine: false, - ignoreKeyword: false - - - }; - }, - - token: function(stream, state) { - if (stream.sol()) { - state.currentIndent += state.nextLineIndent; - state.nextLineIndent = 0; - state.doInCurrentLine = 0; - } - var style = tokenLexer(stream, state); + var external = { + electricChars: "dDpPtTfFeE ", + startState: function () { + return { + tokenize: tokenBase, + lastToken: null, + currentIndent: 0, + nextLineIndent: 0, + doInCurrentLine: false, + ignoreKeyword: false + + + }; + }, + + token: function (stream, state) { + if (stream.sol()) { + state.currentIndent += state.nextLineIndent; + state.nextLineIndent = 0; + state.doInCurrentLine = 0; + } + var style = tokenLexer(stream, state); - state.lastToken = {style:style, content: stream.current()}; + state.lastToken = {style: style, content: stream.current()}; - if (style==='space') style=null; + if (style === 'space') style = null; - return style; - }, + return style; + }, - indent: function(state, textAfter) { - var trueText = textAfter.replace(/^\s+|\s+$/g, '') ; - if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit*(state.currentIndent-1); - if(state.currentIndent < 0) return 0; - return state.currentIndent * conf.indentUnit; - } + indent: function (state, textAfter) { + var trueText = textAfter.replace(/^\s+|\s+$/g, ''); + if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit * (state.currentIndent - 1); + if (state.currentIndent < 0) return 0; + return state.currentIndent * conf.indentUnit; + } - }; - return external; -}); + }; + return external; + }); -CodeMirror.defineMIME("text/vbscript", "vbscript"); + CodeMirror.defineMIME("text/vbscript", "vbscript"); }); diff --git a/web/editor.md/lib/codemirror/mode/velocity/index.html b/web/editor.md/lib/codemirror/mode/velocity/index.html index 2747878..4bb1646 100644 --- a/web/editor.md/lib/codemirror/mode/velocity/index.html +++ b/web/editor.md/lib/codemirror/mode/velocity/index.html @@ -2,30 +2,32 @@ CodeMirror: Velocity mode - + - - + + - +
    -

    Velocity mode

    -

    MIME types defined: text/velocity.

    -
    + diff --git a/web/editor.md/lib/codemirror/mode/velocity/velocity.js b/web/editor.md/lib/codemirror/mode/velocity/velocity.js index 8fc4f95..cd96d80 100644 --- a/web/editor.md/lib/codemirror/mode/velocity/velocity.js +++ b/web/editor.md/lib/codemirror/mode/velocity/velocity.js @@ -1,201 +1,200 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("velocity", function() { - function parseWords(str) { - var obj = {}, words = str.split(" "); - for (var i = 0; i < words.length; ++i) obj[words[i]] = true; - return obj; - } + CodeMirror.defineMode("velocity", function () { + function parseWords(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } - var keywords = parseWords("#end #else #break #stop #[[ #]] " + - "#{end} #{else} #{break} #{stop}"); - var functions = parseWords("#if #elseif #foreach #set #include #parse #macro #define #evaluate " + - "#{if} #{elseif} #{foreach} #{set} #{include} #{parse} #{macro} #{define} #{evaluate}"); - var specials = parseWords("$foreach.count $foreach.hasNext $foreach.first $foreach.last $foreach.topmost $foreach.parent.count $foreach.parent.hasNext $foreach.parent.first $foreach.parent.last $foreach.parent $velocityCount $!bodyContent $bodyContent"); - var isOperatorChar = /[+\-*&%=<>!?:\/|]/; + var keywords = parseWords("#end #else #break #stop #[[ #]] " + + "#{end} #{else} #{break} #{stop}"); + var functions = parseWords("#if #elseif #foreach #set #include #parse #macro #define #evaluate " + + "#{if} #{elseif} #{foreach} #{set} #{include} #{parse} #{macro} #{define} #{evaluate}"); + var specials = parseWords("$foreach.count $foreach.hasNext $foreach.first $foreach.last $foreach.topmost $foreach.parent.count $foreach.parent.hasNext $foreach.parent.first $foreach.parent.last $foreach.parent $velocityCount $!bodyContent $bodyContent"); + var isOperatorChar = /[+\-*&%=<>!?:\/|]/; - function chain(stream, state, f) { - state.tokenize = f; - return f(stream, state); - } - function tokenBase(stream, state) { - var beforeParams = state.beforeParams; - state.beforeParams = false; - var ch = stream.next(); - // start of unparsed string? - if ((ch == "'") && state.inParams) { - state.lastTokenWasBuiltin = false; - return chain(stream, state, tokenString(ch)); + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); } - // start of parsed string? - else if ((ch == '"')) { - state.lastTokenWasBuiltin = false; - if (state.inString) { - state.inString = false; - return "string"; - } - else if (state.inParams) + + function tokenBase(stream, state) { + var beforeParams = state.beforeParams; + state.beforeParams = false; + var ch = stream.next(); + // start of unparsed string? + if ((ch == "'") && state.inParams) { + state.lastTokenWasBuiltin = false; return chain(stream, state, tokenString(ch)); - } - // is it one of the special signs []{}().,;? Seperator? - else if (/[\[\]{}\(\),;\.]/.test(ch)) { - if (ch == "(" && beforeParams) - state.inParams = true; - else if (ch == ")") { - state.inParams = false; - state.lastTokenWasBuiltin = true; } - return null; - } - // start of a number value? - else if (/\d/.test(ch)) { - state.lastTokenWasBuiltin = false; - stream.eatWhile(/[\w\.]/); - return "number"; - } - // multi line comment? - else if (ch == "#" && stream.eat("*")) { - state.lastTokenWasBuiltin = false; - return chain(stream, state, tokenComment); - } - // unparsed content? - else if (ch == "#" && stream.match(/ *\[ *\[/)) { - state.lastTokenWasBuiltin = false; - return chain(stream, state, tokenUnparsed); - } - // single line comment? - else if (ch == "#" && stream.eat("#")) { - state.lastTokenWasBuiltin = false; - stream.skipToEnd(); - return "comment"; - } - // variable? - else if (ch == "$") { - stream.eatWhile(/[\w\d\$_\.{}]/); - // is it one of the specials? - if (specials && specials.propertyIsEnumerable(stream.current())) { - return "keyword"; + // start of parsed string? + else if ((ch == '"')) { + state.lastTokenWasBuiltin = false; + if (state.inString) { + state.inString = false; + return "string"; + } else if (state.inParams) + return chain(stream, state, tokenString(ch)); } - else { - state.lastTokenWasBuiltin = true; - state.beforeParams = true; - return "builtin"; + // is it one of the special signs []{}().,;? Seperator? + else if (/[\[\]{}\(\),;\.]/.test(ch)) { + if (ch == "(" && beforeParams) + state.inParams = true; + else if (ch == ")") { + state.inParams = false; + state.lastTokenWasBuiltin = true; + } + return null; } - } - // is it a operator? - else if (isOperatorChar.test(ch)) { - state.lastTokenWasBuiltin = false; - stream.eatWhile(isOperatorChar); - return "operator"; - } - else { - // get the whole word - stream.eatWhile(/[\w\$_{}@]/); - var word = stream.current(); - // is it one of the listed keywords? - if (keywords && keywords.propertyIsEnumerable(word)) - return "keyword"; - // is it one of the listed functions? - if (functions && functions.propertyIsEnumerable(word) || - (stream.current().match(/^#@?[a-z0-9_]+ *$/i) && stream.peek()=="(") && - !(functions && functions.propertyIsEnumerable(word.toLowerCase()))) { - state.beforeParams = true; + // start of a number value? + else if (/\d/.test(ch)) { state.lastTokenWasBuiltin = false; - return "keyword"; + stream.eatWhile(/[\w\.]/); + return "number"; } - if (state.inString) { + // multi line comment? + else if (ch == "#" && stream.eat("*")) { state.lastTokenWasBuiltin = false; - return "string"; + return chain(stream, state, tokenComment); + } + // unparsed content? + else if (ch == "#" && stream.match(/ *\[ *\[/)) { + state.lastTokenWasBuiltin = false; + return chain(stream, state, tokenUnparsed); + } + // single line comment? + else if (ch == "#" && stream.eat("#")) { + state.lastTokenWasBuiltin = false; + stream.skipToEnd(); + return "comment"; + } + // variable? + else if (ch == "$") { + stream.eatWhile(/[\w\d\$_\.{}]/); + // is it one of the specials? + if (specials && specials.propertyIsEnumerable(stream.current())) { + return "keyword"; + } else { + state.lastTokenWasBuiltin = true; + state.beforeParams = true; + return "builtin"; + } + } + // is it a operator? + else if (isOperatorChar.test(ch)) { + state.lastTokenWasBuiltin = false; + stream.eatWhile(isOperatorChar); + return "operator"; + } else { + // get the whole word + stream.eatWhile(/[\w\$_{}@]/); + var word = stream.current(); + // is it one of the listed keywords? + if (keywords && keywords.propertyIsEnumerable(word)) + return "keyword"; + // is it one of the listed functions? + if (functions && functions.propertyIsEnumerable(word) || + (stream.current().match(/^#@?[a-z0-9_]+ *$/i) && stream.peek() == "(") && + !(functions && functions.propertyIsEnumerable(word.toLowerCase()))) { + state.beforeParams = true; + state.lastTokenWasBuiltin = false; + return "keyword"; + } + if (state.inString) { + state.lastTokenWasBuiltin = false; + return "string"; + } + if (stream.pos > word.length && stream.string.charAt(stream.pos - word.length - 1) == "." && state.lastTokenWasBuiltin) + return "builtin"; + // default: just a "word" + state.lastTokenWasBuiltin = false; + return null; } - if (stream.pos > word.length && stream.string.charAt(stream.pos-word.length-1)=="." && state.lastTokenWasBuiltin) - return "builtin"; - // default: just a "word" - state.lastTokenWasBuiltin = false; - return null; } - } - function tokenString(quote) { - return function(stream, state) { - var escaped = false, next, end = false; - while ((next = stream.next()) != null) { - if ((next == quote) && !escaped) { - end = true; - break; + function tokenString(quote) { + return function (stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if ((next == quote) && !escaped) { + end = true; + break; + } + if (quote == '"' && stream.peek() == '$' && !escaped) { + state.inString = true; + end = true; + break; + } + escaped = !escaped && next == "\\"; } - if (quote=='"' && stream.peek() == '$' && !escaped) { - state.inString = true; - end = true; + if (end) state.tokenize = tokenBase; + return "string"; + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "#" && maybeEnd) { + state.tokenize = tokenBase; break; } - escaped = !escaped && next == "\\"; + maybeEnd = (ch == "*"); } - if (end) state.tokenize = tokenBase; - return "string"; - }; - } - - function tokenComment(stream, state) { - var maybeEnd = false, ch; - while (ch = stream.next()) { - if (ch == "#" && maybeEnd) { - state.tokenize = tokenBase; - break; - } - maybeEnd = (ch == "*"); + return "comment"; } - return "comment"; - } - function tokenUnparsed(stream, state) { - var maybeEnd = 0, ch; - while (ch = stream.next()) { - if (ch == "#" && maybeEnd == 2) { - state.tokenize = tokenBase; - break; + function tokenUnparsed(stream, state) { + var maybeEnd = 0, ch; + while (ch = stream.next()) { + if (ch == "#" && maybeEnd == 2) { + state.tokenize = tokenBase; + break; + } + if (ch == "]") + maybeEnd++; + else if (ch != " ") + maybeEnd = 0; } - if (ch == "]") - maybeEnd++; - else if (ch != " ") - maybeEnd = 0; + return "meta"; } - return "meta"; - } - // Interface - return { - startState: function() { - return { - tokenize: tokenBase, - beforeParams: false, - inParams: false, - inString: false, - lastTokenWasBuiltin: false - }; - }, + // Interface - token: function(stream, state) { - if (stream.eatSpace()) return null; - return state.tokenize(stream, state); - }, - blockCommentStart: "#*", - blockCommentEnd: "*#", - lineComment: "##", - fold: "velocity" - }; -}); + return { + startState: function () { + return { + tokenize: tokenBase, + beforeParams: false, + inParams: false, + inString: false, + lastTokenWasBuiltin: false + }; + }, + + token: function (stream, state) { + if (stream.eatSpace()) return null; + return state.tokenize(stream, state); + }, + blockCommentStart: "#*", + blockCommentEnd: "*#", + lineComment: "##", + fold: "velocity" + }; + }); -CodeMirror.defineMIME("text/velocity", "velocity"); + CodeMirror.defineMIME("text/velocity", "velocity"); }); diff --git a/web/editor.md/lib/codemirror/mode/verilog/index.html b/web/editor.md/lib/codemirror/mode/verilog/index.html index 96b3d64..1098543 100644 --- a/web/editor.md/lib/codemirror/mode/verilog/index.html +++ b/web/editor.md/lib/codemirror/mode/verilog/index.html @@ -2,31 +2,34 @@ CodeMirror: Verilog/SystemVerilog mode - + - + - +
    -

    SystemVerilog mode

    +

    SystemVerilog mode

    -
    - + -

    -Syntax highlighting and indentation for the Verilog and SystemVerilog languages (IEEE 1800). -

    Configuration options:

    -
      -
    • noIndentKeywords - List of keywords which should not cause identation to increase. E.g. ["package", "module"]. Default: None
    • -
    -

    +

    + Syntax highlighting and indentation for the Verilog and SystemVerilog languages (IEEE 1800). +

    Configuration options:

    +
      +
    • noIndentKeywords - List of keywords which should not cause identation to increase. E.g. + ["package", "module"]. Default: None +
    • +
    +

    -

    MIME types defined: text/x-verilog and text/x-systemverilog.

    +

    MIME types defined: text/x-verilog and text/x-systemverilog.

    diff --git a/web/editor.md/lib/codemirror/mode/verilog/test.js b/web/editor.md/lib/codemirror/mode/verilog/test.js index 9c8c094..209b74c 100644 --- a/web/editor.md/lib/codemirror/mode/verilog/test.js +++ b/web/editor.md/lib/codemirror/mode/verilog/test.js @@ -1,273 +1,276 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function() { - var mode = CodeMirror.getMode({indentUnit: 4}, "verilog"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } - - MT("binary_literals", - "[number 1'b0]", - "[number 1'b1]", - "[number 1'bx]", - "[number 1'bz]", - "[number 1'bX]", - "[number 1'bZ]", - "[number 1'B0]", - "[number 1'B1]", - "[number 1'Bx]", - "[number 1'Bz]", - "[number 1'BX]", - "[number 1'BZ]", - "[number 1'b0]", - "[number 1'b1]", - "[number 2'b01]", - "[number 2'bxz]", - "[number 2'b11]", - "[number 2'b10]", - "[number 2'b1Z]", - "[number 12'b0101_0101_0101]", - "[number 1'b 0]", - "[number 'b0101]" - ); - - MT("octal_literals", - "[number 3'o7]", - "[number 3'O7]", - "[number 3'so7]", - "[number 3'SO7]" - ); - - MT("decimal_literals", - "[number 0]", - "[number 1]", - "[number 7]", - "[number 123_456]", - "[number 'd33]", - "[number 8'd255]", - "[number 8'D255]", - "[number 8'sd255]", - "[number 8'SD255]", - "[number 32'd123]", - "[number 32 'd123]", - "[number 32 'd 123]" - ); - - MT("hex_literals", - "[number 4'h0]", - "[number 4'ha]", - "[number 4'hF]", - "[number 4'hx]", - "[number 4'hz]", - "[number 4'hX]", - "[number 4'hZ]", - "[number 32'hdc78]", - "[number 32'hDC78]", - "[number 32 'hDC78]", - "[number 32'h DC78]", - "[number 32 'h DC78]", - "[number 32'h44x7]", - "[number 32'hFFF?]" - ); - - MT("real_number_literals", - "[number 1.2]", - "[number 0.1]", - "[number 2394.26331]", - "[number 1.2E12]", - "[number 1.2e12]", - "[number 1.30e-2]", - "[number 0.1e-0]", - "[number 23E10]", - "[number 29E-2]", - "[number 236.123_763_e-12]" - ); - - MT("operators", - "[meta ^]" - ); - - MT("keywords", - "[keyword logic]", - "[keyword logic] [variable foo]", - "[keyword reg] [variable abc]" - ); - - MT("variables", - "[variable _leading_underscore]", - "[variable _if]", - "[number 12] [variable foo]", - "[variable foo] [number 14]" - ); - - MT("tick_defines", - "[def `FOO]", - "[def `foo]", - "[def `FOO_bar]" - ); - - MT("system_calls", - "[meta $display]", - "[meta $vpi_printf]" - ); - - MT("line_comment", "[comment // Hello world]"); - - // Alignment tests - MT("align_port_map_style1", - /** - * mod mod(.a(a), - * .b(b) - * ); - */ - "[variable mod] [variable mod][bracket (].[variable a][bracket (][variable a][bracket )],", - " .[variable b][bracket (][variable b][bracket )]", - " [bracket )];", - "" - ); - - MT("align_port_map_style2", - /** - * mod mod( - * .a(a), - * .b(b) - * ); - */ - "[variable mod] [variable mod][bracket (]", - " .[variable a][bracket (][variable a][bracket )],", - " .[variable b][bracket (][variable b][bracket )]", - "[bracket )];", - "" - ); - - // Indentation tests - MT("indent_single_statement_if", - "[keyword if] [bracket (][variable foo][bracket )]", - " [keyword break];", - "" - ); - - MT("no_indent_after_single_line_if", - "[keyword if] [bracket (][variable foo][bracket )] [keyword break];", - "" - ); - - MT("indent_after_if_begin_same_line", - "[keyword if] [bracket (][variable foo][bracket )] [keyword begin]", - " [keyword break];", - " [keyword break];", - "[keyword end]", - "" - ); - - MT("indent_after_if_begin_next_line", - "[keyword if] [bracket (][variable foo][bracket )]", - " [keyword begin]", - " [keyword break];", - " [keyword break];", - " [keyword end]", - "" - ); - - MT("indent_single_statement_if_else", - "[keyword if] [bracket (][variable foo][bracket )]", - " [keyword break];", - "[keyword else]", - " [keyword break];", - "" - ); - - MT("indent_if_else_begin_same_line", - "[keyword if] [bracket (][variable foo][bracket )] [keyword begin]", - " [keyword break];", - " [keyword break];", - "[keyword end] [keyword else] [keyword begin]", - " [keyword break];", - " [keyword break];", - "[keyword end]", - "" - ); - - MT("indent_if_else_begin_next_line", - "[keyword if] [bracket (][variable foo][bracket )]", - " [keyword begin]", - " [keyword break];", - " [keyword break];", - " [keyword end]", - "[keyword else]", - " [keyword begin]", - " [keyword break];", - " [keyword break];", - " [keyword end]", - "" - ); - - MT("indent_if_nested_without_begin", - "[keyword if] [bracket (][variable foo][bracket )]", - " [keyword if] [bracket (][variable foo][bracket )]", - " [keyword if] [bracket (][variable foo][bracket )]", - " [keyword break];", - "" - ); - - MT("indent_case", - "[keyword case] [bracket (][variable state][bracket )]", - " [variable FOO]:", - " [keyword break];", - " [variable BAR]:", - " [keyword break];", - "[keyword endcase]", - "" - ); - - MT("unindent_after_end_with_preceding_text", - "[keyword begin]", - " [keyword break]; [keyword end]", - "" - ); - - MT("export_function_one_line_does_not_indent", - "[keyword export] [string \"DPI-C\"] [keyword function] [variable helloFromSV];", - "" - ); - - MT("export_task_one_line_does_not_indent", - "[keyword export] [string \"DPI-C\"] [keyword task] [variable helloFromSV];", - "" - ); - - MT("export_function_two_lines_indents_properly", - "[keyword export]", - " [string \"DPI-C\"] [keyword function] [variable helloFromSV];", - "" - ); - - MT("export_task_two_lines_indents_properly", - "[keyword export]", - " [string \"DPI-C\"] [keyword task] [variable helloFromSV];", - "" - ); - - MT("import_function_one_line_does_not_indent", - "[keyword import] [string \"DPI-C\"] [keyword function] [variable helloFromC];", - "" - ); - - MT("import_task_one_line_does_not_indent", - "[keyword import] [string \"DPI-C\"] [keyword task] [variable helloFromC];", - "" - ); - - MT("import_package_single_line_does_not_indent", - "[keyword import] [variable p]::[variable x];", - "[keyword import] [variable p]::[variable y];", - "" - ); - - MT("covergoup_with_function_indents_properly", - "[keyword covergroup] [variable cg] [keyword with] [keyword function] [variable sample][bracket (][keyword bit] [variable b][bracket )];", - " [variable c] : [keyword coverpoint] [variable c];", - "[keyword endgroup]: [variable cg]", - "" - ); +(function () { + var mode = CodeMirror.getMode({indentUnit: 4}, "verilog"); + + function MT(name) { + test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); + } + + MT("binary_literals", + "[number 1'b0]", + "[number 1'b1]", + "[number 1'bx]", + "[number 1'bz]", + "[number 1'bX]", + "[number 1'bZ]", + "[number 1'B0]", + "[number 1'B1]", + "[number 1'Bx]", + "[number 1'Bz]", + "[number 1'BX]", + "[number 1'BZ]", + "[number 1'b0]", + "[number 1'b1]", + "[number 2'b01]", + "[number 2'bxz]", + "[number 2'b11]", + "[number 2'b10]", + "[number 2'b1Z]", + "[number 12'b0101_0101_0101]", + "[number 1'b 0]", + "[number 'b0101]" + ); + + MT("octal_literals", + "[number 3'o7]", + "[number 3'O7]", + "[number 3'so7]", + "[number 3'SO7]" + ); + + MT("decimal_literals", + "[number 0]", + "[number 1]", + "[number 7]", + "[number 123_456]", + "[number 'd33]", + "[number 8'd255]", + "[number 8'D255]", + "[number 8'sd255]", + "[number 8'SD255]", + "[number 32'd123]", + "[number 32 'd123]", + "[number 32 'd 123]" + ); + + MT("hex_literals", + "[number 4'h0]", + "[number 4'ha]", + "[number 4'hF]", + "[number 4'hx]", + "[number 4'hz]", + "[number 4'hX]", + "[number 4'hZ]", + "[number 32'hdc78]", + "[number 32'hDC78]", + "[number 32 'hDC78]", + "[number 32'h DC78]", + "[number 32 'h DC78]", + "[number 32'h44x7]", + "[number 32'hFFF?]" + ); + + MT("real_number_literals", + "[number 1.2]", + "[number 0.1]", + "[number 2394.26331]", + "[number 1.2E12]", + "[number 1.2e12]", + "[number 1.30e-2]", + "[number 0.1e-0]", + "[number 23E10]", + "[number 29E-2]", + "[number 236.123_763_e-12]" + ); + + MT("operators", + "[meta ^]" + ); + + MT("keywords", + "[keyword logic]", + "[keyword logic] [variable foo]", + "[keyword reg] [variable abc]" + ); + + MT("variables", + "[variable _leading_underscore]", + "[variable _if]", + "[number 12] [variable foo]", + "[variable foo] [number 14]" + ); + + MT("tick_defines", + "[def `FOO]", + "[def `foo]", + "[def `FOO_bar]" + ); + + MT("system_calls", + "[meta $display]", + "[meta $vpi_printf]" + ); + + MT("line_comment", "[comment // Hello world]"); + + // Alignment tests + MT("align_port_map_style1", + /** + * mod mod(.a(a), + * .b(b) + * ); + */ + "[variable mod] [variable mod][bracket (].[variable a][bracket (][variable a][bracket )],", + " .[variable b][bracket (][variable b][bracket )]", + " [bracket )];", + "" + ); + + MT("align_port_map_style2", + /** + * mod mod( + * .a(a), + * .b(b) + * ); + */ + "[variable mod] [variable mod][bracket (]", + " .[variable a][bracket (][variable a][bracket )],", + " .[variable b][bracket (][variable b][bracket )]", + "[bracket )];", + "" + ); + + // Indentation tests + MT("indent_single_statement_if", + "[keyword if] [bracket (][variable foo][bracket )]", + " [keyword break];", + "" + ); + + MT("no_indent_after_single_line_if", + "[keyword if] [bracket (][variable foo][bracket )] [keyword break];", + "" + ); + + MT("indent_after_if_begin_same_line", + "[keyword if] [bracket (][variable foo][bracket )] [keyword begin]", + " [keyword break];", + " [keyword break];", + "[keyword end]", + "" + ); + + MT("indent_after_if_begin_next_line", + "[keyword if] [bracket (][variable foo][bracket )]", + " [keyword begin]", + " [keyword break];", + " [keyword break];", + " [keyword end]", + "" + ); + + MT("indent_single_statement_if_else", + "[keyword if] [bracket (][variable foo][bracket )]", + " [keyword break];", + "[keyword else]", + " [keyword break];", + "" + ); + + MT("indent_if_else_begin_same_line", + "[keyword if] [bracket (][variable foo][bracket )] [keyword begin]", + " [keyword break];", + " [keyword break];", + "[keyword end] [keyword else] [keyword begin]", + " [keyword break];", + " [keyword break];", + "[keyword end]", + "" + ); + + MT("indent_if_else_begin_next_line", + "[keyword if] [bracket (][variable foo][bracket )]", + " [keyword begin]", + " [keyword break];", + " [keyword break];", + " [keyword end]", + "[keyword else]", + " [keyword begin]", + " [keyword break];", + " [keyword break];", + " [keyword end]", + "" + ); + + MT("indent_if_nested_without_begin", + "[keyword if] [bracket (][variable foo][bracket )]", + " [keyword if] [bracket (][variable foo][bracket )]", + " [keyword if] [bracket (][variable foo][bracket )]", + " [keyword break];", + "" + ); + + MT("indent_case", + "[keyword case] [bracket (][variable state][bracket )]", + " [variable FOO]:", + " [keyword break];", + " [variable BAR]:", + " [keyword break];", + "[keyword endcase]", + "" + ); + + MT("unindent_after_end_with_preceding_text", + "[keyword begin]", + " [keyword break]; [keyword end]", + "" + ); + + MT("export_function_one_line_does_not_indent", + "[keyword export] [string \"DPI-C\"] [keyword function] [variable helloFromSV];", + "" + ); + + MT("export_task_one_line_does_not_indent", + "[keyword export] [string \"DPI-C\"] [keyword task] [variable helloFromSV];", + "" + ); + + MT("export_function_two_lines_indents_properly", + "[keyword export]", + " [string \"DPI-C\"] [keyword function] [variable helloFromSV];", + "" + ); + + MT("export_task_two_lines_indents_properly", + "[keyword export]", + " [string \"DPI-C\"] [keyword task] [variable helloFromSV];", + "" + ); + + MT("import_function_one_line_does_not_indent", + "[keyword import] [string \"DPI-C\"] [keyword function] [variable helloFromC];", + "" + ); + + MT("import_task_one_line_does_not_indent", + "[keyword import] [string \"DPI-C\"] [keyword task] [variable helloFromC];", + "" + ); + + MT("import_package_single_line_does_not_indent", + "[keyword import] [variable p]::[variable x];", + "[keyword import] [variable p]::[variable y];", + "" + ); + + MT("covergoup_with_function_indents_properly", + "[keyword covergroup] [variable cg] [keyword with] [keyword function] [variable sample][bracket (][keyword bit] [variable b][bracket )];", + " [variable c] : [keyword coverpoint] [variable c];", + "[keyword endgroup]: [variable cg]", + "" + ); })(); diff --git a/web/editor.md/lib/codemirror/mode/verilog/verilog.js b/web/editor.md/lib/codemirror/mode/verilog/verilog.js index 96b9f24..e4cf3cb 100644 --- a/web/editor.md/lib/codemirror/mode/verilog/verilog.js +++ b/web/editor.md/lib/codemirror/mode/verilog/verilog.js @@ -1,537 +1,549 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("verilog", function(config, parserConfig) { - - var indentUnit = config.indentUnit, - statementIndentUnit = parserConfig.statementIndentUnit || indentUnit, - dontAlignCalls = parserConfig.dontAlignCalls, - noIndentKeywords = parserConfig.noIndentKeywords || [], - multiLineStrings = parserConfig.multiLineStrings, - hooks = parserConfig.hooks || {}; - - function words(str) { - var obj = {}, words = str.split(" "); - for (var i = 0; i < words.length; ++i) obj[words[i]] = true; - return obj; - } - - /** - * Keywords from IEEE 1800-2012 - */ - var keywords = words( - "accept_on alias always always_comb always_ff always_latch and assert assign assume automatic before begin bind " + - "bins binsof bit break buf bufif0 bufif1 byte case casex casez cell chandle checker class clocking cmos config " + - "const constraint context continue cover covergroup coverpoint cross deassign default defparam design disable " + - "dist do edge else end endcase endchecker endclass endclocking endconfig endfunction endgenerate endgroup " + - "endinterface endmodule endpackage endprimitive endprogram endproperty endspecify endsequence endtable endtask " + - "enum event eventually expect export extends extern final first_match for force foreach forever fork forkjoin " + - "function generate genvar global highz0 highz1 if iff ifnone ignore_bins illegal_bins implements implies import " + - "incdir include initial inout input inside instance int integer interconnect interface intersect join join_any " + - "join_none large let liblist library local localparam logic longint macromodule matches medium modport module " + - "nand negedge nettype new nexttime nmos nor noshowcancelled not notif0 notif1 null or output package packed " + - "parameter pmos posedge primitive priority program property protected pull0 pull1 pulldown pullup " + - "pulsestyle_ondetect pulsestyle_onevent pure rand randc randcase randsequence rcmos real realtime ref reg " + - "reject_on release repeat restrict return rnmos rpmos rtran rtranif0 rtranif1 s_always s_eventually s_nexttime " + - "s_until s_until_with scalared sequence shortint shortreal showcancelled signed small soft solve specify " + - "specparam static string strong strong0 strong1 struct super supply0 supply1 sync_accept_on sync_reject_on " + - "table tagged task this throughout time timeprecision timeunit tran tranif0 tranif1 tri tri0 tri1 triand trior " + - "trireg type typedef union unique unique0 unsigned until until_with untyped use uwire var vectored virtual void " + - "wait wait_order wand weak weak0 weak1 while wildcard wire with within wor xnor xor"); - - /** Operators from IEEE 1800-2012 - unary_operator ::= - + | - | ! | ~ | & | ~& | | | ~| | ^ | ~^ | ^~ - binary_operator ::= - + | - | * | / | % | == | != | === | !== | ==? | !=? | && | || | ** - | < | <= | > | >= | & | | | ^ | ^~ | ~^ | >> | << | >>> | <<< - | -> | <-> - inc_or_dec_operator ::= ++ | -- - unary_module_path_operator ::= - ! | ~ | & | ~& | | | ~| | ^ | ~^ | ^~ - binary_module_path_operator ::= - == | != | && | || | & | | | ^ | ^~ | ~^ - */ - var isOperatorChar = /[\+\-\*\/!~&|^%=?:]/; - var isBracketChar = /[\[\]{}()]/; - - var unsignedNumber = /\d[0-9_]*/; - var decimalLiteral = /\d*\s*'s?d\s*\d[0-9_]*/i; - var binaryLiteral = /\d*\s*'s?b\s*[xz01][xz01_]*/i; - var octLiteral = /\d*\s*'s?o\s*[xz0-7][xz0-7_]*/i; - var hexLiteral = /\d*\s*'s?h\s*[0-9a-fxz?][0-9a-fxz?_]*/i; - var realLiteral = /(\d[\d_]*(\.\d[\d_]*)?E-?[\d_]+)|(\d[\d_]*\.\d[\d_]*)/i; - - var closingBracketOrWord = /^((\w+)|[)}\]])/; - var closingBracket = /[)}\]]/; - - var curPunc; - var curKeyword; - - // Block openings which are closed by a matching keyword in the form of ("end" + keyword) - // E.g. "task" => "endtask" - var blockKeywords = words( - "case checker class clocking config function generate interface module package" + - "primitive program property specify sequence table task" - ); - - // Opening/closing pairs - var openClose = {}; - for (var keyword in blockKeywords) { - openClose[keyword] = "end" + keyword; - } - openClose["begin"] = "end"; - openClose["casex"] = "endcase"; - openClose["casez"] = "endcase"; - openClose["do" ] = "while"; - openClose["fork" ] = "join;join_any;join_none"; - openClose["covergroup"] = "endgroup"; - - for (var i in noIndentKeywords) { - var keyword = noIndentKeywords[i]; - if (openClose[keyword]) { - openClose[keyword] = undefined; - } - } +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("verilog", function (config, parserConfig) { + + var indentUnit = config.indentUnit, + statementIndentUnit = parserConfig.statementIndentUnit || indentUnit, + dontAlignCalls = parserConfig.dontAlignCalls, + noIndentKeywords = parserConfig.noIndentKeywords || [], + multiLineStrings = parserConfig.multiLineStrings, + hooks = parserConfig.hooks || {}; + + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } - // Keywords which open statements that are ended with a semi-colon - var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else export for foreach forever if import initial repeat while"); + /** + * Keywords from IEEE 1800-2012 + */ + var keywords = words( + "accept_on alias always always_comb always_ff always_latch and assert assign assume automatic before begin bind " + + "bins binsof bit break buf bufif0 bufif1 byte case casex casez cell chandle checker class clocking cmos config " + + "const constraint context continue cover covergroup coverpoint cross deassign default defparam design disable " + + "dist do edge else end endcase endchecker endclass endclocking endconfig endfunction endgenerate endgroup " + + "endinterface endmodule endpackage endprimitive endprogram endproperty endspecify endsequence endtable endtask " + + "enum event eventually expect export extends extern final first_match for force foreach forever fork forkjoin " + + "function generate genvar global highz0 highz1 if iff ifnone ignore_bins illegal_bins implements implies import " + + "incdir include initial inout input inside instance int integer interconnect interface intersect join join_any " + + "join_none large let liblist library local localparam logic longint macromodule matches medium modport module " + + "nand negedge nettype new nexttime nmos nor noshowcancelled not notif0 notif1 null or output package packed " + + "parameter pmos posedge primitive priority program property protected pull0 pull1 pulldown pullup " + + "pulsestyle_ondetect pulsestyle_onevent pure rand randc randcase randsequence rcmos real realtime ref reg " + + "reject_on release repeat restrict return rnmos rpmos rtran rtranif0 rtranif1 s_always s_eventually s_nexttime " + + "s_until s_until_with scalared sequence shortint shortreal showcancelled signed small soft solve specify " + + "specparam static string strong strong0 strong1 struct super supply0 supply1 sync_accept_on sync_reject_on " + + "table tagged task this throughout time timeprecision timeunit tran tranif0 tranif1 tri tri0 tri1 triand trior " + + "trireg type typedef union unique unique0 unsigned until until_with untyped use uwire var vectored virtual void " + + "wait wait_order wand weak weak0 weak1 while wildcard wire with within wor xnor xor"); + + /** Operators from IEEE 1800-2012 + unary_operator ::= + + | - | ! | ~ | & | ~& | | | ~| | ^ | ~^ | ^~ + binary_operator ::= + + | - | * | / | % | == | != | === | !== | ==? | !=? | && | || | ** + | < | <= | > | >= | & | | | ^ | ^~ | ~^ | >> | << | >>> | <<< + | -> | <-> + inc_or_dec_operator ::= ++ | -- + unary_module_path_operator ::= + ! | ~ | & | ~& | | | ~| | ^ | ~^ | ^~ + binary_module_path_operator ::= + == | != | && | || | & | | | ^ | ^~ | ~^ + */ + var isOperatorChar = /[\+\-\*\/!~&|^%=?:]/; + var isBracketChar = /[\[\]{}()]/; + + var unsignedNumber = /\d[0-9_]*/; + var decimalLiteral = /\d*\s*'s?d\s*\d[0-9_]*/i; + var binaryLiteral = /\d*\s*'s?b\s*[xz01][xz01_]*/i; + var octLiteral = /\d*\s*'s?o\s*[xz0-7][xz0-7_]*/i; + var hexLiteral = /\d*\s*'s?h\s*[0-9a-fxz?][0-9a-fxz?_]*/i; + var realLiteral = /(\d[\d_]*(\.\d[\d_]*)?E-?[\d_]+)|(\d[\d_]*\.\d[\d_]*)/i; + + var closingBracketOrWord = /^((\w+)|[)}\]])/; + var closingBracket = /[)}\]]/; + + var curPunc; + var curKeyword; + + // Block openings which are closed by a matching keyword in the form of ("end" + keyword) + // E.g. "task" => "endtask" + var blockKeywords = words( + "case checker class clocking config function generate interface module package" + + "primitive program property specify sequence table task" + ); + + // Opening/closing pairs + var openClose = {}; + for (var keyword in blockKeywords) { + openClose[keyword] = "end" + keyword; + } + openClose["begin"] = "end"; + openClose["casex"] = "endcase"; + openClose["casez"] = "endcase"; + openClose["do"] = "while"; + openClose["fork"] = "join;join_any;join_none"; + openClose["covergroup"] = "endgroup"; + + for (var i in noIndentKeywords) { + var keyword = noIndentKeywords[i]; + if (openClose[keyword]) { + openClose[keyword] = undefined; + } + } - function tokenBase(stream, state) { - var ch = stream.peek(), style; - if (hooks[ch] && (style = hooks[ch](stream, state)) != false) return style; - if (hooks.tokenBase && (style = hooks.tokenBase(stream, state)) != false) - return style; + // Keywords which open statements that are ended with a semi-colon + var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else export for foreach forever if import initial repeat while"); - if (/[,;:\.]/.test(ch)) { - curPunc = stream.next(); - return null; - } - if (isBracketChar.test(ch)) { - curPunc = stream.next(); - return "bracket"; - } - // Macros (tick-defines) - if (ch == '`') { - stream.next(); - if (stream.eatWhile(/[\w\$_]/)) { - return "def"; - } else { - return null; - } - } - // System calls - if (ch == '$') { - stream.next(); - if (stream.eatWhile(/[\w\$_]/)) { - return "meta"; - } else { - return null; - } - } - // Time literals - if (ch == '#') { - stream.next(); - stream.eatWhile(/[\d_.]/); - return "def"; - } - // Strings - if (ch == '"') { - stream.next(); - state.tokenize = tokenString(ch); - return state.tokenize(stream, state); - } - // Comments - if (ch == "/") { - stream.next(); - if (stream.eat("*")) { - state.tokenize = tokenComment; - return tokenComment(stream, state); - } - if (stream.eat("/")) { - stream.skipToEnd(); - return "comment"; - } - stream.backUp(1); - } + function tokenBase(stream, state) { + var ch = stream.peek(), style; + if (hooks[ch] && (style = hooks[ch](stream, state)) != false) return style; + if (hooks.tokenBase && (style = hooks.tokenBase(stream, state)) != false) + return style; - // Numeric literals - if (stream.match(realLiteral) || - stream.match(decimalLiteral) || - stream.match(binaryLiteral) || - stream.match(octLiteral) || - stream.match(hexLiteral) || - stream.match(unsignedNumber) || - stream.match(realLiteral)) { - return "number"; - } + if (/[,;:\.]/.test(ch)) { + curPunc = stream.next(); + return null; + } + if (isBracketChar.test(ch)) { + curPunc = stream.next(); + return "bracket"; + } + // Macros (tick-defines) + if (ch == '`') { + stream.next(); + if (stream.eatWhile(/[\w\$_]/)) { + return "def"; + } else { + return null; + } + } + // System calls + if (ch == '$') { + stream.next(); + if (stream.eatWhile(/[\w\$_]/)) { + return "meta"; + } else { + return null; + } + } + // Time literals + if (ch == '#') { + stream.next(); + stream.eatWhile(/[\d_.]/); + return "def"; + } + // Strings + if (ch == '"') { + stream.next(); + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + // Comments + if (ch == "/") { + stream.next(); + if (stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + stream.backUp(1); + } - // Operators - if (stream.eatWhile(isOperatorChar)) { - return "meta"; - } + // Numeric literals + if (stream.match(realLiteral) || + stream.match(decimalLiteral) || + stream.match(binaryLiteral) || + stream.match(octLiteral) || + stream.match(hexLiteral) || + stream.match(unsignedNumber) || + stream.match(realLiteral)) { + return "number"; + } - // Keywords / plain variables - if (stream.eatWhile(/[\w\$_]/)) { - var cur = stream.current(); - if (keywords[cur]) { - if (openClose[cur]) { - curPunc = "newblock"; + // Operators + if (stream.eatWhile(isOperatorChar)) { + return "meta"; + } + + // Keywords / plain variables + if (stream.eatWhile(/[\w\$_]/)) { + var cur = stream.current(); + if (keywords[cur]) { + if (openClose[cur]) { + curPunc = "newblock"; + } + if (statementKeywords[cur]) { + curPunc = "newstatement"; + } + curKeyword = cur; + return "keyword"; + } + return "variable"; + } + + stream.next(); + return null; } - if (statementKeywords[cur]) { - curPunc = "newstatement"; + + function tokenString(quote) { + return function (stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) { + end = true; + break; + } + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || multiLineStrings)) + state.tokenize = tokenBase; + return "string"; + }; } - curKeyword = cur; - return "keyword"; - } - return "variable"; - } - stream.next(); - return null; - } - - function tokenString(quote) { - return function(stream, state) { - var escaped = false, next, end = false; - while ((next = stream.next()) != null) { - if (next == quote && !escaped) {end = true; break;} - escaped = !escaped && next == "\\"; - } - if (end || !(escaped || multiLineStrings)) - state.tokenize = tokenBase; - return "string"; - }; - } - - function tokenComment(stream, state) { - var maybeEnd = false, ch; - while (ch = stream.next()) { - if (ch == "/" && maybeEnd) { - state.tokenize = tokenBase; - break; - } - maybeEnd = (ch == "*"); - } - return "comment"; - } - - function Context(indented, column, type, align, prev) { - this.indented = indented; - this.column = column; - this.type = type; - this.align = align; - this.prev = prev; - } - function pushContext(state, col, type) { - var indent = state.indented; - var c = new Context(indent, col, type, null, state.context); - return state.context = c; - } - function popContext(state) { - var t = state.context.type; - if (t == ")" || t == "]" || t == "}") { - state.indented = state.context.indented; - } - return state.context = state.context.prev; - } - - function isClosing(text, contextClosing) { - if (text == contextClosing) { - return true; - } else { - // contextClosing may be mulitple keywords separated by ; - var closingKeywords = contextClosing.split(";"); - for (var i in closingKeywords) { - if (text == closingKeywords[i]) { - return true; + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; } - } - return false; - } - } - - function buildElectricInputRegEx() { - // Reindentation should occur on any bracket char: {}()[] - // or on a match of any of the block closing keywords, at - // the end of a line - var allClosings = []; - for (var i in openClose) { - if (openClose[i]) { - var closings = openClose[i].split(";"); - for (var j in closings) { - allClosings.push(closings[j]); + + function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; } - } - } - var re = new RegExp("[{}()\\[\\]]|(" + allClosings.join("|") + ")$"); - return re; - } - - // Interface - return { - - // Regex to force current line to reindent - electricInput: buildElectricInputRegEx(), - - startState: function(basecolumn) { - var state = { - tokenize: null, - context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), - indented: 0, - startOfLine: true - }; - if (hooks.startState) hooks.startState(state); - return state; - }, - - token: function(stream, state) { - var ctx = state.context; - if (stream.sol()) { - if (ctx.align == null) ctx.align = false; - state.indented = stream.indentation(); - state.startOfLine = true; - } - if (hooks.token) hooks.token(stream, state); - if (stream.eatSpace()) return null; - curPunc = null; - curKeyword = null; - var style = (state.tokenize || tokenBase)(stream, state); - if (style == "comment" || style == "meta" || style == "variable") return style; - if (ctx.align == null) ctx.align = true; - - if (curPunc == ctx.type) { - popContext(state); - } else if ((curPunc == ";" && ctx.type == "statement") || - (ctx.type && isClosing(curKeyword, ctx.type))) { - ctx = popContext(state); - while (ctx && ctx.type == "statement") ctx = popContext(state); - } else if (curPunc == "{") { - pushContext(state, stream.column(), "}"); - } else if (curPunc == "[") { - pushContext(state, stream.column(), "]"); - } else if (curPunc == "(") { - pushContext(state, stream.column(), ")"); - } else if (ctx && ctx.type == "endcase" && curPunc == ":") { - pushContext(state, stream.column(), "statement"); - } else if (curPunc == "newstatement") { - pushContext(state, stream.column(), "statement"); - } else if (curPunc == "newblock") { - if (curKeyword == "function" && ctx && (ctx.type == "statement" || ctx.type == "endgroup")) { - // The 'function' keyword can appear in some other contexts where it actually does not - // indicate a function (import/export DPI and covergroup definitions). - // Do nothing in this case - } else if (curKeyword == "task" && ctx && ctx.type == "statement") { - // Same thing for task - } else { - var close = openClose[curKeyword]; - pushContext(state, stream.column(), close); + + function pushContext(state, col, type) { + var indent = state.indented; + var c = new Context(indent, col, type, null, state.context); + return state.context = c; } - } - - state.startOfLine = false; - return style; - }, - - indent: function(state, textAfter) { - if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass; - if (hooks.indent) { - var fromHook = hooks.indent(state); - if (fromHook >= 0) return fromHook; - } - var ctx = state.context, firstChar = textAfter && textAfter.charAt(0); - if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev; - var closing = false; - var possibleClosing = textAfter.match(closingBracketOrWord); - if (possibleClosing) - closing = isClosing(possibleClosing[0], ctx.type); - if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit); - else if (closingBracket.test(ctx.type) && ctx.align && !dontAlignCalls) return ctx.column + (closing ? 0 : 1); - else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit; - else return ctx.indented + (closing ? 0 : indentUnit); - }, - - blockCommentStart: "/*", - blockCommentEnd: "*/", - lineComment: "//" - }; -}); - CodeMirror.defineMIME("text/x-verilog", { - name: "verilog" - }); - - CodeMirror.defineMIME("text/x-systemverilog", { - name: "verilog" - }); - - // SVXVerilog mode - - var svxchScopePrefixes = { - ">": "property", "->": "property", "-": "hr", "|": "link", "?$": "qualifier", "?*": "qualifier", - "@-": "variable-3", "@": "variable-3", "?": "qualifier" - }; - - function svxGenIndent(stream, state) { - var svxindentUnit = 2; - var rtnIndent = -1, indentUnitRq = 0, curIndent = stream.indentation(); - switch (state.svxCurCtlFlowChar) { - case "\\": - curIndent = 0; - break; - case "|": - if (state.svxPrevPrevCtlFlowChar == "@") { - indentUnitRq = -2; //-2 new pipe rq after cur pipe - break; - } - if (svxchScopePrefixes[state.svxPrevCtlFlowChar]) - indentUnitRq = 1; // +1 new scope - break; - case "M": // m4 - if (state.svxPrevPrevCtlFlowChar == "@") { - indentUnitRq = -2; //-2 new inst rq after pipe - break; - } - if (svxchScopePrefixes[state.svxPrevCtlFlowChar]) - indentUnitRq = 1; // +1 new scope - break; - case "@": - if (state.svxPrevCtlFlowChar == "S") - indentUnitRq = -1; // new pipe stage after stmts - if (state.svxPrevCtlFlowChar == "|") - indentUnitRq = 1; // 1st pipe stage - break; - case "S": - if (state.svxPrevCtlFlowChar == "@") - indentUnitRq = 1; // flow in pipe stage - if (svxchScopePrefixes[state.svxPrevCtlFlowChar]) - indentUnitRq = 1; // +1 new scope - break; - } - var statementIndentUnit = svxindentUnit; - rtnIndent = curIndent + (indentUnitRq*statementIndentUnit); - return rtnIndent >= 0 ? rtnIndent : curIndent; - } - - CodeMirror.defineMIME("text/x-svx", { - name: "verilog", - hooks: { - "\\": function(stream, state) { - var vxIndent = 0, style = false; - var curPunc = stream.string; - if ((stream.sol()) && (/\\SV/.test(stream.string))) { - curPunc = (/\\SVX_version/.test(stream.string)) - ? "\\SVX_version" : stream.string; - stream.skipToEnd(); - if (curPunc == "\\SV" && state.vxCodeActive) {state.vxCodeActive = false;}; - if ((/\\SVX/.test(curPunc) && !state.vxCodeActive) - || (curPunc=="\\SVX_version" && state.vxCodeActive)) {state.vxCodeActive = true;}; - style = "keyword"; - state.svxCurCtlFlowChar = state.svxPrevPrevCtlFlowChar - = state.svxPrevCtlFlowChar = ""; - if (state.vxCodeActive == true) { - state.svxCurCtlFlowChar = "\\"; - vxIndent = svxGenIndent(stream, state); - } - state.vxIndentRq = vxIndent; + function popContext(state) { + var t = state.context.type; + if (t == ")" || t == "]" || t == "}") { + state.indented = state.context.indented; + } + return state.context = state.context.prev; } - return style; - }, - tokenBase: function(stream, state) { - var vxIndent = 0, style = false; - var svxisOperatorChar = /[\[\]=:]/; - var svxkpScopePrefixs = { - "**":"variable-2", "*":"variable-2", "$$":"variable", "$":"variable", - "^^":"attribute", "^":"attribute"}; - var ch = stream.peek(); - var vxCurCtlFlowCharValueAtStart = state.svxCurCtlFlowChar; - if (state.vxCodeActive == true) { - if (/[\[\]{}\(\);\:]/.test(ch)) { - // bypass nesting and 1 char punc - style = "meta"; - stream.next(); - } else if (ch == "/") { - stream.next(); - if (stream.eat("/")) { - stream.skipToEnd(); - style = "comment"; - state.svxCurCtlFlowChar = "S"; + + function isClosing(text, contextClosing) { + if (text == contextClosing) { + return true; } else { - stream.backUp(1); + // contextClosing may be mulitple keywords separated by ; + var closingKeywords = contextClosing.split(";"); + for (var i in closingKeywords) { + if (text == closingKeywords[i]) { + return true; + } + } + return false; } - } else if (ch == "@") { - // pipeline stage - style = svxchScopePrefixes[ch]; - state.svxCurCtlFlowChar = "@"; - stream.next(); - stream.eatWhile(/[\w\$_]/); - } else if (stream.match(/\b[mM]4+/, true)) { // match: function(pattern, consume, caseInsensitive) - // m4 pre proc - stream.skipTo("("); - style = "def"; - state.svxCurCtlFlowChar = "M"; - } else if (ch == "!" && stream.sol()) { - // v stmt in svx region - // state.svxCurCtlFlowChar = "S"; - style = "comment"; - stream.next(); - } else if (svxisOperatorChar.test(ch)) { - // operators - stream.eatWhile(svxisOperatorChar); - style = "operator"; - } else if (ch == "#") { - // phy hier - state.svxCurCtlFlowChar = (state.svxCurCtlFlowChar == "") - ? ch : state.svxCurCtlFlowChar; - stream.next(); - stream.eatWhile(/[+-]\d/); - style = "tag"; - } else if (svxkpScopePrefixs.propertyIsEnumerable(ch)) { - // special SVX operators - style = svxkpScopePrefixs[ch]; - state.svxCurCtlFlowChar = state.svxCurCtlFlowChar == "" ? "S" : state.svxCurCtlFlowChar; // stmt - stream.next(); - stream.match(/[a-zA-Z_0-9]+/); - } else if (style = svxchScopePrefixes[ch] || false) { - // special SVX operators - state.svxCurCtlFlowChar = state.svxCurCtlFlowChar == "" ? ch : state.svxCurCtlFlowChar; - stream.next(); - stream.match(/[a-zA-Z_0-9]+/); - } - if (state.svxCurCtlFlowChar != vxCurCtlFlowCharValueAtStart) { // flow change - vxIndent = svxGenIndent(stream, state); - state.vxIndentRq = vxIndent; - } } - return style; - }, - token: function(stream, state) { - if (state.vxCodeActive == true && stream.sol() && state.svxCurCtlFlowChar != "") { - state.svxPrevPrevCtlFlowChar = state.svxPrevCtlFlowChar; - state.svxPrevCtlFlowChar = state.svxCurCtlFlowChar; - state.svxCurCtlFlowChar = ""; + + function buildElectricInputRegEx() { + // Reindentation should occur on any bracket char: {}()[] + // or on a match of any of the block closing keywords, at + // the end of a line + var allClosings = []; + for (var i in openClose) { + if (openClose[i]) { + var closings = openClose[i].split(";"); + for (var j in closings) { + allClosings.push(closings[j]); + } + } + } + var re = new RegExp("[{}()\\[\\]]|(" + allClosings.join("|") + ")$"); + return re; + } + + // Interface + return { + + // Regex to force current line to reindent + electricInput: buildElectricInputRegEx(), + + startState: function (basecolumn) { + var state = { + tokenize: null, + context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), + indented: 0, + startOfLine: true + }; + if (hooks.startState) hooks.startState(state); + return state; + }, + + token: function (stream, state) { + var ctx = state.context; + if (stream.sol()) { + if (ctx.align == null) ctx.align = false; + state.indented = stream.indentation(); + state.startOfLine = true; + } + if (hooks.token) hooks.token(stream, state); + if (stream.eatSpace()) return null; + curPunc = null; + curKeyword = null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment" || style == "meta" || style == "variable") return style; + if (ctx.align == null) ctx.align = true; + + if (curPunc == ctx.type) { + popContext(state); + } else if ((curPunc == ";" && ctx.type == "statement") || + (ctx.type && isClosing(curKeyword, ctx.type))) { + ctx = popContext(state); + while (ctx && ctx.type == "statement") ctx = popContext(state); + } else if (curPunc == "{") { + pushContext(state, stream.column(), "}"); + } else if (curPunc == "[") { + pushContext(state, stream.column(), "]"); + } else if (curPunc == "(") { + pushContext(state, stream.column(), ")"); + } else if (ctx && ctx.type == "endcase" && curPunc == ":") { + pushContext(state, stream.column(), "statement"); + } else if (curPunc == "newstatement") { + pushContext(state, stream.column(), "statement"); + } else if (curPunc == "newblock") { + if (curKeyword == "function" && ctx && (ctx.type == "statement" || ctx.type == "endgroup")) { + // The 'function' keyword can appear in some other contexts where it actually does not + // indicate a function (import/export DPI and covergroup definitions). + // Do nothing in this case + } else if (curKeyword == "task" && ctx && ctx.type == "statement") { + // Same thing for task + } else { + var close = openClose[curKeyword]; + pushContext(state, stream.column(), close); + } + } + + state.startOfLine = false; + return style; + }, + + indent: function (state, textAfter) { + if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass; + if (hooks.indent) { + var fromHook = hooks.indent(state); + if (fromHook >= 0) return fromHook; + } + var ctx = state.context, firstChar = textAfter && textAfter.charAt(0); + if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev; + var closing = false; + var possibleClosing = textAfter.match(closingBracketOrWord); + if (possibleClosing) + closing = isClosing(possibleClosing[0], ctx.type); + if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit); + else if (closingBracket.test(ctx.type) && ctx.align && !dontAlignCalls) return ctx.column + (closing ? 0 : 1); + else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit; + else return ctx.indented + (closing ? 0 : indentUnit); + }, + + blockCommentStart: "/*", + blockCommentEnd: "*/", + lineComment: "//" + }; + }); + + CodeMirror.defineMIME("text/x-verilog", { + name: "verilog" + }); + + CodeMirror.defineMIME("text/x-systemverilog", { + name: "verilog" + }); + + // SVXVerilog mode + + var svxchScopePrefixes = { + ">": "property", "->": "property", "-": "hr", "|": "link", "?$": "qualifier", "?*": "qualifier", + "@-": "variable-3", "@": "variable-3", "?": "qualifier" + }; + + function svxGenIndent(stream, state) { + var svxindentUnit = 2; + var rtnIndent = -1, indentUnitRq = 0, curIndent = stream.indentation(); + switch (state.svxCurCtlFlowChar) { + case "\\": + curIndent = 0; + break; + case "|": + if (state.svxPrevPrevCtlFlowChar == "@") { + indentUnitRq = -2; //-2 new pipe rq after cur pipe + break; + } + if (svxchScopePrefixes[state.svxPrevCtlFlowChar]) + indentUnitRq = 1; // +1 new scope + break; + case "M": // m4 + if (state.svxPrevPrevCtlFlowChar == "@") { + indentUnitRq = -2; //-2 new inst rq after pipe + break; + } + if (svxchScopePrefixes[state.svxPrevCtlFlowChar]) + indentUnitRq = 1; // +1 new scope + break; + case "@": + if (state.svxPrevCtlFlowChar == "S") + indentUnitRq = -1; // new pipe stage after stmts + if (state.svxPrevCtlFlowChar == "|") + indentUnitRq = 1; // 1st pipe stage + break; + case "S": + if (state.svxPrevCtlFlowChar == "@") + indentUnitRq = 1; // flow in pipe stage + if (svxchScopePrefixes[state.svxPrevCtlFlowChar]) + indentUnitRq = 1; // +1 new scope + break; } - }, - indent: function(state) { - return (state.vxCodeActive == true) ? state.vxIndentRq : -1; - }, - startState: function(state) { - state.svxCurCtlFlowChar = ""; - state.svxPrevCtlFlowChar = ""; - state.svxPrevPrevCtlFlowChar = ""; - state.vxCodeActive = true; - state.vxIndentRq = 0; - } + var statementIndentUnit = svxindentUnit; + rtnIndent = curIndent + (indentUnitRq * statementIndentUnit); + return rtnIndent >= 0 ? rtnIndent : curIndent; } - }); + + CodeMirror.defineMIME("text/x-svx", { + name: "verilog", + hooks: { + "\\": function (stream, state) { + var vxIndent = 0, style = false; + var curPunc = stream.string; + if ((stream.sol()) && (/\\SV/.test(stream.string))) { + curPunc = (/\\SVX_version/.test(stream.string)) + ? "\\SVX_version" : stream.string; + stream.skipToEnd(); + if (curPunc == "\\SV" && state.vxCodeActive) { + state.vxCodeActive = false; + } + ; + if ((/\\SVX/.test(curPunc) && !state.vxCodeActive) + || (curPunc == "\\SVX_version" && state.vxCodeActive)) { + state.vxCodeActive = true; + } + ; + style = "keyword"; + state.svxCurCtlFlowChar = state.svxPrevPrevCtlFlowChar + = state.svxPrevCtlFlowChar = ""; + if (state.vxCodeActive == true) { + state.svxCurCtlFlowChar = "\\"; + vxIndent = svxGenIndent(stream, state); + } + state.vxIndentRq = vxIndent; + } + return style; + }, + tokenBase: function (stream, state) { + var vxIndent = 0, style = false; + var svxisOperatorChar = /[\[\]=:]/; + var svxkpScopePrefixs = { + "**": "variable-2", "*": "variable-2", "$$": "variable", "$": "variable", + "^^": "attribute", "^": "attribute" + }; + var ch = stream.peek(); + var vxCurCtlFlowCharValueAtStart = state.svxCurCtlFlowChar; + if (state.vxCodeActive == true) { + if (/[\[\]{}\(\);\:]/.test(ch)) { + // bypass nesting and 1 char punc + style = "meta"; + stream.next(); + } else if (ch == "/") { + stream.next(); + if (stream.eat("/")) { + stream.skipToEnd(); + style = "comment"; + state.svxCurCtlFlowChar = "S"; + } else { + stream.backUp(1); + } + } else if (ch == "@") { + // pipeline stage + style = svxchScopePrefixes[ch]; + state.svxCurCtlFlowChar = "@"; + stream.next(); + stream.eatWhile(/[\w\$_]/); + } else if (stream.match(/\b[mM]4+/, true)) { // match: function(pattern, consume, caseInsensitive) + // m4 pre proc + stream.skipTo("("); + style = "def"; + state.svxCurCtlFlowChar = "M"; + } else if (ch == "!" && stream.sol()) { + // v stmt in svx region + // state.svxCurCtlFlowChar = "S"; + style = "comment"; + stream.next(); + } else if (svxisOperatorChar.test(ch)) { + // operators + stream.eatWhile(svxisOperatorChar); + style = "operator"; + } else if (ch == "#") { + // phy hier + state.svxCurCtlFlowChar = (state.svxCurCtlFlowChar == "") + ? ch : state.svxCurCtlFlowChar; + stream.next(); + stream.eatWhile(/[+-]\d/); + style = "tag"; + } else if (svxkpScopePrefixs.propertyIsEnumerable(ch)) { + // special SVX operators + style = svxkpScopePrefixs[ch]; + state.svxCurCtlFlowChar = state.svxCurCtlFlowChar == "" ? "S" : state.svxCurCtlFlowChar; // stmt + stream.next(); + stream.match(/[a-zA-Z_0-9]+/); + } else if (style = svxchScopePrefixes[ch] || false) { + // special SVX operators + state.svxCurCtlFlowChar = state.svxCurCtlFlowChar == "" ? ch : state.svxCurCtlFlowChar; + stream.next(); + stream.match(/[a-zA-Z_0-9]+/); + } + if (state.svxCurCtlFlowChar != vxCurCtlFlowCharValueAtStart) { // flow change + vxIndent = svxGenIndent(stream, state); + state.vxIndentRq = vxIndent; + } + } + return style; + }, + token: function (stream, state) { + if (state.vxCodeActive == true && stream.sol() && state.svxCurCtlFlowChar != "") { + state.svxPrevPrevCtlFlowChar = state.svxPrevCtlFlowChar; + state.svxPrevCtlFlowChar = state.svxCurCtlFlowChar; + state.svxCurCtlFlowChar = ""; + } + }, + indent: function (state) { + return (state.vxCodeActive == true) ? state.vxIndentRq : -1; + }, + startState: function (state) { + state.svxCurCtlFlowChar = ""; + state.svxPrevCtlFlowChar = ""; + state.svxPrevPrevCtlFlowChar = ""; + state.vxCodeActive = true; + state.vxIndentRq = 0; + } + } + }); }); diff --git a/web/editor.md/lib/codemirror/mode/xml/index.html b/web/editor.md/lib/codemirror/mode/xml/index.html index 7149f06..5ecf5e6 100644 --- a/web/editor.md/lib/codemirror/mode/xml/index.html +++ b/web/editor.md/lib/codemirror/mode/xml/index.html @@ -2,29 +2,32 @@ CodeMirror: XML mode - + - + - +
    -

    XML mode

    -

    The XML mode supports two configuration parameters:

    -
    htmlMode (boolean)
    -
    This switches the mode to parse HTML instead of XML. This - means attributes do not have to be quoted, and some elements - (such as br) do not require a closing tag.
    -
    alignCDATA (boolean)
    -
    Setting this to true will force the opening tag of CDATA - blocks to not be indented.
    +
    htmlMode (boolean)
    +
    This switches the mode to parse HTML instead of XML. This + means attributes do not have to be quoted, and some elements + (such as br) do not require a closing tag. +
    +
    alignCDATA (boolean)
    +
    Setting this to true will force the opening tag of CDATA + blocks to not be indented. +

    MIME types defined: application/xml, text/html.

    -
    + diff --git a/web/editor.md/lib/codemirror/mode/xml/test.js b/web/editor.md/lib/codemirror/mode/xml/test.js index f48156b..8752175 100644 --- a/web/editor.md/lib/codemirror/mode/xml/test.js +++ b/web/editor.md/lib/codemirror/mode/xml/test.js @@ -1,51 +1,54 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function() { - var mode = CodeMirror.getMode({indentUnit: 2}, "xml"), mname = "xml"; - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), mname); } - - MT("matching", - "[tag&bracket <][tag top][tag&bracket >]", - " text", - " [tag&bracket <][tag inner][tag&bracket />]", - "[tag&bracket ]"); - - MT("nonmatching", - "[tag&bracket <][tag top][tag&bracket >]", - " [tag&bracket <][tag inner][tag&bracket />]", - " [tag&bracket ]"); - - MT("doctype", - "[meta ]", - "[tag&bracket <][tag top][tag&bracket />]"); - - MT("cdata", - "[tag&bracket <][tag top][tag&bracket >]", - " [atom ]", - "[tag&bracket ]"); - - // HTML tests - mode = CodeMirror.getMode({indentUnit: 2}, "text/html"); - - MT("selfclose", - "[tag&bracket <][tag html][tag&bracket >]", - " [tag&bracket <][tag link] [attribute rel]=[string stylesheet] [attribute href]=[string \"/foobar\"][tag&bracket >]", - "[tag&bracket ]"); - - MT("list", - "[tag&bracket <][tag ol][tag&bracket >]", - " [tag&bracket <][tag li][tag&bracket >]one", - " [tag&bracket <][tag li][tag&bracket >]two", - "[tag&bracket ]"); - - MT("valueless", - "[tag&bracket <][tag input] [attribute type]=[string checkbox] [attribute checked][tag&bracket />]"); - - MT("pThenArticle", - "[tag&bracket <][tag p][tag&bracket >]", - " foo", - "[tag&bracket <][tag article][tag&bracket >]bar"); +(function () { + var mode = CodeMirror.getMode({indentUnit: 2}, "xml"), mname = "xml"; + + function MT(name) { + test.mode(name, mode, Array.prototype.slice.call(arguments, 1), mname); + } + + MT("matching", + "[tag&bracket <][tag top][tag&bracket >]", + " text", + " [tag&bracket <][tag inner][tag&bracket />]", + "[tag&bracket ]"); + + MT("nonmatching", + "[tag&bracket <][tag top][tag&bracket >]", + " [tag&bracket <][tag inner][tag&bracket />]", + " [tag&bracket ]"); + + MT("doctype", + "[meta ]", + "[tag&bracket <][tag top][tag&bracket />]"); + + MT("cdata", + "[tag&bracket <][tag top][tag&bracket >]", + " [atom ]", + "[tag&bracket ]"); + + // HTML tests + mode = CodeMirror.getMode({indentUnit: 2}, "text/html"); + + MT("selfclose", + "[tag&bracket <][tag html][tag&bracket >]", + " [tag&bracket <][tag link] [attribute rel]=[string stylesheet] [attribute href]=[string \"/foobar\"][tag&bracket >]", + "[tag&bracket ]"); + + MT("list", + "[tag&bracket <][tag ol][tag&bracket >]", + " [tag&bracket <][tag li][tag&bracket >]one", + " [tag&bracket <][tag li][tag&bracket >]two", + "[tag&bracket ]"); + + MT("valueless", + "[tag&bracket <][tag input] [attribute type]=[string checkbox] [attribute checked][tag&bracket />]"); + + MT("pThenArticle", + "[tag&bracket <][tag p][tag&bracket >]", + " foo", + "[tag&bracket <][tag article][tag&bracket >]bar"); })(); diff --git a/web/editor.md/lib/codemirror/mode/xml/xml.js b/web/editor.md/lib/codemirror/mode/xml/xml.js index 2f3b8f8..ed0f7db 100644 --- a/web/editor.md/lib/codemirror/mode/xml/xml.js +++ b/web/editor.md/lib/codemirror/mode/xml/xml.js @@ -1,384 +1,404 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("xml", function(config, parserConfig) { - var indentUnit = config.indentUnit; - var multilineTagIndentFactor = parserConfig.multilineTagIndentFactor || 1; - var multilineTagIndentPastTag = parserConfig.multilineTagIndentPastTag; - if (multilineTagIndentPastTag == null) multilineTagIndentPastTag = true; + CodeMirror.defineMode("xml", function (config, parserConfig) { + var indentUnit = config.indentUnit; + var multilineTagIndentFactor = parserConfig.multilineTagIndentFactor || 1; + var multilineTagIndentPastTag = parserConfig.multilineTagIndentPastTag; + if (multilineTagIndentPastTag == null) multilineTagIndentPastTag = true; - var Kludges = parserConfig.htmlMode ? { - autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true, - 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true, - 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true, - 'track': true, 'wbr': true, 'menuitem': true}, - implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true, - 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true, - 'th': true, 'tr': true}, - contextGrabbers: { - 'dd': {'dd': true, 'dt': true}, - 'dt': {'dd': true, 'dt': true}, - 'li': {'li': true}, - 'option': {'option': true, 'optgroup': true}, - 'optgroup': {'optgroup': true}, - 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true, - 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true, - 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true, - 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true, - 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true}, - 'rp': {'rp': true, 'rt': true}, - 'rt': {'rp': true, 'rt': true}, - 'tbody': {'tbody': true, 'tfoot': true}, - 'td': {'td': true, 'th': true}, - 'tfoot': {'tbody': true}, - 'th': {'td': true, 'th': true}, - 'thead': {'tbody': true, 'tfoot': true}, - 'tr': {'tr': true} - }, - doNotIndent: {"pre": true}, - allowUnquoted: true, - allowMissing: true, - caseFold: true - } : { - autoSelfClosers: {}, - implicitlyClosed: {}, - contextGrabbers: {}, - doNotIndent: {}, - allowUnquoted: false, - allowMissing: false, - caseFold: false - }; - var alignCDATA = parserConfig.alignCDATA; + var Kludges = parserConfig.htmlMode ? { + autoSelfClosers: { + 'area': true, 'base': true, 'br': true, 'col': true, 'command': true, + 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true, + 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true, + 'track': true, 'wbr': true, 'menuitem': true + }, + implicitlyClosed: { + 'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true, + 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true, + 'th': true, 'tr': true + }, + contextGrabbers: { + 'dd': {'dd': true, 'dt': true}, + 'dt': {'dd': true, 'dt': true}, + 'li': {'li': true}, + 'option': {'option': true, 'optgroup': true}, + 'optgroup': {'optgroup': true}, + 'p': { + 'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true, + 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true, + 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true, + 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true, + 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true + }, + 'rp': {'rp': true, 'rt': true}, + 'rt': {'rp': true, 'rt': true}, + 'tbody': {'tbody': true, 'tfoot': true}, + 'td': {'td': true, 'th': true}, + 'tfoot': {'tbody': true}, + 'th': {'td': true, 'th': true}, + 'thead': {'tbody': true, 'tfoot': true}, + 'tr': {'tr': true} + }, + doNotIndent: {"pre": true}, + allowUnquoted: true, + allowMissing: true, + caseFold: true + } : { + autoSelfClosers: {}, + implicitlyClosed: {}, + contextGrabbers: {}, + doNotIndent: {}, + allowUnquoted: false, + allowMissing: false, + caseFold: false + }; + var alignCDATA = parserConfig.alignCDATA; - // Return variables for tokenizers - var type, setStyle; + // Return variables for tokenizers + var type, setStyle; - function inText(stream, state) { - function chain(parser) { - state.tokenize = parser; - return parser(stream, state); - } + function inText(stream, state) { + function chain(parser) { + state.tokenize = parser; + return parser(stream, state); + } - var ch = stream.next(); - if (ch == "<") { - if (stream.eat("!")) { - if (stream.eat("[")) { - if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>")); - else return null; - } else if (stream.match("--")) { - return chain(inBlock("comment", "-->")); - } else if (stream.match("DOCTYPE", true, true)) { - stream.eatWhile(/[\w\._\-]/); - return chain(doctype(1)); - } else { - return null; + var ch = stream.next(); + if (ch == "<") { + if (stream.eat("!")) { + if (stream.eat("[")) { + if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>")); + else return null; + } else if (stream.match("--")) { + return chain(inBlock("comment", "-->")); + } else if (stream.match("DOCTYPE", true, true)) { + stream.eatWhile(/[\w\._\-]/); + return chain(doctype(1)); + } else { + return null; + } + } else if (stream.eat("?")) { + stream.eatWhile(/[\w\._\-]/); + state.tokenize = inBlock("meta", "?>"); + return "meta"; + } else { + type = stream.eat("/") ? "closeTag" : "openTag"; + state.tokenize = inTag; + return "tag bracket"; + } + } else if (ch == "&") { + var ok; + if (stream.eat("#")) { + if (stream.eat("x")) { + ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";"); + } else { + ok = stream.eatWhile(/[\d]/) && stream.eat(";"); + } + } else { + ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";"); + } + return ok ? "atom" : "error"; + } else { + stream.eatWhile(/[^&<]/); + return null; + } } - } else if (stream.eat("?")) { - stream.eatWhile(/[\w\._\-]/); - state.tokenize = inBlock("meta", "?>"); - return "meta"; - } else { - type = stream.eat("/") ? "closeTag" : "openTag"; - state.tokenize = inTag; - return "tag bracket"; - } - } else if (ch == "&") { - var ok; - if (stream.eat("#")) { - if (stream.eat("x")) { - ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";"); - } else { - ok = stream.eatWhile(/[\d]/) && stream.eat(";"); + + function inTag(stream, state) { + var ch = stream.next(); + if (ch == ">" || (ch == "/" && stream.eat(">"))) { + state.tokenize = inText; + type = ch == ">" ? "endTag" : "selfcloseTag"; + return "tag bracket"; + } else if (ch == "=") { + type = "equals"; + return null; + } else if (ch == "<") { + state.tokenize = inText; + state.state = baseState; + state.tagName = state.tagStart = null; + var next = state.tokenize(stream, state); + return next ? next + " tag error" : "tag error"; + } else if (/[\'\"]/.test(ch)) { + state.tokenize = inAttribute(ch); + state.stringStartCol = stream.column(); + return state.tokenize(stream, state); + } else { + stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/); + return "word"; + } + } + + function inAttribute(quote) { + var closure = function (stream, state) { + while (!stream.eol()) { + if (stream.next() == quote) { + state.tokenize = inTag; + break; + } + } + return "string"; + }; + closure.isInAttribute = true; + return closure; + } + + function inBlock(style, terminator) { + return function (stream, state) { + while (!stream.eol()) { + if (stream.match(terminator)) { + state.tokenize = inText; + break; + } + stream.next(); + } + return style; + }; } - } else { - ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";"); - } - return ok ? "atom" : "error"; - } else { - stream.eatWhile(/[^&<]/); - return null; - } - } - function inTag(stream, state) { - var ch = stream.next(); - if (ch == ">" || (ch == "/" && stream.eat(">"))) { - state.tokenize = inText; - type = ch == ">" ? "endTag" : "selfcloseTag"; - return "tag bracket"; - } else if (ch == "=") { - type = "equals"; - return null; - } else if (ch == "<") { - state.tokenize = inText; - state.state = baseState; - state.tagName = state.tagStart = null; - var next = state.tokenize(stream, state); - return next ? next + " tag error" : "tag error"; - } else if (/[\'\"]/.test(ch)) { - state.tokenize = inAttribute(ch); - state.stringStartCol = stream.column(); - return state.tokenize(stream, state); - } else { - stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/); - return "word"; - } - } + function doctype(depth) { + return function (stream, state) { + var ch; + while ((ch = stream.next()) != null) { + if (ch == "<") { + state.tokenize = doctype(depth + 1); + return state.tokenize(stream, state); + } else if (ch == ">") { + if (depth == 1) { + state.tokenize = inText; + break; + } else { + state.tokenize = doctype(depth - 1); + return state.tokenize(stream, state); + } + } + } + return "meta"; + }; + } - function inAttribute(quote) { - var closure = function(stream, state) { - while (!stream.eol()) { - if (stream.next() == quote) { - state.tokenize = inTag; - break; + function Context(state, tagName, startOfLine) { + this.prev = state.context; + this.tagName = tagName; + this.indent = state.indented; + this.startOfLine = startOfLine; + if (Kludges.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent)) + this.noIndent = true; } - } - return "string"; - }; - closure.isInAttribute = true; - return closure; - } - function inBlock(style, terminator) { - return function(stream, state) { - while (!stream.eol()) { - if (stream.match(terminator)) { - state.tokenize = inText; - break; + function popContext(state) { + if (state.context) state.context = state.context.prev; } - stream.next(); - } - return style; - }; - } - function doctype(depth) { - return function(stream, state) { - var ch; - while ((ch = stream.next()) != null) { - if (ch == "<") { - state.tokenize = doctype(depth + 1); - return state.tokenize(stream, state); - } else if (ch == ">") { - if (depth == 1) { - state.tokenize = inText; - break; - } else { - state.tokenize = doctype(depth - 1); - return state.tokenize(stream, state); - } + + function maybePopContext(state, nextTagName) { + var parentTagName; + while (true) { + if (!state.context) { + return; + } + parentTagName = state.context.tagName; + if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) || + !Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) { + return; + } + popContext(state); + } } - } - return "meta"; - }; - } - function Context(state, tagName, startOfLine) { - this.prev = state.context; - this.tagName = tagName; - this.indent = state.indented; - this.startOfLine = startOfLine; - if (Kludges.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent)) - this.noIndent = true; - } - function popContext(state) { - if (state.context) state.context = state.context.prev; - } - function maybePopContext(state, nextTagName) { - var parentTagName; - while (true) { - if (!state.context) { - return; - } - parentTagName = state.context.tagName; - if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) || - !Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) { - return; - } - popContext(state); - } - } + function baseState(type, stream, state) { + if (type == "openTag") { + state.tagStart = stream.column(); + return tagNameState; + } else if (type == "closeTag") { + return closeTagNameState; + } else { + return baseState; + } + } - function baseState(type, stream, state) { - if (type == "openTag") { - state.tagStart = stream.column(); - return tagNameState; - } else if (type == "closeTag") { - return closeTagNameState; - } else { - return baseState; - } - } - function tagNameState(type, stream, state) { - if (type == "word") { - state.tagName = stream.current(); - setStyle = "tag"; - return attrState; - } else { - setStyle = "error"; - return tagNameState; - } - } - function closeTagNameState(type, stream, state) { - if (type == "word") { - var tagName = stream.current(); - if (state.context && state.context.tagName != tagName && - Kludges.implicitlyClosed.hasOwnProperty(state.context.tagName)) - popContext(state); - if (state.context && state.context.tagName == tagName) { - setStyle = "tag"; - return closeState; - } else { - setStyle = "tag error"; - return closeStateErr; - } - } else { - setStyle = "error"; - return closeStateErr; - } - } + function tagNameState(type, stream, state) { + if (type == "word") { + state.tagName = stream.current(); + setStyle = "tag"; + return attrState; + } else { + setStyle = "error"; + return tagNameState; + } + } - function closeState(type, _stream, state) { - if (type != "endTag") { - setStyle = "error"; - return closeState; - } - popContext(state); - return baseState; - } - function closeStateErr(type, stream, state) { - setStyle = "error"; - return closeState(type, stream, state); - } + function closeTagNameState(type, stream, state) { + if (type == "word") { + var tagName = stream.current(); + if (state.context && state.context.tagName != tagName && + Kludges.implicitlyClosed.hasOwnProperty(state.context.tagName)) + popContext(state); + if (state.context && state.context.tagName == tagName) { + setStyle = "tag"; + return closeState; + } else { + setStyle = "tag error"; + return closeStateErr; + } + } else { + setStyle = "error"; + return closeStateErr; + } + } - function attrState(type, _stream, state) { - if (type == "word") { - setStyle = "attribute"; - return attrEqState; - } else if (type == "endTag" || type == "selfcloseTag") { - var tagName = state.tagName, tagStart = state.tagStart; - state.tagName = state.tagStart = null; - if (type == "selfcloseTag" || - Kludges.autoSelfClosers.hasOwnProperty(tagName)) { - maybePopContext(state, tagName); - } else { - maybePopContext(state, tagName); - state.context = new Context(state, tagName, tagStart == state.indented); - } - return baseState; - } - setStyle = "error"; - return attrState; - } - function attrEqState(type, stream, state) { - if (type == "equals") return attrValueState; - if (!Kludges.allowMissing) setStyle = "error"; - return attrState(type, stream, state); - } - function attrValueState(type, stream, state) { - if (type == "string") return attrContinuedState; - if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return attrState;} - setStyle = "error"; - return attrState(type, stream, state); - } - function attrContinuedState(type, stream, state) { - if (type == "string") return attrContinuedState; - return attrState(type, stream, state); - } + function closeState(type, _stream, state) { + if (type != "endTag") { + setStyle = "error"; + return closeState; + } + popContext(state); + return baseState; + } - return { - startState: function() { - return {tokenize: inText, - state: baseState, - indented: 0, - tagName: null, tagStart: null, - context: null}; - }, + function closeStateErr(type, stream, state) { + setStyle = "error"; + return closeState(type, stream, state); + } - token: function(stream, state) { - if (!state.tagName && stream.sol()) - state.indented = stream.indentation(); + function attrState(type, _stream, state) { + if (type == "word") { + setStyle = "attribute"; + return attrEqState; + } else if (type == "endTag" || type == "selfcloseTag") { + var tagName = state.tagName, tagStart = state.tagStart; + state.tagName = state.tagStart = null; + if (type == "selfcloseTag" || + Kludges.autoSelfClosers.hasOwnProperty(tagName)) { + maybePopContext(state, tagName); + } else { + maybePopContext(state, tagName); + state.context = new Context(state, tagName, tagStart == state.indented); + } + return baseState; + } + setStyle = "error"; + return attrState; + } - if (stream.eatSpace()) return null; - type = null; - var style = state.tokenize(stream, state); - if ((style || type) && style != "comment") { - setStyle = null; - state.state = state.state(type || style, stream, state); - if (setStyle) - style = setStyle == "error" ? style + " error" : setStyle; - } - return style; - }, + function attrEqState(type, stream, state) { + if (type == "equals") return attrValueState; + if (!Kludges.allowMissing) setStyle = "error"; + return attrState(type, stream, state); + } - indent: function(state, textAfter, fullLine) { - var context = state.context; - // Indent multi-line strings (e.g. css). - if (state.tokenize.isInAttribute) { - if (state.tagStart == state.indented) - return state.stringStartCol + 1; - else - return state.indented + indentUnit; - } - if (context && context.noIndent) return CodeMirror.Pass; - if (state.tokenize != inTag && state.tokenize != inText) - return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0; - // Indent the starts of attribute names. - if (state.tagName) { - if (multilineTagIndentPastTag) - return state.tagStart + state.tagName.length + 2; - else - return state.tagStart + indentUnit * multilineTagIndentFactor; - } - if (alignCDATA && /$/, - blockCommentStart: "", + return { + startState: function () { + return { + tokenize: inText, + state: baseState, + indented: 0, + tagName: null, tagStart: null, + context: null + }; + }, - configuration: parserConfig.htmlMode ? "html" : "xml", - helperType: parserConfig.htmlMode ? "html" : "xml" - }; -}); + token: function (stream, state) { + if (!state.tagName && stream.sol()) + state.indented = stream.indentation(); + + if (stream.eatSpace()) return null; + type = null; + var style = state.tokenize(stream, state); + if ((style || type) && style != "comment") { + setStyle = null; + state.state = state.state(type || style, stream, state); + if (setStyle) + style = setStyle == "error" ? style + " error" : setStyle; + } + return style; + }, + + indent: function (state, textAfter, fullLine) { + var context = state.context; + // Indent multi-line strings (e.g. css). + if (state.tokenize.isInAttribute) { + if (state.tagStart == state.indented) + return state.stringStartCol + 1; + else + return state.indented + indentUnit; + } + if (context && context.noIndent) return CodeMirror.Pass; + if (state.tokenize != inTag && state.tokenize != inText) + return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0; + // Indent the starts of attribute names. + if (state.tagName) { + if (multilineTagIndentPastTag) + return state.tagStart + state.tagName.length + 2; + else + return state.tagStart + indentUnit * multilineTagIndentFactor; + } + if (alignCDATA && /$/, + blockCommentStart: "", + + configuration: parserConfig.htmlMode ? "html" : "xml", + helperType: parserConfig.htmlMode ? "html" : "xml" + }; + }); -CodeMirror.defineMIME("text/xml", "xml"); -CodeMirror.defineMIME("application/xml", "xml"); -if (!CodeMirror.mimeModes.hasOwnProperty("text/html")) - CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true}); + CodeMirror.defineMIME("text/xml", "xml"); + CodeMirror.defineMIME("application/xml", "xml"); + if (!CodeMirror.mimeModes.hasOwnProperty("text/html")) + CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true}); }); diff --git a/web/editor.md/lib/codemirror/mode/xquery/index.html b/web/editor.md/lib/codemirror/mode/xquery/index.html index 7ac5aae..60c7312 100644 --- a/web/editor.md/lib/codemirror/mode/xquery/index.html +++ b/web/editor.md/lib/codemirror/mode/xquery/index.html @@ -2,37 +2,38 @@ CodeMirror: XQuery mode - + - - + + + .CodeMirror { + border-top: 1px solid black; + border-bottom: 1px solid black; + height: 400px; + } +
    -

    XQuery mode

    - - -
    +

    XQuery mode

    + + +
    -
    - - - -

    MIME types defined: application/xquery.

    - -

    Development of the CodeMirror XQuery mode was sponsored by - MarkLogic and developed by - Mike Brevoort. + +

    + + + +

    MIME types defined: application/xquery.

    + +

    Development of the CodeMirror XQuery mode was sponsored by + MarkLogic and developed by + Mike Brevoort.

    - -
    + + diff --git a/web/editor.md/lib/codemirror/mode/xquery/test.js b/web/editor.md/lib/codemirror/mode/xquery/test.js index 1f148cd..9b5c74c 100644 --- a/web/editor.md/lib/codemirror/mode/xquery/test.js +++ b/web/editor.md/lib/codemirror/mode/xquery/test.js @@ -6,62 +6,65 @@ // verification. If a change you made causes them to fail, the test is // as likely to wrong as the code. -(function() { - var mode = CodeMirror.getMode({tabSize: 4}, "xquery"); - function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } +(function () { + var mode = CodeMirror.getMode({tabSize: 4}, "xquery"); - MT("eviltest", - "[keyword xquery] [keyword version] [variable "1][keyword .][atom 0][keyword -][variable ml"][def&variable ;] [comment (: this is : a \"comment\" :)]", - " [keyword let] [variable $let] [keyword :=] [variable <x] [variable attr][keyword =][variable "value">"test"<func>][def&variable ;function]() [variable $var] {[keyword function]()} {[variable $var]}[variable <][keyword /][variable func><][keyword /][variable x>]", - " [keyword let] [variable $joe][keyword :=][atom 1]", - " [keyword return] [keyword element] [variable element] {", - " [keyword attribute] [variable attribute] { [atom 1] },", - " [keyword element] [variable test] { [variable 'a'] }, [keyword attribute] [variable foo] { [variable "bar"] },", - " [def&variable fn:doc]()[[ [variable foo][keyword /][variable @bar] [keyword eq] [variable $let] ]],", - " [keyword //][variable x] } [comment (: a more 'evil' test :)]", - " [comment (: Modified Blakeley example (: with nested comment :) ... :)]", - " [keyword declare] [keyword private] [keyword function] [def&variable local:declare]() {()}[variable ;]", - " [keyword declare] [keyword private] [keyword function] [def&variable local:private]() {()}[variable ;]", - " [keyword declare] [keyword private] [keyword function] [def&variable local:function]() {()}[variable ;]", - " [keyword declare] [keyword private] [keyword function] [def&variable local:local]() {()}[variable ;]", - " [keyword let] [variable $let] [keyword :=] [variable <let>let] [variable $let] [keyword :=] [variable "let"<][keyword /let][variable >]", - " [keyword return] [keyword element] [variable element] {", - " [keyword attribute] [variable attribute] { [keyword try] { [def&variable xdmp:version]() } [keyword catch]([variable $e]) { [def&variable xdmp:log]([variable $e]) } },", - " [keyword attribute] [variable fn:doc] { [variable "bar"] [variable castable] [keyword as] [atom xs:string] },", - " [keyword element] [variable text] { [keyword text] { [variable "text"] } },", - " [def&variable fn:doc]()[[ [qualifier child::][variable eq][keyword /]([variable @bar] [keyword |] [qualifier attribute::][variable attribute]) [keyword eq] [variable $let] ]],", - " [keyword //][variable fn:doc]", - " }"); + function MT(name) { + test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); + } - MT("testEmptySequenceKeyword", - "[string \"foo\"] [keyword instance] [keyword of] [keyword empty-sequence]()"); + MT("eviltest", + "[keyword xquery] [keyword version] [variable "1][keyword .][atom 0][keyword -][variable ml"][def&variable ;] [comment (: this is : a \"comment\" :)]", + " [keyword let] [variable $let] [keyword :=] [variable <x] [variable attr][keyword =][variable "value">"test"<func>][def&variable ;function]() [variable $var] {[keyword function]()} {[variable $var]}[variable <][keyword /][variable func><][keyword /][variable x>]", + " [keyword let] [variable $joe][keyword :=][atom 1]", + " [keyword return] [keyword element] [variable element] {", + " [keyword attribute] [variable attribute] { [atom 1] },", + " [keyword element] [variable test] { [variable 'a'] }, [keyword attribute] [variable foo] { [variable "bar"] },", + " [def&variable fn:doc]()[[ [variable foo][keyword /][variable @bar] [keyword eq] [variable $let] ]],", + " [keyword //][variable x] } [comment (: a more 'evil' test :)]", + " [comment (: Modified Blakeley example (: with nested comment :) ... :)]", + " [keyword declare] [keyword private] [keyword function] [def&variable local:declare]() {()}[variable ;]", + " [keyword declare] [keyword private] [keyword function] [def&variable local:private]() {()}[variable ;]", + " [keyword declare] [keyword private] [keyword function] [def&variable local:function]() {()}[variable ;]", + " [keyword declare] [keyword private] [keyword function] [def&variable local:local]() {()}[variable ;]", + " [keyword let] [variable $let] [keyword :=] [variable <let>let] [variable $let] [keyword :=] [variable "let"<][keyword /let][variable >]", + " [keyword return] [keyword element] [variable element] {", + " [keyword attribute] [variable attribute] { [keyword try] { [def&variable xdmp:version]() } [keyword catch]([variable $e]) { [def&variable xdmp:log]([variable $e]) } },", + " [keyword attribute] [variable fn:doc] { [variable "bar"] [variable castable] [keyword as] [atom xs:string] },", + " [keyword element] [variable text] { [keyword text] { [variable "text"] } },", + " [def&variable fn:doc]()[[ [qualifier child::][variable eq][keyword /]([variable @bar] [keyword |] [qualifier attribute::][variable attribute]) [keyword eq] [variable $let] ]],", + " [keyword //][variable fn:doc]", + " }"); - MT("testMultiAttr", - "[tag

    ][variable hello] [variable world][tag

    ]"); + MT("testEmptySequenceKeyword", + "[string \"foo\"] [keyword instance] [keyword of] [keyword empty-sequence]()"); - MT("test namespaced variable", - "[keyword declare] [keyword namespace] [variable e] [keyword =] [string \"http://example.com/ANamespace\"][variable ;declare] [keyword variable] [variable $e:exampleComThisVarIsNotRecognized] [keyword as] [keyword element]([keyword *]) [variable external;]"); + MT("testMultiAttr", + "[tag

    ][variable hello] [variable world][tag

    ]"); - MT("test EQName variable", - "[keyword declare] [keyword variable] [variable $\"http://www.example.com/ns/my\":var] [keyword :=] [atom 12][variable ;]", - "[tag ]{[variable $\"http://www.example.com/ns/my\":var]}[tag ]"); + MT("test namespaced variable", + "[keyword declare] [keyword namespace] [variable e] [keyword =] [string \"http://example.com/ANamespace\"][variable ;declare] [keyword variable] [variable $e:exampleComThisVarIsNotRecognized] [keyword as] [keyword element]([keyword *]) [variable external;]"); - MT("test EQName function", - "[keyword declare] [keyword function] [def&variable \"http://www.example.com/ns/my\":fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {", - " [variable $a] [keyword +] [atom 2]", - "}[variable ;]", - "[tag ]{[def&variable \"http://www.example.com/ns/my\":fn]([atom 12])}[tag ]"); + MT("test EQName variable", + "[keyword declare] [keyword variable] [variable $\"http://www.example.com/ns/my\":var] [keyword :=] [atom 12][variable ;]", + "[tag ]{[variable $\"http://www.example.com/ns/my\":var]}[tag ]"); - MT("test EQName function with single quotes", - "[keyword declare] [keyword function] [def&variable 'http://www.example.com/ns/my':fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {", - " [variable $a] [keyword +] [atom 2]", - "}[variable ;]", - "[tag ]{[def&variable 'http://www.example.com/ns/my':fn]([atom 12])}[tag ]"); + MT("test EQName function", + "[keyword declare] [keyword function] [def&variable \"http://www.example.com/ns/my\":fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {", + " [variable $a] [keyword +] [atom 2]", + "}[variable ;]", + "[tag ]{[def&variable \"http://www.example.com/ns/my\":fn]([atom 12])}[tag ]"); - MT("testProcessingInstructions", - "[def&variable data]([comment&meta ]) [keyword instance] [keyword of] [atom xs:string]"); + MT("test EQName function with single quotes", + "[keyword declare] [keyword function] [def&variable 'http://www.example.com/ns/my':fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {", + " [variable $a] [keyword +] [atom 2]", + "}[variable ;]", + "[tag ]{[def&variable 'http://www.example.com/ns/my':fn]([atom 12])}[tag ]"); - MT("testQuoteEscapeDouble", - "[keyword let] [variable $rootfolder] [keyword :=] [string \"c:\\builds\\winnt\\HEAD\\qa\\scripts\\\"]", - "[keyword let] [variable $keysfolder] [keyword :=] [def&variable concat]([variable $rootfolder], [string \"keys\\\"])"); + MT("testProcessingInstructions", + "[def&variable data]([comment&meta ]) [keyword instance] [keyword of] [atom xs:string]"); + + MT("testQuoteEscapeDouble", + "[keyword let] [variable $rootfolder] [keyword :=] [string \"c:\\builds\\winnt\\HEAD\\qa\\scripts\\\"]", + "[keyword let] [variable $keysfolder] [keyword :=] [def&variable concat]([variable $rootfolder], [string \"keys\\\"])"); })(); diff --git a/web/editor.md/lib/codemirror/mode/xquery/xquery.js b/web/editor.md/lib/codemirror/mode/xquery/xquery.js index c8f3d90..551b2ca 100644 --- a/web/editor.md/lib/codemirror/mode/xquery/xquery.js +++ b/web/editor.md/lib/codemirror/mode/xquery/xquery.js @@ -1,447 +1,473 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; - -CodeMirror.defineMode("xquery", function() { - - // The keywords object is set to the result of this self executing - // function. Each keyword is a property of the keywords object whose - // value is {type: atype, style: astyle} - var keywords = function(){ - // conveinence functions used to build keywords object - function kw(type) {return {type: type, style: "keyword"};} - var A = kw("keyword a") - , B = kw("keyword b") - , C = kw("keyword c") - , operator = kw("operator") - , atom = {type: "atom", style: "atom"} - , punctuation = {type: "punctuation", style: null} - , qualifier = {type: "axis_specifier", style: "qualifier"}; - - // kwObj is what is return from this function at the end - var kwObj = { - 'if': A, 'switch': A, 'while': A, 'for': A, - 'else': B, 'then': B, 'try': B, 'finally': B, 'catch': B, - 'element': C, 'attribute': C, 'let': C, 'implements': C, 'import': C, 'module': C, 'namespace': C, - 'return': C, 'super': C, 'this': C, 'throws': C, 'where': C, 'private': C, - ',': punctuation, - 'null': atom, 'fn:false()': atom, 'fn:true()': atom - }; - - // a list of 'basic' keywords. For each add a property to kwObj with the value of - // {type: basic[i], style: "keyword"} e.g. 'after' --> {type: "after", style: "keyword"} - var basic = ['after','ancestor','ancestor-or-self','and','as','ascending','assert','attribute','before', - 'by','case','cast','child','comment','declare','default','define','descendant','descendant-or-self', - 'descending','document','document-node','element','else','eq','every','except','external','following', - 'following-sibling','follows','for','function','if','import','in','instance','intersect','item', - 'let','module','namespace','node','node','of','only','or','order','parent','precedes','preceding', - 'preceding-sibling','processing-instruction','ref','return','returns','satisfies','schema','schema-element', - 'self','some','sortby','stable','text','then','to','treat','typeswitch','union','variable','version','where', - 'xquery', 'empty-sequence']; - for(var i=0, l=basic.length; i < l; i++) { kwObj[basic[i]] = kw(basic[i]);}; - - // a list of types. For each add a property to kwObj with the value of - // {type: "atom", style: "atom"} - var types = ['xs:string', 'xs:float', 'xs:decimal', 'xs:double', 'xs:integer', 'xs:boolean', 'xs:date', 'xs:dateTime', - 'xs:time', 'xs:duration', 'xs:dayTimeDuration', 'xs:time', 'xs:yearMonthDuration', 'numeric', 'xs:hexBinary', - 'xs:base64Binary', 'xs:anyURI', 'xs:QName', 'xs:byte','xs:boolean','xs:anyURI','xf:yearMonthDuration']; - for(var i=0, l=types.length; i < l; i++) { kwObj[types[i]] = atom;}; - - // each operator will add a property to kwObj with value of {type: "operator", style: "keyword"} - var operators = ['eq', 'ne', 'lt', 'le', 'gt', 'ge', ':=', '=', '>', '>=', '<', '<=', '.', '|', '?', 'and', 'or', 'div', 'idiv', 'mod', '*', '/', '+', '-']; - for(var i=0, l=operators.length; i < l; i++) { kwObj[operators[i]] = operator;}; - - // each axis_specifiers will add a property to kwObj with value of {type: "axis_specifier", style: "qualifier"} - var axis_specifiers = ["self::", "attribute::", "child::", "descendant::", "descendant-or-self::", "parent::", - "ancestor::", "ancestor-or-self::", "following::", "preceding::", "following-sibling::", "preceding-sibling::"]; - for(var i=0, l=axis_specifiers.length; i < l; i++) { kwObj[axis_specifiers[i]] = qualifier; }; - - return kwObj; - }(); - - // Used as scratch variables to communicate multiple values without - // consing up tons of objects. - var type, content; - - function ret(tp, style, cont) { - type = tp; content = cont; - return style; - } - - function chain(stream, state, f) { - state.tokenize = f; - return f(stream, state); - } - - // the primary mode tokenizer - function tokenBase(stream, state) { - var ch = stream.next(), - mightBeFunction = false, - isEQName = isEQNameAhead(stream); - - // an XML tag (if not in some sub, chained tokenizer) - if (ch == "<") { - if(stream.match("!--", true)) - return chain(stream, state, tokenXMLComment); - - if(stream.match("![CDATA", false)) { - state.tokenize = tokenCDATA; - return ret("tag", "tag"); - } - - if(stream.match("?", false)) { - return chain(stream, state, tokenPreProcessing); - } - - var isclose = stream.eat("/"); - stream.eatSpace(); - var tagName = "", c; - while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c; - - return chain(stream, state, tokenTag(tagName, isclose)); - } - // start code block - else if(ch == "{") { - pushStateStack(state,{ type: "codeblock"}); - return ret("", null); - } - // end code block - else if(ch == "}") { - popStateStack(state); - return ret("", null); - } - // if we're in an XML block - else if(isInXmlBlock(state)) { - if(ch == ">") - return ret("tag", "tag"); - else if(ch == "/" && stream.eat(">")) { - popStateStack(state); - return ret("tag", "tag"); - } - else - return ret("word", "variable"); - } - // if a number - else if (/\d/.test(ch)) { - stream.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/); - return ret("number", "atom"); - } - // comment start - else if (ch === "(" && stream.eat(":")) { - pushStateStack(state, { type: "comment"}); - return chain(stream, state, tokenComment); - } - // quoted string - else if ( !isEQName && (ch === '"' || ch === "'")) - return chain(stream, state, tokenString(ch)); - // variable - else if(ch === "$") { - return chain(stream, state, tokenVariable); - } - // assignment - else if(ch ===":" && stream.eat("=")) { - return ret("operator", "keyword"); - } - // open paren - else if(ch === "(") { - pushStateStack(state, { type: "paren"}); - return ret("", null); - } - // close paren - else if(ch === ")") { - popStateStack(state); - return ret("", null); - } - // open paren - else if(ch === "[") { - pushStateStack(state, { type: "bracket"}); - return ret("", null); - } - // close paren - else if(ch === "]") { - popStateStack(state); - return ret("", null); - } - else { - var known = keywords.propertyIsEnumerable(ch) && keywords[ch]; - - // if there's a EQName ahead, consume the rest of the string portion, it's likely a function - if(isEQName && ch === '\"') while(stream.next() !== '"'){} - if(isEQName && ch === '\'') while(stream.next() !== '\''){} - - // gobble up a word if the character is not known - if(!known) stream.eatWhile(/[\w\$_-]/); - - // gobble a colon in the case that is a lib func type call fn:doc - var foundColon = stream.eat(":"); - - // if there's not a second colon, gobble another word. Otherwise, it's probably an axis specifier - // which should get matched as a keyword - if(!stream.eat(":") && foundColon) { - stream.eatWhile(/[\w\$_-]/); - } - // if the next non whitespace character is an open paren, this is probably a function (if not a keyword of other sort) - if(stream.match(/^[ \t]*\(/, false)) { - mightBeFunction = true; - } - // is the word a keyword? - var word = stream.current(); - known = keywords.propertyIsEnumerable(word) && keywords[word]; - - // if we think it's a function call but not yet known, - // set style to variable for now for lack of something better - if(mightBeFunction && !known) known = {type: "function_call", style: "variable def"}; - - // if the previous word was element, attribute, axis specifier, this word should be the name of that - if(isInXmlConstructor(state)) { - popStateStack(state); - return ret("word", "variable", word); - } - // as previously checked, if the word is element,attribute, axis specifier, call it an "xmlconstructor" and - // push the stack so we know to look for it on the next word - if(word == "element" || word == "attribute" || known.type == "axis_specifier") pushStateStack(state, {type: "xmlconstructor"}); - - // if the word is known, return the details of that else just call this a generic 'word' - return known ? ret(known.type, known.style, word) : - ret("word", "variable", word); - } - } - - // handle comments, including nested - function tokenComment(stream, state) { - var maybeEnd = false, maybeNested = false, nestedCount = 0, ch; - while (ch = stream.next()) { - if (ch == ")" && maybeEnd) { - if(nestedCount > 0) - nestedCount--; - else { - popStateStack(state); - break; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; + + CodeMirror.defineMode("xquery", function () { + + // The keywords object is set to the result of this self executing + // function. Each keyword is a property of the keywords object whose + // value is {type: atype, style: astyle} + var keywords = function () { + // conveinence functions used to build keywords object + function kw(type) { + return {type: type, style: "keyword"}; + } + + var A = kw("keyword a") + , B = kw("keyword b") + , C = kw("keyword c") + , operator = kw("operator") + , atom = {type: "atom", style: "atom"} + , punctuation = {type: "punctuation", style: null} + , qualifier = {type: "axis_specifier", style: "qualifier"}; + + // kwObj is what is return from this function at the end + var kwObj = { + 'if': A, 'switch': A, 'while': A, 'for': A, + 'else': B, 'then': B, 'try': B, 'finally': B, 'catch': B, + 'element': C, 'attribute': C, 'let': C, 'implements': C, 'import': C, 'module': C, 'namespace': C, + 'return': C, 'super': C, 'this': C, 'throws': C, 'where': C, 'private': C, + ',': punctuation, + 'null': atom, 'fn:false()': atom, 'fn:true()': atom + }; + + // a list of 'basic' keywords. For each add a property to kwObj with the value of + // {type: basic[i], style: "keyword"} e.g. 'after' --> {type: "after", style: "keyword"} + var basic = ['after', 'ancestor', 'ancestor-or-self', 'and', 'as', 'ascending', 'assert', 'attribute', 'before', + 'by', 'case', 'cast', 'child', 'comment', 'declare', 'default', 'define', 'descendant', 'descendant-or-self', + 'descending', 'document', 'document-node', 'element', 'else', 'eq', 'every', 'except', 'external', 'following', + 'following-sibling', 'follows', 'for', 'function', 'if', 'import', 'in', 'instance', 'intersect', 'item', + 'let', 'module', 'namespace', 'node', 'node', 'of', 'only', 'or', 'order', 'parent', 'precedes', 'preceding', + 'preceding-sibling', 'processing-instruction', 'ref', 'return', 'returns', 'satisfies', 'schema', 'schema-element', + 'self', 'some', 'sortby', 'stable', 'text', 'then', 'to', 'treat', 'typeswitch', 'union', 'variable', 'version', 'where', + 'xquery', 'empty-sequence']; + for (var i = 0, l = basic.length; i < l; i++) { + kwObj[basic[i]] = kw(basic[i]); + } + ; + + // a list of types. For each add a property to kwObj with the value of + // {type: "atom", style: "atom"} + var types = ['xs:string', 'xs:float', 'xs:decimal', 'xs:double', 'xs:integer', 'xs:boolean', 'xs:date', 'xs:dateTime', + 'xs:time', 'xs:duration', 'xs:dayTimeDuration', 'xs:time', 'xs:yearMonthDuration', 'numeric', 'xs:hexBinary', + 'xs:base64Binary', 'xs:anyURI', 'xs:QName', 'xs:byte', 'xs:boolean', 'xs:anyURI', 'xf:yearMonthDuration']; + for (var i = 0, l = types.length; i < l; i++) { + kwObj[types[i]] = atom; + } + ; + + // each operator will add a property to kwObj with value of {type: "operator", style: "keyword"} + var operators = ['eq', 'ne', 'lt', 'le', 'gt', 'ge', ':=', '=', '>', '>=', '<', '<=', '.', '|', '?', 'and', 'or', 'div', 'idiv', 'mod', '*', '/', '+', '-']; + for (var i = 0, l = operators.length; i < l; i++) { + kwObj[operators[i]] = operator; + } + ; + + // each axis_specifiers will add a property to kwObj with value of {type: "axis_specifier", style: "qualifier"} + var axis_specifiers = ["self::", "attribute::", "child::", "descendant::", "descendant-or-self::", "parent::", + "ancestor::", "ancestor-or-self::", "following::", "preceding::", "following-sibling::", "preceding-sibling::"]; + for (var i = 0, l = axis_specifiers.length; i < l; i++) { + kwObj[axis_specifiers[i]] = qualifier; + } + ; + + return kwObj; + }(); + + // Used as scratch variables to communicate multiple values without + // consing up tons of objects. + var type, content; + + function ret(tp, style, cont) { + type = tp; + content = cont; + return style; } - } - else if(ch == ":" && maybeNested) { - nestedCount++; - } - maybeEnd = (ch == ":"); - maybeNested = (ch == "("); - } - - return ret("comment", "comment"); - } - - // tokenizer for string literals - // optionally pass a tokenizer function to set state.tokenize back to when finished - function tokenString(quote, f) { - return function(stream, state) { - var ch; - - if(isInString(state) && stream.current() == quote) { - popStateStack(state); - if(f) state.tokenize = f; - return ret("string", "string"); - } - - pushStateStack(state, { type: "string", name: quote, tokenize: tokenString(quote, f) }); - - // if we're in a string and in an XML block, allow an embedded code block - if(stream.match("{", false) && isInXmlAttributeBlock(state)) { - state.tokenize = tokenBase; - return ret("string", "string"); - } - - - while (ch = stream.next()) { - if (ch == quote) { - popStateStack(state); - if(f) state.tokenize = f; - break; + + function chain(stream, state, f) { + state.tokenize = f; + return f(stream, state); + } + + // the primary mode tokenizer + function tokenBase(stream, state) { + var ch = stream.next(), + mightBeFunction = false, + isEQName = isEQNameAhead(stream); + + // an XML tag (if not in some sub, chained tokenizer) + if (ch == "<") { + if (stream.match("!--", true)) + return chain(stream, state, tokenXMLComment); + + if (stream.match("![CDATA", false)) { + state.tokenize = tokenCDATA; + return ret("tag", "tag"); + } + + if (stream.match("?", false)) { + return chain(stream, state, tokenPreProcessing); + } + + var isclose = stream.eat("/"); + stream.eatSpace(); + var tagName = "", c; + while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c; + + return chain(stream, state, tokenTag(tagName, isclose)); + } + // start code block + else if (ch == "{") { + pushStateStack(state, {type: "codeblock"}); + return ret("", null); + } + // end code block + else if (ch == "}") { + popStateStack(state); + return ret("", null); + } + // if we're in an XML block + else if (isInXmlBlock(state)) { + if (ch == ">") + return ret("tag", "tag"); + else if (ch == "/" && stream.eat(">")) { + popStateStack(state); + return ret("tag", "tag"); + } else + return ret("word", "variable"); + } + // if a number + else if (/\d/.test(ch)) { + stream.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/); + return ret("number", "atom"); + } + // comment start + else if (ch === "(" && stream.eat(":")) { + pushStateStack(state, {type: "comment"}); + return chain(stream, state, tokenComment); + } + // quoted string + else if (!isEQName && (ch === '"' || ch === "'")) + return chain(stream, state, tokenString(ch)); + // variable + else if (ch === "$") { + return chain(stream, state, tokenVariable); + } + // assignment + else if (ch === ":" && stream.eat("=")) { + return ret("operator", "keyword"); + } + // open paren + else if (ch === "(") { + pushStateStack(state, {type: "paren"}); + return ret("", null); + } + // close paren + else if (ch === ")") { + popStateStack(state); + return ret("", null); + } + // open paren + else if (ch === "[") { + pushStateStack(state, {type: "bracket"}); + return ret("", null); + } + // close paren + else if (ch === "]") { + popStateStack(state); + return ret("", null); + } else { + var known = keywords.propertyIsEnumerable(ch) && keywords[ch]; + + // if there's a EQName ahead, consume the rest of the string portion, it's likely a function + if (isEQName && ch === '\"') while (stream.next() !== '"') { + } + if (isEQName && ch === '\'') while (stream.next() !== '\'') { + } + + // gobble up a word if the character is not known + if (!known) stream.eatWhile(/[\w\$_-]/); + + // gobble a colon in the case that is a lib func type call fn:doc + var foundColon = stream.eat(":"); + + // if there's not a second colon, gobble another word. Otherwise, it's probably an axis specifier + // which should get matched as a keyword + if (!stream.eat(":") && foundColon) { + stream.eatWhile(/[\w\$_-]/); + } + // if the next non whitespace character is an open paren, this is probably a function (if not a keyword of other sort) + if (stream.match(/^[ \t]*\(/, false)) { + mightBeFunction = true; + } + // is the word a keyword? + var word = stream.current(); + known = keywords.propertyIsEnumerable(word) && keywords[word]; + + // if we think it's a function call but not yet known, + // set style to variable for now for lack of something better + if (mightBeFunction && !known) known = {type: "function_call", style: "variable def"}; + + // if the previous word was element, attribute, axis specifier, this word should be the name of that + if (isInXmlConstructor(state)) { + popStateStack(state); + return ret("word", "variable", word); + } + // as previously checked, if the word is element,attribute, axis specifier, call it an "xmlconstructor" and + // push the stack so we know to look for it on the next word + if (word == "element" || word == "attribute" || known.type == "axis_specifier") pushStateStack(state, {type: "xmlconstructor"}); + + // if the word is known, return the details of that else just call this a generic 'word' + return known ? ret(known.type, known.style, word) : + ret("word", "variable", word); + } + } + + // handle comments, including nested + function tokenComment(stream, state) { + var maybeEnd = false, maybeNested = false, nestedCount = 0, ch; + while (ch = stream.next()) { + if (ch == ")" && maybeEnd) { + if (nestedCount > 0) + nestedCount--; + else { + popStateStack(state); + break; + } + } else if (ch == ":" && maybeNested) { + nestedCount++; + } + maybeEnd = (ch == ":"); + maybeNested = (ch == "("); + } + + return ret("comment", "comment"); } - else { - // if we're in a string and in an XML block, allow an embedded code block in an attribute - if(stream.match("{", false) && isInXmlAttributeBlock(state)) { + + // tokenizer for string literals + // optionally pass a tokenizer function to set state.tokenize back to when finished + function tokenString(quote, f) { + return function (stream, state) { + var ch; + + if (isInString(state) && stream.current() == quote) { + popStateStack(state); + if (f) state.tokenize = f; + return ret("string", "string"); + } + + pushStateStack(state, {type: "string", name: quote, tokenize: tokenString(quote, f)}); + + // if we're in a string and in an XML block, allow an embedded code block + if (stream.match("{", false) && isInXmlAttributeBlock(state)) { + state.tokenize = tokenBase; + return ret("string", "string"); + } + + + while (ch = stream.next()) { + if (ch == quote) { + popStateStack(state); + if (f) state.tokenize = f; + break; + } else { + // if we're in a string and in an XML block, allow an embedded code block in an attribute + if (stream.match("{", false) && isInXmlAttributeBlock(state)) { + state.tokenize = tokenBase; + return ret("string", "string"); + } + + } + } + + return ret("string", "string"); + }; + } + + // tokenizer for variables + function tokenVariable(stream, state) { + var isVariableChar = /[\w\$_-]/; + + // a variable may start with a quoted EQName so if the next character is quote, consume to the next quote + if (stream.eat("\"")) { + while (stream.next() !== '\"') { + } + ; + stream.eat(":"); + } else { + stream.eatWhile(isVariableChar); + if (!stream.match(":=", false)) stream.eat(":"); + } + stream.eatWhile(isVariableChar); state.tokenize = tokenBase; - return ret("string", "string"); - } + return ret("variable", "variable"); + } + // tokenizer for XML tags + function tokenTag(name, isclose) { + return function (stream, state) { + stream.eatSpace(); + if (isclose && stream.eat(">")) { + popStateStack(state); + state.tokenize = tokenBase; + return ret("tag", "tag"); + } + // self closing tag without attributes? + if (!stream.eat("/")) + pushStateStack(state, {type: "tag", name: name, tokenize: tokenBase}); + if (!stream.eat(">")) { + state.tokenize = tokenAttribute; + return ret("tag", "tag"); + } else { + state.tokenize = tokenBase; + } + return ret("tag", "tag"); + }; } - } - - return ret("string", "string"); - }; - } - - // tokenizer for variables - function tokenVariable(stream, state) { - var isVariableChar = /[\w\$_-]/; - - // a variable may start with a quoted EQName so if the next character is quote, consume to the next quote - if(stream.eat("\"")) { - while(stream.next() !== '\"'){}; - stream.eat(":"); - } else { - stream.eatWhile(isVariableChar); - if(!stream.match(":=", false)) stream.eat(":"); - } - stream.eatWhile(isVariableChar); - state.tokenize = tokenBase; - return ret("variable", "variable"); - } - - // tokenizer for XML tags - function tokenTag(name, isclose) { - return function(stream, state) { - stream.eatSpace(); - if(isclose && stream.eat(">")) { - popStateStack(state); - state.tokenize = tokenBase; - return ret("tag", "tag"); - } - // self closing tag without attributes? - if(!stream.eat("/")) - pushStateStack(state, { type: "tag", name: name, tokenize: tokenBase}); - if(!stream.eat(">")) { - state.tokenize = tokenAttribute; - return ret("tag", "tag"); - } - else { - state.tokenize = tokenBase; - } - return ret("tag", "tag"); - }; - } - - // tokenizer for XML attributes - function tokenAttribute(stream, state) { - var ch = stream.next(); - - if(ch == "/" && stream.eat(">")) { - if(isInXmlAttributeBlock(state)) popStateStack(state); - if(isInXmlBlock(state)) popStateStack(state); - return ret("tag", "tag"); - } - if(ch == ">") { - if(isInXmlAttributeBlock(state)) popStateStack(state); - return ret("tag", "tag"); - } - if(ch == "=") - return ret("", null); - // quoted string - if (ch == '"' || ch == "'") - return chain(stream, state, tokenString(ch, tokenAttribute)); - - if(!isInXmlAttributeBlock(state)) - pushStateStack(state, { type: "attribute", tokenize: tokenAttribute}); - - stream.eat(/[a-zA-Z_:]/); - stream.eatWhile(/[-a-zA-Z0-9_:.]/); - stream.eatSpace(); - - // the case where the attribute has not value and the tag was closed - if(stream.match(">", false) || stream.match("/", false)) { - popStateStack(state); - state.tokenize = tokenBase; - } - - return ret("attribute", "attribute"); - } - - // handle comments, including nested - function tokenXMLComment(stream, state) { - var ch; - while (ch = stream.next()) { - if (ch == "-" && stream.match("->", true)) { - state.tokenize = tokenBase; - return ret("comment", "comment"); - } - } - } - - - // handle CDATA - function tokenCDATA(stream, state) { - var ch; - while (ch = stream.next()) { - if (ch == "]" && stream.match("]", true)) { - state.tokenize = tokenBase; - return ret("comment", "comment"); - } - } - } - - // handle preprocessing instructions - function tokenPreProcessing(stream, state) { - var ch; - while (ch = stream.next()) { - if (ch == "?" && stream.match(">", true)) { - state.tokenize = tokenBase; - return ret("comment", "comment meta"); - } - } - } - - - // functions to test the current context of the state - function isInXmlBlock(state) { return isIn(state, "tag"); } - function isInXmlAttributeBlock(state) { return isIn(state, "attribute"); } - function isInXmlConstructor(state) { return isIn(state, "xmlconstructor"); } - function isInString(state) { return isIn(state, "string"); } - - function isEQNameAhead(stream) { - // assume we've already eaten a quote (") - if(stream.current() === '"') - return stream.match(/^[^\"]+\"\:/, false); - else if(stream.current() === '\'') - return stream.match(/^[^\"]+\'\:/, false); - else - return false; - } - - function isIn(state, type) { - return (state.stack.length && state.stack[state.stack.length - 1].type == type); - } - - function pushStateStack(state, newState) { - state.stack.push(newState); - } - - function popStateStack(state) { - state.stack.pop(); - var reinstateTokenize = state.stack.length && state.stack[state.stack.length-1].tokenize; - state.tokenize = reinstateTokenize || tokenBase; - } - - // the interface for the mode API - return { - startState: function() { - return { - tokenize: tokenBase, - cc: [], - stack: [] - }; - }, - - token: function(stream, state) { - if (stream.eatSpace()) return null; - var style = state.tokenize(stream, state); - return style; - }, - - blockCommentStart: "(:", - blockCommentEnd: ":)" - - }; -}); + // tokenizer for XML attributes + function tokenAttribute(stream, state) { + var ch = stream.next(); + + if (ch == "/" && stream.eat(">")) { + if (isInXmlAttributeBlock(state)) popStateStack(state); + if (isInXmlBlock(state)) popStateStack(state); + return ret("tag", "tag"); + } + if (ch == ">") { + if (isInXmlAttributeBlock(state)) popStateStack(state); + return ret("tag", "tag"); + } + if (ch == "=") + return ret("", null); + // quoted string + if (ch == '"' || ch == "'") + return chain(stream, state, tokenString(ch, tokenAttribute)); + + if (!isInXmlAttributeBlock(state)) + pushStateStack(state, {type: "attribute", tokenize: tokenAttribute}); + + stream.eat(/[a-zA-Z_:]/); + stream.eatWhile(/[-a-zA-Z0-9_:.]/); + stream.eatSpace(); + + // the case where the attribute has not value and the tag was closed + if (stream.match(">", false) || stream.match("/", false)) { + popStateStack(state); + state.tokenize = tokenBase; + } + + return ret("attribute", "attribute"); + } + + // handle comments, including nested + function tokenXMLComment(stream, state) { + var ch; + while (ch = stream.next()) { + if (ch == "-" && stream.match("->", true)) { + state.tokenize = tokenBase; + return ret("comment", "comment"); + } + } + } + + + // handle CDATA + function tokenCDATA(stream, state) { + var ch; + while (ch = stream.next()) { + if (ch == "]" && stream.match("]", true)) { + state.tokenize = tokenBase; + return ret("comment", "comment"); + } + } + } + + // handle preprocessing instructions + function tokenPreProcessing(stream, state) { + var ch; + while (ch = stream.next()) { + if (ch == "?" && stream.match(">", true)) { + state.tokenize = tokenBase; + return ret("comment", "comment meta"); + } + } + } + + + // functions to test the current context of the state + function isInXmlBlock(state) { + return isIn(state, "tag"); + } + + function isInXmlAttributeBlock(state) { + return isIn(state, "attribute"); + } + + function isInXmlConstructor(state) { + return isIn(state, "xmlconstructor"); + } + + function isInString(state) { + return isIn(state, "string"); + } + + function isEQNameAhead(stream) { + // assume we've already eaten a quote (") + if (stream.current() === '"') + return stream.match(/^[^\"]+\"\:/, false); + else if (stream.current() === '\'') + return stream.match(/^[^\"]+\'\:/, false); + else + return false; + } + + function isIn(state, type) { + return (state.stack.length && state.stack[state.stack.length - 1].type == type); + } + + function pushStateStack(state, newState) { + state.stack.push(newState); + } + + function popStateStack(state) { + state.stack.pop(); + var reinstateTokenize = state.stack.length && state.stack[state.stack.length - 1].tokenize; + state.tokenize = reinstateTokenize || tokenBase; + } + + // the interface for the mode API + return { + startState: function () { + return { + tokenize: tokenBase, + cc: [], + stack: [] + }; + }, + + token: function (stream, state) { + if (stream.eatSpace()) return null; + var style = state.tokenize(stream, state); + return style; + }, + + blockCommentStart: "(:", + blockCommentEnd: ":)" + + }; + + }); -CodeMirror.defineMIME("application/xquery", "xquery"); + CodeMirror.defineMIME("application/xquery", "xquery"); }); diff --git a/web/editor.md/lib/codemirror/mode/yaml/index.html b/web/editor.md/lib/codemirror/mode/yaml/index.html index be9b632..097289b 100644 --- a/web/editor.md/lib/codemirror/mode/yaml/index.html +++ b/web/editor.md/lib/codemirror/mode/yaml/index.html @@ -2,29 +2,32 @@ CodeMirror: YAML mode - + - + - +
    -

    YAML mode

    -

    MIME types defined: text/x-yaml.

    -
    + diff --git a/web/editor.md/lib/codemirror/mode/yaml/yaml.js b/web/editor.md/lib/codemirror/mode/yaml/yaml.js index b7015e5..92cac8c 100644 --- a/web/editor.md/lib/codemirror/mode/yaml/yaml.js +++ b/web/editor.md/lib/codemirror/mode/yaml/yaml.js @@ -1,117 +1,141 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode("yaml", function() { + CodeMirror.defineMode("yaml", function () { - var cons = ['true', 'false', 'on', 'off', 'yes', 'no']; - var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i'); + var cons = ['true', 'false', 'on', 'off', 'yes', 'no']; + var keywordRegex = new RegExp("\\b((" + cons.join(")|(") + "))$", 'i'); - return { - token: function(stream, state) { - var ch = stream.peek(); - var esc = state.escaped; - state.escaped = false; - /* comments */ - if (ch == "#" && (stream.pos == 0 || /\s/.test(stream.string.charAt(stream.pos - 1)))) { - stream.skipToEnd(); - return "comment"; - } + return { + token: function (stream, state) { + var ch = stream.peek(); + var esc = state.escaped; + state.escaped = false; + /* comments */ + if (ch == "#" && (stream.pos == 0 || /\s/.test(stream.string.charAt(stream.pos - 1)))) { + stream.skipToEnd(); + return "comment"; + } - if (stream.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/)) - return "string"; + if (stream.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/)) + return "string"; - if (state.literal && stream.indentation() > state.keyCol) { - stream.skipToEnd(); return "string"; - } else if (state.literal) { state.literal = false; } - if (stream.sol()) { - state.keyCol = 0; - state.pair = false; - state.pairStart = false; - /* document start */ - if(stream.match(/---/)) { return "def"; } - /* document end */ - if (stream.match(/\.\.\./)) { return "def"; } - /* array list item */ - if (stream.match(/\s*-\s+/)) { return 'meta'; } - } - /* inline pairs/lists */ - if (stream.match(/^(\{|\}|\[|\])/)) { - if (ch == '{') - state.inlinePairs++; - else if (ch == '}') - state.inlinePairs--; - else if (ch == '[') - state.inlineList++; - else - state.inlineList--; - return 'meta'; - } + if (state.literal && stream.indentation() > state.keyCol) { + stream.skipToEnd(); + return "string"; + } else if (state.literal) { + state.literal = false; + } + if (stream.sol()) { + state.keyCol = 0; + state.pair = false; + state.pairStart = false; + /* document start */ + if (stream.match(/---/)) { + return "def"; + } + /* document end */ + if (stream.match(/\.\.\./)) { + return "def"; + } + /* array list item */ + if (stream.match(/\s*-\s+/)) { + return 'meta'; + } + } + /* inline pairs/lists */ + if (stream.match(/^(\{|\}|\[|\])/)) { + if (ch == '{') + state.inlinePairs++; + else if (ch == '}') + state.inlinePairs--; + else if (ch == '[') + state.inlineList++; + else + state.inlineList--; + return 'meta'; + } - /* list seperator */ - if (state.inlineList > 0 && !esc && ch == ',') { - stream.next(); - return 'meta'; - } - /* pairs seperator */ - if (state.inlinePairs > 0 && !esc && ch == ',') { - state.keyCol = 0; - state.pair = false; - state.pairStart = false; - stream.next(); - return 'meta'; - } + /* list seperator */ + if (state.inlineList > 0 && !esc && ch == ',') { + stream.next(); + return 'meta'; + } + /* pairs seperator */ + if (state.inlinePairs > 0 && !esc && ch == ',') { + state.keyCol = 0; + state.pair = false; + state.pairStart = false; + stream.next(); + return 'meta'; + } - /* start of value of a pair */ - if (state.pairStart) { - /* block literals */ - if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; }; - /* references */ - if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; } - /* numbers */ - if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; } - if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; } - /* keywords */ - if (stream.match(keywordRegex)) { return 'keyword'; } - } + /* start of value of a pair */ + if (state.pairStart) { + /* block literals */ + if (stream.match(/^\s*(\||\>)\s*/)) { + state.literal = true; + return 'meta'; + } + ; + /* references */ + if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { + return 'variable-2'; + } + /* numbers */ + if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { + return 'number'; + } + if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { + return 'number'; + } + /* keywords */ + if (stream.match(keywordRegex)) { + return 'keyword'; + } + } - /* pairs (associative arrays) -> key */ - if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)) { - state.pair = true; - state.keyCol = stream.indentation(); - return "atom"; - } - if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; } + /* pairs (associative arrays) -> key */ + if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)) { + state.pair = true; + state.keyCol = stream.indentation(); + return "atom"; + } + if (state.pair && stream.match(/^:\s*/)) { + state.pairStart = true; + return 'meta'; + } - /* nothing found, continue */ - state.pairStart = false; - state.escaped = (ch == '\\'); - stream.next(); - return null; - }, - startState: function() { - return { - pair: false, - pairStart: false, - keyCol: 0, - inlinePairs: 0, - inlineList: 0, - literal: false, - escaped: false - }; - } - }; -}); + /* nothing found, continue */ + state.pairStart = false; + state.escaped = (ch == '\\'); + stream.next(); + return null; + }, + startState: function () { + return { + pair: false, + pairStart: false, + keyCol: 0, + inlinePairs: 0, + inlineList: 0, + literal: false, + escaped: false + }; + } + }; + }); -CodeMirror.defineMIME("text/x-yaml", "yaml"); + CodeMirror.defineMIME("text/x-yaml", "yaml"); }); diff --git a/web/editor.md/lib/codemirror/mode/z80/index.html b/web/editor.md/lib/codemirror/mode/z80/index.html index 1ad3ace..2e849cd 100644 --- a/web/editor.md/lib/codemirror/mode/z80/index.html +++ b/web/editor.md/lib/codemirror/mode/z80/index.html @@ -2,31 +2,34 @@ CodeMirror: Z80 assembly mode - + - + - +
    -

    Z80 assembly mode

    +

    Z80 assembly mode

    -

    MIME type defined: text/x-z80.

    -
    + diff --git a/web/editor.md/lib/codemirror/mode/z80/z80.js b/web/editor.md/lib/codemirror/mode/z80/z80.js index ec41d05..ce34ab7 100644 --- a/web/editor.md/lib/codemirror/mode/z80/z80.js +++ b/web/editor.md/lib/codemirror/mode/z80/z80.js @@ -1,100 +1,100 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); - else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { -"use strict"; +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function (CodeMirror) { + "use strict"; -CodeMirror.defineMode('z80', function() { - var keywords1 = /^(exx?|(ld|cp|in)([di]r?)?|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|rst|[de]i|halt|im|ot[di]r|out[di]?)\b/i; - var keywords2 = /^(call|j[pr]|ret[in]?)\b/i; - var keywords3 = /^b_?(call|jump)\b/i; - var variables1 = /^(af?|bc?|c|de?|e|hl?|l|i[xy]?|r|sp)\b/i; - var variables2 = /^(n?[zc]|p[oe]?|m)\b/i; - var errors = /^([hl][xy]|i[xy][hl]|slia|sll)\b/i; - var numbers = /^([\da-f]+h|[0-7]+o|[01]+b|\d+)\b/i; + CodeMirror.defineMode('z80', function () { + var keywords1 = /^(exx?|(ld|cp|in)([di]r?)?|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|rst|[de]i|halt|im|ot[di]r|out[di]?)\b/i; + var keywords2 = /^(call|j[pr]|ret[in]?)\b/i; + var keywords3 = /^b_?(call|jump)\b/i; + var variables1 = /^(af?|bc?|c|de?|e|hl?|l|i[xy]?|r|sp)\b/i; + var variables2 = /^(n?[zc]|p[oe]?|m)\b/i; + var errors = /^([hl][xy]|i[xy][hl]|slia|sll)\b/i; + var numbers = /^([\da-f]+h|[0-7]+o|[01]+b|\d+)\b/i; - return { - startState: function() { - return {context: 0}; - }, - token: function(stream, state) { - if (!stream.column()) - state.context = 0; + return { + startState: function () { + return {context: 0}; + }, + token: function (stream, state) { + if (!stream.column()) + state.context = 0; - if (stream.eatSpace()) - return null; + if (stream.eatSpace()) + return null; - var w; + var w; - if (stream.eatWhile(/\w/)) { - w = stream.current(); + if (stream.eatWhile(/\w/)) { + w = stream.current(); - if (stream.indentation()) { - if (state.context == 1 && variables1.test(w)) - return 'variable-2'; + if (stream.indentation()) { + if (state.context == 1 && variables1.test(w)) + return 'variable-2'; - if (state.context == 2 && variables2.test(w)) - return 'variable-3'; + if (state.context == 2 && variables2.test(w)) + return 'variable-3'; - if (keywords1.test(w)) { - state.context = 1; - return 'keyword'; - } else if (keywords2.test(w)) { - state.context = 2; - return 'keyword'; - } else if (keywords3.test(w)) { - state.context = 3; - return 'keyword'; - } + if (keywords1.test(w)) { + state.context = 1; + return 'keyword'; + } else if (keywords2.test(w)) { + state.context = 2; + return 'keyword'; + } else if (keywords3.test(w)) { + state.context = 3; + return 'keyword'; + } - if (errors.test(w)) - return 'error'; - } else if (numbers.test(w)) { - return 'number'; - } else { - return null; - } - } else if (stream.eat(';')) { - stream.skipToEnd(); - return 'comment'; - } else if (stream.eat('"')) { - while (w = stream.next()) { - if (w == '"') - break; + if (errors.test(w)) + return 'error'; + } else if (numbers.test(w)) { + return 'number'; + } else { + return null; + } + } else if (stream.eat(';')) { + stream.skipToEnd(); + return 'comment'; + } else if (stream.eat('"')) { + while (w = stream.next()) { + if (w == '"') + break; - if (w == '\\') - stream.next(); - } - return 'string'; - } else if (stream.eat('\'')) { - if (stream.match(/\\?.'/)) - return 'number'; - } else if (stream.eat('.') || stream.sol() && stream.eat('#')) { - state.context = 4; + if (w == '\\') + stream.next(); + } + return 'string'; + } else if (stream.eat('\'')) { + if (stream.match(/\\?.'/)) + return 'number'; + } else if (stream.eat('.') || stream.sol() && stream.eat('#')) { + state.context = 4; - if (stream.eatWhile(/\w/)) - return 'def'; - } else if (stream.eat('$')) { - if (stream.eatWhile(/[\da-f]/i)) - return 'number'; - } else if (stream.eat('%')) { - if (stream.eatWhile(/[01]/)) - return 'number'; - } else { - stream.next(); - } - return null; - } - }; -}); + if (stream.eatWhile(/\w/)) + return 'def'; + } else if (stream.eat('$')) { + if (stream.eatWhile(/[\da-f]/i)) + return 'number'; + } else if (stream.eat('%')) { + if (stream.eatWhile(/[01]/)) + return 'number'; + } else { + stream.next(); + } + return null; + } + }; + }); -CodeMirror.defineMIME("text/x-z80", "z80"); + CodeMirror.defineMIME("text/x-z80", "z80"); }); diff --git a/web/editor.md/lib/codemirror/package.json b/web/editor.md/lib/codemirror/package.json index b4a9b53..55361f6 100644 --- a/web/editor.md/lib/codemirror/package.json +++ b/web/editor.md/lib/codemirror/package.json @@ -1,21 +1,41 @@ { - "name": "codemirror", - "version":"5.0.0", - "main": "lib/codemirror.js", - "description": "In-browser code editing made bearable", - "licenses": [{"type": "MIT", - "url": "http://codemirror.net/LICENSE"}], - "directories": {"lib": "./lib"}, - "scripts": {"test": "node ./test/run.js"}, - "devDependencies": {"node-static": "0.6.0", - "phantomjs": "1.9.2-5", - "blint": ">=0.1.1"}, - "bugs": "http://github.com/codemirror/CodeMirror/issues", - "keywords": ["JavaScript", "CodeMirror", "Editor"], - "homepage": "http://codemirror.net", - "maintainers":[{"name": "Marijn Haverbeke", - "email": "marijnh@gmail.com", - "web": "http://marijnhaverbeke.nl"}], - "repository": {"type": "git", - "url": "https://github.com/codemirror/CodeMirror.git"} + "name": "codemirror", + "version": "5.0.0", + "main": "lib/codemirror.js", + "description": "In-browser code editing made bearable", + "licenses": [ + { + "type": "MIT", + "url": "http://codemirror.net/LICENSE" + } + ], + "directories": { + "lib": "./lib" + }, + "scripts": { + "test": "node ./test/run.js" + }, + "devDependencies": { + "node-static": "0.6.0", + "phantomjs": "1.9.2-5", + "blint": ">=0.1.1" + }, + "bugs": "http://github.com/codemirror/CodeMirror/issues", + "keywords": [ + "JavaScript", + "CodeMirror", + "Editor" + ], + "homepage": "http://codemirror.net", + "maintainers": [ + { + "name": "Marijn Haverbeke", + "email": "marijnh@gmail.com", + "web": "http://marijnhaverbeke.nl" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/codemirror/CodeMirror.git" + } } diff --git a/web/editor.md/lib/codemirror/theme/3024-day.css b/web/editor.md/lib/codemirror/theme/3024-day.css index 3592816..54551a4 100644 --- a/web/editor.md/lib/codemirror/theme/3024-day.css +++ b/web/editor.md/lib/codemirror/theme/3024-day.css @@ -8,33 +8,102 @@ */ -.cm-s-3024-day.CodeMirror {background: #f7f7f7; color: #3a3432;} -.cm-s-3024-day div.CodeMirror-selected {background: #d6d5d4 !important;} -.cm-s-3024-day.CodeMirror ::selection { background: #d6d5d4; } -.cm-s-3024-day.CodeMirror ::-moz-selection { background: #d9d9d9; } - -.cm-s-3024-day .CodeMirror-gutters {background: #f7f7f7; border-right: 0px;} -.cm-s-3024-day .CodeMirror-guttermarker { color: #db2d20; } -.cm-s-3024-day .CodeMirror-guttermarker-subtle { color: #807d7c; } -.cm-s-3024-day .CodeMirror-linenumber {color: #807d7c;} - -.cm-s-3024-day .CodeMirror-cursor {border-left: 1px solid #5c5855 !important;} - -.cm-s-3024-day span.cm-comment {color: #cdab53;} -.cm-s-3024-day span.cm-atom {color: #a16a94;} -.cm-s-3024-day span.cm-number {color: #a16a94;} - -.cm-s-3024-day span.cm-property, .cm-s-3024-day span.cm-attribute {color: #01a252;} -.cm-s-3024-day span.cm-keyword {color: #db2d20;} -.cm-s-3024-day span.cm-string {color: #fded02;} - -.cm-s-3024-day span.cm-variable {color: #01a252;} -.cm-s-3024-day span.cm-variable-2 {color: #01a0e4;} -.cm-s-3024-day span.cm-def {color: #e8bbd0;} -.cm-s-3024-day span.cm-bracket {color: #3a3432;} -.cm-s-3024-day span.cm-tag {color: #db2d20;} -.cm-s-3024-day span.cm-link {color: #a16a94;} -.cm-s-3024-day span.cm-error {background: #db2d20; color: #5c5855;} - -.cm-s-3024-day .CodeMirror-activeline-background {background: #e8f2ff !important;} -.cm-s-3024-day .CodeMirror-matchingbracket { text-decoration: underline; color: #a16a94 !important;} +.cm-s-3024-day.CodeMirror { + background: #f7f7f7; + color: #3a3432; +} + +.cm-s-3024-day div.CodeMirror-selected { + background: #d6d5d4 !important; +} + +.cm-s-3024-day.CodeMirror ::selection { + background: #d6d5d4; +} + +.cm-s-3024-day.CodeMirror ::-moz-selection { + background: #d9d9d9; +} + +.cm-s-3024-day .CodeMirror-gutters { + background: #f7f7f7; + border-right: 0px; +} + +.cm-s-3024-day .CodeMirror-guttermarker { + color: #db2d20; +} + +.cm-s-3024-day .CodeMirror-guttermarker-subtle { + color: #807d7c; +} + +.cm-s-3024-day .CodeMirror-linenumber { + color: #807d7c; +} + +.cm-s-3024-day .CodeMirror-cursor { + border-left: 1px solid #5c5855 !important; +} + +.cm-s-3024-day span.cm-comment { + color: #cdab53; +} + +.cm-s-3024-day span.cm-atom { + color: #a16a94; +} + +.cm-s-3024-day span.cm-number { + color: #a16a94; +} + +.cm-s-3024-day span.cm-property, .cm-s-3024-day span.cm-attribute { + color: #01a252; +} + +.cm-s-3024-day span.cm-keyword { + color: #db2d20; +} + +.cm-s-3024-day span.cm-string { + color: #fded02; +} + +.cm-s-3024-day span.cm-variable { + color: #01a252; +} + +.cm-s-3024-day span.cm-variable-2 { + color: #01a0e4; +} + +.cm-s-3024-day span.cm-def { + color: #e8bbd0; +} + +.cm-s-3024-day span.cm-bracket { + color: #3a3432; +} + +.cm-s-3024-day span.cm-tag { + color: #db2d20; +} + +.cm-s-3024-day span.cm-link { + color: #a16a94; +} + +.cm-s-3024-day span.cm-error { + background: #db2d20; + color: #5c5855; +} + +.cm-s-3024-day .CodeMirror-activeline-background { + background: #e8f2ff !important; +} + +.cm-s-3024-day .CodeMirror-matchingbracket { + text-decoration: underline; + color: #a16a94 !important; +} diff --git a/web/editor.md/lib/codemirror/theme/3024-night.css b/web/editor.md/lib/codemirror/theme/3024-night.css index ccab9d5..afd764a 100644 --- a/web/editor.md/lib/codemirror/theme/3024-night.css +++ b/web/editor.md/lib/codemirror/theme/3024-night.css @@ -8,32 +8,102 @@ */ -.cm-s-3024-night.CodeMirror {background: #090300; color: #d6d5d4;} -.cm-s-3024-night div.CodeMirror-selected {background: #3a3432 !important;} -.cm-s-3024-night.CodeMirror ::selection { background: rgba(58, 52, 50, .99); } -.cm-s-3024-night.CodeMirror ::-moz-selection { background: rgba(58, 52, 50, .99); } -.cm-s-3024-night .CodeMirror-gutters {background: #090300; border-right: 0px;} -.cm-s-3024-night .CodeMirror-guttermarker { color: #db2d20; } -.cm-s-3024-night .CodeMirror-guttermarker-subtle { color: #5c5855; } -.cm-s-3024-night .CodeMirror-linenumber {color: #5c5855;} - -.cm-s-3024-night .CodeMirror-cursor {border-left: 1px solid #807d7c !important;} - -.cm-s-3024-night span.cm-comment {color: #cdab53;} -.cm-s-3024-night span.cm-atom {color: #a16a94;} -.cm-s-3024-night span.cm-number {color: #a16a94;} - -.cm-s-3024-night span.cm-property, .cm-s-3024-night span.cm-attribute {color: #01a252;} -.cm-s-3024-night span.cm-keyword {color: #db2d20;} -.cm-s-3024-night span.cm-string {color: #fded02;} - -.cm-s-3024-night span.cm-variable {color: #01a252;} -.cm-s-3024-night span.cm-variable-2 {color: #01a0e4;} -.cm-s-3024-night span.cm-def {color: #e8bbd0;} -.cm-s-3024-night span.cm-bracket {color: #d6d5d4;} -.cm-s-3024-night span.cm-tag {color: #db2d20;} -.cm-s-3024-night span.cm-link {color: #a16a94;} -.cm-s-3024-night span.cm-error {background: #db2d20; color: #807d7c;} - -.cm-s-3024-night .CodeMirror-activeline-background {background: #2F2F2F !important;} -.cm-s-3024-night .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} +.cm-s-3024-night.CodeMirror { + background: #090300; + color: #d6d5d4; +} + +.cm-s-3024-night div.CodeMirror-selected { + background: #3a3432 !important; +} + +.cm-s-3024-night.CodeMirror ::selection { + background: rgba(58, 52, 50, .99); +} + +.cm-s-3024-night.CodeMirror ::-moz-selection { + background: rgba(58, 52, 50, .99); +} + +.cm-s-3024-night .CodeMirror-gutters { + background: #090300; + border-right: 0px; +} + +.cm-s-3024-night .CodeMirror-guttermarker { + color: #db2d20; +} + +.cm-s-3024-night .CodeMirror-guttermarker-subtle { + color: #5c5855; +} + +.cm-s-3024-night .CodeMirror-linenumber { + color: #5c5855; +} + +.cm-s-3024-night .CodeMirror-cursor { + border-left: 1px solid #807d7c !important; +} + +.cm-s-3024-night span.cm-comment { + color: #cdab53; +} + +.cm-s-3024-night span.cm-atom { + color: #a16a94; +} + +.cm-s-3024-night span.cm-number { + color: #a16a94; +} + +.cm-s-3024-night span.cm-property, .cm-s-3024-night span.cm-attribute { + color: #01a252; +} + +.cm-s-3024-night span.cm-keyword { + color: #db2d20; +} + +.cm-s-3024-night span.cm-string { + color: #fded02; +} + +.cm-s-3024-night span.cm-variable { + color: #01a252; +} + +.cm-s-3024-night span.cm-variable-2 { + color: #01a0e4; +} + +.cm-s-3024-night span.cm-def { + color: #e8bbd0; +} + +.cm-s-3024-night span.cm-bracket { + color: #d6d5d4; +} + +.cm-s-3024-night span.cm-tag { + color: #db2d20; +} + +.cm-s-3024-night span.cm-link { + color: #a16a94; +} + +.cm-s-3024-night span.cm-error { + background: #db2d20; + color: #807d7c; +} + +.cm-s-3024-night .CodeMirror-activeline-background { + background: #2F2F2F !important; +} + +.cm-s-3024-night .CodeMirror-matchingbracket { + text-decoration: underline; + color: white !important; +} diff --git a/web/editor.md/lib/codemirror/theme/ambiance-mobile.css b/web/editor.md/lib/codemirror/theme/ambiance-mobile.css index 88d332e..578cb78 100644 --- a/web/editor.md/lib/codemirror/theme/ambiance-mobile.css +++ b/web/editor.md/lib/codemirror/theme/ambiance-mobile.css @@ -1,5 +1,5 @@ .cm-s-ambiance.CodeMirror { - -webkit-box-shadow: none; - -moz-box-shadow: none; - box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; } diff --git a/web/editor.md/lib/codemirror/theme/ambiance.css b/web/editor.md/lib/codemirror/theme/ambiance.css index afcf15a..d41c95c 100644 --- a/web/editor.md/lib/codemirror/theme/ambiance.css +++ b/web/editor.md/lib/codemirror/theme/ambiance.css @@ -2,74 +2,167 @@ /* Color scheme */ -.cm-s-ambiance .cm-keyword { color: #cda869; } -.cm-s-ambiance .cm-atom { color: #CF7EA9; } -.cm-s-ambiance .cm-number { color: #78CF8A; } -.cm-s-ambiance .cm-def { color: #aac6e3; } -.cm-s-ambiance .cm-variable { color: #ffb795; } -.cm-s-ambiance .cm-variable-2 { color: #eed1b3; } -.cm-s-ambiance .cm-variable-3 { color: #faded3; } -.cm-s-ambiance .cm-property { color: #eed1b3; } -.cm-s-ambiance .cm-operator {color: #fa8d6a;} -.cm-s-ambiance .cm-comment { color: #555; font-style:italic; } -.cm-s-ambiance .cm-string { color: #8f9d6a; } -.cm-s-ambiance .cm-string-2 { color: #9d937c; } -.cm-s-ambiance .cm-meta { color: #D2A8A1; } -.cm-s-ambiance .cm-qualifier { color: yellow; } -.cm-s-ambiance .cm-builtin { color: #9999cc; } -.cm-s-ambiance .cm-bracket { color: #24C2C7; } -.cm-s-ambiance .cm-tag { color: #fee4ff } -.cm-s-ambiance .cm-attribute { color: #9B859D; } -.cm-s-ambiance .cm-header {color: blue;} -.cm-s-ambiance .cm-quote { color: #24C2C7; } -.cm-s-ambiance .cm-hr { color: pink; } -.cm-s-ambiance .cm-link { color: #F4C20B; } -.cm-s-ambiance .cm-special { color: #FF9D00; } -.cm-s-ambiance .cm-error { color: #AF2018; } - -.cm-s-ambiance .CodeMirror-matchingbracket { color: #0f0; } -.cm-s-ambiance .CodeMirror-nonmatchingbracket { color: #f22; } - -.cm-s-ambiance .CodeMirror-selected { background: rgba(255, 255, 255, 0.15); } -.cm-s-ambiance.CodeMirror-focused .CodeMirror-selected { background: rgba(255, 255, 255, 0.10); } -.cm-s-ambiance.CodeMirror ::selection { background: rgba(255, 255, 255, 0.10); } -.cm-s-ambiance.CodeMirror ::-moz-selection { background: rgba(255, 255, 255, 0.10); } +.cm-s-ambiance .cm-keyword { + color: #cda869; +} + +.cm-s-ambiance .cm-atom { + color: #CF7EA9; +} + +.cm-s-ambiance .cm-number { + color: #78CF8A; +} + +.cm-s-ambiance .cm-def { + color: #aac6e3; +} + +.cm-s-ambiance .cm-variable { + color: #ffb795; +} + +.cm-s-ambiance .cm-variable-2 { + color: #eed1b3; +} + +.cm-s-ambiance .cm-variable-3 { + color: #faded3; +} + +.cm-s-ambiance .cm-property { + color: #eed1b3; +} + +.cm-s-ambiance .cm-operator { + color: #fa8d6a; +} + +.cm-s-ambiance .cm-comment { + color: #555; + font-style: italic; +} + +.cm-s-ambiance .cm-string { + color: #8f9d6a; +} + +.cm-s-ambiance .cm-string-2 { + color: #9d937c; +} + +.cm-s-ambiance .cm-meta { + color: #D2A8A1; +} + +.cm-s-ambiance .cm-qualifier { + color: yellow; +} + +.cm-s-ambiance .cm-builtin { + color: #9999cc; +} + +.cm-s-ambiance .cm-bracket { + color: #24C2C7; +} + +.cm-s-ambiance .cm-tag { + color: #fee4ff +} + +.cm-s-ambiance .cm-attribute { + color: #9B859D; +} + +.cm-s-ambiance .cm-header { + color: blue; +} + +.cm-s-ambiance .cm-quote { + color: #24C2C7; +} + +.cm-s-ambiance .cm-hr { + color: pink; +} + +.cm-s-ambiance .cm-link { + color: #F4C20B; +} + +.cm-s-ambiance .cm-special { + color: #FF9D00; +} + +.cm-s-ambiance .cm-error { + color: #AF2018; +} + +.cm-s-ambiance .CodeMirror-matchingbracket { + color: #0f0; +} + +.cm-s-ambiance .CodeMirror-nonmatchingbracket { + color: #f22; +} + +.cm-s-ambiance .CodeMirror-selected { + background: rgba(255, 255, 255, 0.15); +} + +.cm-s-ambiance.CodeMirror-focused .CodeMirror-selected { + background: rgba(255, 255, 255, 0.10); +} + +.cm-s-ambiance.CodeMirror ::selection { + background: rgba(255, 255, 255, 0.10); +} + +.cm-s-ambiance.CodeMirror ::-moz-selection { + background: rgba(255, 255, 255, 0.10); +} /* Editor styling */ .cm-s-ambiance.CodeMirror { - line-height: 1.40em; - color: #E6E1DC; - background-color: #202020; - -webkit-box-shadow: inset 0 0 10px black; - -moz-box-shadow: inset 0 0 10px black; - box-shadow: inset 0 0 10px black; + line-height: 1.40em; + color: #E6E1DC; + background-color: #202020; + -webkit-box-shadow: inset 0 0 10px black; + -moz-box-shadow: inset 0 0 10px black; + box-shadow: inset 0 0 10px black; } .cm-s-ambiance .CodeMirror-gutters { - background: #3D3D3D; - border-right: 1px solid #4D4D4D; - box-shadow: 0 10px 20px black; + background: #3D3D3D; + border-right: 1px solid #4D4D4D; + box-shadow: 0 10px 20px black; } .cm-s-ambiance .CodeMirror-linenumber { - text-shadow: 0px 1px 1px #4d4d4d; - color: #111; - padding: 0 5px; + text-shadow: 0px 1px 1px #4d4d4d; + color: #111; + padding: 0 5px; } -.cm-s-ambiance .CodeMirror-guttermarker { color: #aaa; } -.cm-s-ambiance .CodeMirror-guttermarker-subtle { color: #111; } +.cm-s-ambiance .CodeMirror-guttermarker { + color: #aaa; +} + +.cm-s-ambiance .CodeMirror-guttermarker-subtle { + color: #111; +} .cm-s-ambiance .CodeMirror-lines .CodeMirror-cursor { - border-left: 1px solid #7991E8; + border-left: 1px solid #7991E8; } .cm-s-ambiance .CodeMirror-activeline-background { - background: none repeat scroll 0% 0% rgba(255, 255, 255, 0.031); + background: none repeat scroll 0% 0% rgba(255, 255, 255, 0.031); } .cm-s-ambiance.CodeMirror, .cm-s-ambiance .CodeMirror-gutters { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAQAAAAHUWYVAABFFUlEQVQYGbzBCeDVU/74/6fj9HIcx/FRHx9JCFmzMyGRURhLZIkUsoeRfUjS2FNDtr6WkMhO9sm+S8maJfu+Jcsg+/o/c+Z4z/t97/vezy3z+z8ekGlnYICG/o7gdk+wmSHZ1z4pJItqapjoKXWahm8NmV6eOTbWUOp6/6a/XIg6GQqmenJ2lDHyvCFZ2cBDbmtHA043VFhHwXxClWmeYAdLhV00Bd85go8VmaFCkbVkzlQENzfBDZ5gtN7HwF0KDrTwJ0dypSOzpaKCMwQHKTIreYIxlmhXTzTWkVm+LTynZhiSBT3RZQ7aGfjGEd3qyXQ1FDymqbKxpspERQN2MiRjNZlFFQXfCNFm9nM1zpAsoYjmtRTc5ajwuaXc5xrWskT97RaKzAGe5ARHhVUsDbjKklziiX5WROcJwSNCNI+9w1Jwv4Zb2r7lCMZ4oq5C0EdTx+2GzNuKpJ+iFf38JEWkHJn9DNF7mmBDITrWEg0VWL3pHU20tSZnuqWu+R3BtYa8XxV1HO7GyD32UkOpL/yDloINFTmvtId+nmAjxRw40VMwVKiwrKLE4bK5UOVntYwhOcSSXKrJHKPJedocpGjVz/ZMIbnYUPB10/eKCrs5apqpgVmWzBYWpmtKHecJPjaUuEgRDDaU0oZghCJ6zNMQ5ZhDYx05r5v2muQdM0EILtXUsaKiQX9WMEUotagQzFbUNN6NUPC2nm5pxEWGCjMc3GdJHjSU2kORLK/JGSrkfGEIjncU/CYUnOipoYemwj8tST9NsJmB7TUVXtbUtXATJVZXBMvYeTXJfobgJUPmGMP/yFaWonaa6BcFO3nqcIqCozSZoZoSr1g4zJOzuyGnxTEX3lUEJ7WcZgme8ddaWvWJo2AJR9DZU3CUIbhCSG6ybSwN6qtJVnCU2svDTP2ZInOw2cBTrqtQahtNZn9NcJ4l2NaSmSkkP1noZWnVwkLmdUPOwLZEwy2Z3S3R+4rIG9hcbpPXHFVWcQdZkn2FOta3cKWQnNRC5g1LsJah4GCzSVsKnCOY5OAFRTBekyyryeyilhFKva75r4Mc0aWanGEaThcy31s439KKxTzJYY5WTHPU1FtIHjQU3Oip4xlNzj/lBw23dYZVliQa7WAXf4shetcQfatI+jWRDBPmyNeW6A1P5kdDgyYJlba0BIM8BZu1JfrFwItyjcAMR3K0BWOIrtMEXyhyrlVEx3ui5dUBjmB/Q3CXW85R4mBD0s7B+4q5tKUjOlb9qqmhi5AZ6GFIC5HXtOobdYGlVdMVbNJ8toNTFcHxnoL+muBagcctjWnbNMuR00uI7nQESwg5q2qqrKWIfrNUmeQocY6HuyxJV02wj36w00yhpmUFenv4p6fUkZYqLyuinx2RGOjhCXYyJF84oiU00YMOOhhquNdfbOB7gU88pY4xJO8LVdp6/q2voeB4R04vIdhSE40xZObx1HGGJ/ja0LBthFInKaLPPFzuCaYaoj8JjPME8yoyxo6zlBqkiUZYgq00OYMswbWO5NGmq+xhipxHLRW29ARjNKXO0wRnear8XSg4XFPLKEPUS1GqvyLwiuBUoa7zpZ0l5xxFwWmWZC1H5h5FwU8eQ7K+g8UcVY6TMQreVQT/8uQ8Z+ALIXnSEa2pYZQneE9RZbSBNYXfWYJzW/h/4j4Dp1tYVcFIC5019Vyi4ThPqSFCzjGWaHQTBU8q6vrVwgxP9Lkm840imWKpcLCjYTtrKuwvsKSnrvHCXGkSMk9p6lhckfRpIeis+N2PiszT+mFLspyGleUhDwcLrZqmyeylxwjBcKHEapqkmyangyLZRVOijwOtCY5SsG5zL0OwlCJ4y5KznF3EUNDDrinwiyLZRzOXtlBbK5ITHFGLp8Q0R6ab6mS7enI2cFrxOyHvOCFaT1HThS1krjCwqWeurCkk+willhCC+RSZnRXBiZaC5RXRIZYKp2lyfrHwiKPKR0JDzrdU2EFgpidawlFDR6FgXUMNa+g1FY3bUQh2cLCwosRdnuQTS/S+JVrGLeWIvtQUvONJxlqSQYYKpwoN2kaocLjdVsis4Mk80ESF2YpSkzwldjHkjFCUutI/r+EHDU8oCs6yzL3PhWiEooZdFMkymlas4AcI3KmoMMNSQ3tHzjGWCrcJJdYyZC7QFGwjRL9p+MrRkAGWzIaWCn9W0F3TsK01c2ZvQw0byvxuQU0r1lM0qJO7wW0kRIMdDTtXEdzi4VIh+EoIHm0mWtAtpCixlabgn83fKTI7anJe9ST7WIK1DMGpQmYeA58ImV6ezOGOzK2Kgq01pd60cKWiUi9Lievb/0vIDPHQ05Kzt4ddPckQBQtoaurjyHnek/nKzpQLrVgKPjIkh2v4uyezpv+Xoo7fPFXaGFp1vaLKxQ4uUpQQS5VuQs7BCq4xRJv7fwpVvvFEB3j+620haOuocqMhWd6TTPAEx+mdFNGHdranFe95WrWmIvlY4F1Dle2ECgc6cto7SryuqGGGha0tFQ5V53migUKmg6XKAo4qS3mik+0OZpAhOLeZKicacgaYcyx5hypYQE02ZA4xi/pNhOQxR4klNKyqacj+mpxnLTnnGSo85++3ZCZq6lrZkXlGEX3o+C9FieccJbZWVFjC0Yo1FZnJhoYMFoI1hEZ9r6hwg75HwzBNhbZCdJEfJwTPGzJvaKImw1yYX1HDAmpXR+ZJQ/SmgqMNVQb5vgamGwLtt7VwvP7Qk1xpiM5x5Cyv93E06MZmgs0Nya2azIKOYKCGBQQW97RmhKNKF02JZqHEJ4o58qp7X5EcZmc56trXEqzjCBZ1MFGR87Ql2tSTs6CGxS05PTzRQorkbw7aKoKXFDXsYW42VJih/q+FP2BdTzDTwVqOYB13liM50vG7wy28qagyuIXMeQI/Oqq8bcn5wJI50xH00CRntyfpL1T4hydYpoXgNiFzoIUTDZnLNRzh4TBHwbYGDvZkxmlyJloyr6tRihpeUG94GnKtIznREF0tzJG/OOr73JBcrSh1k6WuTprgLU+mnSGnv6Zge0NNz+kTDdH8nuAuTdJDCNb21LCiIuqlYbqGzT3RAoZofQfjFazkqeNWdYaGvYTM001EW2oKPvVk1ldUGSgUtHFwjKM1h9jnFcmy5lChoLNaQMGGDsYbKixlaMBmmsx1QjCfflwTfO/gckW0ruZ3jugKR3R5W9hGUWqCgxuFgsuaCHorotGKzGaeZB9DMsaTnKCpMtwTvOzhYk0rdrArKCqcaWmVk1+F372ur1YkKxgatI8Qfe1gIX9wE9FgS8ESmuABIXnRUbCapcKe+nO7slClSZFzpV/LkLncEb1qiO42fS3R855Su2mCLh62t1SYZZYVmKwIHjREF2uihTzB20JOkz7dkxzYQnK0UOU494wh+VWRc6Un2kpTaVgLDFEkJ/uhzRcI0YKGgpGWOlocBU/a4fKoJ/pEaNV6jip3+Es9VXY078rGnmAdf7t9ylPXS34RBSuYPs1UecZTU78WanhBCHpZ5sAoTz0LGZKjPf9TRypqWEiTvOFglL1fCEY3wY/++rbk7C8bWebA6p6om6PgOL2kp44TFJlVNBXae2rqqdZztOJpT87GQsE9jqCPIe9VReZuQ/CIgacsyZdCpIScSYqcZk8r+nsyCzhyfhOqHGOIvrLknC8wTpFcaYiGC/RU1NRbUeUpocQOnkRpGOrIOcNRx+1uA0UrzhSSt+VyS3SJpnFWkzNDqOFGIWcfR86DnmARTQ1HKIL33ExPiemeOhYSSjzlSUZZuE4TveoJLnBUOFof6KiysCbnAEcZgcUNTDOwkqWu3RWtmGpZwlHhJENdZ3miGz0lJlsKnjbwqSHQjpxnFDlTLLwqJPMZMjd7KrzkSG7VsxXBZE+F8YZkb01Oe00yyRK9psh5SYh29ySPKBo2ylNht7ZkZnsKenjKNJu9PNEyZpaCHv4Kt6RQsLvAVp7M9kIimmCUwGeWqLMmGuIotYMmWNpSahkhZw9FqZsVnKJhsjAHvtHMsTM9fCI06Dx/u3vfUXCqfsKRc4oFY2jMsoo/7DJDwZ1CsIKnJu+J9ldkpmiCxQx1rWjI+T9FwcWWzOuaYH0Hj7klNRVWEQpmaqosakiGNTFHdjS/qnUdmf0NJW5xsL0HhimCCZZSRzmSPTXJQ4aaztAwtZnoabebJ+htCaZ7Cm535ByoqXKbX1WRc4Eh2MkRXWzImVc96Cj4VdOKVxR84VdQsIUM8Psoou2byVHyZFuq7O8otbSQ2UAoeEWTudATLGSpZzVLlXVkPU2Jc+27lsw2jmg5T5VhbeE3BT083K9WsTTkFU/Osi0rC5lRlpwRHUiesNS0sOvmqGML1aRbPAxTJD9ZKtxuob+hhl8cwYGWpJ8nub7t5p6coYbMovZ1BTdaKn1jYD6h4GFDNFyT/Kqe1XCXphXHOKLZmuRSRdBPEfVUXQzJm5YGPGGJdvAEr7hHNdGZnuBvrpciGmopOLf5N0uVMy0FfYToJk90uUCbJupaVpO53UJXR2bVpoU00V2KOo4zMFrBd0Jtz2pa0clT5Q5L8IpQ177mWQejPMEJhuQjS10ref6HHjdEhy1P1EYR7GtO0uSsKJQYLiTnG1rVScj5lyazpqWGl5uBbRWl7m6ixGOOnEsMJR7z8J0n6KMnCdxhiNYQCoZ6CmYLnO8omC3MkW3bktlPmEt/VQQHejL3+dOE5FlPdK/Mq8hZxxJtLyRrepLThYKbLZxkSb5W52vYxNOaOxUF0yxMUPwBTYqCzy01XayYK0sJyWBLqX0MwU5CzoymRzV0EjjeUeLgDpTo6ij42ZAzvD01dHUUTPLU96MdLbBME8nFBn7zJCMtJcZokn8YoqU0FS5WFKyniHobguMcmW8N0XkWZjkyN3hqOMtS08r+/xTBwpZSZ3qiVRX8SzMHHjfUNFjgHEPmY9PL3ykEzxkSre/1ZD6z/NuznuB0RcE1TWTm9zRgfUWVJiG6yrzgmWPXC8EAR4Wxhlad0ZbgQyEz3pG5RVEwwDJH2mgKpjcTiCOzn1lfUWANFbZ2BA8balnEweJC9J0iuaeZoI+ippFCztEKVvckR2iice1JvhVytrQwUAZpgsubCPaU7xUe9vWnaOpaSBEspalykhC9bUlOMpT42ZHca6hyrqKmw/wMR8H5ZmdFoBVJb03O4UL0tSNnvIeRmkrLWqrs78gcrEn2tpcboh0UPOW3UUR9PMk4T4nnNKWmCjlrefhCwxRNztfmIQVdDElvS4m1/WuOujoZCs5XVOjtKPGokJzsYCtFYoWonSPT21DheU/wWhM19FcElwqNGOsp9Q8N/cwXaiND1MmeL1Q5XROtYYgGeFq1aTMsoMmcrKjQrOFQTQ1fmBYhmW6o8Jkjc7iDJRTBIo5kgJD5yMEYA3srCg7VFKwiVJkmRCc5ohGOKhsYMn/XBLdo5taZjlb9YAlGWRimqbCsoY7HFAXLa5I1HPRxMMsQDHFkWtRNniqT9UEeNjcE7RUlrCJ4R2CSJuqlKHWvJXjAUNcITYkenuBRB84TbeepcqTj3zZyFJzgYQdHnqfgI0ddUwS6GqWpsKWhjq9cV0vBAEMN2znq+EBfIWT+pClYw5xsTlJU6GeIBsjGmmANTzJZiIYpgrM0Oa8ZMjd7NP87jxhqGOhJlnQtjuQpB+8aEE00wZFznSJPyHxgH3HkPOsJFvYk8zqCHzTs1BYOa4J3PFU+UVRZxlHDM4YavlNUuMoRveiZA2d7grMNc2g+RbSCEKzmgYsUmWmazFJyoiOZ4KnyhKOGRzWJa0+moyV4TVHDzn51Awtqaphfk/lRQ08FX1iiqxTB/kLwd0VynKfEvI6cd4XMV5bMhZ7gZUWVzYQ6Nm2BYzxJbw3bGthEUUMfgbGeorae6DxHtJoZ6alhZ0+ytiVoK1R4z5PTrOECT/SugseEOlb1MMNR4VRNcJy+V1Hg9ONClSZFZjdHlc6W6FBLdJja2MC5hhpu0DBYEY1TFGwiFAxRRCsYkiM9JRb0JNMVkW6CZYT/2EiTGWmo8k+h4FhDNE7BvppoTSFnmCV5xZKzvcCdDo7VVPnIU+I+Rc68juApC90MwcFCsJ5hDqxgScYKreruyQwTqrzoqDCmhWi4IbhB0Yrt3RGa6GfDv52rKXWhh28dyZaWUvcZeMTBaZoSGyiCtRU5J8iviioHaErs7Jkj61syVzTTgOcUOQ8buFBTYWdL5g3T4qlpe0+wvD63heAXRfCCIed9RbCsp2CiI7raUOYOTU13N8PNHvpaGvayo4a3LLT1lDrVEPT2zLUlheB1R+ZTRfKWJ+dcocLJfi11vyJ51lLqJ0WD7tRwryezjiV5W28uJO9qykzX8JDe2lHl/9oyBwa2UMfOngpXCixvKdXTk3wrsKmiVYdZIqsoWEERjbcUNDuiaQomGoIbFdEHmsyWnuR+IeriKDVLnlawlyNHKwKlSU631PKep8J4Q+ayjkSLKYLhalNHlYvttb6fHm0p6OApsZ4l2VfdqZkjuysy6ysKLlckf1KUutCTs39bmCgEyyoasIWlVaMF7mgmWtBT8Kol5xpH9IGllo8cJdopcvZ2sImlDmMIbtDk3KIpeNiS08lQw11NFPTwVFlPP6pJ2gvRfI7gQUfmNAtf6Gs0wQxDsKGlVBdF8rCa3jzdwMaGHOsItrZk7hAyOzpK9VS06j5F49b0VNGOOfKs3lDToMsMBe9ZWtHFEgxTJLs7qrygKZjUnmCYoeAqeU6jqWuLJup4WghOdvCYJnrSkSzoyRkm5M2StQwVltPkfCAk58tET/CSg+8MUecmotMEnhBKfWBIZsg2ihruMJQaoIm+tkTLKEqspMh00w95gvFCQRtDwTT1gVDDSEVdlwqZfxoQRbK0g+tbiBZxzKlpnpypejdDwTaeOvorMk/IJE10h9CqRe28hhLbe0pMsdSwv4ZbhKivo2BjDWfL8UKJgeavwlwb5KlwhyE4u4XkGE2ytZCznKLCDZZq42VzT8HLCrpruFbIfOIINmh/qCdZ1ZBc65kLHR1Bkyf5zn6pN3SvGKIlFNGplhrO9QSXanLOMQTLCa0YJCRrCZm/CZmrLTm7WzCK4GJDiWUdFeYx1LCFg3NMd0XmCuF3Y5rITLDUsYS9zoHVzwnJoYpSTQoObyEzr4cFBNqYTopoaU/wkyLZ2lPhX/5Y95ulxGTV7KjhWrOZgl8MyUUafjYraNjNU1N3IWcjT5WzWqjwtoarHSUObGYO3GCJZpsBlnJGPd6ZYLyl1GdCA2625IwwJDP8GUKymbzuyPlZlvTUsaUh5zFDhRWFzPKKZLAlWdcQbObgF9tOqOsmB1dqcqYJmWstFbZRRI9poolmqiLnU0POvxScpah2iSL5UJNzgScY5+AuIbpO0YD3NCW+dLMszFSdFCWGqG6eVq2uYVNDdICGD6W7EPRWZEY5gpsE9rUkS3mijzzJnm6UpUFXG1hCUeVoS5WfNcFpblELL2qqrCvMvRfd45oalvKU2tiQ6ePJOVMRXase9iTtLJztPxJKLWpo2CRDcJwn2sWSLKIO1WQWNTCvpVUvOZhgSC40JD0dOctaSqzkCRbXsKlb11Oip6PCJ0IwSJM31j3akRxlP7Rwn6aGaUL0qiLnJkvB3xWZ2+Q1TfCwpQH3G0o92UzmX4o/oJNQMMSQc547wVHhdk+VCw01DFYEnTxzZKAm74QmeNNR1w6WzEhNK15VJzuCdxQ53dRUDws5KvwgBMOEgpcVNe0hZI6RXT1Jd0cyj5nsaEAHgVmGaJIlWdsc5Ui2ElrRR6jrRAttNMEAIWrTDFubkZaok7/AkzfIwfuWVq0jHzuCK4QabtLUMVPB3kJ0oyHTSVFlqMALilJf2Rf8k5aaHtMfayocLBS8L89oKoxpJvnAkDPa0qp5DAUTHKWmCcnthlou8iCKaFFLHWcINd1nyIwXqrSxMNmSs6KmoL2QrKuWtlQ5V0120xQ5vRyZS1rgFkWwhiOwiuQbR0OOVhQM9iS3tiXp4RawRPMp5tDletOOBL95MpM01dZTBM9pkn5qF010rIeHFcFZhmSGpYpTsI6nwhqe5C9ynhlpp5ophuRb6WcJFldkVnVEwwxVfrVkvnWUuNLCg5bgboFHPDlDPDmnK7hUrWiIbjadDclujlZcaokOFup4Ri1kacV6jmrrK1hN9bGwpKEBQ4Q6DvIUXOmo6U5LqQM6EPyiKNjVkPnJkDPNEaxhiFay5ExW1NXVUGqcpYYdPcGiCq7z/TSlbhL4pplWXKd7NZO5QQFrefhRQW/NHOsqcIglc4UhWklR8K0QzbAw08CBDnpbgqXdeD/QUsM4RZXDFBW6WJKe/mFPdH0LtBgiq57wFLzlyQzz82qYx5D5WJP5yVJDW01BfyHnS6HKO/reZqId1WGa4Hkh2kWodJ8i6KoIPlAj2hPt76CzXsVR6koPRzWTfKqIentatYpQw2me4AA3y1Kind3SwoOKZDcFXTwl9tWU6mfgRk9d71sKtlNwrjnYw5tC5n5LdKiGry3JKNlHEd3oaMCFHrazBPMp/uNJ+V7IudcSbeOIdjUEdwl0VHCOZo5t6YluEuaC9mQeMgSfOyKnYGFHcIeQ84yQWbuJYJpZw5CzglDH7gKnWqqM9ZTaXcN0TeYhR84eQtJT76JJ1lREe7WnnvsMmRc9FQ7SBBM9mV3lCUdmHk/S2RAMt0QjFNFqQpWjDPQ01DXWUdDBkXziKPjGEP3VP+zIWU2t7im41FOloyWzn/L6dkUy3VLDaZ6appgDLHPjJEsyvJngWEPUyVBiAaHCTEXwrLvSEbV1e1gKJniicWorC1MUrVjB3uDhJE/wgSOzk1DXpk0k73qCM8xw2UvD5kJmDUfOomqMpWCkJRlvKXGmoeBm18USjVIk04SClxTB6YrgLAPLWYK9HLUt5cmc0vYES8GnTeRc6skZbQkWdxRsIcyBRzx1DbTk9FbU0caTPOgJHhJKnOGIVhQqvKmo0llRw9sabrZkDtdg3PqaKi9oatjY8B+G371paMg6+mZFNNtQ04mWBq3rYLOmtWWQp8KJnpy9DdFensyjdqZ+yY40VJlH8wcdLzC8PZnvHMFUTZUrDTkLyQaGus5X5LzpYAf3i+e/ZlhqGqWhh6Ou6xTR9Z6oi5AZZtp7Mj2EEm8oSpxiYZCHU/1fbGdNNNRRoZMhmilEb2gqHOEJDtXkHK/JnG6IrvbPCwV3NhONVdS1thBMs1T4QOBcTWa2IzhMk2nW5Kyn9tXUtpv9RsG2msxk+ZsQzRQacJncpgke0+T8y5Fzj8BiGo7XlJjaTIlpQs7KFjpqGnKuoyEPeIKnFMkZHvopgh81ySxNFWvJWcKRs70j2FOT012IllEEO1n4pD1513Yg2ssQPOThOkvyrqHUdEXOSEsihmBbTbKX1kLBPWqWkLOqJbjB3GBIZmoa8qWl4CG/iZ7oiA72ZL7TJNeZUY7kFQftDcHHluBzRbCegzMtrRjVQpX2lgoPKKLJAkcbMl01XK2p7yhL8pCBbQ3BN2avJgKvttcrWDK3CiUOVxQ8ZP+pqXKyIxnmBymCg5vJjNfkPK4+c8cIfK8ocVt7kmfd/I5SR1hKvCzUtb+lhgc00ZaO6CyhIQP1Uv4yIZjload72PXX0OIJvnFU+0Zf6MhsJwTfW0r0UwQfW4LNLZl5HK261JCZ4qnBaAreVAS3WrjV0LBnNDUNNDToCEeFfwgcb4gOEqLRhirWkexrCEYKVV711DLYEE1XBEsp5tpTGjorkomKYF9FDXv7fR3BGwbettSxnyL53MBPjsxDZjMh+VUW9NRxq1DhVk+FSxQcaGjV9Pawv6eGByw5qzoy7xk4RsOShqjJwWKe/1pEEfzkobeD/dQJmpqedcyBTy2sr4nGNRH0c0SPWTLrqAc0OQcb/gemKgqucQT7ySWKCn2EUotoCvpZct7RO2sy/QW0IWcXd7pQRQyZVwT2USRO87uhjioTLKV2brpMUcMQRbKH/N2T+UlTpaMls6cmc6CCNy3JdYYSUzzJQ4oSD3oKLncULOiJvjBEC2oqnCJkJluCYy2ZQ5so9YYlZ1VLlQU1mXEW1jZERwj/MUSRc24TdexlqLKfQBtDTScJUV8FszXBEY5ktpD5Ur9hYB4Nb1iikw3JoYpkKX+RodRKFt53MMuRnKSpY31PwYaGaILh3wxJGz9TkTPEETxoCWZrgvOlmyMzxFEwVJE5xZKzvyJ4WxEc16Gd4Xe3Weq4XH2jKRikqOkGQ87hQnC7wBmGYLAnesX3M+S87eFATauuN+Qcrh7xIxXJbUIdMw3JGE3ylCWzrieaqCn4zhGM19TQ3z1oH1AX+pWEqIc7wNGAkULBo/ZxRaV9NNyh4Br3rCHZzbzmSfawBL0dNRwpW1kK9mxPXR9povcdrGSZK9c2k0xwFGzjuniCtRSZCZ6ccZ7gaktmgAOtKbG/JnOkJrjcQTdFMsxRQ2cLY3WTIrlCw1eWKn8R6pvt4GFDso3QoL4a3nLk3G6JrtME3dSenpx7PNFTmga0EaJTLQ061sEeQoWXhSo9LTXsaSjoJQRXeZLtDclbCrYzfzHHeaKjHCVOUkQHO3JeEepr56mhiyaYYKjjNU+Fed1wS5VlhWSqI/hYUdDOkaxiKehoyOnrCV5yBHtbWFqTHCCwtpDcYolesVR5yUzTZBb3RNMd0d6WP+SvhuBmRcGxnuQzT95IC285cr41cLGQ6aJJhmi4TMGempxeimBRQw1tFKV+8jd6KuzoSTqqDxzRtpZkurvKEHxlqXKRIjjfUNNXQsNOsRScoWFLT+YeRZVD3GRN0MdQcKqQjHDMrdGGVu3iYJpQx3WGUvfbmxwFfR20WBq0oYY7LMFhhgYtr8jpaEnaOzjawWWaTP8mMr0t/EPDPoqcnxTBI5o58L7uoWnMrpoqPwgVrlAUWE+V+TQl9rawoyP6QGAlQw2TPRX+YSkxyBC8Z6jhHkXBgQL7WII3DVFnRfCrBfxewv9D6xsyjys4VkhWb9pUU627JllV0YDNHMku/ldNMMXDEo4aFnAkk4U6frNEU4XgZUPmEKHUl44KrzmYamjAbh0JFvGnaTLPu1s9jPCwjFpYiN7z1DTOk/nc07CfDFzmCf7i+bfNHXhDtLeBXzTBT5rkMvWOIxpl4EMh2LGJBu2syDnAEx2naEhHDWMMzPZEhygyS1mS5RTJr5ZkoKbEUoYqr2kqdDUE8ztK7OaIntJkFrIECwv8LJTaVx5XJE86go8dFeZ3FN3rjabCAYpoYEeC9zzJVULBbmZhDyd7ko09ydpNZ3nm2Kee4FPPXHnYEF1nqOFEC08LUVcDvYXkJHW8gTaKCk9YGOeIJhqiE4ToPEepdp7IWFjdwnWaufGMwJJCMtUTTBBK9BGCOy2tGGrJTHIwyEOzp6aPzNMOtlZkDvcEWpP5SVNhfkvDxhmSazTJXYrM9U1E0xwFVwqZQwzJxw6+kGGGUj2FglGGmnb1/G51udRSMNlTw6GGnCcUwVcOpmsqTHa06o72sw1RL02p9z0VbnMLOaIX3QKaYKSCFQzBKEUNHTSc48k53RH9wxGMtpQa5KjjW0W0n6XCCCG4yxNNdhQ4R4l1Ff+2sSd6UFHiIEOyqqFgT01mEUMD+joy75jPhOA+oVVLm309FR4yVOlp4RhLiScNmSmaYF5Pw0STrOIoWMSR2UkRXOMp+M4SHW8o8Zoi6OZgjKOaFar8zZDzkWzvKOjkKBjmCXby8JahhjXULY4KlzgKLvAwxVGhvyd4zxB1d9T0piazmKLCVZY5sKiD0y2ZSYrkUEPUbIk+dlQ4SJHTR50k1DPaUWIdTZW9NJwnJMOECgd7ou/MnppMJ02O1VT4Wsh85MnZzcFTngpXGKo84qmwgKbCL/orR/SzJ2crA+t6Mp94KvxJUeIbT3CQu1uIdlQEOzlKfS3UMcrTiFmOuroocrZrT2AcmamOKg8YomeEKm/rlT2sociMaybaUlFhuqHCM2qIJ+rg4EcDFymiDSxzaHdPcpE62pD5kyM5SBMoA1PaUtfIthS85ig1VPiPPYXgYEMNk4Qq7TXBgo7oT57gPUdwgCHzhIVFPFU6OYJzHAX9m5oNrVjeE61miDrqQ4VSa1oiURTsKHC0IfjNwU2WzK6eqK8jWln4g15TVBnqmDteCJ501PGAocJhhqjZdtBEB6lnhLreFJKxmlKbeGrqLiSThVIbCdGzloasa6lpMQXHCME2boLpJgT7yWaemu6wBONbqGNVRS0PKIL7LckbjmQtR7K8I5qtqel+T/ChJTNIKLjdUMNIRyvOEko9YYl2cwQveBikCNawJKcLBbc7+JM92mysNvd/Fqp8a0k6CNEe7cnZrxlW0wQXaXjaktnRwNOGZKYiONwS7a1JVheq3WgJHlQUGKHKmp4KAxXR/ULURcNgoa4zhKSLpZR3kxRRb0NmD0OFn+UCS7CzI1nbP6+o4x47QZE5xRCt3ZagnYcvmpYQktXdk5YKXTzBC57kKEe0VVuiSYqapssMS3C9p2CKkHOg8B8Pa8p5atrIw3qezIWanMGa5HRDNF6RM9wcacl0N+Q8Z8hsIkSnaIIdHRUOEebAPy1zbCkhM062FCJtif7PU+UtoVXzWKqM1PxXO8cfdruhFQ/a6x3JKYagvVDhQEtNiyiiSQ7OsuRsZUku0CRNDs4Sog6KKjsZgk2bYJqijgsEenoKeniinRXBn/U3lgpPdyDZynQx8IiioMnCep5Ky8mjGs6Wty0l1hUQTcNWswS3WRp2kCNZwJG8omG8JphPUaFbC8lEfabwP7VtM9yoaNCAjpR41VNhrD9LkbN722v0CoZMByFzhaW+MyzRYEWFDQwN2M4/JiT76PuljT3VU/A36eaIThb+R9oZGOAJ9tewkgGvqOMNRWYjT/Cwu99Q8LqDE4TgbLWxJ1jaDDAERsFOFrobgjUsBScaguXU8kKm2RL19tRypSHnHNlHiIZqgufs4opgQdVdwxBNNFBR6kVFqb8ogimOzB6a6HTzrlDHEpYaxjiiA4TMQobkDg2vejjfwJGWmnbVFAw3H3hq2NyQfG7hz4aC+w3BbwbesG0swYayvpAs6++Ri1Vfzx93mFChvyN5xVHTS+0p9aqCAxyZ6ZacZyw5+7uuQkFPR9DDk9NOiE7X1PCYJVjVUqq7JlrHwWALF5nfHNGjApdpqgzx5OwilDhCiDYTgnc9waGW4BdLNNUQvOtpzDOWHDH8D7TR/A/85KljEQu3NREc4Pl/6B1Hhc8Umb5CsKMmGC9EPcxoT2amwHNCmeOEnOPbklnMkbOgIvO5UMOpQrS9UGVdt6iH/fURjhI/WOpaW9OKLYRod6HCUEdOX000wpDZQ6hwg6LgZfOqo1RfT/CrJzjekXOGhpc1VW71ZLbXyyp+93ILbC1kPtIEYx0FIx1VDrLoVzXRKRYWk809yYlC9ImcrinxtabKnzRJk3lAU1OLEN1j2zrYzr2myHRXJFf4h4QKT1qSTzTB5+ZNTzTRkAxX8FcLV2uS8eoQQ2aAkFzvCM72sJIcJET3WPjRk5wi32uSS9rfZajpWEvj9hW42F4o5NytSXYy8IKHay10VYdrcl4SkqscrXpMwyGOgtkajheSxdQqmpxP1L3t4R5PqasFnrQEjytq6qgp9Y09Qx9o4S1FzhUCn1kyHSzBWLemoSGvOqLNhZyBjmCaAUYpMgt4Ck7wBBMMwWKWgjsUwTaGVsxWC1mYoKiyqqeGKYqonSIRQ3KIkHO0pmAxTdBHkbOvfllfr+AA+7gnc50huVKYK393FOyg7rbPO/izI7hE4CnHHHnJ0ogNPRUGeUpsrZZTBJcrovUcJe51BPsr6GkJdhCCsZ6aTtMEb2pqWkqeVtDXE/QVggsU/Nl86d9RMF3DxvZTA58agu810RWawCiSzzXBeU3MMW9oyJUedvNEvQyNu1f10BSMddR1vaLCYpYa/mGocLSiYDcLbQz8aMn5iyF4xBNMs1P0QEOV7o5gaWGuzSeLue4tt3ro7y4Tgm4G/mopdZgl6q0o6KzJWE3mMksNr3r+a6CbT8g5wZNzT9O7fi/zpaOmnz3BRoqos+tv9zMbdpxsqDBOEewtJLt7cg5wtKKbvldpSzRRCD43VFheCI7yZLppggMVBS/KMAdHODJvOwq2NQSbKKKPLdFWQs7Fqo+mpl01JXYRgq8dnGLhTiFzqmWsUMdpllZdbKlyvSdYxhI9YghOtxR8LgSLWHK62mGGVoxzBE8LNWzqH9CUesQzFy5RQzTc56mhi6fgXEWwpKfE5Z7M05ZgZUPmo6auiv8YKzDYwWBLMErIbKHJvOwIrvEdhOBcQ9JdU1NHQ7CXn2XIDFBKU2WAgcX9UAUzDXWd5alwuyJ41Z9rjKLCL4aCp4WarhPm2rH+SaHUYE001JDZ2ZAzXPjdMpZWvC9wmqIB2lLhQ01D5jO06hghWMndbM7yRJMsoCj1vYbnFQVrW9jak3OlEJ3s/96+p33dEPRV5GxiqaGjIthUU6FFEZyqCa5qJrpBdzSw95IUnOPIrCUUjRZQFrbw5PR0R1qiYx3cb6nrWUMrBmmiBQxVHtTew5ICP/ip6g4hed/Akob/32wvBHsIOX83cI8hGeNeNPCIkPmXe8fPKx84OMSRM1MTdXSwjCZ4S30jVGhvqTRak/OVhgGazHuOCud5onEO1lJr6ecVyaOK6H7zqlBlIaHE0oroCgfvGJIdPcmfLNGLjpz7hZwZQpUbFME0A1cIJa7VNORkgfsMBatbKgwwJM9bSvQXeNOvbIjelg6WWvo5kvbKaJJNHexkKNHL9xRyFlH8Ti2riB5wVPhUk7nGkJnoCe428LR/wRGdYIlmWebCyxou1rCk4g/ShugBDX0V0ZQWkh0dOVsagkM0yV6OoLd5ye+pRlsCr0n+KiQrGuq5yJDzrTAXHtLUMduTDBVKrSm3eHL+6ijxhFDX9Z5gVU/wliHYTMiMFpKLNMEywu80wd3meoFmt6VbRMPenhrOc6DVe4pgXU8DnnHakLOIIrlF4FZPIw6R+zxBP0dyq6OOZ4Q5sLKCcz084ok+VsMMyQhNZmmBgX5xIXOEJTmi7VsGTvMTNdHHhpzdbE8Du2oKxgvBqQKdDDnTFOylCFaxR1syz2iqrOI/FEpNc3C6f11/7+ASS6l2inq2ciTrCCzgyemrCL5SVPjQkdPZUmGy2c9Sw9FtR1sS30RmsKPCS4rkIC/2U0MduwucYolGaPjKEyhzmiPYXagyWbYz8LWBDdzRimAXzxx4z8K9hpzlhLq+NiQ97HuKorMUfK/OVvC2JfiHUPCQI/q7J2gjK+tTDNxkCc4TMssqCs4TGtLVwQihyoAWgj9bosU80XGW6Ac9TJGziaUh5+hnFcHOnlaM1iRn29NaqGENTTTSUHCH2tWTeV0osUhH6psuVLjRUmGWhm6OZEshGeNowABHcJ2Bpy2ZszRcKkRXd2QuKVEeXnbfaEq825FguqfgfE2whlChSRMdron+LATTPQ2Z369t4B9C5gs/ylzv+CMmepIDPclFQl13W0rspPd1JOcbghGOEutqCv5qacURQl3dDKyvyJlqKXGPgcM9FfawJAMVmdcspcYKOZc4GjDYkFlK05olNMHyHn4zFNykyOxt99RkHlfwmiHo60l2EKI+mhreEKp080Tbug08BVPcgoqC5zWt+NLDTZ7oNSF51N1qie7Va3uCCwyZbkINf/NED6jzOsBdZjFN8oqG3wxVunqCSYYKf3EdhJyf9YWGf7tRU2oH3VHgPr1fe5J9hOgHd7xQ0y7qBwXr23aGErP0cm64JVjZwsOGqL+mhNgZmhJLW2oY4UhedsyBgzrCKrq7BmcpNVhR6jBPq64Vgi+kn6XE68pp8J5/+0wRHGOpsKenQn9DZntPzjRLZpDAdD2fnSgkG9tmIXnUwQ6WVighs7Yi2MxQ0N3CqYaCXkJ0oyOztMDJjmSSpcpvlrk0RMMOjmArQ04PRV1DO1FwhCVaUVPpKUM03JK5SxPsIWRu8/CGHi8UHChiqGFDTbSRJWeYUDDcH6vJWUxR4k1FXbMUwV6e4AJFXS8oMqsZKqzvYQ9DDQdZckY4aGsIhtlubbd2r3j4QBMoTamdPZk7O/Bf62lacZwneNjQoGcdVU7zJOd7ghsUHOkosagic6cnWc8+4gg285R6zZP5s1/LUbCKIznTwK36PkdwlOrl4U1LwfdCCa+IrvFkmgw1PCAUXKWo0sURXWcI2muKJlgyFzhynCY4RBOsqCjoI1R5zREco0n2Vt09BQtYSizgKNHfUmUrQ5UOCh51BFcLmY7umhYqXKQomOop8bUnWNNQcIiBcYaC6xzMNOS8JQQfeqKBmmglB+97ok/lfk3ygaHSyZaCRTzRxQo6GzLfa2jWBPepw+UmT7SQEJyiyRkhBLMVOfcoMjcK0eZChfUNzFAUzCsEN5vP/X1uP/n/aoMX+K+nw/Hjr/9xOo7j7Pju61tLcgvJpTWXNbfN5jLpi6VfCOviTktKlFusQixdEKWmEBUKNaIpjZRSSOXSgzaaKLdabrm1/9nZ+/f+vd/vz/v9+Xy+zZ7PRorYoZqyLrCwQdEAixxVOEXNNnjX2nUSRlkqGmWowk8lxR50JPy9Bo6qJXaXwNvREBvnThPEPrewryLhcAnj5WE15Fqi8W7R1sAuEu86S4ENikItFN4xkv9Af4nXSnUVcLiA9xzesFpivRRVeFKtsMRaKBhuSbjOELnAUtlSQUpXgdfB4Z1oSbnFEetbQ0IrAe+Y+pqnDcEJFj6S8LDZzZHwY4e3XONNlARraomNEt2bkvGsosA3ioyHm+6jCMbI59wqt4eeara28IzEmyPgoRaUOEDhTVdEJhmCoTWfC0p8aNkCp0oYqih2iqGi4yXeMkOsn4LdLLnmKfh/YogjNsPebeFGR4m9BJHLzB61XQ3BtpISfS2FugsK9FAtLWX1dCRcrCnUp44CNzuCowUZmxSRgYaE6Za0W2u/E7CVXCiI/UOR8aAm1+OSyE3mOUcwyc1zBBeoX1kiKy0Zfxck1Gsyulti11i83QTBF5Kg3pDQThFMVHiPSlK+0cSedng/VaS8bOZbtsBcTcZAR8JP5KeqQ1OYKAi20njdNNRpgnsU//K+JnaXJaGTomr7aYIphoRn9aeShJWKEq9LcozSF7QleEfDI5LYm5bgVkFkRwVDBCVu0DDIkGupo8TZBq+/pMQURYErJQmPKGKjNDkWOLx7Jd5QizdUweIaKrlP7SwJDhZvONjLkOsBBX9UpGxnydhXkfBLQ8IxgojQbLFnJf81JytSljclYYyEFyx0kVBvKWOFJmONpshGAcsduQY5giVNCV51eOdJYo/pLhbvM0uDHSevNKRcrKZIqnCtJeEsO95RoqcgGK4ocZcho1tTYtcZvH41pNQ7vA0WrhIfOSraIIntIAi+NXWCErdbkvrWwjRLrt0NKUdL6KSOscTOdMSOUtBHwL6OLA0vNSdynaWQEnCpIvKaIrJJEbvHkmuNhn6OjM8VkSGSqn1uYJCGHnq9I3aLhNME3t6GjIkO7xrNFumpyTNX/NrwX7CrIRiqqWijI9JO4d1iieykyfiposQIQ8YjjsjlBh6oHWbwRjgYJQn2NgSnNycmJAk3NiXhx44Sxykihxm8ybUwT1OVKySc7vi3OXVkdBJ4AyXBeksDXG0IhgtYY0lY5ahCD0ehborIk5aUWRJviMA7Xt5kyRjonrXENkm8yYqgs8VzgrJmClK20uMM3jRJ0FiQICQF9hdETlLQWRIb5ki6WDfWRPobvO6a4GP5mcOrNzDFELtTkONLh9dXE8xypEg7z8A9jkhrQ6Fhjlg/QVktJXxt4WXzT/03Q8IaQWSqIuEvloQ2mqC9Jfi7wRul4RX3pSPlzpoVlmCtI2jvKHCFhjcM3sN6lqF6HxnKelLjXWbwrpR4xzuCrTUZx2qq9oAh8p6ixCUGr78g8oyjRAtB5CZFwi80VerVpI0h+IeBxa6Zg6kWvpDHaioYYuEsRbDC3eOmC2JvGYLeioxGknL2UATNJN6hmtj1DlpLvDVmocYbrGCVJKOrg4X6DgddLA203BKMFngdJJFtFd7vJLm6KEpc5yjQrkk7M80SGe34X24nSex1Ra5Omgb71JKyg8SrU3i/kARKwWpH0kOGhKkObyfd0ZGjvyXlAkVZ4xRbYJ2irFMkFY1SwyWxr2oo4zlNiV+7zmaweFpT4kR3kaDAFW6xpSqzJay05FtYR4HmZhc9UxKbbfF2V8RG1MBmSaE+kmC6JnaRXK9gsiXhJHl/U0qM0WTcbyhwkYIvFGwjSbjfwhiJt8ZSQU+Bd5+marPMOkVkD0muxYLIfEuhh60x/J92itguihJSEMySVPQnTewnEm+620rTQEMsOfo4/kP/0ARvWjitlpSX7GxBgcMEsd3EEeYWvdytd+Saawi6aCIj1CkGb6Aj9rwhx16Cf3vAwFy5pyLhVonXzy51FDpdEblbkdJbUcEPDEFzQ8qNmhzzLTmmKWKbFCXeEuRabp6rxbvAtLF442QjQ+wEA9eL1xSR7Q0JXzlSHjJ4exq89yR0laScJ/FW6z4a73pFMEfDiRZvuvijIt86RaSFOl01riV2mD1UEvxGk/Geg5aWwGki1zgKPG9J2U8PEg8qYvMsZeytiTRXBMslCU8JSlxi8EabjwUldlDNLfzTUmCgxWsjqWCOHavYAqsknKFIO0yQ61VL5AVFxk6WhEaCAkdJgt9aSkzXlKNX2jEa79waYuc7gq0N3GDJGCBhoiTXUEPsdknCUE1CK0fwsiaylSF2uiDyO4XX3pFhNd7R4itFGc0k/ElBZwWvq+GC6szVeEoS/MZ+qylwpKNKv9Z469UOjqCjwlusicyTxG6VpNxcQ8IncoR4RhLbR+NdpGGmJWOcIzJGUuKPGpQg8rrG21dOMqQssJQ4RxH5jaUqnZuQ0F4Q+cjxLwPtpZbIAk3QTJHQWBE5S1BokoVtDd6lhqr9UpHSUxMcIYl9pojsb8h4SBOsMQcqvOWC2E8EVehqiJ1hrrAEbQxeK0NGZ0Gkq+guSRgniM23bIHVkqwx4hiHd7smaOyglyIyQuM978j4VS08J/A2G1KeMBRo4fBaSNhKUEZfQewVQ/C1I+MgfbEleEzCUw7mKXI0M3hd1EESVji8x5uQ41nxs1q4RMJCCXs7Iq9acpxn22oSDnQ/sJTxsCbHIYZiLyhY05TY0ZLIOQrGaSJDDN4t8pVaIrsqqFdEegtizc1iTew5Q4ayBDMUsQMkXocaYkc0hZua412siZ1rSXlR460zRJ5SlHGe5j801RLMlJTxtaOM3Q1pvxJ45zUlWFD7rsAbpfEm1JHxG0eh8w2R7QQVzBUw28FhFp5QZzq8t2rx2joqulYTWSuJdTYfWwqMFMcovFmSyJPNyLhE4E10pHzYjOC3huArRa571ZsGajQpQx38SBP5pyZB6lMU3khDnp0MBV51BE9o2E+TY5Ml2E8S7C0o6w1xvCZjf0HkVEHCzFoyNmqC+9wdcqN+Tp7jSDheE9ws8Y5V0NJCn2bk2tqSY4okdrEhx1iDN8cSudwepWmAGXKcJXK65H9to8jYQRH7SBF01ESUJdd0TayVInaWhLkOjlXE5irKGOnI6GSWGCJa482zBI9rCr0jyTVcEuzriC1vcr6mwFGSiqy5zMwxBH/TJHwjSPhL8+01kaaSUuMFKTcLEvaUePcrSmwn8DZrgikWb7CGPxkSjhQwrRk57tctmxLsb9sZvL9LSlyuSLlWkqOjwduo8b6Uv1DkmudIeFF2dHCgxVtk8dpIvHpBxhEOdhKk7OLIUSdJ+cSRY57B+0DgGUUlNfpthTfGkauzxrvTsUUaCVhlKeteTXCoJDCa2NOKhOmC4G1H8JBd4OBZReSRGkqcb/CO1PyLJTLB4j1q8JYaIutEjSLX8YKM+a6phdMsdLFUoV5RTm9JSkuDN8WcIon0NZMNZWh1q8C7SJEwV5HxrmnnTrf3KoJBlmCYI2ilSLlfEvlE4011NNgjgthzEua0oKK7JLE7HZHlEl60BLMVFewg4EWNt0ThrVNEVkkiTwpKXSWJzdRENgvKGq4IhjsiezgSFtsfCUq8qki5S1LRQeYQQ4nemmCkImWMw3tFUoUBZk4NOeZYEp4XRKTGa6wJjrWNHBVJR4m3FCnbuD6aak2WsMTh3SZImGCIPKNgsDpVwnsa70K31lCFJZYcwwSMFcQulGTsZuEaSdBXkPGZhu0FsdUO73RHjq8MPGGIfaGIbVTk6iuI3GFgucHrIQkmWSJdBd7BBu+uOryWAhY7+Lki9rK5wtEQzWwvtbqGhIMFwWRJsElsY4m9IIg9L6lCX0VklaPAYkfkZEGDnOWowlBJjtMUkcGK4Lg6EtoZInMUBVYLgn0UsdmCyCz7gIGHFfk+k1QwTh5We7A9x+IdJ6CvIkEagms0hR50eH9UnTQJ+2oiKyVlLFUE+8gBGu8MQ3CppUHesnjTHN4QB/UGPhCTHLFPHMFrCqa73gqObUJGa03wgbhHkrCfpEpzNLE7JDS25FMKhlhKKWKfCgqstLCPu1zBXy0J2ztwjtixBu8UTRn9LVtkmCN2iyFhtME70JHRQ1KVZXqKI/KNIKYMCYs1GUMEKbM1bKOI9LDXC7zbHS+bt+1MTWS9odA9DtrYtpbImQJ2VHh/lisEwaHqUk1kjKTAKknkBEXkbkdMGwq0dnhzLJF3NJH3JVwrqOB4Sca2hti75nmJN0WzxS6UxDYoEpxpa4htVlRjkYE7DZGzJVU72uC9IyhQL4i8YfGWSYLLNcHXloyz7QhNifmKSE9JgfGmuyLhc403Xm9vqcp6gXe3xuuv8F6VJNxkyTHEkHG2g0aKXL0MsXc1bGfgas2//dCONXiNLCX+5mB7eZIl1kHh7ajwpikyzlUUWOVOsjSQlsS+M0R+pPje/dzBXRZGO0rMtgQrLLG9VSu9n6CMXS3BhwYmSoIBhsjNBmZbgusE9BCPCP5triU4VhNbJfE+swSP27aayE8tuTpYYjtrYjMVGZdp2NpS1s6aBnKSHDsbKuplKbHM4a0wMFd/5/DmGyKrJSUaW4IBrqUhx0vyfzTBBLPIUcnZdrAkNsKR0sWRspumSns6Ch0v/qqIbBYUWKvPU/CFoyrDJGwSNFhbA/MlzKqjrO80hRbpKx0Jewsi/STftwGSlKc1JZyAzx05dhLEdnfQvhZOqiHWWEAHC7+30FuRcZUgaO5gpaIK+xsiHRUsqaPElTV40xQZQ107Q9BZE1nryDVGU9ZSQ47bmhBpLcYpUt7S+xuK/FiT8qKjwXYw5ypS2iuCv7q1gtgjhuBuB8LCFY5cUuCNtsQOFcT+4Ih9JX+k8Ea6v0iCIRZOtCT0Et00JW5UeC85Cg0ScK0k411HcG1zKtre3SeITBRk7WfwDhEvaYLTHP9le0m8By0JDwn4TlLW/aJOvGHxdjYUes+ScZigCkYQdNdEOhkiezgShqkx8ueKjI8lDfK2oNiOFvrZH1hS+tk7NV7nOmLHicGWEgubkXKdwdtZknCLJXaCpkrjZBtLZFsDP9CdxWsSr05Sxl6CMmoFbCOgryX40uDtamB7SVmXW4Ihlgpmq+00tBKUUa83WbjLUNkzDmY7cow1JDygyPGlhgGKYKz4vcV7QBNbJIgM11TUqZaMdwTeSguH6rOaw1JRKzaaGyxVm2EJ/uCIrVWUcZUkcp2grMsEjK+DMwS59jQk3Kd6SEq1d0S6uVmO4Bc1lDXTUcHjluCXEq+1OlBDj1pi9zgiXxnKuE0SqTXwhqbETW6RggMEnGl/q49UT2iCzgJvRwVXS2K/d6+ZkyUl7jawSVLit46EwxVljDZwoSQ20sDBihztHfk2yA8NVZghiXwrYHQdfKAOtzsayjhY9bY0yE2CWEeJ9xfzO423xhL5syS2TFJofO2pboHob0nY4GiAgRrvGQEDa/FWSsoaaYl0syRsEt3kWoH3B01shCXhTUWe9w3Bt44SC9QCh3eShQctwbaK2ApLroGCMlZrYqvlY3qYhM0aXpFkPOuoqJ3Dm6fxXrGwVF9gCWZagjPqznfkuMKQ8DPTQRO8ZqG1hPGKEm9IgpGW4DZDgTNriTxvFiq+Lz+0cKfp4wj6OCK9JSnzNSn9LFU7UhKZZMnYwcJ8s8yRsECScK4j5UOB95HFO0CzhY4xJxuCix0lDlEUeMdS6EZBkTsUkZ4K74dugyTXS7aNgL8aqjDfkCE0ZbwkCXpaWCKhl8P7VD5jxykivSyxyZrYERbe168LYu9ZYh86IkscgVLE7tWPKmJv11CgoyJltMEbrohtVAQfO4ImltiHEroYEs7RxAarVpY8AwXMcMReFOTYWe5iiLRQxJ5Q8DtJ8LQhWOhIeFESPGsILhbNDRljNbHzNRlTFbk2S3L0NOS6V1KFJYKUbSTcIIhM0wQ/s2TM0SRMNcQmSap3jCH4yhJZKSkwyRHpYYgsFeQ4U7xoCB7VVOExhXepo9ABBsYbvGWKXPME3lyH95YioZ0gssQRWWbI+FaSMkXijZXwgiTlYdPdkNLaETxlyDVIwqeaEus0aTcYcg0RVOkpR3CSJqIddK+90JCxzsDVloyrFd5ZAr4TBKfaWa6boEA7C7s6EpYaeFPjveooY72mjIccLHJ9HUwVlDhKkmutJDJBwnp1rvulJZggKDRfbXAkvC/4l3ozQOG9a8lxjx0i7nV4jSXc7vhe3OwIxjgSHjdEhhsif9YkPGlus3iLFDnWOFhtCZbJg0UbQcIaR67JjthoCyMEZRwhiXWyxO5QxI6w5NhT4U1WsJvDO60J34fW9hwzwlKij6ZAW9ne4L0s8C6XeBMEkd/LQy1VucBRot6QMlbivaBhoBgjqGiCJNhsqVp/S2SsG6DIONCR0dXhvWbJ+MRRZJkkuEjgDXJjFQW6SSL7GXK8Z2CZg7cVsbWGoKmEpzQ5elpiy8Ryg7dMkLLUEauzeO86CuwlSOlgYLojZWeJ9xM3S1PWfEfKl5ISLQ0MEKR8YOB2QfCxJBjrKPCN4f9MkaSsqoVXJBmP7EpFZ9UQfOoOFwSzBN4MQ8LsGrymlipcJQhmy0GaQjPqCHaXRwuCZwRbqK2Fg9wlClZqYicrIgMdZfxTQ0c7TBIbrChxmuzoKG8XRaSrIhhiyNFJkrC7oIAWMEOQa5aBekPCRknCo4IKPrYkvCDI8aYmY7WFtprgekcJZ3oLIqssCSMtFbQTJKwXYy3BY5oCh2iKPCpJOE+zRdpYgi6O2KmOAgvVCYaU4ySRek1sgyFhJ403QFHiVEmJHwtybO1gs8Hr5+BETQX3War0qZngYGgtVZtoqd6vFSk/UwdZElYqyjrF4HXUeFspIi9IGKf4j92pKGAdCYMVsbcV3kRF0N+R8LUd5PCsIGWoxDtBkCI0nKofdJQxT+LtZflvuc8Q3CjwWkq8KwUpHzkK/NmSsclCL0nseQdj5FRH5CNHSgtLiW80Of5HU9Hhlsga9bnBq3fEVltKfO5IaSTmGjjc4J0otcP7QsJUSQM8pEj5/wCuUuC2DWz8AAAAAElFTkSuQmCC"); + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAQAAAAHUWYVAABFFUlEQVQYGbzBCeDVU/74/6fj9HIcx/FRHx9JCFmzMyGRURhLZIkUsoeRfUjS2FNDtr6WkMhO9sm+S8maJfu+Jcsg+/o/c+Z4z/t97/vezy3z+z8ekGlnYICG/o7gdk+wmSHZ1z4pJItqapjoKXWahm8NmV6eOTbWUOp6/6a/XIg6GQqmenJ2lDHyvCFZ2cBDbmtHA043VFhHwXxClWmeYAdLhV00Bd85go8VmaFCkbVkzlQENzfBDZ5gtN7HwF0KDrTwJ0dypSOzpaKCMwQHKTIreYIxlmhXTzTWkVm+LTynZhiSBT3RZQ7aGfjGEd3qyXQ1FDymqbKxpspERQN2MiRjNZlFFQXfCNFm9nM1zpAsoYjmtRTc5ajwuaXc5xrWskT97RaKzAGe5ARHhVUsDbjKklziiX5WROcJwSNCNI+9w1Jwv4Zb2r7lCMZ4oq5C0EdTx+2GzNuKpJ+iFf38JEWkHJn9DNF7mmBDITrWEg0VWL3pHU20tSZnuqWu+R3BtYa8XxV1HO7GyD32UkOpL/yDloINFTmvtId+nmAjxRw40VMwVKiwrKLE4bK5UOVntYwhOcSSXKrJHKPJedocpGjVz/ZMIbnYUPB10/eKCrs5apqpgVmWzBYWpmtKHecJPjaUuEgRDDaU0oZghCJ6zNMQ5ZhDYx05r5v2muQdM0EILtXUsaKiQX9WMEUotagQzFbUNN6NUPC2nm5pxEWGCjMc3GdJHjSU2kORLK/JGSrkfGEIjncU/CYUnOipoYemwj8tST9NsJmB7TUVXtbUtXATJVZXBMvYeTXJfobgJUPmGMP/yFaWonaa6BcFO3nqcIqCozSZoZoSr1g4zJOzuyGnxTEX3lUEJ7WcZgme8ddaWvWJo2AJR9DZU3CUIbhCSG6ybSwN6qtJVnCU2svDTP2ZInOw2cBTrqtQahtNZn9NcJ4l2NaSmSkkP1noZWnVwkLmdUPOwLZEwy2Z3S3R+4rIG9hcbpPXHFVWcQdZkn2FOta3cKWQnNRC5g1LsJah4GCzSVsKnCOY5OAFRTBekyyryeyilhFKva75r4Mc0aWanGEaThcy31s439KKxTzJYY5WTHPU1FtIHjQU3Oip4xlNzj/lBw23dYZVliQa7WAXf4shetcQfatI+jWRDBPmyNeW6A1P5kdDgyYJlba0BIM8BZu1JfrFwItyjcAMR3K0BWOIrtMEXyhyrlVEx3ui5dUBjmB/Q3CXW85R4mBD0s7B+4q5tKUjOlb9qqmhi5AZ6GFIC5HXtOobdYGlVdMVbNJ8toNTFcHxnoL+muBagcctjWnbNMuR00uI7nQESwg5q2qqrKWIfrNUmeQocY6HuyxJV02wj36w00yhpmUFenv4p6fUkZYqLyuinx2RGOjhCXYyJF84oiU00YMOOhhquNdfbOB7gU88pY4xJO8LVdp6/q2voeB4R04vIdhSE40xZObx1HGGJ/ja0LBthFInKaLPPFzuCaYaoj8JjPME8yoyxo6zlBqkiUZYgq00OYMswbWO5NGmq+xhipxHLRW29ARjNKXO0wRnear8XSg4XFPLKEPUS1GqvyLwiuBUoa7zpZ0l5xxFwWmWZC1H5h5FwU8eQ7K+g8UcVY6TMQreVQT/8uQ8Z+ALIXnSEa2pYZQneE9RZbSBNYXfWYJzW/h/4j4Dp1tYVcFIC5019Vyi4ThPqSFCzjGWaHQTBU8q6vrVwgxP9Lkm840imWKpcLCjYTtrKuwvsKSnrvHCXGkSMk9p6lhckfRpIeis+N2PiszT+mFLspyGleUhDwcLrZqmyeylxwjBcKHEapqkmyangyLZRVOijwOtCY5SsG5zL0OwlCJ4y5KznF3EUNDDrinwiyLZRzOXtlBbK5ITHFGLp8Q0R6ab6mS7enI2cFrxOyHvOCFaT1HThS1krjCwqWeurCkk+willhCC+RSZnRXBiZaC5RXRIZYKp2lyfrHwiKPKR0JDzrdU2EFgpidawlFDR6FgXUMNa+g1FY3bUQh2cLCwosRdnuQTS/S+JVrGLeWIvtQUvONJxlqSQYYKpwoN2kaocLjdVsis4Mk80ESF2YpSkzwldjHkjFCUutI/r+EHDU8oCs6yzL3PhWiEooZdFMkymlas4AcI3KmoMMNSQ3tHzjGWCrcJJdYyZC7QFGwjRL9p+MrRkAGWzIaWCn9W0F3TsK01c2ZvQw0byvxuQU0r1lM0qJO7wW0kRIMdDTtXEdzi4VIh+EoIHm0mWtAtpCixlabgn83fKTI7anJe9ST7WIK1DMGpQmYeA58ImV6ezOGOzK2Kgq01pd60cKWiUi9Lievb/0vIDPHQ05Kzt4ddPckQBQtoaurjyHnek/nKzpQLrVgKPjIkh2v4uyezpv+Xoo7fPFXaGFp1vaLKxQ4uUpQQS5VuQs7BCq4xRJv7fwpVvvFEB3j+620haOuocqMhWd6TTPAEx+mdFNGHdranFe95WrWmIvlY4F1Dle2ECgc6cto7SryuqGGGha0tFQ5V53migUKmg6XKAo4qS3mik+0OZpAhOLeZKicacgaYcyx5hypYQE02ZA4xi/pNhOQxR4klNKyqacj+mpxnLTnnGSo85++3ZCZq6lrZkXlGEX3o+C9FieccJbZWVFjC0Yo1FZnJhoYMFoI1hEZ9r6hwg75HwzBNhbZCdJEfJwTPGzJvaKImw1yYX1HDAmpXR+ZJQ/SmgqMNVQb5vgamGwLtt7VwvP7Qk1xpiM5x5Cyv93E06MZmgs0Nya2azIKOYKCGBQQW97RmhKNKF02JZqHEJ4o58qp7X5EcZmc56trXEqzjCBZ1MFGR87Ql2tSTs6CGxS05PTzRQorkbw7aKoKXFDXsYW42VJih/q+FP2BdTzDTwVqOYB13liM50vG7wy28qagyuIXMeQI/Oqq8bcn5wJI50xH00CRntyfpL1T4hydYpoXgNiFzoIUTDZnLNRzh4TBHwbYGDvZkxmlyJloyr6tRihpeUG94GnKtIznREF0tzJG/OOr73JBcrSh1k6WuTprgLU+mnSGnv6Zge0NNz+kTDdH8nuAuTdJDCNb21LCiIuqlYbqGzT3RAoZofQfjFazkqeNWdYaGvYTM001EW2oKPvVk1ldUGSgUtHFwjKM1h9jnFcmy5lChoLNaQMGGDsYbKixlaMBmmsx1QjCfflwTfO/gckW0ruZ3jugKR3R5W9hGUWqCgxuFgsuaCHorotGKzGaeZB9DMsaTnKCpMtwTvOzhYk0rdrArKCqcaWmVk1+F372ur1YkKxgatI8Qfe1gIX9wE9FgS8ESmuABIXnRUbCapcKe+nO7slClSZFzpV/LkLncEb1qiO42fS3R855Su2mCLh62t1SYZZYVmKwIHjREF2uihTzB20JOkz7dkxzYQnK0UOU494wh+VWRc6Un2kpTaVgLDFEkJ/uhzRcI0YKGgpGWOlocBU/a4fKoJ/pEaNV6jip3+Es9VXY078rGnmAdf7t9ylPXS34RBSuYPs1UecZTU78WanhBCHpZ5sAoTz0LGZKjPf9TRypqWEiTvOFglL1fCEY3wY/++rbk7C8bWebA6p6om6PgOL2kp44TFJlVNBXae2rqqdZztOJpT87GQsE9jqCPIe9VReZuQ/CIgacsyZdCpIScSYqcZk8r+nsyCzhyfhOqHGOIvrLknC8wTpFcaYiGC/RU1NRbUeUpocQOnkRpGOrIOcNRx+1uA0UrzhSSt+VyS3SJpnFWkzNDqOFGIWcfR86DnmARTQ1HKIL33ExPiemeOhYSSjzlSUZZuE4TveoJLnBUOFof6KiysCbnAEcZgcUNTDOwkqWu3RWtmGpZwlHhJENdZ3miGz0lJlsKnjbwqSHQjpxnFDlTLLwqJPMZMjd7KrzkSG7VsxXBZE+F8YZkb01Oe00yyRK9psh5SYh29ySPKBo2ylNht7ZkZnsKenjKNJu9PNEyZpaCHv4Kt6RQsLvAVp7M9kIimmCUwGeWqLMmGuIotYMmWNpSahkhZw9FqZsVnKJhsjAHvtHMsTM9fCI06Dx/u3vfUXCqfsKRc4oFY2jMsoo/7DJDwZ1CsIKnJu+J9ldkpmiCxQx1rWjI+T9FwcWWzOuaYH0Hj7klNRVWEQpmaqosakiGNTFHdjS/qnUdmf0NJW5xsL0HhimCCZZSRzmSPTXJQ4aaztAwtZnoabebJ+htCaZ7Cm535ByoqXKbX1WRc4Eh2MkRXWzImVc96Cj4VdOKVxR84VdQsIUM8Psoou2byVHyZFuq7O8otbSQ2UAoeEWTudATLGSpZzVLlXVkPU2Jc+27lsw2jmg5T5VhbeE3BT083K9WsTTkFU/Osi0rC5lRlpwRHUiesNS0sOvmqGML1aRbPAxTJD9ZKtxuob+hhl8cwYGWpJ8nub7t5p6coYbMovZ1BTdaKn1jYD6h4GFDNFyT/Kqe1XCXphXHOKLZmuRSRdBPEfVUXQzJm5YGPGGJdvAEr7hHNdGZnuBvrpciGmopOLf5N0uVMy0FfYToJk90uUCbJupaVpO53UJXR2bVpoU00V2KOo4zMFrBd0Jtz2pa0clT5Q5L8IpQ177mWQejPMEJhuQjS10ref6HHjdEhy1P1EYR7GtO0uSsKJQYLiTnG1rVScj5lyazpqWGl5uBbRWl7m6ixGOOnEsMJR7z8J0n6KMnCdxhiNYQCoZ6CmYLnO8omC3MkW3bktlPmEt/VQQHejL3+dOE5FlPdK/Mq8hZxxJtLyRrepLThYKbLZxkSb5W52vYxNOaOxUF0yxMUPwBTYqCzy01XayYK0sJyWBLqX0MwU5CzoymRzV0EjjeUeLgDpTo6ij42ZAzvD01dHUUTPLU96MdLbBME8nFBn7zJCMtJcZokn8YoqU0FS5WFKyniHobguMcmW8N0XkWZjkyN3hqOMtS08r+/xTBwpZSZ3qiVRX8SzMHHjfUNFjgHEPmY9PL3ykEzxkSre/1ZD6z/NuznuB0RcE1TWTm9zRgfUWVJiG6yrzgmWPXC8EAR4Wxhlad0ZbgQyEz3pG5RVEwwDJH2mgKpjcTiCOzn1lfUWANFbZ2BA8balnEweJC9J0iuaeZoI+ippFCztEKVvckR2iice1JvhVytrQwUAZpgsubCPaU7xUe9vWnaOpaSBEspalykhC9bUlOMpT42ZHca6hyrqKmw/wMR8H5ZmdFoBVJb03O4UL0tSNnvIeRmkrLWqrs78gcrEn2tpcboh0UPOW3UUR9PMk4T4nnNKWmCjlrefhCwxRNztfmIQVdDElvS4m1/WuOujoZCs5XVOjtKPGokJzsYCtFYoWonSPT21DheU/wWhM19FcElwqNGOsp9Q8N/cwXaiND1MmeL1Q5XROtYYgGeFq1aTMsoMmcrKjQrOFQTQ1fmBYhmW6o8Jkjc7iDJRTBIo5kgJD5yMEYA3srCg7VFKwiVJkmRCc5ohGOKhsYMn/XBLdo5taZjlb9YAlGWRimqbCsoY7HFAXLa5I1HPRxMMsQDHFkWtRNniqT9UEeNjcE7RUlrCJ4R2CSJuqlKHWvJXjAUNcITYkenuBRB84TbeepcqTj3zZyFJzgYQdHnqfgI0ddUwS6GqWpsKWhjq9cV0vBAEMN2znq+EBfIWT+pClYw5xsTlJU6GeIBsjGmmANTzJZiIYpgrM0Oa8ZMjd7NP87jxhqGOhJlnQtjuQpB+8aEE00wZFznSJPyHxgH3HkPOsJFvYk8zqCHzTs1BYOa4J3PFU+UVRZxlHDM4YavlNUuMoRveiZA2d7grMNc2g+RbSCEKzmgYsUmWmazFJyoiOZ4KnyhKOGRzWJa0+moyV4TVHDzn51Awtqaphfk/lRQ08FX1iiqxTB/kLwd0VynKfEvI6cd4XMV5bMhZ7gZUWVzYQ6Nm2BYzxJbw3bGthEUUMfgbGeorae6DxHtJoZ6alhZ0+ytiVoK1R4z5PTrOECT/SugseEOlb1MMNR4VRNcJy+V1Hg9ONClSZFZjdHlc6W6FBLdJja2MC5hhpu0DBYEY1TFGwiFAxRRCsYkiM9JRb0JNMVkW6CZYT/2EiTGWmo8k+h4FhDNE7BvppoTSFnmCV5xZKzvcCdDo7VVPnIU+I+Rc68juApC90MwcFCsJ5hDqxgScYKreruyQwTqrzoqDCmhWi4IbhB0Yrt3RGa6GfDv52rKXWhh28dyZaWUvcZeMTBaZoSGyiCtRU5J8iviioHaErs7Jkj61syVzTTgOcUOQ8buFBTYWdL5g3T4qlpe0+wvD63heAXRfCCIed9RbCsp2CiI7raUOYOTU13N8PNHvpaGvayo4a3LLT1lDrVEPT2zLUlheB1R+ZTRfKWJ+dcocLJfi11vyJ51lLqJ0WD7tRwryezjiV5W28uJO9qykzX8JDe2lHl/9oyBwa2UMfOngpXCixvKdXTk3wrsKmiVYdZIqsoWEERjbcUNDuiaQomGoIbFdEHmsyWnuR+IeriKDVLnlawlyNHKwKlSU631PKep8J4Q+ayjkSLKYLhalNHlYvttb6fHm0p6OApsZ4l2VfdqZkjuysy6ysKLlckf1KUutCTs39bmCgEyyoasIWlVaMF7mgmWtBT8Kol5xpH9IGllo8cJdopcvZ2sImlDmMIbtDk3KIpeNiS08lQw11NFPTwVFlPP6pJ2gvRfI7gQUfmNAtf6Gs0wQxDsKGlVBdF8rCa3jzdwMaGHOsItrZk7hAyOzpK9VS06j5F49b0VNGOOfKs3lDToMsMBe9ZWtHFEgxTJLs7qrygKZjUnmCYoeAqeU6jqWuLJup4WghOdvCYJnrSkSzoyRkm5M2StQwVltPkfCAk58tET/CSg+8MUecmotMEnhBKfWBIZsg2ihruMJQaoIm+tkTLKEqspMh00w95gvFCQRtDwTT1gVDDSEVdlwqZfxoQRbK0g+tbiBZxzKlpnpypejdDwTaeOvorMk/IJE10h9CqRe28hhLbe0pMsdSwv4ZbhKivo2BjDWfL8UKJgeavwlwb5KlwhyE4u4XkGE2ytZCznKLCDZZq42VzT8HLCrpruFbIfOIINmh/qCdZ1ZBc65kLHR1Bkyf5zn6pN3SvGKIlFNGplhrO9QSXanLOMQTLCa0YJCRrCZm/CZmrLTm7WzCK4GJDiWUdFeYx1LCFg3NMd0XmCuF3Y5rITLDUsYS9zoHVzwnJoYpSTQoObyEzr4cFBNqYTopoaU/wkyLZ2lPhX/5Y95ulxGTV7KjhWrOZgl8MyUUafjYraNjNU1N3IWcjT5WzWqjwtoarHSUObGYO3GCJZpsBlnJGPd6ZYLyl1GdCA2625IwwJDP8GUKymbzuyPlZlvTUsaUh5zFDhRWFzPKKZLAlWdcQbObgF9tOqOsmB1dqcqYJmWstFbZRRI9poolmqiLnU0POvxScpah2iSL5UJNzgScY5+AuIbpO0YD3NCW+dLMszFSdFCWGqG6eVq2uYVNDdICGD6W7EPRWZEY5gpsE9rUkS3mijzzJnm6UpUFXG1hCUeVoS5WfNcFpblELL2qqrCvMvRfd45oalvKU2tiQ6ePJOVMRXase9iTtLJztPxJKLWpo2CRDcJwn2sWSLKIO1WQWNTCvpVUvOZhgSC40JD0dOctaSqzkCRbXsKlb11Oip6PCJ0IwSJM31j3akRxlP7Rwn6aGaUL0qiLnJkvB3xWZ2+Q1TfCwpQH3G0o92UzmX4o/oJNQMMSQc547wVHhdk+VCw01DFYEnTxzZKAm74QmeNNR1w6WzEhNK15VJzuCdxQ53dRUDws5KvwgBMOEgpcVNe0hZI6RXT1Jd0cyj5nsaEAHgVmGaJIlWdsc5Ui2ElrRR6jrRAttNMEAIWrTDFubkZaok7/AkzfIwfuWVq0jHzuCK4QabtLUMVPB3kJ0oyHTSVFlqMALilJf2Rf8k5aaHtMfayocLBS8L89oKoxpJvnAkDPa0qp5DAUTHKWmCcnthlou8iCKaFFLHWcINd1nyIwXqrSxMNmSs6KmoL2QrKuWtlQ5V0120xQ5vRyZS1rgFkWwhiOwiuQbR0OOVhQM9iS3tiXp4RawRPMp5tDletOOBL95MpM01dZTBM9pkn5qF010rIeHFcFZhmSGpYpTsI6nwhqe5C9ynhlpp5ophuRb6WcJFldkVnVEwwxVfrVkvnWUuNLCg5bgboFHPDlDPDmnK7hUrWiIbjadDclujlZcaokOFup4Ri1kacV6jmrrK1hN9bGwpKEBQ4Q6DvIUXOmo6U5LqQM6EPyiKNjVkPnJkDPNEaxhiFay5ExW1NXVUGqcpYYdPcGiCq7z/TSlbhL4pplWXKd7NZO5QQFrefhRQW/NHOsqcIglc4UhWklR8K0QzbAw08CBDnpbgqXdeD/QUsM4RZXDFBW6WJKe/mFPdH0LtBgiq57wFLzlyQzz82qYx5D5WJP5yVJDW01BfyHnS6HKO/reZqId1WGa4Hkh2kWodJ8i6KoIPlAj2hPt76CzXsVR6koPRzWTfKqIentatYpQw2me4AA3y1Kind3SwoOKZDcFXTwl9tWU6mfgRk9d71sKtlNwrjnYw5tC5n5LdKiGry3JKNlHEd3oaMCFHrazBPMp/uNJ+V7IudcSbeOIdjUEdwl0VHCOZo5t6YluEuaC9mQeMgSfOyKnYGFHcIeQ84yQWbuJYJpZw5CzglDH7gKnWqqM9ZTaXcN0TeYhR84eQtJT76JJ1lREe7WnnvsMmRc9FQ7SBBM9mV3lCUdmHk/S2RAMt0QjFNFqQpWjDPQ01DXWUdDBkXziKPjGEP3VP+zIWU2t7im41FOloyWzn/L6dkUy3VLDaZ6appgDLHPjJEsyvJngWEPUyVBiAaHCTEXwrLvSEbV1e1gKJniicWorC1MUrVjB3uDhJE/wgSOzk1DXpk0k73qCM8xw2UvD5kJmDUfOomqMpWCkJRlvKXGmoeBm18USjVIk04SClxTB6YrgLAPLWYK9HLUt5cmc0vYES8GnTeRc6skZbQkWdxRsIcyBRzx1DbTk9FbU0caTPOgJHhJKnOGIVhQqvKmo0llRw9sabrZkDtdg3PqaKi9oatjY8B+G371paMg6+mZFNNtQ04mWBq3rYLOmtWWQp8KJnpy9DdFensyjdqZ+yY40VJlH8wcdLzC8PZnvHMFUTZUrDTkLyQaGus5X5LzpYAf3i+e/ZlhqGqWhh6Ou6xTR9Z6oi5AZZtp7Mj2EEm8oSpxiYZCHU/1fbGdNNNRRoZMhmilEb2gqHOEJDtXkHK/JnG6IrvbPCwV3NhONVdS1thBMs1T4QOBcTWa2IzhMk2nW5Kyn9tXUtpv9RsG2msxk+ZsQzRQacJncpgke0+T8y5Fzj8BiGo7XlJjaTIlpQs7KFjpqGnKuoyEPeIKnFMkZHvopgh81ySxNFWvJWcKRs70j2FOT012IllEEO1n4pD1513Yg2ssQPOThOkvyrqHUdEXOSEsihmBbTbKX1kLBPWqWkLOqJbjB3GBIZmoa8qWl4CG/iZ7oiA72ZL7TJNeZUY7kFQftDcHHluBzRbCegzMtrRjVQpX2lgoPKKLJAkcbMl01XK2p7yhL8pCBbQ3BN2avJgKvttcrWDK3CiUOVxQ8ZP+pqXKyIxnmBymCg5vJjNfkPK4+c8cIfK8ocVt7kmfd/I5SR1hKvCzUtb+lhgc00ZaO6CyhIQP1Uv4yIZjload72PXX0OIJvnFU+0Zf6MhsJwTfW0r0UwQfW4LNLZl5HK261JCZ4qnBaAreVAS3WrjV0LBnNDUNNDToCEeFfwgcb4gOEqLRhirWkexrCEYKVV711DLYEE1XBEsp5tpTGjorkomKYF9FDXv7fR3BGwbettSxnyL53MBPjsxDZjMh+VUW9NRxq1DhVk+FSxQcaGjV9Pawv6eGByw5qzoy7xk4RsOShqjJwWKe/1pEEfzkobeD/dQJmpqedcyBTy2sr4nGNRH0c0SPWTLrqAc0OQcb/gemKgqucQT7ySWKCn2EUotoCvpZct7RO2sy/QW0IWcXd7pQRQyZVwT2USRO87uhjioTLKV2brpMUcMQRbKH/N2T+UlTpaMls6cmc6CCNy3JdYYSUzzJQ4oSD3oKLncULOiJvjBEC2oqnCJkJluCYy2ZQ5so9YYlZ1VLlQU1mXEW1jZERwj/MUSRc24TdexlqLKfQBtDTScJUV8FszXBEY5ktpD5Ur9hYB4Nb1iikw3JoYpkKX+RodRKFt53MMuRnKSpY31PwYaGaILh3wxJGz9TkTPEETxoCWZrgvOlmyMzxFEwVJE5xZKzvyJ4WxEc16Gd4Xe3Weq4XH2jKRikqOkGQ87hQnC7wBmGYLAnesX3M+S87eFATauuN+Qcrh7xIxXJbUIdMw3JGE3ylCWzrieaqCn4zhGM19TQ3z1oH1AX+pWEqIc7wNGAkULBo/ZxRaV9NNyh4Br3rCHZzbzmSfawBL0dNRwpW1kK9mxPXR9povcdrGSZK9c2k0xwFGzjuniCtRSZCZ6ccZ7gaktmgAOtKbG/JnOkJrjcQTdFMsxRQ2cLY3WTIrlCw1eWKn8R6pvt4GFDso3QoL4a3nLk3G6JrtME3dSenpx7PNFTmga0EaJTLQ061sEeQoWXhSo9LTXsaSjoJQRXeZLtDclbCrYzfzHHeaKjHCVOUkQHO3JeEepr56mhiyaYYKjjNU+Fed1wS5VlhWSqI/hYUdDOkaxiKehoyOnrCV5yBHtbWFqTHCCwtpDcYolesVR5yUzTZBb3RNMd0d6WP+SvhuBmRcGxnuQzT95IC285cr41cLGQ6aJJhmi4TMGempxeimBRQw1tFKV+8jd6KuzoSTqqDxzRtpZkurvKEHxlqXKRIjjfUNNXQsNOsRScoWFLT+YeRZVD3GRN0MdQcKqQjHDMrdGGVu3iYJpQx3WGUvfbmxwFfR20WBq0oYY7LMFhhgYtr8jpaEnaOzjawWWaTP8mMr0t/EPDPoqcnxTBI5o58L7uoWnMrpoqPwgVrlAUWE+V+TQl9rawoyP6QGAlQw2TPRX+YSkxyBC8Z6jhHkXBgQL7WII3DVFnRfCrBfxewv9D6xsyjys4VkhWb9pUU627JllV0YDNHMku/ldNMMXDEo4aFnAkk4U6frNEU4XgZUPmEKHUl44KrzmYamjAbh0JFvGnaTLPu1s9jPCwjFpYiN7z1DTOk/nc07CfDFzmCf7i+bfNHXhDtLeBXzTBT5rkMvWOIxpl4EMh2LGJBu2syDnAEx2naEhHDWMMzPZEhygyS1mS5RTJr5ZkoKbEUoYqr2kqdDUE8ztK7OaIntJkFrIECwv8LJTaVx5XJE86go8dFeZ3FN3rjabCAYpoYEeC9zzJVULBbmZhDyd7ko09ydpNZ3nm2Kee4FPPXHnYEF1nqOFEC08LUVcDvYXkJHW8gTaKCk9YGOeIJhqiE4ToPEepdp7IWFjdwnWaufGMwJJCMtUTTBBK9BGCOy2tGGrJTHIwyEOzp6aPzNMOtlZkDvcEWpP5SVNhfkvDxhmSazTJXYrM9U1E0xwFVwqZQwzJxw6+kGGGUj2FglGGmnb1/G51udRSMNlTw6GGnCcUwVcOpmsqTHa06o72sw1RL02p9z0VbnMLOaIX3QKaYKSCFQzBKEUNHTSc48k53RH9wxGMtpQa5KjjW0W0n6XCCCG4yxNNdhQ4R4l1Ff+2sSd6UFHiIEOyqqFgT01mEUMD+joy75jPhOA+oVVLm309FR4yVOlp4RhLiScNmSmaYF5Pw0STrOIoWMSR2UkRXOMp+M4SHW8o8Zoi6OZgjKOaFar8zZDzkWzvKOjkKBjmCXby8JahhjXULY4KlzgKLvAwxVGhvyd4zxB1d9T0piazmKLCVZY5sKiD0y2ZSYrkUEPUbIk+dlQ4SJHTR50k1DPaUWIdTZW9NJwnJMOECgd7ou/MnppMJ02O1VT4Wsh85MnZzcFTngpXGKo84qmwgKbCL/orR/SzJ2crA+t6Mp94KvxJUeIbT3CQu1uIdlQEOzlKfS3UMcrTiFmOuroocrZrT2AcmamOKg8YomeEKm/rlT2sociMaybaUlFhuqHCM2qIJ+rg4EcDFymiDSxzaHdPcpE62pD5kyM5SBMoA1PaUtfIthS85ig1VPiPPYXgYEMNk4Qq7TXBgo7oT57gPUdwgCHzhIVFPFU6OYJzHAX9m5oNrVjeE61miDrqQ4VSa1oiURTsKHC0IfjNwU2WzK6eqK8jWln4g15TVBnqmDteCJ501PGAocJhhqjZdtBEB6lnhLreFJKxmlKbeGrqLiSThVIbCdGzloasa6lpMQXHCME2boLpJgT7yWaemu6wBONbqGNVRS0PKIL7LckbjmQtR7K8I5qtqel+T/ChJTNIKLjdUMNIRyvOEko9YYl2cwQveBikCNawJKcLBbc7+JM92mysNvd/Fqp8a0k6CNEe7cnZrxlW0wQXaXjaktnRwNOGZKYiONwS7a1JVheq3WgJHlQUGKHKmp4KAxXR/ULURcNgoa4zhKSLpZR3kxRRb0NmD0OFn+UCS7CzI1nbP6+o4x47QZE5xRCt3ZagnYcvmpYQktXdk5YKXTzBC57kKEe0VVuiSYqapssMS3C9p2CKkHOg8B8Pa8p5atrIw3qezIWanMGa5HRDNF6RM9wcacl0N+Q8Z8hsIkSnaIIdHRUOEebAPy1zbCkhM062FCJtif7PU+UtoVXzWKqM1PxXO8cfdruhFQ/a6x3JKYagvVDhQEtNiyiiSQ7OsuRsZUku0CRNDs4Sog6KKjsZgk2bYJqijgsEenoKeniinRXBn/U3lgpPdyDZynQx8IiioMnCep5Ky8mjGs6Wty0l1hUQTcNWswS3WRp2kCNZwJG8omG8JphPUaFbC8lEfabwP7VtM9yoaNCAjpR41VNhrD9LkbN722v0CoZMByFzhaW+MyzRYEWFDQwN2M4/JiT76PuljT3VU/A36eaIThb+R9oZGOAJ9tewkgGvqOMNRWYjT/Cwu99Q8LqDE4TgbLWxJ1jaDDAERsFOFrobgjUsBScaguXU8kKm2RL19tRypSHnHNlHiIZqgufs4opgQdVdwxBNNFBR6kVFqb8ogimOzB6a6HTzrlDHEpYaxjiiA4TMQobkDg2vejjfwJGWmnbVFAw3H3hq2NyQfG7hz4aC+w3BbwbesG0swYayvpAs6++Ri1Vfzx93mFChvyN5xVHTS+0p9aqCAxyZ6ZacZyw5+7uuQkFPR9DDk9NOiE7X1PCYJVjVUqq7JlrHwWALF5nfHNGjApdpqgzx5OwilDhCiDYTgnc9waGW4BdLNNUQvOtpzDOWHDH8D7TR/A/85KljEQu3NREc4Pl/6B1Hhc8Umb5CsKMmGC9EPcxoT2amwHNCmeOEnOPbklnMkbOgIvO5UMOpQrS9UGVdt6iH/fURjhI/WOpaW9OKLYRod6HCUEdOX000wpDZQ6hwg6LgZfOqo1RfT/CrJzjekXOGhpc1VW71ZLbXyyp+93ILbC1kPtIEYx0FIx1VDrLoVzXRKRYWk809yYlC9ImcrinxtabKnzRJk3lAU1OLEN1j2zrYzr2myHRXJFf4h4QKT1qSTzTB5+ZNTzTRkAxX8FcLV2uS8eoQQ2aAkFzvCM72sJIcJET3WPjRk5wi32uSS9rfZajpWEvj9hW42F4o5NytSXYy8IKHay10VYdrcl4SkqscrXpMwyGOgtkajheSxdQqmpxP1L3t4R5PqasFnrQEjytq6qgp9Y09Qx9o4S1FzhUCn1kyHSzBWLemoSGvOqLNhZyBjmCaAUYpMgt4Ck7wBBMMwWKWgjsUwTaGVsxWC1mYoKiyqqeGKYqonSIRQ3KIkHO0pmAxTdBHkbOvfllfr+AA+7gnc50huVKYK393FOyg7rbPO/izI7hE4CnHHHnJ0ogNPRUGeUpsrZZTBJcrovUcJe51BPsr6GkJdhCCsZ6aTtMEb2pqWkqeVtDXE/QVggsU/Nl86d9RMF3DxvZTA58agu810RWawCiSzzXBeU3MMW9oyJUedvNEvQyNu1f10BSMddR1vaLCYpYa/mGocLSiYDcLbQz8aMn5iyF4xBNMs1P0QEOV7o5gaWGuzSeLue4tt3ro7y4Tgm4G/mopdZgl6q0o6KzJWE3mMksNr3r+a6CbT8g5wZNzT9O7fi/zpaOmnz3BRoqos+tv9zMbdpxsqDBOEewtJLt7cg5wtKKbvldpSzRRCD43VFheCI7yZLppggMVBS/KMAdHODJvOwq2NQSbKKKPLdFWQs7Fqo+mpl01JXYRgq8dnGLhTiFzqmWsUMdpllZdbKlyvSdYxhI9YghOtxR8LgSLWHK62mGGVoxzBE8LNWzqH9CUesQzFy5RQzTc56mhi6fgXEWwpKfE5Z7M05ZgZUPmo6auiv8YKzDYwWBLMErIbKHJvOwIrvEdhOBcQ9JdU1NHQ7CXn2XIDFBKU2WAgcX9UAUzDXWd5alwuyJ41Z9rjKLCL4aCp4WarhPm2rH+SaHUYE001JDZ2ZAzXPjdMpZWvC9wmqIB2lLhQ01D5jO06hghWMndbM7yRJMsoCj1vYbnFQVrW9jak3OlEJ3s/96+p33dEPRV5GxiqaGjIthUU6FFEZyqCa5qJrpBdzSw95IUnOPIrCUUjRZQFrbw5PR0R1qiYx3cb6nrWUMrBmmiBQxVHtTew5ICP/ip6g4hed/Akob/32wvBHsIOX83cI8hGeNeNPCIkPmXe8fPKx84OMSRM1MTdXSwjCZ4S30jVGhvqTRak/OVhgGazHuOCud5onEO1lJr6ecVyaOK6H7zqlBlIaHE0oroCgfvGJIdPcmfLNGLjpz7hZwZQpUbFME0A1cIJa7VNORkgfsMBatbKgwwJM9bSvQXeNOvbIjelg6WWvo5kvbKaJJNHexkKNHL9xRyFlH8Ti2riB5wVPhUk7nGkJnoCe428LR/wRGdYIlmWebCyxou1rCk4g/ShugBDX0V0ZQWkh0dOVsagkM0yV6OoLd5ye+pRlsCr0n+KiQrGuq5yJDzrTAXHtLUMduTDBVKrSm3eHL+6ijxhFDX9Z5gVU/wliHYTMiMFpKLNMEywu80wd3meoFmt6VbRMPenhrOc6DVe4pgXU8DnnHakLOIIrlF4FZPIw6R+zxBP0dyq6OOZ4Q5sLKCcz084ok+VsMMyQhNZmmBgX5xIXOEJTmi7VsGTvMTNdHHhpzdbE8Du2oKxgvBqQKdDDnTFOylCFaxR1syz2iqrOI/FEpNc3C6f11/7+ASS6l2inq2ciTrCCzgyemrCL5SVPjQkdPZUmGy2c9Sw9FtR1sS30RmsKPCS4rkIC/2U0MduwucYolGaPjKEyhzmiPYXagyWbYz8LWBDdzRimAXzxx4z8K9hpzlhLq+NiQ97HuKorMUfK/OVvC2JfiHUPCQI/q7J2gjK+tTDNxkCc4TMssqCs4TGtLVwQihyoAWgj9bosU80XGW6Ac9TJGziaUh5+hnFcHOnlaM1iRn29NaqGENTTTSUHCH2tWTeV0osUhH6psuVLjRUmGWhm6OZEshGeNowABHcJ2Bpy2ZszRcKkRXd2QuKVEeXnbfaEq825FguqfgfE2whlChSRMdron+LATTPQ2Z369t4B9C5gs/ylzv+CMmepIDPclFQl13W0rspPd1JOcbghGOEutqCv5qacURQl3dDKyvyJlqKXGPgcM9FfawJAMVmdcspcYKOZc4GjDYkFlK05olNMHyHn4zFNykyOxt99RkHlfwmiHo60l2EKI+mhreEKp080Tbug08BVPcgoqC5zWt+NLDTZ7oNSF51N1qie7Va3uCCwyZbkINf/NED6jzOsBdZjFN8oqG3wxVunqCSYYKf3EdhJyf9YWGf7tRU2oH3VHgPr1fe5J9hOgHd7xQ0y7qBwXr23aGErP0cm64JVjZwsOGqL+mhNgZmhJLW2oY4UhedsyBgzrCKrq7BmcpNVhR6jBPq64Vgi+kn6XE68pp8J5/+0wRHGOpsKenQn9DZntPzjRLZpDAdD2fnSgkG9tmIXnUwQ6WVighs7Yi2MxQ0N3CqYaCXkJ0oyOztMDJjmSSpcpvlrk0RMMOjmArQ04PRV1DO1FwhCVaUVPpKUM03JK5SxPsIWRu8/CGHi8UHChiqGFDTbSRJWeYUDDcH6vJWUxR4k1FXbMUwV6e4AJFXS8oMqsZKqzvYQ9DDQdZckY4aGsIhtlubbd2r3j4QBMoTamdPZk7O/Bf62lacZwneNjQoGcdVU7zJOd7ghsUHOkosagic6cnWc8+4gg285R6zZP5s1/LUbCKIznTwK36PkdwlOrl4U1LwfdCCa+IrvFkmgw1PCAUXKWo0sURXWcI2muKJlgyFzhynCY4RBOsqCjoI1R5zREco0n2Vt09BQtYSizgKNHfUmUrQ5UOCh51BFcLmY7umhYqXKQomOop8bUnWNNQcIiBcYaC6xzMNOS8JQQfeqKBmmglB+97ok/lfk3ygaHSyZaCRTzRxQo6GzLfa2jWBPepw+UmT7SQEJyiyRkhBLMVOfcoMjcK0eZChfUNzFAUzCsEN5vP/X1uP/n/aoMX+K+nw/Hjr/9xOo7j7Pju61tLcgvJpTWXNbfN5jLpi6VfCOviTktKlFusQixdEKWmEBUKNaIpjZRSSOXSgzaaKLdabrm1/9nZ+/f+vd/vz/v9+Xy+zZ7PRorYoZqyLrCwQdEAixxVOEXNNnjX2nUSRlkqGmWowk8lxR50JPy9Bo6qJXaXwNvREBvnThPEPrewryLhcAnj5WE15Fqi8W7R1sAuEu86S4ENikItFN4xkv9Af4nXSnUVcLiA9xzesFpivRRVeFKtsMRaKBhuSbjOELnAUtlSQUpXgdfB4Z1oSbnFEetbQ0IrAe+Y+pqnDcEJFj6S8LDZzZHwY4e3XONNlARraomNEt2bkvGsosA3ioyHm+6jCMbI59wqt4eeara28IzEmyPgoRaUOEDhTVdEJhmCoTWfC0p8aNkCp0oYqih2iqGi4yXeMkOsn4LdLLnmKfh/YogjNsPebeFGR4m9BJHLzB61XQ3BtpISfS2FugsK9FAtLWX1dCRcrCnUp44CNzuCowUZmxSRgYaE6Za0W2u/E7CVXCiI/UOR8aAm1+OSyE3mOUcwyc1zBBeoX1kiKy0Zfxck1Gsyulti11i83QTBF5Kg3pDQThFMVHiPSlK+0cSedng/VaS8bOZbtsBcTcZAR8JP5KeqQ1OYKAi20njdNNRpgnsU//K+JnaXJaGTomr7aYIphoRn9aeShJWKEq9LcozSF7QleEfDI5LYm5bgVkFkRwVDBCVu0DDIkGupo8TZBq+/pMQURYErJQmPKGKjNDkWOLx7Jd5QizdUweIaKrlP7SwJDhZvONjLkOsBBX9UpGxnydhXkfBLQ8IxgojQbLFnJf81JytSljclYYyEFyx0kVBvKWOFJmONpshGAcsduQY5giVNCV51eOdJYo/pLhbvM0uDHSevNKRcrKZIqnCtJeEsO95RoqcgGK4ocZcho1tTYtcZvH41pNQ7vA0WrhIfOSraIIntIAi+NXWCErdbkvrWwjRLrt0NKUdL6KSOscTOdMSOUtBHwL6OLA0vNSdynaWQEnCpIvKaIrJJEbvHkmuNhn6OjM8VkSGSqn1uYJCGHnq9I3aLhNME3t6GjIkO7xrNFumpyTNX/NrwX7CrIRiqqWijI9JO4d1iieykyfiposQIQ8YjjsjlBh6oHWbwRjgYJQn2NgSnNycmJAk3NiXhx44Sxykihxm8ybUwT1OVKySc7vi3OXVkdBJ4AyXBeksDXG0IhgtYY0lY5ahCD0ehborIk5aUWRJviMA7Xt5kyRjonrXENkm8yYqgs8VzgrJmClK20uMM3jRJ0FiQICQF9hdETlLQWRIb5ki6WDfWRPobvO6a4GP5mcOrNzDFELtTkONLh9dXE8xypEg7z8A9jkhrQ6Fhjlg/QVktJXxt4WXzT/03Q8IaQWSqIuEvloQ2mqC9Jfi7wRul4RX3pSPlzpoVlmCtI2jvKHCFhjcM3sN6lqF6HxnKelLjXWbwrpR4xzuCrTUZx2qq9oAh8p6ixCUGr78g8oyjRAtB5CZFwi80VerVpI0h+IeBxa6Zg6kWvpDHaioYYuEsRbDC3eOmC2JvGYLeioxGknL2UATNJN6hmtj1DlpLvDVmocYbrGCVJKOrg4X6DgddLA203BKMFngdJJFtFd7vJLm6KEpc5yjQrkk7M80SGe34X24nSex1Ra5Omgb71JKyg8SrU3i/kARKwWpH0kOGhKkObyfd0ZGjvyXlAkVZ4xRbYJ2irFMkFY1SwyWxr2oo4zlNiV+7zmaweFpT4kR3kaDAFW6xpSqzJay05FtYR4HmZhc9UxKbbfF2V8RG1MBmSaE+kmC6JnaRXK9gsiXhJHl/U0qM0WTcbyhwkYIvFGwjSbjfwhiJt8ZSQU+Bd5+marPMOkVkD0muxYLIfEuhh60x/J92itguihJSEMySVPQnTewnEm+620rTQEMsOfo4/kP/0ARvWjitlpSX7GxBgcMEsd3EEeYWvdytd+Saawi6aCIj1CkGb6Aj9rwhx16Cf3vAwFy5pyLhVonXzy51FDpdEblbkdJbUcEPDEFzQ8qNmhzzLTmmKWKbFCXeEuRabp6rxbvAtLF442QjQ+wEA9eL1xSR7Q0JXzlSHjJ4exq89yR0laScJ/FW6z4a73pFMEfDiRZvuvijIt86RaSFOl01riV2mD1UEvxGk/Geg5aWwGki1zgKPG9J2U8PEg8qYvMsZeytiTRXBMslCU8JSlxi8EabjwUldlDNLfzTUmCgxWsjqWCOHavYAqsknKFIO0yQ61VL5AVFxk6WhEaCAkdJgt9aSkzXlKNX2jEa79waYuc7gq0N3GDJGCBhoiTXUEPsdknCUE1CK0fwsiaylSF2uiDyO4XX3pFhNd7R4itFGc0k/ElBZwWvq+GC6szVeEoS/MZ+qylwpKNKv9Z469UOjqCjwlusicyTxG6VpNxcQ8IncoR4RhLbR+NdpGGmJWOcIzJGUuKPGpQg8rrG21dOMqQssJQ4RxH5jaUqnZuQ0F4Q+cjxLwPtpZbIAk3QTJHQWBE5S1BokoVtDd6lhqr9UpHSUxMcIYl9pojsb8h4SBOsMQcqvOWC2E8EVehqiJ1hrrAEbQxeK0NGZ0Gkq+guSRgniM23bIHVkqwx4hiHd7smaOyglyIyQuM978j4VS08J/A2G1KeMBRo4fBaSNhKUEZfQewVQ/C1I+MgfbEleEzCUw7mKXI0M3hd1EESVji8x5uQ41nxs1q4RMJCCXs7Iq9acpxn22oSDnQ/sJTxsCbHIYZiLyhY05TY0ZLIOQrGaSJDDN4t8pVaIrsqqFdEegtizc1iTew5Q4ayBDMUsQMkXocaYkc0hZua412siZ1rSXlR460zRJ5SlHGe5j801RLMlJTxtaOM3Q1pvxJ45zUlWFD7rsAbpfEm1JHxG0eh8w2R7QQVzBUw28FhFp5QZzq8t2rx2joqulYTWSuJdTYfWwqMFMcovFmSyJPNyLhE4E10pHzYjOC3huArRa571ZsGajQpQx38SBP5pyZB6lMU3khDnp0MBV51BE9o2E+TY5Ml2E8S7C0o6w1xvCZjf0HkVEHCzFoyNmqC+9wdcqN+Tp7jSDheE9ws8Y5V0NJCn2bk2tqSY4okdrEhx1iDN8cSudwepWmAGXKcJXK65H9to8jYQRH7SBF01ESUJdd0TayVInaWhLkOjlXE5irKGOnI6GSWGCJa482zBI9rCr0jyTVcEuzriC1vcr6mwFGSiqy5zMwxBH/TJHwjSPhL8+01kaaSUuMFKTcLEvaUePcrSmwn8DZrgikWb7CGPxkSjhQwrRk57tctmxLsb9sZvL9LSlyuSLlWkqOjwduo8b6Uv1DkmudIeFF2dHCgxVtk8dpIvHpBxhEOdhKk7OLIUSdJ+cSRY57B+0DgGUUlNfpthTfGkauzxrvTsUUaCVhlKeteTXCoJDCa2NOKhOmC4G1H8JBd4OBZReSRGkqcb/CO1PyLJTLB4j1q8JYaIutEjSLX8YKM+a6phdMsdLFUoV5RTm9JSkuDN8WcIon0NZMNZWh1q8C7SJEwV5HxrmnnTrf3KoJBlmCYI2ilSLlfEvlE4011NNgjgthzEua0oKK7JLE7HZHlEl60BLMVFewg4EWNt0ThrVNEVkkiTwpKXSWJzdRENgvKGq4IhjsiezgSFtsfCUq8qki5S1LRQeYQQ4nemmCkImWMw3tFUoUBZk4NOeZYEp4XRKTGa6wJjrWNHBVJR4m3FCnbuD6aak2WsMTh3SZImGCIPKNgsDpVwnsa70K31lCFJZYcwwSMFcQulGTsZuEaSdBXkPGZhu0FsdUO73RHjq8MPGGIfaGIbVTk6iuI3GFgucHrIQkmWSJdBd7BBu+uOryWAhY7+Lki9rK5wtEQzWwvtbqGhIMFwWRJsElsY4m9IIg9L6lCX0VklaPAYkfkZEGDnOWowlBJjtMUkcGK4Lg6EtoZInMUBVYLgn0UsdmCyCz7gIGHFfk+k1QwTh5We7A9x+IdJ6CvIkEagms0hR50eH9UnTQJ+2oiKyVlLFUE+8gBGu8MQ3CppUHesnjTHN4QB/UGPhCTHLFPHMFrCqa73gqObUJGa03wgbhHkrCfpEpzNLE7JDS25FMKhlhKKWKfCgqstLCPu1zBXy0J2ztwjtixBu8UTRn9LVtkmCN2iyFhtME70JHRQ1KVZXqKI/KNIKYMCYs1GUMEKbM1bKOI9LDXC7zbHS+bt+1MTWS9odA9DtrYtpbImQJ2VHh/lisEwaHqUk1kjKTAKknkBEXkbkdMGwq0dnhzLJF3NJH3JVwrqOB4Sca2hti75nmJN0WzxS6UxDYoEpxpa4htVlRjkYE7DZGzJVU72uC9IyhQL4i8YfGWSYLLNcHXloyz7QhNifmKSE9JgfGmuyLhc403Xm9vqcp6gXe3xuuv8F6VJNxkyTHEkHG2g0aKXL0MsXc1bGfgas2//dCONXiNLCX+5mB7eZIl1kHh7ajwpikyzlUUWOVOsjSQlsS+M0R+pPje/dzBXRZGO0rMtgQrLLG9VSu9n6CMXS3BhwYmSoIBhsjNBmZbgusE9BCPCP5triU4VhNbJfE+swSP27aayE8tuTpYYjtrYjMVGZdp2NpS1s6aBnKSHDsbKuplKbHM4a0wMFd/5/DmGyKrJSUaW4IBrqUhx0vyfzTBBLPIUcnZdrAkNsKR0sWRspumSns6Ch0v/qqIbBYUWKvPU/CFoyrDJGwSNFhbA/MlzKqjrO80hRbpKx0Jewsi/STftwGSlKc1JZyAzx05dhLEdnfQvhZOqiHWWEAHC7+30FuRcZUgaO5gpaIK+xsiHRUsqaPElTV40xQZQ107Q9BZE1nryDVGU9ZSQ47bmhBpLcYpUt7S+xuK/FiT8qKjwXYw5ypS2iuCv7q1gtgjhuBuB8LCFY5cUuCNtsQOFcT+4Ih9JX+k8Ea6v0iCIRZOtCT0Et00JW5UeC85Cg0ScK0k411HcG1zKtre3SeITBRk7WfwDhEvaYLTHP9le0m8By0JDwn4TlLW/aJOvGHxdjYUes+ScZigCkYQdNdEOhkiezgShqkx8ueKjI8lDfK2oNiOFvrZH1hS+tk7NV7nOmLHicGWEgubkXKdwdtZknCLJXaCpkrjZBtLZFsDP9CdxWsSr05Sxl6CMmoFbCOgryX40uDtamB7SVmXW4Ihlgpmq+00tBKUUa83WbjLUNkzDmY7cow1JDygyPGlhgGKYKz4vcV7QBNbJIgM11TUqZaMdwTeSguH6rOaw1JRKzaaGyxVm2EJ/uCIrVWUcZUkcp2grMsEjK+DMwS59jQk3Kd6SEq1d0S6uVmO4Bc1lDXTUcHjluCXEq+1OlBDj1pi9zgiXxnKuE0SqTXwhqbETW6RggMEnGl/q49UT2iCzgJvRwVXS2K/d6+ZkyUl7jawSVLit46EwxVljDZwoSQ20sDBihztHfk2yA8NVZghiXwrYHQdfKAOtzsayjhY9bY0yE2CWEeJ9xfzO423xhL5syS2TFJofO2pboHob0nY4GiAgRrvGQEDa/FWSsoaaYl0syRsEt3kWoH3B01shCXhTUWe9w3Bt44SC9QCh3eShQctwbaK2ApLroGCMlZrYqvlY3qYhM0aXpFkPOuoqJ3Dm6fxXrGwVF9gCWZagjPqznfkuMKQ8DPTQRO8ZqG1hPGKEm9IgpGW4DZDgTNriTxvFiq+Lz+0cKfp4wj6OCK9JSnzNSn9LFU7UhKZZMnYwcJ8s8yRsECScK4j5UOB95HFO0CzhY4xJxuCix0lDlEUeMdS6EZBkTsUkZ4K74dugyTXS7aNgL8aqjDfkCE0ZbwkCXpaWCKhl8P7VD5jxykivSyxyZrYERbe168LYu9ZYh86IkscgVLE7tWPKmJv11CgoyJltMEbrohtVAQfO4ImltiHEroYEs7RxAarVpY8AwXMcMReFOTYWe5iiLRQxJ5Q8DtJ8LQhWOhIeFESPGsILhbNDRljNbHzNRlTFbk2S3L0NOS6V1KFJYKUbSTcIIhM0wQ/s2TM0SRMNcQmSap3jCH4yhJZKSkwyRHpYYgsFeQ4U7xoCB7VVOExhXepo9ABBsYbvGWKXPME3lyH95YioZ0gssQRWWbI+FaSMkXijZXwgiTlYdPdkNLaETxlyDVIwqeaEus0aTcYcg0RVOkpR3CSJqIddK+90JCxzsDVloyrFd5ZAr4TBKfaWa6boEA7C7s6EpYaeFPjveooY72mjIccLHJ9HUwVlDhKkmutJDJBwnp1rvulJZggKDRfbXAkvC/4l3ozQOG9a8lxjx0i7nV4jSXc7vhe3OwIxjgSHjdEhhsif9YkPGlus3iLFDnWOFhtCZbJg0UbQcIaR67JjthoCyMEZRwhiXWyxO5QxI6w5NhT4U1WsJvDO60J34fW9hwzwlKij6ZAW9ne4L0s8C6XeBMEkd/LQy1VucBRot6QMlbivaBhoBgjqGiCJNhsqVp/S2SsG6DIONCR0dXhvWbJ+MRRZJkkuEjgDXJjFQW6SSL7GXK8Z2CZg7cVsbWGoKmEpzQ5elpiy8Ryg7dMkLLUEauzeO86CuwlSOlgYLojZWeJ9xM3S1PWfEfKl5ISLQ0MEKR8YOB2QfCxJBjrKPCN4f9MkaSsqoVXJBmP7EpFZ9UQfOoOFwSzBN4MQ8LsGrymlipcJQhmy0GaQjPqCHaXRwuCZwRbqK2Fg9wlClZqYicrIgMdZfxTQ0c7TBIbrChxmuzoKG8XRaSrIhhiyNFJkrC7oIAWMEOQa5aBekPCRknCo4IKPrYkvCDI8aYmY7WFtprgekcJZ3oLIqssCSMtFbQTJKwXYy3BY5oCh2iKPCpJOE+zRdpYgi6O2KmOAgvVCYaU4ySRek1sgyFhJ403QFHiVEmJHwtybO1gs8Hr5+BETQX3War0qZngYGgtVZtoqd6vFSk/UwdZElYqyjrF4HXUeFspIi9IGKf4j92pKGAdCYMVsbcV3kRF0N+R8LUd5PCsIGWoxDtBkCI0nKofdJQxT+LtZflvuc8Q3CjwWkq8KwUpHzkK/NmSsclCL0nseQdj5FRH5CNHSgtLiW80Of5HU9Hhlsga9bnBq3fEVltKfO5IaSTmGjjc4J0otcP7QsJUSQM8pEj5/wCuUuC2DWz8AAAAAElFTkSuQmCC"); } diff --git a/web/editor.md/lib/codemirror/theme/base16-dark.css b/web/editor.md/lib/codemirror/theme/base16-dark.css index b009d2b..4e8c146 100644 --- a/web/editor.md/lib/codemirror/theme/base16-dark.css +++ b/web/editor.md/lib/codemirror/theme/base16-dark.css @@ -8,31 +8,102 @@ */ -.cm-s-base16-dark.CodeMirror {background: #151515; color: #e0e0e0;} -.cm-s-base16-dark div.CodeMirror-selected {background: #303030 !important;} -.cm-s-base16-dark.CodeMirror ::selection { background: rgba(48, 48, 48, .99); } -.cm-s-base16-dark.CodeMirror ::-moz-selection { background: rgba(48, 48, 48, .99); } -.cm-s-base16-dark .CodeMirror-gutters {background: #151515; border-right: 0px;} -.cm-s-base16-dark .CodeMirror-guttermarker { color: #ac4142; } -.cm-s-base16-dark .CodeMirror-guttermarker-subtle { color: #505050; } -.cm-s-base16-dark .CodeMirror-linenumber {color: #505050;} -.cm-s-base16-dark .CodeMirror-cursor {border-left: 1px solid #b0b0b0 !important;} - -.cm-s-base16-dark span.cm-comment {color: #8f5536;} -.cm-s-base16-dark span.cm-atom {color: #aa759f;} -.cm-s-base16-dark span.cm-number {color: #aa759f;} - -.cm-s-base16-dark span.cm-property, .cm-s-base16-dark span.cm-attribute {color: #90a959;} -.cm-s-base16-dark span.cm-keyword {color: #ac4142;} -.cm-s-base16-dark span.cm-string {color: #f4bf75;} - -.cm-s-base16-dark span.cm-variable {color: #90a959;} -.cm-s-base16-dark span.cm-variable-2 {color: #6a9fb5;} -.cm-s-base16-dark span.cm-def {color: #d28445;} -.cm-s-base16-dark span.cm-bracket {color: #e0e0e0;} -.cm-s-base16-dark span.cm-tag {color: #ac4142;} -.cm-s-base16-dark span.cm-link {color: #aa759f;} -.cm-s-base16-dark span.cm-error {background: #ac4142; color: #b0b0b0;} - -.cm-s-base16-dark .CodeMirror-activeline-background {background: #202020 !important;} -.cm-s-base16-dark .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} +.cm-s-base16-dark.CodeMirror { + background: #151515; + color: #e0e0e0; +} + +.cm-s-base16-dark div.CodeMirror-selected { + background: #303030 !important; +} + +.cm-s-base16-dark.CodeMirror ::selection { + background: rgba(48, 48, 48, .99); +} + +.cm-s-base16-dark.CodeMirror ::-moz-selection { + background: rgba(48, 48, 48, .99); +} + +.cm-s-base16-dark .CodeMirror-gutters { + background: #151515; + border-right: 0px; +} + +.cm-s-base16-dark .CodeMirror-guttermarker { + color: #ac4142; +} + +.cm-s-base16-dark .CodeMirror-guttermarker-subtle { + color: #505050; +} + +.cm-s-base16-dark .CodeMirror-linenumber { + color: #505050; +} + +.cm-s-base16-dark .CodeMirror-cursor { + border-left: 1px solid #b0b0b0 !important; +} + +.cm-s-base16-dark span.cm-comment { + color: #8f5536; +} + +.cm-s-base16-dark span.cm-atom { + color: #aa759f; +} + +.cm-s-base16-dark span.cm-number { + color: #aa759f; +} + +.cm-s-base16-dark span.cm-property, .cm-s-base16-dark span.cm-attribute { + color: #90a959; +} + +.cm-s-base16-dark span.cm-keyword { + color: #ac4142; +} + +.cm-s-base16-dark span.cm-string { + color: #f4bf75; +} + +.cm-s-base16-dark span.cm-variable { + color: #90a959; +} + +.cm-s-base16-dark span.cm-variable-2 { + color: #6a9fb5; +} + +.cm-s-base16-dark span.cm-def { + color: #d28445; +} + +.cm-s-base16-dark span.cm-bracket { + color: #e0e0e0; +} + +.cm-s-base16-dark span.cm-tag { + color: #ac4142; +} + +.cm-s-base16-dark span.cm-link { + color: #aa759f; +} + +.cm-s-base16-dark span.cm-error { + background: #ac4142; + color: #b0b0b0; +} + +.cm-s-base16-dark .CodeMirror-activeline-background { + background: #202020 !important; +} + +.cm-s-base16-dark .CodeMirror-matchingbracket { + text-decoration: underline; + color: white !important; +} diff --git a/web/editor.md/lib/codemirror/theme/base16-light.css b/web/editor.md/lib/codemirror/theme/base16-light.css index 15df6d3..de7fb6f 100644 --- a/web/editor.md/lib/codemirror/theme/base16-light.css +++ b/web/editor.md/lib/codemirror/theme/base16-light.css @@ -8,31 +8,102 @@ */ -.cm-s-base16-light.CodeMirror {background: #f5f5f5; color: #202020;} -.cm-s-base16-light div.CodeMirror-selected {background: #e0e0e0 !important;} -.cm-s-base16-light.CodeMirror ::selection { background: #e0e0e0; } -.cm-s-base16-light.CodeMirror ::-moz-selection { background: #e0e0e0; } -.cm-s-base16-light .CodeMirror-gutters {background: #f5f5f5; border-right: 0px;} -.cm-s-base16-light .CodeMirror-guttermarker { color: #ac4142; } -.cm-s-base16-light .CodeMirror-guttermarker-subtle { color: #b0b0b0; } -.cm-s-base16-light .CodeMirror-linenumber {color: #b0b0b0;} -.cm-s-base16-light .CodeMirror-cursor {border-left: 1px solid #505050 !important;} - -.cm-s-base16-light span.cm-comment {color: #8f5536;} -.cm-s-base16-light span.cm-atom {color: #aa759f;} -.cm-s-base16-light span.cm-number {color: #aa759f;} - -.cm-s-base16-light span.cm-property, .cm-s-base16-light span.cm-attribute {color: #90a959;} -.cm-s-base16-light span.cm-keyword {color: #ac4142;} -.cm-s-base16-light span.cm-string {color: #f4bf75;} - -.cm-s-base16-light span.cm-variable {color: #90a959;} -.cm-s-base16-light span.cm-variable-2 {color: #6a9fb5;} -.cm-s-base16-light span.cm-def {color: #d28445;} -.cm-s-base16-light span.cm-bracket {color: #202020;} -.cm-s-base16-light span.cm-tag {color: #ac4142;} -.cm-s-base16-light span.cm-link {color: #aa759f;} -.cm-s-base16-light span.cm-error {background: #ac4142; color: #505050;} - -.cm-s-base16-light .CodeMirror-activeline-background {background: #DDDCDC !important;} -.cm-s-base16-light .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} +.cm-s-base16-light.CodeMirror { + background: #f5f5f5; + color: #202020; +} + +.cm-s-base16-light div.CodeMirror-selected { + background: #e0e0e0 !important; +} + +.cm-s-base16-light.CodeMirror ::selection { + background: #e0e0e0; +} + +.cm-s-base16-light.CodeMirror ::-moz-selection { + background: #e0e0e0; +} + +.cm-s-base16-light .CodeMirror-gutters { + background: #f5f5f5; + border-right: 0px; +} + +.cm-s-base16-light .CodeMirror-guttermarker { + color: #ac4142; +} + +.cm-s-base16-light .CodeMirror-guttermarker-subtle { + color: #b0b0b0; +} + +.cm-s-base16-light .CodeMirror-linenumber { + color: #b0b0b0; +} + +.cm-s-base16-light .CodeMirror-cursor { + border-left: 1px solid #505050 !important; +} + +.cm-s-base16-light span.cm-comment { + color: #8f5536; +} + +.cm-s-base16-light span.cm-atom { + color: #aa759f; +} + +.cm-s-base16-light span.cm-number { + color: #aa759f; +} + +.cm-s-base16-light span.cm-property, .cm-s-base16-light span.cm-attribute { + color: #90a959; +} + +.cm-s-base16-light span.cm-keyword { + color: #ac4142; +} + +.cm-s-base16-light span.cm-string { + color: #f4bf75; +} + +.cm-s-base16-light span.cm-variable { + color: #90a959; +} + +.cm-s-base16-light span.cm-variable-2 { + color: #6a9fb5; +} + +.cm-s-base16-light span.cm-def { + color: #d28445; +} + +.cm-s-base16-light span.cm-bracket { + color: #202020; +} + +.cm-s-base16-light span.cm-tag { + color: #ac4142; +} + +.cm-s-base16-light span.cm-link { + color: #aa759f; +} + +.cm-s-base16-light span.cm-error { + background: #ac4142; + color: #505050; +} + +.cm-s-base16-light .CodeMirror-activeline-background { + background: #DDDCDC !important; +} + +.cm-s-base16-light .CodeMirror-matchingbracket { + text-decoration: underline; + color: white !important; +} diff --git a/web/editor.md/lib/codemirror/theme/blackboard.css b/web/editor.md/lib/codemirror/theme/blackboard.css index 02289b6..007d747 100644 --- a/web/editor.md/lib/codemirror/theme/blackboard.css +++ b/web/editor.md/lib/codemirror/theme/blackboard.css @@ -1,32 +1,117 @@ /* Port of TextMate's Blackboard theme */ -.cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; } -.cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; } -.cm-s-blackboard.CodeMirror ::selection { background: rgba(37, 59, 118, .99); } -.cm-s-blackboard.CodeMirror ::-moz-selection { background: rgba(37, 59, 118, .99); } -.cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; } -.cm-s-blackboard .CodeMirror-guttermarker { color: #FBDE2D; } -.cm-s-blackboard .CodeMirror-guttermarker-subtle { color: #888; } -.cm-s-blackboard .CodeMirror-linenumber { color: #888; } -.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; } - -.cm-s-blackboard .cm-keyword { color: #FBDE2D; } -.cm-s-blackboard .cm-atom { color: #D8FA3C; } -.cm-s-blackboard .cm-number { color: #D8FA3C; } -.cm-s-blackboard .cm-def { color: #8DA6CE; } -.cm-s-blackboard .cm-variable { color: #FF6400; } -.cm-s-blackboard .cm-operator { color: #FBDE2D;} -.cm-s-blackboard .cm-comment { color: #AEAEAE; } -.cm-s-blackboard .cm-string { color: #61CE3C; } -.cm-s-blackboard .cm-string-2 { color: #61CE3C; } -.cm-s-blackboard .cm-meta { color: #D8FA3C; } -.cm-s-blackboard .cm-builtin { color: #8DA6CE; } -.cm-s-blackboard .cm-tag { color: #8DA6CE; } -.cm-s-blackboard .cm-attribute { color: #8DA6CE; } -.cm-s-blackboard .cm-header { color: #FF6400; } -.cm-s-blackboard .cm-hr { color: #AEAEAE; } -.cm-s-blackboard .cm-link { color: #8DA6CE; } -.cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; } - -.cm-s-blackboard .CodeMirror-activeline-background {background: #3C3636 !important;} -.cm-s-blackboard .CodeMirror-matchingbracket {outline:1px solid grey;color:white !important} \ No newline at end of file +.cm-s-blackboard.CodeMirror { + background: #0C1021; + color: #F8F8F8; +} + +.cm-s-blackboard .CodeMirror-selected { + background: #253B76 !important; +} + +.cm-s-blackboard.CodeMirror ::selection { + background: rgba(37, 59, 118, .99); +} + +.cm-s-blackboard.CodeMirror ::-moz-selection { + background: rgba(37, 59, 118, .99); +} + +.cm-s-blackboard .CodeMirror-gutters { + background: #0C1021; + border-right: 0; +} + +.cm-s-blackboard .CodeMirror-guttermarker { + color: #FBDE2D; +} + +.cm-s-blackboard .CodeMirror-guttermarker-subtle { + color: #888; +} + +.cm-s-blackboard .CodeMirror-linenumber { + color: #888; +} + +.cm-s-blackboard .CodeMirror-cursor { + border-left: 1px solid #A7A7A7 !important; +} + +.cm-s-blackboard .cm-keyword { + color: #FBDE2D; +} + +.cm-s-blackboard .cm-atom { + color: #D8FA3C; +} + +.cm-s-blackboard .cm-number { + color: #D8FA3C; +} + +.cm-s-blackboard .cm-def { + color: #8DA6CE; +} + +.cm-s-blackboard .cm-variable { + color: #FF6400; +} + +.cm-s-blackboard .cm-operator { + color: #FBDE2D; +} + +.cm-s-blackboard .cm-comment { + color: #AEAEAE; +} + +.cm-s-blackboard .cm-string { + color: #61CE3C; +} + +.cm-s-blackboard .cm-string-2 { + color: #61CE3C; +} + +.cm-s-blackboard .cm-meta { + color: #D8FA3C; +} + +.cm-s-blackboard .cm-builtin { + color: #8DA6CE; +} + +.cm-s-blackboard .cm-tag { + color: #8DA6CE; +} + +.cm-s-blackboard .cm-attribute { + color: #8DA6CE; +} + +.cm-s-blackboard .cm-header { + color: #FF6400; +} + +.cm-s-blackboard .cm-hr { + color: #AEAEAE; +} + +.cm-s-blackboard .cm-link { + color: #8DA6CE; +} + +.cm-s-blackboard .cm-error { + background: #9D1E15; + color: #F8F8F8; +} + +.cm-s-blackboard .CodeMirror-activeline-background { + background: #3C3636 !important; +} + +.cm-s-blackboard .CodeMirror-matchingbracket { + outline: 1px solid grey; + color: white !important +} \ No newline at end of file diff --git a/web/editor.md/lib/codemirror/theme/cobalt.css b/web/editor.md/lib/codemirror/theme/cobalt.css index 3915589..b481389 100644 --- a/web/editor.md/lib/codemirror/theme/cobalt.css +++ b/web/editor.md/lib/codemirror/theme/cobalt.css @@ -1,25 +1,94 @@ -.cm-s-cobalt.CodeMirror { background: #002240; color: white; } -.cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; } -.cm-s-cobalt.CodeMirror ::selection { background: rgba(179, 101, 57, .99); } -.cm-s-cobalt.CodeMirror ::-moz-selection { background: rgba(179, 101, 57, .99); } -.cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } -.cm-s-cobalt .CodeMirror-guttermarker { color: #ffee80; } -.cm-s-cobalt .CodeMirror-guttermarker-subtle { color: #d0d0d0; } -.cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; } -.cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; } - -.cm-s-cobalt span.cm-comment { color: #08f; } -.cm-s-cobalt span.cm-atom { color: #845dc4; } -.cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; } -.cm-s-cobalt span.cm-keyword { color: #ffee80; } -.cm-s-cobalt span.cm-string { color: #3ad900; } -.cm-s-cobalt span.cm-meta { color: #ff9d00; } -.cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; } -.cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; } -.cm-s-cobalt span.cm-bracket { color: #d8d8d8; } -.cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; } -.cm-s-cobalt span.cm-link { color: #845dc4; } -.cm-s-cobalt span.cm-error { color: #9d1e15; } - -.cm-s-cobalt .CodeMirror-activeline-background {background: #002D57 !important;} -.cm-s-cobalt .CodeMirror-matchingbracket {outline:1px solid grey;color:white !important} +.cm-s-cobalt.CodeMirror { + background: #002240; + color: white; +} + +.cm-s-cobalt div.CodeMirror-selected { + background: #b36539 !important; +} + +.cm-s-cobalt.CodeMirror ::selection { + background: rgba(179, 101, 57, .99); +} + +.cm-s-cobalt.CodeMirror ::-moz-selection { + background: rgba(179, 101, 57, .99); +} + +.cm-s-cobalt .CodeMirror-gutters { + background: #002240; + border-right: 1px solid #aaa; +} + +.cm-s-cobalt .CodeMirror-guttermarker { + color: #ffee80; +} + +.cm-s-cobalt .CodeMirror-guttermarker-subtle { + color: #d0d0d0; +} + +.cm-s-cobalt .CodeMirror-linenumber { + color: #d0d0d0; +} + +.cm-s-cobalt .CodeMirror-cursor { + border-left: 1px solid white !important; +} + +.cm-s-cobalt span.cm-comment { + color: #08f; +} + +.cm-s-cobalt span.cm-atom { + color: #845dc4; +} + +.cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { + color: #ff80e1; +} + +.cm-s-cobalt span.cm-keyword { + color: #ffee80; +} + +.cm-s-cobalt span.cm-string { + color: #3ad900; +} + +.cm-s-cobalt span.cm-meta { + color: #ff9d00; +} + +.cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { + color: #9effff; +} + +.cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { + color: white; +} + +.cm-s-cobalt span.cm-bracket { + color: #d8d8d8; +} + +.cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { + color: #ff9e59; +} + +.cm-s-cobalt span.cm-link { + color: #845dc4; +} + +.cm-s-cobalt span.cm-error { + color: #9d1e15; +} + +.cm-s-cobalt .CodeMirror-activeline-background { + background: #002D57 !important; +} + +.cm-s-cobalt .CodeMirror-matchingbracket { + outline: 1px solid grey; + color: white !important +} diff --git a/web/editor.md/lib/codemirror/theme/colorforth.css b/web/editor.md/lib/codemirror/theme/colorforth.css index 73fbf80..03251f3 100644 --- a/web/editor.md/lib/codemirror/theme/colorforth.css +++ b/web/editor.md/lib/codemirror/theme/colorforth.css @@ -1,33 +1,108 @@ -.cm-s-colorforth.CodeMirror { background: #000000; color: #f8f8f8; } -.cm-s-colorforth .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } -.cm-s-colorforth .CodeMirror-guttermarker { color: #FFBD40; } -.cm-s-colorforth .CodeMirror-guttermarker-subtle { color: #78846f; } -.cm-s-colorforth .CodeMirror-linenumber { color: #bababa; } -.cm-s-colorforth .CodeMirror-cursor { border-left: 1px solid white !important; } - -.cm-s-colorforth span.cm-comment { color: #ededed; } -.cm-s-colorforth span.cm-def { color: #ff1c1c; font-weight:bold; } -.cm-s-colorforth span.cm-keyword { color: #ffd900; } -.cm-s-colorforth span.cm-builtin { color: #00d95a; } -.cm-s-colorforth span.cm-variable { color: #73ff00; } -.cm-s-colorforth span.cm-string { color: #007bff; } -.cm-s-colorforth span.cm-number { color: #00c4ff; } -.cm-s-colorforth span.cm-atom { color: #606060; } - -.cm-s-colorforth span.cm-variable-2 { color: #EEE; } -.cm-s-colorforth span.cm-variable-3 { color: #DDD; } -.cm-s-colorforth span.cm-property {} -.cm-s-colorforth span.cm-operator {} - -.cm-s-colorforth span.cm-meta { color: yellow; } -.cm-s-colorforth span.cm-qualifier { color: #FFF700; } -.cm-s-colorforth span.cm-bracket { color: #cc7; } -.cm-s-colorforth span.cm-tag { color: #FFBD40; } -.cm-s-colorforth span.cm-attribute { color: #FFF700; } -.cm-s-colorforth span.cm-error { color: #f00; } - -.cm-s-colorforth .CodeMirror-selected { background: #333d53 !important; } - -.cm-s-colorforth span.cm-compilation { background: rgba(255, 255, 255, 0.12); } - -.cm-s-colorforth .CodeMirror-activeline-background {background: #253540 !important;} +.cm-s-colorforth.CodeMirror { + background: #000000; + color: #f8f8f8; +} + +.cm-s-colorforth .CodeMirror-gutters { + background: #0a001f; + border-right: 1px solid #aaa; +} + +.cm-s-colorforth .CodeMirror-guttermarker { + color: #FFBD40; +} + +.cm-s-colorforth .CodeMirror-guttermarker-subtle { + color: #78846f; +} + +.cm-s-colorforth .CodeMirror-linenumber { + color: #bababa; +} + +.cm-s-colorforth .CodeMirror-cursor { + border-left: 1px solid white !important; +} + +.cm-s-colorforth span.cm-comment { + color: #ededed; +} + +.cm-s-colorforth span.cm-def { + color: #ff1c1c; + font-weight: bold; +} + +.cm-s-colorforth span.cm-keyword { + color: #ffd900; +} + +.cm-s-colorforth span.cm-builtin { + color: #00d95a; +} + +.cm-s-colorforth span.cm-variable { + color: #73ff00; +} + +.cm-s-colorforth span.cm-string { + color: #007bff; +} + +.cm-s-colorforth span.cm-number { + color: #00c4ff; +} + +.cm-s-colorforth span.cm-atom { + color: #606060; +} + +.cm-s-colorforth span.cm-variable-2 { + color: #EEE; +} + +.cm-s-colorforth span.cm-variable-3 { + color: #DDD; +} + +.cm-s-colorforth span.cm-property { +} + +.cm-s-colorforth span.cm-operator { +} + +.cm-s-colorforth span.cm-meta { + color: yellow; +} + +.cm-s-colorforth span.cm-qualifier { + color: #FFF700; +} + +.cm-s-colorforth span.cm-bracket { + color: #cc7; +} + +.cm-s-colorforth span.cm-tag { + color: #FFBD40; +} + +.cm-s-colorforth span.cm-attribute { + color: #FFF700; +} + +.cm-s-colorforth span.cm-error { + color: #f00; +} + +.cm-s-colorforth .CodeMirror-selected { + background: #333d53 !important; +} + +.cm-s-colorforth span.cm-compilation { + background: rgba(255, 255, 255, 0.12); +} + +.cm-s-colorforth .CodeMirror-activeline-background { + background: #253540 !important; +} diff --git a/web/editor.md/lib/codemirror/theme/eclipse.css b/web/editor.md/lib/codemirror/theme/eclipse.css index 317218e..367fbb5 100644 --- a/web/editor.md/lib/codemirror/theme/eclipse.css +++ b/web/editor.md/lib/codemirror/theme/eclipse.css @@ -1,23 +1,90 @@ -.cm-s-eclipse span.cm-meta {color: #FF1717;} -.cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; } -.cm-s-eclipse span.cm-atom {color: #219;} -.cm-s-eclipse span.cm-number {color: #164;} -.cm-s-eclipse span.cm-def {color: #00f;} -.cm-s-eclipse span.cm-variable {color: black;} -.cm-s-eclipse span.cm-variable-2 {color: #0000C0;} -.cm-s-eclipse span.cm-variable-3 {color: #0000C0;} -.cm-s-eclipse span.cm-property {color: black;} -.cm-s-eclipse span.cm-operator {color: black;} -.cm-s-eclipse span.cm-comment {color: #3F7F5F;} -.cm-s-eclipse span.cm-string {color: #2A00FF;} -.cm-s-eclipse span.cm-string-2 {color: #f50;} -.cm-s-eclipse span.cm-qualifier {color: #555;} -.cm-s-eclipse span.cm-builtin {color: #30a;} -.cm-s-eclipse span.cm-bracket {color: #cc7;} -.cm-s-eclipse span.cm-tag {color: #170;} -.cm-s-eclipse span.cm-attribute {color: #00c;} -.cm-s-eclipse span.cm-link {color: #219;} -.cm-s-eclipse span.cm-error {color: #f00;} - -.cm-s-eclipse .CodeMirror-activeline-background {background: #e8f2ff !important;} -.cm-s-eclipse .CodeMirror-matchingbracket {outline:1px solid grey; color:black !important;} +.cm-s-eclipse span.cm-meta { + color: #FF1717; +} + +.cm-s-eclipse span.cm-keyword { + line-height: 1em; + font-weight: bold; + color: #7F0055; +} + +.cm-s-eclipse span.cm-atom { + color: #219; +} + +.cm-s-eclipse span.cm-number { + color: #164; +} + +.cm-s-eclipse span.cm-def { + color: #00f; +} + +.cm-s-eclipse span.cm-variable { + color: black; +} + +.cm-s-eclipse span.cm-variable-2 { + color: #0000C0; +} + +.cm-s-eclipse span.cm-variable-3 { + color: #0000C0; +} + +.cm-s-eclipse span.cm-property { + color: black; +} + +.cm-s-eclipse span.cm-operator { + color: black; +} + +.cm-s-eclipse span.cm-comment { + color: #3F7F5F; +} + +.cm-s-eclipse span.cm-string { + color: #2A00FF; +} + +.cm-s-eclipse span.cm-string-2 { + color: #f50; +} + +.cm-s-eclipse span.cm-qualifier { + color: #555; +} + +.cm-s-eclipse span.cm-builtin { + color: #30a; +} + +.cm-s-eclipse span.cm-bracket { + color: #cc7; +} + +.cm-s-eclipse span.cm-tag { + color: #170; +} + +.cm-s-eclipse span.cm-attribute { + color: #00c; +} + +.cm-s-eclipse span.cm-link { + color: #219; +} + +.cm-s-eclipse span.cm-error { + color: #f00; +} + +.cm-s-eclipse .CodeMirror-activeline-background { + background: #e8f2ff !important; +} + +.cm-s-eclipse .CodeMirror-matchingbracket { + outline: 1px solid grey; + color: black !important; +} diff --git a/web/editor.md/lib/codemirror/theme/elegant.css b/web/editor.md/lib/codemirror/theme/elegant.css index dd7df7b..b807f75 100644 --- a/web/editor.md/lib/codemirror/theme/elegant.css +++ b/web/editor.md/lib/codemirror/theme/elegant.css @@ -1,13 +1,52 @@ -.cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;} -.cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;} -.cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;} -.cm-s-elegant span.cm-variable {color: black;} -.cm-s-elegant span.cm-variable-2 {color: #b11;} -.cm-s-elegant span.cm-qualifier {color: #555;} -.cm-s-elegant span.cm-keyword {color: #730;} -.cm-s-elegant span.cm-builtin {color: #30a;} -.cm-s-elegant span.cm-link {color: #762;} -.cm-s-elegant span.cm-error {background-color: #fdd;} - -.cm-s-elegant .CodeMirror-activeline-background {background: #e8f2ff !important;} -.cm-s-elegant .CodeMirror-matchingbracket {outline:1px solid grey; color:black !important;} +.cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom { + color: #762; +} + +.cm-s-elegant span.cm-comment { + color: #262; + font-style: italic; + line-height: 1em; +} + +.cm-s-elegant span.cm-meta { + color: #555; + font-style: italic; + line-height: 1em; +} + +.cm-s-elegant span.cm-variable { + color: black; +} + +.cm-s-elegant span.cm-variable-2 { + color: #b11; +} + +.cm-s-elegant span.cm-qualifier { + color: #555; +} + +.cm-s-elegant span.cm-keyword { + color: #730; +} + +.cm-s-elegant span.cm-builtin { + color: #30a; +} + +.cm-s-elegant span.cm-link { + color: #762; +} + +.cm-s-elegant span.cm-error { + background-color: #fdd; +} + +.cm-s-elegant .CodeMirror-activeline-background { + background: #e8f2ff !important; +} + +.cm-s-elegant .CodeMirror-matchingbracket { + outline: 1px solid grey; + color: black !important; +} diff --git a/web/editor.md/lib/codemirror/theme/erlang-dark.css b/web/editor.md/lib/codemirror/theme/erlang-dark.css index 25c7e0a..e1503a8 100644 --- a/web/editor.md/lib/codemirror/theme/erlang-dark.css +++ b/web/editor.md/lib/codemirror/theme/erlang-dark.css @@ -1,34 +1,130 @@ -.cm-s-erlang-dark.CodeMirror { background: #002240; color: white; } -.cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; } -.cm-s-erlang-dark.CodeMirror ::selection { background: rgba(179, 101, 57, .99); } -.cm-s-erlang-dark.CodeMirror ::-moz-selection { background: rgba(179, 101, 57, .99); } -.cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } -.cm-s-erlang-dark .CodeMirror-guttermarker { color: white; } -.cm-s-erlang-dark .CodeMirror-guttermarker-subtle { color: #d0d0d0; } -.cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; } -.cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; } - -.cm-s-erlang-dark span.cm-atom { color: #f133f1; } -.cm-s-erlang-dark span.cm-attribute { color: #ff80e1; } -.cm-s-erlang-dark span.cm-bracket { color: #ff9d00; } -.cm-s-erlang-dark span.cm-builtin { color: #eaa; } -.cm-s-erlang-dark span.cm-comment { color: #77f; } -.cm-s-erlang-dark span.cm-def { color: #e7a; } -.cm-s-erlang-dark span.cm-keyword { color: #ffee80; } -.cm-s-erlang-dark span.cm-meta { color: #50fefe; } -.cm-s-erlang-dark span.cm-number { color: #ffd0d0; } -.cm-s-erlang-dark span.cm-operator { color: #d55; } -.cm-s-erlang-dark span.cm-property { color: #ccc; } -.cm-s-erlang-dark span.cm-qualifier { color: #ccc; } -.cm-s-erlang-dark span.cm-quote { color: #ccc; } -.cm-s-erlang-dark span.cm-special { color: #ffbbbb; } -.cm-s-erlang-dark span.cm-string { color: #3ad900; } -.cm-s-erlang-dark span.cm-string-2 { color: #ccc; } -.cm-s-erlang-dark span.cm-tag { color: #9effff; } -.cm-s-erlang-dark span.cm-variable { color: #50fe50; } -.cm-s-erlang-dark span.cm-variable-2 { color: #e0e; } -.cm-s-erlang-dark span.cm-variable-3 { color: #ccc; } -.cm-s-erlang-dark span.cm-error { color: #9d1e15; } - -.cm-s-erlang-dark .CodeMirror-activeline-background {background: #013461 !important;} -.cm-s-erlang-dark .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} +.cm-s-erlang-dark.CodeMirror { + background: #002240; + color: white; +} + +.cm-s-erlang-dark div.CodeMirror-selected { + background: #b36539 !important; +} + +.cm-s-erlang-dark.CodeMirror ::selection { + background: rgba(179, 101, 57, .99); +} + +.cm-s-erlang-dark.CodeMirror ::-moz-selection { + background: rgba(179, 101, 57, .99); +} + +.cm-s-erlang-dark .CodeMirror-gutters { + background: #002240; + border-right: 1px solid #aaa; +} + +.cm-s-erlang-dark .CodeMirror-guttermarker { + color: white; +} + +.cm-s-erlang-dark .CodeMirror-guttermarker-subtle { + color: #d0d0d0; +} + +.cm-s-erlang-dark .CodeMirror-linenumber { + color: #d0d0d0; +} + +.cm-s-erlang-dark .CodeMirror-cursor { + border-left: 1px solid white !important; +} + +.cm-s-erlang-dark span.cm-atom { + color: #f133f1; +} + +.cm-s-erlang-dark span.cm-attribute { + color: #ff80e1; +} + +.cm-s-erlang-dark span.cm-bracket { + color: #ff9d00; +} + +.cm-s-erlang-dark span.cm-builtin { + color: #eaa; +} + +.cm-s-erlang-dark span.cm-comment { + color: #77f; +} + +.cm-s-erlang-dark span.cm-def { + color: #e7a; +} + +.cm-s-erlang-dark span.cm-keyword { + color: #ffee80; +} + +.cm-s-erlang-dark span.cm-meta { + color: #50fefe; +} + +.cm-s-erlang-dark span.cm-number { + color: #ffd0d0; +} + +.cm-s-erlang-dark span.cm-operator { + color: #d55; +} + +.cm-s-erlang-dark span.cm-property { + color: #ccc; +} + +.cm-s-erlang-dark span.cm-qualifier { + color: #ccc; +} + +.cm-s-erlang-dark span.cm-quote { + color: #ccc; +} + +.cm-s-erlang-dark span.cm-special { + color: #ffbbbb; +} + +.cm-s-erlang-dark span.cm-string { + color: #3ad900; +} + +.cm-s-erlang-dark span.cm-string-2 { + color: #ccc; +} + +.cm-s-erlang-dark span.cm-tag { + color: #9effff; +} + +.cm-s-erlang-dark span.cm-variable { + color: #50fe50; +} + +.cm-s-erlang-dark span.cm-variable-2 { + color: #e0e; +} + +.cm-s-erlang-dark span.cm-variable-3 { + color: #ccc; +} + +.cm-s-erlang-dark span.cm-error { + color: #9d1e15; +} + +.cm-s-erlang-dark .CodeMirror-activeline-background { + background: #013461 !important; +} + +.cm-s-erlang-dark .CodeMirror-matchingbracket { + outline: 1px solid grey; + color: white !important; +} diff --git a/web/editor.md/lib/codemirror/theme/lesser-dark.css b/web/editor.md/lib/codemirror/theme/lesser-dark.css index 5af8b7f..ede677f 100644 --- a/web/editor.md/lib/codemirror/theme/lesser-dark.css +++ b/web/editor.md/lib/codemirror/theme/lesser-dark.css @@ -3,45 +3,158 @@ http://lesscss.org/ dark theme Ported to CodeMirror by Peter Kroon */ .cm-s-lesser-dark { - line-height: 1.3em; -} -.cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; } -.cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/ -.cm-s-lesser-dark.CodeMirror ::selection { background: rgba(69, 68, 59, .99); } -.cm-s-lesser-dark.CodeMirror ::-moz-selection { background: rgba(69, 68, 59, .99); } -.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; } -.cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/ - -.cm-s-lesser-dark.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/ - -.cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; } -.cm-s-lesser-dark .CodeMirror-guttermarker { color: #599eff; } -.cm-s-lesser-dark .CodeMirror-guttermarker-subtle { color: #777; } -.cm-s-lesser-dark .CodeMirror-linenumber { color: #777; } - -.cm-s-lesser-dark span.cm-keyword { color: #599eff; } -.cm-s-lesser-dark span.cm-atom { color: #C2B470; } -.cm-s-lesser-dark span.cm-number { color: #B35E4D; } -.cm-s-lesser-dark span.cm-def {color: white;} -.cm-s-lesser-dark span.cm-variable { color:#D9BF8C; } -.cm-s-lesser-dark span.cm-variable-2 { color: #669199; } -.cm-s-lesser-dark span.cm-variable-3 { color: white; } -.cm-s-lesser-dark span.cm-property {color: #92A75C;} -.cm-s-lesser-dark span.cm-operator {color: #92A75C;} -.cm-s-lesser-dark span.cm-comment { color: #666; } -.cm-s-lesser-dark span.cm-string { color: #BCD279; } -.cm-s-lesser-dark span.cm-string-2 {color: #f50;} -.cm-s-lesser-dark span.cm-meta { color: #738C73; } -.cm-s-lesser-dark span.cm-qualifier {color: #555;} -.cm-s-lesser-dark span.cm-builtin { color: #ff9e59; } -.cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; } -.cm-s-lesser-dark span.cm-tag { color: #669199; } -.cm-s-lesser-dark span.cm-attribute {color: #00c;} -.cm-s-lesser-dark span.cm-header {color: #a0a;} -.cm-s-lesser-dark span.cm-quote {color: #090;} -.cm-s-lesser-dark span.cm-hr {color: #999;} -.cm-s-lesser-dark span.cm-link {color: #00c;} -.cm-s-lesser-dark span.cm-error { color: #9d1e15; } - -.cm-s-lesser-dark .CodeMirror-activeline-background {background: #3C3A3A !important;} -.cm-s-lesser-dark .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} + line-height: 1.3em; +} + +.cm-s-lesser-dark.CodeMirror { + background: #262626; + color: #EBEFE7; + text-shadow: 0 -1px 1px #262626; +} + +.cm-s-lesser-dark div.CodeMirror-selected { + background: #45443B !important; +} + +/* 33322B*/ +.cm-s-lesser-dark.CodeMirror ::selection { + background: rgba(69, 68, 59, .99); +} + +.cm-s-lesser-dark.CodeMirror ::-moz-selection { + background: rgba(69, 68, 59, .99); +} + +.cm-s-lesser-dark .CodeMirror-cursor { + border-left: 1px solid white !important; +} + +.cm-s-lesser-dark pre { + padding: 0 8px; +} + +/*editable code holder*/ + +.cm-s-lesser-dark.CodeMirror span.CodeMirror-matchingbracket { + color: #7EFC7E; +} + +/*65FC65*/ + +.cm-s-lesser-dark .CodeMirror-gutters { + background: #262626; + border-right: 1px solid #aaa; +} + +.cm-s-lesser-dark .CodeMirror-guttermarker { + color: #599eff; +} + +.cm-s-lesser-dark .CodeMirror-guttermarker-subtle { + color: #777; +} + +.cm-s-lesser-dark .CodeMirror-linenumber { + color: #777; +} + +.cm-s-lesser-dark span.cm-keyword { + color: #599eff; +} + +.cm-s-lesser-dark span.cm-atom { + color: #C2B470; +} + +.cm-s-lesser-dark span.cm-number { + color: #B35E4D; +} + +.cm-s-lesser-dark span.cm-def { + color: white; +} + +.cm-s-lesser-dark span.cm-variable { + color: #D9BF8C; +} + +.cm-s-lesser-dark span.cm-variable-2 { + color: #669199; +} + +.cm-s-lesser-dark span.cm-variable-3 { + color: white; +} + +.cm-s-lesser-dark span.cm-property { + color: #92A75C; +} + +.cm-s-lesser-dark span.cm-operator { + color: #92A75C; +} + +.cm-s-lesser-dark span.cm-comment { + color: #666; +} + +.cm-s-lesser-dark span.cm-string { + color: #BCD279; +} + +.cm-s-lesser-dark span.cm-string-2 { + color: #f50; +} + +.cm-s-lesser-dark span.cm-meta { + color: #738C73; +} + +.cm-s-lesser-dark span.cm-qualifier { + color: #555; +} + +.cm-s-lesser-dark span.cm-builtin { + color: #ff9e59; +} + +.cm-s-lesser-dark span.cm-bracket { + color: #EBEFE7; +} + +.cm-s-lesser-dark span.cm-tag { + color: #669199; +} + +.cm-s-lesser-dark span.cm-attribute { + color: #00c; +} + +.cm-s-lesser-dark span.cm-header { + color: #a0a; +} + +.cm-s-lesser-dark span.cm-quote { + color: #090; +} + +.cm-s-lesser-dark span.cm-hr { + color: #999; +} + +.cm-s-lesser-dark span.cm-link { + color: #00c; +} + +.cm-s-lesser-dark span.cm-error { + color: #9d1e15; +} + +.cm-s-lesser-dark .CodeMirror-activeline-background { + background: #3C3A3A !important; +} + +.cm-s-lesser-dark .CodeMirror-matchingbracket { + outline: 1px solid grey; + color: white !important; +} diff --git a/web/editor.md/lib/codemirror/theme/mbo.css b/web/editor.md/lib/codemirror/theme/mbo.css index e398795..b4c1bf8 100644 --- a/web/editor.md/lib/codemirror/theme/mbo.css +++ b/web/editor.md/lib/codemirror/theme/mbo.css @@ -4,34 +4,114 @@ /* Create your own: http://tmtheme-editor.herokuapp.com */ /****************************************************************/ -.cm-s-mbo.CodeMirror {background: #2c2c2c; color: #ffffec;} -.cm-s-mbo div.CodeMirror-selected {background: #716C62 !important;} -.cm-s-mbo.CodeMirror ::selection { background: rgba(113, 108, 98, .99); } -.cm-s-mbo.CodeMirror ::-moz-selection { background: rgba(113, 108, 98, .99); } -.cm-s-mbo .CodeMirror-gutters {background: #4e4e4e; border-right: 0px;} -.cm-s-mbo .CodeMirror-guttermarker { color: white; } -.cm-s-mbo .CodeMirror-guttermarker-subtle { color: grey; } -.cm-s-mbo .CodeMirror-linenumber {color: #dadada;} -.cm-s-mbo .CodeMirror-cursor {border-left: 1px solid #ffffec !important;} - -.cm-s-mbo span.cm-comment {color: #95958a;} -.cm-s-mbo span.cm-atom {color: #00a8c6;} -.cm-s-mbo span.cm-number {color: #00a8c6;} - -.cm-s-mbo span.cm-property, .cm-s-mbo span.cm-attribute {color: #9ddfe9;} -.cm-s-mbo span.cm-keyword {color: #ffb928;} -.cm-s-mbo span.cm-string {color: #ffcf6c;} -.cm-s-mbo span.cm-string.cm-property {color: #ffffec;} - -.cm-s-mbo span.cm-variable {color: #ffffec;} -.cm-s-mbo span.cm-variable-2 {color: #00a8c6;} -.cm-s-mbo span.cm-def {color: #ffffec;} -.cm-s-mbo span.cm-bracket {color: #fffffc; font-weight: bold;} -.cm-s-mbo span.cm-tag {color: #9ddfe9;} -.cm-s-mbo span.cm-link {color: #f54b07;} -.cm-s-mbo span.cm-error {border-bottom: #636363; color: #ffffec;} -.cm-s-mbo span.cm-qualifier {color: #ffffec;} - -.cm-s-mbo .CodeMirror-activeline-background {background: #494b41 !important;} -.cm-s-mbo .CodeMirror-matchingbracket {color: #222 !important;} -.cm-s-mbo .CodeMirror-matchingtag {background: rgba(255, 255, 255, .37);} +.cm-s-mbo.CodeMirror { + background: #2c2c2c; + color: #ffffec; +} + +.cm-s-mbo div.CodeMirror-selected { + background: #716C62 !important; +} + +.cm-s-mbo.CodeMirror ::selection { + background: rgba(113, 108, 98, .99); +} + +.cm-s-mbo.CodeMirror ::-moz-selection { + background: rgba(113, 108, 98, .99); +} + +.cm-s-mbo .CodeMirror-gutters { + background: #4e4e4e; + border-right: 0px; +} + +.cm-s-mbo .CodeMirror-guttermarker { + color: white; +} + +.cm-s-mbo .CodeMirror-guttermarker-subtle { + color: grey; +} + +.cm-s-mbo .CodeMirror-linenumber { + color: #dadada; +} + +.cm-s-mbo .CodeMirror-cursor { + border-left: 1px solid #ffffec !important; +} + +.cm-s-mbo span.cm-comment { + color: #95958a; +} + +.cm-s-mbo span.cm-atom { + color: #00a8c6; +} + +.cm-s-mbo span.cm-number { + color: #00a8c6; +} + +.cm-s-mbo span.cm-property, .cm-s-mbo span.cm-attribute { + color: #9ddfe9; +} + +.cm-s-mbo span.cm-keyword { + color: #ffb928; +} + +.cm-s-mbo span.cm-string { + color: #ffcf6c; +} + +.cm-s-mbo span.cm-string.cm-property { + color: #ffffec; +} + +.cm-s-mbo span.cm-variable { + color: #ffffec; +} + +.cm-s-mbo span.cm-variable-2 { + color: #00a8c6; +} + +.cm-s-mbo span.cm-def { + color: #ffffec; +} + +.cm-s-mbo span.cm-bracket { + color: #fffffc; + font-weight: bold; +} + +.cm-s-mbo span.cm-tag { + color: #9ddfe9; +} + +.cm-s-mbo span.cm-link { + color: #f54b07; +} + +.cm-s-mbo span.cm-error { + border-bottom: #636363; + color: #ffffec; +} + +.cm-s-mbo span.cm-qualifier { + color: #ffffec; +} + +.cm-s-mbo .CodeMirror-activeline-background { + background: #494b41 !important; +} + +.cm-s-mbo .CodeMirror-matchingbracket { + color: #222 !important; +} + +.cm-s-mbo .CodeMirror-matchingtag { + background: rgba(255, 255, 255, .37); +} diff --git a/web/editor.md/lib/codemirror/theme/mdn-like.css b/web/editor.md/lib/codemirror/theme/mdn-like.css index 93293c0..b1d983f 100644 --- a/web/editor.md/lib/codemirror/theme/mdn-like.css +++ b/web/editor.md/lib/codemirror/theme/mdn-like.css @@ -7,40 +7,139 @@ The mdn-like theme is inspired on the displayed code examples at: https://developer.mozilla.org/en-US/docs/Web/CSS/animation */ -.cm-s-mdn-like.CodeMirror { color: #999; background-color: #fff; } -.cm-s-mdn-like .CodeMirror-selected { background: #cfc !important; } -.cm-s-mdn-like.CodeMirror ::selection { background: #cfc; } -.cm-s-mdn-like.CodeMirror ::-moz-selection { background: #cfc; } - -.cm-s-mdn-like .CodeMirror-gutters { background: #f8f8f8; border-left: 6px solid rgba(0,83,159,0.65); color: #333; } -.cm-s-mdn-like .CodeMirror-linenumber { color: #aaa; margin-left: 3px; } -div.cm-s-mdn-like .CodeMirror-cursor { border-left: 2px solid #222; } - -.cm-s-mdn-like .cm-keyword { color: #6262FF; } -.cm-s-mdn-like .cm-atom { color: #F90; } -.cm-s-mdn-like .cm-number { color: #ca7841; } -.cm-s-mdn-like .cm-def { color: #8DA6CE; } -.cm-s-mdn-like span.cm-variable-2, .cm-s-mdn-like span.cm-tag { color: #690; } -.cm-s-mdn-like span.cm-variable-3, .cm-s-mdn-like span.cm-def { color: #07a; } - -.cm-s-mdn-like .cm-variable { color: #07a; } -.cm-s-mdn-like .cm-property { color: #905; } -.cm-s-mdn-like .cm-qualifier { color: #690; } - -.cm-s-mdn-like .cm-operator { color: #cda869; } -.cm-s-mdn-like .cm-comment { color:#777; font-weight:normal; } -.cm-s-mdn-like .cm-string { color:#07a; font-style:italic; } -.cm-s-mdn-like .cm-string-2 { color:#bd6b18; } /*?*/ -.cm-s-mdn-like .cm-meta { color: #000; } /*?*/ -.cm-s-mdn-like .cm-builtin { color: #9B7536; } /*?*/ -.cm-s-mdn-like .cm-tag { color: #997643; } -.cm-s-mdn-like .cm-attribute { color: #d6bb6d; } /*?*/ -.cm-s-mdn-like .cm-header { color: #FF6400; } -.cm-s-mdn-like .cm-hr { color: #AEAEAE; } -.cm-s-mdn-like .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } -.cm-s-mdn-like .cm-error { border-bottom: 1px solid red; } - -div.cm-s-mdn-like .CodeMirror-activeline-background {background: #efefff;} -div.cm-s-mdn-like span.CodeMirror-matchingbracket {outline:1px solid grey; color: inherit;} - -.cm-s-mdn-like.CodeMirror { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFcAAAAyCAYAAAAp8UeFAAAHvklEQVR42s2b63bcNgyEQZCSHCdt2vd/0tWF7I+Q6XgMXiTtuvU5Pl57ZQKkKHzEAOtF5KeIJBGJ8uvL599FRFREZhFx8DeXv8trn68RuGaC8TRfo3SNp9dlDDHedyLyTUTeRWStXKPZrjtpZxaRw5hPqozRs1N8/enzIiQRWcCgy4MUA0f+XWliDhyL8Lfyvx7ei/Ae3iQFHyw7U/59pQVIMEEPEz0G7XiwdRjzSfC3UTtz9vchIntxvry5iMgfIhJoEflOz2CQr3F5h/HfeFe+GTdLaKcu9L8LTeQb/R/7GgbsfKedyNdoHsN31uRPWrfZ5wsj/NzzRQHuToIdU3ahwnsKPxXCjJITuOsi7XLc7SG/v5GdALs7wf8JjTFiB5+QvTEfRyGOfX3Lrx8wxyQi3sNq46O7QahQiCsRFgqddjBouVEHOKDgXAQHD9gJCr5sMKkEdjwsarG/ww3BMHBU7OBjXnzdyY7SfCxf5/z6ATccrwlKuwC/jhznnPF4CgVzhhVf4xp2EixcBActO75iZ8/fM9zAs2OMzKdslgXWJ9XG8PQoOAMA5fGcsvORgv0doBXyHrCwfLJAOwo71QLNkb8n2Pl6EWiR7OCibtkPaz4Kc/0NNAze2gju3zOwekALDaCFPI5vjPFmgGY5AZqyGEvH1x7QfIb8YtxMnA/b+QQ0aQDAwc6JMFg8CbQZ4qoYEEHbRwNojuK3EHwd7VALSgq+MNDKzfT58T8qdpADrgW0GmgcAS1lhzztJmkAzcPNOQbsWEALBDSlMKUG0Eq4CLAQWvEVQ9WU57gZJwZtgPO3r9oBTQ9WO8TjqXINx8R0EYpiZEUWOF3FxkbJkgU9B2f41YBrIj5ZfsQa0M5kTgiAAqM3ShXLgu8XMqcrQBvJ0CL5pnTsfMB13oB8athpAq2XOQmcGmoACCLydx7nToa23ATaSIY2ichfOdPTGxlasXMLaL0MLZAOwAKIM+y8CmicobGdCcbbK9DzN+yYGVoNNI5iUKTMyYOjPse4A8SM1MmcXgU0toOq1yO/v8FOxlASyc7TgeYaAMBJHcY1CcCwGI/TK4AmDbDyKYBBtFUkRwto8gygiQEaByFgJ00BH2M8JWwQS1nafDXQCidWyOI8AcjDCSjCLk8ngObuAm3JAHAdubAmOaK06V8MNEsKPJOhobSprwQa6gD7DclRQdqcwL4zxqgBrQcabUiBLclRDKAlWp+etPkBaNMA0AKlrHwTdEByZAA4GM+SNluSY6wAzcMNewxmgig5Ks0nkrSpBvSaQHMdKTBAnLojOdYyGpQ254602ZILPdTD1hdlggdIm74jbTp8vDwF5ZYUeLWGJpWsh6XNyXgcYwVoJQTEhhTYkxzZjiU5npU2TaB979TQehlaAVq4kaGpiPwwwLkYUuBbQwocyQTv1tA0+1UFWoJF3iv1oq+qoSk8EQdJmwHkziIF7oOZk14EGitibAdjLYYK78H5vZOhtWpoI0ATGHs0Q8OMb4Ey+2bU2UYztCtA0wFAs7TplGLRVQCcqaFdGSPCeTI1QNIC52iWNzof6Uib7xjEp07mNNoUYmVosVItHrHzRlLgBn9LFyRHaQCtVUMbtTNhoXWiTOO9k/V8BdAc1Oq0ArSQs6/5SU0hckNy9NnXqQY0PGYo5dWJ7nINaN6o958FWin27aBaWRka1r5myvLOAm0j30eBJqCxHLReVclxhxOEN2JfDWjxBtAC7MIH1fVaGdoOp4qJYDgKtKPSFNID2gSnGldrCqkFZ+5UeQXQBIRrSwocbdZYQT/2LwRahBPBXoHrB8nxaGROST62DKUbQOMMzZIC9abkuELfQzQALWTnDNAm8KHWFOJgJ5+SHIvTPcmx1xQyZRhNL5Qci689aXMEaN/uNIWkEwDAvFpOZmgsBaaGnbs1NPa1Jm32gBZAIh1pCtG7TSH4aE0y1uVY4uqoFPisGlpP2rSA5qTecWn5agK6BzSpgAyD+wFaqhnYoSZ1Vwr8CmlTQbrcO3ZaX0NAEyMbYaAlyquFoLKK3SPby9CeVUPThrSJmkCAE0CrKUQadi4DrdSlWhmah0YL9z9vClH59YGbHx1J8VZTyAjQepJjmXwAKTDQI3omc3p1U4gDUf6RfcdYfrUp5ClAi2J3Ba6UOXGo+K+bQrjjssitG2SJzshaLwMtXgRagUNpYYoVkMSBLM+9GGiJZMvduG6DRZ4qc04DMPtQQxOjEtACmhO7K1AbNbQDEggZyJwscFpAGwENhoBeUwh3bWolhe8BTYVKxQEWrSUn/uhcM5KhvUu/+eQu0Lzhi+VrK0PrZZNDQKs9cpYUuFYgMVpD4/NxenJTiMCNqdUEUf1qZWjppLT5qSkkUZbCwkbZMSuVnu80hfSkzRbQeqCZSAh6huR4VtoM2gHAlLf72smuWgE+VV7XpE25Ab2WFDgyhnSuKbs4GuGzCjR+tIoUuMFg3kgcWKLTwRqanJQ2W00hAsenfaApRC42hbCvK1SlE0HtE9BGgneJO+ELamitD1YjjOYnNYVcraGhtKkW0EqVVeDx733I2NH581k1NNxNLG0i0IJ8/NjVaOZ0tYZ2Vtr0Xv7tPV3hkWp9EFkgS/J0vosngTaSoaG06WHi+xObQkaAdlbanP8B2+2l0f90LmUAAAAASUVORK5CYII=); } +.cm-s-mdn-like.CodeMirror { + color: #999; + background-color: #fff; +} + +.cm-s-mdn-like .CodeMirror-selected { + background: #cfc !important; +} + +.cm-s-mdn-like.CodeMirror ::selection { + background: #cfc; +} + +.cm-s-mdn-like.CodeMirror ::-moz-selection { + background: #cfc; +} + +.cm-s-mdn-like .CodeMirror-gutters { + background: #f8f8f8; + border-left: 6px solid rgba(0, 83, 159, 0.65); + color: #333; +} + +.cm-s-mdn-like .CodeMirror-linenumber { + color: #aaa; + margin-left: 3px; +} + +div.cm-s-mdn-like .CodeMirror-cursor { + border-left: 2px solid #222; +} + +.cm-s-mdn-like .cm-keyword { + color: #6262FF; +} + +.cm-s-mdn-like .cm-atom { + color: #F90; +} + +.cm-s-mdn-like .cm-number { + color: #ca7841; +} + +.cm-s-mdn-like .cm-def { + color: #8DA6CE; +} + +.cm-s-mdn-like span.cm-variable-2, .cm-s-mdn-like span.cm-tag { + color: #690; +} + +.cm-s-mdn-like span.cm-variable-3, .cm-s-mdn-like span.cm-def { + color: #07a; +} + +.cm-s-mdn-like .cm-variable { + color: #07a; +} + +.cm-s-mdn-like .cm-property { + color: #905; +} + +.cm-s-mdn-like .cm-qualifier { + color: #690; +} + +.cm-s-mdn-like .cm-operator { + color: #cda869; +} + +.cm-s-mdn-like .cm-comment { + color: #777; + font-weight: normal; +} + +.cm-s-mdn-like .cm-string { + color: #07a; + font-style: italic; +} + +.cm-s-mdn-like .cm-string-2 { + color: #bd6b18; +} + +/*?*/ +.cm-s-mdn-like .cm-meta { + color: #000; +} + +/*?*/ +.cm-s-mdn-like .cm-builtin { + color: #9B7536; +} + +/*?*/ +.cm-s-mdn-like .cm-tag { + color: #997643; +} + +.cm-s-mdn-like .cm-attribute { + color: #d6bb6d; +} + +/*?*/ +.cm-s-mdn-like .cm-header { + color: #FF6400; +} + +.cm-s-mdn-like .cm-hr { + color: #AEAEAE; +} + +.cm-s-mdn-like .cm-link { + color: #ad9361; + font-style: italic; + text-decoration: none; +} + +.cm-s-mdn-like .cm-error { + border-bottom: 1px solid red; +} + +div.cm-s-mdn-like .CodeMirror-activeline-background { + background: #efefff; +} + +div.cm-s-mdn-like span.CodeMirror-matchingbracket { + outline: 1px solid grey; + color: inherit; +} + +.cm-s-mdn-like.CodeMirror { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFcAAAAyCAYAAAAp8UeFAAAHvklEQVR42s2b63bcNgyEQZCSHCdt2vd/0tWF7I+Q6XgMXiTtuvU5Pl57ZQKkKHzEAOtF5KeIJBGJ8uvL599FRFREZhFx8DeXv8trn68RuGaC8TRfo3SNp9dlDDHedyLyTUTeRWStXKPZrjtpZxaRw5hPqozRs1N8/enzIiQRWcCgy4MUA0f+XWliDhyL8Lfyvx7ei/Ae3iQFHyw7U/59pQVIMEEPEz0G7XiwdRjzSfC3UTtz9vchIntxvry5iMgfIhJoEflOz2CQr3F5h/HfeFe+GTdLaKcu9L8LTeQb/R/7GgbsfKedyNdoHsN31uRPWrfZ5wsj/NzzRQHuToIdU3ahwnsKPxXCjJITuOsi7XLc7SG/v5GdALs7wf8JjTFiB5+QvTEfRyGOfX3Lrx8wxyQi3sNq46O7QahQiCsRFgqddjBouVEHOKDgXAQHD9gJCr5sMKkEdjwsarG/ww3BMHBU7OBjXnzdyY7SfCxf5/z6ATccrwlKuwC/jhznnPF4CgVzhhVf4xp2EixcBActO75iZ8/fM9zAs2OMzKdslgXWJ9XG8PQoOAMA5fGcsvORgv0doBXyHrCwfLJAOwo71QLNkb8n2Pl6EWiR7OCibtkPaz4Kc/0NNAze2gju3zOwekALDaCFPI5vjPFmgGY5AZqyGEvH1x7QfIb8YtxMnA/b+QQ0aQDAwc6JMFg8CbQZ4qoYEEHbRwNojuK3EHwd7VALSgq+MNDKzfT58T8qdpADrgW0GmgcAS1lhzztJmkAzcPNOQbsWEALBDSlMKUG0Eq4CLAQWvEVQ9WU57gZJwZtgPO3r9oBTQ9WO8TjqXINx8R0EYpiZEUWOF3FxkbJkgU9B2f41YBrIj5ZfsQa0M5kTgiAAqM3ShXLgu8XMqcrQBvJ0CL5pnTsfMB13oB8athpAq2XOQmcGmoACCLydx7nToa23ATaSIY2ichfOdPTGxlasXMLaL0MLZAOwAKIM+y8CmicobGdCcbbK9DzN+yYGVoNNI5iUKTMyYOjPse4A8SM1MmcXgU0toOq1yO/v8FOxlASyc7TgeYaAMBJHcY1CcCwGI/TK4AmDbDyKYBBtFUkRwto8gygiQEaByFgJ00BH2M8JWwQS1nafDXQCidWyOI8AcjDCSjCLk8ngObuAm3JAHAdubAmOaK06V8MNEsKPJOhobSprwQa6gD7DclRQdqcwL4zxqgBrQcabUiBLclRDKAlWp+etPkBaNMA0AKlrHwTdEByZAA4GM+SNluSY6wAzcMNewxmgig5Ks0nkrSpBvSaQHMdKTBAnLojOdYyGpQ254602ZILPdTD1hdlggdIm74jbTp8vDwF5ZYUeLWGJpWsh6XNyXgcYwVoJQTEhhTYkxzZjiU5npU2TaB979TQehlaAVq4kaGpiPwwwLkYUuBbQwocyQTv1tA0+1UFWoJF3iv1oq+qoSk8EQdJmwHkziIF7oOZk14EGitibAdjLYYK78H5vZOhtWpoI0ATGHs0Q8OMb4Ey+2bU2UYztCtA0wFAs7TplGLRVQCcqaFdGSPCeTI1QNIC52iWNzof6Uib7xjEp07mNNoUYmVosVItHrHzRlLgBn9LFyRHaQCtVUMbtTNhoXWiTOO9k/V8BdAc1Oq0ArSQs6/5SU0hckNy9NnXqQY0PGYo5dWJ7nINaN6o958FWin27aBaWRka1r5myvLOAm0j30eBJqCxHLReVclxhxOEN2JfDWjxBtAC7MIH1fVaGdoOp4qJYDgKtKPSFNID2gSnGldrCqkFZ+5UeQXQBIRrSwocbdZYQT/2LwRahBPBXoHrB8nxaGROST62DKUbQOMMzZIC9abkuELfQzQALWTnDNAm8KHWFOJgJ5+SHIvTPcmx1xQyZRhNL5Qci689aXMEaN/uNIWkEwDAvFpOZmgsBaaGnbs1NPa1Jm32gBZAIh1pCtG7TSH4aE0y1uVY4uqoFPisGlpP2rSA5qTecWn5agK6BzSpgAyD+wFaqhnYoSZ1Vwr8CmlTQbrcO3ZaX0NAEyMbYaAlyquFoLKK3SPby9CeVUPThrSJmkCAE0CrKUQadi4DrdSlWhmah0YL9z9vClH59YGbHx1J8VZTyAjQepJjmXwAKTDQI3omc3p1U4gDUf6RfcdYfrUp5ClAi2J3Ba6UOXGo+K+bQrjjssitG2SJzshaLwMtXgRagUNpYYoVkMSBLM+9GGiJZMvduG6DRZ4qc04DMPtQQxOjEtACmhO7K1AbNbQDEggZyJwscFpAGwENhoBeUwh3bWolhe8BTYVKxQEWrSUn/uhcM5KhvUu/+eQu0Lzhi+VrK0PrZZNDQKs9cpYUuFYgMVpD4/NxenJTiMCNqdUEUf1qZWjppLT5qSkkUZbCwkbZMSuVnu80hfSkzRbQeqCZSAh6huR4VtoM2gHAlLf72smuWgE+VV7XpE25Ab2WFDgyhnSuKbs4GuGzCjR+tIoUuMFg3kgcWKLTwRqanJQ2W00hAsenfaApRC42hbCvK1SlE0HtE9BGgneJO+ELamitD1YjjOYnNYVcraGhtKkW0EqVVeDx733I2NH581k1NNxNLG0i0IJ8/NjVaOZ0tYZ2Vtr0Xv7tPV3hkWp9EFkgS/J0vosngTaSoaG06WHi+xObQkaAdlbanP8B2+2l0f90LmUAAAAASUVORK5CYII=); +} diff --git a/web/editor.md/lib/codemirror/theme/midnight.css b/web/editor.md/lib/codemirror/theme/midnight.css index 296af4f..5d42d1c 100644 --- a/web/editor.md/lib/codemirror/theme/midnight.css +++ b/web/editor.md/lib/codemirror/theme/midnight.css @@ -1,47 +1,116 @@ /* Based on the theme at http://bonsaiden.github.com/JavaScript-Garden */ /**/ -.cm-s-midnight span.CodeMirror-matchhighlight { background: #494949; } -.cm-s-midnight.CodeMirror-focused span.CodeMirror-matchhighlight { background: #314D67 !important; } +.cm-s-midnight span.CodeMirror-matchhighlight { + background: #494949; +} + +.cm-s-midnight.CodeMirror-focused span.CodeMirror-matchhighlight { + background: #314D67 !important; +} /**/ -.cm-s-midnight .CodeMirror-activeline-background {background: #253540 !important;} +.cm-s-midnight .CodeMirror-activeline-background { + background: #253540 !important; +} .cm-s-midnight.CodeMirror { background: #0F192A; color: #D1EDFF; } -.cm-s-midnight.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;} +.cm-s-midnight.CodeMirror { + border-top: 1px solid black; + border-bottom: 1px solid black; +} + +.cm-s-midnight div.CodeMirror-selected { + background: #314D67 !important; +} + +.cm-s-midnight.CodeMirror ::selection { + background: rgba(49, 77, 103, .99); +} + +.cm-s-midnight.CodeMirror ::-moz-selection { + background: rgba(49, 77, 103, .99); +} + +.cm-s-midnight .CodeMirror-gutters { + background: #0F192A; + border-right: 1px solid; +} + +.cm-s-midnight .CodeMirror-guttermarker { + color: white; +} + +.cm-s-midnight .CodeMirror-guttermarker-subtle { + color: #d0d0d0; +} + +.cm-s-midnight .CodeMirror-linenumber { + color: #D0D0D0; +} -.cm-s-midnight div.CodeMirror-selected {background: #314D67 !important;} -.cm-s-midnight.CodeMirror ::selection { background: rgba(49, 77, 103, .99); } -.cm-s-midnight.CodeMirror ::-moz-selection { background: rgba(49, 77, 103, .99); } -.cm-s-midnight .CodeMirror-gutters {background: #0F192A; border-right: 1px solid;} -.cm-s-midnight .CodeMirror-guttermarker { color: white; } -.cm-s-midnight .CodeMirror-guttermarker-subtle { color: #d0d0d0; } -.cm-s-midnight .CodeMirror-linenumber {color: #D0D0D0;} .cm-s-midnight .CodeMirror-cursor { border-left: 1px solid #F8F8F0 !important; } -.cm-s-midnight span.cm-comment {color: #428BDD;} -.cm-s-midnight span.cm-atom {color: #AE81FF;} -.cm-s-midnight span.cm-number {color: #D1EDFF;} +.cm-s-midnight span.cm-comment { + color: #428BDD; +} + +.cm-s-midnight span.cm-atom { + color: #AE81FF; +} + +.cm-s-midnight span.cm-number { + color: #D1EDFF; +} + +.cm-s-midnight span.cm-property, .cm-s-midnight span.cm-attribute { + color: #A6E22E; +} -.cm-s-midnight span.cm-property, .cm-s-midnight span.cm-attribute {color: #A6E22E;} -.cm-s-midnight span.cm-keyword {color: #E83737;} -.cm-s-midnight span.cm-string {color: #1DC116;} +.cm-s-midnight span.cm-keyword { + color: #E83737; +} + +.cm-s-midnight span.cm-string { + color: #1DC116; +} -.cm-s-midnight span.cm-variable {color: #FFAA3E;} -.cm-s-midnight span.cm-variable-2 {color: #FFAA3E;} -.cm-s-midnight span.cm-def {color: #4DD;} -.cm-s-midnight span.cm-bracket {color: #D1EDFF;} -.cm-s-midnight span.cm-tag {color: #449;} -.cm-s-midnight span.cm-link {color: #AE81FF;} -.cm-s-midnight span.cm-error {background: #F92672; color: #F8F8F0;} +.cm-s-midnight span.cm-variable { + color: #FFAA3E; +} + +.cm-s-midnight span.cm-variable-2 { + color: #FFAA3E; +} + +.cm-s-midnight span.cm-def { + color: #4DD; +} + +.cm-s-midnight span.cm-bracket { + color: #D1EDFF; +} + +.cm-s-midnight span.cm-tag { + color: #449; +} + +.cm-s-midnight span.cm-link { + color: #AE81FF; +} + +.cm-s-midnight span.cm-error { + background: #F92672; + color: #F8F8F0; +} .cm-s-midnight .CodeMirror-matchingbracket { - text-decoration: underline; - color: white !important; + text-decoration: underline; + color: white !important; } diff --git a/web/editor.md/lib/codemirror/theme/monokai.css b/web/editor.md/lib/codemirror/theme/monokai.css index 6dfcc73..994546e 100644 --- a/web/editor.md/lib/codemirror/theme/monokai.css +++ b/web/editor.md/lib/codemirror/theme/monokai.css @@ -1,33 +1,101 @@ /* Based on Sublime Text's Monokai theme */ -.cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;} -.cm-s-monokai div.CodeMirror-selected {background: #49483E !important;} -.cm-s-monokai.CodeMirror ::selection { background: rgba(73, 72, 62, .99); } -.cm-s-monokai.CodeMirror ::-moz-selection { background: rgba(73, 72, 62, .99); } -.cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;} -.cm-s-monokai .CodeMirror-guttermarker { color: white; } -.cm-s-monokai .CodeMirror-guttermarker-subtle { color: #d0d0d0; } -.cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;} -.cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;} - -.cm-s-monokai span.cm-comment {color: #75715e;} -.cm-s-monokai span.cm-atom {color: #ae81ff;} -.cm-s-monokai span.cm-number {color: #ae81ff;} - -.cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;} -.cm-s-monokai span.cm-keyword {color: #f92672;} -.cm-s-monokai span.cm-string {color: #e6db74;} - -.cm-s-monokai span.cm-variable {color: #a6e22e;} -.cm-s-monokai span.cm-variable-2 {color: #9effff;} -.cm-s-monokai span.cm-def {color: #fd971f;} -.cm-s-monokai span.cm-bracket {color: #f8f8f2;} -.cm-s-monokai span.cm-tag {color: #f92672;} -.cm-s-monokai span.cm-link {color: #ae81ff;} -.cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;} - -.cm-s-monokai .CodeMirror-activeline-background {background: #373831 !important;} +.cm-s-monokai.CodeMirror { + background: #272822; + color: #f8f8f2; +} + +.cm-s-monokai div.CodeMirror-selected { + background: #49483E !important; +} + +.cm-s-monokai.CodeMirror ::selection { + background: rgba(73, 72, 62, .99); +} + +.cm-s-monokai.CodeMirror ::-moz-selection { + background: rgba(73, 72, 62, .99); +} + +.cm-s-monokai .CodeMirror-gutters { + background: #272822; + border-right: 0px; +} + +.cm-s-monokai .CodeMirror-guttermarker { + color: white; +} + +.cm-s-monokai .CodeMirror-guttermarker-subtle { + color: #d0d0d0; +} + +.cm-s-monokai .CodeMirror-linenumber { + color: #d0d0d0; +} + +.cm-s-monokai .CodeMirror-cursor { + border-left: 1px solid #f8f8f0 !important; +} + +.cm-s-monokai span.cm-comment { + color: #75715e; +} + +.cm-s-monokai span.cm-atom { + color: #ae81ff; +} + +.cm-s-monokai span.cm-number { + color: #ae81ff; +} + +.cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute { + color: #a6e22e; +} + +.cm-s-monokai span.cm-keyword { + color: #f92672; +} + +.cm-s-monokai span.cm-string { + color: #e6db74; +} + +.cm-s-monokai span.cm-variable { + color: #a6e22e; +} + +.cm-s-monokai span.cm-variable-2 { + color: #9effff; +} + +.cm-s-monokai span.cm-def { + color: #fd971f; +} + +.cm-s-monokai span.cm-bracket { + color: #f8f8f2; +} + +.cm-s-monokai span.cm-tag { + color: #f92672; +} + +.cm-s-monokai span.cm-link { + color: #ae81ff; +} + +.cm-s-monokai span.cm-error { + background: #f92672; + color: #f8f8f0; +} + +.cm-s-monokai .CodeMirror-activeline-background { + background: #373831 !important; +} + .cm-s-monokai .CodeMirror-matchingbracket { - text-decoration: underline; - color: white !important; + text-decoration: underline; + color: white !important; } diff --git a/web/editor.md/lib/codemirror/theme/neat.css b/web/editor.md/lib/codemirror/theme/neat.css index 115083b..b82758d 100644 --- a/web/editor.md/lib/codemirror/theme/neat.css +++ b/web/editor.md/lib/codemirror/theme/neat.css @@ -1,12 +1,50 @@ -.cm-s-neat span.cm-comment { color: #a86; } -.cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; } -.cm-s-neat span.cm-string { color: #a22; } -.cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; } -.cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; } -.cm-s-neat span.cm-variable { color: black; } -.cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; } -.cm-s-neat span.cm-meta {color: #555;} -.cm-s-neat span.cm-link { color: #3a3; } - -.cm-s-neat .CodeMirror-activeline-background {background: #e8f2ff !important;} -.cm-s-neat .CodeMirror-matchingbracket {outline:1px solid grey; color:black !important;} +.cm-s-neat span.cm-comment { + color: #a86; +} + +.cm-s-neat span.cm-keyword { + line-height: 1em; + font-weight: bold; + color: blue; +} + +.cm-s-neat span.cm-string { + color: #a22; +} + +.cm-s-neat span.cm-builtin { + line-height: 1em; + font-weight: bold; + color: #077; +} + +.cm-s-neat span.cm-special { + line-height: 1em; + font-weight: bold; + color: #0aa; +} + +.cm-s-neat span.cm-variable { + color: black; +} + +.cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { + color: #3a3; +} + +.cm-s-neat span.cm-meta { + color: #555; +} + +.cm-s-neat span.cm-link { + color: #3a3; +} + +.cm-s-neat .CodeMirror-activeline-background { + background: #e8f2ff !important; +} + +.cm-s-neat .CodeMirror-matchingbracket { + outline: 1px solid grey; + color: black !important; +} diff --git a/web/editor.md/lib/codemirror/theme/neo.css b/web/editor.md/lib/codemirror/theme/neo.css index cecaaf2..d5aa115 100644 --- a/web/editor.md/lib/codemirror/theme/neo.css +++ b/web/editor.md/lib/codemirror/theme/neo.css @@ -3,41 +3,64 @@ /* Color scheme */ .cm-s-neo.CodeMirror { - background-color:#ffffff; - color:#2e383c; - line-height:1.4375; + background-color: #ffffff; + color: #2e383c; + line-height: 1.4375; +} + +.cm-s-neo .cm-comment { + color: #75787b +} + +.cm-s-neo .cm-keyword, .cm-s-neo .cm-property { + color: #1d75b3 +} + +.cm-s-neo .cm-atom, .cm-s-neo .cm-number { + color: #75438a +} + +.cm-s-neo .cm-node, .cm-s-neo .cm-tag { + color: #9c3328 +} + +.cm-s-neo .cm-string { + color: #b35e14 +} + +.cm-s-neo .cm-variable, .cm-s-neo .cm-qualifier { + color: #047d65 } -.cm-s-neo .cm-comment {color:#75787b} -.cm-s-neo .cm-keyword, .cm-s-neo .cm-property {color:#1d75b3} -.cm-s-neo .cm-atom,.cm-s-neo .cm-number {color:#75438a} -.cm-s-neo .cm-node,.cm-s-neo .cm-tag {color:#9c3328} -.cm-s-neo .cm-string {color:#b35e14} -.cm-s-neo .cm-variable,.cm-s-neo .cm-qualifier {color:#047d65} /* Editor styling */ .cm-s-neo pre { - padding:0; + padding: 0; } .cm-s-neo .CodeMirror-gutters { - border:none; - border-right:10px solid transparent; - background-color:transparent; + border: none; + border-right: 10px solid transparent; + background-color: transparent; } .cm-s-neo .CodeMirror-linenumber { - padding:0; - color:#e0e2e5; + padding: 0; + color: #e0e2e5; } -.cm-s-neo .CodeMirror-guttermarker { color: #1d75b3; } -.cm-s-neo .CodeMirror-guttermarker-subtle { color: #e0e2e5; } +.cm-s-neo .CodeMirror-guttermarker { + color: #1d75b3; +} + +.cm-s-neo .CodeMirror-guttermarker-subtle { + color: #e0e2e5; +} .cm-s-neo div.CodeMirror-cursor { - width: auto; - border: 0; - background: rgba(155,157,162,0.37); - z-index: 1; + width: auto; + border: 0; + background: rgba(155, 157, 162, 0.37); + z-index: 1; } diff --git a/web/editor.md/lib/codemirror/theme/night.css b/web/editor.md/lib/codemirror/theme/night.css index 6b2ac6c..62d5d83 100644 --- a/web/editor.md/lib/codemirror/theme/night.css +++ b/web/editor.md/lib/codemirror/theme/night.css @@ -1,28 +1,100 @@ /* Loosely based on the Midnight Textmate theme */ -.cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; } -.cm-s-night div.CodeMirror-selected { background: #447 !important; } -.cm-s-night.CodeMirror ::selection { background: rgba(68, 68, 119, .99); } -.cm-s-night.CodeMirror ::-moz-selection { background: rgba(68, 68, 119, .99); } -.cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } -.cm-s-night .CodeMirror-guttermarker { color: white; } -.cm-s-night .CodeMirror-guttermarker-subtle { color: #bbb; } -.cm-s-night .CodeMirror-linenumber { color: #f8f8f8; } -.cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; } - -.cm-s-night span.cm-comment { color: #6900a1; } -.cm-s-night span.cm-atom { color: #845dc4; } -.cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; } -.cm-s-night span.cm-keyword { color: #599eff; } -.cm-s-night span.cm-string { color: #37f14a; } -.cm-s-night span.cm-meta { color: #7678e2; } -.cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; } -.cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; } -.cm-s-night span.cm-bracket { color: #8da6ce; } -.cm-s-night span.cm-comment { color: #6900a1; } -.cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; } -.cm-s-night span.cm-link { color: #845dc4; } -.cm-s-night span.cm-error { color: #9d1e15; } - -.cm-s-night .CodeMirror-activeline-background {background: #1C005A !important;} -.cm-s-night .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} +.cm-s-night.CodeMirror { + background: #0a001f; + color: #f8f8f8; +} + +.cm-s-night div.CodeMirror-selected { + background: #447 !important; +} + +.cm-s-night.CodeMirror ::selection { + background: rgba(68, 68, 119, .99); +} + +.cm-s-night.CodeMirror ::-moz-selection { + background: rgba(68, 68, 119, .99); +} + +.cm-s-night .CodeMirror-gutters { + background: #0a001f; + border-right: 1px solid #aaa; +} + +.cm-s-night .CodeMirror-guttermarker { + color: white; +} + +.cm-s-night .CodeMirror-guttermarker-subtle { + color: #bbb; +} + +.cm-s-night .CodeMirror-linenumber { + color: #f8f8f8; +} + +.cm-s-night .CodeMirror-cursor { + border-left: 1px solid white !important; +} + +.cm-s-night span.cm-comment { + color: #6900a1; +} + +.cm-s-night span.cm-atom { + color: #845dc4; +} + +.cm-s-night span.cm-number, .cm-s-night span.cm-attribute { + color: #ffd500; +} + +.cm-s-night span.cm-keyword { + color: #599eff; +} + +.cm-s-night span.cm-string { + color: #37f14a; +} + +.cm-s-night span.cm-meta { + color: #7678e2; +} + +.cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { + color: #99b2ff; +} + +.cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { + color: white; +} + +.cm-s-night span.cm-bracket { + color: #8da6ce; +} + +.cm-s-night span.cm-comment { + color: #6900a1; +} + +.cm-s-night span.cm-builtin, .cm-s-night span.cm-special { + color: #ff9e59; +} + +.cm-s-night span.cm-link { + color: #845dc4; +} + +.cm-s-night span.cm-error { + color: #9d1e15; +} + +.cm-s-night .CodeMirror-activeline-background { + background: #1C005A !important; +} + +.cm-s-night .CodeMirror-matchingbracket { + outline: 1px solid grey; + color: white !important; +} diff --git a/web/editor.md/lib/codemirror/theme/paraiso-dark.css b/web/editor.md/lib/codemirror/theme/paraiso-dark.css index af914b6..b1de048 100644 --- a/web/editor.md/lib/codemirror/theme/paraiso-dark.css +++ b/web/editor.md/lib/codemirror/theme/paraiso-dark.css @@ -8,31 +8,102 @@ */ -.cm-s-paraiso-dark.CodeMirror {background: #2f1e2e; color: #b9b6b0;} -.cm-s-paraiso-dark div.CodeMirror-selected {background: #41323f !important;} -.cm-s-paraiso-dark.CodeMirror ::selection { background: rgba(65, 50, 63, .99); } -.cm-s-paraiso-dark.CodeMirror ::-moz-selection { background: rgba(65, 50, 63, .99); } -.cm-s-paraiso-dark .CodeMirror-gutters {background: #2f1e2e; border-right: 0px;} -.cm-s-paraiso-dark .CodeMirror-guttermarker { color: #ef6155; } -.cm-s-paraiso-dark .CodeMirror-guttermarker-subtle { color: #776e71; } -.cm-s-paraiso-dark .CodeMirror-linenumber {color: #776e71;} -.cm-s-paraiso-dark .CodeMirror-cursor {border-left: 1px solid #8d8687 !important;} - -.cm-s-paraiso-dark span.cm-comment {color: #e96ba8;} -.cm-s-paraiso-dark span.cm-atom {color: #815ba4;} -.cm-s-paraiso-dark span.cm-number {color: #815ba4;} - -.cm-s-paraiso-dark span.cm-property, .cm-s-paraiso-dark span.cm-attribute {color: #48b685;} -.cm-s-paraiso-dark span.cm-keyword {color: #ef6155;} -.cm-s-paraiso-dark span.cm-string {color: #fec418;} - -.cm-s-paraiso-dark span.cm-variable {color: #48b685;} -.cm-s-paraiso-dark span.cm-variable-2 {color: #06b6ef;} -.cm-s-paraiso-dark span.cm-def {color: #f99b15;} -.cm-s-paraiso-dark span.cm-bracket {color: #b9b6b0;} -.cm-s-paraiso-dark span.cm-tag {color: #ef6155;} -.cm-s-paraiso-dark span.cm-link {color: #815ba4;} -.cm-s-paraiso-dark span.cm-error {background: #ef6155; color: #8d8687;} - -.cm-s-paraiso-dark .CodeMirror-activeline-background {background: #4D344A !important;} -.cm-s-paraiso-dark .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} +.cm-s-paraiso-dark.CodeMirror { + background: #2f1e2e; + color: #b9b6b0; +} + +.cm-s-paraiso-dark div.CodeMirror-selected { + background: #41323f !important; +} + +.cm-s-paraiso-dark.CodeMirror ::selection { + background: rgba(65, 50, 63, .99); +} + +.cm-s-paraiso-dark.CodeMirror ::-moz-selection { + background: rgba(65, 50, 63, .99); +} + +.cm-s-paraiso-dark .CodeMirror-gutters { + background: #2f1e2e; + border-right: 0px; +} + +.cm-s-paraiso-dark .CodeMirror-guttermarker { + color: #ef6155; +} + +.cm-s-paraiso-dark .CodeMirror-guttermarker-subtle { + color: #776e71; +} + +.cm-s-paraiso-dark .CodeMirror-linenumber { + color: #776e71; +} + +.cm-s-paraiso-dark .CodeMirror-cursor { + border-left: 1px solid #8d8687 !important; +} + +.cm-s-paraiso-dark span.cm-comment { + color: #e96ba8; +} + +.cm-s-paraiso-dark span.cm-atom { + color: #815ba4; +} + +.cm-s-paraiso-dark span.cm-number { + color: #815ba4; +} + +.cm-s-paraiso-dark span.cm-property, .cm-s-paraiso-dark span.cm-attribute { + color: #48b685; +} + +.cm-s-paraiso-dark span.cm-keyword { + color: #ef6155; +} + +.cm-s-paraiso-dark span.cm-string { + color: #fec418; +} + +.cm-s-paraiso-dark span.cm-variable { + color: #48b685; +} + +.cm-s-paraiso-dark span.cm-variable-2 { + color: #06b6ef; +} + +.cm-s-paraiso-dark span.cm-def { + color: #f99b15; +} + +.cm-s-paraiso-dark span.cm-bracket { + color: #b9b6b0; +} + +.cm-s-paraiso-dark span.cm-tag { + color: #ef6155; +} + +.cm-s-paraiso-dark span.cm-link { + color: #815ba4; +} + +.cm-s-paraiso-dark span.cm-error { + background: #ef6155; + color: #8d8687; +} + +.cm-s-paraiso-dark .CodeMirror-activeline-background { + background: #4D344A !important; +} + +.cm-s-paraiso-dark .CodeMirror-matchingbracket { + text-decoration: underline; + color: white !important; +} diff --git a/web/editor.md/lib/codemirror/theme/paraiso-light.css b/web/editor.md/lib/codemirror/theme/paraiso-light.css index e198066..55737a4 100644 --- a/web/editor.md/lib/codemirror/theme/paraiso-light.css +++ b/web/editor.md/lib/codemirror/theme/paraiso-light.css @@ -8,31 +8,102 @@ */ -.cm-s-paraiso-light.CodeMirror {background: #e7e9db; color: #41323f;} -.cm-s-paraiso-light div.CodeMirror-selected {background: #b9b6b0 !important;} -.cm-s-paraiso-light.CodeMirror ::selection { background: #b9b6b0; } -.cm-s-paraiso-light.CodeMirror ::-moz-selection { background: #b9b6b0; } -.cm-s-paraiso-light .CodeMirror-gutters {background: #e7e9db; border-right: 0px;} -.cm-s-paraiso-light .CodeMirror-guttermarker { color: black; } -.cm-s-paraiso-light .CodeMirror-guttermarker-subtle { color: #8d8687; } -.cm-s-paraiso-light .CodeMirror-linenumber {color: #8d8687;} -.cm-s-paraiso-light .CodeMirror-cursor {border-left: 1px solid #776e71 !important;} - -.cm-s-paraiso-light span.cm-comment {color: #e96ba8;} -.cm-s-paraiso-light span.cm-atom {color: #815ba4;} -.cm-s-paraiso-light span.cm-number {color: #815ba4;} - -.cm-s-paraiso-light span.cm-property, .cm-s-paraiso-light span.cm-attribute {color: #48b685;} -.cm-s-paraiso-light span.cm-keyword {color: #ef6155;} -.cm-s-paraiso-light span.cm-string {color: #fec418;} - -.cm-s-paraiso-light span.cm-variable {color: #48b685;} -.cm-s-paraiso-light span.cm-variable-2 {color: #06b6ef;} -.cm-s-paraiso-light span.cm-def {color: #f99b15;} -.cm-s-paraiso-light span.cm-bracket {color: #41323f;} -.cm-s-paraiso-light span.cm-tag {color: #ef6155;} -.cm-s-paraiso-light span.cm-link {color: #815ba4;} -.cm-s-paraiso-light span.cm-error {background: #ef6155; color: #776e71;} - -.cm-s-paraiso-light .CodeMirror-activeline-background {background: #CFD1C4 !important;} -.cm-s-paraiso-light .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} +.cm-s-paraiso-light.CodeMirror { + background: #e7e9db; + color: #41323f; +} + +.cm-s-paraiso-light div.CodeMirror-selected { + background: #b9b6b0 !important; +} + +.cm-s-paraiso-light.CodeMirror ::selection { + background: #b9b6b0; +} + +.cm-s-paraiso-light.CodeMirror ::-moz-selection { + background: #b9b6b0; +} + +.cm-s-paraiso-light .CodeMirror-gutters { + background: #e7e9db; + border-right: 0px; +} + +.cm-s-paraiso-light .CodeMirror-guttermarker { + color: black; +} + +.cm-s-paraiso-light .CodeMirror-guttermarker-subtle { + color: #8d8687; +} + +.cm-s-paraiso-light .CodeMirror-linenumber { + color: #8d8687; +} + +.cm-s-paraiso-light .CodeMirror-cursor { + border-left: 1px solid #776e71 !important; +} + +.cm-s-paraiso-light span.cm-comment { + color: #e96ba8; +} + +.cm-s-paraiso-light span.cm-atom { + color: #815ba4; +} + +.cm-s-paraiso-light span.cm-number { + color: #815ba4; +} + +.cm-s-paraiso-light span.cm-property, .cm-s-paraiso-light span.cm-attribute { + color: #48b685; +} + +.cm-s-paraiso-light span.cm-keyword { + color: #ef6155; +} + +.cm-s-paraiso-light span.cm-string { + color: #fec418; +} + +.cm-s-paraiso-light span.cm-variable { + color: #48b685; +} + +.cm-s-paraiso-light span.cm-variable-2 { + color: #06b6ef; +} + +.cm-s-paraiso-light span.cm-def { + color: #f99b15; +} + +.cm-s-paraiso-light span.cm-bracket { + color: #41323f; +} + +.cm-s-paraiso-light span.cm-tag { + color: #ef6155; +} + +.cm-s-paraiso-light span.cm-link { + color: #815ba4; +} + +.cm-s-paraiso-light span.cm-error { + background: #ef6155; + color: #776e71; +} + +.cm-s-paraiso-light .CodeMirror-activeline-background { + background: #CFD1C4 !important; +} + +.cm-s-paraiso-light .CodeMirror-matchingbracket { + text-decoration: underline; + color: white !important; +} diff --git a/web/editor.md/lib/codemirror/theme/pastel-on-dark.css b/web/editor.md/lib/codemirror/theme/pastel-on-dark.css index 0d06f63..98a6fcc 100644 --- a/web/editor.md/lib/codemirror/theme/pastel-on-dark.css +++ b/web/editor.md/lib/codemirror/theme/pastel-on-dark.css @@ -8,46 +8,117 @@ */ .cm-s-pastel-on-dark.CodeMirror { - background: #2c2827; - color: #8F938F; - line-height: 1.5; - font-size: 14px; + background: #2c2827; + color: #8F938F; + line-height: 1.5; + font-size: 14px; +} + +.cm-s-pastel-on-dark div.CodeMirror-selected { + background: rgba(221, 240, 255, 0.2) !important; +} + +.cm-s-pastel-on-dark.CodeMirror ::selection { + background: rgba(221, 240, 255, 0.2); +} + +.cm-s-pastel-on-dark.CodeMirror ::-moz-selection { + background: rgba(221, 240, 255, 0.2); } -.cm-s-pastel-on-dark div.CodeMirror-selected { background: rgba(221,240,255,0.2) !important; } -.cm-s-pastel-on-dark.CodeMirror ::selection { background: rgba(221,240,255,0.2); } -.cm-s-pastel-on-dark.CodeMirror ::-moz-selection { background: rgba(221,240,255,0.2); } .cm-s-pastel-on-dark .CodeMirror-gutters { - background: #34302f; - border-right: 0px; - padding: 0 3px; -} -.cm-s-pastel-on-dark .CodeMirror-guttermarker { color: white; } -.cm-s-pastel-on-dark .CodeMirror-guttermarker-subtle { color: #8F938F; } -.cm-s-pastel-on-dark .CodeMirror-linenumber { color: #8F938F; } -.cm-s-pastel-on-dark .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; } -.cm-s-pastel-on-dark span.cm-comment { color: #A6C6FF; } -.cm-s-pastel-on-dark span.cm-atom { color: #DE8E30; } -.cm-s-pastel-on-dark span.cm-number { color: #CCCCCC; } -.cm-s-pastel-on-dark span.cm-property { color: #8F938F; } -.cm-s-pastel-on-dark span.cm-attribute { color: #a6e22e; } -.cm-s-pastel-on-dark span.cm-keyword { color: #AEB2F8; } -.cm-s-pastel-on-dark span.cm-string { color: #66A968; } -.cm-s-pastel-on-dark span.cm-variable { color: #AEB2F8; } -.cm-s-pastel-on-dark span.cm-variable-2 { color: #BEBF55; } -.cm-s-pastel-on-dark span.cm-variable-3 { color: #DE8E30; } -.cm-s-pastel-on-dark span.cm-def { color: #757aD8; } -.cm-s-pastel-on-dark span.cm-bracket { color: #f8f8f2; } -.cm-s-pastel-on-dark span.cm-tag { color: #C1C144; } -.cm-s-pastel-on-dark span.cm-link { color: #ae81ff; } -.cm-s-pastel-on-dark span.cm-qualifier,.cm-s-pastel-on-dark span.cm-builtin { color: #C1C144; } + background: #34302f; + border-right: 0px; + padding: 0 3px; +} + +.cm-s-pastel-on-dark .CodeMirror-guttermarker { + color: white; +} + +.cm-s-pastel-on-dark .CodeMirror-guttermarker-subtle { + color: #8F938F; +} + +.cm-s-pastel-on-dark .CodeMirror-linenumber { + color: #8F938F; +} + +.cm-s-pastel-on-dark .CodeMirror-cursor { + border-left: 1px solid #A7A7A7 !important; +} + +.cm-s-pastel-on-dark span.cm-comment { + color: #A6C6FF; +} + +.cm-s-pastel-on-dark span.cm-atom { + color: #DE8E30; +} + +.cm-s-pastel-on-dark span.cm-number { + color: #CCCCCC; +} + +.cm-s-pastel-on-dark span.cm-property { + color: #8F938F; +} + +.cm-s-pastel-on-dark span.cm-attribute { + color: #a6e22e; +} + +.cm-s-pastel-on-dark span.cm-keyword { + color: #AEB2F8; +} + +.cm-s-pastel-on-dark span.cm-string { + color: #66A968; +} + +.cm-s-pastel-on-dark span.cm-variable { + color: #AEB2F8; +} + +.cm-s-pastel-on-dark span.cm-variable-2 { + color: #BEBF55; +} + +.cm-s-pastel-on-dark span.cm-variable-3 { + color: #DE8E30; +} + +.cm-s-pastel-on-dark span.cm-def { + color: #757aD8; +} + +.cm-s-pastel-on-dark span.cm-bracket { + color: #f8f8f2; +} + +.cm-s-pastel-on-dark span.cm-tag { + color: #C1C144; +} + +.cm-s-pastel-on-dark span.cm-link { + color: #ae81ff; +} + +.cm-s-pastel-on-dark span.cm-qualifier, .cm-s-pastel-on-dark span.cm-builtin { + color: #C1C144; +} + .cm-s-pastel-on-dark span.cm-error { - background: #757aD8; - color: #f8f8f0; + background: #757aD8; + color: #f8f8f0; } -.cm-s-pastel-on-dark .CodeMirror-activeline-background { background: rgba(255, 255, 255, 0.031) !important; } + +.cm-s-pastel-on-dark .CodeMirror-activeline-background { + background: rgba(255, 255, 255, 0.031) !important; +} + .cm-s-pastel-on-dark .CodeMirror-matchingbracket { - border: 1px solid rgba(255,255,255,0.25); - color: #8F938F !important; - margin: -1px -1px 0 -1px; + border: 1px solid rgba(255, 255, 255, 0.25); + color: #8F938F !important; + margin: -1px -1px 0 -1px; } diff --git a/web/editor.md/lib/codemirror/theme/rubyblue.css b/web/editor.md/lib/codemirror/theme/rubyblue.css index d2fc0ec..73aab2a 100644 --- a/web/editor.md/lib/codemirror/theme/rubyblue.css +++ b/web/editor.md/lib/codemirror/theme/rubyblue.css @@ -1,25 +1,95 @@ -.cm-s-rubyblue.CodeMirror { background: #112435; color: white; } -.cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; } -.cm-s-rubyblue.CodeMirror ::selection { background: rgba(56, 86, 111, 0.99); } -.cm-s-rubyblue.CodeMirror ::-moz-selection { background: rgba(56, 86, 111, 0.99); } -.cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; } -.cm-s-rubyblue .CodeMirror-guttermarker { color: white; } -.cm-s-rubyblue .CodeMirror-guttermarker-subtle { color: #3E7087; } -.cm-s-rubyblue .CodeMirror-linenumber { color: white; } -.cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; } - -.cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; } -.cm-s-rubyblue span.cm-atom { color: #F4C20B; } -.cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; } -.cm-s-rubyblue span.cm-keyword { color: #F0F; } -.cm-s-rubyblue span.cm-string { color: #F08047; } -.cm-s-rubyblue span.cm-meta { color: #F0F; } -.cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; } -.cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; } -.cm-s-rubyblue span.cm-bracket { color: #F0F; } -.cm-s-rubyblue span.cm-link { color: #F4C20B; } -.cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; } -.cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; } -.cm-s-rubyblue span.cm-error { color: #AF2018; } - -.cm-s-rubyblue .CodeMirror-activeline-background {background: #173047 !important;} +.cm-s-rubyblue.CodeMirror { + background: #112435; + color: white; +} + +.cm-s-rubyblue div.CodeMirror-selected { + background: #38566F !important; +} + +.cm-s-rubyblue.CodeMirror ::selection { + background: rgba(56, 86, 111, 0.99); +} + +.cm-s-rubyblue.CodeMirror ::-moz-selection { + background: rgba(56, 86, 111, 0.99); +} + +.cm-s-rubyblue .CodeMirror-gutters { + background: #1F4661; + border-right: 7px solid #3E7087; +} + +.cm-s-rubyblue .CodeMirror-guttermarker { + color: white; +} + +.cm-s-rubyblue .CodeMirror-guttermarker-subtle { + color: #3E7087; +} + +.cm-s-rubyblue .CodeMirror-linenumber { + color: white; +} + +.cm-s-rubyblue .CodeMirror-cursor { + border-left: 1px solid white !important; +} + +.cm-s-rubyblue span.cm-comment { + color: #999; + font-style: italic; + line-height: 1em; +} + +.cm-s-rubyblue span.cm-atom { + color: #F4C20B; +} + +.cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { + color: #82C6E0; +} + +.cm-s-rubyblue span.cm-keyword { + color: #F0F; +} + +.cm-s-rubyblue span.cm-string { + color: #F08047; +} + +.cm-s-rubyblue span.cm-meta { + color: #F0F; +} + +.cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { + color: #7BD827; +} + +.cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { + color: white; +} + +.cm-s-rubyblue span.cm-bracket { + color: #F0F; +} + +.cm-s-rubyblue span.cm-link { + color: #F4C20B; +} + +.cm-s-rubyblue span.CodeMirror-matchingbracket { + color: #F0F !important; +} + +.cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { + color: #FF9D00; +} + +.cm-s-rubyblue span.cm-error { + color: #AF2018; +} + +.cm-s-rubyblue .CodeMirror-activeline-background { + background: #173047 !important; +} diff --git a/web/editor.md/lib/codemirror/theme/solarized.css b/web/editor.md/lib/codemirror/theme/solarized.css index 4a10b7c..cb74822 100644 --- a/web/editor.md/lib/codemirror/theme/solarized.css +++ b/web/editor.md/lib/codemirror/theme/solarized.css @@ -8,149 +8,296 @@ Solarized color pallet http://ethanschoonover.com/solarized/img/solarized-palette.png */ -.solarized.base03 { color: #002b36; } -.solarized.base02 { color: #073642; } -.solarized.base01 { color: #586e75; } -.solarized.base00 { color: #657b83; } -.solarized.base0 { color: #839496; } -.solarized.base1 { color: #93a1a1; } -.solarized.base2 { color: #eee8d5; } -.solarized.base3 { color: #fdf6e3; } -.solarized.solar-yellow { color: #b58900; } -.solarized.solar-orange { color: #cb4b16; } -.solarized.solar-red { color: #dc322f; } -.solarized.solar-magenta { color: #d33682; } -.solarized.solar-violet { color: #6c71c4; } -.solarized.solar-blue { color: #268bd2; } -.solarized.solar-cyan { color: #2aa198; } -.solarized.solar-green { color: #859900; } +.solarized.base03 { + color: #002b36; +} + +.solarized.base02 { + color: #073642; +} + +.solarized.base01 { + color: #586e75; +} + +.solarized.base00 { + color: #657b83; +} + +.solarized.base0 { + color: #839496; +} + +.solarized.base1 { + color: #93a1a1; +} + +.solarized.base2 { + color: #eee8d5; +} + +.solarized.base3 { + color: #fdf6e3; +} + +.solarized.solar-yellow { + color: #b58900; +} + +.solarized.solar-orange { + color: #cb4b16; +} + +.solarized.solar-red { + color: #dc322f; +} + +.solarized.solar-magenta { + color: #d33682; +} + +.solarized.solar-violet { + color: #6c71c4; +} + +.solarized.solar-blue { + color: #268bd2; +} + +.solarized.solar-cyan { + color: #2aa198; +} + +.solarized.solar-green { + color: #859900; +} /* Color scheme for code-mirror */ .cm-s-solarized { - line-height: 1.45em; - color-profile: sRGB; - rendering-intent: auto; + line-height: 1.45em; + color-profile: sRGB; + rendering-intent: auto; } + .cm-s-solarized.cm-s-dark { - color: #839496; - background-color: #002b36; - text-shadow: #002b36 0 1px; + color: #839496; + background-color: #002b36; + text-shadow: #002b36 0 1px; } + .cm-s-solarized.cm-s-light { - background-color: #fdf6e3; - color: #657b83; - text-shadow: #eee8d5 0 1px; + background-color: #fdf6e3; + color: #657b83; + text-shadow: #eee8d5 0 1px; } .cm-s-solarized .CodeMirror-widget { - text-shadow: none; + text-shadow: none; +} + + +.cm-s-solarized .cm-keyword { + color: #cb4b16 +} + +.cm-s-solarized .cm-atom { + color: #d33682; +} + +.cm-s-solarized .cm-number { + color: #d33682; +} + +.cm-s-solarized .cm-def { + color: #2aa198; +} + +.cm-s-solarized .cm-variable { + color: #268bd2; +} + +.cm-s-solarized .cm-variable-2 { + color: #b58900; +} + +.cm-s-solarized .cm-variable-3 { + color: #6c71c4; +} + +.cm-s-solarized .cm-property { + color: #2aa198; } +.cm-s-solarized .cm-operator { + color: #6c71c4; +} -.cm-s-solarized .cm-keyword { color: #cb4b16 } -.cm-s-solarized .cm-atom { color: #d33682; } -.cm-s-solarized .cm-number { color: #d33682; } -.cm-s-solarized .cm-def { color: #2aa198; } +.cm-s-solarized .cm-comment { + color: #586e75; + font-style: italic; +} -.cm-s-solarized .cm-variable { color: #268bd2; } -.cm-s-solarized .cm-variable-2 { color: #b58900; } -.cm-s-solarized .cm-variable-3 { color: #6c71c4; } +.cm-s-solarized .cm-string { + color: #859900; +} -.cm-s-solarized .cm-property { color: #2aa198; } -.cm-s-solarized .cm-operator {color: #6c71c4;} +.cm-s-solarized .cm-string-2 { + color: #b58900; +} -.cm-s-solarized .cm-comment { color: #586e75; font-style:italic; } +.cm-s-solarized .cm-meta { + color: #859900; +} -.cm-s-solarized .cm-string { color: #859900; } -.cm-s-solarized .cm-string-2 { color: #b58900; } +.cm-s-solarized .cm-qualifier { + color: #b58900; +} + +.cm-s-solarized .cm-builtin { + color: #d33682; +} + +.cm-s-solarized .cm-bracket { + color: #cb4b16; +} + +.cm-s-solarized .CodeMirror-matchingbracket { + color: #859900; +} + +.cm-s-solarized .CodeMirror-nonmatchingbracket { + color: #dc322f; +} + +.cm-s-solarized .cm-tag { + color: #93a1a1 +} + +.cm-s-solarized .cm-attribute { + color: #2aa198; +} + +.cm-s-solarized .cm-header { + color: #586e75; +} + +.cm-s-solarized .cm-quote { + color: #93a1a1; +} -.cm-s-solarized .cm-meta { color: #859900; } -.cm-s-solarized .cm-qualifier { color: #b58900; } -.cm-s-solarized .cm-builtin { color: #d33682; } -.cm-s-solarized .cm-bracket { color: #cb4b16; } -.cm-s-solarized .CodeMirror-matchingbracket { color: #859900; } -.cm-s-solarized .CodeMirror-nonmatchingbracket { color: #dc322f; } -.cm-s-solarized .cm-tag { color: #93a1a1 } -.cm-s-solarized .cm-attribute { color: #2aa198; } -.cm-s-solarized .cm-header { color: #586e75; } -.cm-s-solarized .cm-quote { color: #93a1a1; } .cm-s-solarized .cm-hr { - color: transparent; - border-top: 1px solid #586e75; - display: block; + color: transparent; + border-top: 1px solid #586e75; + display: block; +} + +.cm-s-solarized .cm-link { + color: #93a1a1; + cursor: pointer; } -.cm-s-solarized .cm-link { color: #93a1a1; cursor: pointer; } -.cm-s-solarized .cm-special { color: #6c71c4; } + +.cm-s-solarized .cm-special { + color: #6c71c4; +} + .cm-s-solarized .cm-em { - color: #999; - text-decoration: underline; - text-decoration-style: dotted; + color: #999; + text-decoration: underline; + text-decoration-style: dotted; } -.cm-s-solarized .cm-strong { color: #eee; } + +.cm-s-solarized .cm-strong { + color: #eee; +} + .cm-s-solarized .cm-error, .cm-s-solarized .cm-invalidchar { - color: #586e75; - border-bottom: 1px dotted #dc322f; + color: #586e75; + border-bottom: 1px dotted #dc322f; } -.cm-s-solarized.cm-s-dark .CodeMirror-selected { background: #073642; } -.cm-s-solarized.cm-s-dark.CodeMirror ::selection { background: rgba(7, 54, 66, 0.99); } -.cm-s-solarized.cm-s-dark.CodeMirror ::-moz-selection { background: rgba(7, 54, 66, 0.99); } +.cm-s-solarized.cm-s-dark .CodeMirror-selected { + background: #073642; +} -.cm-s-solarized.cm-s-light .CodeMirror-selected { background: #eee8d5; } -.cm-s-solarized.cm-s-light.CodeMirror ::selection { background: #eee8d5; } -.cm-s-solarized.cm-s-lightCodeMirror ::-moz-selection { background: #eee8d5; } +.cm-s-solarized.cm-s-dark.CodeMirror ::selection { + background: rgba(7, 54, 66, 0.99); +} -/* Editor styling */ +.cm-s-solarized.cm-s-dark.CodeMirror ::-moz-selection { + background: rgba(7, 54, 66, 0.99); +} + +.cm-s-solarized.cm-s-light .CodeMirror-selected { + background: #eee8d5; +} +.cm-s-solarized.cm-s-light.CodeMirror ::selection { + background: #eee8d5; +} + +.cm-s-solarized.cm-s-lightCodeMirror ::-moz-selection { + background: #eee8d5; +} + +/* Editor styling */ /* Little shadow on the view-port of the buffer view */ .cm-s-solarized.CodeMirror { - -moz-box-shadow: inset 7px 0 12px -6px #000; - -webkit-box-shadow: inset 7px 0 12px -6px #000; - box-shadow: inset 7px 0 12px -6px #000; + -moz-box-shadow: inset 7px 0 12px -6px #000; + -webkit-box-shadow: inset 7px 0 12px -6px #000; + box-shadow: inset 7px 0 12px -6px #000; } /* Gutter border and some shadow from it */ .cm-s-solarized .CodeMirror-gutters { - border-right: 1px solid; + border-right: 1px solid; } /* Gutter colors and line number styling based of color scheme (dark / light) */ /* Dark */ .cm-s-solarized.cm-s-dark .CodeMirror-gutters { - background-color: #002b36; - border-color: #00232c; + background-color: #002b36; + border-color: #00232c; } .cm-s-solarized.cm-s-dark .CodeMirror-linenumber { - text-shadow: #021014 0 -1px; + text-shadow: #021014 0 -1px; } /* Light */ .cm-s-solarized.cm-s-light .CodeMirror-gutters { - background-color: #fdf6e3; - border-color: #eee8d5; + background-color: #fdf6e3; + border-color: #eee8d5; } /* Common */ .cm-s-solarized .CodeMirror-linenumber { - color: #586e75; - padding: 0 5px; + color: #586e75; + padding: 0 5px; +} + +.cm-s-solarized .CodeMirror-guttermarker-subtle { + color: #586e75; +} + +.cm-s-solarized.cm-s-dark .CodeMirror-guttermarker { + color: #ddd; +} + +.cm-s-solarized.cm-s-light .CodeMirror-guttermarker { + color: #cb4b16; } -.cm-s-solarized .CodeMirror-guttermarker-subtle { color: #586e75; } -.cm-s-solarized.cm-s-dark .CodeMirror-guttermarker { color: #ddd; } -.cm-s-solarized.cm-s-light .CodeMirror-guttermarker { color: #cb4b16; } .cm-s-solarized .CodeMirror-gutter .CodeMirror-gutter-text { - color: #586e75; + color: #586e75; } .cm-s-solarized .CodeMirror-lines .CodeMirror-cursor { - border-left: 1px solid #819090; + border-left: 1px solid #819090; } /* @@ -158,8 +305,9 @@ Active line. Negative margin compensates left padding of the text in the view-port */ .cm-s-solarized.cm-s-dark .CodeMirror-activeline-background { - background: rgba(255, 255, 255, 0.10); + background: rgba(255, 255, 255, 0.10); } + .cm-s-solarized.cm-s-light .CodeMirror-activeline-background { - background: rgba(0, 0, 0, 0.10); + background: rgba(0, 0, 0, 0.10); } diff --git a/web/editor.md/lib/codemirror/theme/the-matrix.css b/web/editor.md/lib/codemirror/theme/the-matrix.css index f29b22b..4aefe78 100644 --- a/web/editor.md/lib/codemirror/theme/the-matrix.css +++ b/web/editor.md/lib/codemirror/theme/the-matrix.css @@ -1,30 +1,114 @@ -.cm-s-the-matrix.CodeMirror { background: #000000; color: #00FF00; } -.cm-s-the-matrix div.CodeMirror-selected { background: #2D2D2D !important; } -.cm-s-the-matrix.CodeMirror ::selection { background: rgba(45, 45, 45, 0.99); } -.cm-s-the-matrix.CodeMirror ::-moz-selection { background: rgba(45, 45, 45, 0.99); } -.cm-s-the-matrix .CodeMirror-gutters { background: #060; border-right: 2px solid #00FF00; } -.cm-s-the-matrix .CodeMirror-guttermarker { color: #0f0; } -.cm-s-the-matrix .CodeMirror-guttermarker-subtle { color: white; } -.cm-s-the-matrix .CodeMirror-linenumber { color: #FFFFFF; } -.cm-s-the-matrix .CodeMirror-cursor { border-left: 1px solid #00FF00 !important; } - -.cm-s-the-matrix span.cm-keyword {color: #008803; font-weight: bold;} -.cm-s-the-matrix span.cm-atom {color: #3FF;} -.cm-s-the-matrix span.cm-number {color: #FFB94F;} -.cm-s-the-matrix span.cm-def {color: #99C;} -.cm-s-the-matrix span.cm-variable {color: #F6C;} -.cm-s-the-matrix span.cm-variable-2 {color: #C6F;} -.cm-s-the-matrix span.cm-variable-3 {color: #96F;} -.cm-s-the-matrix span.cm-property {color: #62FFA0;} -.cm-s-the-matrix span.cm-operator {color: #999} -.cm-s-the-matrix span.cm-comment {color: #CCCCCC;} -.cm-s-the-matrix span.cm-string {color: #39C;} -.cm-s-the-matrix span.cm-meta {color: #C9F;} -.cm-s-the-matrix span.cm-qualifier {color: #FFF700;} -.cm-s-the-matrix span.cm-builtin {color: #30a;} -.cm-s-the-matrix span.cm-bracket {color: #cc7;} -.cm-s-the-matrix span.cm-tag {color: #FFBD40;} -.cm-s-the-matrix span.cm-attribute {color: #FFF700;} -.cm-s-the-matrix span.cm-error {color: #FF0000;} - -.cm-s-the-matrix .CodeMirror-activeline-background {background: #040;} +.cm-s-the-matrix.CodeMirror { + background: #000000; + color: #00FF00; +} + +.cm-s-the-matrix div.CodeMirror-selected { + background: #2D2D2D !important; +} + +.cm-s-the-matrix.CodeMirror ::selection { + background: rgba(45, 45, 45, 0.99); +} + +.cm-s-the-matrix.CodeMirror ::-moz-selection { + background: rgba(45, 45, 45, 0.99); +} + +.cm-s-the-matrix .CodeMirror-gutters { + background: #060; + border-right: 2px solid #00FF00; +} + +.cm-s-the-matrix .CodeMirror-guttermarker { + color: #0f0; +} + +.cm-s-the-matrix .CodeMirror-guttermarker-subtle { + color: white; +} + +.cm-s-the-matrix .CodeMirror-linenumber { + color: #FFFFFF; +} + +.cm-s-the-matrix .CodeMirror-cursor { + border-left: 1px solid #00FF00 !important; +} + +.cm-s-the-matrix span.cm-keyword { + color: #008803; + font-weight: bold; +} + +.cm-s-the-matrix span.cm-atom { + color: #3FF; +} + +.cm-s-the-matrix span.cm-number { + color: #FFB94F; +} + +.cm-s-the-matrix span.cm-def { + color: #99C; +} + +.cm-s-the-matrix span.cm-variable { + color: #F6C; +} + +.cm-s-the-matrix span.cm-variable-2 { + color: #C6F; +} + +.cm-s-the-matrix span.cm-variable-3 { + color: #96F; +} + +.cm-s-the-matrix span.cm-property { + color: #62FFA0; +} + +.cm-s-the-matrix span.cm-operator { + color: #999 +} + +.cm-s-the-matrix span.cm-comment { + color: #CCCCCC; +} + +.cm-s-the-matrix span.cm-string { + color: #39C; +} + +.cm-s-the-matrix span.cm-meta { + color: #C9F; +} + +.cm-s-the-matrix span.cm-qualifier { + color: #FFF700; +} + +.cm-s-the-matrix span.cm-builtin { + color: #30a; +} + +.cm-s-the-matrix span.cm-bracket { + color: #cc7; +} + +.cm-s-the-matrix span.cm-tag { + color: #FFBD40; +} + +.cm-s-the-matrix span.cm-attribute { + color: #FFF700; +} + +.cm-s-the-matrix span.cm-error { + color: #FF0000; +} + +.cm-s-the-matrix .CodeMirror-activeline-background { + background: #040; +} diff --git a/web/editor.md/lib/codemirror/theme/tomorrow-night-bright.css b/web/editor.md/lib/codemirror/theme/tomorrow-night-bright.css index decb82d..311379d 100644 --- a/web/editor.md/lib/codemirror/theme/tomorrow-night-bright.css +++ b/web/editor.md/lib/codemirror/theme/tomorrow-night-bright.css @@ -7,29 +7,94 @@ */ -.cm-s-tomorrow-night-bright.CodeMirror {background: #000000; color: #eaeaea;} -.cm-s-tomorrow-night-bright div.CodeMirror-selected {background: #424242 !important;} -.cm-s-tomorrow-night-bright .CodeMirror-gutters {background: #000000; border-right: 0px;} -.cm-s-tomorrow-night-bright .CodeMirror-guttermarker { color: #e78c45; } -.cm-s-tomorrow-night-bright .CodeMirror-guttermarker-subtle { color: #777; } -.cm-s-tomorrow-night-bright .CodeMirror-linenumber {color: #424242;} -.cm-s-tomorrow-night-bright .CodeMirror-cursor {border-left: 1px solid #6A6A6A !important;} - -.cm-s-tomorrow-night-bright span.cm-comment {color: #d27b53;} -.cm-s-tomorrow-night-bright span.cm-atom {color: #a16a94;} -.cm-s-tomorrow-night-bright span.cm-number {color: #a16a94;} - -.cm-s-tomorrow-night-bright span.cm-property, .cm-s-tomorrow-night-bright span.cm-attribute {color: #99cc99;} -.cm-s-tomorrow-night-bright span.cm-keyword {color: #d54e53;} -.cm-s-tomorrow-night-bright span.cm-string {color: #e7c547;} - -.cm-s-tomorrow-night-bright span.cm-variable {color: #b9ca4a;} -.cm-s-tomorrow-night-bright span.cm-variable-2 {color: #7aa6da;} -.cm-s-tomorrow-night-bright span.cm-def {color: #e78c45;} -.cm-s-tomorrow-night-bright span.cm-bracket {color: #eaeaea;} -.cm-s-tomorrow-night-bright span.cm-tag {color: #d54e53;} -.cm-s-tomorrow-night-bright span.cm-link {color: #a16a94;} -.cm-s-tomorrow-night-bright span.cm-error {background: #d54e53; color: #6A6A6A;} - -.cm-s-tomorrow-night-bright .CodeMirror-activeline-background {background: #2a2a2a !important;} -.cm-s-tomorrow-night-bright .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} +.cm-s-tomorrow-night-bright.CodeMirror { + background: #000000; + color: #eaeaea; +} + +.cm-s-tomorrow-night-bright div.CodeMirror-selected { + background: #424242 !important; +} + +.cm-s-tomorrow-night-bright .CodeMirror-gutters { + background: #000000; + border-right: 0px; +} + +.cm-s-tomorrow-night-bright .CodeMirror-guttermarker { + color: #e78c45; +} + +.cm-s-tomorrow-night-bright .CodeMirror-guttermarker-subtle { + color: #777; +} + +.cm-s-tomorrow-night-bright .CodeMirror-linenumber { + color: #424242; +} + +.cm-s-tomorrow-night-bright .CodeMirror-cursor { + border-left: 1px solid #6A6A6A !important; +} + +.cm-s-tomorrow-night-bright span.cm-comment { + color: #d27b53; +} + +.cm-s-tomorrow-night-bright span.cm-atom { + color: #a16a94; +} + +.cm-s-tomorrow-night-bright span.cm-number { + color: #a16a94; +} + +.cm-s-tomorrow-night-bright span.cm-property, .cm-s-tomorrow-night-bright span.cm-attribute { + color: #99cc99; +} + +.cm-s-tomorrow-night-bright span.cm-keyword { + color: #d54e53; +} + +.cm-s-tomorrow-night-bright span.cm-string { + color: #e7c547; +} + +.cm-s-tomorrow-night-bright span.cm-variable { + color: #b9ca4a; +} + +.cm-s-tomorrow-night-bright span.cm-variable-2 { + color: #7aa6da; +} + +.cm-s-tomorrow-night-bright span.cm-def { + color: #e78c45; +} + +.cm-s-tomorrow-night-bright span.cm-bracket { + color: #eaeaea; +} + +.cm-s-tomorrow-night-bright span.cm-tag { + color: #d54e53; +} + +.cm-s-tomorrow-night-bright span.cm-link { + color: #a16a94; +} + +.cm-s-tomorrow-night-bright span.cm-error { + background: #d54e53; + color: #6A6A6A; +} + +.cm-s-tomorrow-night-bright .CodeMirror-activeline-background { + background: #2a2a2a !important; +} + +.cm-s-tomorrow-night-bright .CodeMirror-matchingbracket { + text-decoration: underline; + color: white !important; +} diff --git a/web/editor.md/lib/codemirror/theme/tomorrow-night-eighties.css b/web/editor.md/lib/codemirror/theme/tomorrow-night-eighties.css index 5fca3ca..a2dae76 100644 --- a/web/editor.md/lib/codemirror/theme/tomorrow-night-eighties.css +++ b/web/editor.md/lib/codemirror/theme/tomorrow-night-eighties.css @@ -8,31 +8,102 @@ */ -.cm-s-tomorrow-night-eighties.CodeMirror {background: #000000; color: #CCCCCC;} -.cm-s-tomorrow-night-eighties div.CodeMirror-selected {background: #2D2D2D !important;} -.cm-s-tomorrow-night-eighties.CodeMirror ::selection { background: rgba(45, 45, 45, 0.99); } -.cm-s-tomorrow-night-eighties.CodeMirror ::-moz-selection { background: rgba(45, 45, 45, 0.99); } -.cm-s-tomorrow-night-eighties .CodeMirror-gutters {background: #000000; border-right: 0px;} -.cm-s-tomorrow-night-eighties .CodeMirror-guttermarker { color: #f2777a; } -.cm-s-tomorrow-night-eighties .CodeMirror-guttermarker-subtle { color: #777; } -.cm-s-tomorrow-night-eighties .CodeMirror-linenumber {color: #515151;} -.cm-s-tomorrow-night-eighties .CodeMirror-cursor {border-left: 1px solid #6A6A6A !important;} - -.cm-s-tomorrow-night-eighties span.cm-comment {color: #d27b53;} -.cm-s-tomorrow-night-eighties span.cm-atom {color: #a16a94;} -.cm-s-tomorrow-night-eighties span.cm-number {color: #a16a94;} - -.cm-s-tomorrow-night-eighties span.cm-property, .cm-s-tomorrow-night-eighties span.cm-attribute {color: #99cc99;} -.cm-s-tomorrow-night-eighties span.cm-keyword {color: #f2777a;} -.cm-s-tomorrow-night-eighties span.cm-string {color: #ffcc66;} - -.cm-s-tomorrow-night-eighties span.cm-variable {color: #99cc99;} -.cm-s-tomorrow-night-eighties span.cm-variable-2 {color: #6699cc;} -.cm-s-tomorrow-night-eighties span.cm-def {color: #f99157;} -.cm-s-tomorrow-night-eighties span.cm-bracket {color: #CCCCCC;} -.cm-s-tomorrow-night-eighties span.cm-tag {color: #f2777a;} -.cm-s-tomorrow-night-eighties span.cm-link {color: #a16a94;} -.cm-s-tomorrow-night-eighties span.cm-error {background: #f2777a; color: #6A6A6A;} - -.cm-s-tomorrow-night-eighties .CodeMirror-activeline-background {background: #343600 !important;} -.cm-s-tomorrow-night-eighties .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} +.cm-s-tomorrow-night-eighties.CodeMirror { + background: #000000; + color: #CCCCCC; +} + +.cm-s-tomorrow-night-eighties div.CodeMirror-selected { + background: #2D2D2D !important; +} + +.cm-s-tomorrow-night-eighties.CodeMirror ::selection { + background: rgba(45, 45, 45, 0.99); +} + +.cm-s-tomorrow-night-eighties.CodeMirror ::-moz-selection { + background: rgba(45, 45, 45, 0.99); +} + +.cm-s-tomorrow-night-eighties .CodeMirror-gutters { + background: #000000; + border-right: 0px; +} + +.cm-s-tomorrow-night-eighties .CodeMirror-guttermarker { + color: #f2777a; +} + +.cm-s-tomorrow-night-eighties .CodeMirror-guttermarker-subtle { + color: #777; +} + +.cm-s-tomorrow-night-eighties .CodeMirror-linenumber { + color: #515151; +} + +.cm-s-tomorrow-night-eighties .CodeMirror-cursor { + border-left: 1px solid #6A6A6A !important; +} + +.cm-s-tomorrow-night-eighties span.cm-comment { + color: #d27b53; +} + +.cm-s-tomorrow-night-eighties span.cm-atom { + color: #a16a94; +} + +.cm-s-tomorrow-night-eighties span.cm-number { + color: #a16a94; +} + +.cm-s-tomorrow-night-eighties span.cm-property, .cm-s-tomorrow-night-eighties span.cm-attribute { + color: #99cc99; +} + +.cm-s-tomorrow-night-eighties span.cm-keyword { + color: #f2777a; +} + +.cm-s-tomorrow-night-eighties span.cm-string { + color: #ffcc66; +} + +.cm-s-tomorrow-night-eighties span.cm-variable { + color: #99cc99; +} + +.cm-s-tomorrow-night-eighties span.cm-variable-2 { + color: #6699cc; +} + +.cm-s-tomorrow-night-eighties span.cm-def { + color: #f99157; +} + +.cm-s-tomorrow-night-eighties span.cm-bracket { + color: #CCCCCC; +} + +.cm-s-tomorrow-night-eighties span.cm-tag { + color: #f2777a; +} + +.cm-s-tomorrow-night-eighties span.cm-link { + color: #a16a94; +} + +.cm-s-tomorrow-night-eighties span.cm-error { + background: #f2777a; + color: #6A6A6A; +} + +.cm-s-tomorrow-night-eighties .CodeMirror-activeline-background { + background: #343600 !important; +} + +.cm-s-tomorrow-night-eighties .CodeMirror-matchingbracket { + text-decoration: underline; + color: white !important; +} diff --git a/web/editor.md/lib/codemirror/theme/twilight.css b/web/editor.md/lib/codemirror/theme/twilight.css index 889a83d..268be4c 100644 --- a/web/editor.md/lib/codemirror/theme/twilight.css +++ b/web/editor.md/lib/codemirror/theme/twilight.css @@ -1,32 +1,139 @@ -.cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/ -.cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/ -.cm-s-twilight.CodeMirror ::selection { background: rgba(50, 50, 50, 0.99); } -.cm-s-twilight.CodeMirror ::-moz-selection { background: rgba(50, 50, 50, 0.99); } - -.cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; } -.cm-s-twilight .CodeMirror-guttermarker { color: white; } -.cm-s-twilight .CodeMirror-guttermarker-subtle { color: #aaa; } -.cm-s-twilight .CodeMirror-linenumber { color: #aaa; } -.cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; } - -.cm-s-twilight .cm-keyword { color: #f9ee98; } /**/ -.cm-s-twilight .cm-atom { color: #FC0; } -.cm-s-twilight .cm-number { color: #ca7841; } /**/ -.cm-s-twilight .cm-def { color: #8DA6CE; } -.cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/ -.cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/ -.cm-s-twilight .cm-operator { color: #cda869; } /**/ -.cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/ -.cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/ -.cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/ -.cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/ -.cm-s-twilight .cm-builtin { color: #cda869; } /*?*/ -.cm-s-twilight .cm-tag { color: #997643; } /**/ -.cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/ -.cm-s-twilight .cm-header { color: #FF6400; } -.cm-s-twilight .cm-hr { color: #AEAEAE; } -.cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/ -.cm-s-twilight .cm-error { border-bottom: 1px solid red; } - -.cm-s-twilight .CodeMirror-activeline-background {background: #27282E !important;} -.cm-s-twilight .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} +.cm-s-twilight.CodeMirror { + background: #141414; + color: #f7f7f7; +} + +/**/ +.cm-s-twilight .CodeMirror-selected { + background: #323232 !important; +} + +/**/ +.cm-s-twilight.CodeMirror ::selection { + background: rgba(50, 50, 50, 0.99); +} + +.cm-s-twilight.CodeMirror ::-moz-selection { + background: rgba(50, 50, 50, 0.99); +} + +.cm-s-twilight .CodeMirror-gutters { + background: #222; + border-right: 1px solid #aaa; +} + +.cm-s-twilight .CodeMirror-guttermarker { + color: white; +} + +.cm-s-twilight .CodeMirror-guttermarker-subtle { + color: #aaa; +} + +.cm-s-twilight .CodeMirror-linenumber { + color: #aaa; +} + +.cm-s-twilight .CodeMirror-cursor { + border-left: 1px solid white !important; +} + +.cm-s-twilight .cm-keyword { + color: #f9ee98; +} + +/**/ +.cm-s-twilight .cm-atom { + color: #FC0; +} + +.cm-s-twilight .cm-number { + color: #ca7841; +} + +/**/ +.cm-s-twilight .cm-def { + color: #8DA6CE; +} + +.cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { + color: #607392; +} + +/**/ +.cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { + color: #607392; +} + +/**/ +.cm-s-twilight .cm-operator { + color: #cda869; +} + +/**/ +.cm-s-twilight .cm-comment { + color: #777; + font-style: italic; + font-weight: normal; +} + +/**/ +.cm-s-twilight .cm-string { + color: #8f9d6a; + font-style: italic; +} + +/**/ +.cm-s-twilight .cm-string-2 { + color: #bd6b18 +} + +/*?*/ +.cm-s-twilight .cm-meta { + background-color: #141414; + color: #f7f7f7; +} + +/*?*/ +.cm-s-twilight .cm-builtin { + color: #cda869; +} + +/*?*/ +.cm-s-twilight .cm-tag { + color: #997643; +} + +/**/ +.cm-s-twilight .cm-attribute { + color: #d6bb6d; +} + +/*?*/ +.cm-s-twilight .cm-header { + color: #FF6400; +} + +.cm-s-twilight .cm-hr { + color: #AEAEAE; +} + +.cm-s-twilight .cm-link { + color: #ad9361; + font-style: italic; + text-decoration: none; +} + +/**/ +.cm-s-twilight .cm-error { + border-bottom: 1px solid red; +} + +.cm-s-twilight .CodeMirror-activeline-background { + background: #27282E !important; +} + +.cm-s-twilight .CodeMirror-matchingbracket { + outline: 1px solid grey; + color: white !important; +} diff --git a/web/editor.md/lib/codemirror/theme/vibrant-ink.css b/web/editor.md/lib/codemirror/theme/vibrant-ink.css index 8ea5359..aecf74a 100644 --- a/web/editor.md/lib/codemirror/theme/vibrant-ink.css +++ b/web/editor.md/lib/codemirror/theme/vibrant-ink.css @@ -1,34 +1,121 @@ /* Taken from the popular Visual Studio Vibrant Ink Schema */ -.cm-s-vibrant-ink.CodeMirror { background: black; color: white; } -.cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; } -.cm-s-vibrant-ink.CodeMirror ::selection { background: rgba(53, 73, 60, 0.99); } -.cm-s-vibrant-ink.CodeMirror ::-moz-selection { background: rgba(53, 73, 60, 0.99); } - -.cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } -.cm-s-vibrant-ink .CodeMirror-guttermarker { color: white; } -.cm-s-vibrant-ink .CodeMirror-guttermarker-subtle { color: #d0d0d0; } -.cm-s-vibrant-ink .CodeMirror-linenumber { color: #d0d0d0; } -.cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; } - -.cm-s-vibrant-ink .cm-keyword { color: #CC7832; } -.cm-s-vibrant-ink .cm-atom { color: #FC0; } -.cm-s-vibrant-ink .cm-number { color: #FFEE98; } -.cm-s-vibrant-ink .cm-def { color: #8DA6CE; } -.cm-s-vibrant-ink span.cm-variable-2, .cm-s-vibrant span.cm-tag { color: #FFC66D } -.cm-s-vibrant-ink span.cm-variable-3, .cm-s-vibrant span.cm-def { color: #FFC66D } -.cm-s-vibrant-ink .cm-operator { color: #888; } -.cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; } -.cm-s-vibrant-ink .cm-string { color: #A5C25C } -.cm-s-vibrant-ink .cm-string-2 { color: red } -.cm-s-vibrant-ink .cm-meta { color: #D8FA3C; } -.cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; } -.cm-s-vibrant-ink .cm-tag { color: #8DA6CE; } -.cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; } -.cm-s-vibrant-ink .cm-header { color: #FF6400; } -.cm-s-vibrant-ink .cm-hr { color: #AEAEAE; } -.cm-s-vibrant-ink .cm-link { color: blue; } -.cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; } - -.cm-s-vibrant-ink .CodeMirror-activeline-background {background: #27282E !important;} -.cm-s-vibrant-ink .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} +.cm-s-vibrant-ink.CodeMirror { + background: black; + color: white; +} + +.cm-s-vibrant-ink .CodeMirror-selected { + background: #35493c !important; +} + +.cm-s-vibrant-ink.CodeMirror ::selection { + background: rgba(53, 73, 60, 0.99); +} + +.cm-s-vibrant-ink.CodeMirror ::-moz-selection { + background: rgba(53, 73, 60, 0.99); +} + +.cm-s-vibrant-ink .CodeMirror-gutters { + background: #002240; + border-right: 1px solid #aaa; +} + +.cm-s-vibrant-ink .CodeMirror-guttermarker { + color: white; +} + +.cm-s-vibrant-ink .CodeMirror-guttermarker-subtle { + color: #d0d0d0; +} + +.cm-s-vibrant-ink .CodeMirror-linenumber { + color: #d0d0d0; +} + +.cm-s-vibrant-ink .CodeMirror-cursor { + border-left: 1px solid white !important; +} + +.cm-s-vibrant-ink .cm-keyword { + color: #CC7832; +} + +.cm-s-vibrant-ink .cm-atom { + color: #FC0; +} + +.cm-s-vibrant-ink .cm-number { + color: #FFEE98; +} + +.cm-s-vibrant-ink .cm-def { + color: #8DA6CE; +} + +.cm-s-vibrant-ink span.cm-variable-2, .cm-s-vibrant span.cm-tag { + color: #FFC66D +} + +.cm-s-vibrant-ink span.cm-variable-3, .cm-s-vibrant span.cm-def { + color: #FFC66D +} + +.cm-s-vibrant-ink .cm-operator { + color: #888; +} + +.cm-s-vibrant-ink .cm-comment { + color: gray; + font-weight: bold; +} + +.cm-s-vibrant-ink .cm-string { + color: #A5C25C +} + +.cm-s-vibrant-ink .cm-string-2 { + color: red +} + +.cm-s-vibrant-ink .cm-meta { + color: #D8FA3C; +} + +.cm-s-vibrant-ink .cm-builtin { + color: #8DA6CE; +} + +.cm-s-vibrant-ink .cm-tag { + color: #8DA6CE; +} + +.cm-s-vibrant-ink .cm-attribute { + color: #8DA6CE; +} + +.cm-s-vibrant-ink .cm-header { + color: #FF6400; +} + +.cm-s-vibrant-ink .cm-hr { + color: #AEAEAE; +} + +.cm-s-vibrant-ink .cm-link { + color: blue; +} + +.cm-s-vibrant-ink .cm-error { + border-bottom: 1px solid red; +} + +.cm-s-vibrant-ink .CodeMirror-activeline-background { + background: #27282E !important; +} + +.cm-s-vibrant-ink .CodeMirror-matchingbracket { + outline: 1px solid grey; + color: white !important; +} diff --git a/web/editor.md/lib/codemirror/theme/xq-dark.css b/web/editor.md/lib/codemirror/theme/xq-dark.css index d537993..371c5a0 100644 --- a/web/editor.md/lib/codemirror/theme/xq-dark.css +++ b/web/editor.md/lib/codemirror/theme/xq-dark.css @@ -20,34 +20,120 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -.cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; } -.cm-s-xq-dark .CodeMirror-selected { background: #27007A !important; } -.cm-s-xq-dark.CodeMirror ::selection { background: rgba(39, 0, 122, 0.99); } -.cm-s-xq-dark.CodeMirror ::-moz-selection { background: rgba(39, 0, 122, 0.99); } -.cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } -.cm-s-xq-dark .CodeMirror-guttermarker { color: #FFBD40; } -.cm-s-xq-dark .CodeMirror-guttermarker-subtle { color: #f8f8f8; } -.cm-s-xq-dark .CodeMirror-linenumber { color: #f8f8f8; } -.cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; } - -.cm-s-xq-dark span.cm-keyword {color: #FFBD40;} -.cm-s-xq-dark span.cm-atom {color: #6C8CD5;} -.cm-s-xq-dark span.cm-number {color: #164;} -.cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;} -.cm-s-xq-dark span.cm-variable {color: #FFF;} -.cm-s-xq-dark span.cm-variable-2 {color: #EEE;} -.cm-s-xq-dark span.cm-variable-3 {color: #DDD;} -.cm-s-xq-dark span.cm-property {} -.cm-s-xq-dark span.cm-operator {} -.cm-s-xq-dark span.cm-comment {color: gray;} -.cm-s-xq-dark span.cm-string {color: #9FEE00;} -.cm-s-xq-dark span.cm-meta {color: yellow;} -.cm-s-xq-dark span.cm-qualifier {color: #FFF700;} -.cm-s-xq-dark span.cm-builtin {color: #30a;} -.cm-s-xq-dark span.cm-bracket {color: #cc7;} -.cm-s-xq-dark span.cm-tag {color: #FFBD40;} -.cm-s-xq-dark span.cm-attribute {color: #FFF700;} -.cm-s-xq-dark span.cm-error {color: #f00;} - -.cm-s-xq-dark .CodeMirror-activeline-background {background: #27282E !important;} -.cm-s-xq-dark .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} \ No newline at end of file +.cm-s-xq-dark.CodeMirror { + background: #0a001f; + color: #f8f8f8; +} + +.cm-s-xq-dark .CodeMirror-selected { + background: #27007A !important; +} + +.cm-s-xq-dark.CodeMirror ::selection { + background: rgba(39, 0, 122, 0.99); +} + +.cm-s-xq-dark.CodeMirror ::-moz-selection { + background: rgba(39, 0, 122, 0.99); +} + +.cm-s-xq-dark .CodeMirror-gutters { + background: #0a001f; + border-right: 1px solid #aaa; +} + +.cm-s-xq-dark .CodeMirror-guttermarker { + color: #FFBD40; +} + +.cm-s-xq-dark .CodeMirror-guttermarker-subtle { + color: #f8f8f8; +} + +.cm-s-xq-dark .CodeMirror-linenumber { + color: #f8f8f8; +} + +.cm-s-xq-dark .CodeMirror-cursor { + border-left: 1px solid white !important; +} + +.cm-s-xq-dark span.cm-keyword { + color: #FFBD40; +} + +.cm-s-xq-dark span.cm-atom { + color: #6C8CD5; +} + +.cm-s-xq-dark span.cm-number { + color: #164; +} + +.cm-s-xq-dark span.cm-def { + color: #FFF; + text-decoration: underline; +} + +.cm-s-xq-dark span.cm-variable { + color: #FFF; +} + +.cm-s-xq-dark span.cm-variable-2 { + color: #EEE; +} + +.cm-s-xq-dark span.cm-variable-3 { + color: #DDD; +} + +.cm-s-xq-dark span.cm-property { +} + +.cm-s-xq-dark span.cm-operator { +} + +.cm-s-xq-dark span.cm-comment { + color: gray; +} + +.cm-s-xq-dark span.cm-string { + color: #9FEE00; +} + +.cm-s-xq-dark span.cm-meta { + color: yellow; +} + +.cm-s-xq-dark span.cm-qualifier { + color: #FFF700; +} + +.cm-s-xq-dark span.cm-builtin { + color: #30a; +} + +.cm-s-xq-dark span.cm-bracket { + color: #cc7; +} + +.cm-s-xq-dark span.cm-tag { + color: #FFBD40; +} + +.cm-s-xq-dark span.cm-attribute { + color: #FFF700; +} + +.cm-s-xq-dark span.cm-error { + color: #f00; +} + +.cm-s-xq-dark .CodeMirror-activeline-background { + background: #27282E !important; +} + +.cm-s-xq-dark .CodeMirror-matchingbracket { + outline: 1px solid grey; + color: white !important; +} \ No newline at end of file diff --git a/web/editor.md/lib/codemirror/theme/xq-light.css b/web/editor.md/lib/codemirror/theme/xq-light.css index 20b5c79..1c1dd6e 100644 --- a/web/editor.md/lib/codemirror/theme/xq-light.css +++ b/web/editor.md/lib/codemirror/theme/xq-light.css @@ -20,24 +20,85 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -.cm-s-xq-light span.cm-keyword {line-height: 1em; font-weight: bold; color: #5A5CAD; } -.cm-s-xq-light span.cm-atom {color: #6C8CD5;} -.cm-s-xq-light span.cm-number {color: #164;} -.cm-s-xq-light span.cm-def {text-decoration:underline;} -.cm-s-xq-light span.cm-variable {color: black; } -.cm-s-xq-light span.cm-variable-2 {color:black;} -.cm-s-xq-light span.cm-variable-3 {color: black; } -.cm-s-xq-light span.cm-property {} -.cm-s-xq-light span.cm-operator {} -.cm-s-xq-light span.cm-comment {color: #0080FF; font-style: italic;} -.cm-s-xq-light span.cm-string {color: red;} -.cm-s-xq-light span.cm-meta {color: yellow;} -.cm-s-xq-light span.cm-qualifier {color: grey} -.cm-s-xq-light span.cm-builtin {color: #7EA656;} -.cm-s-xq-light span.cm-bracket {color: #cc7;} -.cm-s-xq-light span.cm-tag {color: #3F7F7F;} -.cm-s-xq-light span.cm-attribute {color: #7F007F;} -.cm-s-xq-light span.cm-error {color: #f00;} - -.cm-s-xq-light .CodeMirror-activeline-background {background: #e8f2ff !important;} -.cm-s-xq-light .CodeMirror-matchingbracket {outline:1px solid grey;color:black !important;background:yellow;} \ No newline at end of file +.cm-s-xq-light span.cm-keyword { + line-height: 1em; + font-weight: bold; + color: #5A5CAD; +} + +.cm-s-xq-light span.cm-atom { + color: #6C8CD5; +} + +.cm-s-xq-light span.cm-number { + color: #164; +} + +.cm-s-xq-light span.cm-def { + text-decoration: underline; +} + +.cm-s-xq-light span.cm-variable { + color: black; +} + +.cm-s-xq-light span.cm-variable-2 { + color: black; +} + +.cm-s-xq-light span.cm-variable-3 { + color: black; +} + +.cm-s-xq-light span.cm-property { +} + +.cm-s-xq-light span.cm-operator { +} + +.cm-s-xq-light span.cm-comment { + color: #0080FF; + font-style: italic; +} + +.cm-s-xq-light span.cm-string { + color: red; +} + +.cm-s-xq-light span.cm-meta { + color: yellow; +} + +.cm-s-xq-light span.cm-qualifier { + color: grey +} + +.cm-s-xq-light span.cm-builtin { + color: #7EA656; +} + +.cm-s-xq-light span.cm-bracket { + color: #cc7; +} + +.cm-s-xq-light span.cm-tag { + color: #3F7F7F; +} + +.cm-s-xq-light span.cm-attribute { + color: #7F007F; +} + +.cm-s-xq-light span.cm-error { + color: #f00; +} + +.cm-s-xq-light .CodeMirror-activeline-background { + background: #e8f2ff !important; +} + +.cm-s-xq-light .CodeMirror-matchingbracket { + outline: 1px solid grey; + color: black !important; + background: yellow; +} \ No newline at end of file diff --git a/web/editor.md/lib/codemirror/theme/zenburn.css b/web/editor.md/lib/codemirror/theme/zenburn.css index f817198..7428727 100644 --- a/web/editor.md/lib/codemirror/theme/zenburn.css +++ b/web/editor.md/lib/codemirror/theme/zenburn.css @@ -8,30 +8,116 @@ * From: https://github.com/wisenomad/zenburn-lighttable-theme/blob/master/zenburn.css */ -.cm-s-zenburn .CodeMirror-gutters { background: #3f3f3f !important; } -.cm-s-zenburn .CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded { color: #999; } -.cm-s-zenburn .CodeMirror-cursor { border-left: 1px solid white !important; } -.cm-s-zenburn { background-color: #3f3f3f; color: #dcdccc; } -.cm-s-zenburn span.cm-builtin { color: #dcdccc; font-weight: bold; } -.cm-s-zenburn span.cm-comment { color: #7f9f7f; } -.cm-s-zenburn span.cm-keyword { color: #f0dfaf; font-weight: bold; } -.cm-s-zenburn span.cm-atom { color: #bfebbf; } -.cm-s-zenburn span.cm-def { color: #dcdccc; } -.cm-s-zenburn span.cm-variable { color: #dfaf8f; } -.cm-s-zenburn span.cm-variable-2 { color: #dcdccc; } -.cm-s-zenburn span.cm-string { color: #cc9393; } -.cm-s-zenburn span.cm-string-2 { color: #cc9393; } -.cm-s-zenburn span.cm-number { color: #dcdccc; } -.cm-s-zenburn span.cm-tag { color: #93e0e3; } -.cm-s-zenburn span.cm-property { color: #dfaf8f; } -.cm-s-zenburn span.cm-attribute { color: #dfaf8f; } -.cm-s-zenburn span.cm-qualifier { color: #7cb8bb; } -.cm-s-zenburn span.cm-meta { color: #f0dfaf; } -.cm-s-zenburn span.cm-header { color: #f0efd0; } -.cm-s-zenburn span.cm-operator { color: #f0efd0; } -.cm-s-zenburn span.CodeMirror-matchingbracket { box-sizing: border-box; background: transparent; border-bottom: 1px solid; } -.cm-s-zenburn span.CodeMirror-nonmatchingbracket { border-bottom: 1px solid; background: none; } -.cm-s-zenburn .CodeMirror-activeline { background: #000000; } -.cm-s-zenburn .CodeMirror-activeline-background { background: #000000; } -.cm-s-zenburn .CodeMirror-selected { background: #545454; } -.cm-s-zenburn .CodeMirror-focused .CodeMirror-selected { background: #4f4f4f; } +.cm-s-zenburn .CodeMirror-gutters { + background: #3f3f3f !important; +} + +.cm-s-zenburn .CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded { + color: #999; +} + +.cm-s-zenburn .CodeMirror-cursor { + border-left: 1px solid white !important; +} + +.cm-s-zenburn { + background-color: #3f3f3f; + color: #dcdccc; +} + +.cm-s-zenburn span.cm-builtin { + color: #dcdccc; + font-weight: bold; +} + +.cm-s-zenburn span.cm-comment { + color: #7f9f7f; +} + +.cm-s-zenburn span.cm-keyword { + color: #f0dfaf; + font-weight: bold; +} + +.cm-s-zenburn span.cm-atom { + color: #bfebbf; +} + +.cm-s-zenburn span.cm-def { + color: #dcdccc; +} + +.cm-s-zenburn span.cm-variable { + color: #dfaf8f; +} + +.cm-s-zenburn span.cm-variable-2 { + color: #dcdccc; +} + +.cm-s-zenburn span.cm-string { + color: #cc9393; +} + +.cm-s-zenburn span.cm-string-2 { + color: #cc9393; +} + +.cm-s-zenburn span.cm-number { + color: #dcdccc; +} + +.cm-s-zenburn span.cm-tag { + color: #93e0e3; +} + +.cm-s-zenburn span.cm-property { + color: #dfaf8f; +} + +.cm-s-zenburn span.cm-attribute { + color: #dfaf8f; +} + +.cm-s-zenburn span.cm-qualifier { + color: #7cb8bb; +} + +.cm-s-zenburn span.cm-meta { + color: #f0dfaf; +} + +.cm-s-zenburn span.cm-header { + color: #f0efd0; +} + +.cm-s-zenburn span.cm-operator { + color: #f0efd0; +} + +.cm-s-zenburn span.CodeMirror-matchingbracket { + box-sizing: border-box; + background: transparent; + border-bottom: 1px solid; +} + +.cm-s-zenburn span.CodeMirror-nonmatchingbracket { + border-bottom: 1px solid; + background: none; +} + +.cm-s-zenburn .CodeMirror-activeline { + background: #000000; +} + +.cm-s-zenburn .CodeMirror-activeline-background { + background: #000000; +} + +.cm-s-zenburn .CodeMirror-selected { + background: #545454; +} + +.cm-s-zenburn .CodeMirror-focused .CodeMirror-selected { + background: #4f4f4f; +} diff --git a/web/editor.md/plugins/code-block-dialog/code-block-dialog.js b/web/editor.md/plugins/code-block-dialog/code-block-dialog.js index b4b0d8c..45b57c7 100644 --- a/web/editor.md/plugins/code-block-dialog/code-block-dialog.js +++ b/web/editor.md/plugins/code-block-dialog/code-block-dialog.js @@ -9,69 +9,68 @@ * @license MIT */ -(function() { +(function () { var factory = function (exports) { - var cmEditor; - var pluginName = "code-block-dialog"; - - // for CodeBlock dialog select - var codeLanguages = exports.codeLanguages = { - asp : ["ASP", "vbscript"], - actionscript : ["ActionScript(3.0)/Flash/Flex", "clike"], - bash : ["Bash/Bat", "shell"], - css : ["CSS", "css"], - c : ["C", "clike"], - cpp : ["C++", "clike"], - csharp : ["C#", "clike"], - coffeescript : ["CoffeeScript", "coffeescript"], - d : ["D", "d"], - dart : ["Dart", "dart"], - delphi : ["Delphi/Pascal", "pascal"], - erlang : ["Erlang", "erlang"], - go : ["Golang", "go"], - groovy : ["Groovy", "groovy"], - html : ["HTML", "text/html"], - java : ["Java", "clike"], - json : ["JSON", "text/json"], - javascript : ["Javascript", "javascript"], - lua : ["Lua", "lua"], - less : ["LESS", "css"], - markdown : ["Markdown", "gfm"], - "objective-c" : ["Objective-C", "clike"], - php : ["PHP", "php"], - perl : ["Perl", "perl"], - python : ["Python", "python"], - r : ["R", "r"], - rst : ["reStructedText", "rst"], - ruby : ["Ruby", "ruby"], - sql : ["SQL", "sql"], - sass : ["SASS/SCSS", "sass"], - shell : ["Shell", "shell"], - scala : ["Scala", "clike"], - swift : ["Swift", "clike"], - vb : ["VB/VBScript", "vb"], - xml : ["XML", "text/xml"], - yaml : ["YAML", "yaml"] - }; - - exports.fn.codeBlockDialog = function() { - - var _this = this; - var cm = this.cm; - var lang = this.lang; - var editor = this.editor; - var settings = this.settings; - var cursor = cm.getCursor(); - var selection = cm.getSelection(); + var cmEditor; + var pluginName = "code-block-dialog"; + + // for CodeBlock dialog select + var codeLanguages = exports.codeLanguages = { + asp: ["ASP", "vbscript"], + actionscript: ["ActionScript(3.0)/Flash/Flex", "clike"], + bash: ["Bash/Bat", "shell"], + css: ["CSS", "css"], + c: ["C", "clike"], + cpp: ["C++", "clike"], + csharp: ["C#", "clike"], + coffeescript: ["CoffeeScript", "coffeescript"], + d: ["D", "d"], + dart: ["Dart", "dart"], + delphi: ["Delphi/Pascal", "pascal"], + erlang: ["Erlang", "erlang"], + go: ["Golang", "go"], + groovy: ["Groovy", "groovy"], + html: ["HTML", "text/html"], + java: ["Java", "clike"], + json: ["JSON", "text/json"], + javascript: ["Javascript", "javascript"], + lua: ["Lua", "lua"], + less: ["LESS", "css"], + markdown: ["Markdown", "gfm"], + "objective-c": ["Objective-C", "clike"], + php: ["PHP", "php"], + perl: ["Perl", "perl"], + python: ["Python", "python"], + r: ["R", "r"], + rst: ["reStructedText", "rst"], + ruby: ["Ruby", "ruby"], + sql: ["SQL", "sql"], + sass: ["SASS/SCSS", "sass"], + shell: ["Shell", "shell"], + scala: ["Scala", "clike"], + swift: ["Swift", "clike"], + vb: ["VB/VBScript", "vb"], + xml: ["XML", "text/xml"], + yaml: ["YAML", "yaml"] + }; + + exports.fn.codeBlockDialog = function () { + + var _this = this; + var cm = this.cm; + var lang = this.lang; + var editor = this.editor; + var settings = this.settings; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); var classPrefix = this.classPrefix; - var dialogName = classPrefix + pluginName, dialog; - var dialogLang = lang.dialog.codeBlock; + var dialogName = classPrefix + pluginName, dialog; + var dialogLang = lang.dialog.codeBlock; - cm.focus(); + cm.focus(); - if (editor.find("." + dialogName).length > 0) - { + if (editor.find("." + dialogName).length > 0) { dialog = editor.find("." + dialogName); dialog.find("option:first").attr("selected", "selected"); dialog.find("textarea").val(selection); @@ -79,40 +78,36 @@ this.dialogShowMask(dialog); this.dialogLockScreen(); dialog.show(); - } - else - { + } else { var dialogHTML = "
    " + - dialogLang.selectLabel + "" + - "
    " + - ""; + dialogLang.selectLabel + "" + + "
  • " + + ""; dialog = this.createDialog({ - name : dialogName, - title : dialogLang.title, - width : 780, - height : 565, - mask : settings.dialogShowMask, - drag : settings.dialogDraggable, - content : dialogHTML, - lockScreen : settings.dialogLockScreen, - maskStyle : { - opacity : settings.dialogMaskOpacity, - backgroundColor : settings.dialogMaskBgColor + name: dialogName, + title: dialogLang.title, + width: 780, + height: 565, + mask: settings.dialogShowMask, + drag: settings.dialogDraggable, + content: dialogHTML, + lockScreen: settings.dialogLockScreen, + maskStyle: { + opacity: settings.dialogMaskOpacity, + backgroundColor: settings.dialogMaskBgColor }, - buttons : { - enter : [lang.buttons.enter, function() { - var codeTexts = this.find("textarea").val(); - var langName = this.find("select").val(); + buttons: { + enter: [lang.buttons.enter, function () { + var codeTexts = this.find("textarea").val(); + var langName = this.find("select").val(); - if (langName === "") - { + if (langName === "") { alert(lang.dialog.codeBlock.unselectedLanguageAlert); return false; } - if (codeTexts === "") - { + if (codeTexts === "") { alert(lang.dialog.codeBlock.codeEmptyAlert); return false; } @@ -129,7 +124,7 @@ return false; }], - cancel : [lang.buttons.cancel, function() { + cancel: [lang.buttons.cancel, function () { this.hide().lockScreen(false).hideMask(); return false; @@ -138,100 +133,95 @@ }); } - var langSelect = dialog.find("select"); - - if (langSelect.find("option").length === 1) - { - for (var key in codeLanguages) - { - var codeLang = codeLanguages[key]; - langSelect.append(""); - } - - langSelect.append(""); - } - - var mode = langSelect.find("option:selected").attr("mode"); - - var cmConfig = { - mode : (mode) ? mode : "text/html", - theme : settings.theme, - tabSize : 4, - autofocus : true, - autoCloseTags : true, - indentUnit : 4, - lineNumbers : true, - lineWrapping : true, - extraKeys : {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }}, - foldGutter : true, - gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], - matchBrackets : true, - indentWithTabs : true, - styleActiveLine : true, - styleSelectedText : true, - autoCloseBrackets : true, - showTrailingSpace : true, - highlightSelectionMatches : true - }; - - var textarea = dialog.find("textarea"); - var cmObj = dialog.find(".CodeMirror"); - - if (dialog.find(".CodeMirror").length < 1) - { - cmEditor = exports.$CodeMirror.fromTextArea(textarea[0], cmConfig); - cmObj = dialog.find(".CodeMirror"); - - cmObj.css({ - "float" : "none", - margin : "8px 0", - border : "1px solid #ddd", - fontSize : settings.fontSize, - width : "100%", - height : "390px" - }); - - cmEditor.on("change", function(cm) { - textarea.val(cm.getValue()); - }); - } - else - { - - cmEditor.setValue(cm.getSelection()); - } - - langSelect.change(function(){ - var _mode = $(this).find("option:selected").attr("mode"); - cmEditor.setOption("mode", _mode); - }); - }; - - }; - - // CommonJS/Node.js - if (typeof require === "function" && typeof exports === "object" && typeof module === "object") - { + var langSelect = dialog.find("select"); + + if (langSelect.find("option").length === 1) { + for (var key in codeLanguages) { + var codeLang = codeLanguages[key]; + langSelect.append(""); + } + + langSelect.append(""); + } + + var mode = langSelect.find("option:selected").attr("mode"); + + var cmConfig = { + mode: (mode) ? mode : "text/html", + theme: settings.theme, + tabSize: 4, + autofocus: true, + autoCloseTags: true, + indentUnit: 4, + lineNumbers: true, + lineWrapping: true, + extraKeys: { + "Ctrl-Q": function (cm) { + cm.foldCode(cm.getCursor()); + } + }, + foldGutter: true, + gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], + matchBrackets: true, + indentWithTabs: true, + styleActiveLine: true, + styleSelectedText: true, + autoCloseBrackets: true, + showTrailingSpace: true, + highlightSelectionMatches: true + }; + + var textarea = dialog.find("textarea"); + var cmObj = dialog.find(".CodeMirror"); + + if (dialog.find(".CodeMirror").length < 1) { + cmEditor = exports.$CodeMirror.fromTextArea(textarea[0], cmConfig); + cmObj = dialog.find(".CodeMirror"); + + cmObj.css({ + "float": "none", + margin: "8px 0", + border: "1px solid #ddd", + fontSize: settings.fontSize, + width: "100%", + height: "390px" + }); + + cmEditor.on("change", function (cm) { + textarea.val(cm.getValue()); + }); + } else { + + cmEditor.setValue(cm.getSelection()); + } + + langSelect.change(function () { + var _mode = $(this).find("option:selected").attr("mode"); + cmEditor.setOption("mode", _mode); + }); + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { module.exports = factory; - } - else if (typeof define === "function") // AMD/CMD/Sea.js + } else if (typeof define === "function") // AMD/CMD/Sea.js { - if (define.amd) { // for Require.js + if (define.amd) { // for Require.js - define(["editormd"], function(editormd) { + define(["editormd"], function (editormd) { factory(editormd); }); - } else { // for Sea.js - define(function(require) { + } else { // for Sea.js + define(function (require) { var editormd = require("./../../editormd"); factory(editormd); }); - } - } - else - { + } + } else { factory(window.editormd); - } + } })(); diff --git a/web/editor.md/plugins/emoji-dialog/emoji-dialog.js b/web/editor.md/plugins/emoji-dialog/emoji-dialog.js index d43ef20..beecfa0 100644 --- a/web/editor.md/plugins/emoji-dialog/emoji-dialog.js +++ b/web/editor.md/plugins/emoji-dialog/emoji-dialog.js @@ -9,225 +9,207 @@ * @license MIT */ -(function() { - - var factory = function (exports) { - - var $ = jQuery; - var pluginName = "emoji-dialog"; - var emojiTabIndex = 0; - var emojiData = []; - var selecteds = []; - - var logoPrefix = "editormd-logo"; - var logos = [ - logoPrefix, - logoPrefix + "-1x", - logoPrefix + "-2x", - logoPrefix + "-3x", - logoPrefix + "-4x", - logoPrefix + "-5x", - logoPrefix + "-6x", - logoPrefix + "-7x", - logoPrefix + "-8x" - ]; - - var langs = { - "zh-cn" : { - toolbar : { - emoji : "Emoji 表情" - }, - dialog : { - emoji : { - title : "Emoji 表情" - } - } - }, - "zh-tw" : { - toolbar : { - emoji : "Emoji 表情" - }, - dialog : { - emoji : { - title : "Emoji 表情" - } - } - }, - "en" : { - toolbar : { - emoji : "Emoji" - }, - dialog : { - emoji : { - title : "Emoji" - } - } - } - }; - - exports.fn.emojiDialog = function() { - var _this = this; - var cm = this.cm; - var settings = _this.settings; - - if (!settings.emoji) - { +(function () { + + var factory = function (exports) { + + var $ = jQuery; + var pluginName = "emoji-dialog"; + var emojiTabIndex = 0; + var emojiData = []; + var selecteds = []; + + var logoPrefix = "editormd-logo"; + var logos = [ + logoPrefix, + logoPrefix + "-1x", + logoPrefix + "-2x", + logoPrefix + "-3x", + logoPrefix + "-4x", + logoPrefix + "-5x", + logoPrefix + "-6x", + logoPrefix + "-7x", + logoPrefix + "-8x" + ]; + + var langs = { + "zh-cn": { + toolbar: { + emoji: "Emoji 表情" + }, + dialog: { + emoji: { + title: "Emoji 表情" + } + } + }, + "zh-tw": { + toolbar: { + emoji: "Emoji 表情" + }, + dialog: { + emoji: { + title: "Emoji 表情" + } + } + }, + "en": { + toolbar: { + emoji: "Emoji" + }, + dialog: { + emoji: { + title: "Emoji" + } + } + } + }; + + exports.fn.emojiDialog = function () { + var _this = this; + var cm = this.cm; + var settings = _this.settings; + + if (!settings.emoji) { alert("settings.emoji == false"); - return ; + return; } - - var path = settings.pluginPath + pluginName + "/"; - var editor = this.editor; - var cursor = cm.getCursor(); - var selection = cm.getSelection(); - var classPrefix = this.classPrefix; - - $.extend(true, this.lang, langs[this.lang.name]); - this.setToolbar(); - - var lang = this.lang; - var dialogName = classPrefix + pluginName, dialog; - var dialogLang = lang.dialog.emoji; - - var dialogContent = [ - "
    ", - "
    ", - "
    ", - ].join("\n"); - - cm.focus(); - - if (editor.find("." + dialogName).length > 0) - { + + var path = settings.pluginPath + pluginName + "/"; + var editor = this.editor; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + var classPrefix = this.classPrefix; + + $.extend(true, this.lang, langs[this.lang.name]); + this.setToolbar(); + + var lang = this.lang; + var dialogName = classPrefix + pluginName, dialog; + var dialogLang = lang.dialog.emoji; + + var dialogContent = [ + "
    ", + "
    ", + "
    ", + ].join("\n"); + + cm.focus(); + + if (editor.find("." + dialogName).length > 0) { dialog = editor.find("." + dialogName); - selecteds = []; - dialog.find("a").removeClass("selected"); - - this.dialogShowMask(dialog); - this.dialogLockScreen(); - dialog.show(); - } - else - { - dialog = this.createDialog({ - name : dialogName, - title : dialogLang.title, - width : 800, - height : 475, - mask : settings.dialogShowMask, - drag : settings.dialogDraggable, - content : dialogContent, - lockScreen : settings.dialogLockScreen, - maskStyle : { - opacity : settings.dialogMaskOpacity, - backgroundColor : settings.dialogMaskBgColor - }, - buttons : { - enter : [lang.buttons.enter, function() { - cm.replaceSelection(selecteds.join(" ")); - this.hide().lockScreen(false).hideMask(); - - return false; - }], - cancel : [lang.buttons.cancel, function() { - this.hide().lockScreen(false).hideMask(); - - return false; - }] - } - }); - } - - var category = ["Github emoji", "Twemoji", "Font awesome", "Editor.md logo"]; - var tab = dialog.find("." + classPrefix + "tab"); - - if (tab.html() === "") - { - var head = ""; - - tab.append(head); - - var container = "
    "; - - for (var x = 0; x < 4; x++) - { - var display = (x === 0) ? "" : "display:none;"; - container += "
    "; - } - - container += "
    "; - - tab.append(container); - } - - var tabBoxs = tab.find("." + classPrefix + "tab-box"); + selecteds = []; + dialog.find("a").removeClass("selected"); + + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + } else { + dialog = this.createDialog({ + name: dialogName, + title: dialogLang.title, + width: 800, + height: 475, + mask: settings.dialogShowMask, + drag: settings.dialogDraggable, + content: dialogContent, + lockScreen: settings.dialogLockScreen, + maskStyle: { + opacity: settings.dialogMaskOpacity, + backgroundColor: settings.dialogMaskBgColor + }, + buttons: { + enter: [lang.buttons.enter, function () { + cm.replaceSelection(selecteds.join(" ")); + this.hide().lockScreen(false).hideMask(); + + return false; + }], + cancel: [lang.buttons.cancel, function () { + this.hide().lockScreen(false).hideMask(); + + return false; + }] + } + }); + } + + var category = ["Github emoji", "Twemoji", "Font awesome", "Editor.md logo"]; + var tab = dialog.find("." + classPrefix + "tab"); + + if (tab.html() === "") { + var head = ""; + + tab.append(head); + + var container = "
    "; + + for (var x = 0; x < 4; x++) { + var display = (x === 0) ? "" : "display:none;"; + container += "
    "; + } + + container += "
    "; + + tab.append(container); + } + + var tabBoxs = tab.find("." + classPrefix + "tab-box"); var emojiCategories = ["github-emoji", "twemoji", "font-awesome", logoPrefix]; - var drawTable = function() { + var drawTable = function () { var cname = emojiCategories[emojiTabIndex]; - var $data = emojiData[cname]; - var $tab = tabBoxs.eq(emojiTabIndex); + var $data = emojiData[cname]; + var $tab = tabBoxs.eq(emojiTabIndex); - if ($tab.html() !== "") { + if ($tab.html() !== "") { //console.log("break =>", cname); - return ; + return; } - - var pagination = function(data, type) { + + var pagination = function (data, type) { var rowNumber = (type === "editormd-logo") ? "5" : 20; var pageTotal = Math.ceil(data.length / rowNumber); - var table = "
    "; + var table = "
    "; - for (var i = 0; i < pageTotal; i++) - { + for (var i = 0; i < pageTotal; i++) { var row = "
    "; - for (var x = 0; x < rowNumber; x++) - { + for (var x = 0; x < rowNumber; x++) { var emoji = $.trim(data[(i * rowNumber) + x]); - - if (typeof emoji !== "undefined" && emoji !== "") - { + + if (typeof emoji !== "undefined" && emoji !== "") { var img = "", icon = ""; - - if (type === "github-emoji") - { + + if (type === "github-emoji") { var src = (emoji === "+1") ? "plus1" : emoji; - src = (src === "black_large_square") ? "black_square" : src; - src = (src === "moon") ? "waxing_gibbous_moon" : src; - - src = exports.emoji.path + src + exports.emoji.ext; - img = "\":""; + src = (src === "black_large_square") ? "black_square" : src; + src = (src === "moon") ? "waxing_gibbous_moon" : src; + + src = exports.emoji.path + src + exports.emoji.ext; + img = "\":""; row += "" + img + ""; - } - else if (type === "twemoji") - { + } else if (type === "twemoji") { var twemojiSrc = exports.twemoji.path + emoji + exports.twemoji.ext; img = "\"twemoji-""; row += "" + img + ""; - } - else if (type === "font-awesome") - { + } else if (type === "font-awesome") { icon = ""; row += "" + icon + ""; - } - else if (type === "editormd-logo") - { + } else if (type === "editormd-logo") { icon = ""; row += "" + icon + ""; } - } - else - { - row += ""; + } else { + row += ""; } } @@ -237,91 +219,79 @@ } table += "
    "; - + return table; }; - - if (emojiTabIndex === 0) - { - for (var i = 0, len = $data.length; i < len; i++) - { + + if (emojiTabIndex === 0) { + for (var i = 0, len = $data.length; i < len; i++) { var h4Style = (i === 0) ? " style=\"margin: 0 0 10px;\"" : " style=\"margin: 10px 0;\""; $tab.append("" + $data[i].category + ""); $tab.append(pagination($data[i].list, cname)); } - } - else - { + } else { $tab.append(pagination($data, cname)); } - $tab.find("." + classPrefix + "emoji-btn").bind(exports.mouseOrTouch("click", "touchend"), function() { - $(this).toggleClass("selected"); - - if ($(this).hasClass("selected")) - { - selecteds.push($(this).attr("value")); - } - }); - }; - - if (emojiData.length < 1) - { - if (typeof dialog.loading === "function") { + $tab.find("." + classPrefix + "emoji-btn").bind(exports.mouseOrTouch("click", "touchend"), function () { + $(this).toggleClass("selected"); + + if ($(this).hasClass("selected")) { + selecteds.push($(this).attr("value")); + } + }); + }; + + if (emojiData.length < 1) { + if (typeof dialog.loading === "function") { dialog.loading(true); } - $.getJSON(path + "emoji.json?temp=" + Math.random(), function(json) { + $.getJSON(path + "emoji.json?temp=" + Math.random(), function (json) { - if (typeof dialog.loading === "function") { + if (typeof dialog.loading === "function") { dialog.loading(false); } - emojiData = json; + emojiData = json; emojiData[logoPrefix] = logos; - drawTable(); - }); - } - else - { - drawTable(); - } - - tab.find("li").bind(exports.mouseOrTouch("click", "touchend"), function() { - var $this = $(this); - emojiTabIndex = $this.index(); - - $this.addClass("active").siblings().removeClass("active"); - tabBoxs.eq(emojiTabIndex).show().siblings().hide(); - drawTable(); - }); - }; - - }; - - // CommonJS/Node.js - if (typeof require === "function" && typeof exports === "object" && typeof module === "object") - { + drawTable(); + }); + } else { + drawTable(); + } + + tab.find("li").bind(exports.mouseOrTouch("click", "touchend"), function () { + var $this = $(this); + emojiTabIndex = $this.index(); + + $this.addClass("active").siblings().removeClass("active"); + tabBoxs.eq(emojiTabIndex).show().siblings().hide(); + drawTable(); + }); + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { module.exports = factory; - } - else if (typeof define === "function") // AMD/CMD/Sea.js + } else if (typeof define === "function") // AMD/CMD/Sea.js { - if (define.amd) { // for Require.js + if (define.amd) { // for Require.js - define(["editormd"], function(editormd) { + define(["editormd"], function (editormd) { factory(editormd); }); - } else { // for Sea.js - define(function(require) { + } else { // for Sea.js + define(function (require) { var editormd = require("./../../editormd"); factory(editormd); }); - } - } - else - { + } + } else { factory(window.editormd); - } + } })(); diff --git a/web/editor.md/plugins/emoji-dialog/emoji.json b/web/editor.md/plugins/emoji-dialog/emoji.json index 46d8473..d31b614 100644 --- a/web/editor.md/plugins/emoji-dialog/emoji.json +++ b/web/editor.md/plugins/emoji-dialog/emoji.json @@ -1,28 +1,3025 @@ { - "github-emoji" : [ - { - "category" :"People", - "list" : ["bowtie","smile","laughing","blush","smiley","relaxed","smirk","heart_eyes","kissing_heart","kissing_closed_eyes","flushed","relieved","satisfied","grin","wink","stuck_out_tongue_winking_eye","stuck_out_tongue_closed_eyes","grinning","kissing","kissing_smiling_eyes","stuck_out_tongue","sleeping","worried","frowning","anguished","open_mouth","grimacing","confused","hushed","expressionless","unamused","sweat_smile","sweat","disappointed_relieved","weary","pensive","disappointed","confounded","fearful","cold_sweat","persevere","cry","sob","joy","astonished","scream","neckbeard","tired_face","angry","rage","triumph","sleepy","yum","mask","sunglasses","dizzy_face","imp","smiling_imp","neutral_face","no_mouth","innocent","alien","yellow_heart","blue_heart","purple_heart","heart","green_heart","broken_heart","heartbeat","heartpulse","two_hearts","revolving_hearts","cupid","sparkling_heart","sparkles","star","star2","dizzy","boom","collision","anger","exclamation","question","grey_exclamation","grey_question","zzz","dash","sweat_drops","notes","musical_note","fire","hankey","poop","shit","+1","thumbsup","-1","thumbsdown","ok_hand","punch","facepunch","fist","v","wave","hand","raised_hand","open_hands","point_up","point_down","point_left","point_right","raised_hands","pray","point_up_2","clap","muscle","metal","fu","walking","runner","running","couple","family","two_men_holding_hands","two_women_holding_hands","dancer","dancers","ok_woman","no_good","information_desk_person","raising_hand","bride_with_veil","person_with_pouting_face","person_frowning","bow","couplekiss","couple_with_heart","massage","haircut","nail_care","boy","girl","woman","man","baby","older_woman","older_man","person_with_blond_hair","man_with_gua_pi_mao","man_with_turban","construction_worker","cop","angel","princess","smiley_cat","smile_cat","heart_eyes_cat","kissing_cat","smirk_cat","scream_cat","crying_cat_face","joy_cat","pouting_cat","japanese_ogre","japanese_goblin","see_no_evil","hear_no_evil","speak_no_evil","guardsman","skull","feet","lips","kiss","droplet","ear","eyes","nose","tongue","love_letter","bust_in_silhouette","busts_in_silhouette","speech_balloon","thought_balloon","feelsgood","finnadie","goberserk","godmode","hurtrealbad","rage1","rage2","rage3","rage4","suspect","trollface"] - }, - { - "category" :"Nature", - "list" : ["sunny","umbrella","cloud","snowflake","snowman","zap","cyclone","foggy","ocean","cat","dog","mouse","hamster","rabbit","wolf","frog","tiger","koala","bear","pig","pig_nose","cow","boar","monkey_face","monkey","horse","racehorse","camel","sheep","elephant","panda_face","snake","bird","baby_chick","hatched_chick","hatching_chick","chicken","penguin","turtle","bug","honeybee","ant","beetle","snail","octopus","tropical_fish","fish","whale","whale2","dolphin","cow2","ram","rat","water_buffalo","tiger2","rabbit2","dragon","goat","rooster","dog2","pig2","mouse2","ox","dragon_face","blowfish","crocodile","dromedary_camel","leopard","cat2","poodle","paw_prints","bouquet","cherry_blossom","tulip","four_leaf_clover","rose","sunflower","hibiscus","maple_leaf","leaves","fallen_leaf","herb","mushroom","cactus","palm_tree","evergreen_tree","deciduous_tree","chestnut","seedling","blossom","ear_of_rice","shell","globe_with_meridians","sun_with_face","full_moon_with_face","new_moon_with_face","new_moon","waxing_crescent_moon","first_quarter_moon","waxing_gibbous_moon","full_moon","waning_gibbous_moon","last_quarter_moon","waning_crescent_moon","last_quarter_moon_with_face","first_quarter_moon_with_face","moon","earth_africa","earth_americas","earth_asia","volcano","milky_way","partly_sunny","octocat","squirrel"] - }, - { - "category" :"Objects", - "list" : ["bamboo","gift_heart","dolls","school_satchel","mortar_board","flags","fireworks","sparkler","wind_chime","rice_scene","jack_o_lantern","ghost","santa","christmas_tree","gift","bell","no_bell","tanabata_tree","tada","confetti_ball","balloon","crystal_ball","cd","dvd","floppy_disk","camera","video_camera","movie_camera","computer","tv","iphone","phone","telephone","telephone_receiver","pager","fax","minidisc","vhs","sound","speaker","mute","loudspeaker","mega","hourglass","hourglass_flowing_sand","alarm_clock","watch","radio","satellite","loop","mag","mag_right","unlock","lock","lock_with_ink_pen","closed_lock_with_key","key","bulb","flashlight","high_brightness","low_brightness","electric_plug","battery","calling","email","mailbox","postbox","bath","bathtub","shower","toilet","wrench","nut_and_bolt","hammer","seat","moneybag","yen","dollar","pound","euro","credit_card","money_with_wings","e-mail","inbox_tray","outbox_tray","envelope","incoming_envelope","postal_horn","mailbox_closed","mailbox_with_mail","mailbox_with_no_mail","package","door","smoking","bomb","gun","hocho","pill","syringe","page_facing_up","page_with_curl","bookmark_tabs","bar_chart","chart_with_upwards_trend","chart_with_downwards_trend","scroll","clipboard","calendar","date","card_index","file_folder","open_file_folder","scissors","pushpin","paperclip","black_nib","pencil2","straight_ruler","triangular_ruler","closed_book","green_book","blue_book","orange_book","notebook","notebook_with_decorative_cover","ledger","books","bookmark","name_badge","microscope","telescope","newspaper","football","basketball","soccer","baseball","tennis","8ball","rugby_football","bowling","golf","mountain_bicyclist","bicyclist","horse_racing","snowboarder","swimmer","surfer","ski","spades","hearts","clubs","diamonds","gem","ring","trophy","musical_score","musical_keyboard","violin","space_invader","video_game","black_joker","flower_playing_cards","game_die","dart","mahjong","clapper","memo","pencil","book","art","microphone","headphones","trumpet","saxophone","guitar","shoe","sandal","high_heel","lipstick","boot","shirt","tshirt","necktie","womans_clothes","dress","running_shirt_with_sash","jeans","kimono","bikini","ribbon","tophat","crown","womans_hat","mans_shoe","closed_umbrella","briefcase","handbag","pouch","purse","eyeglasses","fishing_pole_and_fish","coffee","tea","sake","baby_bottle","beer","beers","cocktail","tropical_drink","wine_glass","fork_and_knife","pizza","hamburger","fries","poultry_leg","meat_on_bone","spaghetti","curry","fried_shrimp","bento","sushi","fish_cake","rice_ball","rice_cracker","rice","ramen","stew","oden","dango","egg","bread","doughnut","custard","icecream","ice_cream","shaved_ice","birthday","cake","cookie","chocolate_bar","candy","lollipop","honey_pot","apple","green_apple","tangerine","lemon","cherries","grapes","watermelon","strawberry","peach","melon","banana","pear","pineapple","sweet_potato","eggplant","tomato","corn"] - }, - { - "category" :"Places", - "list" : ["house","house_with_garden","school","office","post_office","hospital","bank","convenience_store","love_hotel","hotel","wedding","church","department_store","european_post_office","city_sunrise","city_sunset","japanese_castle","european_castle","tent","factory","tokyo_tower","japan","mount_fuji","sunrise_over_mountains","sunrise","stars","statue_of_liberty","bridge_at_night","carousel_horse","rainbow","ferris_wheel","fountain","roller_coaster","ship","speedboat","boat","sailboat","rowboat","anchor","rocket","airplane","helicopter","steam_locomotive","tram","mountain_railway","bike","aerial_tramway","suspension_railway","mountain_cableway","tractor","blue_car","oncoming_automobile","car","red_car","taxi","oncoming_taxi","articulated_lorry","bus","oncoming_bus","rotating_light","police_car","oncoming_police_car","fire_engine","ambulance","minibus","truck","train","station","train2","bullettrain_front","bullettrain_side","light_rail","monorail","railway_car","trolleybus","ticket","fuelpump","vertical_traffic_light","traffic_light","warning","construction","beginner","atm","slot_machine","busstop","barber","hotsprings","checkered_flag","crossed_flags","izakaya_lantern","moyai","circus_tent","performing_arts","round_pushpin","triangular_flag_on_post","jp","kr","cn","us","fr","es","it","ru","gb","uk","de"] - }, - { - "category" :"Symbols", - "list" : ["one","two","three","four","five","six","seven","eight","nine","keycap_ten","1234","zero","hash","symbols","arrow_backward","arrow_down","arrow_forward","arrow_left","capital_abcd","abcd","abc","arrow_lower_left","arrow_lower_right","arrow_right","arrow_up","arrow_upper_left","arrow_upper_right","arrow_double_down","arrow_double_up","arrow_down_small","arrow_heading_down","arrow_heading_up","leftwards_arrow_with_hook","arrow_right_hook","left_right_arrow","arrow_up_down","arrow_up_small","arrows_clockwise","arrows_counterclockwise","rewind","fast_forward","information_source","ok","twisted_rightwards_arrows","repeat","repeat_one","new","top","up","cool","free","ng","cinema","koko","signal_strength","u5272","u5408","u55b6","u6307","u6708","u6709","u6e80","u7121","u7533","u7a7a","u7981","sa","restroom","mens","womens","baby_symbol","no_smoking","parking","wheelchair","metro","baggage_claim","accept","wc","potable_water","put_litter_in_its_place","secret","congratulations","m","passport_control","left_luggage","customs","ideograph_advantage","cl","sos","id","no_entry_sign","underage","no_mobile_phones","do_not_litter","non-potable_water","no_bicycles","no_pedestrians","children_crossing","no_entry","eight_spoked_asterisk","sparkle","eight_pointed_black_star","heart_decoration","vs","vibration_mode","mobile_phone_off","chart","currency_exchange","aries","taurus","gemini","cancer","leo","virgo","libra","scorpius","sagittarius","capricorn","aquarius","pisces","ophiuchus","six_pointed_star","negative_squared_cross_mark","a","b","ab","o2","diamond_shape_with_a_dot_inside","recycle","end","back","on","soon","clock1","clock130","clock10","clock1030","clock11","clock1130","clock12","clock1230","clock2","clock230","clock3","clock330","clock4","clock430","clock5","clock530","clock6","clock630","clock7","clock730","clock8","clock830","clock9","clock930","heavy_dollar_sign","copyright","registered","tm","x","heavy_exclamation_mark","bangbang","interrobang","o","heavy_multiplication_x","heavy_plus_sign","heavy_minus_sign","heavy_division_sign","white_flower","100","heavy_check_mark","ballot_box_with_check","radio_button","link","curly_loop","wavy_dash","part_alternation_mark","trident","black_small_square","white_small_square","black_medium_small_square","white_medium_small_square","black_medium_square","white_medium_square","black_large_square","white_large_square","white_check_mark","black_square_button","white_square_button","black_circle","white_circle","red_circle","large_blue_circle","large_blue_diamond","large_orange_diamond","small_blue_diamond","small_orange_diamond","small_red_triangle","small_red_triangle_down","shipit"] - } - ], - - "twemoji" : ["1f004","1f0cf","1f170","1f171","1f17e","1f17f","1f18e","1f191","1f192","1f193","1f194","1f195","1f196","1f197","1f198","1f199","1f19a","1f1e6","1f1e7","1f1e8-1f1f3","1f1e8","1f1e9-1f1ea","1f1e9","1f1ea-1f1f8","1f1ea","1f1eb-1f1f7","1f1eb","1f1ec-1f1e7","1f1ec","1f1ed","1f1ee-1f1f9","1f1ee","1f1ef-1f1f5","1f1ef","1f1f0-1f1f7","1f1f0","1f1f1","1f1f2","1f1f3","1f1f4","1f1f5","1f1f6","1f1f7-1f1fa","1f1f7","1f1f8","1f1f9","1f1fa-1f1f8","1f1fa","1f1fb","1f1fc","1f1fd","1f1fe","1f1ff","1f201","1f202","1f21a","1f22f","1f232","1f233","1f234","1f235","1f236","1f237","1f238","1f239","1f23a","1f250","1f251","1f300","1f301","1f302","1f303","1f304","1f305","1f306","1f307","1f308","1f309","1f30a","1f30b","1f30c","1f30d","1f30e","1f30f","1f310","1f311","1f312","1f313","1f314","1f315","1f316","1f317","1f318","1f319","1f31a","1f31b","1f31c","1f31d","1f31e","1f31f","1f320","1f330","1f331","1f332","1f333","1f334","1f335","1f337","1f338","1f339","1f33a","1f33b","1f33c","1f33d","1f33e","1f33f","1f340","1f341","1f342","1f343","1f344","1f345","1f346","1f347","1f348","1f349","1f34a","1f34b","1f34c","1f34d","1f34e","1f34f","1f350","1f351","1f352","1f353","1f354","1f355","1f356","1f357","1f358","1f359","1f35a","1f35b","1f35c","1f35d","1f35e","1f35f","1f360","1f361","1f362","1f363","1f364","1f365","1f366","1f367","1f368","1f369","1f36a","1f36b","1f36c","1f36d","1f36e","1f36f","1f370","1f371","1f372","1f373","1f374","1f375","1f376","1f377","1f378","1f379","1f37a","1f37b","1f37c","1f380","1f381","1f382","1f383","1f384","1f385","1f386","1f387","1f388","1f389","1f38a","1f38b","1f38c","1f38d","1f38e","1f38f","1f390","1f391","1f392","1f393","1f3a0","1f3a1","1f3a2","1f3a3","1f3a4","1f3a5","1f3a6","1f3a7","1f3a8","1f3a9","1f3aa","1f3ab","1f3ac","1f3ad","1f3ae","1f3af","1f3b0","1f3b1","1f3b2","1f3b3","1f3b4","1f3b5","1f3b6","1f3b7","1f3b8","1f3b9","1f3ba","1f3bb","1f3bc","1f3bd","1f3be","1f3bf","1f3c0","1f3c1","1f3c2","1f3c3","1f3c4","1f3c6","1f3c7","1f3c8","1f3c9","1f3ca","1f3e0","1f3e1","1f3e2","1f3e3","1f3e4","1f3e5","1f3e6","1f3e7","1f3e8","1f3e9","1f3ea","1f3eb","1f3ec","1f3ed","1f3ee","1f3ef","1f3f0","1f400","1f401","1f402","1f403","1f404","1f405","1f406","1f407","1f408","1f409","1f40a","1f40b","1f40c","1f40d","1f40e","1f40f","1f410","1f411","1f412","1f413","1f414","1f415","1f416","1f417","1f418","1f419","1f41a","1f41b","1f41c","1f41d","1f41e","1f41f","1f420","1f421","1f422","1f423","1f424","1f425","1f426","1f427","1f428","1f429","1f42a","1f42b","1f42c","1f42d","1f42e","1f42f","1f430","1f431","1f432","1f433","1f434","1f435","1f436","1f437","1f438","1f439","1f43a","1f43b","1f43c","1f43d","1f43e","1f440","1f442","1f443","1f444","1f445","1f446","1f447","1f448","1f449","1f44a","1f44b","1f44c","1f44d","1f44e","1f44f","1f450","1f451","1f452","1f453","1f454","1f455","1f456","1f457","1f458","1f459","1f45a","1f45b","1f45c","1f45d","1f45e","1f45f","1f460","1f461","1f462","1f463","1f464","1f465","1f466","1f467","1f468","1f469","1f46a","1f46b","1f46c","1f46d","1f46e","1f46f","1f470","1f471","1f472","1f473","1f474","1f475","1f476","1f477","1f478","1f479","1f47a","1f47b","1f47c","1f47d","1f47e","1f47f","1f480","1f481","1f482","1f483","1f484","1f485","1f486","1f487","1f488","1f489","1f48a","1f48b","1f48c","1f48d","1f48e","1f48f","1f490","1f491","1f492","1f493","1f494","1f495","1f496","1f497","1f498","1f499","1f49a","1f49b","1f49c","1f49d","1f49e","1f49f","1f4a0","1f4a1","1f4a2","1f4a3","1f4a4","1f4a5","1f4a6","1f4a7","1f4a8","1f4a9","1f4aa","1f4ab","1f4ac","1f4ad","1f4ae","1f4af","1f4b0","1f4b1","1f4b2","1f4b3","1f4b4","1f4b5","1f4b6","1f4b7","1f4b8","1f4b9","1f4ba","1f4bb","1f4bc","1f4bd","1f4be","1f4bf","1f4c0","1f4c1","1f4c2","1f4c3","1f4c4","1f4c5","1f4c6","1f4c7","1f4c8","1f4c9","1f4ca","1f4cb","1f4cc","1f4cd","1f4ce","1f4cf","1f4d0","1f4d1","1f4d2","1f4d3","1f4d4","1f4d5","1f4d6","1f4d7","1f4d8","1f4d9","1f4da","1f4db","1f4dc","1f4dd","1f4de","1f4df","1f4e0","1f4e1","1f4e2","1f4e3","1f4e4","1f4e5","1f4e6","1f4e7","1f4e8","1f4e9","1f4ea","1f4eb","1f4ec","1f4ed","1f4ee","1f4ef","1f4f0","1f4f1","1f4f2","1f4f3","1f4f4","1f4f5","1f4f6","1f4f7","1f4f9","1f4fa","1f4fb","1f4fc","1f500","1f501","1f502","1f503","1f504","1f505","1f506","1f507","1f508","1f509","1f50a","1f50b","1f50c","1f50d","1f50e","1f50f","1f510","1f511","1f512","1f513","1f514","1f515","1f516","1f517","1f518","1f519","1f51a","1f51b","1f51c","1f51d","1f51e","1f51f","1f520","1f521","1f522","1f523","1f524","1f525","1f526","1f527","1f528","1f529","1f52a","1f52b","1f52c","1f52d","1f52e","1f52f","1f530","1f531","1f532","1f533","1f534","1f535","1f536","1f537","1f538","1f539","1f53a","1f53b","1f53c","1f53d","1f550","1f551","1f552","1f553","1f554","1f555","1f556","1f557","1f558","1f559","1f55a","1f55b","1f55c","1f55d","1f55e","1f55f","1f560","1f561","1f562","1f563","1f564","1f565","1f566","1f567","1f5fb","1f5fc","1f5fd","1f5fe","1f5ff","1f600","1f601","1f602","1f603","1f604","1f605","1f606","1f607","1f608","1f609","1f60a","1f60b","1f60c","1f60d","1f60e","1f60f","1f610","1f611","1f612","1f613","1f614","1f615","1f616","1f617","1f618","1f619","1f61a","1f61b","1f61c","1f61d","1f61e","1f61f","1f620","1f621","1f622","1f623","1f624","1f625","1f626","1f627","1f628","1f629","1f62a","1f62b","1f62c","1f62d","1f62e","1f62f","1f630","1f631","1f632","1f633","1f634","1f635","1f636","1f637","1f638","1f639","1f63a","1f63b","1f63c","1f63d","1f63e","1f63f","1f640","1f645","1f646","1f647","1f648","1f649","1f64a","1f64b","1f64c","1f64d","1f64e","1f64f","1f680","1f681","1f682","1f683","1f684","1f685","1f686","1f687","1f688","1f689","1f68a","1f68b","1f68c","1f68d","1f68e","1f68f","1f690","1f691","1f692","1f693","1f694","1f695","1f696","1f697","1f698","1f699","1f69a","1f69b","1f69c","1f69d","1f69e","1f69f","1f6a0","1f6a1","1f6a2","1f6a3","1f6a4","1f6a5","1f6a6","1f6a7","1f6a8","1f6a9","1f6aa","1f6ab","1f6ac","1f6ad","1f6ae","1f6af","1f6b0","1f6b1","1f6b2","1f6b3","1f6b4","1f6b5","1f6b6","1f6b7","1f6b8","1f6b9","1f6ba","1f6bb","1f6bc","1f6bd","1f6be","1f6bf","1f6c0","1f6c1","1f6c2","1f6c3","1f6c4","1f6c5","203c","2049","2122","2139","2194","2195","2196","2197","2198","2199","21a9","21aa","23-20e3","231a","231b","23e9","23ea","23eb","23ec","23f0","23f3","24c2","25aa","25ab","25b6","25c0","25fb","25fc","25fd","25fe","2600","2601","260e","2611","2614","2615","261d","263a","2648","2649","264a","264b","264c","264d","264e","264f","2650","2651","2652","2653","2660","2663","2665","2666","2668","267b","267f","2693","26a0","26a1","26aa","26ab","26bd","26be","26c4","26c5","26ce","26d4","26ea","26f2","26f3","26f5","26fa","26fd","2702","2705","2708","2709","270a","270b","270c","270f","2712","2714","2716","2728","2733","2734","2744","2747","274c","274e","2753","2754","2755","2757","2764","2795","2796","2797","27a1","27b0","27bf","2934","2935","2b05","2b06","2b07","2b1b","2b1c","2b50","2b55","30-20e3","3030","303d","31-20e3","32-20e3","3297","3299","33-20e3","34-20e3","35-20e3","36-20e3","37-20e3","38-20e3","39-20e3","a9","ae","e50a"], - - "font-awesome" : ["glass","music","search","envelope-o","heart","star","star-o","user","film","th-large","th","th-list","check","times","search-plus","search-minus","power-off","signal","cog","trash-o","home","file-o","clock-o","road","download","arrow-circle-o-down","arrow-circle-o-up","inbox","play-circle-o","repeat","refresh","list-alt","lock","flag","headphones","volume-off","volume-down","volume-up","qrcode","barcode","tag","tags","book","bookmark","print","camera","font","bold","italic","text-height","text-width","align-left","align-center","align-right","align-justify","list","outdent","indent","video-camera","picture-o","pencil","map-marker","adjust","tint","pencil-square-o","share-square-o","check-square-o","arrows","step-backward","fast-backward","backward","play","pause","stop","forward","fast-forward","step-forward","eject","chevron-left","chevron-right","plus-circle","minus-circle","times-circle","check-circle","question-circle","info-circle","crosshairs","times-circle-o","check-circle-o","ban","arrow-left","arrow-right","arrow-up","arrow-down","share","expand","compress","plus","minus","asterisk","exclamation-circle","gift","leaf","fire","eye","eye-slash","exclamation-triangle","plane","calendar","random","comment","magnet","chevron-up","chevron-down","retweet","shopping-cart","folder","folder-open","arrows-v","arrows-h","bar-chart","twitter-square","facebook-square","camera-retro","key","cogs","comments","thumbs-o-up","thumbs-o-down","star-half","heart-o","sign-out","linkedin-square","thumb-tack","external-link","sign-in","trophy","github-square","upload","lemon-o","phone","square-o","bookmark-o","phone-square","twitter","facebook","github","unlock","credit-card","rss","hdd-o","bullhorn","bell","certificate","hand-o-right","hand-o-left","hand-o-up","hand-o-down","arrow-circle-left","arrow-circle-right","arrow-circle-up","arrow-circle-down","globe","wrench","tasks","filter","briefcase","arrows-alt","users","link","cloud","flask","scissors","files-o","paperclip","floppy-o","square","bars","list-ul","list-ol","strikethrough","underline","table","magic","truck","pinterest","pinterest-square","google-plus-square","google-plus","money","caret-down","caret-up","caret-left","caret-right","columns","sort","sort-desc","sort-asc","envelope","linkedin","undo","gavel","tachometer","comment-o","comments-o","bolt","sitemap","umbrella","clipboard","lightbulb-o","exchange","cloud-download","cloud-upload","user-md","stethoscope","suitcase","bell-o","coffee","cutlery","file-text-o","building-o","hospital-o","ambulance","medkit","fighter-jet","beer","h-square","plus-square","angle-double-left","angle-double-right","angle-double-up","angle-double-down","angle-left","angle-right","angle-up","angle-down","desktop","laptop","tablet","mobile","circle-o","quote-left","quote-right","spinner","circle","reply","github-alt","folder-o","folder-open-o","smile-o","frown-o","meh-o","gamepad","keyboard-o","flag-o","flag-checkered","terminal","code","reply-all","star-half-o","location-arrow","crop","code-fork","chain-broken","question","info","exclamation","superscript","subscript","eraser","puzzle-piece","microphone","microphone-slash","shield","calendar-o","fire-extinguisher","rocket","maxcdn","chevron-circle-left","chevron-circle-right","chevron-circle-up","chevron-circle-down","html5","css3","anchor","unlock-alt","bullseye","ellipsis-h","ellipsis-v","rss-square","play-circle","ticket","minus-square","minus-square-o","level-up","level-down","check-square","pencil-square","share-square","compass","caret-square-o-down","caret-square-o-up","caret-square-o-right","eur","gbp","usd","inr","jpy","rub","krw","btc","file","file-text","sort-alpha-asc","sort-alpha-desc","sort-amount-asc","sort-amount-desc","sort-numeric-asc","sort-numeric-desc","thumbs-up","thumbs-down","youtube-square","youtube","xing","xing-square","youtube-play","dropbox","stack-overflow","instagram","flickr","adn","bitbucket","bitbucket-square","tumblr","tumblr-square","long-arrow-down","long-arrow-up","long-arrow-left","long-arrow-right","apple","windows","android","linux","dribbble","skype","foursquare","trello","female","male","gratipay","sun-o","moon-o","archive","bug","vk","weibo","renren","pagelines","stack-exchange","arrow-circle-o-right","arrow-circle-o-left","caret-square-o-left","dot-circle-o","wheelchair","vimeo-square","try","plus-square-o","space-shuttle","slack","envelope-square","wordpress","openid","university","graduation-cap","yahoo","google","reddit","reddit-square","stumbleupon-circle","stumbleupon","delicious","digg","pied-piper","pied-piper-alt","drupal","joomla","language","fax","building","child","paw","spoon","cube","cubes","behance","behance-square","steam","steam-square","recycle","car","taxi","tree","spotify","deviantart","soundcloud","database","file-pdf-o","file-word-o","file-excel-o","file-powerpoint-o","file-image-o","file-archive-o","file-audio-o","file-video-o","file-code-o","vine","codepen","jsfiddle","life-ring","circle-o-notch","rebel","empire","git-square","git","hacker-news","tencent-weibo","qq","weixin","paper-plane","paper-plane-o","history","circle-thin","header","paragraph","sliders","share-alt","share-alt-square","bomb","futbol-o","tty","binoculars","plug","slideshare","twitch","yelp","newspaper-o","wifi","calculator","paypal","google-wallet","cc-visa","cc-mastercard","cc-discover","cc-amex","cc-paypal","cc-stripe","bell-slash","bell-slash-o","trash","copyright","at","eyedropper","paint-brush","birthday-cake","area-chart","pie-chart","line-chart","lastfm","lastfm-square","toggle-off","toggle-on","bicycle","bus","ioxhost","angellist","cc","ils","meanpath","buysellads","connectdevelop","dashcube","forumbee","leanpub","sellsy","shirtsinbulk","simplybuilt","skyatlas","cart-plus","cart-arrow-down","diamond","ship","user-secret","motorcycle","street-view","heartbeat","venus","mars","mercury","transgender","transgender-alt","venus-double","mars-double","venus-mars","mars-stroke","mars-stroke-v","mars-stroke-h","neuter","facebook-official","pinterest-p","whatsapp","server","user-plus","user-times","bed","viacoin","train","subway","medium","GitHub","bed","buysellads","cart-arrow-down","cart-plus","connectdevelop","dashcube","diamond","facebook-official","forumbee","heartbeat","hotel","leanpub","mars","mars-double","mars-stroke","mars-stroke-h","mars-stroke-v","medium","mercury","motorcycle","neuter","pinterest-p","sellsy","server","ship","shirtsinbulk","simplybuilt","skyatlas","street-view","subway","train","transgender","transgender-alt","user-plus","user-secret","user-times","venus","venus-double","venus-mars","viacoin","whatsapp","adjust","anchor","archive","area-chart","arrows","arrows-h","arrows-v","asterisk","at","automobile","ban","bank","bar-chart","bar-chart-o","barcode","bars","bed","beer","bell","bell-o","bell-slash","bell-slash-o","bicycle","binoculars","birthday-cake","bolt","bomb","book","bookmark","bookmark-o","briefcase","bug","building","building-o","bullhorn","bullseye","bus","cab","calculator","calendar","calendar-o","camera","camera-retro","car","caret-square-o-down","caret-square-o-left","caret-square-o-right","caret-square-o-up","cart-arrow-down","cart-plus","cc","certificate","check","check-circle","check-circle-o","check-square","check-square-o","child","circle","circle-o","circle-o-notch","circle-thin","clock-o","close","cloud","cloud-download","cloud-upload","code","code-fork","coffee","cog","cogs","comment","comment-o","comments","comments-o","compass","copyright","credit-card","crop","crosshairs","cube","cubes","cutlery","dashboard","database","desktop","diamond","dot-circle-o","download","edit","ellipsis-h","ellipsis-v","envelope","envelope-o","envelope-square","eraser","exchange","exclamation","exclamation-circle","exclamation-triangle","external-link","external-link-square","eye","eye-slash","eyedropper","fax","female","fighter-jet","file-archive-o","file-audio-o","file-code-o","file-excel-o","file-image-o","file-movie-o","file-pdf-o","file-photo-o","file-picture-o","file-powerpoint-o","file-sound-o","file-video-o","file-word-o","file-zip-o","film","filter","fire","fire-extinguisher","flag","flag-checkered","flag-o","flash","flask","folder","folder-o","folder-open","folder-open-o","frown-o","futbol-o","gamepad","gavel","gear","gears","genderless","gift","glass","globe","graduation-cap","group","hdd-o","headphones","heart","heart-o","heartbeat","history","home","hotel","image","inbox","info","info-circle","institution","key","keyboard-o","language","laptop","leaf","legal","lemon-o","level-down","level-up","life-bouy","life-buoy","life-ring","life-saver","lightbulb-o","line-chart","location-arrow","lock","magic","magnet","mail-forward","mail-reply","mail-reply-all","male","map-marker","meh-o","microphone","microphone-slash","minus","minus-circle","minus-square","minus-square-o","mobile","mobile-phone","money","moon-o","mortar-board","motorcycle","music","navicon","newspaper-o","paint-brush","paper-plane","paper-plane-o","paw","pencil","pencil-square","pencil-square-o","phone","phone-square","photo","picture-o","pie-chart","plane","plug","plus","plus-circle","plus-square","plus-square-o","power-off","print","puzzle-piece","qrcode","question","question-circle","quote-left","quote-right","random","recycle","refresh","remove","reorder","reply","reply-all","retweet","road","rocket","rss","rss-square","search","search-minus","search-plus","send","send-o","server","share","share-alt","share-alt-square","share-square","share-square-o","shield","ship","shopping-cart","sign-in","sign-out","signal","sitemap","sliders","smile-o","soccer-ball-o","sort","sort-alpha-asc","sort-alpha-desc","sort-amount-asc","sort-amount-desc","sort-asc","sort-desc","sort-down","sort-numeric-asc","sort-numeric-desc","sort-up","space-shuttle","spinner","spoon","square","square-o","star","star-half","star-half-empty","star-half-full","star-half-o","star-o","street-view","suitcase","sun-o","support","tablet","tachometer","tag","tags","tasks","taxi","terminal","thumb-tack","thumbs-down","thumbs-o-down","thumbs-o-up","thumbs-up","ticket","times","times-circle","times-circle-o","tint","toggle-down","toggle-left","toggle-off","toggle-on","toggle-right","toggle-up","trash","trash-o","tree","trophy","truck","tty","umbrella","university","unlock","unlock-alt","unsorted","upload","user","user-plus","user-secret","user-times","users","video-camera","volume-down","volume-off","volume-up","warning","wheelchair","wifi","wrench","ambulance","automobile","bicycle","bus","cab","car","fighter-jet","motorcycle","plane","rocket","ship","space-shuttle","subway","taxi","train","truck","wheelchair","circle-thin","genderless","mars","mars-double","mars-stroke","mars-stroke-h","mars-stroke-v","mercury","neuter","transgender","transgender-alt","venus","venus-double","venus-mars","file","file-archive-o","file-audio-o","file-code-o","file-excel-o","file-image-o","file-movie-o","file-o","file-pdf-o","file-photo-o","file-picture-o","file-powerpoint-o","file-sound-o","file-text","file-text-o","file-video-o","file-word-o","file-zip-o","circle-o-notch","cog","gear","refresh","spinner","check-square","check-square-o","circle","circle-o","dot-circle-o","minus-square","minus-square-o","plus-square","plus-square-o","square","square-o","cc-amex","cc-discover","cc-mastercard","cc-paypal","cc-stripe","cc-visa","credit-card","google-wallet","paypal","area-chart","bar-chart","bar-chart-o","line-chart","pie-chart","bitcoin","btc","cny","dollar","eur","euro","gbp","ils","inr","jpy","krw","money","rmb","rouble","rub","ruble","rupee","shekel","sheqel","try","turkish-lira","usd","won","yen","align-center","align-justify","align-left","align-right","bold","chain","chain-broken","clipboard","columns","copy","cut","dedent","eraser","file","file-o","file-text","file-text-o","files-o","floppy-o","font","header","indent","italic","link","list","list-alt","list-ol","list-ul","outdent","paperclip","paragraph","paste","repeat","rotate-left","rotate-right","save","scissors","strikethrough","subscript","superscript","table","text-height","text-width","th","th-large","th-list","underline","undo","unlink","angle-double-down","angle-double-left","angle-double-right","angle-double-up","angle-down","angle-left","angle-right","angle-up","arrow-circle-down","arrow-circle-left","arrow-circle-o-down","arrow-circle-o-left","arrow-circle-o-right","arrow-circle-o-up","arrow-circle-right","arrow-circle-up","arrow-down","arrow-left","arrow-right","arrow-up","arrows","arrows-alt","arrows-h","arrows-v","caret-down","caret-left","caret-right","caret-square-o-down","caret-square-o-left","caret-square-o-right","caret-square-o-up","caret-up","chevron-circle-down","chevron-circle-left","chevron-circle-right","chevron-circle-up","chevron-down","chevron-left","chevron-right","chevron-up","hand-o-down","hand-o-left","hand-o-right","hand-o-up","long-arrow-down","long-arrow-left","long-arrow-right","long-arrow-up","toggle-down","toggle-left","toggle-right","toggle-up","arrows-alt","backward","compress","eject","expand","fast-backward","fast-forward","forward","pause","play","play-circle","play-circle-o","step-backward","step-forward","stop","youtube-play","report an issue with Adblock Plus","adn","android","angellist","apple","behance","behance-square","bitbucket","bitbucket-square","bitcoin","btc","buysellads","cc-amex","cc-discover","cc-mastercard","cc-paypal","cc-stripe","cc-visa","codepen","connectdevelop","css3","dashcube","delicious","deviantart","digg","dribbble","dropbox","drupal","empire","facebook","facebook-f","facebook-official","facebook-square","flickr","forumbee","foursquare","ge","git","git-square","github","github-alt","github-square","gittip","google","google-plus","google-plus-square","google-wallet","gratipay","hacker-news","html5","instagram","ioxhost","joomla","jsfiddle","lastfm","lastfm-square","leanpub","linkedin","linkedin-square","linux","maxcdn","meanpath","medium","openid","pagelines","paypal","pied-piper","pied-piper-alt","pinterest","pinterest-p","pinterest-square","qq","ra","rebel","reddit","reddit-square","renren","sellsy","share-alt","share-alt-square","shirtsinbulk","simplybuilt","skyatlas","skype","slack","slideshare","soundcloud","spotify","stack-exchange","stack-overflow","steam","steam-square","stumbleupon","stumbleupon-circle","tencent-weibo","trello","tumblr","tumblr-square","twitch","twitter","twitter-square","viacoin","vimeo-square","vine","vk","wechat","weibo","weixin","whatsapp","windows","wordpress","xing","xing-square","yahoo","yelp","youtube","youtube-play","youtube-square","ambulance","h-square","heart","heart-o","heartbeat","hospital-o","medkit","plus-square","stethoscope","user-md","wheelchair"] + "github-emoji": [ + { + "category": "People", + "list": [ + "bowtie", + "smile", + "laughing", + "blush", + "smiley", + "relaxed", + "smirk", + "heart_eyes", + "kissing_heart", + "kissing_closed_eyes", + "flushed", + "relieved", + "satisfied", + "grin", + "wink", + "stuck_out_tongue_winking_eye", + "stuck_out_tongue_closed_eyes", + "grinning", + "kissing", + "kissing_smiling_eyes", + "stuck_out_tongue", + "sleeping", + "worried", + "frowning", + "anguished", + "open_mouth", + "grimacing", + "confused", + "hushed", + "expressionless", + "unamused", + "sweat_smile", + "sweat", + "disappointed_relieved", + "weary", + "pensive", + "disappointed", + "confounded", + "fearful", + "cold_sweat", + "persevere", + "cry", + "sob", + "joy", + "astonished", + "scream", + "neckbeard", + "tired_face", + "angry", + "rage", + "triumph", + "sleepy", + "yum", + "mask", + "sunglasses", + "dizzy_face", + "imp", + "smiling_imp", + "neutral_face", + "no_mouth", + "innocent", + "alien", + "yellow_heart", + "blue_heart", + "purple_heart", + "heart", + "green_heart", + "broken_heart", + "heartbeat", + "heartpulse", + "two_hearts", + "revolving_hearts", + "cupid", + "sparkling_heart", + "sparkles", + "star", + "star2", + "dizzy", + "boom", + "collision", + "anger", + "exclamation", + "question", + "grey_exclamation", + "grey_question", + "zzz", + "dash", + "sweat_drops", + "notes", + "musical_note", + "fire", + "hankey", + "poop", + "shit", + "+1", + "thumbsup", + "-1", + "thumbsdown", + "ok_hand", + "punch", + "facepunch", + "fist", + "v", + "wave", + "hand", + "raised_hand", + "open_hands", + "point_up", + "point_down", + "point_left", + "point_right", + "raised_hands", + "pray", + "point_up_2", + "clap", + "muscle", + "metal", + "fu", + "walking", + "runner", + "running", + "couple", + "family", + "two_men_holding_hands", + "two_women_holding_hands", + "dancer", + "dancers", + "ok_woman", + "no_good", + "information_desk_person", + "raising_hand", + "bride_with_veil", + "person_with_pouting_face", + "person_frowning", + "bow", + "couplekiss", + "couple_with_heart", + "massage", + "haircut", + "nail_care", + "boy", + "girl", + "woman", + "man", + "baby", + "older_woman", + "older_man", + "person_with_blond_hair", + "man_with_gua_pi_mao", + "man_with_turban", + "construction_worker", + "cop", + "angel", + "princess", + "smiley_cat", + "smile_cat", + "heart_eyes_cat", + "kissing_cat", + "smirk_cat", + "scream_cat", + "crying_cat_face", + "joy_cat", + "pouting_cat", + "japanese_ogre", + "japanese_goblin", + "see_no_evil", + "hear_no_evil", + "speak_no_evil", + "guardsman", + "skull", + "feet", + "lips", + "kiss", + "droplet", + "ear", + "eyes", + "nose", + "tongue", + "love_letter", + "bust_in_silhouette", + "busts_in_silhouette", + "speech_balloon", + "thought_balloon", + "feelsgood", + "finnadie", + "goberserk", + "godmode", + "hurtrealbad", + "rage1", + "rage2", + "rage3", + "rage4", + "suspect", + "trollface" + ] + }, + { + "category": "Nature", + "list": [ + "sunny", + "umbrella", + "cloud", + "snowflake", + "snowman", + "zap", + "cyclone", + "foggy", + "ocean", + "cat", + "dog", + "mouse", + "hamster", + "rabbit", + "wolf", + "frog", + "tiger", + "koala", + "bear", + "pig", + "pig_nose", + "cow", + "boar", + "monkey_face", + "monkey", + "horse", + "racehorse", + "camel", + "sheep", + "elephant", + "panda_face", + "snake", + "bird", + "baby_chick", + "hatched_chick", + "hatching_chick", + "chicken", + "penguin", + "turtle", + "bug", + "honeybee", + "ant", + "beetle", + "snail", + "octopus", + "tropical_fish", + "fish", + "whale", + "whale2", + "dolphin", + "cow2", + "ram", + "rat", + "water_buffalo", + "tiger2", + "rabbit2", + "dragon", + "goat", + "rooster", + "dog2", + "pig2", + "mouse2", + "ox", + "dragon_face", + "blowfish", + "crocodile", + "dromedary_camel", + "leopard", + "cat2", + "poodle", + "paw_prints", + "bouquet", + "cherry_blossom", + "tulip", + "four_leaf_clover", + "rose", + "sunflower", + "hibiscus", + "maple_leaf", + "leaves", + "fallen_leaf", + "herb", + "mushroom", + "cactus", + "palm_tree", + "evergreen_tree", + "deciduous_tree", + "chestnut", + "seedling", + "blossom", + "ear_of_rice", + "shell", + "globe_with_meridians", + "sun_with_face", + "full_moon_with_face", + "new_moon_with_face", + "new_moon", + "waxing_crescent_moon", + "first_quarter_moon", + "waxing_gibbous_moon", + "full_moon", + "waning_gibbous_moon", + "last_quarter_moon", + "waning_crescent_moon", + "last_quarter_moon_with_face", + "first_quarter_moon_with_face", + "moon", + "earth_africa", + "earth_americas", + "earth_asia", + "volcano", + "milky_way", + "partly_sunny", + "octocat", + "squirrel" + ] + }, + { + "category": "Objects", + "list": [ + "bamboo", + "gift_heart", + "dolls", + "school_satchel", + "mortar_board", + "flags", + "fireworks", + "sparkler", + "wind_chime", + "rice_scene", + "jack_o_lantern", + "ghost", + "santa", + "christmas_tree", + "gift", + "bell", + "no_bell", + "tanabata_tree", + "tada", + "confetti_ball", + "balloon", + "crystal_ball", + "cd", + "dvd", + "floppy_disk", + "camera", + "video_camera", + "movie_camera", + "computer", + "tv", + "iphone", + "phone", + "telephone", + "telephone_receiver", + "pager", + "fax", + "minidisc", + "vhs", + "sound", + "speaker", + "mute", + "loudspeaker", + "mega", + "hourglass", + "hourglass_flowing_sand", + "alarm_clock", + "watch", + "radio", + "satellite", + "loop", + "mag", + "mag_right", + "unlock", + "lock", + "lock_with_ink_pen", + "closed_lock_with_key", + "key", + "bulb", + "flashlight", + "high_brightness", + "low_brightness", + "electric_plug", + "battery", + "calling", + "email", + "mailbox", + "postbox", + "bath", + "bathtub", + "shower", + "toilet", + "wrench", + "nut_and_bolt", + "hammer", + "seat", + "moneybag", + "yen", + "dollar", + "pound", + "euro", + "credit_card", + "money_with_wings", + "e-mail", + "inbox_tray", + "outbox_tray", + "envelope", + "incoming_envelope", + "postal_horn", + "mailbox_closed", + "mailbox_with_mail", + "mailbox_with_no_mail", + "package", + "door", + "smoking", + "bomb", + "gun", + "hocho", + "pill", + "syringe", + "page_facing_up", + "page_with_curl", + "bookmark_tabs", + "bar_chart", + "chart_with_upwards_trend", + "chart_with_downwards_trend", + "scroll", + "clipboard", + "calendar", + "date", + "card_index", + "file_folder", + "open_file_folder", + "scissors", + "pushpin", + "paperclip", + "black_nib", + "pencil2", + "straight_ruler", + "triangular_ruler", + "closed_book", + "green_book", + "blue_book", + "orange_book", + "notebook", + "notebook_with_decorative_cover", + "ledger", + "books", + "bookmark", + "name_badge", + "microscope", + "telescope", + "newspaper", + "football", + "basketball", + "soccer", + "baseball", + "tennis", + "8ball", + "rugby_football", + "bowling", + "golf", + "mountain_bicyclist", + "bicyclist", + "horse_racing", + "snowboarder", + "swimmer", + "surfer", + "ski", + "spades", + "hearts", + "clubs", + "diamonds", + "gem", + "ring", + "trophy", + "musical_score", + "musical_keyboard", + "violin", + "space_invader", + "video_game", + "black_joker", + "flower_playing_cards", + "game_die", + "dart", + "mahjong", + "clapper", + "memo", + "pencil", + "book", + "art", + "microphone", + "headphones", + "trumpet", + "saxophone", + "guitar", + "shoe", + "sandal", + "high_heel", + "lipstick", + "boot", + "shirt", + "tshirt", + "necktie", + "womans_clothes", + "dress", + "running_shirt_with_sash", + "jeans", + "kimono", + "bikini", + "ribbon", + "tophat", + "crown", + "womans_hat", + "mans_shoe", + "closed_umbrella", + "briefcase", + "handbag", + "pouch", + "purse", + "eyeglasses", + "fishing_pole_and_fish", + "coffee", + "tea", + "sake", + "baby_bottle", + "beer", + "beers", + "cocktail", + "tropical_drink", + "wine_glass", + "fork_and_knife", + "pizza", + "hamburger", + "fries", + "poultry_leg", + "meat_on_bone", + "spaghetti", + "curry", + "fried_shrimp", + "bento", + "sushi", + "fish_cake", + "rice_ball", + "rice_cracker", + "rice", + "ramen", + "stew", + "oden", + "dango", + "egg", + "bread", + "doughnut", + "custard", + "icecream", + "ice_cream", + "shaved_ice", + "birthday", + "cake", + "cookie", + "chocolate_bar", + "candy", + "lollipop", + "honey_pot", + "apple", + "green_apple", + "tangerine", + "lemon", + "cherries", + "grapes", + "watermelon", + "strawberry", + "peach", + "melon", + "banana", + "pear", + "pineapple", + "sweet_potato", + "eggplant", + "tomato", + "corn" + ] + }, + { + "category": "Places", + "list": [ + "house", + "house_with_garden", + "school", + "office", + "post_office", + "hospital", + "bank", + "convenience_store", + "love_hotel", + "hotel", + "wedding", + "church", + "department_store", + "european_post_office", + "city_sunrise", + "city_sunset", + "japanese_castle", + "european_castle", + "tent", + "factory", + "tokyo_tower", + "japan", + "mount_fuji", + "sunrise_over_mountains", + "sunrise", + "stars", + "statue_of_liberty", + "bridge_at_night", + "carousel_horse", + "rainbow", + "ferris_wheel", + "fountain", + "roller_coaster", + "ship", + "speedboat", + "boat", + "sailboat", + "rowboat", + "anchor", + "rocket", + "airplane", + "helicopter", + "steam_locomotive", + "tram", + "mountain_railway", + "bike", + "aerial_tramway", + "suspension_railway", + "mountain_cableway", + "tractor", + "blue_car", + "oncoming_automobile", + "car", + "red_car", + "taxi", + "oncoming_taxi", + "articulated_lorry", + "bus", + "oncoming_bus", + "rotating_light", + "police_car", + "oncoming_police_car", + "fire_engine", + "ambulance", + "minibus", + "truck", + "train", + "station", + "train2", + "bullettrain_front", + "bullettrain_side", + "light_rail", + "monorail", + "railway_car", + "trolleybus", + "ticket", + "fuelpump", + "vertical_traffic_light", + "traffic_light", + "warning", + "construction", + "beginner", + "atm", + "slot_machine", + "busstop", + "barber", + "hotsprings", + "checkered_flag", + "crossed_flags", + "izakaya_lantern", + "moyai", + "circus_tent", + "performing_arts", + "round_pushpin", + "triangular_flag_on_post", + "jp", + "kr", + "cn", + "us", + "fr", + "es", + "it", + "ru", + "gb", + "uk", + "de" + ] + }, + { + "category": "Symbols", + "list": [ + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "keycap_ten", + "1234", + "zero", + "hash", + "symbols", + "arrow_backward", + "arrow_down", + "arrow_forward", + "arrow_left", + "capital_abcd", + "abcd", + "abc", + "arrow_lower_left", + "arrow_lower_right", + "arrow_right", + "arrow_up", + "arrow_upper_left", + "arrow_upper_right", + "arrow_double_down", + "arrow_double_up", + "arrow_down_small", + "arrow_heading_down", + "arrow_heading_up", + "leftwards_arrow_with_hook", + "arrow_right_hook", + "left_right_arrow", + "arrow_up_down", + "arrow_up_small", + "arrows_clockwise", + "arrows_counterclockwise", + "rewind", + "fast_forward", + "information_source", + "ok", + "twisted_rightwards_arrows", + "repeat", + "repeat_one", + "new", + "top", + "up", + "cool", + "free", + "ng", + "cinema", + "koko", + "signal_strength", + "u5272", + "u5408", + "u55b6", + "u6307", + "u6708", + "u6709", + "u6e80", + "u7121", + "u7533", + "u7a7a", + "u7981", + "sa", + "restroom", + "mens", + "womens", + "baby_symbol", + "no_smoking", + "parking", + "wheelchair", + "metro", + "baggage_claim", + "accept", + "wc", + "potable_water", + "put_litter_in_its_place", + "secret", + "congratulations", + "m", + "passport_control", + "left_luggage", + "customs", + "ideograph_advantage", + "cl", + "sos", + "id", + "no_entry_sign", + "underage", + "no_mobile_phones", + "do_not_litter", + "non-potable_water", + "no_bicycles", + "no_pedestrians", + "children_crossing", + "no_entry", + "eight_spoked_asterisk", + "sparkle", + "eight_pointed_black_star", + "heart_decoration", + "vs", + "vibration_mode", + "mobile_phone_off", + "chart", + "currency_exchange", + "aries", + "taurus", + "gemini", + "cancer", + "leo", + "virgo", + "libra", + "scorpius", + "sagittarius", + "capricorn", + "aquarius", + "pisces", + "ophiuchus", + "six_pointed_star", + "negative_squared_cross_mark", + "a", + "b", + "ab", + "o2", + "diamond_shape_with_a_dot_inside", + "recycle", + "end", + "back", + "on", + "soon", + "clock1", + "clock130", + "clock10", + "clock1030", + "clock11", + "clock1130", + "clock12", + "clock1230", + "clock2", + "clock230", + "clock3", + "clock330", + "clock4", + "clock430", + "clock5", + "clock530", + "clock6", + "clock630", + "clock7", + "clock730", + "clock8", + "clock830", + "clock9", + "clock930", + "heavy_dollar_sign", + "copyright", + "registered", + "tm", + "x", + "heavy_exclamation_mark", + "bangbang", + "interrobang", + "o", + "heavy_multiplication_x", + "heavy_plus_sign", + "heavy_minus_sign", + "heavy_division_sign", + "white_flower", + "100", + "heavy_check_mark", + "ballot_box_with_check", + "radio_button", + "link", + "curly_loop", + "wavy_dash", + "part_alternation_mark", + "trident", + "black_small_square", + "white_small_square", + "black_medium_small_square", + "white_medium_small_square", + "black_medium_square", + "white_medium_square", + "black_large_square", + "white_large_square", + "white_check_mark", + "black_square_button", + "white_square_button", + "black_circle", + "white_circle", + "red_circle", + "large_blue_circle", + "large_blue_diamond", + "large_orange_diamond", + "small_blue_diamond", + "small_orange_diamond", + "small_red_triangle", + "small_red_triangle_down", + "shipit" + ] + } + ], + "twemoji": [ + "1f004", + "1f0cf", + "1f170", + "1f171", + "1f17e", + "1f17f", + "1f18e", + "1f191", + "1f192", + "1f193", + "1f194", + "1f195", + "1f196", + "1f197", + "1f198", + "1f199", + "1f19a", + "1f1e6", + "1f1e7", + "1f1e8-1f1f3", + "1f1e8", + "1f1e9-1f1ea", + "1f1e9", + "1f1ea-1f1f8", + "1f1ea", + "1f1eb-1f1f7", + "1f1eb", + "1f1ec-1f1e7", + "1f1ec", + "1f1ed", + "1f1ee-1f1f9", + "1f1ee", + "1f1ef-1f1f5", + "1f1ef", + "1f1f0-1f1f7", + "1f1f0", + "1f1f1", + "1f1f2", + "1f1f3", + "1f1f4", + "1f1f5", + "1f1f6", + "1f1f7-1f1fa", + "1f1f7", + "1f1f8", + "1f1f9", + "1f1fa-1f1f8", + "1f1fa", + "1f1fb", + "1f1fc", + "1f1fd", + "1f1fe", + "1f1ff", + "1f201", + "1f202", + "1f21a", + "1f22f", + "1f232", + "1f233", + "1f234", + "1f235", + "1f236", + "1f237", + "1f238", + "1f239", + "1f23a", + "1f250", + "1f251", + "1f300", + "1f301", + "1f302", + "1f303", + "1f304", + "1f305", + "1f306", + "1f307", + "1f308", + "1f309", + "1f30a", + "1f30b", + "1f30c", + "1f30d", + "1f30e", + "1f30f", + "1f310", + "1f311", + "1f312", + "1f313", + "1f314", + "1f315", + "1f316", + "1f317", + "1f318", + "1f319", + "1f31a", + "1f31b", + "1f31c", + "1f31d", + "1f31e", + "1f31f", + "1f320", + "1f330", + "1f331", + "1f332", + "1f333", + "1f334", + "1f335", + "1f337", + "1f338", + "1f339", + "1f33a", + "1f33b", + "1f33c", + "1f33d", + "1f33e", + "1f33f", + "1f340", + "1f341", + "1f342", + "1f343", + "1f344", + "1f345", + "1f346", + "1f347", + "1f348", + "1f349", + "1f34a", + "1f34b", + "1f34c", + "1f34d", + "1f34e", + "1f34f", + "1f350", + "1f351", + "1f352", + "1f353", + "1f354", + "1f355", + "1f356", + "1f357", + "1f358", + "1f359", + "1f35a", + "1f35b", + "1f35c", + "1f35d", + "1f35e", + "1f35f", + "1f360", + "1f361", + "1f362", + "1f363", + "1f364", + "1f365", + "1f366", + "1f367", + "1f368", + "1f369", + "1f36a", + "1f36b", + "1f36c", + "1f36d", + "1f36e", + "1f36f", + "1f370", + "1f371", + "1f372", + "1f373", + "1f374", + "1f375", + "1f376", + "1f377", + "1f378", + "1f379", + "1f37a", + "1f37b", + "1f37c", + "1f380", + "1f381", + "1f382", + "1f383", + "1f384", + "1f385", + "1f386", + "1f387", + "1f388", + "1f389", + "1f38a", + "1f38b", + "1f38c", + "1f38d", + "1f38e", + "1f38f", + "1f390", + "1f391", + "1f392", + "1f393", + "1f3a0", + "1f3a1", + "1f3a2", + "1f3a3", + "1f3a4", + "1f3a5", + "1f3a6", + "1f3a7", + "1f3a8", + "1f3a9", + "1f3aa", + "1f3ab", + "1f3ac", + "1f3ad", + "1f3ae", + "1f3af", + "1f3b0", + "1f3b1", + "1f3b2", + "1f3b3", + "1f3b4", + "1f3b5", + "1f3b6", + "1f3b7", + "1f3b8", + "1f3b9", + "1f3ba", + "1f3bb", + "1f3bc", + "1f3bd", + "1f3be", + "1f3bf", + "1f3c0", + "1f3c1", + "1f3c2", + "1f3c3", + "1f3c4", + "1f3c6", + "1f3c7", + "1f3c8", + "1f3c9", + "1f3ca", + "1f3e0", + "1f3e1", + "1f3e2", + "1f3e3", + "1f3e4", + "1f3e5", + "1f3e6", + "1f3e7", + "1f3e8", + "1f3e9", + "1f3ea", + "1f3eb", + "1f3ec", + "1f3ed", + "1f3ee", + "1f3ef", + "1f3f0", + "1f400", + "1f401", + "1f402", + "1f403", + "1f404", + "1f405", + "1f406", + "1f407", + "1f408", + "1f409", + "1f40a", + "1f40b", + "1f40c", + "1f40d", + "1f40e", + "1f40f", + "1f410", + "1f411", + "1f412", + "1f413", + "1f414", + "1f415", + "1f416", + "1f417", + "1f418", + "1f419", + "1f41a", + "1f41b", + "1f41c", + "1f41d", + "1f41e", + "1f41f", + "1f420", + "1f421", + "1f422", + "1f423", + "1f424", + "1f425", + "1f426", + "1f427", + "1f428", + "1f429", + "1f42a", + "1f42b", + "1f42c", + "1f42d", + "1f42e", + "1f42f", + "1f430", + "1f431", + "1f432", + "1f433", + "1f434", + "1f435", + "1f436", + "1f437", + "1f438", + "1f439", + "1f43a", + "1f43b", + "1f43c", + "1f43d", + "1f43e", + "1f440", + "1f442", + "1f443", + "1f444", + "1f445", + "1f446", + "1f447", + "1f448", + "1f449", + "1f44a", + "1f44b", + "1f44c", + "1f44d", + "1f44e", + "1f44f", + "1f450", + "1f451", + "1f452", + "1f453", + "1f454", + "1f455", + "1f456", + "1f457", + "1f458", + "1f459", + "1f45a", + "1f45b", + "1f45c", + "1f45d", + "1f45e", + "1f45f", + "1f460", + "1f461", + "1f462", + "1f463", + "1f464", + "1f465", + "1f466", + "1f467", + "1f468", + "1f469", + "1f46a", + "1f46b", + "1f46c", + "1f46d", + "1f46e", + "1f46f", + "1f470", + "1f471", + "1f472", + "1f473", + "1f474", + "1f475", + "1f476", + "1f477", + "1f478", + "1f479", + "1f47a", + "1f47b", + "1f47c", + "1f47d", + "1f47e", + "1f47f", + "1f480", + "1f481", + "1f482", + "1f483", + "1f484", + "1f485", + "1f486", + "1f487", + "1f488", + "1f489", + "1f48a", + "1f48b", + "1f48c", + "1f48d", + "1f48e", + "1f48f", + "1f490", + "1f491", + "1f492", + "1f493", + "1f494", + "1f495", + "1f496", + "1f497", + "1f498", + "1f499", + "1f49a", + "1f49b", + "1f49c", + "1f49d", + "1f49e", + "1f49f", + "1f4a0", + "1f4a1", + "1f4a2", + "1f4a3", + "1f4a4", + "1f4a5", + "1f4a6", + "1f4a7", + "1f4a8", + "1f4a9", + "1f4aa", + "1f4ab", + "1f4ac", + "1f4ad", + "1f4ae", + "1f4af", + "1f4b0", + "1f4b1", + "1f4b2", + "1f4b3", + "1f4b4", + "1f4b5", + "1f4b6", + "1f4b7", + "1f4b8", + "1f4b9", + "1f4ba", + "1f4bb", + "1f4bc", + "1f4bd", + "1f4be", + "1f4bf", + "1f4c0", + "1f4c1", + "1f4c2", + "1f4c3", + "1f4c4", + "1f4c5", + "1f4c6", + "1f4c7", + "1f4c8", + "1f4c9", + "1f4ca", + "1f4cb", + "1f4cc", + "1f4cd", + "1f4ce", + "1f4cf", + "1f4d0", + "1f4d1", + "1f4d2", + "1f4d3", + "1f4d4", + "1f4d5", + "1f4d6", + "1f4d7", + "1f4d8", + "1f4d9", + "1f4da", + "1f4db", + "1f4dc", + "1f4dd", + "1f4de", + "1f4df", + "1f4e0", + "1f4e1", + "1f4e2", + "1f4e3", + "1f4e4", + "1f4e5", + "1f4e6", + "1f4e7", + "1f4e8", + "1f4e9", + "1f4ea", + "1f4eb", + "1f4ec", + "1f4ed", + "1f4ee", + "1f4ef", + "1f4f0", + "1f4f1", + "1f4f2", + "1f4f3", + "1f4f4", + "1f4f5", + "1f4f6", + "1f4f7", + "1f4f9", + "1f4fa", + "1f4fb", + "1f4fc", + "1f500", + "1f501", + "1f502", + "1f503", + "1f504", + "1f505", + "1f506", + "1f507", + "1f508", + "1f509", + "1f50a", + "1f50b", + "1f50c", + "1f50d", + "1f50e", + "1f50f", + "1f510", + "1f511", + "1f512", + "1f513", + "1f514", + "1f515", + "1f516", + "1f517", + "1f518", + "1f519", + "1f51a", + "1f51b", + "1f51c", + "1f51d", + "1f51e", + "1f51f", + "1f520", + "1f521", + "1f522", + "1f523", + "1f524", + "1f525", + "1f526", + "1f527", + "1f528", + "1f529", + "1f52a", + "1f52b", + "1f52c", + "1f52d", + "1f52e", + "1f52f", + "1f530", + "1f531", + "1f532", + "1f533", + "1f534", + "1f535", + "1f536", + "1f537", + "1f538", + "1f539", + "1f53a", + "1f53b", + "1f53c", + "1f53d", + "1f550", + "1f551", + "1f552", + "1f553", + "1f554", + "1f555", + "1f556", + "1f557", + "1f558", + "1f559", + "1f55a", + "1f55b", + "1f55c", + "1f55d", + "1f55e", + "1f55f", + "1f560", + "1f561", + "1f562", + "1f563", + "1f564", + "1f565", + "1f566", + "1f567", + "1f5fb", + "1f5fc", + "1f5fd", + "1f5fe", + "1f5ff", + "1f600", + "1f601", + "1f602", + "1f603", + "1f604", + "1f605", + "1f606", + "1f607", + "1f608", + "1f609", + "1f60a", + "1f60b", + "1f60c", + "1f60d", + "1f60e", + "1f60f", + "1f610", + "1f611", + "1f612", + "1f613", + "1f614", + "1f615", + "1f616", + "1f617", + "1f618", + "1f619", + "1f61a", + "1f61b", + "1f61c", + "1f61d", + "1f61e", + "1f61f", + "1f620", + "1f621", + "1f622", + "1f623", + "1f624", + "1f625", + "1f626", + "1f627", + "1f628", + "1f629", + "1f62a", + "1f62b", + "1f62c", + "1f62d", + "1f62e", + "1f62f", + "1f630", + "1f631", + "1f632", + "1f633", + "1f634", + "1f635", + "1f636", + "1f637", + "1f638", + "1f639", + "1f63a", + "1f63b", + "1f63c", + "1f63d", + "1f63e", + "1f63f", + "1f640", + "1f645", + "1f646", + "1f647", + "1f648", + "1f649", + "1f64a", + "1f64b", + "1f64c", + "1f64d", + "1f64e", + "1f64f", + "1f680", + "1f681", + "1f682", + "1f683", + "1f684", + "1f685", + "1f686", + "1f687", + "1f688", + "1f689", + "1f68a", + "1f68b", + "1f68c", + "1f68d", + "1f68e", + "1f68f", + "1f690", + "1f691", + "1f692", + "1f693", + "1f694", + "1f695", + "1f696", + "1f697", + "1f698", + "1f699", + "1f69a", + "1f69b", + "1f69c", + "1f69d", + "1f69e", + "1f69f", + "1f6a0", + "1f6a1", + "1f6a2", + "1f6a3", + "1f6a4", + "1f6a5", + "1f6a6", + "1f6a7", + "1f6a8", + "1f6a9", + "1f6aa", + "1f6ab", + "1f6ac", + "1f6ad", + "1f6ae", + "1f6af", + "1f6b0", + "1f6b1", + "1f6b2", + "1f6b3", + "1f6b4", + "1f6b5", + "1f6b6", + "1f6b7", + "1f6b8", + "1f6b9", + "1f6ba", + "1f6bb", + "1f6bc", + "1f6bd", + "1f6be", + "1f6bf", + "1f6c0", + "1f6c1", + "1f6c2", + "1f6c3", + "1f6c4", + "1f6c5", + "203c", + "2049", + "2122", + "2139", + "2194", + "2195", + "2196", + "2197", + "2198", + "2199", + "21a9", + "21aa", + "23-20e3", + "231a", + "231b", + "23e9", + "23ea", + "23eb", + "23ec", + "23f0", + "23f3", + "24c2", + "25aa", + "25ab", + "25b6", + "25c0", + "25fb", + "25fc", + "25fd", + "25fe", + "2600", + "2601", + "260e", + "2611", + "2614", + "2615", + "261d", + "263a", + "2648", + "2649", + "264a", + "264b", + "264c", + "264d", + "264e", + "264f", + "2650", + "2651", + "2652", + "2653", + "2660", + "2663", + "2665", + "2666", + "2668", + "267b", + "267f", + "2693", + "26a0", + "26a1", + "26aa", + "26ab", + "26bd", + "26be", + "26c4", + "26c5", + "26ce", + "26d4", + "26ea", + "26f2", + "26f3", + "26f5", + "26fa", + "26fd", + "2702", + "2705", + "2708", + "2709", + "270a", + "270b", + "270c", + "270f", + "2712", + "2714", + "2716", + "2728", + "2733", + "2734", + "2744", + "2747", + "274c", + "274e", + "2753", + "2754", + "2755", + "2757", + "2764", + "2795", + "2796", + "2797", + "27a1", + "27b0", + "27bf", + "2934", + "2935", + "2b05", + "2b06", + "2b07", + "2b1b", + "2b1c", + "2b50", + "2b55", + "30-20e3", + "3030", + "303d", + "31-20e3", + "32-20e3", + "3297", + "3299", + "33-20e3", + "34-20e3", + "35-20e3", + "36-20e3", + "37-20e3", + "38-20e3", + "39-20e3", + "a9", + "ae", + "e50a" + ], + "font-awesome": [ + "glass", + "music", + "search", + "envelope-o", + "heart", + "star", + "star-o", + "user", + "film", + "th-large", + "th", + "th-list", + "check", + "times", + "search-plus", + "search-minus", + "power-off", + "signal", + "cog", + "trash-o", + "home", + "file-o", + "clock-o", + "road", + "download", + "arrow-circle-o-down", + "arrow-circle-o-up", + "inbox", + "play-circle-o", + "repeat", + "refresh", + "list-alt", + "lock", + "flag", + "headphones", + "volume-off", + "volume-down", + "volume-up", + "qrcode", + "barcode", + "tag", + "tags", + "book", + "bookmark", + "print", + "camera", + "font", + "bold", + "italic", + "text-height", + "text-width", + "align-left", + "align-center", + "align-right", + "align-justify", + "list", + "outdent", + "indent", + "video-camera", + "picture-o", + "pencil", + "map-marker", + "adjust", + "tint", + "pencil-square-o", + "share-square-o", + "check-square-o", + "arrows", + "step-backward", + "fast-backward", + "backward", + "play", + "pause", + "stop", + "forward", + "fast-forward", + "step-forward", + "eject", + "chevron-left", + "chevron-right", + "plus-circle", + "minus-circle", + "times-circle", + "check-circle", + "question-circle", + "info-circle", + "crosshairs", + "times-circle-o", + "check-circle-o", + "ban", + "arrow-left", + "arrow-right", + "arrow-up", + "arrow-down", + "share", + "expand", + "compress", + "plus", + "minus", + "asterisk", + "exclamation-circle", + "gift", + "leaf", + "fire", + "eye", + "eye-slash", + "exclamation-triangle", + "plane", + "calendar", + "random", + "comment", + "magnet", + "chevron-up", + "chevron-down", + "retweet", + "shopping-cart", + "folder", + "folder-open", + "arrows-v", + "arrows-h", + "bar-chart", + "twitter-square", + "facebook-square", + "camera-retro", + "key", + "cogs", + "comments", + "thumbs-o-up", + "thumbs-o-down", + "star-half", + "heart-o", + "sign-out", + "linkedin-square", + "thumb-tack", + "external-link", + "sign-in", + "trophy", + "github-square", + "upload", + "lemon-o", + "phone", + "square-o", + "bookmark-o", + "phone-square", + "twitter", + "facebook", + "github", + "unlock", + "credit-card", + "rss", + "hdd-o", + "bullhorn", + "bell", + "certificate", + "hand-o-right", + "hand-o-left", + "hand-o-up", + "hand-o-down", + "arrow-circle-left", + "arrow-circle-right", + "arrow-circle-up", + "arrow-circle-down", + "globe", + "wrench", + "tasks", + "filter", + "briefcase", + "arrows-alt", + "users", + "link", + "cloud", + "flask", + "scissors", + "files-o", + "paperclip", + "floppy-o", + "square", + "bars", + "list-ul", + "list-ol", + "strikethrough", + "underline", + "table", + "magic", + "truck", + "pinterest", + "pinterest-square", + "google-plus-square", + "google-plus", + "money", + "caret-down", + "caret-up", + "caret-left", + "caret-right", + "columns", + "sort", + "sort-desc", + "sort-asc", + "envelope", + "linkedin", + "undo", + "gavel", + "tachometer", + "comment-o", + "comments-o", + "bolt", + "sitemap", + "umbrella", + "clipboard", + "lightbulb-o", + "exchange", + "cloud-download", + "cloud-upload", + "user-md", + "stethoscope", + "suitcase", + "bell-o", + "coffee", + "cutlery", + "file-text-o", + "building-o", + "hospital-o", + "ambulance", + "medkit", + "fighter-jet", + "beer", + "h-square", + "plus-square", + "angle-double-left", + "angle-double-right", + "angle-double-up", + "angle-double-down", + "angle-left", + "angle-right", + "angle-up", + "angle-down", + "desktop", + "laptop", + "tablet", + "mobile", + "circle-o", + "quote-left", + "quote-right", + "spinner", + "circle", + "reply", + "github-alt", + "folder-o", + "folder-open-o", + "smile-o", + "frown-o", + "meh-o", + "gamepad", + "keyboard-o", + "flag-o", + "flag-checkered", + "terminal", + "code", + "reply-all", + "star-half-o", + "location-arrow", + "crop", + "code-fork", + "chain-broken", + "question", + "info", + "exclamation", + "superscript", + "subscript", + "eraser", + "puzzle-piece", + "microphone", + "microphone-slash", + "shield", + "calendar-o", + "fire-extinguisher", + "rocket", + "maxcdn", + "chevron-circle-left", + "chevron-circle-right", + "chevron-circle-up", + "chevron-circle-down", + "html5", + "css3", + "anchor", + "unlock-alt", + "bullseye", + "ellipsis-h", + "ellipsis-v", + "rss-square", + "play-circle", + "ticket", + "minus-square", + "minus-square-o", + "level-up", + "level-down", + "check-square", + "pencil-square", + "share-square", + "compass", + "caret-square-o-down", + "caret-square-o-up", + "caret-square-o-right", + "eur", + "gbp", + "usd", + "inr", + "jpy", + "rub", + "krw", + "btc", + "file", + "file-text", + "sort-alpha-asc", + "sort-alpha-desc", + "sort-amount-asc", + "sort-amount-desc", + "sort-numeric-asc", + "sort-numeric-desc", + "thumbs-up", + "thumbs-down", + "youtube-square", + "youtube", + "xing", + "xing-square", + "youtube-play", + "dropbox", + "stack-overflow", + "instagram", + "flickr", + "adn", + "bitbucket", + "bitbucket-square", + "tumblr", + "tumblr-square", + "long-arrow-down", + "long-arrow-up", + "long-arrow-left", + "long-arrow-right", + "apple", + "windows", + "android", + "linux", + "dribbble", + "skype", + "foursquare", + "trello", + "female", + "male", + "gratipay", + "sun-o", + "moon-o", + "archive", + "bug", + "vk", + "weibo", + "renren", + "pagelines", + "stack-exchange", + "arrow-circle-o-right", + "arrow-circle-o-left", + "caret-square-o-left", + "dot-circle-o", + "wheelchair", + "vimeo-square", + "try", + "plus-square-o", + "space-shuttle", + "slack", + "envelope-square", + "wordpress", + "openid", + "university", + "graduation-cap", + "yahoo", + "google", + "reddit", + "reddit-square", + "stumbleupon-circle", + "stumbleupon", + "delicious", + "digg", + "pied-piper", + "pied-piper-alt", + "drupal", + "joomla", + "language", + "fax", + "building", + "child", + "paw", + "spoon", + "cube", + "cubes", + "behance", + "behance-square", + "steam", + "steam-square", + "recycle", + "car", + "taxi", + "tree", + "spotify", + "deviantart", + "soundcloud", + "database", + "file-pdf-o", + "file-word-o", + "file-excel-o", + "file-powerpoint-o", + "file-image-o", + "file-archive-o", + "file-audio-o", + "file-video-o", + "file-code-o", + "vine", + "codepen", + "jsfiddle", + "life-ring", + "circle-o-notch", + "rebel", + "empire", + "git-square", + "git", + "hacker-news", + "tencent-weibo", + "qq", + "weixin", + "paper-plane", + "paper-plane-o", + "history", + "circle-thin", + "header", + "paragraph", + "sliders", + "share-alt", + "share-alt-square", + "bomb", + "futbol-o", + "tty", + "binoculars", + "plug", + "slideshare", + "twitch", + "yelp", + "newspaper-o", + "wifi", + "calculator", + "paypal", + "google-wallet", + "cc-visa", + "cc-mastercard", + "cc-discover", + "cc-amex", + "cc-paypal", + "cc-stripe", + "bell-slash", + "bell-slash-o", + "trash", + "copyright", + "at", + "eyedropper", + "paint-brush", + "birthday-cake", + "area-chart", + "pie-chart", + "line-chart", + "lastfm", + "lastfm-square", + "toggle-off", + "toggle-on", + "bicycle", + "bus", + "ioxhost", + "angellist", + "cc", + "ils", + "meanpath", + "buysellads", + "connectdevelop", + "dashcube", + "forumbee", + "leanpub", + "sellsy", + "shirtsinbulk", + "simplybuilt", + "skyatlas", + "cart-plus", + "cart-arrow-down", + "diamond", + "ship", + "user-secret", + "motorcycle", + "street-view", + "heartbeat", + "venus", + "mars", + "mercury", + "transgender", + "transgender-alt", + "venus-double", + "mars-double", + "venus-mars", + "mars-stroke", + "mars-stroke-v", + "mars-stroke-h", + "neuter", + "facebook-official", + "pinterest-p", + "whatsapp", + "server", + "user-plus", + "user-times", + "bed", + "viacoin", + "train", + "subway", + "medium", + "GitHub", + "bed", + "buysellads", + "cart-arrow-down", + "cart-plus", + "connectdevelop", + "dashcube", + "diamond", + "facebook-official", + "forumbee", + "heartbeat", + "hotel", + "leanpub", + "mars", + "mars-double", + "mars-stroke", + "mars-stroke-h", + "mars-stroke-v", + "medium", + "mercury", + "motorcycle", + "neuter", + "pinterest-p", + "sellsy", + "server", + "ship", + "shirtsinbulk", + "simplybuilt", + "skyatlas", + "street-view", + "subway", + "train", + "transgender", + "transgender-alt", + "user-plus", + "user-secret", + "user-times", + "venus", + "venus-double", + "venus-mars", + "viacoin", + "whatsapp", + "adjust", + "anchor", + "archive", + "area-chart", + "arrows", + "arrows-h", + "arrows-v", + "asterisk", + "at", + "automobile", + "ban", + "bank", + "bar-chart", + "bar-chart-o", + "barcode", + "bars", + "bed", + "beer", + "bell", + "bell-o", + "bell-slash", + "bell-slash-o", + "bicycle", + "binoculars", + "birthday-cake", + "bolt", + "bomb", + "book", + "bookmark", + "bookmark-o", + "briefcase", + "bug", + "building", + "building-o", + "bullhorn", + "bullseye", + "bus", + "cab", + "calculator", + "calendar", + "calendar-o", + "camera", + "camera-retro", + "car", + "caret-square-o-down", + "caret-square-o-left", + "caret-square-o-right", + "caret-square-o-up", + "cart-arrow-down", + "cart-plus", + "cc", + "certificate", + "check", + "check-circle", + "check-circle-o", + "check-square", + "check-square-o", + "child", + "circle", + "circle-o", + "circle-o-notch", + "circle-thin", + "clock-o", + "close", + "cloud", + "cloud-download", + "cloud-upload", + "code", + "code-fork", + "coffee", + "cog", + "cogs", + "comment", + "comment-o", + "comments", + "comments-o", + "compass", + "copyright", + "credit-card", + "crop", + "crosshairs", + "cube", + "cubes", + "cutlery", + "dashboard", + "database", + "desktop", + "diamond", + "dot-circle-o", + "download", + "edit", + "ellipsis-h", + "ellipsis-v", + "envelope", + "envelope-o", + "envelope-square", + "eraser", + "exchange", + "exclamation", + "exclamation-circle", + "exclamation-triangle", + "external-link", + "external-link-square", + "eye", + "eye-slash", + "eyedropper", + "fax", + "female", + "fighter-jet", + "file-archive-o", + "file-audio-o", + "file-code-o", + "file-excel-o", + "file-image-o", + "file-movie-o", + "file-pdf-o", + "file-photo-o", + "file-picture-o", + "file-powerpoint-o", + "file-sound-o", + "file-video-o", + "file-word-o", + "file-zip-o", + "film", + "filter", + "fire", + "fire-extinguisher", + "flag", + "flag-checkered", + "flag-o", + "flash", + "flask", + "folder", + "folder-o", + "folder-open", + "folder-open-o", + "frown-o", + "futbol-o", + "gamepad", + "gavel", + "gear", + "gears", + "genderless", + "gift", + "glass", + "globe", + "graduation-cap", + "group", + "hdd-o", + "headphones", + "heart", + "heart-o", + "heartbeat", + "history", + "home", + "hotel", + "image", + "inbox", + "info", + "info-circle", + "institution", + "key", + "keyboard-o", + "language", + "laptop", + "leaf", + "legal", + "lemon-o", + "level-down", + "level-up", + "life-bouy", + "life-buoy", + "life-ring", + "life-saver", + "lightbulb-o", + "line-chart", + "location-arrow", + "lock", + "magic", + "magnet", + "mail-forward", + "mail-reply", + "mail-reply-all", + "male", + "map-marker", + "meh-o", + "microphone", + "microphone-slash", + "minus", + "minus-circle", + "minus-square", + "minus-square-o", + "mobile", + "mobile-phone", + "money", + "moon-o", + "mortar-board", + "motorcycle", + "music", + "navicon", + "newspaper-o", + "paint-brush", + "paper-plane", + "paper-plane-o", + "paw", + "pencil", + "pencil-square", + "pencil-square-o", + "phone", + "phone-square", + "photo", + "picture-o", + "pie-chart", + "plane", + "plug", + "plus", + "plus-circle", + "plus-square", + "plus-square-o", + "power-off", + "print", + "puzzle-piece", + "qrcode", + "question", + "question-circle", + "quote-left", + "quote-right", + "random", + "recycle", + "refresh", + "remove", + "reorder", + "reply", + "reply-all", + "retweet", + "road", + "rocket", + "rss", + "rss-square", + "search", + "search-minus", + "search-plus", + "send", + "send-o", + "server", + "share", + "share-alt", + "share-alt-square", + "share-square", + "share-square-o", + "shield", + "ship", + "shopping-cart", + "sign-in", + "sign-out", + "signal", + "sitemap", + "sliders", + "smile-o", + "soccer-ball-o", + "sort", + "sort-alpha-asc", + "sort-alpha-desc", + "sort-amount-asc", + "sort-amount-desc", + "sort-asc", + "sort-desc", + "sort-down", + "sort-numeric-asc", + "sort-numeric-desc", + "sort-up", + "space-shuttle", + "spinner", + "spoon", + "square", + "square-o", + "star", + "star-half", + "star-half-empty", + "star-half-full", + "star-half-o", + "star-o", + "street-view", + "suitcase", + "sun-o", + "support", + "tablet", + "tachometer", + "tag", + "tags", + "tasks", + "taxi", + "terminal", + "thumb-tack", + "thumbs-down", + "thumbs-o-down", + "thumbs-o-up", + "thumbs-up", + "ticket", + "times", + "times-circle", + "times-circle-o", + "tint", + "toggle-down", + "toggle-left", + "toggle-off", + "toggle-on", + "toggle-right", + "toggle-up", + "trash", + "trash-o", + "tree", + "trophy", + "truck", + "tty", + "umbrella", + "university", + "unlock", + "unlock-alt", + "unsorted", + "upload", + "user", + "user-plus", + "user-secret", + "user-times", + "users", + "video-camera", + "volume-down", + "volume-off", + "volume-up", + "warning", + "wheelchair", + "wifi", + "wrench", + "ambulance", + "automobile", + "bicycle", + "bus", + "cab", + "car", + "fighter-jet", + "motorcycle", + "plane", + "rocket", + "ship", + "space-shuttle", + "subway", + "taxi", + "train", + "truck", + "wheelchair", + "circle-thin", + "genderless", + "mars", + "mars-double", + "mars-stroke", + "mars-stroke-h", + "mars-stroke-v", + "mercury", + "neuter", + "transgender", + "transgender-alt", + "venus", + "venus-double", + "venus-mars", + "file", + "file-archive-o", + "file-audio-o", + "file-code-o", + "file-excel-o", + "file-image-o", + "file-movie-o", + "file-o", + "file-pdf-o", + "file-photo-o", + "file-picture-o", + "file-powerpoint-o", + "file-sound-o", + "file-text", + "file-text-o", + "file-video-o", + "file-word-o", + "file-zip-o", + "circle-o-notch", + "cog", + "gear", + "refresh", + "spinner", + "check-square", + "check-square-o", + "circle", + "circle-o", + "dot-circle-o", + "minus-square", + "minus-square-o", + "plus-square", + "plus-square-o", + "square", + "square-o", + "cc-amex", + "cc-discover", + "cc-mastercard", + "cc-paypal", + "cc-stripe", + "cc-visa", + "credit-card", + "google-wallet", + "paypal", + "area-chart", + "bar-chart", + "bar-chart-o", + "line-chart", + "pie-chart", + "bitcoin", + "btc", + "cny", + "dollar", + "eur", + "euro", + "gbp", + "ils", + "inr", + "jpy", + "krw", + "money", + "rmb", + "rouble", + "rub", + "ruble", + "rupee", + "shekel", + "sheqel", + "try", + "turkish-lira", + "usd", + "won", + "yen", + "align-center", + "align-justify", + "align-left", + "align-right", + "bold", + "chain", + "chain-broken", + "clipboard", + "columns", + "copy", + "cut", + "dedent", + "eraser", + "file", + "file-o", + "file-text", + "file-text-o", + "files-o", + "floppy-o", + "font", + "header", + "indent", + "italic", + "link", + "list", + "list-alt", + "list-ol", + "list-ul", + "outdent", + "paperclip", + "paragraph", + "paste", + "repeat", + "rotate-left", + "rotate-right", + "save", + "scissors", + "strikethrough", + "subscript", + "superscript", + "table", + "text-height", + "text-width", + "th", + "th-large", + "th-list", + "underline", + "undo", + "unlink", + "angle-double-down", + "angle-double-left", + "angle-double-right", + "angle-double-up", + "angle-down", + "angle-left", + "angle-right", + "angle-up", + "arrow-circle-down", + "arrow-circle-left", + "arrow-circle-o-down", + "arrow-circle-o-left", + "arrow-circle-o-right", + "arrow-circle-o-up", + "arrow-circle-right", + "arrow-circle-up", + "arrow-down", + "arrow-left", + "arrow-right", + "arrow-up", + "arrows", + "arrows-alt", + "arrows-h", + "arrows-v", + "caret-down", + "caret-left", + "caret-right", + "caret-square-o-down", + "caret-square-o-left", + "caret-square-o-right", + "caret-square-o-up", + "caret-up", + "chevron-circle-down", + "chevron-circle-left", + "chevron-circle-right", + "chevron-circle-up", + "chevron-down", + "chevron-left", + "chevron-right", + "chevron-up", + "hand-o-down", + "hand-o-left", + "hand-o-right", + "hand-o-up", + "long-arrow-down", + "long-arrow-left", + "long-arrow-right", + "long-arrow-up", + "toggle-down", + "toggle-left", + "toggle-right", + "toggle-up", + "arrows-alt", + "backward", + "compress", + "eject", + "expand", + "fast-backward", + "fast-forward", + "forward", + "pause", + "play", + "play-circle", + "play-circle-o", + "step-backward", + "step-forward", + "stop", + "youtube-play", + "report an issue with Adblock Plus", + "adn", + "android", + "angellist", + "apple", + "behance", + "behance-square", + "bitbucket", + "bitbucket-square", + "bitcoin", + "btc", + "buysellads", + "cc-amex", + "cc-discover", + "cc-mastercard", + "cc-paypal", + "cc-stripe", + "cc-visa", + "codepen", + "connectdevelop", + "css3", + "dashcube", + "delicious", + "deviantart", + "digg", + "dribbble", + "dropbox", + "drupal", + "empire", + "facebook", + "facebook-f", + "facebook-official", + "facebook-square", + "flickr", + "forumbee", + "foursquare", + "ge", + "git", + "git-square", + "github", + "github-alt", + "github-square", + "gittip", + "google", + "google-plus", + "google-plus-square", + "google-wallet", + "gratipay", + "hacker-news", + "html5", + "instagram", + "ioxhost", + "joomla", + "jsfiddle", + "lastfm", + "lastfm-square", + "leanpub", + "linkedin", + "linkedin-square", + "linux", + "maxcdn", + "meanpath", + "medium", + "openid", + "pagelines", + "paypal", + "pied-piper", + "pied-piper-alt", + "pinterest", + "pinterest-p", + "pinterest-square", + "qq", + "ra", + "rebel", + "reddit", + "reddit-square", + "renren", + "sellsy", + "share-alt", + "share-alt-square", + "shirtsinbulk", + "simplybuilt", + "skyatlas", + "skype", + "slack", + "slideshare", + "soundcloud", + "spotify", + "stack-exchange", + "stack-overflow", + "steam", + "steam-square", + "stumbleupon", + "stumbleupon-circle", + "tencent-weibo", + "trello", + "tumblr", + "tumblr-square", + "twitch", + "twitter", + "twitter-square", + "viacoin", + "vimeo-square", + "vine", + "vk", + "wechat", + "weibo", + "weixin", + "whatsapp", + "windows", + "wordpress", + "xing", + "xing-square", + "yahoo", + "yelp", + "youtube", + "youtube-play", + "youtube-square", + "ambulance", + "h-square", + "heart", + "heart-o", + "heartbeat", + "hospital-o", + "medkit", + "plus-square", + "stethoscope", + "user-md", + "wheelchair" + ] } \ No newline at end of file diff --git a/web/editor.md/plugins/goto-line-dialog/goto-line-dialog.js b/web/editor.md/plugins/goto-line-dialog/goto-line-dialog.js index f875743..9fd4416 100644 --- a/web/editor.md/plugins/goto-line-dialog/goto-line-dialog.js +++ b/web/editor.md/plugins/goto-line-dialog/goto-line-dialog.js @@ -9,149 +9,144 @@ * @license MIT */ -(function() { - - var factory = function (exports) { - - var $ = jQuery; - var pluginName = "goto-line-dialog"; - - var langs = { - "zh-cn" : { - toolbar : { - "goto-line" : "跳转到行" - }, - dialog : { - "goto-line" : { - title : "跳转到行", - label : "请输入行号", - error : "错误:" - } - } - }, - "zh-tw" : { - toolbar : { - "goto-line" : "跳轉到行" - }, - dialog : { - "goto-line" : { - title : "跳轉到行", - label : "請輸入行號", - error : "錯誤:" - } - } - }, - "en" : { - toolbar : { - "goto-line" : "Goto line" - }, - dialog : { - "goto-line" : { - title : "Goto line", - label : "Enter a line number, range ", - error : "Error: " - } - } - } - }; - - exports.fn.gotoLineDialog = function() { - var _this = this; - var cm = this.cm; - var editor = this.editor; - var settings = this.settings; - var path = settings.pluginPath + pluginName +"/"; - var classPrefix = this.classPrefix; - var dialogName = classPrefix + pluginName, dialog; - - $.extend(true, this.lang, langs[this.lang.name]); - this.setToolbar(); - - var lang = this.lang; - var dialogLang = lang.dialog["goto-line"]; - var lineCount = cm.lineCount(); - - dialogLang.error += dialogLang.label + " 1-" + lineCount; - - if (editor.find("." + dialogName).length < 1) - { - var dialogContent = [ - "
    ", - "

    " + dialogLang.label + " 1-" + lineCount +"   

    ", - "
    " - ].join("\n"); - - dialog = this.createDialog({ - name : dialogName, - title : dialogLang.title, - width : 400, - height : 180, - mask : settings.dialogShowMask, - drag : settings.dialogDraggable, - content : dialogContent, - lockScreen : settings.dialogLockScreen, - maskStyle : { - opacity : settings.dialogMaskOpacity, - backgroundColor : settings.dialogMaskBgColor - }, - buttons : { - enter : [lang.buttons.enter, function() { - var line = parseInt(this.find("[data-line-number]").val()); - - if (line < 1 || line > lineCount) { - alert(dialogLang.error); - - return false; - } - - _this.gotoLine(line); +(function () { + + var factory = function (exports) { + + var $ = jQuery; + var pluginName = "goto-line-dialog"; + + var langs = { + "zh-cn": { + toolbar: { + "goto-line": "跳转到行" + }, + dialog: { + "goto-line": { + title: "跳转到行", + label: "请输入行号", + error: "错误:" + } + } + }, + "zh-tw": { + toolbar: { + "goto-line": "跳轉到行" + }, + dialog: { + "goto-line": { + title: "跳轉到行", + label: "請輸入行號", + error: "錯誤:" + } + } + }, + "en": { + toolbar: { + "goto-line": "Goto line" + }, + dialog: { + "goto-line": { + title: "Goto line", + label: "Enter a line number, range ", + error: "Error: " + } + } + } + }; + + exports.fn.gotoLineDialog = function () { + var _this = this; + var cm = this.cm; + var editor = this.editor; + var settings = this.settings; + var path = settings.pluginPath + pluginName + "/"; + var classPrefix = this.classPrefix; + var dialogName = classPrefix + pluginName, dialog; + + $.extend(true, this.lang, langs[this.lang.name]); + this.setToolbar(); + + var lang = this.lang; + var dialogLang = lang.dialog["goto-line"]; + var lineCount = cm.lineCount(); + + dialogLang.error += dialogLang.label + " 1-" + lineCount; + + if (editor.find("." + dialogName).length < 1) { + var dialogContent = [ + "
    ", + "

    " + dialogLang.label + " 1-" + lineCount + "   

    ", + "
    " + ].join("\n"); + + dialog = this.createDialog({ + name: dialogName, + title: dialogLang.title, + width: 400, + height: 180, + mask: settings.dialogShowMask, + drag: settings.dialogDraggable, + content: dialogContent, + lockScreen: settings.dialogLockScreen, + maskStyle: { + opacity: settings.dialogMaskOpacity, + backgroundColor: settings.dialogMaskBgColor + }, + buttons: { + enter: [lang.buttons.enter, function () { + var line = parseInt(this.find("[data-line-number]").val()); + + if (line < 1 || line > lineCount) { + alert(dialogLang.error); + + return false; + } + + _this.gotoLine(line); this.hide().lockScreen(false).hideMask(); return false; }], - cancel : [lang.buttons.cancel, function() { + cancel: [lang.buttons.cancel, function () { this.hide().lockScreen(false).hideMask(); return false; }] - } - }); - } - - dialog = editor.find("." + dialogName); - - this.dialogShowMask(dialog); - this.dialogLockScreen(); - dialog.show(); - }; - - }; - - // CommonJS/Node.js - if (typeof require === "function" && typeof exports === "object" && typeof module === "object") - { + } + }); + } + + dialog = editor.find("." + dialogName); + + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { module.exports = factory; - } - else if (typeof define === "function") // AMD/CMD/Sea.js + } else if (typeof define === "function") // AMD/CMD/Sea.js { - if (define.amd) { // for Require.js + if (define.amd) { // for Require.js - define(["editormd"], function(editormd) { + define(["editormd"], function (editormd) { factory(editormd); }); - } else { // for Sea.js - define(function(require) { + } else { // for Sea.js + define(function (require) { var editormd = require("./../../editormd"); factory(editormd); }); - } - } - else - { + } + } else { factory(window.editormd); - } + } })(); diff --git a/web/editor.md/plugins/help-dialog/help-dialog.js b/web/editor.md/plugins/help-dialog/help-dialog.js index 339b3c0..b057c36 100644 --- a/web/editor.md/plugins/help-dialog/help-dialog.js +++ b/web/editor.md/plugins/help-dialog/help-dialog.js @@ -9,94 +9,88 @@ * @license MIT */ -(function() { - - var factory = function (exports) { - - var $ = jQuery; - var pluginName = "help-dialog"; - - exports.fn.helpDialog = function() { - var _this = this; - var lang = this.lang; - var editor = this.editor; - var settings = this.settings; - var path = settings.pluginPath + pluginName + "/"; - var classPrefix = this.classPrefix; - var dialogName = classPrefix + pluginName, dialog; - var dialogLang = lang.dialog.help; - - if (editor.find("." + dialogName).length < 1) - { - var dialogContent = "
    "; - - dialog = this.createDialog({ - name : dialogName, - title : dialogLang.title, - width : 840, - height : 540, - mask : settings.dialogShowMask, - drag : settings.dialogDraggable, - content : dialogContent, - lockScreen : settings.dialogLockScreen, - maskStyle : { - opacity : settings.dialogMaskOpacity, - backgroundColor : settings.dialogMaskBgColor - }, - buttons : { - close : [lang.buttons.close, function() { - this.hide().lockScreen(false).hideMask(); - - return false; - }] - } - }); - } - - dialog = editor.find("." + dialogName); - - this.dialogShowMask(dialog); - this.dialogLockScreen(); - dialog.show(); - - var helpContent = dialog.find(".markdown-body"); - - if (helpContent.html() === "") - { - $.get(path + "help.md", function(text) { - var md = exports.$marked(text); - helpContent.html(md); - +(function () { + + var factory = function (exports) { + + var $ = jQuery; + var pluginName = "help-dialog"; + + exports.fn.helpDialog = function () { + var _this = this; + var lang = this.lang; + var editor = this.editor; + var settings = this.settings; + var path = settings.pluginPath + pluginName + "/"; + var classPrefix = this.classPrefix; + var dialogName = classPrefix + pluginName, dialog; + var dialogLang = lang.dialog.help; + + if (editor.find("." + dialogName).length < 1) { + var dialogContent = "
    "; + + dialog = this.createDialog({ + name: dialogName, + title: dialogLang.title, + width: 840, + height: 540, + mask: settings.dialogShowMask, + drag: settings.dialogDraggable, + content: dialogContent, + lockScreen: settings.dialogLockScreen, + maskStyle: { + opacity: settings.dialogMaskOpacity, + backgroundColor: settings.dialogMaskBgColor + }, + buttons: { + close: [lang.buttons.close, function () { + this.hide().lockScreen(false).hideMask(); + + return false; + }] + } + }); + } + + dialog = editor.find("." + dialogName); + + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + + var helpContent = dialog.find(".markdown-body"); + + if (helpContent.html() === "") { + $.get(path + "help.md", function (text) { + var md = exports.$marked(text); + helpContent.html(md); + helpContent.find("a").attr("target", "_blank"); - }); - } - }; - - }; - - // CommonJS/Node.js - if (typeof require === "function" && typeof exports === "object" && typeof module === "object") - { + }); + } + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { module.exports = factory; - } - else if (typeof define === "function") // AMD/CMD/Sea.js + } else if (typeof define === "function") // AMD/CMD/Sea.js { - if (define.amd) { // for Require.js + if (define.amd) { // for Require.js - define(["editormd"], function(editormd) { + define(["editormd"], function (editormd) { factory(editormd); }); - } else { // for Sea.js - define(function(require) { + } else { // for Sea.js + define(function (require) { var editormd = require("./../../editormd"); factory(editormd); }); - } - } - else - { + } + } else { factory(window.editormd); - } + } })(); diff --git a/web/editor.md/plugins/help-dialog/help.md b/web/editor.md/plugins/help-dialog/help.md index 9a030f2..7c2babf 100644 --- a/web/editor.md/plugins/help-dialog/help.md +++ b/web/editor.md/plugins/help-dialog/help.md @@ -10,53 +10,53 @@ ##### 键盘快捷键 (Keyboard shortcuts) > If Editor.md code editor is on focus, you can use keyboard shortcuts. - -| Keyboard shortcuts (键盘快捷键) | 说明 | Description | -| :---------------------------------------------- |:--------------------------------- | :------------------------------------------------- | -| F9 | 切换实时预览 | Switch watch/unwatch | -| F10 | 全屏HTML预览(按 Shift + ESC 退出) | Full preview HTML (Press Shift + ESC exit) | -| F11 | 切换全屏状态 | Switch fullscreen (Press ESC exit) | -| Ctrl + 1~6 / Command + 1~6 | 插入标题1~6 | Insert heading 1~6 | -| Ctrl + A / Command + A | 全选 | Select all | -| Ctrl + B / Command + B | 插入粗体 | Insert bold | -| Ctrl + D / Command + D | 插入日期时间 | Insert datetime | -| Ctrl + E / Command + E | 插入Emoji符号 | Insert :emoji: | -| Ctrl + F / Command + F | 查找/搜索 | Start searching | -| Ctrl + G / Command + G | 切换到下一个搜索结果项 | Find next search results | -| Ctrl + H / Command + H | 插入水平线 | Insert horizontal rule | -| Ctrl + I / Command + I | 插入斜体 | Insert italic | -| Ctrl + K / Command + K | 插入行内代码 | Insert inline code | -| Ctrl + L / Command + L | 插入链接 | Insert link | -| Ctrl + U / Command + U | 插入无序列表 | Insert unordered list | -| Ctrl + Q | 代码折叠切换 | Switch code fold | -| Ctrl + Z / Command + Z | 撤销 | Undo | -| Ctrl + Y / Command + Y | 重做 | Redo | -| Ctrl + Shift + A | 插入@链接 | Insert @link | -| Ctrl + Shift + C | 插入行内代码 | Insert inline code | -| Ctrl + Shift + E | 打开插入Emoji表情对话框 | Open emoji dialog | -| Ctrl + Shift + F / Command + Option + F | 替换 | Replace | -| Ctrl + Shift + G / Shift + Command + G | 切换到上一个搜索结果项 | Find previous search results | -| Ctrl + Shift + H | 打开HTML实体字符对话框 | Open HTML Entities dialog | -| Ctrl + Shift + I | 插入图片 | Insert image ![]() | -| Ctrl + Shift + K | 插入TeX(KaTeX)公式符号 | Insert TeX(KaTeX) symbol $$TeX$$ | -| Ctrl + Shift + L | 打开插入链接对话框 | Open link dialog | -| Ctrl + Shift + O | 插入有序列表 | Insert ordered list | -| Ctrl + Shift + P | 打开插入PRE对话框 | Open Preformatted text dialog | -| Ctrl + Shift + Q | 插入引用 | Insert blockquotes | -| Ctrl + Shift + R / Shift + Command + Option + F | 全部替换 | Replace all | -| Ctrl + Shift + S | 插入删除线 | Insert strikethrough | -| Ctrl + Shift + T | 打开插入表格对话框 | Open table dialog | -| Ctrl + Shift + U | 将所选文字转成大写 | Selection text convert to uppercase | -| Shift + Alt + C | 插入```代码 | Insert code blocks (```) | -| Shift + Alt + H | 打开使用帮助对话框 | Open help dialog | -| Shift + Alt + L | 将所选文本转成小写 | Selection text convert to lowercase | -| Shift + Alt + P | 插入分页符 | Insert page break | -| Alt + L | 将所选文本转成小写 | Selection text convert to lowercase | -| Shift + Alt + U | 将所选的每个单词的首字母转成大写 | Selection words first letter convert to Uppercase | -| Ctrl + Shift + Alt + C | 打开插入代码块对话框层 | Open code blocks dialog | -| Ctrl + Shift + Alt + I | 打开插入图片对话框层 | Open image dialog | -| Ctrl + Shift + Alt + U | 将所选文本的第一个首字母转成大写 | Selection text first letter convert to uppercase | -| Ctrl + Alt + G | 跳转到指定的行 | Goto line | + +| Keyboard shortcuts (键盘快捷键) | 说明 | Description | +|:------------------------------------------------|:---------------------------|:--------------------------------------------------| +| F9 | 切换实时预览 | Switch watch/unwatch | +| F10 | 全屏HTML预览(按 Shift + ESC 退出) | Full preview HTML (Press Shift + ESC exit) | +| F11 | 切换全屏状态 | Switch fullscreen (Press ESC exit) | +| Ctrl + 1~6 / Command + 1~6 | 插入标题1~6 | Insert heading 1~6 | +| Ctrl + A / Command + A | 全选 | Select all | +| Ctrl + B / Command + B | 插入粗体 | Insert bold | +| Ctrl + D / Command + D | 插入日期时间 | Insert datetime | +| Ctrl + E / Command + E | 插入Emoji符号 | Insert :emoji: | +| Ctrl + F / Command + F | 查找/搜索 | Start searching | +| Ctrl + G / Command + G | 切换到下一个搜索结果项 | Find next search results | +| Ctrl + H / Command + H | 插入水平线 | Insert horizontal rule | +| Ctrl + I / Command + I | 插入斜体 | Insert italic | +| Ctrl + K / Command + K | 插入行内代码 | Insert inline code | +| Ctrl + L / Command + L | 插入链接 | Insert link | +| Ctrl + U / Command + U | 插入无序列表 | Insert unordered list | +| Ctrl + Q | 代码折叠切换 | Switch code fold | +| Ctrl + Z / Command + Z | 撤销 | Undo | +| Ctrl + Y / Command + Y | 重做 | Redo | +| Ctrl + Shift + A | 插入@链接 | Insert @link | +| Ctrl + Shift + C | 插入行内代码 | Insert inline code | +| Ctrl + Shift + E | 打开插入Emoji表情对话框 | Open emoji dialog | +| Ctrl + Shift + F / Command + Option + F | 替换 | Replace | +| Ctrl + Shift + G / Shift + Command + G | 切换到上一个搜索结果项 | Find previous search results | +| Ctrl + Shift + H | 打开HTML实体字符对话框 | Open HTML Entities dialog | +| Ctrl + Shift + I | 插入图片 | Insert image ![]() | +| Ctrl + Shift + K | 插入TeX(KaTeX)公式符号 | Insert TeX(KaTeX) symbol $$TeX$$ | +| Ctrl + Shift + L | 打开插入链接对话框 | Open link dialog | +| Ctrl + Shift + O | 插入有序列表 | Insert ordered list | +| Ctrl + Shift + P | 打开插入PRE对话框 | Open Preformatted text dialog | +| Ctrl + Shift + Q | 插入引用 | Insert blockquotes | +| Ctrl + Shift + R / Shift + Command + Option + F | 全部替换 | Replace all | +| Ctrl + Shift + S | 插入删除线 | Insert strikethrough | +| Ctrl + Shift + T | 打开插入表格对话框 | Open table dialog | +| Ctrl + Shift + U | 将所选文字转成大写 | Selection text convert to uppercase | +| Shift + Alt + C | 插入```代码 | Insert code blocks (```) | +| Shift + Alt + H | 打开使用帮助对话框 | Open help dialog | +| Shift + Alt + L | 将所选文本转成小写 | Selection text convert to lowercase | +| Shift + Alt + P | 插入分页符 | Insert page break | +| Alt + L | 将所选文本转成小写 | Selection text convert to lowercase | +| Shift + Alt + U | 将所选的每个单词的首字母转成大写 | Selection words first letter convert to Uppercase | +| Ctrl + Shift + Alt + C | 打开插入代码块对话框层 | Open code blocks dialog | +| Ctrl + Shift + Alt + I | 打开插入图片对话框层 | Open image dialog | +| Ctrl + Shift + Alt + U | 将所选文本的第一个首字母转成大写 | Selection text first letter convert to uppercase | +| Ctrl + Alt + G | 跳转到指定的行 | Goto line | ##### Emoji表情参考 (Emoji reference) diff --git a/web/editor.md/plugins/html-entities-dialog/html-entities-dialog.js b/web/editor.md/plugins/html-entities-dialog/html-entities-dialog.js index 6c77053..29697a4 100644 --- a/web/editor.md/plugins/html-entities-dialog/html-entities-dialog.js +++ b/web/editor.md/plugins/html-entities-dialog/html-entities-dialog.js @@ -9,165 +9,151 @@ * @license MIT */ -(function() { - - var factory = function (exports) { - - var $ = jQuery; - var pluginName = "html-entities-dialog"; - var selecteds = []; - var entitiesData = []; - - exports.fn.htmlEntitiesDialog = function() { - var _this = this; - var cm = this.cm; - var lang = _this.lang; - var settings = _this.settings; - var path = settings.pluginPath + pluginName + "/"; - var editor = this.editor; - var cursor = cm.getCursor(); - var selection = cm.getSelection(); - var classPrefix = _this.classPrefix; - - var dialogName = classPrefix + "dialog-" + pluginName, dialog; - var dialogLang = lang.dialog.htmlEntities; - - var dialogContent = [ - '
    ', - '
    ', - '
    ', - '
    ', - ].join("\r\n"); - - cm.focus(); - - if (editor.find("." + dialogName).length > 0) - { +(function () { + + var factory = function (exports) { + + var $ = jQuery; + var pluginName = "html-entities-dialog"; + var selecteds = []; + var entitiesData = []; + + exports.fn.htmlEntitiesDialog = function () { + var _this = this; + var cm = this.cm; + var lang = _this.lang; + var settings = _this.settings; + var path = settings.pluginPath + pluginName + "/"; + var editor = this.editor; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + var classPrefix = _this.classPrefix; + + var dialogName = classPrefix + "dialog-" + pluginName, dialog; + var dialogLang = lang.dialog.htmlEntities; + + var dialogContent = [ + '
    ', + '
    ', + '
    ', + '
    ', + ].join("\r\n"); + + cm.focus(); + + if (editor.find("." + dialogName).length > 0) { dialog = editor.find("." + dialogName); - selecteds = []; - dialog.find("a").removeClass("selected"); - - this.dialogShowMask(dialog); - this.dialogLockScreen(); - dialog.show(); - } - else - { - dialog = this.createDialog({ - name : dialogName, - title : dialogLang.title, - width : 800, - height : 475, - mask : settings.dialogShowMask, - drag : settings.dialogDraggable, - content : dialogContent, - lockScreen : settings.dialogLockScreen, - maskStyle : { - opacity : settings.dialogMaskOpacity, - backgroundColor : settings.dialogMaskBgColor - }, - buttons : { - enter : [lang.buttons.enter, function() { - cm.replaceSelection(selecteds.join(" ")); - this.hide().lockScreen(false).hideMask(); - - return false; - }], - cancel : [lang.buttons.cancel, function() { - this.hide().lockScreen(false).hideMask(); - - return false; - }] - } - }); - } - - var table = dialog.find("." + classPrefix + "grid-table"); - - var drawTable = function() { - - if (entitiesData.length < 1) return ; - - var rowNumber = 20; - var pageTotal = Math.ceil(entitiesData.length / rowNumber); - - table.html(""); - - for (var i = 0; i < pageTotal; i++) - { - var row = "
    "; - - for (var x = 0; x < rowNumber; x++) - { - var entity = entitiesData[(i * rowNumber) + x]; - - if (typeof entity !== "undefined") - { - var name = entity.name.replace("&", "&"); - - row += "" + name + ""; - } - } - - row += "
    "; - - table.append(row); - } - - dialog.find("." + classPrefix + "html-entity-btn").bind(exports.mouseOrTouch("click", "touchend"), function() { - $(this).toggleClass("selected"); - - if ($(this).hasClass("selected")) - { - selecteds.push($(this).attr("value")); - } - }); - }; - - if (entitiesData.length < 1) - { - if (typeof (dialog.loading) == "function") dialog.loading(true); - - $.getJSON(path + pluginName.replace("-dialog", "") + ".json", function(json) { - - if (typeof (dialog.loading) == "function") dialog.loading(false); - - entitiesData = json; - drawTable(); - }); - } - else - { - drawTable(); - } - }; - - }; - - // CommonJS/Node.js - if (typeof require === "function" && typeof exports === "object" && typeof module === "object") - { + selecteds = []; + dialog.find("a").removeClass("selected"); + + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + } else { + dialog = this.createDialog({ + name: dialogName, + title: dialogLang.title, + width: 800, + height: 475, + mask: settings.dialogShowMask, + drag: settings.dialogDraggable, + content: dialogContent, + lockScreen: settings.dialogLockScreen, + maskStyle: { + opacity: settings.dialogMaskOpacity, + backgroundColor: settings.dialogMaskBgColor + }, + buttons: { + enter: [lang.buttons.enter, function () { + cm.replaceSelection(selecteds.join(" ")); + this.hide().lockScreen(false).hideMask(); + + return false; + }], + cancel: [lang.buttons.cancel, function () { + this.hide().lockScreen(false).hideMask(); + + return false; + }] + } + }); + } + + var table = dialog.find("." + classPrefix + "grid-table"); + + var drawTable = function () { + + if (entitiesData.length < 1) return; + + var rowNumber = 20; + var pageTotal = Math.ceil(entitiesData.length / rowNumber); + + table.html(""); + + for (var i = 0; i < pageTotal; i++) { + var row = "
    "; + + for (var x = 0; x < rowNumber; x++) { + var entity = entitiesData[(i * rowNumber) + x]; + + if (typeof entity !== "undefined") { + var name = entity.name.replace("&", "&"); + + row += "" + name + ""; + } + } + + row += "
    "; + + table.append(row); + } + + dialog.find("." + classPrefix + "html-entity-btn").bind(exports.mouseOrTouch("click", "touchend"), function () { + $(this).toggleClass("selected"); + + if ($(this).hasClass("selected")) { + selecteds.push($(this).attr("value")); + } + }); + }; + + if (entitiesData.length < 1) { + if (typeof (dialog.loading) == "function") dialog.loading(true); + + $.getJSON(path + pluginName.replace("-dialog", "") + ".json", function (json) { + + if (typeof (dialog.loading) == "function") dialog.loading(false); + + entitiesData = json; + drawTable(); + }); + } else { + drawTable(); + } + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { module.exports = factory; - } - else if (typeof define === "function") // AMD/CMD/Sea.js + } else if (typeof define === "function") // AMD/CMD/Sea.js { - if (define.amd) { // for Require.js + if (define.amd) { // for Require.js - define(["editormd"], function(editormd) { + define(["editormd"], function (editormd) { factory(editormd); }); - } else { // for Sea.js - define(function(require) { + } else { // for Sea.js + define(function (require) { var editormd = require("./../../editormd"); factory(editormd); }); - } - } - else - { + } + } else { factory(window.editormd); - } + } })(); diff --git a/web/editor.md/plugins/html-entities-dialog/html-entities.json b/web/editor.md/plugins/html-entities-dialog/html-entities.json index e9e8229..644cfe6 100644 --- a/web/editor.md/plugins/html-entities-dialog/html-entities.json +++ b/web/editor.md/plugins/html-entities-dialog/html-entities.json @@ -1,936 +1,930 @@ [ - { - "name" : "&#64;", - "description":"at symbol" - }, - { - "name":"&copy;", - "description":"copyright symbol" - }, - { - "name":"&reg;", - "description":"registered symbol" - }, - { - "name":"&trade;", - "description":"trademark symbol" - }, - { - "name":"&hearts;", - "description":"heart" - }, - { - "name":"&nbsp;", - "description":"Inserts a non-breaking blank space" - }, - { - "name":"&amp;", - "description":"Ampersand" - }, - { - "name":"&#36;", - "description":"dollar symbol" - }, - { - "name":"&cent;", - "description":"Cent symbol" - }, - { - "name":"&pound;", - "description":"Pound" - }, - { - "name":"&yen;", - "description":"Yen" - }, - { - "name":"&euro;", - "description":"Euro symbol" - }, - { - "name":"&quot;", - "description":"quotation mark" - }, - { - "name":"&ldquo;", - "description":"Opening Double Quotes " - }, - { - "name":"&rdquo;", - "description":"Closing Double Quotes " - }, - { - "name":"&lsquo;", - "description":"Opening Single Quote Mark " - }, - { - "name":"&rsquo;", - "description":"Closing Single Quote Mark " - }, - { - "name":"&laquo;", - "description":"angle quotation mark (left)" - }, - { - "name":"&raquo;", - "description":"angle quotation mark (right)" - }, - { - "name":"&lsaquo;", - "description":"single left angle quotation" - }, - { - "name":"&rsaquo;", - "description":"single right angle quotation" - }, - { - "name":"&sect;", - "description":"Section Symbol" - }, - { - "name":"&micro;", - "description":"micro sign" - }, - { - "name":"&para;", - "description":"Paragraph symbol" - }, - { - "name":"&bull;", - "description":"Big List Dot" - }, - { - "name":"&middot;", - "description":"Medium List Dot" - }, - { - "name":"&hellip;", - "description":"horizontal ellipsis" - }, - { - "name":"&#124;", - "description":"vertical bar" - }, - { - "name":"&brvbar;", - "description":"broken vertical bar" - }, - { - "name":"&ndash;", - "description":"en-dash" - }, - { - "name":"&mdash;", - "description":"em-dash" - }, - { - "name":"&curren;", - "description":"Generic currency symbol" - }, - { - "name":"&#33;", - "description":"exclamation point" - }, - { - "name":"&#35;", - "description":"number sign" - }, - { - "name":"&#39;", - "description":"single quote" - }, - { - "name":"&#40;", - "description":"" - }, - { - "name":"&#41;", - "description":"" - }, - { - "name":"&#42;", - "description":"asterisk" - }, - { - "name":"&#43;", - "description":"plus sign" - }, - { - "name":"&#44;", - "description":"comma" - }, - { - "name":"&#45;", - "description":"minus sign - hyphen" - }, - { - "name":"&#46;", - "description":"period" - }, - { - "name":"&#47;", - "description":"slash" - }, - { - "name":"&#48;", - "description":"0" - }, - { - "name":"&#49;", - "description":"1" - }, - { - "name":"&#50;", - "description":"2" - }, - { - "name":"&#51;", - "description":"3" - }, - { - "name":"&#52;", - "description":"4" - }, - { - "name":"&#53;", - "description":"5" - }, - { - "name":"&#54;", - "description":"6" - }, - { - "name":"&#55;", - "description":"7" - }, - { - "name":"&#56;", - "description":"8" - }, - { - "name":"&#57;", - "description":"9" - }, - { - "name":"&#58;", - "description":"colon" - }, - { - "name":"&#59;", - "description":"semicolon" - }, - { - "name":"&#61;", - "description":"equal sign" - }, - { - "name":"&#63;", - "description":"question mark" - }, - { - "name":"&lt;", - "description":"Less than" - }, - { - "name":"&gt;", - "description":"Greater than" - }, - { - "name":"&le;", - "description":"Less than or Equal to" - }, - { - "name":"&ge;", - "description":"Greater than or Equal to" - }, - { - "name":"&times;", - "description":"Multiplication symbol" - }, - { - "name":"&divide;", - "description":"Division symbol" - }, - { - "name":"&minus;", - "description":"Minus symbol" - }, - { - "name":"&plusmn;", - "description":"Plus/minus symbol" - }, - { - "name":"&ne;", - "description":"Not Equal" - }, - { - "name":"&sup1;", - "description":"Superscript 1" - }, - { - "name":"&sup2;", - "description":"Superscript 2" - }, - { - "name":"&sup3;", - "description":"Superscript 3" - }, - { - "name":"&frac12;", - "description":"Fraction ½" - }, - { - "name":"&frac14;", - "description":"Fraction ¼" - }, - { - "name":"&frac34;", - "description":"Fraction ¾" - }, - { - "name":"&permil;", - "description":"per mille" - }, - { - "name":"&deg;", - "description":"Degree symbol" - }, - { - "name":"&radic;", - "description":"square root" - }, - { - "name":"&infin;", - "description":"Infinity" - }, - { - "name":"&larr;", - "description":"left arrow" - }, - { - "name":"&uarr;", - "description":"up arrow" - }, - { - "name":"&rarr;", - "description":"right arrow" - }, - { - "name":"&darr;", - "description":"down arrow" - }, - { - "name":"&harr;", - "description":"left right arrow" - }, - { - "name":"&crarr;", - "description":"carriage return arrow" - }, - { - "name":"&lceil;", - "description":"left ceiling" - }, - { - "name":"&rceil;", - "description":"right ceiling" - }, - { - "name":"&lfloor;", - "description":"left floor" - }, - { - "name":"&rfloor;", - "description":"right floor" - }, - { - "name":"&spades;", - "description":"spade" - }, - { - "name":"&clubs;", - "description":"club" - }, - { - "name":"&hearts;", - "description":"heart" - }, - { - "name":"&diams;", - "description":"diamond" - }, - { - "name":"&loz;", - "description":"lozenge" - }, - { - "name":"&dagger;", - "description":"dagger" - }, - { - "name":"&Dagger;", - "description":"double dagger" - }, - { - "name":"&iexcl;", - "description":"inverted exclamation mark" - }, - { - "name":"&iquest;", - "description":"inverted question mark" - }, - { - "name":"&#338;", - "description":"latin capital letter OE" - }, - { - "name":"&#339;", - "description":"latin small letter oe" - }, - { - "name":"&#352;", - "description":"latin capital letter S with caron" - }, - { - "name":"&#353;", - "description":"latin small letter s with caron" - }, - { - "name":"&#376;", - "description":"latin capital letter Y with diaeresis" - }, - { - "name":"&#402;", - "description":"latin small f with hook - function" - }, - { - "name":"&not;", - "description":"not sign" - }, - { - "name":"&ordf;", - "description":"feminine ordinal indicator" - }, - { - "name":"&uml;", - "description":"spacing diaeresis - umlaut" - }, - { - "name":"&macr;", - "description":"spacing macron - overline" - }, - { - "name":"&acute;", - "description":"acute accent - spacing acute" - }, - { - "name":"&Agrave;", - "description":"latin capital letter A with grave" - }, - { - "name":"&Aacute;", - "description":"latin capital letter A with acute" - }, - { - "name":"&Acirc;", - "description":"latin capital letter A with circumflex" - }, - { - "name":"&Atilde;", - "description":"latin capital letter A with tilde" - }, - { - "name":"&Auml;", - "description":"latin capital letter A with diaeresis" - }, - { - "name":"&Aring;", - "description":"latin capital letter A with ring above" - }, - { - "name":"&AElig;", - "description":"latin capital letter AE" - }, - { - "name":"&Ccedil;", - "description":"latin capital letter C with cedilla" - }, - { - "name":"&Egrave;", - "description":"latin capital letter E with grave" - }, - { - "name":"&Eacute;", - "description":"latin capital letter E with acute" - }, - { - "name":"&Ecirc;", - "description":"latin capital letter E with circumflex" - }, - { - "name":"&Euml;", - "description":"latin capital letter E with diaeresis" - }, - { - "name":"&Igrave;", - "description":"latin capital letter I with grave" - }, - { - "name":"&Iacute;", - "description":"latin capital letter I with acute" - }, - { - "name":"&Icirc;", - "description":"latin capital letter I with circumflex" - }, - { - "name":"&Iuml;", - "description":"latin capital letter I with diaeresis" - }, - - { - "name":"&ETH;", - "description":"latin capital letter ETH" - }, - { - "name":"&Ntilde;", - "description":"latin capital letter N with tilde" - }, - { - "name":"&Ograve;", - "description":"latin capital letter O with grave" - }, - { - "name":"&Oacute;", - "description":"latin capital letter O with acute" - }, - { - "name":"&Ocirc;", - "description":"latin capital letter O with circumflex" - }, - { - "name":"&Otilde;", - "description":"latin capital letter O with tilde" - }, - { - "name":"&Ouml;", - "description":"latin capital letter O with diaeresis" - }, - { - "name":"&times;", - "description":"multiplication sign" - }, - { - "name":"&Oslash;", - "description":"latin capital letter O with slash" - }, - { - "name":"&Ugrave;", - "description":"latin capital letter U with grave" - }, - { - "name":"&Uacute;", - "description":"latin capital letter U with acute" - }, - { - "name":"&Ucirc;", - "description":"latin capital letter U with circumflex" - }, - { - "name":"&Uuml;", - "description":"latin capital letter U with diaeresis" - }, - { - "name":"&Yacute;", - "description":"latin capital letter Y with acute" - }, - { - "name":"&THORN;", - "description":"latin capital letter THORN" - }, - { - "name":"&szlig;", - "description":"latin small letter sharp s - ess-zed" - }, - - - { - "name":"&eth;", - "description":"latin capital letter eth" - }, - { - "name":"&ntilde;", - "description":"latin capital letter n with tilde" - }, - { - "name":"&ograve;", - "description":"latin capital letter o with grave" - }, - { - "name":"&oacute;", - "description":"latin capital letter o with acute" - }, - { - "name":"&ocirc;", - "description":"latin capital letter o with circumflex" - }, - { - "name":"&otilde;", - "description":"latin capital letter o with tilde" - }, - { - "name":"&ouml;", - "description":"latin capital letter o with diaeresis" - }, - { - "name":"&times;", - "description":"multiplication sign" - }, - { - "name":"&oslash;", - "description":"latin capital letter o with slash" - }, - { - "name":"&ugrave;", - "description":"latin capital letter u with grave" - }, - { - "name":"&uacute;", - "description":"latin capital letter u with acute" - }, - { - "name":"&ucirc;", - "description":"latin capital letter u with circumflex" - }, - { - "name":"&uuml;", - "description":"latin capital letter u with diaeresis" - }, - { - "name":"&yacute;", - "description":"latin capital letter y with acute" - }, - { - "name":"&thorn;", - "description":"latin capital letter thorn" - }, - { - "name":"&yuml;", - "description":"latin small letter y with diaeresis" - }, - - { - "name":"&agrave;", - "description":"latin capital letter a with grave" - }, - { - "name":"&aacute;", - "description":"latin capital letter a with acute" - }, - { - "name":"&acirc;", - "description":"latin capital letter a with circumflex" - }, - { - "name":"&atilde;", - "description":"latin capital letter a with tilde" - }, - { - "name":"&auml;", - "description":"latin capital letter a with diaeresis" - }, - { - "name":"&aring;", - "description":"latin capital letter a with ring above" - }, - { - "name":"&aelig;", - "description":"latin capital letter ae" - }, - { - "name":"&ccedil;", - "description":"latin capital letter c with cedilla" - }, - { - "name":"&egrave;", - "description":"latin capital letter e with grave" - }, - { - "name":"&eacute;", - "description":"latin capital letter e with acute" - }, - { - "name":"&ecirc;", - "description":"latin capital letter e with circumflex" - }, - { - "name":"&euml;", - "description":"latin capital letter e with diaeresis" - }, - { - "name":"&igrave;", - "description":"latin capital letter i with grave" - }, - { - "name":"&Iacute;", - "description":"latin capital letter i with acute" - }, - { - "name":"&icirc;", - "description":"latin capital letter i with circumflex" - }, - { - "name":"&iuml;", - "description":"latin capital letter i with diaeresis" - }, - - { - "name":"&#65;", - "description":"A" - }, - { - "name":"&#66;", - "description":"B" - }, - { - "name":"&#67;", - "description":"C" - }, - { - "name":"&#68;", - "description":"D" - }, - { - "name":"&#69;", - "description":"E" - }, - { - "name":"&#70;", - "description":"F" - }, - { - "name":"&#71;", - "description":"G" - }, - { - "name":"&#72;", - "description":"H" - }, - { - "name":"&#73;", - "description":"I" - }, - { - "name":"&#74;", - "description":"J" - }, - { - "name":"&#75;", - "description":"K" - }, - { - "name":"&#76;", - "description":"L" - }, - { - "name":"&#77;", - "description":"M" - }, - { - "name":"&#78;", - "description":"N" - }, - { - "name":"&#79;", - "description":"O" - }, - { - "name":"&#80;", - "description":"P" - }, - { - "name":"&#81;", - "description":"Q" - }, - { - "name":"&#82;", - "description":"R" - }, - { - "name":"&#83;", - "description":"S" - }, - { - "name":"&#84;", - "description":"T" - }, - { - "name":"&#85;", - "description":"U" - }, - { - "name":"&#86;", - "description":"V" - }, - { - "name":"&#87;", - "description":"W" - }, - { - "name":"&#88;", - "description":"X" - }, - { - "name":"&#89;", - "description":"Y" - }, - { - "name":"&#90;", - "description":"Z" - }, - { - "name":"&#91;", - "description":"opening bracket" - }, - { - "name":"&#92;", - "description":"backslash" - }, - { - "name":"&#93;", - "description":"closing bracket" - }, - { - "name":"&#94;", - "description":"caret - circumflex" - }, - { - "name":"&#95;", - "description":"underscore" - }, - - { - "name":"&#96;", - "description":"grave accent" - }, - { - "name":"&#97;", - "description":"a" - }, - { - "name":"&#98;", - "description":"b" - }, - { - "name":"&#99;", - "description":"c" - }, - { - "name":"&#100;", - "description":"d" - }, - { - "name":"&#101;", - "description":"e" - }, - { - "name":"&#102;", - "description":"f" - }, - { - "name":"&#103;", - "description":"g" - }, - { - "name":"&#104;", - "description":"h" - }, - { - "name":"&#105;", - "description":"i" - }, - { - "name":"&#106;", - "description":"j" - }, - { - "name":"&#107;", - "description":"k" - }, - { - "name":"&#108;", - "description":"l" - }, - { - "name":"&#109;", - "description":"m" - }, - { - "name":"&#110;", - "description":"n" - }, - { - "name":"&#111;", - "description":"o" - }, - { - "name":"&#112;", - "description":"p" - }, - { - "name":"&#113;", - "description":"q" - }, - { - "name":"&#114;", - "description":"r" - }, - { - "name":"&#115;", - "description":"s" - }, - { - "name":"&#116;", - "description":"t" - }, - { - "name":"&#117;", - "description":"u" - }, - { - "name":"&#118;", - "description":"v" - }, - { - "name":"&#119;", - "description":"w" - }, - { - "name":"&#120;", - "description":"x" - }, - { - "name":"&#121;", - "description":"y" - }, - { - "name":"&#122;", - "description":"z" - }, - { - "name":"&#123;", - "description":"opening brace" - }, - { - "name":"&#124;", - "description":"vertical bar" - }, - { - "name":"&#125;", - "description":"closing brace" - }, - { - "name":"&#126;", - "description":"equivalency sign - tilde" - } + { + "name": "&#64;", + "description": "at symbol" + }, + { + "name": "&copy;", + "description": "copyright symbol" + }, + { + "name": "&reg;", + "description": "registered symbol" + }, + { + "name": "&trade;", + "description": "trademark symbol" + }, + { + "name": "&hearts;", + "description": "heart" + }, + { + "name": "&nbsp;", + "description": "Inserts a non-breaking blank space" + }, + { + "name": "&amp;", + "description": "Ampersand" + }, + { + "name": "&#36;", + "description": "dollar symbol" + }, + { + "name": "&cent;", + "description": "Cent symbol" + }, + { + "name": "&pound;", + "description": "Pound" + }, + { + "name": "&yen;", + "description": "Yen" + }, + { + "name": "&euro;", + "description": "Euro symbol" + }, + { + "name": "&quot;", + "description": "quotation mark" + }, + { + "name": "&ldquo;", + "description": "Opening Double Quotes " + }, + { + "name": "&rdquo;", + "description": "Closing Double Quotes " + }, + { + "name": "&lsquo;", + "description": "Opening Single Quote Mark " + }, + { + "name": "&rsquo;", + "description": "Closing Single Quote Mark " + }, + { + "name": "&laquo;", + "description": "angle quotation mark (left)" + }, + { + "name": "&raquo;", + "description": "angle quotation mark (right)" + }, + { + "name": "&lsaquo;", + "description": "single left angle quotation" + }, + { + "name": "&rsaquo;", + "description": "single right angle quotation" + }, + { + "name": "&sect;", + "description": "Section Symbol" + }, + { + "name": "&micro;", + "description": "micro sign" + }, + { + "name": "&para;", + "description": "Paragraph symbol" + }, + { + "name": "&bull;", + "description": "Big List Dot" + }, + { + "name": "&middot;", + "description": "Medium List Dot" + }, + { + "name": "&hellip;", + "description": "horizontal ellipsis" + }, + { + "name": "&#124;", + "description": "vertical bar" + }, + { + "name": "&brvbar;", + "description": "broken vertical bar" + }, + { + "name": "&ndash;", + "description": "en-dash" + }, + { + "name": "&mdash;", + "description": "em-dash" + }, + { + "name": "&curren;", + "description": "Generic currency symbol" + }, + { + "name": "&#33;", + "description": "exclamation point" + }, + { + "name": "&#35;", + "description": "number sign" + }, + { + "name": "&#39;", + "description": "single quote" + }, + { + "name": "&#40;", + "description": "" + }, + { + "name": "&#41;", + "description": "" + }, + { + "name": "&#42;", + "description": "asterisk" + }, + { + "name": "&#43;", + "description": "plus sign" + }, + { + "name": "&#44;", + "description": "comma" + }, + { + "name": "&#45;", + "description": "minus sign - hyphen" + }, + { + "name": "&#46;", + "description": "period" + }, + { + "name": "&#47;", + "description": "slash" + }, + { + "name": "&#48;", + "description": "0" + }, + { + "name": "&#49;", + "description": "1" + }, + { + "name": "&#50;", + "description": "2" + }, + { + "name": "&#51;", + "description": "3" + }, + { + "name": "&#52;", + "description": "4" + }, + { + "name": "&#53;", + "description": "5" + }, + { + "name": "&#54;", + "description": "6" + }, + { + "name": "&#55;", + "description": "7" + }, + { + "name": "&#56;", + "description": "8" + }, + { + "name": "&#57;", + "description": "9" + }, + { + "name": "&#58;", + "description": "colon" + }, + { + "name": "&#59;", + "description": "semicolon" + }, + { + "name": "&#61;", + "description": "equal sign" + }, + { + "name": "&#63;", + "description": "question mark" + }, + { + "name": "&lt;", + "description": "Less than" + }, + { + "name": "&gt;", + "description": "Greater than" + }, + { + "name": "&le;", + "description": "Less than or Equal to" + }, + { + "name": "&ge;", + "description": "Greater than or Equal to" + }, + { + "name": "&times;", + "description": "Multiplication symbol" + }, + { + "name": "&divide;", + "description": "Division symbol" + }, + { + "name": "&minus;", + "description": "Minus symbol" + }, + { + "name": "&plusmn;", + "description": "Plus/minus symbol" + }, + { + "name": "&ne;", + "description": "Not Equal" + }, + { + "name": "&sup1;", + "description": "Superscript 1" + }, + { + "name": "&sup2;", + "description": "Superscript 2" + }, + { + "name": "&sup3;", + "description": "Superscript 3" + }, + { + "name": "&frac12;", + "description": "Fraction ½" + }, + { + "name": "&frac14;", + "description": "Fraction ¼" + }, + { + "name": "&frac34;", + "description": "Fraction ¾" + }, + { + "name": "&permil;", + "description": "per mille" + }, + { + "name": "&deg;", + "description": "Degree symbol" + }, + { + "name": "&radic;", + "description": "square root" + }, + { + "name": "&infin;", + "description": "Infinity" + }, + { + "name": "&larr;", + "description": "left arrow" + }, + { + "name": "&uarr;", + "description": "up arrow" + }, + { + "name": "&rarr;", + "description": "right arrow" + }, + { + "name": "&darr;", + "description": "down arrow" + }, + { + "name": "&harr;", + "description": "left right arrow" + }, + { + "name": "&crarr;", + "description": "carriage return arrow" + }, + { + "name": "&lceil;", + "description": "left ceiling" + }, + { + "name": "&rceil;", + "description": "right ceiling" + }, + { + "name": "&lfloor;", + "description": "left floor" + }, + { + "name": "&rfloor;", + "description": "right floor" + }, + { + "name": "&spades;", + "description": "spade" + }, + { + "name": "&clubs;", + "description": "club" + }, + { + "name": "&hearts;", + "description": "heart" + }, + { + "name": "&diams;", + "description": "diamond" + }, + { + "name": "&loz;", + "description": "lozenge" + }, + { + "name": "&dagger;", + "description": "dagger" + }, + { + "name": "&Dagger;", + "description": "double dagger" + }, + { + "name": "&iexcl;", + "description": "inverted exclamation mark" + }, + { + "name": "&iquest;", + "description": "inverted question mark" + }, + { + "name": "&#338;", + "description": "latin capital letter OE" + }, + { + "name": "&#339;", + "description": "latin small letter oe" + }, + { + "name": "&#352;", + "description": "latin capital letter S with caron" + }, + { + "name": "&#353;", + "description": "latin small letter s with caron" + }, + { + "name": "&#376;", + "description": "latin capital letter Y with diaeresis" + }, + { + "name": "&#402;", + "description": "latin small f with hook - function" + }, + { + "name": "&not;", + "description": "not sign" + }, + { + "name": "&ordf;", + "description": "feminine ordinal indicator" + }, + { + "name": "&uml;", + "description": "spacing diaeresis - umlaut" + }, + { + "name": "&macr;", + "description": "spacing macron - overline" + }, + { + "name": "&acute;", + "description": "acute accent - spacing acute" + }, + { + "name": "&Agrave;", + "description": "latin capital letter A with grave" + }, + { + "name": "&Aacute;", + "description": "latin capital letter A with acute" + }, + { + "name": "&Acirc;", + "description": "latin capital letter A with circumflex" + }, + { + "name": "&Atilde;", + "description": "latin capital letter A with tilde" + }, + { + "name": "&Auml;", + "description": "latin capital letter A with diaeresis" + }, + { + "name": "&Aring;", + "description": "latin capital letter A with ring above" + }, + { + "name": "&AElig;", + "description": "latin capital letter AE" + }, + { + "name": "&Ccedil;", + "description": "latin capital letter C with cedilla" + }, + { + "name": "&Egrave;", + "description": "latin capital letter E with grave" + }, + { + "name": "&Eacute;", + "description": "latin capital letter E with acute" + }, + { + "name": "&Ecirc;", + "description": "latin capital letter E with circumflex" + }, + { + "name": "&Euml;", + "description": "latin capital letter E with diaeresis" + }, + { + "name": "&Igrave;", + "description": "latin capital letter I with grave" + }, + { + "name": "&Iacute;", + "description": "latin capital letter I with acute" + }, + { + "name": "&Icirc;", + "description": "latin capital letter I with circumflex" + }, + { + "name": "&Iuml;", + "description": "latin capital letter I with diaeresis" + }, + { + "name": "&ETH;", + "description": "latin capital letter ETH" + }, + { + "name": "&Ntilde;", + "description": "latin capital letter N with tilde" + }, + { + "name": "&Ograve;", + "description": "latin capital letter O with grave" + }, + { + "name": "&Oacute;", + "description": "latin capital letter O with acute" + }, + { + "name": "&Ocirc;", + "description": "latin capital letter O with circumflex" + }, + { + "name": "&Otilde;", + "description": "latin capital letter O with tilde" + }, + { + "name": "&Ouml;", + "description": "latin capital letter O with diaeresis" + }, + { + "name": "&times;", + "description": "multiplication sign" + }, + { + "name": "&Oslash;", + "description": "latin capital letter O with slash" + }, + { + "name": "&Ugrave;", + "description": "latin capital letter U with grave" + }, + { + "name": "&Uacute;", + "description": "latin capital letter U with acute" + }, + { + "name": "&Ucirc;", + "description": "latin capital letter U with circumflex" + }, + { + "name": "&Uuml;", + "description": "latin capital letter U with diaeresis" + }, + { + "name": "&Yacute;", + "description": "latin capital letter Y with acute" + }, + { + "name": "&THORN;", + "description": "latin capital letter THORN" + }, + { + "name": "&szlig;", + "description": "latin small letter sharp s - ess-zed" + }, + { + "name": "&eth;", + "description": "latin capital letter eth" + }, + { + "name": "&ntilde;", + "description": "latin capital letter n with tilde" + }, + { + "name": "&ograve;", + "description": "latin capital letter o with grave" + }, + { + "name": "&oacute;", + "description": "latin capital letter o with acute" + }, + { + "name": "&ocirc;", + "description": "latin capital letter o with circumflex" + }, + { + "name": "&otilde;", + "description": "latin capital letter o with tilde" + }, + { + "name": "&ouml;", + "description": "latin capital letter o with diaeresis" + }, + { + "name": "&times;", + "description": "multiplication sign" + }, + { + "name": "&oslash;", + "description": "latin capital letter o with slash" + }, + { + "name": "&ugrave;", + "description": "latin capital letter u with grave" + }, + { + "name": "&uacute;", + "description": "latin capital letter u with acute" + }, + { + "name": "&ucirc;", + "description": "latin capital letter u with circumflex" + }, + { + "name": "&uuml;", + "description": "latin capital letter u with diaeresis" + }, + { + "name": "&yacute;", + "description": "latin capital letter y with acute" + }, + { + "name": "&thorn;", + "description": "latin capital letter thorn" + }, + { + "name": "&yuml;", + "description": "latin small letter y with diaeresis" + }, + { + "name": "&agrave;", + "description": "latin capital letter a with grave" + }, + { + "name": "&aacute;", + "description": "latin capital letter a with acute" + }, + { + "name": "&acirc;", + "description": "latin capital letter a with circumflex" + }, + { + "name": "&atilde;", + "description": "latin capital letter a with tilde" + }, + { + "name": "&auml;", + "description": "latin capital letter a with diaeresis" + }, + { + "name": "&aring;", + "description": "latin capital letter a with ring above" + }, + { + "name": "&aelig;", + "description": "latin capital letter ae" + }, + { + "name": "&ccedil;", + "description": "latin capital letter c with cedilla" + }, + { + "name": "&egrave;", + "description": "latin capital letter e with grave" + }, + { + "name": "&eacute;", + "description": "latin capital letter e with acute" + }, + { + "name": "&ecirc;", + "description": "latin capital letter e with circumflex" + }, + { + "name": "&euml;", + "description": "latin capital letter e with diaeresis" + }, + { + "name": "&igrave;", + "description": "latin capital letter i with grave" + }, + { + "name": "&Iacute;", + "description": "latin capital letter i with acute" + }, + { + "name": "&icirc;", + "description": "latin capital letter i with circumflex" + }, + { + "name": "&iuml;", + "description": "latin capital letter i with diaeresis" + }, + { + "name": "&#65;", + "description": "A" + }, + { + "name": "&#66;", + "description": "B" + }, + { + "name": "&#67;", + "description": "C" + }, + { + "name": "&#68;", + "description": "D" + }, + { + "name": "&#69;", + "description": "E" + }, + { + "name": "&#70;", + "description": "F" + }, + { + "name": "&#71;", + "description": "G" + }, + { + "name": "&#72;", + "description": "H" + }, + { + "name": "&#73;", + "description": "I" + }, + { + "name": "&#74;", + "description": "J" + }, + { + "name": "&#75;", + "description": "K" + }, + { + "name": "&#76;", + "description": "L" + }, + { + "name": "&#77;", + "description": "M" + }, + { + "name": "&#78;", + "description": "N" + }, + { + "name": "&#79;", + "description": "O" + }, + { + "name": "&#80;", + "description": "P" + }, + { + "name": "&#81;", + "description": "Q" + }, + { + "name": "&#82;", + "description": "R" + }, + { + "name": "&#83;", + "description": "S" + }, + { + "name": "&#84;", + "description": "T" + }, + { + "name": "&#85;", + "description": "U" + }, + { + "name": "&#86;", + "description": "V" + }, + { + "name": "&#87;", + "description": "W" + }, + { + "name": "&#88;", + "description": "X" + }, + { + "name": "&#89;", + "description": "Y" + }, + { + "name": "&#90;", + "description": "Z" + }, + { + "name": "&#91;", + "description": "opening bracket" + }, + { + "name": "&#92;", + "description": "backslash" + }, + { + "name": "&#93;", + "description": "closing bracket" + }, + { + "name": "&#94;", + "description": "caret - circumflex" + }, + { + "name": "&#95;", + "description": "underscore" + }, + { + "name": "&#96;", + "description": "grave accent" + }, + { + "name": "&#97;", + "description": "a" + }, + { + "name": "&#98;", + "description": "b" + }, + { + "name": "&#99;", + "description": "c" + }, + { + "name": "&#100;", + "description": "d" + }, + { + "name": "&#101;", + "description": "e" + }, + { + "name": "&#102;", + "description": "f" + }, + { + "name": "&#103;", + "description": "g" + }, + { + "name": "&#104;", + "description": "h" + }, + { + "name": "&#105;", + "description": "i" + }, + { + "name": "&#106;", + "description": "j" + }, + { + "name": "&#107;", + "description": "k" + }, + { + "name": "&#108;", + "description": "l" + }, + { + "name": "&#109;", + "description": "m" + }, + { + "name": "&#110;", + "description": "n" + }, + { + "name": "&#111;", + "description": "o" + }, + { + "name": "&#112;", + "description": "p" + }, + { + "name": "&#113;", + "description": "q" + }, + { + "name": "&#114;", + "description": "r" + }, + { + "name": "&#115;", + "description": "s" + }, + { + "name": "&#116;", + "description": "t" + }, + { + "name": "&#117;", + "description": "u" + }, + { + "name": "&#118;", + "description": "v" + }, + { + "name": "&#119;", + "description": "w" + }, + { + "name": "&#120;", + "description": "x" + }, + { + "name": "&#121;", + "description": "y" + }, + { + "name": "&#122;", + "description": "z" + }, + { + "name": "&#123;", + "description": "opening brace" + }, + { + "name": "&#124;", + "description": "vertical bar" + }, + { + "name": "&#125;", + "description": "closing brace" + }, + { + "name": "&#126;", + "description": "equivalency sign - tilde" + } ] \ No newline at end of file diff --git a/web/editor.md/plugins/image-dialog/image-dialog.js b/web/editor.md/plugins/image-dialog/image-dialog.js index ebc8d74..d4131bc 100644 --- a/web/editor.md/plugins/image-dialog/image-dialog.js +++ b/web/editor.md/plugins/image-dialog/image-dialog.js @@ -9,96 +9,90 @@ * @license MIT */ -(function() { +(function () { var factory = function (exports) { - var pluginName = "image-dialog"; + var pluginName = "image-dialog"; - exports.fn.imageDialog = function() { + exports.fn.imageDialog = function () { - var _this = this; - var cm = this.cm; - var lang = this.lang; - var editor = this.editor; - var settings = this.settings; - var cursor = cm.getCursor(); - var selection = cm.getSelection(); - var imageLang = lang.dialog.image; + var _this = this; + var cm = this.cm; + var lang = this.lang; + var editor = this.editor; + var settings = this.settings; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + var imageLang = lang.dialog.image; var classPrefix = this.classPrefix; - var iframeName = classPrefix + "image-iframe"; - var dialogName = classPrefix + pluginName, dialog; + var iframeName = classPrefix + "image-iframe"; + var dialogName = classPrefix + pluginName, dialog; - cm.focus(); + cm.focus(); - var loading = function(show) { + var loading = function (show) { var _loading = dialog.find("." + classPrefix + "dialog-mask"); _loading[(show) ? "show" : "hide"](); }; - if (editor.find("." + dialogName).length < 1) - { - var guid = (new Date).getTime(); + if (editor.find("." + dialogName).length < 1) { + var guid = (new Date).getTime(); var action = settings.imageUploadURL + (settings.imageUploadURL.indexOf("?") >= 0 ? "&" : "?") + "guid=" + guid; - if (settings.crossDomainUpload) - { + if (settings.crossDomainUpload) { action += "&callback=" + settings.uploadCallbackURL + "&dialog_id=editormd-image-dialog-" + guid; } - var dialogContent = ( (settings.imageUpload) ? "
    " : "
    " ) + - ( (settings.imageUpload) ? "" : "" ) + - "" + - "" + (function(){ - return (settings.imageUpload) ? "
    " + - "" + - "" + - "
    " : ""; - })() + - "
    " + - "" + - "" + - "
    " + - "" + - "" + - "
    " + - ( (settings.imageUpload) ? "" : "
    "); + var dialogContent = ((settings.imageUpload) ? "
    " : "
    ") + + ((settings.imageUpload) ? "" : "") + + "" + + "" + (function () { + return (settings.imageUpload) ? "
    " + + "" + + "" + + "
    " : ""; + })() + + "
    " + + "" + + "" + + "
    " + + "" + + "" + + "
    " + + ((settings.imageUpload) ? "" : "
    "); //var imageFooterHTML = ""; dialog = this.createDialog({ - title : imageLang.title, - width : (settings.imageUpload) ? 465 : 380, - height : 254, - name : dialogName, - content : dialogContent, - mask : settings.dialogShowMask, - drag : settings.dialogDraggable, - lockScreen : settings.dialogLockScreen, - maskStyle : { - opacity : settings.dialogMaskOpacity, - backgroundColor : settings.dialogMaskBgColor + title: imageLang.title, + width: (settings.imageUpload) ? 465 : 380, + height: 254, + name: dialogName, + content: dialogContent, + mask: settings.dialogShowMask, + drag: settings.dialogDraggable, + lockScreen: settings.dialogLockScreen, + maskStyle: { + opacity: settings.dialogMaskOpacity, + backgroundColor: settings.dialogMaskBgColor }, - buttons : { - enter : [lang.buttons.enter, function() { - var url = this.find("[data-url]").val(); - var alt = this.find("[data-alt]").val(); + buttons: { + enter: [lang.buttons.enter, function () { + var url = this.find("[data-url]").val(); + var alt = this.find("[data-alt]").val(); var link = this.find("[data-link]").val(); - if (url === "") - { + if (url === "") { alert(imageLang.imageURLEmpty); return false; } - var altAttr = (alt !== "") ? " \"" + alt + "\"" : ""; + var altAttr = (alt !== "") ? " \"" + alt + "\"" : ""; - if (link === "" || link === "http://") - { + if (link === "" || link === "http://") { cm.replaceSelection("![" + alt + "](" + url + altAttr + ")"); - } - else - { + } else { cm.replaceSelection("[![" + alt + "](" + url + altAttr + ")](" + link + altAttr + ")"); } @@ -111,7 +105,7 @@ return false; }], - cancel : [lang.buttons.cancel, function() { + cancel: [lang.buttons.cancel, function () { this.hide().lockScreen(false).hideMask(); return false; @@ -121,51 +115,46 @@ dialog.attr("id", classPrefix + "image-dialog-" + guid); - if (!settings.imageUpload) { - return ; + if (!settings.imageUpload) { + return; } - var fileInput = dialog.find("[name=\"" + classPrefix + "image-file\"]"); + var fileInput = dialog.find("[name=\"" + classPrefix + "image-file\"]"); + + fileInput.bind("change", function () { + var fileName = fileInput.val(); + var isImage = new RegExp("(\\.(" + settings.imageFormats.join("|") + "))$"); // /(\.(webp|jpg|jpeg|gif|bmp|png))$/ - fileInput.bind("change", function() { - var fileName = fileInput.val(); - var isImage = new RegExp("(\\.(" + settings.imageFormats.join("|") + "))$"); // /(\.(webp|jpg|jpeg|gif|bmp|png))$/ + if (fileName === "") { + alert(imageLang.uploadFileEmpty); - if (fileName === "") - { - alert(imageLang.uploadFileEmpty); - return false; - } - - if (!isImage.test(fileName)) - { - alert(imageLang.formatNotAllowed + settings.imageFormats.join(", ")); - + } + + if (!isImage.test(fileName)) { + alert(imageLang.formatNotAllowed + settings.imageFormats.join(", ")); + return false; - } + } loading(true); - var submitHandler = function() { + var submitHandler = function () { var uploadIframe = document.getElementById(iframeName); - uploadIframe.onload = function() { - + uploadIframe.onload = function () { + loading(false); var body = (uploadIframe.contentWindow ? uploadIframe.contentWindow : uploadIframe.contentDocument).document.body; - var json = (body.innerText) ? body.innerText : ( (body.textContent) ? body.textContent : null); + var json = (body.innerText) ? body.innerText : ((body.textContent) ? body.textContent : null); json = (typeof JSON.parse !== "undefined") ? JSON.parse(json) : eval("(" + json + ")"); - if (json.success === 1) - { + if (json.success === 1) { dialog.find("[data-url]").val(json.url); - } - else - { + } else { alert(json.message); } @@ -174,45 +163,41 @@ }; dialog.find("[type=\"submit\"]").bind("click", submitHandler).trigger("click"); - }); + }); } - dialog = editor.find("." + dialogName); - dialog.find("[type=\"text\"]").val(""); - dialog.find("[type=\"file\"]").val(""); - dialog.find("[data-link]").val("http://"); + dialog = editor.find("." + dialogName); + dialog.find("[type=\"text\"]").val(""); + dialog.find("[type=\"file\"]").val(""); + dialog.find("[data-link]").val("http://"); - this.dialogShowMask(dialog); - this.dialogLockScreen(); - dialog.show(); + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); - }; + }; - }; + }; - // CommonJS/Node.js - if (typeof require === "function" && typeof exports === "object" && typeof module === "object") - { + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { module.exports = factory; - } - else if (typeof define === "function") // AMD/CMD/Sea.js + } else if (typeof define === "function") // AMD/CMD/Sea.js { - if (define.amd) { // for Require.js + if (define.amd) { // for Require.js - define(["editormd"], function(editormd) { + define(["editormd"], function (editormd) { factory(editormd); }); - } else { // for Sea.js - define(function(require) { + } else { // for Sea.js + define(function (require) { var editormd = require("./../../editormd"); factory(editormd); }); - } - } - else - { + } + } else { factory(window.editormd); - } + } })(); diff --git a/web/editor.md/plugins/link-dialog/link-dialog.js b/web/editor.md/plugins/link-dialog/link-dialog.js index 3e1d0bf..db2f028 100644 --- a/web/editor.md/plugins/link-dialog/link-dialog.js +++ b/web/editor.md/plugins/link-dialog/link-dialog.js @@ -9,28 +9,27 @@ * @license MIT */ -(function() { +(function () { var factory = function (exports) { - var pluginName = "link-dialog"; + var pluginName = "link-dialog"; - exports.fn.linkDialog = function() { + exports.fn.linkDialog = function () { - var _this = this; - var cm = this.cm; - var editor = this.editor; - var settings = this.settings; - var selection = cm.getSelection(); - var lang = this.lang; - var linkLang = lang.dialog.link; + var _this = this; + var cm = this.cm; + var editor = this.editor; + var settings = this.settings; + var selection = cm.getSelection(); + var lang = this.lang; + var linkLang = lang.dialog.link; var classPrefix = this.classPrefix; - var dialogName = classPrefix + pluginName, dialog; + var dialogName = classPrefix + pluginName, dialog; - cm.focus(); + cm.focus(); - if (editor.find("." + dialogName).length > 0) - { + if (editor.find("." + dialogName).length > 0) { dialog = editor.find("." + dialogName); dialog.find("[data-url]").val("http://"); dialog.find("[data-title]").val(selection); @@ -38,37 +37,34 @@ this.dialogShowMask(dialog); this.dialogLockScreen(); dialog.show(); - } - else - { - var dialogHTML = "
    " + - "" + - "" + - "
    " + - "" + - "" + - "
    " + - "
    "; + } else { + var dialogHTML = "
    " + + "" + + "" + + "
    " + + "" + + "" + + "
    " + + "
    "; dialog = this.createDialog({ - title : linkLang.title, - width : 380, - height : 211, - content : dialogHTML, - mask : settings.dialogShowMask, - drag : settings.dialogDraggable, - lockScreen : settings.dialogLockScreen, - maskStyle : { - opacity : settings.dialogMaskOpacity, - backgroundColor : settings.dialogMaskBgColor + title: linkLang.title, + width: 380, + height: 211, + content: dialogHTML, + mask: settings.dialogShowMask, + drag: settings.dialogDraggable, + lockScreen: settings.dialogLockScreen, + maskStyle: { + opacity: settings.dialogMaskOpacity, + backgroundColor: settings.dialogMaskBgColor }, - buttons : { - enter : [lang.buttons.enter, function() { - var url = this.find("[data-url]").val(); + buttons: { + enter: [lang.buttons.enter, function () { + var url = this.find("[data-url]").val(); var title = this.find("[data-title]").val(); - if (url === "http://" || url === "") - { + if (url === "http://" || url === "") { alert(linkLang.urlEmpty); return false; } @@ -78,13 +74,12 @@ alert(linkLang.titleEmpty); return false; }*/ - + var str = "[" + title + "](" + url + " \"" + title + "\")"; - - if (title == "") - { + + if (title == "") { str = "[" + url + "](" + url + ")"; - } + } cm.replaceSelection(str); @@ -93,41 +88,37 @@ return false; }], - cancel : [lang.buttons.cancel, function() { + cancel: [lang.buttons.cancel, function () { this.hide().lockScreen(false).hideMask(); return false; }] } }); - } - }; - - }; - - // CommonJS/Node.js - if (typeof require === "function" && typeof exports === "object" && typeof module === "object") - { + } + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { module.exports = factory; - } - else if (typeof define === "function") // AMD/CMD/Sea.js + } else if (typeof define === "function") // AMD/CMD/Sea.js { - if (define.amd) { // for Require.js + if (define.amd) { // for Require.js - define(["editormd"], function(editormd) { + define(["editormd"], function (editormd) { factory(editormd); }); - } else { // for Sea.js - define(function(require) { + } else { // for Sea.js + define(function (require) { var editormd = require("./../../editormd"); factory(editormd); }); - } - } - else - { + } + } else { factory(window.editormd); - } + } })(); diff --git a/web/editor.md/plugins/plugin-template.js b/web/editor.md/plugins/plugin-template.js index 8e30169..c9120fb 100644 --- a/web/editor.md/plugins/plugin-template.js +++ b/web/editor.md/plugins/plugin-template.js @@ -9,103 +9,99 @@ * @license MIT */ -(function() { +(function () { var factory = function (exports) { - var $ = jQuery; // if using module loader(Require.js/Sea.js). + var $ = jQuery; // if using module loader(Require.js/Sea.js). - var langs = { - "zh-cn" : { - toolbar : { - table : "表格" - }, - dialog : { - table : { - title : "添加表格", - cellsLabel : "单元格数", - alignLabel : "对齐方式", - rows : "行数", - cols : "列数", - aligns : ["默认", "左对齐", "居中对齐", "右对齐"] - } - } - }, - "zh-tw" : { - toolbar : { - table : "添加表格" - }, - dialog : { - table : { - title : "添加表格", - cellsLabel : "單元格數", - alignLabel : "對齊方式", - rows : "行數", - cols : "列數", - aligns : ["默認", "左對齊", "居中對齊", "右對齊"] - } - } - }, - "en" : { - toolbar : { - table : "Tables" - }, - dialog : { - table : { - title : "Tables", - cellsLabel : "Cells", - alignLabel : "Align", - rows : "Rows", - cols : "Cols", - aligns : ["Default", "Left align", "Center align", "Right align"] - } - } - } - }; + var langs = { + "zh-cn": { + toolbar: { + table: "表格" + }, + dialog: { + table: { + title: "添加表格", + cellsLabel: "单元格数", + alignLabel: "对齐方式", + rows: "行数", + cols: "列数", + aligns: ["默认", "左对齐", "居中对齐", "右对齐"] + } + } + }, + "zh-tw": { + toolbar: { + table: "添加表格" + }, + dialog: { + table: { + title: "添加表格", + cellsLabel: "單元格數", + alignLabel: "對齊方式", + rows: "行數", + cols: "列數", + aligns: ["默認", "左對齊", "居中對齊", "右對齊"] + } + } + }, + "en": { + toolbar: { + table: "Tables" + }, + dialog: { + table: { + title: "Tables", + cellsLabel: "Cells", + alignLabel: "Align", + rows: "Rows", + cols: "Cols", + aligns: ["Default", "Left align", "Center align", "Right align"] + } + } + } + }; - exports.fn.htmlEntities = function() { - /* - var _this = this; // this == the current instance object of Editor.md - var lang = _this.lang; - var settings = _this.settings; - var editor = this.editor; - var cursor = cm.getCursor(); - var selection = cm.getSelection(); - var classPrefix = this.classPrefix; + exports.fn.htmlEntities = function () { + /* + var _this = this; // this == the current instance object of Editor.md + var lang = _this.lang; + var settings = _this.settings; + var editor = this.editor; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + var classPrefix = this.classPrefix; - $.extend(true, this.lang, langs[this.lang.name]); // l18n - this.setToolbar(); + $.extend(true, this.lang, langs[this.lang.name]); // l18n + this.setToolbar(); - cm.focus(); - */ - //.... - }; + cm.focus(); + */ + //.... + }; - }; - - // CommonJS/Node.js - if (typeof require === "function" && typeof exports === "object" && typeof module === "object") - { + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { module.exports = factory; - } - else if (typeof define === "function") // AMD/CMD/Sea.js + } else if (typeof define === "function") // AMD/CMD/Sea.js { - if (define.amd) { // for Require.js + if (define.amd) { // for Require.js - define(["editormd"], function(editormd) { + define(["editormd"], function (editormd) { factory(editormd); }); - } else { // for Sea.js - define(function(require) { + } else { // for Sea.js + define(function (require) { var editormd = require("./../../editormd"); factory(editormd); }); - } - } - else - { + } + } else { factory(window.editormd); - } + } })(); diff --git a/web/editor.md/plugins/preformatted-text-dialog/preformatted-text-dialog.js b/web/editor.md/plugins/preformatted-text-dialog/preformatted-text-dialog.js index c890adc..0b7e4ad 100644 --- a/web/editor.md/plugins/preformatted-text-dialog/preformatted-text-dialog.js +++ b/web/editor.md/plugins/preformatted-text-dialog/preformatted-text-dialog.js @@ -9,72 +9,67 @@ * @license MIT */ -(function() { +(function () { var factory = function (exports) { - var cmEditor; - var pluginName = "preformatted-text-dialog"; - - exports.fn.preformattedTextDialog = function() { - - var _this = this; - var cm = this.cm; - var lang = this.lang; - var editor = this.editor; - var settings = this.settings; - var cursor = cm.getCursor(); - var selection = cm.getSelection(); + var cmEditor; + var pluginName = "preformatted-text-dialog"; + + exports.fn.preformattedTextDialog = function () { + + var _this = this; + var cm = this.cm; + var lang = this.lang; + var editor = this.editor; + var settings = this.settings; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); var classPrefix = this.classPrefix; - var dialogLang = lang.dialog.preformattedText; - var dialogName = classPrefix + pluginName, dialog; + var dialogLang = lang.dialog.preformattedText; + var dialogName = classPrefix + pluginName, dialog; - cm.focus(); + cm.focus(); - if (editor.find("." + dialogName).length > 0) - { + if (editor.find("." + dialogName).length > 0) { dialog = editor.find("." + dialogName); dialog.find("textarea").val(selection); this.dialogShowMask(dialog); this.dialogLockScreen(); dialog.show(); - } - else - { + } else { var dialogContent = ""; dialog = this.createDialog({ - name : dialogName, - title : dialogLang.title, - width : 780, - height : 540, - mask : settings.dialogShowMask, - drag : settings.dialogDraggable, - content : dialogContent, - lockScreen : settings.dialogLockScreen, - maskStyle : { - opacity : settings.dialogMaskOpacity, - backgroundColor : settings.dialogMaskBgColor + name: dialogName, + title: dialogLang.title, + width: 780, + height: 540, + mask: settings.dialogShowMask, + drag: settings.dialogDraggable, + content: dialogContent, + lockScreen: settings.dialogLockScreen, + maskStyle: { + opacity: settings.dialogMaskOpacity, + backgroundColor: settings.dialogMaskBgColor }, - buttons : { - enter : [lang.buttons.enter, function() { - var codeTexts = this.find("textarea").val(); + buttons: { + enter: [lang.buttons.enter, function () { + var codeTexts = this.find("textarea").val(); - if (codeTexts === "") - { + if (codeTexts === "") { alert(dialogLang.emptyAlert); return false; } codeTexts = codeTexts.split("\n"); - for (var i in codeTexts) - { + for (var i in codeTexts) { codeTexts[i] = " " + codeTexts[i]; } - + codeTexts = codeTexts.join("\n"); - + if (cursor.ch !== 0) { codeTexts = "\r\n\r\n" + codeTexts; } @@ -85,7 +80,7 @@ return false; }], - cancel : [lang.buttons.cancel, function() { + cancel: [lang.buttons.cancel, function () { this.hide().lockScreen(false).hideMask(); return false; @@ -93,80 +88,77 @@ } }); } - - var cmConfig = { - mode : "text/html", - theme : settings.theme, - tabSize : 4, - autofocus : true, - autoCloseTags : true, - indentUnit : 4, - lineNumbers : true, - lineWrapping : true, - extraKeys : {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }}, - foldGutter : true, - gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], - matchBrackets : true, - indentWithTabs : true, - styleActiveLine : true, - styleSelectedText : true, - autoCloseBrackets : true, - showTrailingSpace : true, - highlightSelectionMatches : true - }; - - var textarea = dialog.find("textarea"); - var cmObj = dialog.find(".CodeMirror"); - - if (dialog.find(".CodeMirror").length < 1) - { - cmEditor = exports.$CodeMirror.fromTextArea(textarea[0], cmConfig); - cmObj = dialog.find(".CodeMirror"); - - cmObj.css({ - "float" : "none", - margin : "0 0 5px", - border : "1px solid #ddd", - fontSize : settings.fontSize, - width : "100%", - height : "410px" - }); - - cmEditor.on("change", function(cm) { - textarea.val(cm.getValue()); - }); - } - else - { - cmEditor.setValue(cm.getSelection()); - } - }; - - }; - - // CommonJS/Node.js - if (typeof require === "function" && typeof exports === "object" && typeof module === "object") - { + + var cmConfig = { + mode: "text/html", + theme: settings.theme, + tabSize: 4, + autofocus: true, + autoCloseTags: true, + indentUnit: 4, + lineNumbers: true, + lineWrapping: true, + extraKeys: { + "Ctrl-Q": function (cm) { + cm.foldCode(cm.getCursor()); + } + }, + foldGutter: true, + gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], + matchBrackets: true, + indentWithTabs: true, + styleActiveLine: true, + styleSelectedText: true, + autoCloseBrackets: true, + showTrailingSpace: true, + highlightSelectionMatches: true + }; + + var textarea = dialog.find("textarea"); + var cmObj = dialog.find(".CodeMirror"); + + if (dialog.find(".CodeMirror").length < 1) { + cmEditor = exports.$CodeMirror.fromTextArea(textarea[0], cmConfig); + cmObj = dialog.find(".CodeMirror"); + + cmObj.css({ + "float": "none", + margin: "0 0 5px", + border: "1px solid #ddd", + fontSize: settings.fontSize, + width: "100%", + height: "410px" + }); + + cmEditor.on("change", function (cm) { + textarea.val(cm.getValue()); + }); + } else { + cmEditor.setValue(cm.getSelection()); + } + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { module.exports = factory; - } - else if (typeof define === "function") // AMD/CMD/Sea.js + } else if (typeof define === "function") // AMD/CMD/Sea.js { - if (define.amd) { // for Require.js + if (define.amd) { // for Require.js - define(["editormd"], function(editormd) { + define(["editormd"], function (editormd) { factory(editormd); }); - } else { // for Sea.js - define(function(require) { + } else { // for Sea.js + define(function (require) { var editormd = require("./../../editormd"); factory(editormd); }); - } - } - else - { + } + } else { factory(window.editormd); - } + } })(); diff --git a/web/editor.md/plugins/reference-link-dialog/reference-link-dialog.js b/web/editor.md/plugins/reference-link-dialog/reference-link-dialog.js index f1ad086..0256f4d 100644 --- a/web/editor.md/plugins/reference-link-dialog/reference-link-dialog.js +++ b/web/editor.md/plugins/reference-link-dialog/reference-link-dialog.js @@ -9,79 +9,75 @@ * @license MIT */ -(function() { +(function () { var factory = function (exports) { - var pluginName = "reference-link-dialog"; - var ReLinkId = 1; + var pluginName = "reference-link-dialog"; + var ReLinkId = 1; - exports.fn.referenceLinkDialog = function() { + exports.fn.referenceLinkDialog = function () { - var _this = this; - var cm = this.cm; - var lang = this.lang; - var editor = this.editor; - var settings = this.settings; - var cursor = cm.getCursor(); - var selection = cm.getSelection(); - var dialogLang = lang.dialog.referenceLink; + var _this = this; + var cm = this.cm; + var lang = this.lang; + var editor = this.editor; + var settings = this.settings; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + var dialogLang = lang.dialog.referenceLink; var classPrefix = this.classPrefix; - var dialogName = classPrefix + pluginName, dialog; + var dialogName = classPrefix + pluginName, dialog; - cm.focus(); + cm.focus(); - if (editor.find("." + dialogName).length < 1) - { + if (editor.find("." + dialogName).length < 1) { var dialogHTML = "
    " + - "" + - "" + - "
    " + - "" + - "" + - "
    " + - "" + - "" + - "
    " + - "" + - "" + - "
    " + - "
    "; - - dialog = this.createDialog({ - name : dialogName, - title : dialogLang.title, - width : 380, - height : 296, - content : dialogHTML, - mask : settings.dialogShowMask, - drag : settings.dialogDraggable, - lockScreen : settings.dialogLockScreen, - maskStyle : { - opacity : settings.dialogMaskOpacity, - backgroundColor : settings.dialogMaskBgColor + "" + + "" + + "
    " + + "" + + "" + + "
    " + + "" + + "" + + "
    " + + "" + + "" + + "
    " + + "
    "; + + dialog = this.createDialog({ + name: dialogName, + title: dialogLang.title, + width: 380, + height: 296, + content: dialogHTML, + mask: settings.dialogShowMask, + drag: settings.dialogDraggable, + lockScreen: settings.dialogLockScreen, + maskStyle: { + opacity: settings.dialogMaskOpacity, + backgroundColor: settings.dialogMaskBgColor }, - buttons : { - enter : [lang.buttons.enter, function() { - var name = this.find("[data-name]").val(); - var url = this.find("[data-url]").val(); - var rid = this.find("[data-url-id]").val(); + buttons: { + enter: [lang.buttons.enter, function () { + var name = this.find("[data-name]").val(); + var url = this.find("[data-url]").val(); + var rid = this.find("[data-url-id]").val(); var title = this.find("[data-title]").val(); - if (name === "") - { + if (name === "") { alert(dialogLang.nameEmpty); return false; } - if (rid === "") - { + if (rid === "") { alert(dialogLang.idEmpty); return false; } - if (url === "http://" || url === "") - { + if (url === "http://" || url === "") { alert(dialogLang.urlEmpty); return false; } @@ -93,15 +89,15 @@ cm.setCursor(cursor.line, cursor.ch + 1); } - title = (title === "") ? "" : " \"" + title + "\""; + title = (title === "") ? "" : " \"" + title + "\""; - cm.setValue(cm.getValue() + "\n[" + rid + "]: " + url + title + ""); + cm.setValue(cm.getValue() + "\n[" + rid + "]: " + url + title + ""); this.hide().lockScreen(false).hideMask(); return false; }], - cancel : [lang.buttons.cancel, function() { + cancel: [lang.buttons.cancel, function () { this.hide().lockScreen(false).hideMask(); return false; @@ -110,44 +106,40 @@ }); } - dialog = editor.find("." + dialogName); - dialog.find("[data-name]").val("[" + ReLinkId + "]"); - dialog.find("[data-url-id]").val(""); - dialog.find("[data-url]").val("http://"); - dialog.find("[data-title]").val(selection); + dialog = editor.find("." + dialogName); + dialog.find("[data-name]").val("[" + ReLinkId + "]"); + dialog.find("[data-url-id]").val(""); + dialog.find("[data-url]").val("http://"); + dialog.find("[data-title]").val(selection); - this.dialogShowMask(dialog); - this.dialogLockScreen(); - dialog.show(); + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); - ReLinkId++; - }; + ReLinkId++; + }; - }; - - // CommonJS/Node.js - if (typeof require === "function" && typeof exports === "object" && typeof module === "object") - { + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { module.exports = factory; - } - else if (typeof define === "function") // AMD/CMD/Sea.js + } else if (typeof define === "function") // AMD/CMD/Sea.js { - if (define.amd) { // for Require.js + if (define.amd) { // for Require.js - define(["editormd"], function(editormd) { + define(["editormd"], function (editormd) { factory(editormd); }); - } else { // for Sea.js - define(function(require) { + } else { // for Sea.js + define(function (require) { var editormd = require("./../../editormd"); factory(editormd); }); - } - } - else - { + } + } else { factory(window.editormd); - } + } })(); diff --git a/web/editor.md/plugins/table-dialog/table-dialog.js b/web/editor.md/plugins/table-dialog/table-dialog.js index 578adf2..3dd5e10 100644 --- a/web/editor.md/plugins/table-dialog/table-dialog.js +++ b/web/editor.md/plugins/table-dialog/table-dialog.js @@ -9,210 +9,198 @@ * @license MIT */ -(function() { - - var factory = function (exports) { - - var $ = jQuery; - var pluginName = "table-dialog"; - - var langs = { - "zh-cn" : { - toolbar : { - table : "表格" - }, - dialog : { - table : { - title : "添加表格", - cellsLabel : "单元格数", - alignLabel : "对齐方式", - rows : "行数", - cols : "列数", - aligns : ["默认", "左对齐", "居中对齐", "右对齐"] - } - } - }, - "zh-tw" : { - toolbar : { - table : "添加表格" - }, - dialog : { - table : { - title : "添加表格", - cellsLabel : "單元格數", - alignLabel : "對齊方式", - rows : "行數", - cols : "列數", - aligns : ["默認", "左對齊", "居中對齊", "右對齊"] - } - } - }, - "en" : { - toolbar : { - table : "Tables" - }, - dialog : { - table : { - title : "Tables", - cellsLabel : "Cells", - alignLabel : "Align", - rows : "Rows", - cols : "Cols", - aligns : ["Default", "Left align", "Center align", "Right align"] - } - } - } - }; - - exports.fn.tableDialog = function() { - var _this = this; - var cm = this.cm; - var editor = this.editor; - var settings = this.settings; - var path = settings.path + "../plugins/" + pluginName +"/"; - var classPrefix = this.classPrefix; - var dialogName = classPrefix + pluginName, dialog; - - $.extend(true, this.lang, langs[this.lang.name]); - this.setToolbar(); - - var lang = this.lang; - var dialogLang = lang.dialog.table; - - var dialogContent = [ - "
    ", - "", - dialogLang.rows + "   ", - dialogLang.cols + "
    ", - "", - "
    ", - "
    " - ].join("\n"); - - if (editor.find("." + dialogName).length > 0) - { +(function () { + + var factory = function (exports) { + + var $ = jQuery; + var pluginName = "table-dialog"; + + var langs = { + "zh-cn": { + toolbar: { + table: "表格" + }, + dialog: { + table: { + title: "添加表格", + cellsLabel: "单元格数", + alignLabel: "对齐方式", + rows: "行数", + cols: "列数", + aligns: ["默认", "左对齐", "居中对齐", "右对齐"] + } + } + }, + "zh-tw": { + toolbar: { + table: "添加表格" + }, + dialog: { + table: { + title: "添加表格", + cellsLabel: "單元格數", + alignLabel: "對齊方式", + rows: "行數", + cols: "列數", + aligns: ["默認", "左對齊", "居中對齊", "右對齊"] + } + } + }, + "en": { + toolbar: { + table: "Tables" + }, + dialog: { + table: { + title: "Tables", + cellsLabel: "Cells", + alignLabel: "Align", + rows: "Rows", + cols: "Cols", + aligns: ["Default", "Left align", "Center align", "Right align"] + } + } + } + }; + + exports.fn.tableDialog = function () { + var _this = this; + var cm = this.cm; + var editor = this.editor; + var settings = this.settings; + var path = settings.path + "../plugins/" + pluginName + "/"; + var classPrefix = this.classPrefix; + var dialogName = classPrefix + pluginName, dialog; + + $.extend(true, this.lang, langs[this.lang.name]); + this.setToolbar(); + + var lang = this.lang; + var dialogLang = lang.dialog.table; + + var dialogContent = [ + "
    ", + "", + dialogLang.rows + "   ", + dialogLang.cols + "
    ", + "", + "
    ", + "
    " + ].join("\n"); + + if (editor.find("." + dialogName).length > 0) { dialog = editor.find("." + dialogName); - this.dialogShowMask(dialog); - this.dialogLockScreen(); - dialog.show(); - } - else - { - dialog = this.createDialog({ - name : dialogName, - title : dialogLang.title, - width : 360, - height : 226, - mask : settings.dialogShowMask, - drag : settings.dialogDraggable, - content : dialogContent, - lockScreen : settings.dialogLockScreen, - maskStyle : { - opacity : settings.dialogMaskOpacity, - backgroundColor : settings.dialogMaskBgColor - }, - buttons : { - enter : [lang.buttons.enter, function() { - var rows = parseInt(this.find("[data-rows]").val()); - var cols = parseInt(this.find("[data-cols]").val()); - var align = this.find("[name=\"table-align\"]:checked").val(); - var table = ""; - var hrLine = "------------"; - - var alignSign = { - _default : hrLine, - left : ":" + hrLine, - center : ":" + hrLine + ":", - right : hrLine + ":" - }; - - if ( rows > 1 && cols > 0) - { - for (var r = 0, len = rows; r < len; r++) - { - var row = []; - var head = []; - - for (var c = 0, len2 = cols; c < len2; c++) - { - if (r === 1) { - head.push(alignSign[align]); - } - - row.push(" "); - } - - if (r === 1) { - table += "| " + head.join(" | ") + " |" + "\n"; - } - - table += "| " + row.join( (cols === 1) ? "" : " | " ) + " |" + "\n"; - } - } - - cm.replaceSelection(table); + this.dialogShowMask(dialog); + this.dialogLockScreen(); + dialog.show(); + } else { + dialog = this.createDialog({ + name: dialogName, + title: dialogLang.title, + width: 360, + height: 226, + mask: settings.dialogShowMask, + drag: settings.dialogDraggable, + content: dialogContent, + lockScreen: settings.dialogLockScreen, + maskStyle: { + opacity: settings.dialogMaskOpacity, + backgroundColor: settings.dialogMaskBgColor + }, + buttons: { + enter: [lang.buttons.enter, function () { + var rows = parseInt(this.find("[data-rows]").val()); + var cols = parseInt(this.find("[data-cols]").val()); + var align = this.find("[name=\"table-align\"]:checked").val(); + var table = ""; + var hrLine = "------------"; + + var alignSign = { + _default: hrLine, + left: ":" + hrLine, + center: ":" + hrLine + ":", + right: hrLine + ":" + }; + + if (rows > 1 && cols > 0) { + for (var r = 0, len = rows; r < len; r++) { + var row = []; + var head = []; + + for (var c = 0, len2 = cols; c < len2; c++) { + if (r === 1) { + head.push(alignSign[align]); + } + + row.push(" "); + } + + if (r === 1) { + table += "| " + head.join(" | ") + " |" + "\n"; + } + + table += "| " + row.join((cols === 1) ? "" : " | ") + " |" + "\n"; + } + } + + cm.replaceSelection(table); this.hide().lockScreen(false).hideMask(); return false; }], - cancel : [lang.buttons.cancel, function() { + cancel: [lang.buttons.cancel, function () { this.hide().lockScreen(false).hideMask(); return false; }] - } - }); - } - - var faBtns = dialog.find(".fa-btns"); - - if (faBtns.html() === "") - { - var icons = ["align-justify", "align-left", "align-center", "align-right"]; - var _lang = dialogLang.aligns; - var values = ["_default", "left", "center", "right"]; - - for (var i = 0, len = icons.length; i < len; i++) - { - var checked = (i === 0) ? " checked=\"checked\"" : ""; - var btn = ""; - - faBtns.append(btn); - } - } - }; - - }; - - // CommonJS/Node.js - if (typeof require === "function" && typeof exports === "object" && typeof module === "object") - { + } + }); + } + + var faBtns = dialog.find(".fa-btns"); + + if (faBtns.html() === "") { + var icons = ["align-justify", "align-left", "align-center", "align-right"]; + var _lang = dialogLang.aligns; + var values = ["_default", "left", "center", "right"]; + + for (var i = 0, len = icons.length; i < len; i++) { + var checked = (i === 0) ? " checked=\"checked\"" : ""; + var btn = ""; + + faBtns.append(btn); + } + } + }; + + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { module.exports = factory; - } - else if (typeof define === "function") // AMD/CMD/Sea.js + } else if (typeof define === "function") // AMD/CMD/Sea.js { - if (define.amd) { // for Require.js + if (define.amd) { // for Require.js - define(["editormd"], function(editormd) { + define(["editormd"], function (editormd) { factory(editormd); }); - } else { // for Sea.js - define(function(require) { + } else { // for Sea.js + define(function (require) { var editormd = require("./../../editormd"); factory(editormd); }); - } - } - else - { + } + } else { factory(window.editormd); - } + } })(); diff --git a/web/editor.md/plugins/test-plugin/test-plugin.js b/web/editor.md/plugins/test-plugin/test-plugin.js index bc4da31..b6b20e1 100644 --- a/web/editor.md/plugins/test-plugin/test-plugin.js +++ b/web/editor.md/plugins/test-plugin/test-plugin.js @@ -9,58 +9,54 @@ * @license MIT */ -(function() { +(function () { var factory = function (exports) { - var $ = jQuery; // if using module loader(Require.js/Sea.js). + var $ = jQuery; // if using module loader(Require.js/Sea.js). - exports.testPlugin = function(){ - alert("testPlugin"); - }; + exports.testPlugin = function () { + alert("testPlugin"); + }; - exports.fn.testPluginMethodA = function() { - /* - var _this = this; // this == the current instance object of Editor.md - var lang = _this.lang; - var settings = _this.settings; - var editor = this.editor; - var cursor = cm.getCursor(); - var selection = cm.getSelection(); - var classPrefix = this.classPrefix; + exports.fn.testPluginMethodA = function () { + /* + var _this = this; // this == the current instance object of Editor.md + var lang = _this.lang; + var settings = _this.settings; + var editor = this.editor; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); + var classPrefix = this.classPrefix; - cm.focus(); - */ - //.... + cm.focus(); + */ + //.... - alert("testPluginMethodA"); - }; + alert("testPluginMethodA"); + }; - }; - - // CommonJS/Node.js - if (typeof require === "function" && typeof exports === "object" && typeof module === "object") - { + }; + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { module.exports = factory; - } - else if (typeof define === "function") // AMD/CMD/Sea.js + } else if (typeof define === "function") // AMD/CMD/Sea.js { - if (define.amd) { // for Require.js + if (define.amd) { // for Require.js - define(["editormd"], function(editormd) { + define(["editormd"], function (editormd) { factory(editormd); }); - } else { // for Sea.js - define(function(require) { + } else { // for Sea.js + define(function (require) { var editormd = require("./../../editormd"); factory(editormd); }); - } - } - else - { + } + } else { factory(window.editormd); - } + } })(); diff --git a/web/editor.md/scss/editormd.codemirror.scss b/web/editor.md/scss/editormd.codemirror.scss index 2c487c6..bdc5d61 100644 --- a/web/editor.md/scss/editormd.codemirror.scss +++ b/web/editor.md/scss/editormd.codemirror.scss @@ -1,89 +1,90 @@ @charset "UTF-8"; .editormd .CodeMirror, #{$prefix}preview { - display: inline-block; - width: 50%; - height: 100%; - vertical-align: top; - @include box-sizing(border-box); - margin: 0; + display: inline-block; + width: 50%; + height: 100%; + vertical-align: top; + @include box-sizing(border-box); + margin: 0; } #{$prefix}preview { - position: absolute; - top: 35px; - right: 0; - right: -1px\0; - overflow: auto; - line-height: 1.6; - display: none; - background: #fff; + position: absolute; + top: 35px; + right: 0; + right: -1px \0 +; + overflow: auto; + line-height: 1.6; + display: none; + background: #fff; } .editormd { - - .CodeMirror { - z-index: 10; - float: left; - border-right: 1px solid $borderColor; - font-size: 14px; - font-family: "YaHei Consolas Hybrid", Consolas, "微软雅黑", "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, "Monaco", courier, monospace; - line-height: 1.6; - margin-top: 35px; - - pre { - font-size: 14px; - padding: 0 12px; - } - } - - .CodeMirror-linenumbers { - padding: 0 5px; - } - .CodeMirror-selected { - background: #70B7FF; - } + .CodeMirror { + z-index: 10; + float: left; + border-right: 1px solid $borderColor; + font-size: 14px; + font-family: "YaHei Consolas Hybrid", Consolas, "微软雅黑", "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, "Monaco", courier, monospace; + line-height: 1.6; + margin-top: 35px; - .CodeMirror-focused .CodeMirror-selected { - background: #70B7FF; + pre { + font-size: 14px; + padding: 0 12px; } + } - .CodeMirror, .CodeMirror-scroll, #{$prefix}preview { - -webkit-overflow-scrolling : touch; - } + .CodeMirror-linenumbers { + padding: 0 5px; + } - .styled-background { - background-color: #ff7; - } + .CodeMirror-selected { + background: #70B7FF; + } - .CodeMirror-focused .cm-matchhighlight { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==); - background-position: bottom; - background-repeat: repeat-x; - } - - .CodeMirror-empty { - //outline: 1px solid #c22; - - &.CodeMirror-focused { - outline: none; - } - } - - .CodeMirror pre.CodeMirror-placeholder { - color: #999; - } + .CodeMirror-focused .CodeMirror-selected { + background: #70B7FF; + } - .cm-trailingspace { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAAB/qH1jAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QUXCToH00Y1UgAAACFJREFUCNdjPMDBUc/AwNDAAAFMTAwMDA0OP34wQgX/AQBYgwYEx4f9lQAAAABJRU5ErkJggg==); - background-position: bottom left; - background-repeat: repeat-x; - } + .CodeMirror, .CodeMirror-scroll, #{$prefix}preview { + -webkit-overflow-scrolling: touch; + } + + .styled-background { + background-color: #ff7; + } + + .CodeMirror-focused .cm-matchhighlight { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==); + background-position: bottom; + background-repeat: repeat-x; + } - .cm-tab { - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAYAAAAkuj5RAAAAAXNSR0IArs4c6QAAAGFJREFUSMft1LsRQFAQheHPowAKoACx3IgEKtaEHujDjORSgWTH/ZOdnZOcM/sgk/kFFWY0qV8foQwS4MKBCS3qR6ixBJvElOobYAtivseIE120FaowJPN75GMu8j/LfMwNjh4HUpwg4LUAAAAASUVORK5CYII=); - background-position: right; - background-repeat: no-repeat; + .CodeMirror-empty { + //outline: 1px solid #c22; + + &.CodeMirror-focused { + outline: none; } + } + + .CodeMirror pre.CodeMirror-placeholder { + color: #999; + } + + .cm-trailingspace { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAAB/qH1jAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QUXCToH00Y1UgAAACFJREFUCNdjPMDBUc/AwNDAAAFMTAwMDA0OP34wQgX/AQBYgwYEx4f9lQAAAABJRU5ErkJggg==); + background-position: bottom left; + background-repeat: repeat-x; + } + + .cm-tab { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAYAAAAkuj5RAAAAAXNSR0IArs4c6QAAAGFJREFUSMft1LsRQFAQheHPowAKoACx3IgEKtaEHujDjORSgWTH/ZOdnZOcM/sgk/kFFWY0qV8foQwS4MKBCS3qR6ixBJvElOobYAtivseIE120FaowJPN75GMu8j/LfMwNjh4HUpwg4LUAAAAASUVORK5CYII=); + background-position: right; + background-repeat: no-repeat; + } } \ No newline at end of file diff --git a/web/editor.md/scss/editormd.dialog.scss b/web/editor.md/scss/editormd.dialog.scss index 609f6a9..2213d60 100644 --- a/web/editor.md/scss/editormd.dialog.scss +++ b/web/editor.md/scss/editormd.dialog.scss @@ -1,184 +1,184 @@ @charset "UTF-8"; #{$prefix}dialog { - color: $color; - position: fixed; - z-index: 99999; - display: none; - @include border-radius(3px); - @include box-shadow(0 0 10px rgba(0, 0, 0, 0.3)); - //@include user-select(none); - background: #fff; - font-size: 14px; + color: $color; + position: fixed; + z-index: 99999; + display: none; + @include border-radius(3px); + @include box-shadow(0 0 10px rgba(0, 0, 0, 0.3)); + //@include user-select(none); + background: #fff; + font-size: 14px; } #{$prefix}dialog-container { - position: relative; - padding: 20px; - line-height: 1.4; - - h1 { - font-size: 24px; - margin-bottom: 10px; - - .fa { - color: #2C7EEA; - padding-right: 5px; - } - - small { - padding-left: 5px; - font-weight: normal; - font-size: 12px; - color: #999; - } - } - - select { - color: #999; - padding: 3px 8px; - border: 1px solid $borderColor; + position: relative; + padding: 20px; + line-height: 1.4; + + h1 { + font-size: 24px; + margin-bottom: 10px; + + .fa { + color: #2C7EEA; + padding-right: 5px; + } + + small { + padding-left: 5px; + font-weight: normal; + font-size: 12px; + color: #999; } + } + + select { + color: #999; + padding: 3px 8px; + border: 1px solid $borderColor; + } } #{$prefix}dialog-close { - position: absolute; - top: 12px; - right: 15px; - font-size: 18px; - color: #ccc; - @include transition(color 300ms ease-out); + position: absolute; + top: 12px; + right: 15px; + font-size: 18px; + color: #ccc; + @include transition(color 300ms ease-out); + + &:hover { + color: #999; + } +} - &:hover { - color: #999; - } -} - #{$prefix}dialog-header { - padding: 11px 20px; - border-bottom: 1px solid #eee; - @include transition(background 300ms ease-out); + padding: 11px 20px; + border-bottom: 1px solid #eee; + @include transition(background 300ms ease-out); - &:hover { - background: #f6f6f6; - } + &:hover { + background: #f6f6f6; + } } #{$prefix}dialog-title { - font-size: 14px; + font-size: 14px; } - + #{$prefix}dialog-footer { - padding: 10px 0 0 0; - text-align: right; + padding: 10px 0 0 0; + text-align: right; } #{$prefix}dialog-info { - width: 420px; - - h1 { - font-weight: normal; - } + width: 420px; - #{$prefix}dialog-container { - padding: 20px 25px 25px; - } + h1 { + font-weight: normal; + } - #{$prefix}dialog-close { - top: 10px; - right: 10px; - } - - p > a, .hover-link:hover { - color: #2196F3; - } - - .hover-link { - color: #666; + #{$prefix}dialog-container { + padding: 20px 25px 25px; + } + + #{$prefix}dialog-close { + top: 10px; + right: 10px; + } + + p > a, .hover-link:hover { + color: #2196F3; + } + + .hover-link { + color: #666; + } + + a { + .fa-external-link { + display: none; } - - a { - .fa-external-link { - display: none; - } - - &:hover { - color: #2196F3; - - .fa-external-link { - display: inline-block; - } - } + + &:hover { + color: #2196F3; + + .fa-external-link { + display: inline-block; + } } + } } #{$prefix}mask, #{$prefix}container-mask, #{$prefix}dialog-mask { - display: none; - width: 100%; - height: 100%; - position: absolute; - top: 0; - left: 0; + display: none; + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; } #{$prefix}mask, #{$prefix}dialog-mask-bg { - background: #fff; - opacity: 0.5; - filter: alpha(opacity=50); + background: #fff; + opacity: 0.5; + filter: alpha(opacity=50); } #{$prefix}mask { - position: fixed; - background: #000; - @include opacity(0.2); - z-index: 99998; + position: fixed; + background: #000; + @include opacity(0.2); + z-index: 99998; } -#{$prefix}container-mask, +#{$prefix}container-mask, #{$prefix}dialog-mask-con { - background: url(../images/loading.gif) no-repeat center center; - @include background-size(32px 32px); + background: url(../images/loading.gif) no-repeat center center; + @include background-size(32px 32px); } #{$prefix}container-mask { - z-index: 20; - display: block; - background-color: #fff; + z-index: 20; + display: block; + background-color: #fff; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2) { - #{$prefix}container-mask, - #{$prefix}dialog-mask-con { - background-image: url(../images/loading@2x.gif); - } + #{$prefix}container-mask, + #{$prefix}dialog-mask-con { + background-image: url(../images/loading@2x.gif); + } } @media only screen and (-webkit-min-device-pixel-ratio: 3), only screen and (min-device-pixel-ratio: 3) { - #{$prefix}container-mask, - #{$prefix}dialog-mask-con { - background-image: url(../images/loading@3x.gif); - } + #{$prefix}container-mask, + #{$prefix}dialog-mask-con { + background-image: url(../images/loading@3x.gif); + } } -#{$prefix}code-block-dialog, +#{$prefix}code-block-dialog, #{$prefix}preformatted-text-dialog { - textarea { - width: 100%; - height: 400px; - margin-bottom: 6px; - overflow: auto; - border: 1px solid #eee; - background: #fff; - padding: 15px; - resize: none; - } + textarea { + width: 100%; + height: 400px; + margin-bottom: 6px; + overflow: auto; + border: 1px solid #eee; + background: #fff; + padding: 15px; + resize: none; + } } #{$prefix}code-toolbar { - color: #999; - font-size: 14px; - margin: -5px 0 10px; + color: #999; + font-size: 14px; + margin: -5px 0 10px; } \ No newline at end of file diff --git a/web/editor.md/scss/editormd.form.scss b/web/editor.md/scss/editormd.form.scss index e91456d..12072a4 100644 --- a/web/editor.md/scss/editormd.form.scss +++ b/web/editor.md/scss/editormd.form.scss @@ -1,130 +1,131 @@ @charset "UTF-8"; // Form - + #{$prefix}form { - color: $color; - - label { - float: left; - display: block; - width: 75px; - text-align: left; - padding: 7px 0 15px 5px; - margin: 0 0 2px; - font-weight: normal; - } + color: $color; - br { - clear: both; - } + label { + float: left; + display: block; + width: 75px; + text-align: left; + padding: 7px 0 15px 5px; + margin: 0 0 2px; + font-weight: normal; + } + + br { + clear: both; + } + + iframe { + display: none; + } + + input:focus { + outline: 0; + } + + input[type="text"], input[type="number"] { + color: #999; + padding: 8px; + border: 1px solid $borderColor; + } + + input[type="number"] { + width: 40px; + display: inline-block; + padding: 6px 8px; + } - iframe { - display: none; - } + input[type="text"] { + display: inline-block; + width: 264px; + } - input:focus { - outline: 0; - } + .fa-btns { + display: inline-block; - input[type="text"], input[type="number"] { - color: #999; - padding: 8px; - border: 1px solid $borderColor; - } - - input[type="number"] { - width: 40px; - display: inline-block; - padding: 6px 8px; + a { + color: #999; + padding: 7px 10px 0 0; + display: inline-block; + text-decoration: none; + text-align: center; } - input[type="text"] { - display: inline-block; - width: 264px; + .fa { + font-size: 1.3em; } - - .fa-btns { - display: inline-block; - - a { - color: #999; - padding: 7px 10px 0 0; - display: inline-block; - text-decoration: none; - text-align: center; - } - - .fa { - font-size: 1.3em; - } - - label { - float: none; - display: inline-block; - width: auto; - text-align: left; - padding: 0 0 0 5px; - cursor: pointer; - } + + label { + float: none; + display: inline-block; + width: auto; + text-align: left; + padding: 0 0 0 5px; + cursor: pointer; } + } } #{$prefix}form, #{$prefix}dialog-container, #{$prefix}dialog-footer { - input[type="submit"], #{$prefix}btn, button { - color: $color; - min-width: 75px; - cursor: pointer; - background: #fff; - padding: 7px 10px; - border: 1px solid #ddd; - @include border-radius(3px); - @include transition(background 300ms ease-out); - - &:hover { - background: #eee; - } + input[type="submit"], #{$prefix}btn, button { + color: $color; + min-width: 75px; + cursor: pointer; + background: #fff; + padding: 7px 10px; + border: 1px solid #ddd; + @include border-radius(3px); + @include transition(background 300ms ease-out); + + &:hover { + background: #eee; } + } - #{$prefix}btn { - padding: 5px 8px 4px\0; - } + #{$prefix}btn { + padding: 5px 8px 4px \0 + ; + } - #{$prefix}btn + #{$prefix}btn { - margin-left: 8px; - } + #{$prefix}btn + #{$prefix}btn { + margin-left: 8px; + } } #{$prefix}file-input { + width: 75px; + height: 32px; + margin-left: 8px; + position: relative; + display: inline-block; + + input[type="file"] { width: 75px; height: 32px; - margin-left: 8px; - position: relative; + opacity: 0; + cursor: pointer; + background: #000; display: inline-block; + position: absolute; + top: 0; + right: 0; - input[type="file"] { - width: 75px; - height: 32px; - opacity: 0; - cursor: pointer; - background: #000; - display: inline-block; - position: absolute; - top: 0; - right: 0; - - &::-webkit-file-upload-button { - visibility: hidden; - } + &::-webkit-file-upload-button { + visibility: hidden; } + } - input[type="submit"] { - } + input[type="submit"] { + } - &:hover input[type="submit"] { - background: #eee; - } + &:hover input[type="submit"] { + background: #eee; + } } \ No newline at end of file diff --git a/web/editor.md/scss/editormd.grid.scss b/web/editor.md/scss/editormd.grid.scss index d7b6558..eecf14e 100644 --- a/web/editor.md/scss/editormd.grid.scss +++ b/web/editor.md/scss/editormd.grid.scss @@ -1,36 +1,36 @@ @charset "utf-8"; .editormd-grid-table { - width: 99%; - display: table; - border: 1px solid #ddd; - border-collapse: collapse; + width: 99%; + display: table; + border: 1px solid #ddd; + border-collapse: collapse; } .editormd-grid-table-row { - width: 100%; - display: table-row; + width: 100%; + display: table-row; - a { - font-size: 1.4em; - width: 5%; - height: 36px; - color: #999; - text-align: center; - display: table-cell; - vertical-align: middle; - border: 1px solid #ddd; - text-decoration: none; - @include transition(background-color 300ms ease-out, color 100ms ease-in); + a { + font-size: 1.4em; + width: 5%; + height: 36px; + color: #999; + text-align: center; + display: table-cell; + vertical-align: middle; + border: 1px solid #ddd; + text-decoration: none; + @include transition(background-color 300ms ease-out, color 100ms ease-in); - &.selected { - color: #666; - background-color: #eee; - } + &.selected { + color: #666; + background-color: #eee; + } - &:hover { - color: #777; - background-color: #f6f6f6; - } + &:hover { + color: #777; + background-color: #f6f6f6; } + } } \ No newline at end of file diff --git a/web/editor.md/scss/editormd.logo.scss b/web/editor.md/scss/editormd.logo.scss index bd7e556..d021e60 100644 --- a/web/editor.md/scss/editormd.logo.scss +++ b/web/editor.md/scss/editormd.logo.scss @@ -4,14 +4,14 @@ @import "lib/prefixes"; @font-face { - font-family: 'editormd-logo'; - src:url('../fonts/editormd-logo.eot?-5y8q6h'); - src:url('.../fonts/editormd-logo.eot?#iefix-5y8q6h') format('embedded-opentype'), - url('../fonts/editormd-logo.woff?-5y8q6h') format('woff'), - url('../fonts/editormd-logo.ttf?-5y8q6h') format('truetype'), - url('../fonts/editormd-logo.svg?-5y8q6h#icomoon') format('svg'); - font-weight: normal; - font-style: normal; + font-family: 'editormd-logo'; + src: url('../fonts/editormd-logo.eot?-5y8q6h'); + src: url('.../fonts/editormd-logo.eot?#iefix-5y8q6h') format('embedded-opentype'), + url('../fonts/editormd-logo.woff?-5y8q6h') format('woff'), + url('../fonts/editormd-logo.ttf?-5y8q6h') format('truetype'), + url('../fonts/editormd-logo.svg?-5y8q6h#icomoon') format('svg'); + font-weight: normal; + font-style: normal; } #{$prefix}logo, @@ -23,67 +23,67 @@ #{$prefix}logo-6x, #{$prefix}logo-7x, #{$prefix}logo-8x { - font-family: 'editormd-logo'; - speak: none; - font-style: normal; - font-weight: normal; - font-variant: normal; - text-transform: none; - font-size: inherit; - line-height: 1; - display: inline-block; - text-rendering: auto; - vertical-align: inherit; + font-family: 'editormd-logo'; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + font-size: inherit; + line-height: 1; + display: inline-block; + text-rendering: auto; + vertical-align: inherit; - //Better Font Rendering - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; + //Better Font Rendering + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; - &:before { - content: "\e1987"; - /* - HTML Entity 󡦇 - example: - */ - } + &:before { + content: "\e1987"; + /* + HTML Entity 󡦇 + example: + */ + } } -#{$prefix}logo-1x { - font-size: 1em; +#{$prefix}logo-1x { + font-size: 1em; } -#{$prefix}logo-lg { - font-size: 1.2em; +#{$prefix}logo-lg { + font-size: 1.2em; } -#{$prefix}logo-2x { - font-size: 2em; +#{$prefix}logo-2x { + font-size: 2em; } -#{$prefix}logo-3x { - font-size: 3em; +#{$prefix}logo-3x { + font-size: 3em; } -#{$prefix}logo-4x { - font-size: 4em; +#{$prefix}logo-4x { + font-size: 4em; } -#{$prefix}logo-5x { - font-size: 5em; +#{$prefix}logo-5x { + font-size: 5em; } -#{$prefix}logo-6x { - font-size: 6em; +#{$prefix}logo-6x { + font-size: 6em; } -#{$prefix}logo-7x { - font-size: 7em; +#{$prefix}logo-7x { + font-size: 7em; } -#{$prefix}logo-8x { - font-size: 8em; +#{$prefix}logo-8x { + font-size: 8em; } #{$prefix}logo-color { - color: $mainColor; + color: $mainColor; } \ No newline at end of file diff --git a/web/editor.md/scss/editormd.menu.scss b/web/editor.md/scss/editormd.menu.scss index 766903f..3b5ed0c 100644 --- a/web/editor.md/scss/editormd.menu.scss +++ b/web/editor.md/scss/editormd.menu.scss @@ -1,113 +1,113 @@ @charset "UTF-8"; #{$prefix}menu { + margin: 0; + padding: 0; + list-style: none; + + > li { margin: 0; - padding: 0; - list-style: none; - - > li { - margin: 0; - padding: 5px 1px; + padding: 5px 1px; + display: inline-block; + position: relative; + + &.divider { + display: inline-block; + text-indent: -9999px; + margin: 0 5px; + height: 65%; + border-right: 1px solid $borderColor; + } + + > a { + outline: 0; + color: $color; + display: inline-block; + min-width: 24px; + font-size: 16px; + text-decoration: none; + text-align: center; + @include border-radius(2px); + border: 1px solid #fff; + @include transition(all 300ms ease-out); + + &:hover, &.active { + border: 1px solid $borderColor; + background: #eee; + } + + > .fa { + text-align: center; + display: block; + padding: 5px; + } + + > #{$prefix}bold { + padding: 5px 2px; display: inline-block; - position: relative; - - &.divider { - display: inline-block; - text-indent: -9999px; - margin: 0 5px; - height: 65%; - border-right: 1px solid $borderColor; - } - - > a { - outline: 0; - color: $color; - display: inline-block; - min-width: 24px; - font-size: 16px; - text-decoration: none; - text-align: center; - @include border-radius(2px); - border: 1px solid #fff; - @include transition(all 300ms ease-out); - - &:hover, &.active { - border: 1px solid $borderColor; - background: #eee; - } - - > .fa { - text-align: center; - display: block; - padding: 5px; - } - - > #{$prefix}bold { - padding: 5px 2px; - display: inline-block; - font-weight: bold; - } - } - - &:hover #{$prefix}dropdown-menu { - display: block; - } + font-weight: bold; + } } - > li + li > a { - margin-left: 3px; + &:hover #{$prefix}dropdown-menu { + display: block; } + } + + > li + li > a { + margin-left: 3px; + } } -#{$prefix}dropdown-menu { - display: none; - background: #fff; - border: 1px solid $borderColor; - width: 148px; - list-style: none; +#{$prefix}dropdown-menu { + display: none; + background: #fff; + border: 1px solid $borderColor; + width: 148px; + list-style: none; + position: absolute; + top: 33px; + left: 0; + z-index: 100; + @include box-shadow(1px 2px 6px rgba(0, 0, 0, 0.15)); + + &:before, &:after { + width: 0; + height: 0; + display: block; + content: ""; position: absolute; - top: 33px; - left: 0; - z-index: 100; - @include box-shadow(1px 2px 6px rgba(0, 0, 0, 0.15)); - - &:before, &:after { - width: 0; - height: 0; - display: block; - content: ""; - position: absolute; - top: -11px; - left: 8px; - border: 5px solid transparent; - } + top: -11px; + left: 8px; + border: 5px solid transparent; + } - &:before { - border-bottom-color: #ccc; - } + &:before { + border-bottom-color: #ccc; + } - &:after { - border-bottom-color: #ffffff; - top: -10px; - } + &:after { + border-bottom-color: #ffffff; + top: -10px; + } - > li { - - > a { - color: $color; - display: block; - text-decoration: none; - padding: 8px 10px; + > li { - &:hover { - background: #f6f6f6; - @include transition(all 300ms ease-out); - } - } - } + > a { + color: $color; + display: block; + text-decoration: none; + padding: 8px 10px; - > li + li { - border-top: 1px solid $borderColor; + &:hover { + background: #f6f6f6; + @include transition(all 300ms ease-out); + } } + } + + > li + li { + border-top: 1px solid $borderColor; + } } \ No newline at end of file diff --git a/web/editor.md/scss/editormd.preview.scss b/web/editor.md/scss/editormd.preview.scss index 5f9ce90..8067b50 100644 --- a/web/editor.md/scss/editormd.preview.scss +++ b/web/editor.md/scss/editormd.preview.scss @@ -7,105 +7,105 @@ @import "editormd.logo"; // github-markdown.css -@import "github-markdown"; +@import "github-markdown"; #{$prefix}preview-container, #{$prefix}html-preview { - text-align: left; + text-align: left; + font-size: 14px; + line-height: 1.6; + padding: 20px; + overflow: auto; + width: 100%; + background-color: #fff; + + blockquote { + color: $color; + border-left: 4px solid $borderColor; + padding-left: 20px; + margin-left: 0; font-size: 14px; - line-height: 1.6; - padding: 20px; - overflow: auto; - width: 100%; - background-color: #fff; - - blockquote { - color: $color; - border-left: 4px solid $borderColor; - padding-left: 20px; - margin-left: 0; - font-size: 14px; - font-style: italic; - } - - p code { - margin-left: 5px; - margin-right: 4px; - } - - abbr { - background: #ffffdd; - } + font-style: italic; + } + + p code { + margin-left: 5px; + margin-right: 4px; + } + + abbr { + background: #ffffdd; + } + + hr { + height: 1px; + border: none; + border-top: 1px solid $borderColor; + background: none; + } + + code { + border: 1px solid $borderColor; + background: #f6f6f6; + padding: 3px; + border-radius: 3px; + font-size: 14px; + } - hr { - height: 1px; - border: none; - border-top: 1px solid $borderColor; - background: none; - } + pre { + border: 1px solid $borderColor; + background: #f6f6f6; + padding: 10px; + @include border-radius(3px); code { - border: 1px solid $borderColor; - background: #f6f6f6; - padding: 3px; - border-radius: 3px; - font-size: 14px; + padding: 0; } + } - pre { - border: 1px solid $borderColor; - background: #f6f6f6; - padding: 10px; - @include border-radius(3px); + pre, code, kbd { + font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; + } - code { - padding: 0; - } - } - - pre, code, kbd { - font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; - } + table thead tr { + background-color: #F8F8F8; + } - table thead tr { - background-color: #F8F8F8; - } + .markdown-toc { + } - .markdown-toc { - } + .markdown-toc-list { + } - .markdown-toc-list { - } - - p#{$prefix}tex { - text-align: center; - } - - span#{$prefix}tex { - margin: 0 5px; - } - - .emoji { - width: 24px; - height: 24px; - } - - .katex { - font-size: 1.4em; - } + p#{$prefix}tex { + text-align: center; + } - .sequence-diagram, .flowchart { - margin: 0 auto; - text-align: center; - - svg { - margin: 0 auto; - } + span#{$prefix}tex { + margin: 0 5px; + } - text { - font-size : 15px !important; - font-family: "YaHei Consolas Hybrid", Consolas, "Microsoft YaHei", "Malgun Gothic", "Segoe UI", Helvetica, Arial !important; - } + .emoji { + width: 24px; + height: 24px; + } + + .katex { + font-size: 1.4em; + } + + .sequence-diagram, .flowchart { + margin: 0 auto; + text-align: center; + + svg { + margin: 0 auto; + } + + text { + font-size: 15px !important; + font-family: "YaHei Consolas Hybrid", Consolas, "Microsoft YaHei", "Malgun Gothic", "Segoe UI", Helvetica, Arial !important; } + } } //Pretty printing styles. Used with prettify.js. @@ -113,210 +113,210 @@ @import "prettify"; #{$prefix}preview-container, #{$prefix}html-preview { - pre.prettyprint { - padding: 10px; - border: 1px solid $borderColor; - white-space: pre-wrap; - word-wrap: break-word; - } + pre.prettyprint { + padding: 10px; + border: 1px solid $borderColor; + white-space: pre-wrap; + word-wrap: break-word; + } - ol.linenums { - color: #999; - padding-left: 2.5em; - - li { - list-style-type: decimal; - - code { - border: none; - background:none; - padding: 0; - } - } + ol.linenums { + color: #999; + padding-left: 2.5em; + + li { + list-style-type: decimal; + + code { + border: none; + background: none; + padding: 0; + } } -} + } +} #{$prefix}preview-container, #{$prefix}html-preview { - #{$prefix}toc-menu { - margin: 8px 0 12px 0; - display: inline-block; - - > .markdown-toc { - position: relative; - @include border-radius(4px); - border: 1px solid #ddd; - display: inline-block; - font-size: 1em; - - > ul { - width : 160%; - min-width: 180px; - position: absolute; - left: -1px; - top: -2px; - z-index: 100; - padding: 0 10px 10px; - display: none; - background: #fff; - border: 1px solid #ddd; - @include border-radius(4px); - @include box-shadow(0 3px 5px rgba(0, 0, 0, 0.2)); - - > li ul { - width: 100%; - min-width: 180px; - border: 1px solid #ddd; - display: none; - background: #fff; - @include border-radius(4px); - } - - > li a { - color: #666; - padding: 6px 10px; - display: block; - @include transition(background-color 500ms ease-out); - - &:hover { - background-color: #f6f6f6; - } - } - } - - li { - position: relative; - - > ul { - position: absolute; - top: 32px; - left: 10%; - display: none; - @include box-shadow(0 3px 5px rgba(0, 0, 0, 0.2)); - - &:before, &:after { - pointer-events: pointer-events; - position: absolute; - left: 15px; - top: -6px; - display: block; - content: ""; - width: 0; - height: 0; - border: 6px solid transparent; - border-width: 0 6px 6px; - z-index: 10; - } - - &:before { - border-bottom-color: #ccc; - } - - &:after { - border-bottom-color: #ffffff; - top: -5px; - } - } - } + #{$prefix}toc-menu { + margin: 8px 0 12px 0; + display: inline-block; + + > .markdown-toc { + position: relative; + @include border-radius(4px); + border: 1px solid #ddd; + display: inline-block; + font-size: 1em; + + > ul { + width: 160%; + min-width: 180px; + position: absolute; + left: -1px; + top: -2px; + z-index: 100; + padding: 0 10px 10px; + display: none; + background: #fff; + border: 1px solid #ddd; + @include border-radius(4px); + @include box-shadow(0 3px 5px rgba(0, 0, 0, 0.2)); + + > li ul { + width: 100%; + min-width: 180px; + border: 1px solid #ddd; + display: none; + background: #fff; + @include border-radius(4px); } - ul { - list-style: none; - } + > li a { + color: #666; + padding: 6px 10px; + display: block; + @include transition(background-color 500ms ease-out); - a { - text-decoration: none; + &:hover { + background-color: #f6f6f6; + } + } + } + + li { + position: relative; + + > ul { + position: absolute; + top: 32px; + left: 10%; + display: none; + @include box-shadow(0 3px 5px rgba(0, 0, 0, 0.2)); + + &:before, &:after { + pointer-events: pointer-events; + position: absolute; + left: 15px; + top: -6px; + display: block; + content: ""; + width: 0; + height: 0; + border: 6px solid transparent; + border-width: 0 6px 6px; + z-index: 10; + } + + &:before { + border-bottom-color: #ccc; + } + + &:after { + border-bottom-color: #ffffff; + top: -5px; + } } + } + } - h1 { - font-size: 16px; - padding: 5px 0 10px 10px; - line-height: 1; - border-bottom: 1px solid #eee; + ul { + list-style: none; + } - .fa { - padding-left: 10px; - } - } + a { + text-decoration: none; + } - .toc-menu-btn { - color: #666; - min-width: 180px; - padding: 5px 10px; - border-radius: 4px; - display: inline-block; - @include transition(background-color 500ms ease-out); - - &:hover { - background-color: #f6f6f6; - } - - .fa { - float: right; - padding: 3px 0 0 10px; - font-size: 1.3em; - } - } + h1 { + font-size: 16px; + padding: 5px 0 10px 10px; + line-height: 1; + border-bottom: 1px solid #eee; + + .fa { + padding-left: 10px; + } + } + + .toc-menu-btn { + color: #666; + min-width: 180px; + padding: 5px 10px; + border-radius: 4px; + display: inline-block; + @include transition(background-color 500ms ease-out); + + &:hover { + background-color: #f6f6f6; + } + + .fa { + float: right; + padding: 3px 0 0 10px; + font-size: 1.3em; + } } + } } .markdown-body { - #{$prefix}toc-menu { - ul { - padding-left: 0; - } + #{$prefix}toc-menu { + ul { + padding-left: 0; } + } - .highlight pre, pre { - line-height: 1.6; - } + .highlight pre, pre { + line-height: 1.6; + } } hr.editormd-page-break { - border: 1px dotted #ccc; - font-size: 0; - height: 2px; + border: 1px dotted #ccc; + font-size: 0; + height: 2px; } @media only print { - hr.editormd-page-break { - background: none; - border: none; - height: 0; - } + hr.editormd-page-break { + background: none; + border: none; + height: 0; + } } #{$prefix}html-preview { - textarea { - display : none; - } + textarea { + display: none; + } - hr.editormd-page-break { - background: none; - border: none; - height: 0; - } + hr.editormd-page-break { + background: none; + border: none; + height: 0; + } } #{$prefix}preview-close-btn { - color: #fff; - padding: 4px 6px; - font-size: 18px; - @include border-radius(500px); - display: none; - background-color: #ccc; - position: absolute; - top: 25px; - right: 35px; - z-index: 19; - @include transition(background-color 300ms ease-out); - - &:hover { - background-color: #999; - } + color: #fff; + padding: 4px 6px; + font-size: 18px; + @include border-radius(500px); + display: none; + background-color: #ccc; + position: absolute; + top: 25px; + right: 35px; + z-index: 19; + @include transition(background-color 300ms ease-out); + + &:hover { + background-color: #999; + } } .editormd-preview-active { - width: 100%; - padding: 40px; + width: 100%; + padding: 40px; } \ No newline at end of file diff --git a/web/editor.md/scss/editormd.preview.themes.scss b/web/editor.md/scss/editormd.preview.themes.scss index 6553c1e..95d4c2b 100644 --- a/web/editor.md/scss/editormd.preview.themes.scss +++ b/web/editor.md/scss/editormd.preview.themes.scss @@ -1,131 +1,174 @@ /* Preview dark theme */ - + #{$prefix}preview-theme-dark { - color: #777; - background:#2C2827; - - #{$prefix}preview-container { - color: #888; - background-color: #2C2827; - //font-family: "Meiryo UI", "Helvetica Neue", "Microsoft YaHei"; - - pre.prettyprint { - border: none; - } - - blockquote { - color: #555; - padding: 0.5em; - background: #222; - border-color: #333; - } - - abbr { - color: #fff; - padding: 1px 3px; - @include border-radius(3px); - background:#ff9900; - } - - code { - color: #fff; - border: none; - padding: 1px 3px; - @include border-radius(3px); - background: #5A9600; - } - - table { - border: none; - } - - .fa-emoji { - color: #B4BF42; - } - - .katex { - color: #FEC93F; - } - } - - .editormd-toc-menu { - > .markdown-toc { - background:#fff; - border:none; - - h1 { - border-color:#ddd; - } - } - } - - .markdown-body { - h1, h2, hr { - border-color: #222; - } - } - - pre { - color: #999; - background-color: #111; - background-color: rgba(0,0,0,.4); - - /* plain text */ - .pln { - color: #999; - } - } - - li.L1, li.L3, li.L5, li.L7, li.L9 { - background: none; - } - - [class*=editormd-logo] { - color: #2196F3; - } - - .sequence-diagram { - text { - fill: #fff; - } - - rect, path { - color:#fff; - fill : #64D1CB; - stroke : #64D1CB; - } - } - - .flowchart { - rect, path { - stroke : #A6C6FF; - } - - rect { - fill: #A6C6FF; - } - - text { - fill: #5879B4; - } + color: #777; + background: #2C2827; + + #{$prefix}preview-container { + color: #888; + background-color: #2C2827; + //font-family: "Meiryo UI", "Helvetica Neue", "Microsoft YaHei"; + + pre.prettyprint { + border: none; + } + + blockquote { + color: #555; + padding: 0.5em; + background: #222; + border-color: #333; + } + + abbr { + color: #fff; + padding: 1px 3px; + @include border-radius(3px); + background: #ff9900; + } + + code { + color: #fff; + border: none; + padding: 1px 3px; + @include border-radius(3px); + background: #5A9600; + } + + table { + border: none; + } + + .fa-emoji { + color: #B4BF42; + } + + .katex { + color: #FEC93F; } + } + + .editormd-toc-menu { + > .markdown-toc { + background: #fff; + border: none; + + h1 { + border-color: #ddd; + } + } + } + + .markdown-body { + h1, h2, hr { + border-color: #222; + } + } + + pre { + color: #999; + background-color: #111; + background-color: rgba(0, 0, 0, .4); + + /* plain text */ + .pln { + color: #999; + } + } + + li.L1, li.L3, li.L5, li.L7, li.L9 { + background: none; + } + + [class*=editormd-logo] { + color: #2196F3; + } + + .sequence-diagram { + text { + fill: #fff; + } + + rect, path { + color: #fff; + fill: #64D1CB; + stroke: #64D1CB; + } + } + + .flowchart { + rect, path { + stroke: #A6C6FF; + } + + rect { + fill: #A6C6FF; + } + + text { + fill: #5879B4; + } + } } @media screen { - - #{$prefix}preview-theme-dark { - .str { color: #080 } /* string content */ - .kwd { color: #ff9900; } /* a keyword */ - .com { color: #444444; } /* a comment */ - .typ { color: #606 } /* a type name */ - .lit { color: #066 } /* a literal value */ - /* punctuation, lisp open bracket, lisp close bracket */ - .pun, .opn, .clo { color: #660 } - .tag { color: #ff9900; } /* a markup tag name */ - .atn { color: #6C95F5; } /* a markup attribute name */ - .atv { color: #080 } /* a markup attribute value */ - .dec, .var { color: #008BA7; } /* a declaration; a variable name */ - .fun { color: red } /* a function name */ - } - + + #{$prefix}preview-theme-dark { + .str { + color: #080 + } + + /* string content */ + .kwd { + color: #ff9900; + } + + /* a keyword */ + .com { + color: #444444; + } + + /* a comment */ + .typ { + color: #606 + } + + /* a type name */ + .lit { + color: #066 + } + + /* a literal value */ + /* punctuation, lisp open bracket, lisp close bracket */ + .pun, .opn, .clo { + color: #660 + } + + .tag { + color: #ff9900; + } + + /* a markup tag name */ + .atn { + color: #6C95F5; + } + + /* a markup attribute name */ + .atv { + color: #080 + } + + /* a markup attribute value */ + .dec, .var { + color: #008BA7; + } + + /* a declaration; a variable name */ + .fun { + color: red + } + + /* a function name */ + } + } \ No newline at end of file diff --git a/web/editor.md/scss/editormd.scss b/web/editor.md/scss/editormd.scss index 30abf38..c89d5c4 100644 --- a/web/editor.md/scss/editormd.scss +++ b/web/editor.md/scss/editormd.scss @@ -2,136 +2,136 @@ @import "lib/variables"; @import "lib/prefixes"; - + .editormd { - width: 90%; - height: 640px; - margin: 0 auto; - text-align: left; - overflow: hidden; - position: relative; - margin-bottom: 15px; - border: 1px solid $borderColor; - font-family: "Meiryo UI", "Microsoft YaHei", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, "Monaco", monospace, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif; - - *, *:before, *:after { - @include box-sizing(border-box); - } - - a { - text-decoration: none; - } + width: 90%; + height: 640px; + margin: 0 auto; + text-align: left; + overflow: hidden; + position: relative; + margin-bottom: 15px; + border: 1px solid $borderColor; + font-family: "Meiryo UI", "Microsoft YaHei", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, "Monaco", monospace, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif; + + *, *:before, *:after { + @include box-sizing(border-box); + } - img { - border: none; - vertical-align: middle; - } - - > textarea, - #{$prefix}html-textarea, - #{$prefix}markdown-textarea { - width: 0; - height: 0; - outline: 0; - resize:none; - } - - #{$prefix}html-textarea, - #{$prefix}markdown-textarea { - display : none; - } + a { + text-decoration: none; + } - input[type="text"], - input[type="button"], - input[type="submit"], - select, textarea, button { - @include appearance(none); - } - - ::-webkit-scrollbar { - height: 10px; - width: 7px; - background: rgba(0, 0, 0, .1); - - &:hover { - background: rgba(0, 0, 0, .2); - } + img { + border: none; + vertical-align: middle; + } + + > textarea, + #{$prefix}html-textarea, + #{$prefix}markdown-textarea { + width: 0; + height: 0; + outline: 0; + resize: none; + } + + #{$prefix}html-textarea, + #{$prefix}markdown-textarea { + display: none; + } + + input[type="text"], + input[type="button"], + input[type="submit"], + select, textarea, button { + @include appearance(none); + } + + ::-webkit-scrollbar { + height: 10px; + width: 7px; + background: rgba(0, 0, 0, .1); + + &:hover { + background: rgba(0, 0, 0, .2); } + } - ::-webkit-scrollbar-thumb { - background: rgba(0,0,0,0.3); - @include border-radius(6px); + ::-webkit-scrollbar-thumb { + background: rgba(0, 0, 0, 0.3); + @include border-radius(6px); - &:hover { - @include box-shadow(inset 1px 1px 1px rgba(0, 0, 0, .25)); - background-color: rgba(0, 0, 0, .4); - } + &:hover { + @include box-shadow(inset 1px 1px 1px rgba(0, 0, 0, .25)); + background-color: rgba(0, 0, 0, .4); } + } } - -#{$prefix}user-unselect { - @include user-select(none); + +#{$prefix}user-unselect { + @include user-select(none); } #{$prefix}toolbar { - width: 100%; - min-height: 37px; - background: #fff; - display: none; - position: absolute; - top: 0; - left: 0; - z-index: 10; - border-bottom: 1px solid $borderColor; + width: 100%; + min-height: 37px; + background: #fff; + display: none; + position: absolute; + top: 0; + left: 0; + z-index: 10; + border-bottom: 1px solid $borderColor; } #{$prefix}toolbar-container { - padding: 0 8px; - min-height: 35px; - @include user-select(none); + padding: 0 8px; + min-height: 35px; + @include user-select(none); } @import "editormd.menu"; #{$prefix}container { - margin: 0; - width: 100%; - height: 100%; - overflow: hidden; - padding: 35px 0 0; - position: relative; - background: #fff; - @include box-sizing(border-box); + margin: 0; + width: 100%; + height: 100%; + overflow: hidden; + padding: 35px 0 0; + position: relative; + background: #fff; + @include box-sizing(border-box); } -@import "editormd.dialog"; -@import "editormd.grid"; -@import "editormd.tab"; -@import "editormd.form"; -@import "editormd.codemirror"; +@import "editormd.dialog"; +@import "editormd.grid"; +@import "editormd.tab"; +@import "editormd.form"; +@import "editormd.codemirror"; @import "editormd.preview"; @import "editormd.preview.themes"; #{$prefix}onlyread { - #{$prefix}toolbar { - display: none; - } + #{$prefix}toolbar { + display: none; + } - .CodeMirror { - margin-top: 0; - } + .CodeMirror { + margin-top: 0; + } - #{$prefix}preview { - top: 0; - } + #{$prefix}preview { + top: 0; + } } #{$prefix}fullscreen { - position: fixed; - top : 0; - left : 0; - border: none; - margin: 0 auto; + position: fixed; + top: 0; + left: 0; + border: none; + margin: 0 auto; } @import "editormd.themes"; \ No newline at end of file diff --git a/web/editor.md/scss/editormd.tab.scss b/web/editor.md/scss/editormd.tab.scss index 483b420..79042b4 100644 --- a/web/editor.md/scss/editormd.tab.scss +++ b/web/editor.md/scss/editormd.tab.scss @@ -4,46 +4,46 @@ } .editormd-tab-head { - list-style: none; - border-bottom: 1px solid #ddd; - - li { - display: inline-block; - - a { - color: #999; - display: block; - padding: 6px 12px 5px; - text-align: center; - text-decoration: none; - margin-bottom: -1px; - border: 1px solid #ddd; - @include border-top-left-radius(3px); - @include border-top-right-radius(3px); - background: #f6f6f6; - @include transition(all 300ms ease-out); - - &:hover { - color: #666; - background: #eee; - } - } - - &.active a { - color: #666; - background: #fff; - border-bottom-color: #fff; - } + list-style: none; + border-bottom: 1px solid #ddd; + + li { + display: inline-block; + + a { + color: #999; + display: block; + padding: 6px 12px 5px; + text-align: center; + text-decoration: none; + margin-bottom: -1px; + border: 1px solid #ddd; + @include border-top-left-radius(3px); + @include border-top-right-radius(3px); + background: #f6f6f6; + @include transition(all 300ms ease-out); + + &:hover { + color: #666; + background: #eee; + } } - - li + li { - margin-left: 3px; + + &.active a { + color: #666; + background: #fff; + border-bottom-color: #fff; } + } + + li + li { + margin-left: 3px; + } } .editormd-tab-container { } .editormd-tab-box { - padding: 20px 0; + padding: 20px 0; } \ No newline at end of file diff --git a/web/editor.md/scss/editormd.themes.scss b/web/editor.md/scss/editormd.themes.scss index 257766a..0ef9b45 100644 --- a/web/editor.md/scss/editormd.themes.scss +++ b/web/editor.md/scss/editormd.themes.scss @@ -1,28 +1,28 @@ /* Editor.md Dark theme */ #{$prefix}theme-dark { - border-color: #1a1a17; + border-color: #1a1a17; - #{$prefix}toolbar { - background: #1A1A17; - border-color: #1a1a17; - } + #{$prefix}toolbar { + background: #1A1A17; + border-color: #1a1a17; + } - #{$prefix}menu > li > a { - color: #777; - border-color: #1a1a17; + #{$prefix}menu > li > a { + color: #777; + border-color: #1a1a17; - &:hover, &.active { - border-color: #333; - background: #333; - } + &:hover, &.active { + border-color: #333; + background: #333; } + } - #{$prefix}menu > li.divider { - border-right: 1px solid #111; - } - - .CodeMirror { - border-right: 1px solid rgba(0,0,0,0.1); - } + #{$prefix}menu > li.divider { + border-right: 1px solid #111; + } + + .CodeMirror { + border-right: 1px solid rgba(0, 0, 0, 0.1); + } } \ No newline at end of file diff --git a/web/editor.md/scss/font-awesome.scss b/web/editor.md/scss/font-awesome.scss index 2dcdc22..ac4af69 100644 --- a/web/editor.md/scss/font-awesome.scss +++ b/web/editor.md/scss/font-awesome.scss @@ -11,6 +11,7 @@ font-weight: normal; font-style: normal; } + .fa { display: inline-block; font: normal normal normal 14px/1 FontAwesome; @@ -20,36 +21,45 @@ -moz-osx-font-smoothing: grayscale; transform: translate(0, 0); } + /* makes the font 33% larger relative to the icon container */ .fa-lg { font-size: 1.33333333em; line-height: 0.75em; vertical-align: -15%; } + .fa-2x { font-size: 2em; } + .fa-3x { font-size: 3em; } + .fa-4x { font-size: 4em; } + .fa-5x { font-size: 5em; } + .fa-fw { width: 1.28571429em; text-align: center; } + .fa-ul { padding-left: 0; margin-left: 2.14285714em; list-style-type: none; } + .fa-ul > li { position: relative; } + .fa-li { position: absolute; left: -2.14285714em; @@ -57,34 +67,43 @@ top: 0.14285714em; text-align: center; } + .fa-li.fa-lg { left: -1.85714286em; } + .fa-border { padding: .2em .25em .15em; border: solid 0.08em #eeeeee; border-radius: .1em; } + .pull-right { float: right; } + .pull-left { float: left; } + .fa.pull-left { margin-right: .3em; } + .fa.pull-right { margin-left: .3em; } + .fa-spin { -webkit-animation: fa-spin 2s infinite linear; animation: fa-spin 2s infinite linear; } + .fa-pulse { -webkit-animation: fa-spin 1s infinite steps(8); animation: fa-spin 1s infinite steps(8); } + @-webkit-keyframes fa-spin { 0% { -webkit-transform: rotate(0deg); @@ -95,6 +114,7 @@ transform: rotate(359deg); } } + @keyframes fa-spin { 0% { -webkit-transform: rotate(0deg); @@ -105,36 +125,42 @@ transform: rotate(359deg); } } + .fa-rotate-90 { filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); -webkit-transform: rotate(90deg); -ms-transform: rotate(90deg); transform: rotate(90deg); } + .fa-rotate-180 { filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2); -webkit-transform: rotate(180deg); -ms-transform: rotate(180deg); transform: rotate(180deg); } + .fa-rotate-270 { filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); -webkit-transform: rotate(270deg); -ms-transform: rotate(270deg); transform: rotate(270deg); } + .fa-flip-horizontal { filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1); -webkit-transform: scale(-1, 1); -ms-transform: scale(-1, 1); transform: scale(-1, 1); } + .fa-flip-vertical { filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1); -webkit-transform: scale(1, -1); -ms-transform: scale(1, -1); transform: scale(1, -1); } + :root .fa-rotate-90, :root .fa-rotate-180, :root .fa-rotate-270, @@ -142,6 +168,7 @@ :root .fa-flip-vertical { filter: none; } + .fa-stack { position: relative; display: inline-block; @@ -150,6 +177,7 @@ line-height: 2em; vertical-align: middle; } + .fa-stack-1x, .fa-stack-2x { position: absolute; @@ -157,1334 +185,1757 @@ width: 100%; text-align: center; } + .fa-stack-1x { line-height: inherit; } + .fa-stack-2x { font-size: 2em; } + .fa-inverse { color: #ffffff; } + /* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen readers do not read off random characters that represent icons */ .fa-glass:before { content: "\f000"; } + .fa-music:before { content: "\f001"; } + .fa-search:before { content: "\f002"; } + .fa-envelope-o:before { content: "\f003"; } + .fa-heart:before { content: "\f004"; } + .fa-star:before { content: "\f005"; } + .fa-star-o:before { content: "\f006"; } + .fa-user:before { content: "\f007"; } + .fa-film:before { content: "\f008"; } + .fa-th-large:before { content: "\f009"; } + .fa-th:before { content: "\f00a"; } + .fa-th-list:before { content: "\f00b"; } + .fa-check:before { content: "\f00c"; } + .fa-remove:before, .fa-close:before, .fa-times:before { content: "\f00d"; } + .fa-search-plus:before { content: "\f00e"; } + .fa-search-minus:before { content: "\f010"; } + .fa-power-off:before { content: "\f011"; } + .fa-signal:before { content: "\f012"; } + .fa-gear:before, .fa-cog:before { content: "\f013"; } + .fa-trash-o:before { content: "\f014"; } + .fa-home:before { content: "\f015"; } + .fa-file-o:before { content: "\f016"; } + .fa-clock-o:before { content: "\f017"; } + .fa-road:before { content: "\f018"; } + .fa-download:before { content: "\f019"; } + .fa-arrow-circle-o-down:before { content: "\f01a"; } + .fa-arrow-circle-o-up:before { content: "\f01b"; } + .fa-inbox:before { content: "\f01c"; } + .fa-play-circle-o:before { content: "\f01d"; } + .fa-rotate-right:before, .fa-repeat:before { content: "\f01e"; } + .fa-refresh:before { content: "\f021"; } + .fa-list-alt:before { content: "\f022"; } + .fa-lock:before { content: "\f023"; } + .fa-flag:before { content: "\f024"; } + .fa-headphones:before { content: "\f025"; } + .fa-volume-off:before { content: "\f026"; } + .fa-volume-down:before { content: "\f027"; } + .fa-volume-up:before { content: "\f028"; } + .fa-qrcode:before { content: "\f029"; } + .fa-barcode:before { content: "\f02a"; } + .fa-tag:before { content: "\f02b"; } + .fa-tags:before { content: "\f02c"; } + .fa-book:before { content: "\f02d"; } + .fa-bookmark:before { content: "\f02e"; } + .fa-print:before { content: "\f02f"; } + .fa-camera:before { content: "\f030"; } + .fa-font:before { content: "\f031"; } + .fa-bold:before { content: "\f032"; } + .fa-italic:before { content: "\f033"; } + .fa-text-height:before { content: "\f034"; } + .fa-text-width:before { content: "\f035"; } + .fa-align-left:before { content: "\f036"; } + .fa-align-center:before { content: "\f037"; } + .fa-align-right:before { content: "\f038"; } + .fa-align-justify:before { content: "\f039"; } + .fa-list:before { content: "\f03a"; } + .fa-dedent:before, .fa-outdent:before { content: "\f03b"; } + .fa-indent:before { content: "\f03c"; } + .fa-video-camera:before { content: "\f03d"; } + .fa-photo:before, .fa-image:before, .fa-picture-o:before { content: "\f03e"; } + .fa-pencil:before { content: "\f040"; } + .fa-map-marker:before { content: "\f041"; } + .fa-adjust:before { content: "\f042"; } + .fa-tint:before { content: "\f043"; } + .fa-edit:before, .fa-pencil-square-o:before { content: "\f044"; } + .fa-share-square-o:before { content: "\f045"; } + .fa-check-square-o:before { content: "\f046"; } + .fa-arrows:before { content: "\f047"; } + .fa-step-backward:before { content: "\f048"; } + .fa-fast-backward:before { content: "\f049"; } + .fa-backward:before { content: "\f04a"; } + .fa-play:before { content: "\f04b"; } + .fa-pause:before { content: "\f04c"; } + .fa-stop:before { content: "\f04d"; } + .fa-forward:before { content: "\f04e"; } + .fa-fast-forward:before { content: "\f050"; } + .fa-step-forward:before { content: "\f051"; } + .fa-eject:before { content: "\f052"; } + .fa-chevron-left:before { content: "\f053"; } + .fa-chevron-right:before { content: "\f054"; } + .fa-plus-circle:before { content: "\f055"; } + .fa-minus-circle:before { content: "\f056"; } + .fa-times-circle:before { content: "\f057"; } + .fa-check-circle:before { content: "\f058"; } + .fa-question-circle:before { content: "\f059"; } + .fa-info-circle:before { content: "\f05a"; } + .fa-crosshairs:before { content: "\f05b"; } + .fa-times-circle-o:before { content: "\f05c"; } + .fa-check-circle-o:before { content: "\f05d"; } + .fa-ban:before { content: "\f05e"; } + .fa-arrow-left:before { content: "\f060"; } + .fa-arrow-right:before { content: "\f061"; } + .fa-arrow-up:before { content: "\f062"; } + .fa-arrow-down:before { content: "\f063"; } + .fa-mail-forward:before, .fa-share:before { content: "\f064"; } + .fa-expand:before { content: "\f065"; } + .fa-compress:before { content: "\f066"; } + .fa-plus:before { content: "\f067"; } + .fa-minus:before { content: "\f068"; } + .fa-asterisk:before { content: "\f069"; } + .fa-exclamation-circle:before { content: "\f06a"; } + .fa-gift:before { content: "\f06b"; } + .fa-leaf:before { content: "\f06c"; } + .fa-fire:before { content: "\f06d"; } + .fa-eye:before { content: "\f06e"; } + .fa-eye-slash:before { content: "\f070"; } + .fa-warning:before, .fa-exclamation-triangle:before { content: "\f071"; } + .fa-plane:before { content: "\f072"; } + .fa-calendar:before { content: "\f073"; } + .fa-random:before { content: "\f074"; } + .fa-comment:before { content: "\f075"; } + .fa-magnet:before { content: "\f076"; } + .fa-chevron-up:before { content: "\f077"; } + .fa-chevron-down:before { content: "\f078"; } + .fa-retweet:before { content: "\f079"; } + .fa-shopping-cart:before { content: "\f07a"; } + .fa-folder:before { content: "\f07b"; } + .fa-folder-open:before { content: "\f07c"; } + .fa-arrows-v:before { content: "\f07d"; } + .fa-arrows-h:before { content: "\f07e"; } + .fa-bar-chart-o:before, .fa-bar-chart:before { content: "\f080"; } + .fa-twitter-square:before { content: "\f081"; } + .fa-facebook-square:before { content: "\f082"; } + .fa-camera-retro:before { content: "\f083"; } + .fa-key:before { content: "\f084"; } + .fa-gears:before, .fa-cogs:before { content: "\f085"; } + .fa-comments:before { content: "\f086"; } + .fa-thumbs-o-up:before { content: "\f087"; } + .fa-thumbs-o-down:before { content: "\f088"; } + .fa-star-half:before { content: "\f089"; } + .fa-heart-o:before { content: "\f08a"; } + .fa-sign-out:before { content: "\f08b"; } + .fa-linkedin-square:before { content: "\f08c"; } + .fa-thumb-tack:before { content: "\f08d"; } + .fa-external-link:before { content: "\f08e"; } + .fa-sign-in:before { content: "\f090"; } + .fa-trophy:before { content: "\f091"; } + .fa-github-square:before { content: "\f092"; } + .fa-upload:before { content: "\f093"; } + .fa-lemon-o:before { content: "\f094"; } + .fa-phone:before { content: "\f095"; } + .fa-square-o:before { content: "\f096"; } + .fa-bookmark-o:before { content: "\f097"; } + .fa-phone-square:before { content: "\f098"; } + .fa-twitter:before { content: "\f099"; } + .fa-facebook-f:before, .fa-facebook:before { content: "\f09a"; } + .fa-github:before { content: "\f09b"; } + .fa-unlock:before { content: "\f09c"; } + .fa-credit-card:before { content: "\f09d"; } + .fa-rss:before { content: "\f09e"; } + .fa-hdd-o:before { content: "\f0a0"; } + .fa-bullhorn:before { content: "\f0a1"; } + .fa-bell:before { content: "\f0f3"; } + .fa-certificate:before { content: "\f0a3"; } + .fa-hand-o-right:before { content: "\f0a4"; } + .fa-hand-o-left:before { content: "\f0a5"; } + .fa-hand-o-up:before { content: "\f0a6"; } + .fa-hand-o-down:before { content: "\f0a7"; } + .fa-arrow-circle-left:before { content: "\f0a8"; } + .fa-arrow-circle-right:before { content: "\f0a9"; } + .fa-arrow-circle-up:before { content: "\f0aa"; } + .fa-arrow-circle-down:before { content: "\f0ab"; } + .fa-globe:before { content: "\f0ac"; } + .fa-wrench:before { content: "\f0ad"; } + .fa-tasks:before { content: "\f0ae"; } + .fa-filter:before { content: "\f0b0"; } + .fa-briefcase:before { content: "\f0b1"; } + .fa-arrows-alt:before { content: "\f0b2"; } + .fa-group:before, .fa-users:before { content: "\f0c0"; } + .fa-chain:before, .fa-link:before { content: "\f0c1"; } + .fa-cloud:before { content: "\f0c2"; } + .fa-flask:before { content: "\f0c3"; } + .fa-cut:before, .fa-scissors:before { content: "\f0c4"; } + .fa-copy:before, .fa-files-o:before { content: "\f0c5"; } + .fa-paperclip:before { content: "\f0c6"; } + .fa-save:before, .fa-floppy-o:before { content: "\f0c7"; } + .fa-square:before { content: "\f0c8"; } + .fa-navicon:before, .fa-reorder:before, .fa-bars:before { content: "\f0c9"; } + .fa-list-ul:before { content: "\f0ca"; } + .fa-list-ol:before { content: "\f0cb"; } + .fa-strikethrough:before { content: "\f0cc"; } + .fa-underline:before { content: "\f0cd"; } + .fa-table:before { content: "\f0ce"; } + .fa-magic:before { content: "\f0d0"; } + .fa-truck:before { content: "\f0d1"; } + .fa-pinterest:before { content: "\f0d2"; } + .fa-pinterest-square:before { content: "\f0d3"; } + .fa-google-plus-square:before { content: "\f0d4"; } + .fa-google-plus:before { content: "\f0d5"; } + .fa-money:before { content: "\f0d6"; } + .fa-caret-down:before { content: "\f0d7"; } + .fa-caret-up:before { content: "\f0d8"; } + .fa-caret-left:before { content: "\f0d9"; } + .fa-caret-right:before { content: "\f0da"; } + .fa-columns:before { content: "\f0db"; } + .fa-unsorted:before, .fa-sort:before { content: "\f0dc"; } + .fa-sort-down:before, .fa-sort-desc:before { content: "\f0dd"; } + .fa-sort-up:before, .fa-sort-asc:before { content: "\f0de"; } + .fa-envelope:before { content: "\f0e0"; } + .fa-linkedin:before { content: "\f0e1"; } + .fa-rotate-left:before, .fa-undo:before { content: "\f0e2"; } + .fa-legal:before, .fa-gavel:before { content: "\f0e3"; } + .fa-dashboard:before, .fa-tachometer:before { content: "\f0e4"; } + .fa-comment-o:before { content: "\f0e5"; } + .fa-comments-o:before { content: "\f0e6"; } + .fa-flash:before, .fa-bolt:before { content: "\f0e7"; } + .fa-sitemap:before { content: "\f0e8"; } + .fa-umbrella:before { content: "\f0e9"; } + .fa-paste:before, .fa-clipboard:before { content: "\f0ea"; } + .fa-lightbulb-o:before { content: "\f0eb"; } + .fa-exchange:before { content: "\f0ec"; } + .fa-cloud-download:before { content: "\f0ed"; } + .fa-cloud-upload:before { content: "\f0ee"; } + .fa-user-md:before { content: "\f0f0"; } + .fa-stethoscope:before { content: "\f0f1"; } + .fa-suitcase:before { content: "\f0f2"; } + .fa-bell-o:before { content: "\f0a2"; } + .fa-coffee:before { content: "\f0f4"; } + .fa-cutlery:before { content: "\f0f5"; } + .fa-file-text-o:before { content: "\f0f6"; } + .fa-building-o:before { content: "\f0f7"; } + .fa-hospital-o:before { content: "\f0f8"; } + .fa-ambulance:before { content: "\f0f9"; } + .fa-medkit:before { content: "\f0fa"; } + .fa-fighter-jet:before { content: "\f0fb"; } + .fa-beer:before { content: "\f0fc"; } + .fa-h-square:before { content: "\f0fd"; } + .fa-plus-square:before { content: "\f0fe"; } + .fa-angle-double-left:before { content: "\f100"; } + .fa-angle-double-right:before { content: "\f101"; } + .fa-angle-double-up:before { content: "\f102"; } + .fa-angle-double-down:before { content: "\f103"; } + .fa-angle-left:before { content: "\f104"; } + .fa-angle-right:before { content: "\f105"; } + .fa-angle-up:before { content: "\f106"; } + .fa-angle-down:before { content: "\f107"; } + .fa-desktop:before { content: "\f108"; } + .fa-laptop:before { content: "\f109"; } + .fa-tablet:before { content: "\f10a"; } + .fa-mobile-phone:before, .fa-mobile:before { content: "\f10b"; } + .fa-circle-o:before { content: "\f10c"; } + .fa-quote-left:before { content: "\f10d"; } + .fa-quote-right:before { content: "\f10e"; } + .fa-spinner:before { content: "\f110"; } + .fa-circle:before { content: "\f111"; } + .fa-mail-reply:before, .fa-reply:before { content: "\f112"; } + .fa-github-alt:before { content: "\f113"; } + .fa-folder-o:before { content: "\f114"; } + .fa-folder-open-o:before { content: "\f115"; } + .fa-smile-o:before { content: "\f118"; } + .fa-frown-o:before { content: "\f119"; } + .fa-meh-o:before { content: "\f11a"; } + .fa-gamepad:before { content: "\f11b"; } + .fa-keyboard-o:before { content: "\f11c"; } + .fa-flag-o:before { content: "\f11d"; } + .fa-flag-checkered:before { content: "\f11e"; } + .fa-terminal:before { content: "\f120"; } + .fa-code:before { content: "\f121"; } + .fa-mail-reply-all:before, .fa-reply-all:before { content: "\f122"; } + .fa-star-half-empty:before, .fa-star-half-full:before, .fa-star-half-o:before { content: "\f123"; } + .fa-location-arrow:before { content: "\f124"; } + .fa-crop:before { content: "\f125"; } + .fa-code-fork:before { content: "\f126"; } + .fa-unlink:before, .fa-chain-broken:before { content: "\f127"; } + .fa-question:before { content: "\f128"; } + .fa-info:before { content: "\f129"; } + .fa-exclamation:before { content: "\f12a"; } + .fa-superscript:before { content: "\f12b"; } + .fa-subscript:before { content: "\f12c"; } + .fa-eraser:before { content: "\f12d"; } + .fa-puzzle-piece:before { content: "\f12e"; } + .fa-microphone:before { content: "\f130"; } + .fa-microphone-slash:before { content: "\f131"; } + .fa-shield:before { content: "\f132"; } + .fa-calendar-o:before { content: "\f133"; } + .fa-fire-extinguisher:before { content: "\f134"; } + .fa-rocket:before { content: "\f135"; } + .fa-maxcdn:before { content: "\f136"; } + .fa-chevron-circle-left:before { content: "\f137"; } + .fa-chevron-circle-right:before { content: "\f138"; } + .fa-chevron-circle-up:before { content: "\f139"; } + .fa-chevron-circle-down:before { content: "\f13a"; } + .fa-html5:before { content: "\f13b"; } + .fa-css3:before { content: "\f13c"; } + .fa-anchor:before { content: "\f13d"; } + .fa-unlock-alt:before { content: "\f13e"; } + .fa-bullseye:before { content: "\f140"; } + .fa-ellipsis-h:before { content: "\f141"; } + .fa-ellipsis-v:before { content: "\f142"; } + .fa-rss-square:before { content: "\f143"; } + .fa-play-circle:before { content: "\f144"; } + .fa-ticket:before { content: "\f145"; } + .fa-minus-square:before { content: "\f146"; } + .fa-minus-square-o:before { content: "\f147"; } + .fa-level-up:before { content: "\f148"; } + .fa-level-down:before { content: "\f149"; } + .fa-check-square:before { content: "\f14a"; } + .fa-pencil-square:before { content: "\f14b"; } + .fa-external-link-square:before { content: "\f14c"; } + .fa-share-square:before { content: "\f14d"; } + .fa-compass:before { content: "\f14e"; } + .fa-toggle-down:before, .fa-caret-square-o-down:before { content: "\f150"; } + .fa-toggle-up:before, .fa-caret-square-o-up:before { content: "\f151"; } + .fa-toggle-right:before, .fa-caret-square-o-right:before { content: "\f152"; } + .fa-euro:before, .fa-eur:before { content: "\f153"; } + .fa-gbp:before { content: "\f154"; } + .fa-dollar:before, .fa-usd:before { content: "\f155"; } + .fa-rupee:before, .fa-inr:before { content: "\f156"; } + .fa-cny:before, .fa-rmb:before, .fa-yen:before, .fa-jpy:before { content: "\f157"; } + .fa-ruble:before, .fa-rouble:before, .fa-rub:before { content: "\f158"; } + .fa-won:before, .fa-krw:before { content: "\f159"; } + .fa-bitcoin:before, .fa-btc:before { content: "\f15a"; } + .fa-file:before { content: "\f15b"; } + .fa-file-text:before { content: "\f15c"; } + .fa-sort-alpha-asc:before { content: "\f15d"; } + .fa-sort-alpha-desc:before { content: "\f15e"; } + .fa-sort-amount-asc:before { content: "\f160"; } + .fa-sort-amount-desc:before { content: "\f161"; } + .fa-sort-numeric-asc:before { content: "\f162"; } + .fa-sort-numeric-desc:before { content: "\f163"; } + .fa-thumbs-up:before { content: "\f164"; } + .fa-thumbs-down:before { content: "\f165"; } + .fa-youtube-square:before { content: "\f166"; } + .fa-youtube:before { content: "\f167"; } + .fa-xing:before { content: "\f168"; } + .fa-xing-square:before { content: "\f169"; } + .fa-youtube-play:before { content: "\f16a"; } + .fa-dropbox:before { content: "\f16b"; } + .fa-stack-overflow:before { content: "\f16c"; } + .fa-instagram:before { content: "\f16d"; } + .fa-flickr:before { content: "\f16e"; } + .fa-adn:before { content: "\f170"; } + .fa-bitbucket:before { content: "\f171"; } + .fa-bitbucket-square:before { content: "\f172"; } + .fa-tumblr:before { content: "\f173"; } + .fa-tumblr-square:before { content: "\f174"; } + .fa-long-arrow-down:before { content: "\f175"; } + .fa-long-arrow-up:before { content: "\f176"; } + .fa-long-arrow-left:before { content: "\f177"; } + .fa-long-arrow-right:before { content: "\f178"; } + .fa-apple:before { content: "\f179"; } + .fa-windows:before { content: "\f17a"; } + .fa-android:before { content: "\f17b"; } + .fa-linux:before { content: "\f17c"; } + .fa-dribbble:before { content: "\f17d"; } + .fa-skype:before { content: "\f17e"; } + .fa-foursquare:before { content: "\f180"; } + .fa-trello:before { content: "\f181"; } + .fa-female:before { content: "\f182"; } + .fa-male:before { content: "\f183"; } + .fa-gittip:before, .fa-gratipay:before { content: "\f184"; } + .fa-sun-o:before { content: "\f185"; } + .fa-moon-o:before { content: "\f186"; } + .fa-archive:before { content: "\f187"; } + .fa-bug:before { content: "\f188"; } + .fa-vk:before { content: "\f189"; } + .fa-weibo:before { content: "\f18a"; } + .fa-renren:before { content: "\f18b"; } + .fa-pagelines:before { content: "\f18c"; } + .fa-stack-exchange:before { content: "\f18d"; } + .fa-arrow-circle-o-right:before { content: "\f18e"; } + .fa-arrow-circle-o-left:before { content: "\f190"; } + .fa-toggle-left:before, .fa-caret-square-o-left:before { content: "\f191"; } + .fa-dot-circle-o:before { content: "\f192"; } + .fa-wheelchair:before { content: "\f193"; } + .fa-vimeo-square:before { content: "\f194"; } + .fa-turkish-lira:before, .fa-try:before { content: "\f195"; } + .fa-plus-square-o:before { content: "\f196"; } + .fa-space-shuttle:before { content: "\f197"; } + .fa-slack:before { content: "\f198"; } + .fa-envelope-square:before { content: "\f199"; } + .fa-wordpress:before { content: "\f19a"; } + .fa-openid:before { content: "\f19b"; } + .fa-institution:before, .fa-bank:before, .fa-university:before { content: "\f19c"; } + .fa-mortar-board:before, .fa-graduation-cap:before { content: "\f19d"; } + .fa-yahoo:before { content: "\f19e"; } + .fa-google:before { content: "\f1a0"; } + .fa-reddit:before { content: "\f1a1"; } + .fa-reddit-square:before { content: "\f1a2"; } + .fa-stumbleupon-circle:before { content: "\f1a3"; } + .fa-stumbleupon:before { content: "\f1a4"; } + .fa-delicious:before { content: "\f1a5"; } + .fa-digg:before { content: "\f1a6"; } + .fa-pied-piper:before { content: "\f1a7"; } + .fa-pied-piper-alt:before { content: "\f1a8"; } + .fa-drupal:before { content: "\f1a9"; } + .fa-joomla:before { content: "\f1aa"; } + .fa-language:before { content: "\f1ab"; } + .fa-fax:before { content: "\f1ac"; } + .fa-building:before { content: "\f1ad"; } + .fa-child:before { content: "\f1ae"; } + .fa-paw:before { content: "\f1b0"; } + .fa-spoon:before { content: "\f1b1"; } + .fa-cube:before { content: "\f1b2"; } + .fa-cubes:before { content: "\f1b3"; } + .fa-behance:before { content: "\f1b4"; } + .fa-behance-square:before { content: "\f1b5"; } + .fa-steam:before { content: "\f1b6"; } + .fa-steam-square:before { content: "\f1b7"; } + .fa-recycle:before { content: "\f1b8"; } + .fa-automobile:before, .fa-car:before { content: "\f1b9"; } + .fa-cab:before, .fa-taxi:before { content: "\f1ba"; } + .fa-tree:before { content: "\f1bb"; } + .fa-spotify:before { content: "\f1bc"; } + .fa-deviantart:before { content: "\f1bd"; } + .fa-soundcloud:before { content: "\f1be"; } + .fa-database:before { content: "\f1c0"; } + .fa-file-pdf-o:before { content: "\f1c1"; } + .fa-file-word-o:before { content: "\f1c2"; } + .fa-file-excel-o:before { content: "\f1c3"; } + .fa-file-powerpoint-o:before { content: "\f1c4"; } + .fa-file-photo-o:before, .fa-file-picture-o:before, .fa-file-image-o:before { content: "\f1c5"; } + .fa-file-zip-o:before, .fa-file-archive-o:before { content: "\f1c6"; } + .fa-file-sound-o:before, .fa-file-audio-o:before { content: "\f1c7"; } + .fa-file-movie-o:before, .fa-file-video-o:before { content: "\f1c8"; } + .fa-file-code-o:before { content: "\f1c9"; } + .fa-vine:before { content: "\f1ca"; } + .fa-codepen:before { content: "\f1cb"; } + .fa-jsfiddle:before { content: "\f1cc"; } + .fa-life-bouy:before, .fa-life-buoy:before, .fa-life-saver:before, @@ -1492,310 +1943,409 @@ .fa-life-ring:before { content: "\f1cd"; } + .fa-circle-o-notch:before { content: "\f1ce"; } + .fa-ra:before, .fa-rebel:before { content: "\f1d0"; } + .fa-ge:before, .fa-empire:before { content: "\f1d1"; } + .fa-git-square:before { content: "\f1d2"; } + .fa-git:before { content: "\f1d3"; } + .fa-hacker-news:before { content: "\f1d4"; } + .fa-tencent-weibo:before { content: "\f1d5"; } + .fa-qq:before { content: "\f1d6"; } + .fa-wechat:before, .fa-weixin:before { content: "\f1d7"; } + .fa-send:before, .fa-paper-plane:before { content: "\f1d8"; } + .fa-send-o:before, .fa-paper-plane-o:before { content: "\f1d9"; } + .fa-history:before { content: "\f1da"; } + .fa-genderless:before, .fa-circle-thin:before { content: "\f1db"; } + .fa-header:before { content: "\f1dc"; } + .fa-paragraph:before { content: "\f1dd"; } + .fa-sliders:before { content: "\f1de"; } + .fa-share-alt:before { content: "\f1e0"; } + .fa-share-alt-square:before { content: "\f1e1"; } + .fa-bomb:before { content: "\f1e2"; } + .fa-soccer-ball-o:before, .fa-futbol-o:before { content: "\f1e3"; } + .fa-tty:before { content: "\f1e4"; } + .fa-binoculars:before { content: "\f1e5"; } + .fa-plug:before { content: "\f1e6"; } + .fa-slideshare:before { content: "\f1e7"; } + .fa-twitch:before { content: "\f1e8"; } + .fa-yelp:before { content: "\f1e9"; } + .fa-newspaper-o:before { content: "\f1ea"; } + .fa-wifi:before { content: "\f1eb"; } + .fa-calculator:before { content: "\f1ec"; } + .fa-paypal:before { content: "\f1ed"; } + .fa-google-wallet:before { content: "\f1ee"; } + .fa-cc-visa:before { content: "\f1f0"; } + .fa-cc-mastercard:before { content: "\f1f1"; } + .fa-cc-discover:before { content: "\f1f2"; } + .fa-cc-amex:before { content: "\f1f3"; } + .fa-cc-paypal:before { content: "\f1f4"; } + .fa-cc-stripe:before { content: "\f1f5"; } + .fa-bell-slash:before { content: "\f1f6"; } + .fa-bell-slash-o:before { content: "\f1f7"; } + .fa-trash:before { content: "\f1f8"; } + .fa-copyright:before { content: "\f1f9"; } + .fa-at:before { content: "\f1fa"; } + .fa-eyedropper:before { content: "\f1fb"; } + .fa-paint-brush:before { content: "\f1fc"; } + .fa-birthday-cake:before { content: "\f1fd"; } + .fa-area-chart:before { content: "\f1fe"; } + .fa-pie-chart:before { content: "\f200"; } + .fa-line-chart:before { content: "\f201"; } + .fa-lastfm:before { content: "\f202"; } + .fa-lastfm-square:before { content: "\f203"; } + .fa-toggle-off:before { content: "\f204"; } + .fa-toggle-on:before { content: "\f205"; } + .fa-bicycle:before { content: "\f206"; } + .fa-bus:before { content: "\f207"; } + .fa-ioxhost:before { content: "\f208"; } + .fa-angellist:before { content: "\f209"; } + .fa-cc:before { content: "\f20a"; } + .fa-shekel:before, .fa-sheqel:before, .fa-ils:before { content: "\f20b"; } + .fa-meanpath:before { content: "\f20c"; } + .fa-buysellads:before { content: "\f20d"; } + .fa-connectdevelop:before { content: "\f20e"; } + .fa-dashcube:before { content: "\f210"; } + .fa-forumbee:before { content: "\f211"; } + .fa-leanpub:before { content: "\f212"; } + .fa-sellsy:before { content: "\f213"; } + .fa-shirtsinbulk:before { content: "\f214"; } + .fa-simplybuilt:before { content: "\f215"; } + .fa-skyatlas:before { content: "\f216"; } + .fa-cart-plus:before { content: "\f217"; } + .fa-cart-arrow-down:before { content: "\f218"; } + .fa-diamond:before { content: "\f219"; } + .fa-ship:before { content: "\f21a"; } + .fa-user-secret:before { content: "\f21b"; } + .fa-motorcycle:before { content: "\f21c"; } + .fa-street-view:before { content: "\f21d"; } + .fa-heartbeat:before { content: "\f21e"; } + .fa-venus:before { content: "\f221"; } + .fa-mars:before { content: "\f222"; } + .fa-mercury:before { content: "\f223"; } + .fa-transgender:before { content: "\f224"; } + .fa-transgender-alt:before { content: "\f225"; } + .fa-venus-double:before { content: "\f226"; } + .fa-mars-double:before { content: "\f227"; } + .fa-venus-mars:before { content: "\f228"; } + .fa-mars-stroke:before { content: "\f229"; } + .fa-mars-stroke-v:before { content: "\f22a"; } + .fa-mars-stroke-h:before { content: "\f22b"; } + .fa-neuter:before { content: "\f22c"; } + .fa-facebook-official:before { content: "\f230"; } + .fa-pinterest-p:before { content: "\f231"; } + .fa-whatsapp:before { content: "\f232"; } + .fa-server:before { content: "\f233"; } + .fa-user-plus:before { content: "\f234"; } + .fa-user-times:before { content: "\f235"; } + .fa-hotel:before, .fa-bed:before { content: "\f236"; } + .fa-viacoin:before { content: "\f237"; } + .fa-train:before { content: "\f238"; } + .fa-subway:before { content: "\f239"; } + .fa-medium:before { content: "\f23a"; } diff --git a/web/editor.md/scss/github-markdown.scss b/web/editor.md/scss/github-markdown.scss index 0d42686..5865132 100644 --- a/web/editor.md/scss/github-markdown.scss +++ b/web/editor.md/scss/github-markdown.scss @@ -216,11 +216,11 @@ content: '\f05c'; } -.markdown-body>*:first-child { +.markdown-body > *:first-child { margin-top: 0 !important; } -.markdown-body>*:last-child { +.markdown-body > *:last-child { margin-bottom: 0 !important; } @@ -348,6 +348,7 @@ margin-top: 0; margin-bottom: 16px; } + /* .markdown-body hr { height: 4px; @@ -370,7 +371,7 @@ margin-bottom: 0; } -.markdown-body li>p { +.markdown-body li > p { margin-top: 16px; } @@ -397,11 +398,11 @@ border-left: 4px solid #ddd; } -.markdown-body blockquote>:first-child { +.markdown-body blockquote > :first-child { margin-top: 0; } -.markdown-body blockquote>:last-child { +.markdown-body blockquote > :last-child { margin-bottom: 0; } @@ -444,7 +445,7 @@ padding-bottom: 0.2em; margin: 0; font-size: 85%; - background-color: rgba(0,0,0,0.04); + background-color: rgba(0, 0, 0, 0.04); border-radius: 3px; } @@ -454,7 +455,7 @@ content: "\00a0"; } -.markdown-body pre>code { +.markdown-body pre > code { padding: 0; margin: 0; font-size: 100%; @@ -648,7 +649,7 @@ list-style-type: none; } -.markdown-body .task-list-item+.task-list-item { +.markdown-body .task-list-item + .task-list-item { margin-top: 3px; } @@ -658,7 +659,7 @@ vertical-align: middle; } -.markdown-body :checked+.radio-label { +.markdown-body :checked + .radio-label { z-index: 1; position: relative; border-color: #4183c4; diff --git a/web/editor.md/scss/lib/prefixes.scss b/web/editor.md/scss/lib/prefixes.scss index 70a785d..29c99ac 100644 --- a/web/editor.md/scss/lib/prefixes.scss +++ b/web/editor.md/scss/lib/prefixes.scss @@ -5,780 +5,780 @@ // appearance @mixin appearance($value) { - -webkit-appearance: $value; - -moz-appearance: $value; - -ms-appearance: $value; - appearance: $value; + -webkit-appearance: $value; + -moz-appearance: $value; + -ms-appearance: $value; + appearance: $value; } // clearfix -@mixin clearfix() { - &:before, &:after { - content: " "; - display: table; - } - - &:after { - clear: both; - } +@mixin clearfix() { + &:before, &:after { + content: " "; + display: table; + } + + &:after { + clear: both; + } } // viewport @mixin viewport-device-width() { - width: device-width; - user-zoom: fixed; + width: device-width; + user-zoom: fixed; } @mixin viewport() { - @-webkit-viewport { - @include viewport-device-width(); - } - @-moz-viewport { - @include viewport-device-width(); - } - - @-ms-viewport { - @include viewport-device-width(); - } - - @-o-viewport { - @include viewport-device-width(); - } - - @viewport { - @include viewport-device-width(); - } + @-webkit-viewport { + @include viewport-device-width(); + } + @-moz-viewport { + @include viewport-device-width(); + } + + @-ms-viewport { + @include viewport-device-width(); + } + + @-o-viewport { + @include viewport-device-width(); + } + + @viewport { + @include viewport-device-width(); + } } // Transform @mixin transform($transform) { - -webkit-transform: $transform; /* Safari, Chrome */ - -moz-transform: $transform; /* Firefox 3.5~16.0 */ - -ms-transform: $transform; /* IE9~10 */ - -o-transform: $transform; /* Opera 10.5~12.10 */ - transform: $transform; + -webkit-transform: $transform; /* Safari, Chrome */ + -moz-transform: $transform; /* Firefox 3.5~16.0 */ + -ms-transform: $transform; /* IE9~10 */ + -o-transform: $transform; /* Opera 10.5~12.10 */ + transform: $transform; } @mixin transform-origin($origin) { - -webkit-transform-origin: $origin; - -moz-transform-origin: $origin; /* Firefox 3.5~16.0 */ - -ms-transform-origin: $origin; /* IE9~10 */ - -o-transform-origin: $origin; /* Opera 10.5~12.10 */ - transform-origin: $origin; + -webkit-transform-origin: $origin; + -moz-transform-origin: $origin; /* Firefox 3.5~16.0 */ + -ms-transform-origin: $origin; /* IE9~10 */ + -o-transform-origin: $origin; /* Opera 10.5~12.10 */ + transform-origin: $origin; } @mixin transform-origin-x($origin) { - -webkit-transform-origin-x: $origin; /* Blink, Webkit */ - transform-origin-x: $origin; /* IE11+ */ + -webkit-transform-origin-x: $origin; /* Blink, Webkit */ + transform-origin-x: $origin; /* IE11+ */ } @mixin transform-origin-y($origin) { - -webkit-transform-origin-y: $origin; /* Blink, Webkit */ - transform-origin-y: $origin; /* IE11+ */ + -webkit-transform-origin-y: $origin; /* Blink, Webkit */ + transform-origin-y: $origin; /* IE11+ */ } @mixin transform-origin-z($origin) { - -webkit-transform-origin-z: $origin; /* Blink, Webkit */ - transform-origin-z: $origin; /* IE11+ */ + -webkit-transform-origin-z: $origin; /* Blink, Webkit */ + transform-origin-z: $origin; /* IE11+ */ } @mixin transform-style($style) { - -webkit-transform-style: $style; - -moz-transform-style: $style; /* Firefox 10~16.0 */ - -ms-transform-style: $style; /* IE9~10 */ - transform-style: $style; /* Firefox, Blink, IE11+ */ + -webkit-transform-style: $style; + -moz-transform-style: $style; /* Firefox 10~16.0 */ + -ms-transform-style: $style; /* IE9~10 */ + transform-style: $style; /* Firefox, Blink, IE11+ */ } // perspective @mixin perspective($value) { - -webkit-perspective: $value; /* Safari, Chrome */ - perspective: $value; /* None yet / Non-standard */ + -webkit-perspective: $value; /* Safari, Chrome */ + perspective: $value; /* None yet / Non-standard */ } @mixin perspective-origin($value) { - -webkit-perspective-origin: $value; /* Safari, Chrome 12+ */ - -moz-perspective-origin: $value; /* Firefox 10~16 */ - perspective-origin: $value; /* Opera 15+, IE10+ */ + -webkit-perspective-origin: $value; /* Safari, Chrome 12+ */ + -moz-perspective-origin: $value; /* Firefox 10~16 */ + perspective-origin: $value; /* Opera 15+, IE10+ */ } @mixin perspective-origin-x($value) { - -webkit-perspective-origin-x: $value; /* Safari, Chrome 12+ */ - perspective-origin-x: $value; /* IE10+ */ + -webkit-perspective-origin-x: $value; /* Safari, Chrome 12+ */ + perspective-origin-x: $value; /* IE10+ */ } @mixin perspective-origin-y($value) { - -webkit-perspective-origin-y: $value; /* Safari, Chrome 12+ */ - perspective-origin-y: $value; /* IE10+ */ + -webkit-perspective-origin-y: $value; /* Safari, Chrome 12+ */ + perspective-origin-y: $value; /* IE10+ */ } @mixin backface-visibility($value : hidden) { - -webkit-backface-visibility: $value; /* Chrome, Safari, Opera 15+ */ - -moz-backface-visibility: $value; /* Firefox */ - -ms-backface-visibility: $value; /* IE10 */ - backface-visibility: $value; + -webkit-backface-visibility: $value; /* Chrome, Safari, Opera 15+ */ + -moz-backface-visibility: $value; /* Firefox */ + -ms-backface-visibility: $value; /* IE10 */ + backface-visibility: $value; } // Transitions IE10+ @mixin transition($transition...) { - -webkit-transition: $transition; /* Safari, Chrome */ - -moz-transition: $transition; /* Firefox 4.0~16.0 */ - transition: $transition; /* IE >9, FF >15, Opera >12.0 */ + -webkit-transition: $transition; /* Safari, Chrome */ + -moz-transition: $transition; /* Firefox 4.0~16.0 */ + transition: $transition; /* IE >9, FF >15, Opera >12.0 */ } @mixin transition-property($property) { - -webkit-transition-property: $property; - -moz-transition-property: $property; /* Firefox 4.0~16.0 */ - transition-property: $property; + -webkit-transition-property: $property; + -moz-transition-property: $property; /* Firefox 4.0~16.0 */ + transition-property: $property; } @mixin transition-duration($duration) { - -webkit-transition-duration: $duration; - -moz-transition-duration: $duration; /* Firefox 4.0~16.0 */ - transition-duration: $duration; + -webkit-transition-duration: $duration; + -moz-transition-duration: $duration; /* Firefox 4.0~16.0 */ + transition-duration: $duration; } @mixin transition-timing-function($easing) { - -webkit-transition-timing-function: $easing; - -moz-transition-timing-function: $easing; /* Firefox 4.0~16.0 */ - transition-timing-function: $easing; + -webkit-transition-timing-function: $easing; + -moz-transition-timing-function: $easing; /* Firefox 4.0~16.0 */ + transition-timing-function: $easing; } @mixin transition-delay($delay) { - -webkit-transition-delay: $delay; - -moz-transition-delay: $delay; /* Firefox 4.0~16.0 */ - transition-delay: $delay; + -webkit-transition-delay: $delay; + -moz-transition-delay: $delay; /* Firefox 4.0~16.0 */ + transition-delay: $delay; } // Flex align @mixin align-content($value) { - -webkit-align-content: $value; /* Chrome 21.0+, Safari Not supported. */ - align-content: $value; /* Firefox 28+, Opera 12.10, IE Not supported. */ + -webkit-align-content: $value; /* Chrome 21.0+, Safari Not supported. */ + align-content: $value; /* Firefox 28+, Opera 12.10, IE Not supported. */ } @mixin align-items($value) { - -webkit-align-items: $value; /* Safari 7.0+, Chrome 21.0+ */ - align-items: $value; /* Firefox 20.0+, IE11+, Opera 12.10 */ + -webkit-align-items: $value; /* Safari 7.0+, Chrome 21.0+ */ + align-items: $value; /* Firefox 20.0+, IE11+, Opera 12.10 */ } @mixin align-self($value) { - -webkit-align-self: $value; /* Chrome 21~36, Safari Not supported. */ - align-self: $value; /* Firefox 28+, Opera 12.10, IE Not supported. */ + -webkit-align-self: $value; /* Chrome 21~36, Safari Not supported. */ + align-self: $value; /* Firefox 28+, Opera 12.10, IE Not supported. */ } // Animations IE10+ @mixin keyframes($name) { - @-webkit-keyframes #{$name} { - @content; - } - - @-moz-keyframes #{$name} { - @content; - } - - @keyframes #{$name} { - @content; - } + @-webkit-keyframes #{$name} { + @content; + } + + @-moz-keyframes #{$name} { + @content; + } + + @keyframes #{$name} { + @content; + } } @mixin animation($animation...) { - -webkit-animation: $animation; - -moz-animation: $animation; /* Firefox 5.0~16.0 */ - animation: $animation; /* IE10+ */ + -webkit-animation: $animation; + -moz-animation: $animation; /* Firefox 5.0~16.0 */ + animation: $animation; /* IE10+ */ } @mixin animation-name($name) { - -webkit-animation-name: $name; - -moz-animation-name: $name; /* Firefox 5.0~16.0 */ - animation-name: $name; + -webkit-animation-name: $name; + -moz-animation-name: $name; /* Firefox 5.0~16.0 */ + animation-name: $name; } @mixin animation-duration($time : 1s) { - -webkit-animation-duration: $time; - -moz-animation-duration: $time; /* Firefox 5.0~16.0 */ - animation-duration: $time; + -webkit-animation-duration: $time; + -moz-animation-duration: $time; /* Firefox 5.0~16.0 */ + animation-duration: $time; } @mixin animation-timing-function($easing : ease) { - -webkit-animation-timing-function: $easing; - -moz-animation-timing-function: $easing; /* Firefox 5.0~16.0 */ - animation-timing-function: $easing; + -webkit-animation-timing-function: $easing; + -moz-animation-timing-function: $easing; /* Firefox 5.0~16.0 */ + animation-timing-function: $easing; } @mixin animation-delay($delay : 1s) { - -webkit-animation-delay: $delay; - -moz-animation-delay: $delay; /* Firefox 5.0~16.0 */ - animation-delay: $delay; + -webkit-animation-delay: $delay; + -moz-animation-delay: $delay; /* Firefox 5.0~16.0 */ + animation-delay: $delay; } @mixin animation-iteration-count($count : infinite) { - -webkit-animation-iteration-count: $count; - -moz-animation-iteration-count: $count; /* Firefox 5.0~16.0 */ - animation-iteration-count: $count; + -webkit-animation-iteration-count: $count; + -moz-animation-iteration-count: $count; /* Firefox 5.0~16.0 */ + animation-iteration-count: $count; } // normal or alternate @mixin animation-direction($direction : normal) { - -webkit-animation-direction: $direction; - -moz-animation-direction: $direction; /* Firefox 5.0~16.0 */ - animation-direction: $direction; + -webkit-animation-direction: $direction; + -moz-animation-direction: $direction; /* Firefox 5.0~16.0 */ + animation-direction: $direction; } // paused or running @mixin animation-play-state($state) { - -webkit-animation-play-state: $state; - -moz-animation-play-state: $state; /* Firefox 5.0~16.0 */ - animation-play-state: $state; + -webkit-animation-play-state: $state; + -moz-animation-play-state: $state; /* Firefox 5.0~16.0 */ + animation-play-state: $state; } // animation-fill-mode @mixin animation-fill-mode($mode) { - -webkit-animation-fill-mode: $mode; - -moz-animation-fill-mode: $mode; - animation-fill-mode: $mode; + -webkit-animation-fill-mode: $mode; + -moz-animation-fill-mode: $mode; + animation-fill-mode: $mode; } // user-select @mixin user-select($type) { - -webkit-user-select: $type; - -moz-user-select: $type; - -ms-user-select: $type; - -o-user-select: $type; - user-select: $type; + -webkit-user-select: $type; + -moz-user-select: $type; + -ms-user-select: $type; + -o-user-select: $type; + user-select: $type; } // border-radius -@mixin border-radius($radius: 4px) { - -webkit-border-radius: $radius; - -moz-border-radius: $radius; - -ms-border-radius: $radius; - -o-border-radius: $radius; - border-radius: $radius; +@mixin border-radius($radius: 4px) { + -webkit-border-radius: $radius; + -moz-border-radius: $radius; + -ms-border-radius: $radius; + -o-border-radius: $radius; + border-radius: $radius; } -@mixin border-top-left-radius($radius: 4px) { - -webkit-border-top-left-radius: $radius; - -moz-border-top-left-radius: $radius; - -ms-border-top-left-radius: $radius; - -o-border-top-left-radius: $radius; - border-top-left-radius: $radius; +@mixin border-top-left-radius($radius: 4px) { + -webkit-border-top-left-radius: $radius; + -moz-border-top-left-radius: $radius; + -ms-border-top-left-radius: $radius; + -o-border-top-left-radius: $radius; + border-top-left-radius: $radius; } -@mixin border-top-right-radius($radius: 4px) { - -webkit-border-top-right-radius: $radius; - -moz-border-top-right-radius: $radius; - -ms-border-top-right-radius: $radius; - -o-border-top-right-radius: $radius; - border-top-right-radius: $radius; +@mixin border-top-right-radius($radius: 4px) { + -webkit-border-top-right-radius: $radius; + -moz-border-top-right-radius: $radius; + -ms-border-top-right-radius: $radius; + -o-border-top-right-radius: $radius; + border-top-right-radius: $radius; } -@mixin border-bottom-left-radius($radius: 4px) { - -webkit-border-bottom-left-radius: $radius; - -moz-border-bottom-left-radius: $radius; - -ms-border-bottom-left-radius: $radius; - -o-border-bottom-left-radius: $radius; - border-bottom-left-radius: $radius; +@mixin border-bottom-left-radius($radius: 4px) { + -webkit-border-bottom-left-radius: $radius; + -moz-border-bottom-left-radius: $radius; + -ms-border-bottom-left-radius: $radius; + -o-border-bottom-left-radius: $radius; + border-bottom-left-radius: $radius; } -@mixin border-bottom-right-radius($radius: 4px) { - -webkit-border-bottom-right-radius: $radius; - -moz-border-bottom-right-radius: $radius; - -ms-border-bottom-right-radius: $radius; - -o-border-bottom-right-radius: $radius; - border-bottom-right-radius: $radius; +@mixin border-bottom-right-radius($radius: 4px) { + -webkit-border-bottom-right-radius: $radius; + -moz-border-bottom-right-radius: $radius; + -ms-border-bottom-right-radius: $radius; + -o-border-bottom-right-radius: $radius; + border-bottom-right-radius: $radius; } // border-image @mixin border-image($value) { - -webkit-border-image: $value; /* Safari 5, Chrome */ - -moz-border-image: $value; /* Firefox 3.5~15.0 */ - -o-border-image: $value; /* Opera */ - border-image: $value; /* Safari 6+, Chrome, New */ + -webkit-border-image: $value; /* Safari 5, Chrome */ + -moz-border-image: $value; /* Firefox 3.5~15.0 */ + -o-border-image: $value; /* Opera */ + border-image: $value; /* Safari 6+, Chrome, New */ } @mixin border-image-source($value) { - -webkit-border-image-source: $value; /* Safari 5, Chrome */ - border-image-source: $value; /* Safari 6+, Chrome, IE11+, Opera 15+ */ + -webkit-border-image-source: $value; /* Safari 5, Chrome */ + border-image-source: $value; /* Safari 6+, Chrome, IE11+, Opera 15+ */ } @mixin border-image-slice($value) { - -webkit-border-image-slice: $value; /* Safari 5, Chrome */ - border-image-slice: $value; /* Safari 6+, Chrome, IE11+, Opera 15+ */ + -webkit-border-image-slice: $value; /* Safari 5, Chrome */ + border-image-slice: $value; /* Safari 6+, Chrome, IE11+, Opera 15+ */ } @mixin border-image-width($value) { - -webkit-border-image-width: $value; /* Safari 5, Chrome */ - border-image-width: $value; /* Safari 6+, Chrome, IE11+, Opera 15+ */ + -webkit-border-image-width: $value; /* Safari 5, Chrome */ + border-image-width: $value; /* Safari 6+, Chrome, IE11+, Opera 15+ */ } @mixin border-image-outset($value) { - -webkit-border-image-outset: $value; /* Safari 5, Chrome */ - border-image-outset: $value; /* Safari 6+, Chrome, IE11+, Opera 15+ */ + -webkit-border-image-outset: $value; /* Safari 5, Chrome */ + border-image-outset: $value; /* Safari 6+, Chrome, IE11+, Opera 15+ */ } @mixin border-image-repeat($value) { - -webkit-border-image-repeat: $value; /* Safari 5, Chrome */ - border-image-repeat: $value; /* Safari 6+, Chrome, IE11+, Opera 15+ */ + -webkit-border-image-repeat: $value; /* Safari 5, Chrome */ + border-image-repeat: $value; /* Safari 6+, Chrome, IE11+, Opera 15+ */ } // box-shadow @mixin box-shadow($value) { - -webkit-box-shadow: $value; /* Webkit browsers */ - -moz-box-shadow: $value; /* Firefox */ - -ms-box-shadow: $value; /* IE9 */ - -o-box-shadow: $value; /* Opera(Old) */ - box-shadow: $value; /* IE9+, News */ + -webkit-box-shadow: $value; /* Webkit browsers */ + -moz-box-shadow: $value; /* Firefox */ + -ms-box-shadow: $value; /* IE9 */ + -o-box-shadow: $value; /* Opera(Old) */ + box-shadow: $value; /* IE9+, News */ } //box-sizing @mixin box-sizing($value) { - -webkit-box-sizing: $value; - -moz-box-sizing: $value; - box-sizing: $value; + -webkit-box-sizing: $value; + -moz-box-sizing: $value; + box-sizing: $value; } // box-reflect @mixin box-reflect($value) { - -webkit-box-reflect: $value; /* Chrome, Safari, iOS, Blackberry */ - box-reflect: $value; /* None yet / Non-standard */ + -webkit-box-reflect: $value; /* Chrome, Safari, iOS, Blackberry */ + box-reflect: $value; /* None yet / Non-standard */ } // background @mixin linear-gradient($start-color, $end-color, $position : top, $perStart : 0%, $perEnd : 100%) { - background: -webkit-linear-gradient($position, $start-color, $end-color); /* Webkit browsers */ - background: -moz-linear-gradient( $position, $start-color, $end-color); /* Firefox(old) */ - background: -o-linear-gradient( $position, $start-color, $end-color); /* Opera(old) */ - background: -ms-linear-gradient( $position, $start-color $perStart, $end-color $perEnd); /* IE10 */ - filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, start-colorstr=#{$start-color}, end-colorstr=#{$end-color}); /* IE9 */ - ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, start-colorstr=#{$start-color}, end-colorstr=#{$end-color})"; /* IE8 */ - background: linear-gradient( $position, $start-color $perStart, $end-color $perEnd); /* W3C */ + background: -webkit-linear-gradient($position, $start-color, $end-color); /* Webkit browsers */ + background: -moz-linear-gradient($position, $start-color, $end-color); /* Firefox(old) */ + background: -o-linear-gradient($position, $start-color, $end-color); /* Opera(old) */ + background: -ms-linear-gradient($position, $start-color $perStart, $end-color $perEnd); /* IE10 */ + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, start-colorstr=#{$start-color}, end-colorstr=#{$end-color}); /* IE9 */ + ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, start-colorstr=#{$start-color}, end-colorstr=#{$end-color})"; /* IE8 */ + background: linear-gradient($position, $start-color $perStart, $end-color $perEnd); /* W3C */ } @mixin background-clip($value) { - -webkit-background-clip: $value; - background-clip: $value; /* Firefox 4.0, IE9+, Opera 10.5+, Chrome, Safari 3.0+ */ + -webkit-background-clip: $value; + background-clip: $value; /* Firefox 4.0, IE9+, Opera 10.5+, Chrome, Safari 3.0+ */ } @mixin background-origin($value) { - -webkit-background-origin: $value; - background-origin: $value; /* IE9+, Other */ + -webkit-background-origin: $value; + background-origin: $value; /* IE9+, Other */ } @mixin background-size($value) { - -webkit-background-size: $value; /* Chrome, iOS, Safari */ - -moz-background-size: $value; /* Firefox 3.6~4.0 */ - -o-background-size: $value; /* Opera 9.5 */ - background-size: $value; /* IE9+, New */ + -webkit-background-size: $value; /* Chrome, iOS, Safari */ + -moz-background-size: $value; /* Firefox 3.6~4.0 */ + -o-background-size: $value; /* Opera 9.5 */ + background-size: $value; /* IE9+, New */ } // Column @mixin column-count($value) { -webkit-column-count: $value; /* Chrome, Safari, Android, Blackberry */ - -moz-column-count: $value; /* Firefox 34+ */ - column-count: $value; /* IE 10+, Opera 11.1+, New */ + -moz-column-count: $value; /* Firefox 34+ */ + column-count: $value; /* IE 10+, Opera 11.1+, New */ } @mixin column-gap($value) { - -webkit-column-gap: $value; /* Chrome, Safari, Android, Blackberry */ - -moz-column-gap: $value; /* Firefox 34+ */ - column-gap: $value; /* IE 10+, Opera 11.1+, New */ + -webkit-column-gap: $value; /* Chrome, Safari, Android, Blackberry */ + -moz-column-gap: $value; /* Firefox 34+ */ + column-gap: $value; /* IE 10+, Opera 11.1+, New */ } @mixin column-rule($value) { - -webkit-column-rule: $value; /* Chrome, Safari, Android, Blackberry */ - -moz-column-rule: $value; /* Firefox 34+ */ - column-rule: $value; /* IE 10+, Opera 11.1+, New */ + -webkit-column-rule: $value; /* Chrome, Safari, Android, Blackberry */ + -moz-column-rule: $value; /* Firefox 34+ */ + column-rule: $value; /* IE 10+, Opera 11.1+, New */ } @mixin column-rule-color($value) { - -webkit-column-rule-color: $value; /* Chrome, Safari, Android, Blackberry */ - -moz-column-rule-color: $value; /* Firefox 34+ */ - column-rule-color: $value; /* IE 10+, Opera 11.1+, New */ + -webkit-column-rule-color: $value; /* Chrome, Safari, Android, Blackberry */ + -moz-column-rule-color: $value; /* Firefox 34+ */ + column-rule-color: $value; /* IE 10+, Opera 11.1+, New */ } @mixin column-rule-style($value) { - -webkit-column-rule-style: $value; /* Chrome, Safari, Android, Blackberry */ - -moz-column-rule-style: $value; /* Firefox 34+ */ - column-rule-style: $value; /* IE 10+, Opera 11.1+, New */ + -webkit-column-rule-style: $value; /* Chrome, Safari, Android, Blackberry */ + -moz-column-rule-style: $value; /* Firefox 34+ */ + column-rule-style: $value; /* IE 10+, Opera 11.1+, New */ } @mixin column-rule-width($value) { - -webkit-column-rule-width: $value; /* Chrome, Safari, Android, Blackberry */ - -moz-column-rule-width: $value; /* Firefox 34+ */ - column-rule-width: $value; /* IE 10+, Opera 11.1+, New */ + -webkit-column-rule-width: $value; /* Chrome, Safari, Android, Blackberry */ + -moz-column-rule-width: $value; /* Firefox 34+ */ + column-rule-width: $value; /* IE 10+, Opera 11.1+, New */ } @mixin column-fill($value) { - -webkit-column-fill: $value; /* None yet */ - -moz-column-fill: $value; /* Firefox 13.0+ */ - column-fill: $value; /* None yet / Non-standard */ + -webkit-column-fill: $value; /* None yet */ + -moz-column-fill: $value; /* Firefox 13.0+ */ + column-fill: $value; /* None yet / Non-standard */ } @mixin column-span($value) { - -webkit-column-span: $value; /* Safari, Chrome, iOS 7.0+, Android, Opera 26+ */ - -moz-column-span: $value; /* Firefox 34+ */ - column-span: $value; /* IE10+, Opera Mini */ + -webkit-column-span: $value; /* Safari, Chrome, iOS 7.0+, Android, Opera 26+ */ + -moz-column-span: $value; /* Firefox 34+ */ + column-span: $value; /* IE10+, Opera Mini */ } @mixin column-width($value) { - -webkit-column-width: $value; /* Safari, Chrome, iOS 7.0+, Android, Opera 26+ */ - -moz-column-width: $value; /* Firefox */ - column-width: $value; /* IE10+, Opera */ + -webkit-column-width: $value; /* Safari, Chrome, iOS 7.0+, Android, Opera 26+ */ + -moz-column-width: $value; /* Firefox */ + column-width: $value; /* IE10+, Opera */ } // columns: column-width column-count; @mixin columns($value) { - -webkit-columns: $value; /* Safari, Chrome, iOS 7.0+, Android, Opera 26+ */ - -moz-columns: $value; /* Firefox */ - columns: $value; /* IE10+, Opera */ + -webkit-columns: $value; /* Safari, Chrome, iOS 7.0+, Android, Opera 26+ */ + -moz-columns: $value; /* Firefox */ + columns: $value; /* IE10+, Opera */ } // clip-path @mixin clip-path($value) { - -webkit-clip-path: $value; /* Chrome, iOS, Safari */ - clip-path: $value; + -webkit-clip-path: $value; /* Chrome, iOS, Safari */ + clip-path: $value; } // display @mixin display-grid() { - display: -ms-grid; /* IE 10 */ - display: grid; /* None yet */ + display: -ms-grid; /* IE 10 */ + display: grid; /* None yet */ } @mixin display-flex() { - display: -webkit-box; /* Old - iOS 6-, Safari 3.1~6, Blackberry 7 */ - display: -ms-flexbox; /* TWEENER - IE 10 */ - display: -webkit-flex; /* New - Safari 6.1+. iOS 7.1+, Blackberry 10 */ - display: flex; /* New, Spec - Firefox, Chrome, Opera */ + display: -webkit-box; /* Old - iOS 6-, Safari 3.1~6, Blackberry 7 */ + display: -ms-flexbox; /* TWEENER - IE 10 */ + display: -webkit-flex; /* New - Safari 6.1+. iOS 7.1+, Blackberry 10 */ + display: flex; /* New, Spec - Firefox, Chrome, Opera */ } @mixin inline-flex($value) { - -webkit-inline-flex: $value; /* Chrome 21.0+ */ - inline-flex: $value; /* Firefox 20+, Opera 12.5 */ + -webkit-inline-flex: $value; /* Chrome 21.0+ */ + inline-flex: $value; /* Firefox 20+, Opera 12.5 */ } @mixin flex($value) { - -webkit-box-flex: $value; /* Old - iOS 6-, Safari 3.1~6 */ - -webkit-flex: $value; /* Safari 6.1+. iOS 7.1+, Blackberry 10 */ - -ms-flex: $value; /* IE 10 */ - flex: $value; /* New, Spec - Firefox, Chrome, Opera */ + -webkit-box-flex: $value; /* Old - iOS 6-, Safari 3.1~6 */ + -webkit-flex: $value; /* Safari 6.1+. iOS 7.1+, Blackberry 10 */ + -ms-flex: $value; /* IE 10 */ + flex: $value; /* New, Spec - Firefox, Chrome, Opera */ } @mixin flex-direction($value) { - -webkit-flex-direction: $value; /* Chrome 21.0+, But Safari & Android & iOS Not supported. */ - flex-direction: $value; /* Firefox 28+, IE11, Opera 12.10 */ + -webkit-flex-direction: $value; /* Chrome 21.0+, But Safari & Android & iOS Not supported. */ + flex-direction: $value; /* Firefox 28+, IE11, Opera 12.10 */ } @mixin flex-basis($value) { - -webkit-flex-basis: $value; /* Chrome 21.0+, But Safari & Android & iOS Not supported. */ - flex-basis: $value; /* Firefox 22+, IE11, Opera 12.10 */ + -webkit-flex-basis: $value; /* Chrome 21.0+, But Safari & Android & iOS Not supported. */ + flex-basis: $value; /* Firefox 22+, IE11, Opera 12.10 */ } @mixin flex-flow($value) { - -webkit-flex-flow: $value; /* Chrome 21.0+, But Safari & Android & iOS Not supported. */ - flex-flow: $value; /* Firefox 28+, IE11, Opera 12.10 */ + -webkit-flex-flow: $value; /* Chrome 21.0+, But Safari & Android & iOS Not supported. */ + flex-flow: $value; /* Firefox 28+, IE11, Opera 12.10 */ } @mixin flex-grow($value) { - -webkit-flex-grow: $value; /* Chrome 21.0+, But Safari & Android & iOS Not supported. */ - flex-grow: $value; /* Firefox 20+, Opera 12.10, IE Not supported. */ + -webkit-flex-grow: $value; /* Chrome 21.0+, But Safari & Android & iOS Not supported. */ + flex-grow: $value; /* Firefox 20+, Opera 12.10, IE Not supported. */ } @mixin flex-shrink($value) { - -webkit-flex-shrink: $value; /* Chrome 21.0+, But Safari & Android & iOS Not supported. */ - flex-shrink: $value; /* Firefox 20+, Opera 12.10, IE Not supported. */ + -webkit-flex-shrink: $value; /* Chrome 21.0+, But Safari & Android & iOS Not supported. */ + flex-shrink: $value; /* Firefox 20+, Opera 12.10, IE Not supported. */ } @mixin flex-wrap($value) { - -webkit-flex-wrap: $value; /* Safari 6.1+, Chrome 21.0+, Android 4.4+, iOS 7.0+ */ - flex-wrap: $value; /* Firefox 28+, IE11, Opera 12.10 */ + -webkit-flex-wrap: $value; /* Safari 6.1+, Chrome 21.0+, Android 4.4+, iOS 7.0+ */ + flex-wrap: $value; /* Firefox 28+, IE11, Opera 12.10 */ } @mixin order($value) { - -webkit-order: $value; /* Chrome 21+, Safari Not supported. */ - -ms-flex-order: $value; /* IE 10.0 */ - order: $value; /* Firefox 20+, Opera 12.10 */ + -webkit-order: $value; /* Chrome 21+, Safari Not supported. */ + -ms-flex-order: $value; /* IE 10.0 */ + order: $value; /* Firefox 20+, Opera 12.10 */ } // flow @mixin flow-into($value) { - -webkit-flow-into: $value; /* Safari 7.1+, iOS Safari 7.1+ */ - -ms-flow-into: $value; /* IE10+ */ - flow-into: $value; /* None yet */ + -webkit-flow-into: $value; /* Safari 7.1+, iOS Safari 7.1+ */ + -ms-flow-into: $value; /* IE10+ */ + flow-into: $value; /* None yet */ } @mixin flow-from($value) { - -webkit-flow-from: $value; /* Safari 7.1+, iOS Safari 7.1+ */ - -ms-flow-from: $value; /* IE10+ */ - flow-from: $value; /* None yet */ + -webkit-flow-from: $value; /* Safari 7.1+, iOS Safari 7.1+ */ + -ms-flow-from: $value; /* IE10+ */ + flow-from: $value; /* None yet */ } // filter @mixin filter($value) { - -webkit-filter: $value; /* Chrome 23+, Safari 6.0+, Blackberry 10.0+ */ - filter: $value; /* None yet */ + -webkit-filter: $value; /* Chrome 23+, Safari 6.0+, Blackberry 10.0+ */ + filter: $value; /* None yet */ } // filter blur -@mixin filter-blur($value : 10px, $ie-value : 10) { - filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius=#{$ie-value}, MakeShadow=false); /* IE6~IE9 */ - -webkit-filter: blur($value); /* Chrome, Opera, iOS, Safari */ - -moz-filter: blur($value); /* Firefox(Old) */ - -ms-filter: blur($value); - filter: blur($value); +@mixin filter-blur($value : 10px, $ie-value : 10) { + filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius=#{$ie-value}, MakeShadow=false); /* IE6~IE9 */ + -webkit-filter: blur($value); /* Chrome, Opera, iOS, Safari */ + -moz-filter: blur($value); /* Firefox(Old) */ + -ms-filter: blur($value); + filter: blur($value); } @mixin font-kerning($value) { - -webkit-font-kerning: $value; - font-kerning: $value; + -webkit-font-kerning: $value; + font-kerning: $value; } // font-feature-settings @mixin font-feature-settings($value) { - -webkit-font-feature-settings: $value; /* Chrome 16-26, Blackberry 10 */ - -moz-font-feature-settings: $value; /* Firefox 4-21 */ - font-feature-settings: $value; /* IE 10, Safari 4.0-6.0 */ + -webkit-font-feature-settings: $value; /* Chrome 16-26, Blackberry 10 */ + -moz-font-feature-settings: $value; /* Firefox 4-21 */ + font-feature-settings: $value; /* IE 10, Safari 4.0-6.0 */ } @mixin font-variant-ligatures($value) { - -webkit-font-variant-ligatures: $value; - font-variant-ligatures: $value; + -webkit-font-variant-ligatures: $value; + font-variant-ligatures: $value; } // hyphens @mixin hyphens($value : auto) { - // Chrome 29- and Android 4.0 Browser support "-webkit-hyphens: none", but not the "auto" property. - -webkit-hyphens: $value; /* Safari 5.1+, Chrome */ - -moz-hyphens: $value; /* Firefox 6.0+ */ - -ms-hyphens: $value; /* IE 10+ */ - hyphens: $value; /* None yet */ + // Chrome 29- and Android 4.0 Browser support "-webkit-hyphens: none", but not the "auto" property. + -webkit-hyphens: $value; /* Safari 5.1+, Chrome */ + -moz-hyphens: $value; /* Firefox 6.0+ */ + -ms-hyphens: $value; /* IE 10+ */ + hyphens: $value; /* None yet */ } @mixin justify-content($value) { - -webkit-justify-content: $value; /* Chrome 21+, Safari Not supported. */ - justify-content: $value; /* Firefox 20+, Opera 12.10, IE Not supported. */ + -webkit-justify-content: $value; /* Chrome 21+, Safari Not supported. */ + justify-content: $value; /* Firefox 20+, Opera 12.10, IE Not supported. */ } // line @mixin line-break($value) { - -webkit-line-break: $value; - line-break: $value; + -webkit-line-break: $value; + line-break: $value; } // margin @mixin margin-start($value) { - -webkit-margin-start: $value; /* Safari 3.0+, Chrome */ - -moz-margin-start: $value; /* Firefox 1.0+ */ - margin-start: $value; /* None yet / Non-standard */ + -webkit-margin-start: $value; /* Safari 3.0+, Chrome */ + -moz-margin-start: $value; /* Firefox 1.0+ */ + margin-start: $value; /* None yet / Non-standard */ } @mixin margin-end($value) { - -webkit-margin-end: $value; /* Safari 3.0+, Chrome */ - -moz-margin-end: $value; /* Firefox 1.0+ */ - margin-end: $value; /* None yet / Non-standard */ + -webkit-margin-end: $value; /* Safari 3.0+, Chrome */ + -moz-margin-end: $value; /* Firefox 1.0+ */ + margin-end: $value; /* None yet / Non-standard */ } // mask @mixin mask-image($value) { - -webkit-mask-image: $value; /* Chrome, iOS, Safari */ - mask-image: $value; /* None yet / Non-standard */ + -webkit-mask-image: $value; /* Chrome, iOS, Safari */ + mask-image: $value; /* None yet / Non-standard */ } @mixin mask-size($value) { - -webkit-mask-size: $value; /* Chrome, iOS, Safari */ - mask-size: $value; /* None yet / Non-standard */ + -webkit-mask-size: $value; /* Chrome, iOS, Safari */ + mask-size: $value; /* None yet / Non-standard */ } @mixin mask-clip($value) { - -webkit-mask-clip: $value; /* Chrome, iOS, Safari */ - mask-clip: $value; /* None yet / Non-standard */ + -webkit-mask-clip: $value; /* Chrome, iOS, Safari */ + mask-clip: $value; /* None yet / Non-standard */ } @mixin mask-position($value) { - -webkit-mask-position: $value; /* Chrome, iOS, Safari */ - mask-position: $value; /* None yet / Non-standard */ + -webkit-mask-position: $value; /* Chrome, iOS, Safari */ + mask-position: $value; /* None yet / Non-standard */ } @mixin mask-position-x($value) { - -webkit-mask-position-x: $value; /* Chrome, iOS, Safari */ - mask-position-x: $value; /* None yet / Non-standard */ + -webkit-mask-position-x: $value; /* Chrome, iOS, Safari */ + mask-position-x: $value; /* None yet / Non-standard */ } @mixin mask-position-y($value) { - -webkit-mask-position-y: $value; /* Chrome, iOS, Safari */ - mask-position-y: $value; /* None yet / Non-standard */ + -webkit-mask-position-y: $value; /* Chrome, iOS, Safari */ + mask-position-y: $value; /* None yet / Non-standard */ } @mixin mask-origin($value) { - -webkit-mask-origin: $value; /* Chrome, iOS, Safari */ - mask-origin: $value; /* None yet / Non-standard */ + -webkit-mask-origin: $value; /* Chrome, iOS, Safari */ + mask-origin: $value; /* None yet / Non-standard */ } @mixin mask-repeat($value) { - -webkit-mask-repeat: $value; /* Chrome, iOS, Safari */ - mask-repeat: $value; /* None yet / Non-standard */ + -webkit-mask-repeat: $value; /* Chrome, iOS, Safari */ + mask-repeat: $value; /* None yet / Non-standard */ } @mixin mask-attachment($value) { - -webkit-mask-attachment: $value; /* Chrome, iOS, Safari */ - mask-attachment: $value; /* None yet / Non-standard */ + -webkit-mask-attachment: $value; /* Chrome, iOS, Safari */ + mask-attachment: $value; /* None yet / Non-standard */ } @mixin mask-composite($value) { - -webkit-mask-composite: $value; /* Chrome, iOS, Safari */ - mask-composite: $value; /* None yet / Non-standard */ + -webkit-mask-composite: $value; /* Chrome, iOS, Safari */ + mask-composite: $value; /* None yet / Non-standard */ } @mixin mask-box-image($value) { - -webkit-mask-box-image: $value; /* Chrome, iOS, Safari */ - mask-box-image: $value; /* None yet / Non-standard */ + -webkit-mask-box-image: $value; /* Chrome, iOS, Safari */ + mask-box-image: $value; /* None yet / Non-standard */ } // opacity @mixin opacity($opacity) { - opacity: $opacity; /* W3C */ - filter: alpha(opacity=($opacity * 100)); /* IE */ + opacity: $opacity; /* W3C */ + filter: alpha(opacity=($opacity * 100)); /* IE */ } // padding @mixin padding-start($value) { - -webkit-padding-start: $value; /* Safari, Chrome, WebKit */ - -moz-padding-start: $value; /* Firefox 3+ */ - padding-start: $value; + -webkit-padding-start: $value; /* Safari, Chrome, WebKit */ + -moz-padding-start: $value; /* Firefox 3+ */ + padding-start: $value; } @mixin padding-end($value) { - -webkit-padding-end: $value; /* Safari, Chrome, WebKit */ - -moz-padding-end: $value; /* Firefox 3+ */ - padding-end: $value; + -webkit-padding-end: $value; /* Safari, Chrome, WebKit */ + -moz-padding-end: $value; /* Firefox 3+ */ + padding-end: $value; } // ruby-position @mixin ruby-position($value) { - -webkit-ruby-position: $value; /* Blink, Webkit */ - ruby-position: $value; /* Firefox, IE */ + -webkit-ruby-position: $value; /* Blink, Webkit */ + ruby-position: $value; /* Firefox, IE */ } // Text @mixin text-size-adjust($value) { - -webkit-text-size-adjust: $value; /* Chrome 27+ */ - -moz-text-size-adjust: $value; /* Firefox */ - text-size-adjust: $value; /* None yet */ + -webkit-text-size-adjust: $value; /* Chrome 27+ */ + -moz-text-size-adjust: $value; /* Firefox */ + text-size-adjust: $value; /* None yet */ } @mixin text-align-last($value) { - -webkit-text-align-last: $value; /* Chrome 35+, Safari Not supported. */ - -moz-text-align-last: $value; /* Firefox 12.0 */ - text-align-last: $value; /* IE 5.5+ */ + -webkit-text-align-last: $value; /* Chrome 35+, Safari Not supported. */ + -moz-text-align-last: $value; /* Firefox 12.0 */ + text-align-last: $value; /* IE 5.5+ */ } @mixin text-justify($value) { - -webkit-text-justify: $value; - text-justify: $value; + -webkit-text-justify: $value; + text-justify: $value; } @mixin text-decoration-color($value) { - -webkit-text-decoration-color: $value; - text-decoration-color: $value; + -webkit-text-decoration-color: $value; + text-decoration-color: $value; } @mixin text-decoration-line($value) { - -webkit-text-decoration-line: $value; - text-decoration-line: $value; + -webkit-text-decoration-line: $value; + text-decoration-line: $value; } @mixin text-decoration-style($value) { - -webkit-text-decoration-style: $value; - text-decoration-style: $value; + -webkit-text-decoration-style: $value; + text-decoration-style: $value; } @mixin text-orientation($value) { - -webkit-text-orientation: $value; - text-orientation: $value; + -webkit-text-orientation: $value; + text-orientation: $value; } @mixin text-underline-position($value) { - -webkit-text-underline-position: $value; /* Chrome 33 not fully supported. */ - text-underline-position: $value; /* IE 5 not fully supported. */ + -webkit-text-underline-position: $value; /* Chrome 33 not fully supported. */ + text-underline-position: $value; /* IE 5 not fully supported. */ } @mixin text-emphasis($value) { - -webkit-text-emphasis: $value; /* Blink */ - text-emphasis: $value; /* WebKit */ + -webkit-text-emphasis: $value; /* Blink */ + text-emphasis: $value; /* WebKit */ } @mixin text-emphasis-color($value) { - -webkit-text-emphasis-color: $value; /* Blink */ - text-emphasis-color: $value; /* WebKit */ + -webkit-text-emphasis-color: $value; /* Blink */ + text-emphasis-color: $value; /* WebKit */ } @mixin text-emphasis-style($value) { - -webkit-text-emphasis-style: $value; /* Blink */ - text-emphasis-style: $value; /* WebKit */ + -webkit-text-emphasis-style: $value; /* Blink */ + text-emphasis-style: $value; /* WebKit */ } @mixin text-emphasis-position($value) { - -webkit-text-emphasis-position: $value; /* Blink */ - text-emphasis-position: $value; /* WebKit */ + -webkit-text-emphasis-position: $value; /* Blink */ + text-emphasis-position: $value; /* WebKit */ } // tab @mixin tab-size($value) { - -webkit-tab-size: $value; /* Chrome 21+, Safari 6.1+ */ - -moz-tab-size: $value; /* Firefox 4.0 */ - -o-tab-size: $value; /* Opera 10.6~15 */ - tab-size: $value; /* Blink & Webkit */ + -webkit-tab-size: $value; /* Chrome 21+, Safari 6.1+ */ + -moz-tab-size: $value; /* Firefox 4.0 */ + -o-tab-size: $value; /* Opera 10.6~15 */ + tab-size: $value; /* Blink & Webkit */ } // input-placeholder @mixin input-placeholder($seletor) { - - #{$seletor}::-webkit-input-placeholder { - @content; - } - - #{$seletor}:-moz-placeholder { /* Firefox 4~18 */ - @content; - } - - #{$seletor}::-moz-placeholder { /* Firefox 19+ */ - @content; - } - - #{$seletor}:-ms-input-placeholder { /* IE10+ */ - @content; - } + + #{$seletor}::-webkit-input-placeholder { + @content; + } + + #{$seletor}:-moz-placeholder { /* Firefox 4~18 */ + @content; + } + + #{$seletor}::-moz-placeholder { /* Firefox 19+ */ + @content; + } + + #{$seletor}:-ms-input-placeholder { /* IE10+ */ + @content; + } } \ No newline at end of file diff --git a/web/editor.md/scss/lib/variables.scss b/web/editor.md/scss/lib/variables.scss index 4e21a7b..4b53d16 100644 --- a/web/editor.md/scss/lib/variables.scss +++ b/web/editor.md/scss/lib/variables.scss @@ -2,10 +2,10 @@ // Global Variables -$prefix : ".editormd-"; -$color : #666; -$mainColor : #2196F3; -$primaryColor : $mainColor; -$secondColor : #33CC66; -$thirdColor : #999999; -$borderColor : #ddd; \ No newline at end of file +$prefix: ".editormd-"; +$color: #666; +$mainColor: #2196F3; +$primaryColor: $mainColor; +$secondColor: #33CC66; +$thirdColor: #999999; +$borderColor: #ddd; \ No newline at end of file diff --git a/web/editor.md/scss/prettify.scss b/web/editor.md/scss/prettify.scss index c50bbe0..3c34307 100644 --- a/web/editor.md/scss/prettify.scss +++ b/web/editor.md/scss/prettify.scss @@ -2,41 +2,107 @@ /*! Pretty printing styles. Used with prettify.js. */ /* SPAN elements with the classes below are added by prettyprint. */ -.pln { color: #000 } /* plain text */ +.pln { + color: #000 +} + +/* plain text */ @media screen { - .str { color: #080 } /* string content */ - .kwd { color: #008 } /* a keyword */ - .com { color: #800 } /* a comment */ - .typ { color: #606 } /* a type name */ - .lit { color: #066 } /* a literal value */ + .str { + color: #080 + } + /* string content */ + .kwd { + color: #008 + } + /* a keyword */ + .com { + color: #800 + } + /* a comment */ + .typ { + color: #606 + } + /* a type name */ + .lit { + color: #066 + } + /* a literal value */ /* punctuation, lisp open bracket, lisp close bracket */ - .pun, .opn, .clo { color: #660 } - .tag { color: #008 } /* a markup tag name */ - .atn { color: #606 } /* a markup attribute name */ - .atv { color: #080 } /* a markup attribute value */ - .dec, .var { color: #606 } /* a declaration; a variable name */ - .fun { color: red } /* a function name */ + .pun, .opn, .clo { + color: #660 + } + .tag { + color: #008 + } + /* a markup tag name */ + .atn { + color: #606 + } + /* a markup attribute name */ + .atv { + color: #080 + } + /* a markup attribute value */ + .dec, .var { + color: #606 + } + /* a declaration; a variable name */ + .fun { + color: red + } + /* a function name */ } /* Use higher contrast and text-weight for printable form. */ @media print, projection { - .str { color: #060 } - .kwd { color: #006; font-weight: bold } - .com { color: #600; font-style: italic } - .typ { color: #404; font-weight: bold } - .lit { color: #044 } - .pun, .opn, .clo { color: #440 } - .tag { color: #006; font-weight: bold } - .atn { color: #404 } - .atv { color: #060 } + .str { + color: #060 + } + .kwd { + color: #006; + font-weight: bold + } + .com { + color: #600; + font-style: italic + } + .typ { + color: #404; + font-weight: bold + } + .lit { + color: #044 + } + .pun, .opn, .clo { + color: #440 + } + .tag { + color: #006; + font-weight: bold + } + .atn { + color: #404 + } + .atv { + color: #060 + } } /* Put a border around prettyprinted code snippets. */ -pre.prettyprint { padding: 2px; border: 1px solid #888 } +pre.prettyprint { + padding: 2px; + border: 1px solid #888 +} /* Specify class=linenums on a pre to get line numbering */ -ol.linenums { margin-top: 0; margin-bottom: 0 } /* IE indents via margin-left */ +ol.linenums { + margin-top: 0; + margin-bottom: 0 +} + +/* IE indents via margin-left */ li.L0, li.L1, li.L2, @@ -44,10 +110,15 @@ li.L3, li.L5, li.L6, li.L7, -li.L8 { list-style-type: none } +li.L8 { + list-style-type: none +} + /* Alternate shading for lines */ li.L1, li.L3, li.L5, li.L7, -li.L9 { background: #eee } \ No newline at end of file +li.L9 { + background: #eee +} \ No newline at end of file diff --git a/web/editor.md/src/editormd.js b/web/editor.md/src/editormd.js index 7873818..df764c7 100644 --- a/web/editor.md/src/editormd.js +++ b/web/editor.md/src/editormd.js @@ -1,524 +1,506 @@ -;(function(factory) { +;(function (factory) { "use strict"; - - // CommonJS/Node.js - if (typeof require === "function" && typeof exports === "object" && typeof module === "object") - { + + // CommonJS/Node.js + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { module.exports = factory; - } - else if (typeof define === "function") // AMD/CMD/Sea.js - { + } else if (typeof define === "function") // AMD/CMD/Sea.js + { if (define.amd) // for Require.js { /* Require.js define replace */ - } - else - { - define(["jquery"], factory); // for Sea.js + } else { + define(["jquery"], factory); // for Sea.js } - } - else - { + } else { window.editormd = factory(); - } - -}(function() { + } + +}(function () { /* Require.js assignment replace */ - + "use strict"; - + var $ = (typeof (jQuery) !== "undefined") ? jQuery : Zepto; - if (typeof ($) === "undefined") { - return ; - } - + if (typeof ($) === "undefined") { + return; + } + /** * editormd - * + * * @param {String} id 编辑器的ID * @param {Object} options 配置选项 Key/Value * @returns {Object} editormd 返回editormd对象 */ - - var editormd = function (id, options) { + + var editormd = function (id, options) { return new editormd.fn.init(id, options); }; - - editormd.title = editormd.$name = "Editor.md"; - editormd.version = "1.5.0"; - editormd.homePage = "https://pandao.github.io/editor.md/"; - editormd.classPrefix = "editormd-"; - + + editormd.title = editormd.$name = "Editor.md"; + editormd.version = "1.5.0"; + editormd.homePage = "https://pandao.github.io/editor.md/"; + editormd.classPrefix = "editormd-"; + editormd.toolbarModes = { - full : [ - "undo", "redo", "|", - "bold", "del", "italic", "quote", "ucwords", "uppercase", "lowercase", "|", - "h1", "h2", "h3", "h4", "h5", "h6", "|", + full: [ + "undo", "redo", "|", + "bold", "del", "italic", "quote", "ucwords", "uppercase", "lowercase", "|", + "h1", "h2", "h3", "h4", "h5", "h6", "|", "list-ul", "list-ol", "hr", "|", "link", "reference-link", "image", "code", "preformatted-text", "code-block", "table", "datetime", "emoji", "html-entities", "pagebreak", "|", "goto-line", "watch", "preview", "fullscreen", "clear", "search", "|", "help", "info" ], - simple : [ - "undo", "redo", "|", - "bold", "del", "italic", "quote", "uppercase", "lowercase", "|", - "h1", "h2", "h3", "h4", "h5", "h6", "|", + simple: [ + "undo", "redo", "|", + "bold", "del", "italic", "quote", "uppercase", "lowercase", "|", + "h1", "h2", "h3", "h4", "h5", "h6", "|", "list-ul", "list-ol", "hr", "|", "watch", "preview", "fullscreen", "|", "help", "info" ], - mini : [ + mini: [ "undo", "redo", "|", "watch", "preview", "|", "help", "info" ] }; - - editormd.defaults = { - mode : "gfm", //gfm or markdown - name : "", // Form element name - value : "", // value for CodeMirror, if mode not gfm/markdown - theme : "", // Editor.md self themes, before v1.5.0 is CodeMirror theme, default empty - editorTheme : "default", // Editor area, this is CodeMirror theme at v1.5.0 - previewTheme : "", // Preview area theme, default empty - markdown : "", // Markdown source code - appendMarkdown : "", // if in init textarea value not empty, append markdown to textarea - width : "100%", - height : "100%", - path : "./lib/", // Dependents module file directory - pluginPath : "", // If this empty, default use settings.path + "../plugins/" - delay : 300, // Delay parse markdown to html, Uint : ms - autoLoadModules : true, // Automatic load dependent module files - watch : true, - placeholder : "Enjoy Markdown! coding now...", - gotoLine : true, - codeFold : false, - autoHeight : false, - autoFocus : true, - autoCloseTags : true, - searchReplace : true, - syncScrolling : true, // true | false | "single", default true - readOnly : false, - tabSize : 4, - indentUnit : 4, - lineNumbers : true, - lineWrapping : true, - autoCloseBrackets : true, - showTrailingSpace : true, - matchBrackets : true, - indentWithTabs : true, - styleSelectedText : true, - matchWordHighlight : true, // options: true, false, "onselected" - styleActiveLine : true, // Highlight the current line - dialogLockScreen : true, - dialogShowMask : true, - dialogDraggable : true, - dialogMaskBgColor : "#fff", - dialogMaskOpacity : 0.1, - fontSize : "13px", - saveHTMLToTextarea : false, - disabledKeyMaps : [], - - onload : function() {}, - onresize : function() {}, - onchange : function() {}, - onwatch : null, - onunwatch : null, - onpreviewing : function() {}, - onpreviewed : function() {}, - onfullscreen : function() {}, - onfullscreenExit : function() {}, - onscroll : function() {}, - onpreviewscroll : function() {}, - - imageUpload : false, - imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"], - imageUploadURL : "", - crossDomainUpload : false, - uploadCallbackURL : "", - - toc : true, // Table of contents - tocm : false, // Using [TOCM], auto create ToC dropdown menu - tocTitle : "", // for ToC dropdown menu btn - tocDropdown : false, - tocContainer : "", - tocStartLevel : 1, // Said from H1 to create ToC - htmlDecode : false, // Open the HTML tag identification - pageBreak : true, // Enable parse page break [========] - atLink : true, // for @link - emailLink : true, // for email address auto link - taskList : false, // Enable Github Flavored Markdown task lists - emoji : false, // :emoji: , Support Github emoji, Twitter Emoji (Twemoji); - // Support FontAwesome icon emoji :fa-xxx: > Using fontAwesome icon web fonts; - // Support Editor.md logo icon emoji :editormd-logo: :editormd-logo-1x: > 1~8x; - tex : false, // TeX(LaTeX), based on KaTeX - flowChart : false, // flowChart.js only support IE9+ - sequenceDiagram : false, // sequenceDiagram.js only support IE9+ - previewCodeHighlight : true, - - toolbar : true, // show/hide toolbar - toolbarAutoFixed : true, // on window scroll auto fixed position - toolbarIcons : "full", - toolbarTitles : {}, - toolbarHandlers : { - ucwords : function() { + + editormd.defaults = { + mode: "gfm", //gfm or markdown + name: "", // Form element name + value: "", // value for CodeMirror, if mode not gfm/markdown + theme: "", // Editor.md self themes, before v1.5.0 is CodeMirror theme, default empty + editorTheme: "default", // Editor area, this is CodeMirror theme at v1.5.0 + previewTheme: "", // Preview area theme, default empty + markdown: "", // Markdown source code + appendMarkdown: "", // if in init textarea value not empty, append markdown to textarea + width: "100%", + height: "100%", + path: "./lib/", // Dependents module file directory + pluginPath: "", // If this empty, default use settings.path + "../plugins/" + delay: 300, // Delay parse markdown to html, Uint : ms + autoLoadModules: true, // Automatic load dependent module files + watch: true, + placeholder: "Enjoy Markdown! coding now...", + gotoLine: true, + codeFold: false, + autoHeight: false, + autoFocus: true, + autoCloseTags: true, + searchReplace: true, + syncScrolling: true, // true | false | "single", default true + readOnly: false, + tabSize: 4, + indentUnit: 4, + lineNumbers: true, + lineWrapping: true, + autoCloseBrackets: true, + showTrailingSpace: true, + matchBrackets: true, + indentWithTabs: true, + styleSelectedText: true, + matchWordHighlight: true, // options: true, false, "onselected" + styleActiveLine: true, // Highlight the current line + dialogLockScreen: true, + dialogShowMask: true, + dialogDraggable: true, + dialogMaskBgColor: "#fff", + dialogMaskOpacity: 0.1, + fontSize: "13px", + saveHTMLToTextarea: false, + disabledKeyMaps: [], + + onload: function () { + }, + onresize: function () { + }, + onchange: function () { + }, + onwatch: null, + onunwatch: null, + onpreviewing: function () { + }, + onpreviewed: function () { + }, + onfullscreen: function () { + }, + onfullscreenExit: function () { + }, + onscroll: function () { + }, + onpreviewscroll: function () { + }, + + imageUpload: false, + imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"], + imageUploadURL: "", + crossDomainUpload: false, + uploadCallbackURL: "", + + toc: true, // Table of contents + tocm: false, // Using [TOCM], auto create ToC dropdown menu + tocTitle: "", // for ToC dropdown menu btn + tocDropdown: false, + tocContainer: "", + tocStartLevel: 1, // Said from H1 to create ToC + htmlDecode: false, // Open the HTML tag identification + pageBreak: true, // Enable parse page break [========] + atLink: true, // for @link + emailLink: true, // for email address auto link + taskList: false, // Enable Github Flavored Markdown task lists + emoji: false, // :emoji: , Support Github emoji, Twitter Emoji (Twemoji); + // Support FontAwesome icon emoji :fa-xxx: > Using fontAwesome icon web fonts; + // Support Editor.md logo icon emoji :editormd-logo: :editormd-logo-1x: > 1~8x; + tex: false, // TeX(LaTeX), based on KaTeX + flowChart: false, // flowChart.js only support IE9+ + sequenceDiagram: false, // sequenceDiagram.js only support IE9+ + previewCodeHighlight: true, + + toolbar: true, // show/hide toolbar + toolbarAutoFixed: true, // on window scroll auto fixed position + toolbarIcons: "full", + toolbarTitles: {}, + toolbarHandlers: { + ucwords: function () { return editormd.toolbarHandlers.ucwords; }, - lowercase : function() { + lowercase: function () { return editormd.toolbarHandlers.lowercase; } }, - toolbarCustomIcons : { // using html tag create toolbar icon, unused default tag. - lowercase : "a", - "ucwords" : "Aa" - }, - toolbarIconsClass : { - undo : "fa-undo", - redo : "fa-repeat", - bold : "fa-bold", - del : "fa-strikethrough", - italic : "fa-italic", - quote : "fa-quote-left", - uppercase : "fa-font", - h1 : editormd.classPrefix + "bold", - h2 : editormd.classPrefix + "bold", - h3 : editormd.classPrefix + "bold", - h4 : editormd.classPrefix + "bold", - h5 : editormd.classPrefix + "bold", - h6 : editormd.classPrefix + "bold", - "list-ul" : "fa-list-ul", - "list-ol" : "fa-list-ol", - hr : "fa-minus", - link : "fa-link", - "reference-link" : "fa-anchor", - image : "fa-picture-o", - code : "fa-code", - "preformatted-text" : "fa-file-code-o", - "code-block" : "fa-file-code-o", - table : "fa-table", - datetime : "fa-clock-o", - emoji : "fa-smile-o", - "html-entities" : "fa-copyright", - pagebreak : "fa-newspaper-o", - "goto-line" : "fa-terminal", // fa-crosshairs - watch : "fa-eye-slash", - unwatch : "fa-eye", - preview : "fa-desktop", - search : "fa-search", - fullscreen : "fa-arrows-alt", - clear : "fa-eraser", - help : "fa-question-circle", - info : "fa-info-circle" - }, - toolbarIconTexts : {}, - - lang : { - name : "zh-cn", - description : "开源在线Markdown编辑器
    Open source online Markdown editor.", - tocTitle : "目录", - toolbar : { - undo : "撤销(Ctrl+Z)", - redo : "重做(Ctrl+Y)", - bold : "粗体", - del : "删除线", - italic : "斜体", - quote : "引用", - ucwords : "将每个单词首字母转成大写", - uppercase : "将所选转换成大写", - lowercase : "将所选转换成小写", - h1 : "标题1", - h2 : "标题2", - h3 : "标题3", - h4 : "标题4", - h5 : "标题5", - h6 : "标题6", - "list-ul" : "无序列表", - "list-ol" : "有序列表", - hr : "横线", - link : "链接", - "reference-link" : "引用链接", - image : "添加图片", - code : "行内代码", - "preformatted-text" : "预格式文本 / 代码块(缩进风格)", - "code-block" : "代码块(多语言风格)", - table : "添加表格", - datetime : "日期时间", - emoji : "Emoji表情", - "html-entities" : "HTML实体字符", - pagebreak : "插入分页符", - "goto-line" : "跳转到行", - watch : "关闭实时预览", - unwatch : "开启实时预览", - preview : "全窗口预览HTML(按 Shift + ESC还原)", - fullscreen : "全屏(按ESC还原)", - clear : "清空", - search : "搜索", - help : "使用帮助", - info : "关于" + editormd.title + toolbarCustomIcons: { // using html tag create toolbar icon, unused default tag. + lowercase: "a", + "ucwords": "Aa" + }, + toolbarIconsClass: { + undo: "fa-undo", + redo: "fa-repeat", + bold: "fa-bold", + del: "fa-strikethrough", + italic: "fa-italic", + quote: "fa-quote-left", + uppercase: "fa-font", + h1: editormd.classPrefix + "bold", + h2: editormd.classPrefix + "bold", + h3: editormd.classPrefix + "bold", + h4: editormd.classPrefix + "bold", + h5: editormd.classPrefix + "bold", + h6: editormd.classPrefix + "bold", + "list-ul": "fa-list-ul", + "list-ol": "fa-list-ol", + hr: "fa-minus", + link: "fa-link", + "reference-link": "fa-anchor", + image: "fa-picture-o", + code: "fa-code", + "preformatted-text": "fa-file-code-o", + "code-block": "fa-file-code-o", + table: "fa-table", + datetime: "fa-clock-o", + emoji: "fa-smile-o", + "html-entities": "fa-copyright", + pagebreak: "fa-newspaper-o", + "goto-line": "fa-terminal", // fa-crosshairs + watch: "fa-eye-slash", + unwatch: "fa-eye", + preview: "fa-desktop", + search: "fa-search", + fullscreen: "fa-arrows-alt", + clear: "fa-eraser", + help: "fa-question-circle", + info: "fa-info-circle" + }, + toolbarIconTexts: {}, + + lang: { + name: "zh-cn", + description: "开源在线Markdown编辑器
    Open source online Markdown editor.", + tocTitle: "目录", + toolbar: { + undo: "撤销(Ctrl+Z)", + redo: "重做(Ctrl+Y)", + bold: "粗体", + del: "删除线", + italic: "斜体", + quote: "引用", + ucwords: "将每个单词首字母转成大写", + uppercase: "将所选转换成大写", + lowercase: "将所选转换成小写", + h1: "标题1", + h2: "标题2", + h3: "标题3", + h4: "标题4", + h5: "标题5", + h6: "标题6", + "list-ul": "无序列表", + "list-ol": "有序列表", + hr: "横线", + link: "链接", + "reference-link": "引用链接", + image: "添加图片", + code: "行内代码", + "preformatted-text": "预格式文本 / 代码块(缩进风格)", + "code-block": "代码块(多语言风格)", + table: "添加表格", + datetime: "日期时间", + emoji: "Emoji表情", + "html-entities": "HTML实体字符", + pagebreak: "插入分页符", + "goto-line": "跳转到行", + watch: "关闭实时预览", + unwatch: "开启实时预览", + preview: "全窗口预览HTML(按 Shift + ESC还原)", + fullscreen: "全屏(按ESC还原)", + clear: "清空", + search: "搜索", + help: "使用帮助", + info: "关于" + editormd.title }, - buttons : { - enter : "确定", - cancel : "取消", - close : "关闭" + buttons: { + enter: "确定", + cancel: "取消", + close: "关闭" }, - dialog : { - link : { - title : "添加链接", - url : "链接地址", - urlTitle : "链接标题", - urlEmpty : "错误:请填写链接地址。" + dialog: { + link: { + title: "添加链接", + url: "链接地址", + urlTitle: "链接标题", + urlEmpty: "错误:请填写链接地址。" }, - referenceLink : { - title : "添加引用链接", - name : "引用名称", - url : "链接地址", - urlId : "链接ID", - urlTitle : "链接标题", + referenceLink: { + title: "添加引用链接", + name: "引用名称", + url: "链接地址", + urlId: "链接ID", + urlTitle: "链接标题", nameEmpty: "错误:引用链接的名称不能为空。", - idEmpty : "错误:请填写引用链接的ID。", - urlEmpty : "错误:请填写引用链接的URL地址。" + idEmpty: "错误:请填写引用链接的ID。", + urlEmpty: "错误:请填写引用链接的URL地址。" }, - image : { - title : "添加图片", - url : "图片地址", - link : "图片链接", - alt : "图片描述", - uploadButton : "本地上传", - imageURLEmpty : "错误:图片地址不能为空。", - uploadFileEmpty : "错误:上传的图片不能为空。", - formatNotAllowed : "错误:只允许上传图片文件,允许上传的图片文件格式有:" + image: { + title: "添加图片", + url: "图片地址", + link: "图片链接", + alt: "图片描述", + uploadButton: "本地上传", + imageURLEmpty: "错误:图片地址不能为空。", + uploadFileEmpty: "错误:上传的图片不能为空。", + formatNotAllowed: "错误:只允许上传图片文件,允许上传的图片文件格式有:" }, - preformattedText : { - title : "添加预格式文本或代码块", - emptyAlert : "错误:请填写预格式文本或代码的内容。" + preformattedText: { + title: "添加预格式文本或代码块", + emptyAlert: "错误:请填写预格式文本或代码的内容。" }, - codeBlock : { - title : "添加代码块", - selectLabel : "代码语言:", - selectDefaultText : "请选择代码语言", - otherLanguage : "其他语言", - unselectedLanguageAlert : "错误:请选择代码所属的语言类型。", - codeEmptyAlert : "错误:请填写代码内容。" + codeBlock: { + title: "添加代码块", + selectLabel: "代码语言:", + selectDefaultText: "请选择代码语言", + otherLanguage: "其他语言", + unselectedLanguageAlert: "错误:请选择代码所属的语言类型。", + codeEmptyAlert: "错误:请填写代码内容。" }, - htmlEntities : { - title : "HTML 实体字符" + htmlEntities: { + title: "HTML 实体字符" }, - help : { - title : "使用帮助" + help: { + title: "使用帮助" } } } }; - - editormd.classNames = { - tex : editormd.classPrefix + "tex" + + editormd.classNames = { + tex: editormd.classPrefix + "tex" }; editormd.dialogZindex = 99999; - - editormd.$katex = null; - editormd.$marked = null; - editormd.$CodeMirror = null; + + editormd.$katex = null; + editormd.$marked = null; + editormd.$CodeMirror = null; editormd.$prettyPrint = null; - + var timer, flowchartTimer; - editormd.prototype = editormd.fn = { - state : { - watching : false, - loaded : false, - preview : false, - fullscreen : false + editormd.prototype = editormd.fn = { + state: { + watching: false, + loaded: false, + preview: false, + fullscreen: false }, - + /** * 构造函数/实例初始化 * Constructor / instance initialization - * + * * @param {String} id 编辑器的ID * @param {Object} [options={}] 配置选项 Key/Value * @returns {editormd} 返回editormd的实例对象 */ - - init : function (id, options) { - - options = options || {}; - - if (typeof id === "object") - { + + init: function (id, options) { + + options = options || {}; + + if (typeof id === "object") { options = id; } - - var _this = this; - var classPrefix = this.classPrefix = editormd.classPrefix; - var settings = this.settings = $.extend(true, editormd.defaults, options); - - id = (typeof id === "object") ? settings.id : id; - - var editor = this.editor = $("#" + id); - - this.id = id; - this.lang = settings.lang; - - var classNames = this.classNames = { - textarea : { - html : classPrefix + "html-textarea", - markdown : classPrefix + "markdown-textarea" + + var _this = this; + var classPrefix = this.classPrefix = editormd.classPrefix; + var settings = this.settings = $.extend(true, editormd.defaults, options); + + id = (typeof id === "object") ? settings.id : id; + + var editor = this.editor = $("#" + id); + + this.id = id; + this.lang = settings.lang; + + var classNames = this.classNames = { + textarea: { + html: classPrefix + "html-textarea", + markdown: classPrefix + "markdown-textarea" } }; - - settings.pluginPath = (settings.pluginPath === "") ? settings.path + "../plugins/" : settings.pluginPath; - + + settings.pluginPath = (settings.pluginPath === "") ? settings.path + "../plugins/" : settings.pluginPath; + this.state.watching = (settings.watch) ? true : false; - - if ( !editor.hasClass("editormd") ) { + + if (!editor.hasClass("editormd")) { editor.addClass("editormd"); } - + editor.css({ - width : (typeof settings.width === "number") ? settings.width + "px" : settings.width, - height : (typeof settings.height === "number") ? settings.height + "px" : settings.height + width: (typeof settings.width === "number") ? settings.width + "px" : settings.width, + height: (typeof settings.height === "number") ? settings.height + "px" : settings.height }); - - if (settings.autoHeight) - { + + if (settings.autoHeight) { editor.css("height", "auto"); } - + var markdownTextarea = this.markdownTextarea = editor.children("textarea"); - - if (markdownTextarea.length < 1) - { + + if (markdownTextarea.length < 1) { editor.append(""); markdownTextarea = this.markdownTextarea = editor.children("textarea"); } - + markdownTextarea.addClass(classNames.textarea.markdown).attr("placeholder", settings.placeholder); - - if (typeof markdownTextarea.attr("name") === "undefined" || markdownTextarea.attr("name") === "") - { + + if (typeof markdownTextarea.attr("name") === "undefined" || markdownTextarea.attr("name") === "") { markdownTextarea.attr("name", (settings.name !== "") ? settings.name : id + "-markdown-doc"); } - + var appendElements = [ (!settings.readOnly) ? "" : "", - ( (settings.saveHTMLToTextarea) ? "" : "" ), + ((settings.saveHTMLToTextarea) ? "" : ""), "
    ", "
    ", "
    " ].join("\n"); - + editor.append(appendElements).addClass(classPrefix + "vertical"); - - if (settings.theme !== "") - { + + if (settings.theme !== "") { editor.addClass(classPrefix + "theme-" + settings.theme); } - - this.mask = editor.children("." + classPrefix + "mask"); - this.containerMask = editor.children("." + classPrefix + "container-mask"); - - if (settings.markdown !== "") - { + + this.mask = editor.children("." + classPrefix + "mask"); + this.containerMask = editor.children("." + classPrefix + "container-mask"); + + if (settings.markdown !== "") { markdownTextarea.val(settings.markdown); } - - if (settings.appendMarkdown !== "") - { + + if (settings.appendMarkdown !== "") { markdownTextarea.val(markdownTextarea.val() + settings.appendMarkdown); } - - this.htmlTextarea = editor.children("." + classNames.textarea.html); - this.preview = editor.children("." + classPrefix + "preview"); + + this.htmlTextarea = editor.children("." + classNames.textarea.html); + this.preview = editor.children("." + classPrefix + "preview"); this.previewContainer = this.preview.children("." + classPrefix + "preview-container"); - - if (settings.previewTheme !== "") - { + + if (settings.previewTheme !== "") { this.preview.addClass(classPrefix + "preview-theme-" + settings.previewTheme); } - - if (typeof define === "function" && define.amd) - { - if (typeof katex !== "undefined") - { + + if (typeof define === "function" && define.amd) { + if (typeof katex !== "undefined") { editormd.$katex = katex; } - - if (settings.searchReplace && !settings.readOnly) - { + + if (settings.searchReplace && !settings.readOnly) { editormd.loadCSS(settings.path + "codemirror/addon/dialog/dialog"); editormd.loadCSS(settings.path + "codemirror/addon/search/matchesonscrollbar"); } } - - if ((typeof define === "function" && define.amd) || !settings.autoLoadModules) - { + + if ((typeof define === "function" && define.amd) || !settings.autoLoadModules) { if (typeof CodeMirror !== "undefined") { editormd.$CodeMirror = CodeMirror; } - - if (typeof marked !== "undefined") { - editormd.$marked = marked; + + if (typeof marked !== "undefined") { + editormd.$marked = marked; } - + this.setCodeMirror().setToolbar().loadedDisplay(); - } - else - { + } else { this.loadQueues(); } return this; }, - + /** * 所需组件加载队列 * Required components loading queue - * + * * @returns {editormd} 返回editormd的实例对象 */ - - loadQueues : function() { - var _this = this; - var settings = this.settings; - var loadPath = settings.path; - - var loadFlowChartOrSequenceDiagram = function() { - - if (editormd.isIE8) - { + + loadQueues: function () { + var _this = this; + var settings = this.settings; + var loadPath = settings.path; + + var loadFlowChartOrSequenceDiagram = function () { + + if (editormd.isIE8) { _this.loadedDisplay(); - - return ; + + return; } - if (settings.flowChart || settings.sequenceDiagram) - { - editormd.loadScript(loadPath + "raphael.min", function() { + if (settings.flowChart || settings.sequenceDiagram) { + editormd.loadScript(loadPath + "raphael.min", function () { - editormd.loadScript(loadPath + "underscore.min", function() { + editormd.loadScript(loadPath + "underscore.min", function () { - if (!settings.flowChart && settings.sequenceDiagram) - { - editormd.loadScript(loadPath + "sequence-diagram.min", function() { + if (!settings.flowChart && settings.sequenceDiagram) { + editormd.loadScript(loadPath + "sequence-diagram.min", function () { _this.loadedDisplay(); }); - } - else if (settings.flowChart && !settings.sequenceDiagram) - { - editormd.loadScript(loadPath + "flowchart.min", function() { - editormd.loadScript(loadPath + "jquery.flowchart.min", function() { + } else if (settings.flowChart && !settings.sequenceDiagram) { + editormd.loadScript(loadPath + "flowchart.min", function () { + editormd.loadScript(loadPath + "jquery.flowchart.min", function () { _this.loadedDisplay(); }); }); - } - else if (settings.flowChart && settings.sequenceDiagram) - { - editormd.loadScript(loadPath + "flowchart.min", function() { - editormd.loadScript(loadPath + "jquery.flowchart.min", function() { - editormd.loadScript(loadPath + "sequence-diagram.min", function() { + } else if (settings.flowChart && settings.sequenceDiagram) { + editormd.loadScript(loadPath + "flowchart.min", function () { + editormd.loadScript(loadPath + "jquery.flowchart.min", function () { + editormd.loadScript(loadPath + "sequence-diagram.min", function () { _this.loadedDisplay(); }); }); @@ -527,646 +509,598 @@ }); }); - } - else - { + } else { _this.loadedDisplay(); } - }; + }; editormd.loadCSS(loadPath + "codemirror/codemirror.min"); - - if (settings.searchReplace && !settings.readOnly) - { + + if (settings.searchReplace && !settings.readOnly) { editormd.loadCSS(loadPath + "codemirror/addon/dialog/dialog"); editormd.loadCSS(loadPath + "codemirror/addon/search/matchesonscrollbar"); } - - if (settings.codeFold) - { - editormd.loadCSS(loadPath + "codemirror/addon/fold/foldgutter"); + + if (settings.codeFold) { + editormd.loadCSS(loadPath + "codemirror/addon/fold/foldgutter"); } - - editormd.loadScript(loadPath + "codemirror/codemirror.min", function() { + + editormd.loadScript(loadPath + "codemirror/codemirror.min", function () { editormd.$CodeMirror = CodeMirror; - - editormd.loadScript(loadPath + "codemirror/modes.min", function() { - - editormd.loadScript(loadPath + "codemirror/addons.min", function() { - + + editormd.loadScript(loadPath + "codemirror/modes.min", function () { + + editormd.loadScript(loadPath + "codemirror/addons.min", function () { + _this.setCodeMirror(); - - if (settings.mode !== "gfm" && settings.mode !== "markdown") - { + + if (settings.mode !== "gfm" && settings.mode !== "markdown") { _this.loadedDisplay(); - + return false; } - + _this.setToolbar(); - editormd.loadScript(loadPath + "marked.min", function() { + editormd.loadScript(loadPath + "marked.min", function () { editormd.$marked = marked; - - if (settings.previewCodeHighlight) - { - editormd.loadScript(loadPath + "prettify.min", function() { + + if (settings.previewCodeHighlight) { + editormd.loadScript(loadPath + "prettify.min", function () { loadFlowChartOrSequenceDiagram(); }); - } - else - { + } else { loadFlowChartOrSequenceDiagram(); } }); - + }); - + }); - + }); return this; }, - + /** * 设置 Editor.md 的整体主题,主要是工具栏 * Setting Editor.md theme - * + * * @returns {editormd} 返回editormd的实例对象 */ - - setTheme : function(theme) { - var editor = this.editor; - var oldTheme = this.settings.theme; + + setTheme: function (theme) { + var editor = this.editor; + var oldTheme = this.settings.theme; var themePrefix = this.classPrefix + "theme-"; - + editor.removeClass(themePrefix + oldTheme).addClass(themePrefix + theme); - + this.settings.theme = theme; - + return this; }, - + /** * 设置 CodeMirror(编辑区)的主题 * Setting CodeMirror (Editor area) theme - * + * * @returns {editormd} 返回editormd的实例对象 */ - - setEditorTheme : function(theme) { - var settings = this.settings; - settings.editorTheme = theme; - - if (theme !== "default") - { + + setEditorTheme: function (theme) { + var settings = this.settings; + settings.editorTheme = theme; + + if (theme !== "default") { editormd.loadCSS(settings.path + "codemirror/theme/" + settings.editorTheme); } - + this.cm.setOption("theme", theme); - + return this; }, - + /** * setEditorTheme() 的别名 * setEditorTheme() alias - * + * * @returns {editormd} 返回editormd的实例对象 */ - - setCodeMirrorTheme : function (theme) { + + setCodeMirrorTheme: function (theme) { this.setEditorTheme(theme); - + return this; }, - + /** * 设置 Editor.md 的主题 * Setting Editor.md theme - * + * * @returns {editormd} 返回editormd的实例对象 */ - - setPreviewTheme : function(theme) { - var preview = this.preview; - var oldTheme = this.settings.previewTheme; + + setPreviewTheme: function (theme) { + var preview = this.preview; + var oldTheme = this.settings.previewTheme; var themePrefix = this.classPrefix + "preview-theme-"; - + preview.removeClass(themePrefix + oldTheme).addClass(themePrefix + theme); - + this.settings.previewTheme = theme; - + return this; }, - + /** * 配置和初始化CodeMirror组件 * CodeMirror initialization - * + * * @returns {editormd} 返回editormd的实例对象 */ - - setCodeMirror : function() { - var settings = this.settings; - var editor = this.editor; - - if (settings.editorTheme !== "default") - { + + setCodeMirror: function () { + var settings = this.settings; + var editor = this.editor; + + if (settings.editorTheme !== "default") { editormd.loadCSS(settings.path + "codemirror/theme/" + settings.editorTheme); } - + var codeMirrorConfig = { - mode : settings.mode, - theme : settings.editorTheme, - tabSize : settings.tabSize, - dragDrop : false, - autofocus : settings.autoFocus, - autoCloseTags : settings.autoCloseTags, - readOnly : (settings.readOnly) ? "nocursor" : false, - indentUnit : settings.indentUnit, - lineNumbers : settings.lineNumbers, - lineWrapping : settings.lineWrapping, - extraKeys : { - "Ctrl-Q": function(cm) { - cm.foldCode(cm.getCursor()); - } - }, - foldGutter : settings.codeFold, - gutters : ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], - matchBrackets : settings.matchBrackets, - indentWithTabs : settings.indentWithTabs, - styleActiveLine : settings.styleActiveLine, - styleSelectedText : settings.styleSelectedText, - autoCloseBrackets : settings.autoCloseBrackets, - showTrailingSpace : settings.showTrailingSpace, - highlightSelectionMatches : ( (!settings.matchWordHighlight) ? false : { showToken: (settings.matchWordHighlight === "onselected") ? false : /\w/ } ) + mode: settings.mode, + theme: settings.editorTheme, + tabSize: settings.tabSize, + dragDrop: false, + autofocus: settings.autoFocus, + autoCloseTags: settings.autoCloseTags, + readOnly: (settings.readOnly) ? "nocursor" : false, + indentUnit: settings.indentUnit, + lineNumbers: settings.lineNumbers, + lineWrapping: settings.lineWrapping, + extraKeys: { + "Ctrl-Q": function (cm) { + cm.foldCode(cm.getCursor()); + } + }, + foldGutter: settings.codeFold, + gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], + matchBrackets: settings.matchBrackets, + indentWithTabs: settings.indentWithTabs, + styleActiveLine: settings.styleActiveLine, + styleSelectedText: settings.styleSelectedText, + autoCloseBrackets: settings.autoCloseBrackets, + showTrailingSpace: settings.showTrailingSpace, + highlightSelectionMatches: ((!settings.matchWordHighlight) ? false : {showToken: (settings.matchWordHighlight === "onselected") ? false : /\w/}) }; - - this.codeEditor = this.cm = editormd.$CodeMirror.fromTextArea(this.markdownTextarea[0], codeMirrorConfig); + + this.codeEditor = this.cm = editormd.$CodeMirror.fromTextArea(this.markdownTextarea[0], codeMirrorConfig); this.codeMirror = this.cmElement = editor.children(".CodeMirror"); - - if (settings.value !== "") - { + + if (settings.value !== "") { this.cm.setValue(settings.value); } this.codeMirror.css({ - fontSize : settings.fontSize, - width : (!settings.watch) ? "100%" : "50%" + fontSize: settings.fontSize, + width: (!settings.watch) ? "100%" : "50%" }); - - if (settings.autoHeight) - { + + if (settings.autoHeight) { this.codeMirror.css("height", "auto"); this.cm.setOption("viewportMargin", Infinity); } - - if (!settings.lineNumbers) - { + + if (!settings.lineNumbers) { this.codeMirror.find(".CodeMirror-gutters").css("border-right", "none"); } return this; }, - + /** * 获取CodeMirror的配置选项 * Get CodeMirror setting options - * + * * @returns {Mixed} return CodeMirror setting option value */ - - getCodeMirrorOption : function(key) { + + getCodeMirrorOption: function (key) { return this.cm.getOption(key); }, - + /** * 配置和重配置CodeMirror的选项 * CodeMirror setting options / resettings - * + * * @returns {editormd} 返回editormd的实例对象 */ - - setCodeMirrorOption : function(key, value) { - + + setCodeMirrorOption: function (key, value) { + this.cm.setOption(key, value); - + return this; }, - + /** * 添加 CodeMirror 键盘快捷键 * Add CodeMirror keyboard shortcuts key map - * + * * @returns {editormd} 返回editormd的实例对象 */ - - addKeyMap : function(map, bottom) { + + addKeyMap: function (map, bottom) { this.cm.addKeyMap(map, bottom); - + return this; }, - + /** * 移除 CodeMirror 键盘快捷键 * Remove CodeMirror keyboard shortcuts key map - * + * * @returns {editormd} 返回editormd的实例对象 */ - - removeKeyMap : function(map) { + + removeKeyMap: function (map) { this.cm.removeKeyMap(map); - + return this; }, - + /** * 跳转到指定的行 * Goto CodeMirror line - * + * * @param {String|Intiger} line line number or "first"|"last" * @returns {editormd} 返回editormd的实例对象 */ - - gotoLine : function (line) { - + + gotoLine: function (line) { + var settings = this.settings; - - if (!settings.gotoLine) - { + + if (!settings.gotoLine) { return this; } - - var cm = this.cm; - var editor = this.editor; - var count = cm.lineCount(); - var preview = this.preview; - - if (typeof line === "string") - { - if(line === "last") - { + + var cm = this.cm; + var editor = this.editor; + var count = cm.lineCount(); + var preview = this.preview; + + if (typeof line === "string") { + if (line === "last") { line = count; } - - if (line === "first") - { + + if (line === "first") { line = 1; } } - - if (typeof line !== "number") - { + + if (typeof line !== "number") { alert("Error: The line number must be an integer."); return this; } - - line = parseInt(line) - 1; - - if (line > count) - { + + line = parseInt(line) - 1; + + if (line > count) { alert("Error: The line number range 1-" + count); - + return this; } - - cm.setCursor( {line : line, ch : 0} ); - - var scrollInfo = cm.getScrollInfo(); - var clientHeight = scrollInfo.clientHeight; - var coords = cm.charCoords({line : line, ch : 0}, "local"); - + + cm.setCursor({line: line, ch: 0}); + + var scrollInfo = cm.getScrollInfo(); + var clientHeight = scrollInfo.clientHeight; + var coords = cm.charCoords({line: line, ch: 0}, "local"); + cm.scrollTo(null, (coords.top + coords.bottom - clientHeight) / 2); - - if (settings.watch) - { - var cmScroll = this.codeMirror.find(".CodeMirror-scroll")[0]; - var height = $(cmScroll).height(); - var scrollTop = cmScroll.scrollTop; - var percent = (scrollTop / cmScroll.scrollHeight); - - if (scrollTop === 0) - { + + if (settings.watch) { + var cmScroll = this.codeMirror.find(".CodeMirror-scroll")[0]; + var height = $(cmScroll).height(); + var scrollTop = cmScroll.scrollTop; + var percent = (scrollTop / cmScroll.scrollHeight); + + if (scrollTop === 0) { preview.scrollTop(0); - } - else if (scrollTop + height >= cmScroll.scrollHeight - 16) - { - preview.scrollTop(preview[0].scrollHeight); - } - else - { + } else if (scrollTop + height >= cmScroll.scrollHeight - 16) { + preview.scrollTop(preview[0].scrollHeight); + } else { preview.scrollTop(preview[0].scrollHeight * percent); } } cm.focus(); - + return this; }, - + /** * 扩展当前实例对象,可同时设置多个或者只设置一个 * Extend editormd instance object, can mutil setting. - * + * * @returns {editormd} this(editormd instance object.) */ - - extend : function() { - if (typeof arguments[1] !== "undefined") - { - if (typeof arguments[1] === "function") - { + + extend: function () { + if (typeof arguments[1] !== "undefined") { + if (typeof arguments[1] === "function") { arguments[1] = $.proxy(arguments[1], this); } this[arguments[0]] = arguments[1]; } - - if (typeof arguments[0] === "object" && typeof arguments[0].length === "undefined") - { + + if (typeof arguments[0] === "object" && typeof arguments[0].length === "undefined") { $.extend(true, this, arguments[0]); } return this; }, - + /** * 设置或扩展当前实例对象,单个设置 * Extend editormd instance object, one by one - * + * * @param {String|Object} key option key * @param {String|Object} value option value * @returns {editormd} this(editormd instance object.) */ - - set : function (key, value) { - - if (typeof value !== "undefined" && typeof value === "function") - { + + set: function (key, value) { + + if (typeof value !== "undefined" && typeof value === "function") { value = $.proxy(value, this); } - + this[key] = value; return this; }, - + /** * 重新配置 * Resetting editor options - * + * * @param {String|Object} key option key * @param {String|Object} value option value * @returns {editormd} this(editormd instance object.) */ - - config : function(key, value) { + + config: function (key, value) { var settings = this.settings; - - if (typeof key === "object") - { + + if (typeof key === "object") { settings = $.extend(true, settings, key); } - - if (typeof key === "string") - { + + if (typeof key === "string") { settings[key] = value; } - + this.settings = settings; this.recreate(); - + return this; }, - + /** * 注册事件处理方法 * Bind editor event handle - * + * * @param {String} eventType event type * @param {Function} callback 回调函数 * @returns {editormd} this(editormd instance object.) */ - - on : function(eventType, callback) { + + on: function (eventType, callback) { var settings = this.settings; - - if (typeof settings["on" + eventType] !== "undefined") - { - settings["on" + eventType] = $.proxy(callback, this); + + if (typeof settings["on" + eventType] !== "undefined") { + settings["on" + eventType] = $.proxy(callback, this); } return this; }, - + /** * 解除事件处理方法 * Unbind editor event handle - * + * * @param {String} eventType event type * @returns {editormd} this(editormd instance object.) */ - - off : function(eventType) { + + off: function (eventType) { var settings = this.settings; - - if (typeof settings["on" + eventType] !== "undefined") - { - settings["on" + eventType] = function(){}; + + if (typeof settings["on" + eventType] !== "undefined") { + settings["on" + eventType] = function () { + }; } - + return this; }, - + /** * 显示工具栏 * Display toolbar - * + * * @param {Function} [callback=function(){}] 回调函数 * @returns {editormd} 返回editormd的实例对象 */ - - showToolbar : function(callback) { + + showToolbar: function (callback) { var settings = this.settings; - - if(settings.readOnly) { + + if (settings.readOnly) { return this; } - - if (settings.toolbar && (this.toolbar.length < 1 || this.toolbar.find("." + this.classPrefix + "menu").html() === "") ) - { + + if (settings.toolbar && (this.toolbar.length < 1 || this.toolbar.find("." + this.classPrefix + "menu").html() === "")) { this.setToolbar(); } - - settings.toolbar = true; - + + settings.toolbar = true; + this.toolbar.show(); this.resize(); - - $.proxy(callback || function(){}, this)(); + + $.proxy(callback || function () { + }, this)(); return this; }, - + /** * 隐藏工具栏 * Hide toolbar - * + * * @param {Function} [callback=function(){}] 回调函数 * @returns {editormd} this(editormd instance object.) */ - - hideToolbar : function(callback) { + + hideToolbar: function (callback) { var settings = this.settings; - - settings.toolbar = false; + + settings.toolbar = false; this.toolbar.hide(); this.resize(); - - $.proxy(callback || function(){}, this)(); + + $.proxy(callback || function () { + }, this)(); return this; }, - + /** * 页面滚动时工具栏的固定定位 * Set toolbar in window scroll auto fixed position - * + * * @returns {editormd} 返回editormd的实例对象 */ - - setToolbarAutoFixed : function(fixed) { - - var state = this.state; - var editor = this.editor; - var toolbar = this.toolbar; + + setToolbarAutoFixed: function (fixed) { + + var state = this.state; + var editor = this.editor; + var toolbar = this.toolbar; var settings = this.settings; - - if (typeof fixed !== "undefined") - { + + if (typeof fixed !== "undefined") { settings.toolbarAutoFixed = fixed; } - - var autoFixedHandle = function(){ + + var autoFixedHandle = function () { var $window = $(window); - var top = $window.scrollTop(); - - if (!settings.toolbarAutoFixed) - { + var top = $window.scrollTop(); + + if (!settings.toolbarAutoFixed) { return false; } - if (top - editor.offset().top > 10 && top < editor.height()) - { + if (top - editor.offset().top > 10 && top < editor.height()) { toolbar.css({ - position : "fixed", - width : editor.width() + "px", - left : ($window.width() - editor.width()) / 2 + "px" + position: "fixed", + width: editor.width() + "px", + left: ($window.width() - editor.width()) / 2 + "px" }); - } - else - { + } else { toolbar.css({ - position : "absolute", - width : "100%", - left : 0 + position: "absolute", + width: "100%", + left: 0 }); } }; - - if (!state.fullscreen && !state.preview && settings.toolbar && settings.toolbarAutoFixed) - { + + if (!state.fullscreen && !state.preview && settings.toolbar && settings.toolbarAutoFixed) { $(window).bind("scroll", autoFixedHandle); } return this; }, - + /** * 配置和初始化工具栏 * Set toolbar and Initialization - * + * * @returns {editormd} 返回editormd的实例对象 */ - - setToolbar : function() { - var settings = this.settings; - - if(settings.readOnly) { + + setToolbar: function () { + var settings = this.settings; + + if (settings.readOnly) { return this; } - - var editor = this.editor; - var preview = this.preview; + + var editor = this.editor; + var preview = this.preview; var classPrefix = this.classPrefix; - - var toolbar = this.toolbar = editor.children("." + classPrefix + "toolbar"); - - if (settings.toolbar && toolbar.length < 1) - { + + var toolbar = this.toolbar = editor.children("." + classPrefix + "toolbar"); + + if (settings.toolbar && toolbar.length < 1) { var toolbarHTML = "
      "; - + editor.append(toolbarHTML); toolbar = this.toolbar = editor.children("." + classPrefix + "toolbar"); } - - if (!settings.toolbar) - { + + if (!settings.toolbar) { toolbar.hide(); - + return this; } - + toolbar.show(); - - var icons = (typeof settings.toolbarIcons === "function") ? settings.toolbarIcons() - : ((typeof settings.toolbarIcons === "string") ? editormd.toolbarModes[settings.toolbarIcons] : settings.toolbarIcons); - + + var icons = (typeof settings.toolbarIcons === "function") ? settings.toolbarIcons() + : ((typeof settings.toolbarIcons === "string") ? editormd.toolbarModes[settings.toolbarIcons] : settings.toolbarIcons); + var toolbarMenu = toolbar.find("." + this.classPrefix + "menu"), menu = ""; - var pullRight = false; - - for (var i = 0, len = icons.length; i < len; i++) - { + var pullRight = false; + + for (var i = 0, len = icons.length; i < len; i++) { var name = icons[i]; - if (name === "||") - { + if (name === "||") { pullRight = true; - } - else if (name === "|") - { + } else if (name === "|") { menu += "
    • |
    • "; - } - else - { + } else { var isHeader = (/h(\d)/.test(name)); - var index = name; - + var index = name; + if (name === "watch" && !settings.watch) { index = "unwatch"; } - - var title = settings.lang.toolbar[index]; + + var title = settings.lang.toolbar[index]; var iconTexts = settings.toolbarIconTexts[index]; var iconClass = settings.toolbarIconsClass[index]; - - title = (typeof title === "undefined") ? "" : title; + + title = (typeof title === "undefined") ? "" : title; iconTexts = (typeof iconTexts === "undefined") ? "" : iconTexts; iconClass = (typeof iconClass === "undefined") ? "" : iconClass; var menuItem = pullRight ? "
    • " : "
    • "; - - if (typeof settings.toolbarCustomIcons[name] !== "undefined" && typeof settings.toolbarCustomIcons[name] !== "function") - { + + if (typeof settings.toolbarCustomIcons[name] !== "undefined" && typeof settings.toolbarCustomIcons[name] !== "function") { menuItem += settings.toolbarCustomIcons[name]; - } - else - { + } else { menuItem += ""; - menuItem += ""+((isHeader) ? name.toUpperCase() : ( (iconClass === "") ? iconTexts : "") ) + ""; + menuItem += "" + ((isHeader) ? name.toUpperCase() : ((iconClass === "") ? iconTexts : "")) + ""; menuItem += ""; } @@ -1177,92 +1111,87 @@ } toolbarMenu.html(menu); - + toolbarMenu.find("[title=\"Lowercase\"]").attr("title", settings.lang.toolbar.lowercase); toolbarMenu.find("[title=\"ucwords\"]").attr("title", settings.lang.toolbar.ucwords); - + this.setToolbarHandler(); this.setToolbarAutoFixed(); return this; }, - + /** * 工具栏图标事件处理对象序列 * Get toolbar icons event handlers - * + * * @param {Object} cm CodeMirror的实例对象 * @param {String} name 要获取的事件处理器名称 * @returns {Object} 返回处理对象序列 */ - - dialogLockScreen : function() { + + dialogLockScreen: function () { $.proxy(editormd.dialogLockScreen, this)(); - + return this; }, - dialogShowMask : function(dialog) { + dialogShowMask: function (dialog) { $.proxy(editormd.dialogShowMask, this)(dialog); - + return this; }, - - getToolbarHandles : function(name) { + + getToolbarHandles: function (name) { var toolbarHandlers = this.toolbarHandlers = editormd.toolbarHandlers; - + return (name && typeof toolbarIconHandlers[name] !== "undefined") ? toolbarHandlers[name] : toolbarHandlers; }, - + /** * 工具栏图标事件处理器 * Bind toolbar icons event handle - * + * * @returns {editormd} 返回editormd的实例对象 */ - - setToolbarHandler : function() { - var _this = this; - var settings = this.settings; - + + setToolbarHandler: function () { + var _this = this; + var settings = this.settings; + if (!settings.toolbar || settings.readOnly) { return this; } - - var toolbar = this.toolbar; - var cm = this.cm; - var classPrefix = this.classPrefix; - var toolbarIcons = this.toolbarIcons = toolbar.find("." + classPrefix + "menu > li > a"); - var toolbarIconHandlers = this.getToolbarHandles(); - - toolbarIcons.bind(editormd.mouseOrTouch("click", "touchend"), function(event) { - var icon = $(this).children(".fa"); - var name = icon.attr("name"); - var cursor = cm.getCursor(); - var selection = cm.getSelection(); + var toolbar = this.toolbar; + var cm = this.cm; + var classPrefix = this.classPrefix; + var toolbarIcons = this.toolbarIcons = toolbar.find("." + classPrefix + "menu > li > a"); + var toolbarIconHandlers = this.getToolbarHandles(); + + toolbarIcons.bind(editormd.mouseOrTouch("click", "touchend"), function (event) { + + var icon = $(this).children(".fa"); + var name = icon.attr("name"); + var cursor = cm.getCursor(); + var selection = cm.getSelection(); if (name === "") { - return ; + return; } - + _this.activeIcon = icon; - if (typeof toolbarIconHandlers[name] !== "undefined") - { + if (typeof toolbarIconHandlers[name] !== "undefined") { $.proxy(toolbarIconHandlers[name], _this)(cm); - } - else - { - if (typeof settings.toolbarHandlers[name] !== "undefined") - { + } else { + if (typeof settings.toolbarHandlers[name] !== "undefined") { $.proxy(settings.toolbarHandlers[name], _this)(cm, icon, cursor, selection); } } - - if (name !== "link" && name !== "reference-link" && name !== "image" && name !== "code-block" && - name !== "preformatted-text" && name !== "watch" && name !== "preview" && name !== "search" && name !== "fullscreen" && name !== "info") - { + + if (name !== "link" && name !== "reference-link" && name !== "image" && name !== "code-block" && + name !== "preformatted-text" && name !== "watch" && name !== "preview" && name !== "search" && name !== "fullscreen" && name !== "info") { cm.focus(); } @@ -1272,31 +1201,31 @@ return this; }, - + /** * 动态创建对话框 * Creating custom dialogs - * + * * @param {Object} options 配置项键值对 Key/Value * @returns {dialog} 返回创建的dialog的jQuery实例对象 */ - - createDialog : function(options) { + + createDialog: function (options) { return $.proxy(editormd.createDialog, this)(options); }, - + /** * 创建关于Editor.md的对话框 * Create about Editor.md dialog - * + * * @returns {editormd} 返回editormd的实例对象 */ - - createInfoDialog : function() { - var _this = this; - var editor = this.editor; - var classPrefix = this.classPrefix; - + + createInfoDialog: function () { + var _this = this; + var editor = this.editor; + var classPrefix = this.classPrefix; + var infoDialogHTML = [ "
      ", "
      ", @@ -1310,87 +1239,86 @@ ].join("\n"); editor.append(infoDialogHTML); - - var infoDialog = this.infoDialog = editor.children("." + classPrefix + "dialog-info"); - infoDialog.find("." + classPrefix + "dialog-close").bind(editormd.mouseOrTouch("click", "touchend"), function() { + var infoDialog = this.infoDialog = editor.children("." + classPrefix + "dialog-info"); + + infoDialog.find("." + classPrefix + "dialog-close").bind(editormd.mouseOrTouch("click", "touchend"), function () { _this.hideInfoDialog(); }); - + infoDialog.css("border", (editormd.isIE8) ? "1px solid #ddd" : "").css("z-index", editormd.dialogZindex).show(); - + this.infoDialogPosition(); return this; }, - + /** * 关于Editor.md对话居中定位 * Editor.md dialog position handle - * + * * @returns {editormd} 返回editormd的实例对象 */ - - infoDialogPosition : function() { + + infoDialogPosition: function () { var infoDialog = this.infoDialog; - - var _infoDialogPosition = function() { - infoDialog.css({ - top : ($(window).height() - infoDialog.height()) / 2 + "px", - left : ($(window).width() - infoDialog.width()) / 2 + "px" - }); - }; - - _infoDialogPosition(); - - $(window).resize(_infoDialogPosition); - + + var _infoDialogPosition = function () { + infoDialog.css({ + top: ($(window).height() - infoDialog.height()) / 2 + "px", + left: ($(window).width() - infoDialog.width()) / 2 + "px" + }); + }; + + _infoDialogPosition(); + + $(window).resize(_infoDialogPosition); + return this; }, - + /** * 显示关于Editor.md * Display about Editor.md dialog - * + * * @returns {editormd} 返回editormd的实例对象 */ - - showInfoDialog : function() { + + showInfoDialog: function () { $("html,body").css("overflow-x", "hidden"); - - var _this = this; - var editor = this.editor; - var settings = this.settings; - var infoDialog = this.infoDialog = editor.children("." + this.classPrefix + "dialog-info"); - - if (infoDialog.length < 1) - { + + var _this = this; + var editor = this.editor; + var settings = this.settings; + var infoDialog = this.infoDialog = editor.children("." + this.classPrefix + "dialog-info"); + + if (infoDialog.length < 1) { this.createInfoDialog(); } - + this.lockScreen(true); - + this.mask.css({ - opacity : settings.dialogMaskOpacity, - backgroundColor : settings.dialogMaskBgColor - }).show(); + opacity: settings.dialogMaskOpacity, + backgroundColor: settings.dialogMaskBgColor + }).show(); - infoDialog.css("z-index", editormd.dialogZindex).show(); + infoDialog.css("z-index", editormd.dialogZindex).show(); - this.infoDialogPosition(); + this.infoDialogPosition(); return this; }, - + /** * 隐藏关于Editor.md * Hide about Editor.md dialog - * + * * @returns {editormd} 返回editormd的实例对象 */ - - hideInfoDialog : function() { + + hideInfoDialog: function () { $("html,body").css("overflow-x", ""); this.infoDialog.hide(); this.mask.hide(); @@ -1398,116 +1326,111 @@ return this; }, - + /** * 锁屏 * lock screen - * + * * @param {Boolean} lock Boolean 布尔值,是否锁屏 * @returns {editormd} 返回editormd的实例对象 */ - - lockScreen : function(lock) { + + lockScreen: function (lock) { editormd.lockScreen(lock); this.resize(); return this; }, - + /** * 编辑器界面重建,用于动态语言包或模块加载等 * Recreate editor - * + * * @returns {editormd} 返回editormd的实例对象 */ - - recreate : function() { - var _this = this; - var editor = this.editor; - var settings = this.settings; - + + recreate: function () { + var _this = this; + var editor = this.editor; + var settings = this.settings; + this.codeMirror.remove(); - + this.setCodeMirror(); - if (!settings.readOnly) - { + if (!settings.readOnly) { if (editor.find(".editormd-dialog").length > 0) { editor.find(".editormd-dialog").remove(); } - - if (settings.toolbar) - { - this.getToolbarHandles(); + + if (settings.toolbar) { + this.getToolbarHandles(); this.setToolbar(); } } - + this.loadedDisplay(true); return this; }, - + /** * 高亮预览HTML的pre代码部分 * highlight of preview codes - * + * * @returns {editormd} 返回editormd的实例对象 */ - - previewCodeHighlight : function() { - var settings = this.settings; + + previewCodeHighlight: function () { + var settings = this.settings; var previewContainer = this.previewContainer; - - if (settings.previewCodeHighlight) - { + + if (settings.previewCodeHighlight) { previewContainer.find("pre").addClass("prettyprint linenums"); - - if (typeof prettyPrint !== "undefined") - { + + if (typeof prettyPrint !== "undefined") { prettyPrint(); } } return this; }, - + /** * 解析TeX(KaTeX)科学公式 * TeX(KaTeX) Renderer - * + * * @returns {editormd} 返回editormd的实例对象 */ - - katexRender : function() { - - if (timer === null) - { + + katexRender: function () { + + if (timer === null) { return this; } - - this.previewContainer.find("." + editormd.classNames.tex).each(function(){ - var tex = $(this); + + this.previewContainer.find("." + editormd.classNames.tex).each(function () { + var tex = $(this); editormd.$katex.render(tex.text(), tex[0]); - + tex.find(".katex").css("font-size", "1.6em"); - }); + }); return this; }, - + /** * 解析和渲染流程图及时序图 * FlowChart and SequenceDiagram Renderer - * + * * @returns {editormd} 返回editormd的实例对象 */ - - flowChartAndSequenceDiagramRender : function() { - var $this = this; - var settings = this.settings; + + flowChartAndSequenceDiagramRender: function () { + var $this = this; + var settings = this.settings; var previewContainer = this.previewContainer; - + if (editormd.isIE8) { return this; } @@ -1516,120 +1439,106 @@ if (flowchartTimer === null) { return this; } - - previewContainer.find(".flowchart").flowChart(); + + previewContainer.find(".flowchart").flowChart(); } if (settings.sequenceDiagram) { previewContainer.find(".sequence-diagram").sequenceDiagram({theme: "simple"}); } - - var preview = $this.preview; + + var preview = $this.preview; var codeMirror = $this.codeMirror; - var codeView = codeMirror.find(".CodeMirror-scroll"); + var codeView = codeMirror.find(".CodeMirror-scroll"); - var height = codeView.height(); - var scrollTop = codeView.scrollTop(); - var percent = (scrollTop / codeView[0].scrollHeight); + var height = codeView.height(); + var scrollTop = codeView.scrollTop(); + var percent = (scrollTop / codeView[0].scrollHeight); var tocHeight = 0; - preview.find(".markdown-toc-list").each(function(){ + preview.find(".markdown-toc-list").each(function () { tocHeight += $(this).height(); }); - var tocMenuHeight = preview.find(".editormd-toc-menu").height(); + var tocMenuHeight = preview.find(".editormd-toc-menu").height(); tocMenuHeight = (!tocMenuHeight) ? 0 : tocMenuHeight; - if (scrollTop === 0) - { + if (scrollTop === 0) { preview.scrollTop(0); - } - else if (scrollTop + height >= codeView[0].scrollHeight - 16) - { - preview.scrollTop(preview[0].scrollHeight); - } - else - { + } else if (scrollTop + height >= codeView[0].scrollHeight - 16) { + preview.scrollTop(preview[0].scrollHeight); + } else { preview.scrollTop((preview[0].scrollHeight + tocHeight + tocMenuHeight) * percent); } return this; }, - + /** * 注册键盘快捷键处理 * Register CodeMirror keyMaps (keyboard shortcuts). - * + * * @param {Object} keyMap KeyMap key/value {"(Ctrl/Shift/Alt)-Key" : function(){}} * @returns {editormd} return this */ - - registerKeyMaps : function(keyMap) { - - var _this = this; - var cm = this.cm; - var settings = this.settings; + + registerKeyMaps: function (keyMap) { + + var _this = this; + var cm = this.cm; + var settings = this.settings; var toolbarHandlers = editormd.toolbarHandlers; var disabledKeyMaps = settings.disabledKeyMaps; - - keyMap = keyMap || null; - - if (keyMap) - { - for (var i in keyMap) - { - if ($.inArray(i, disabledKeyMaps) < 0) - { + + keyMap = keyMap || null; + + if (keyMap) { + for (var i in keyMap) { + if ($.inArray(i, disabledKeyMaps) < 0) { var map = {}; - map[i] = keyMap[i]; + map[i] = keyMap[i]; cm.addKeyMap(keyMap); } } - } - else - { - for (var k in editormd.keyMaps) - { + } else { + for (var k in editormd.keyMaps) { var _keyMap = editormd.keyMaps[k]; var handle = (typeof _keyMap === "string") ? $.proxy(toolbarHandlers[_keyMap], _this) : $.proxy(_keyMap, _this); - - if ($.inArray(k, ["F9", "F10", "F11"]) < 0 && $.inArray(k, disabledKeyMaps) < 0) - { + + if ($.inArray(k, ["F9", "F10", "F11"]) < 0 && $.inArray(k, disabledKeyMaps) < 0) { var _map = {}; _map[k] = handle; cm.addKeyMap(_map); } } - - $(window).keydown(function(event) { - + + $(window).keydown(function (event) { + var keymaps = { - "120" : "F9", - "121" : "F10", - "122" : "F11" + "120": "F9", + "121": "F10", + "122": "F11" }; - - if ( $.inArray(keymaps[event.keyCode], disabledKeyMaps) < 0 ) - { - switch (event.keyCode) - { + + if ($.inArray(keymaps[event.keyCode], disabledKeyMaps) < 0) { + switch (event.keyCode) { case 120: - $.proxy(toolbarHandlers["watch"], _this)(); - return false; + $.proxy(toolbarHandlers["watch"], _this)(); + return false; break; - + case 121: - $.proxy(toolbarHandlers["preview"], _this)(); - return false; + $.proxy(toolbarHandlers["preview"], _this)(); + return false; break; - + case 122: - $.proxy(toolbarHandlers["fullscreen"], _this)(); - return false; + $.proxy(toolbarHandlers["fullscreen"], _this)(); + return false; break; - + default: break; } @@ -1639,130 +1548,119 @@ return this; }, - + /** * 绑定同步滚动 - * + * * @returns {editormd} return this */ - - bindScrollEvent : function() { - - var _this = this; - var preview = this.preview; - var settings = this.settings; - var codeMirror = this.codeMirror; - var mouseOrTouch = editormd.mouseOrTouch; - + + bindScrollEvent: function () { + + var _this = this; + var preview = this.preview; + var settings = this.settings; + var codeMirror = this.codeMirror; + var mouseOrTouch = editormd.mouseOrTouch; + if (!settings.syncScrolling) { return this; } - - var cmBindScroll = function() { - codeMirror.find(".CodeMirror-scroll").bind(mouseOrTouch("scroll", "touchmove"), function(event) { - var height = $(this).height(); - var scrollTop = $(this).scrollTop(); - var percent = (scrollTop / $(this)[0].scrollHeight); - + + var cmBindScroll = function () { + codeMirror.find(".CodeMirror-scroll").bind(mouseOrTouch("scroll", "touchmove"), function (event) { + var height = $(this).height(); + var scrollTop = $(this).scrollTop(); + var percent = (scrollTop / $(this)[0].scrollHeight); + var tocHeight = 0; - - preview.find(".markdown-toc-list").each(function(){ + + preview.find(".markdown-toc-list").each(function () { tocHeight += $(this).height(); }); - + var tocMenuHeight = preview.find(".editormd-toc-menu").height(); tocMenuHeight = (!tocMenuHeight) ? 0 : tocMenuHeight; - if (scrollTop === 0) - { + if (scrollTop === 0) { preview.scrollTop(0); - } - else if (scrollTop + height >= $(this)[0].scrollHeight - 16) - { - preview.scrollTop(preview[0].scrollHeight); - } - else - { - preview.scrollTop((preview[0].scrollHeight + tocHeight + tocMenuHeight) * percent); + } else if (scrollTop + height >= $(this)[0].scrollHeight - 16) { + preview.scrollTop(preview[0].scrollHeight); + } else { + preview.scrollTop((preview[0].scrollHeight + tocHeight + tocMenuHeight) * percent); } - + $.proxy(settings.onscroll, _this)(event); }); }; - var cmUnbindScroll = function() { + var cmUnbindScroll = function () { codeMirror.find(".CodeMirror-scroll").unbind(mouseOrTouch("scroll", "touchmove")); }; - var previewBindScroll = function() { - - preview.bind(mouseOrTouch("scroll", "touchmove"), function(event) { - var height = $(this).height(); - var scrollTop = $(this).scrollTop(); - var percent = (scrollTop / $(this)[0].scrollHeight); - var codeView = codeMirror.find(".CodeMirror-scroll"); + var previewBindScroll = function () { + + preview.bind(mouseOrTouch("scroll", "touchmove"), function (event) { + var height = $(this).height(); + var scrollTop = $(this).scrollTop(); + var percent = (scrollTop / $(this)[0].scrollHeight); + var codeView = codeMirror.find(".CodeMirror-scroll"); - if(scrollTop === 0) - { + if (scrollTop === 0) { codeView.scrollTop(0); - } - else if (scrollTop + height >= $(this)[0].scrollHeight) - { - codeView.scrollTop(codeView[0].scrollHeight); - } - else - { + } else if (scrollTop + height >= $(this)[0].scrollHeight) { + codeView.scrollTop(codeView[0].scrollHeight); + } else { codeView.scrollTop(codeView[0].scrollHeight * percent); } - + $.proxy(settings.onpreviewscroll, _this)(event); }); }; - var previewUnbindScroll = function() { + var previewUnbindScroll = function () { preview.unbind(mouseOrTouch("scroll", "touchmove")); - }; - - codeMirror.bind({ - mouseover : cmBindScroll, - mouseout : cmUnbindScroll, - touchstart : cmBindScroll, - touchend : cmUnbindScroll - }); - + }; + + codeMirror.bind({ + mouseover: cmBindScroll, + mouseout: cmUnbindScroll, + touchstart: cmBindScroll, + touchend: cmUnbindScroll + }); + if (settings.syncScrolling === "single") { return this; } - - preview.bind({ - mouseover : previewBindScroll, - mouseout : previewUnbindScroll, - touchstart : previewBindScroll, - touchend : previewUnbindScroll - }); + + preview.bind({ + mouseover: previewBindScroll, + mouseout: previewUnbindScroll, + touchstart: previewBindScroll, + touchend: previewUnbindScroll + }); return this; }, - - bindChangeEvent : function() { - - var _this = this; - var cm = this.cm; - var settings = this.settings; - + + bindChangeEvent: function () { + + var _this = this; + var cm = this.cm; + var settings = this.settings; + if (!settings.syncScrolling) { return this; } - - cm.on("change", function(_cm, changeObj) { - - if (settings.watch) - { + + cm.on("change", function (_cm, changeObj) { + + if (settings.watch) { _this.previewContainer.css("padding", settings.autoHeight ? "20px 20px 50px 40px" : "20px"); } - - timer = setTimeout(function() { + + timer = setTimeout(function () { clearTimeout(timer); _this.save(); timer = null; @@ -1771,715 +1669,678 @@ return this; }, - + /** * 加载队列完成之后的显示处理 * Display handle of the module queues loaded after. - * + * * @param {Boolean} recreate 是否为重建编辑器 * @returns {editormd} 返回editormd的实例对象 */ - - loadedDisplay : function(recreate) { - - recreate = recreate || false; - - var _this = this; - var editor = this.editor; - var preview = this.preview; - var settings = this.settings; - + + loadedDisplay: function (recreate) { + + recreate = recreate || false; + + var _this = this; + var editor = this.editor; + var preview = this.preview; + var settings = this.settings; + this.containerMask.hide(); - + this.save(); - + if (settings.watch) { preview.show(); } - + editor.data("oldWidth", editor.width()).data("oldHeight", editor.height()); // 为了兼容Zepto - + this.resize(); this.registerKeyMaps(); - - $(window).resize(function(){ + + $(window).resize(function () { _this.resize(); }); - + this.bindScrollEvent().bindChangeEvent(); - - if (!recreate) - { + + if (!recreate) { $.proxy(settings.onload, this)(); } - + this.state.loaded = true; return this; }, - + /** * 设置编辑器的宽度 * Set editor width - * + * * @param {Number|String} width 编辑器宽度值 * @returns {editormd} 返回editormd的实例对象 */ - - width : function(width) { - - this.editor.css("width", (typeof width === "number") ? width + "px" : width); + + width: function (width) { + + this.editor.css("width", (typeof width === "number") ? width + "px" : width); this.resize(); - + return this; }, - + /** * 设置编辑器的高度 * Set editor height - * + * * @param {Number|String} height 编辑器高度值 * @returns {editormd} 返回editormd的实例对象 */ - - height : function(height) { - - this.editor.css("height", (typeof height === "number") ? height + "px" : height); + + height: function (height) { + + this.editor.css("height", (typeof height === "number") ? height + "px" : height); this.resize(); - + return this; }, - + /** * 调整编辑器的尺寸和布局 * Resize editor layout - * + * * @param {Number|String} [width=null] 编辑器宽度值 * @param {Number|String} [height=null] 编辑器高度值 * @returns {editormd} 返回editormd的实例对象 */ - - resize : function(width, height) { - - width = width || null; + + resize: function (width, height) { + + width = width || null; height = height || null; - - var state = this.state; - var editor = this.editor; - var preview = this.preview; - var toolbar = this.toolbar; - var settings = this.settings; + + var state = this.state; + var editor = this.editor; + var preview = this.preview; + var toolbar = this.toolbar; + var settings = this.settings; var codeMirror = this.codeMirror; - - if (width) - { - editor.css("width", (typeof width === "number") ? width + "px" : width); + + if (width) { + editor.css("width", (typeof width === "number") ? width + "px" : width); } - - if (settings.autoHeight && !state.fullscreen && !state.preview) - { + + if (settings.autoHeight && !state.fullscreen && !state.preview) { editor.css("height", "auto"); codeMirror.css("height", "auto"); - } - else - { - if (height) - { + } else { + if (height) { editor.css("height", (typeof height === "number") ? height + "px" : height); } - - if (state.fullscreen) - { + + if (state.fullscreen) { editor.height($(window).height()); } - if (settings.toolbar && !settings.readOnly) - { + if (settings.toolbar && !settings.readOnly) { codeMirror.css("margin-top", toolbar.height() + 1).height(editor.height() - toolbar.height()); - } - else - { + } else { codeMirror.css("margin-top", 0).height(editor.height()); } } - - if(settings.watch) - { + + if (settings.watch) { codeMirror.width(editor.width() / 2); preview.width((!state.preview) ? editor.width() / 2 : editor.width()); - + this.previewContainer.css("padding", settings.autoHeight ? "20px 20px 50px 40px" : "20px"); - - if (settings.toolbar && !settings.readOnly) - { + + if (settings.toolbar && !settings.readOnly) { preview.css("top", toolbar.height() + 1); - } - else - { + } else { preview.css("top", 0); } - - if (settings.autoHeight && !state.fullscreen && !state.preview) - { + + if (settings.autoHeight && !state.fullscreen && !state.preview) { preview.height(""); - } - else - { + } else { var previewHeight = (settings.toolbar && !settings.readOnly) ? editor.height() - toolbar.height() : editor.height(); - + preview.height(previewHeight); } - } - else - { + } else { codeMirror.width(editor.width()); preview.hide(); } - - if (state.loaded) - { + + if (state.loaded) { $.proxy(settings.onresize, this)(); } return this; }, - + /** * 解析和保存Markdown代码 * Parse & Saving Markdown source code - * + * * @returns {editormd} 返回editormd的实例对象 */ - - save : function() { - - if (timer === null) - { + + save: function () { + + if (timer === null) { return this; } - - var _this = this; - var state = this.state; - var settings = this.settings; - var cm = this.cm; - var cmValue = cm.getValue(); + + var _this = this; + var state = this.state; + var settings = this.settings; + var cm = this.cm; + var cmValue = cm.getValue(); var previewContainer = this.previewContainer; - if (settings.mode !== "gfm" && settings.mode !== "markdown") - { + if (settings.mode !== "gfm" && settings.mode !== "markdown") { this.markdownTextarea.val(cmValue); - + return this; } - - var marked = editormd.$marked; - var markdownToC = this.markdownToC = []; - var rendererOptions = this.markedRendererOptions = { - toc : settings.toc, - tocm : settings.tocm, - tocStartLevel : settings.tocStartLevel, - pageBreak : settings.pageBreak, - taskList : settings.taskList, - emoji : settings.emoji, - tex : settings.tex, - atLink : settings.atLink, // for @link - emailLink : settings.emailLink, // for mail address auto link - flowChart : settings.flowChart, - sequenceDiagram : settings.sequenceDiagram, - previewCodeHighlight : settings.previewCodeHighlight, + + var marked = editormd.$marked; + var markdownToC = this.markdownToC = []; + var rendererOptions = this.markedRendererOptions = { + toc: settings.toc, + tocm: settings.tocm, + tocStartLevel: settings.tocStartLevel, + pageBreak: settings.pageBreak, + taskList: settings.taskList, + emoji: settings.emoji, + tex: settings.tex, + atLink: settings.atLink, // for @link + emailLink: settings.emailLink, // for mail address auto link + flowChart: settings.flowChart, + sequenceDiagram: settings.sequenceDiagram, + previewCodeHighlight: settings.previewCodeHighlight, }; - + var markedOptions = this.markedOptions = { - renderer : editormd.markedRenderer(markdownToC, rendererOptions), - gfm : true, - tables : true, - breaks : true, - pedantic : false, - sanitize : (settings.htmlDecode) ? false : true, // 关闭忽略HTML标签,即开启识别HTML标签,默认为false - smartLists : true, - smartypants : true + renderer: editormd.markedRenderer(markdownToC, rendererOptions), + gfm: true, + tables: true, + breaks: true, + pedantic: false, + sanitize: (settings.htmlDecode) ? false : true, // 关闭忽略HTML标签,即开启识别HTML标签,默认为false + smartLists: true, + smartypants: true }; - + marked.setOptions(markedOptions); - + var newMarkdownDoc = editormd.$marked(cmValue, markedOptions); - + //console.info("cmValue", cmValue, newMarkdownDoc); - + newMarkdownDoc = editormd.filterHTMLTags(newMarkdownDoc, settings.htmlDecode); - + //console.error("cmValue", cmValue, newMarkdownDoc); - + this.markdownTextarea.text(cmValue); - + cm.save(); - - if (settings.saveHTMLToTextarea) - { + + if (settings.saveHTMLToTextarea) { this.htmlTextarea.text(newMarkdownDoc); } - - if(settings.watch || (!settings.watch && state.preview)) - { + + if (settings.watch || (!settings.watch && state.preview)) { previewContainer.html(newMarkdownDoc); this.previewCodeHighlight(); - - if (settings.toc) - { + + if (settings.toc) { var tocContainer = (settings.tocContainer === "") ? previewContainer : $(settings.tocContainer); - var tocMenu = tocContainer.find("." + this.classPrefix + "toc-menu"); - + var tocMenu = tocContainer.find("." + this.classPrefix + "toc-menu"); + tocContainer.attr("previewContainer", (settings.tocContainer === "") ? "true" : "false"); - - if (settings.tocContainer !== "" && tocMenu.length > 0) - { + + if (settings.tocContainer !== "" && tocMenu.length > 0) { tocMenu.remove(); } - + editormd.markdownToCRenderer(markdownToC, tocContainer, settings.tocDropdown, settings.tocStartLevel); - - if (settings.tocDropdown || tocContainer.find("." + this.classPrefix + "toc-menu").length > 0) - { + + if (settings.tocDropdown || tocContainer.find("." + this.classPrefix + "toc-menu").length > 0) { editormd.tocDropdownMenu(tocContainer, (settings.tocTitle !== "") ? settings.tocTitle : this.lang.tocTitle); } - - if (settings.tocContainer !== "") - { + + if (settings.tocContainer !== "") { previewContainer.find(".markdown-toc").css("border", "none"); } } - - if (settings.tex) - { - if (!editormd.kaTeXLoaded && settings.autoLoadModules) - { - editormd.loadKaTeX(function() { + + if (settings.tex) { + if (!editormd.kaTeXLoaded && settings.autoLoadModules) { + editormd.loadKaTeX(function () { editormd.$katex = katex; editormd.kaTeXLoaded = true; _this.katexRender(); }); - } - else - { + } else { editormd.$katex = katex; this.katexRender(); } - } - - if (settings.flowChart || settings.sequenceDiagram) - { - flowchartTimer = setTimeout(function(){ + } + + if (settings.flowChart || settings.sequenceDiagram) { + flowchartTimer = setTimeout(function () { clearTimeout(flowchartTimer); _this.flowChartAndSequenceDiagramRender(); flowchartTimer = null; }, 10); } - if (state.loaded) - { + if (state.loaded) { $.proxy(settings.onchange, this)(); } } return this; }, - + /** * 聚焦光标位置 * Focusing the cursor position - * + * * @returns {editormd} 返回editormd的实例对象 */ - - focus : function() { + + focus: function () { this.cm.focus(); return this; }, - + /** * 设置光标的位置 * Set cursor position - * + * * @param {Object} cursor 要设置的光标位置键值对象,例:{line:1, ch:0} * @returns {editormd} 返回editormd的实例对象 */ - - setCursor : function(cursor) { + + setCursor: function (cursor) { this.cm.setCursor(cursor); return this; }, - + /** * 获取当前光标的位置 * Get the current position of the cursor - * + * * @returns {Cursor} 返回一个光标Cursor对象 */ - - getCursor : function() { + + getCursor: function () { return this.cm.getCursor(); }, - + /** * 设置光标选中的范围 * Set cursor selected ranges - * + * * @param {Object} from 开始位置的光标键值对象,例:{line:1, ch:0} * @param {Object} to 结束位置的光标键值对象,例:{line:1, ch:0} * @returns {editormd} 返回editormd的实例对象 */ - - setSelection : function(from, to) { - + + setSelection: function (from, to) { + this.cm.setSelection(from, to); - + return this; }, - + /** * 获取光标选中的文本 * Get the texts from cursor selected - * + * * @returns {String} 返回选中文本的字符串形式 */ - - getSelection : function() { + + getSelection: function () { return this.cm.getSelection(); }, - + /** * 设置光标选中的文本范围 * Set the cursor selection ranges - * + * * @param {Array} ranges cursor selection ranges array * @returns {Array} return this */ - - setSelections : function(ranges) { + + setSelections: function (ranges) { this.cm.setSelections(ranges); - + return this; }, - + /** * 获取光标选中的文本范围 * Get the cursor selection ranges - * + * * @returns {Array} return selection ranges array */ - - getSelections : function() { + + getSelections: function () { return this.cm.getSelections(); }, - + /** * 替换当前光标选中的文本或在当前光标处插入新字符 * Replace the text at the current cursor selected or insert a new character at the current cursor position - * + * * @param {String} value 要插入的字符值 * @returns {editormd} 返回editormd的实例对象 */ - - replaceSelection : function(value) { + + replaceSelection: function (value) { this.cm.replaceSelection(value); return this; }, - + /** * 在当前光标处插入新字符 * Insert a new character at the current cursor position * * 同replaceSelection()方法 * With the replaceSelection() method - * + * * @param {String} value 要插入的字符值 * @returns {editormd} 返回editormd的实例对象 */ - - insertValue : function(value) { + + insertValue: function (value) { this.replaceSelection(value); return this; }, - + /** * 追加markdown * append Markdown to editor - * + * * @param {String} md 要追加的markdown源文档 * @returns {editormd} 返回editormd的实例对象 */ - - appendMarkdown : function(md) { + + appendMarkdown: function (md) { var settings = this.settings; - var cm = this.cm; - + var cm = this.cm; + cm.setValue(cm.getValue() + md); - + return this; }, - + /** * 设置和传入编辑器的markdown源文档 * Set Markdown source document - * + * * @param {String} md 要传入的markdown源文档 * @returns {editormd} 返回editormd的实例对象 */ - - setMarkdown : function(md) { + + setMarkdown: function (md) { this.cm.setValue(md || this.settings.markdown); - + return this; }, - + /** * 获取编辑器的markdown源文档 * Set Editor.md markdown/CodeMirror value - * + * * @returns {editormd} 返回editormd的实例对象 */ - - getMarkdown : function() { + + getMarkdown: function () { return this.cm.getValue(); }, - + /** * 获取编辑器的源文档 * Get CodeMirror value - * + * * @returns {editormd} 返回editormd的实例对象 */ - - getValue : function() { + + getValue: function () { return this.cm.getValue(); }, - + /** * 设置编辑器的源文档 * Set CodeMirror value - * + * * @param {String} value set code/value/string/text * @returns {editormd} 返回editormd的实例对象 */ - - setValue : function(value) { + + setValue: function (value) { this.cm.setValue(value); - + return this; }, - + /** * 清空编辑器 * Empty CodeMirror editor container - * + * * @returns {editormd} 返回editormd的实例对象 */ - - clear : function() { + + clear: function () { this.cm.setValue(""); - + return this; }, - + /** * 获取解析后存放在Textarea的HTML源码 * Get parsed html code from Textarea - * + * * @returns {String} 返回HTML源码 */ - - getHTML : function() { - if (!this.settings.saveHTMLToTextarea) - { + + getHTML: function () { + if (!this.settings.saveHTMLToTextarea) { alert("Error: settings.saveHTMLToTextarea == false"); return false; } - + return this.htmlTextarea.val(); }, - + /** * getHTML()的别名 * getHTML (alias) - * + * * @returns {String} Return html code 返回HTML源码 */ - - getTextareaSavedHTML : function() { + + getTextareaSavedHTML: function () { return this.getHTML(); }, - + /** * 获取预览窗口的HTML源码 * Get html from preview container - * + * * @returns {editormd} 返回editormd的实例对象 */ - - getPreviewedHTML : function() { - if (!this.settings.watch) - { + + getPreviewedHTML: function () { + if (!this.settings.watch) { alert("Error: settings.watch == false"); return false; } - + return this.previewContainer.html(); }, - + /** * 开启实时预览 * Enable real-time watching - * + * * @returns {editormd} 返回editormd的实例对象 */ - - watch : function(callback) { - var settings = this.settings; - - if ($.inArray(settings.mode, ["gfm", "markdown"]) < 0) - { + + watch: function (callback) { + var settings = this.settings; + + if ($.inArray(settings.mode, ["gfm", "markdown"]) < 0) { return this; } - + this.state.watching = settings.watch = true; this.preview.show(); - - if (this.toolbar) - { - var watchIcon = settings.toolbarIconsClass.watch; + + if (this.toolbar) { + var watchIcon = settings.toolbarIconsClass.watch; var unWatchIcon = settings.toolbarIconsClass.unwatch; - - var icon = this.toolbar.find(".fa[name=watch]"); + + var icon = this.toolbar.find(".fa[name=watch]"); icon.parent().attr("title", settings.lang.toolbar.watch); icon.removeClass(unWatchIcon).addClass(watchIcon); } - - this.codeMirror.css("border-right", "1px solid #ddd").width(this.editor.width() / 2); - + + this.codeMirror.css("border-right", "1px solid #ddd").width(this.editor.width() / 2); + timer = 0; - + this.save().resize(); - - if (!settings.onwatch) - { - settings.onwatch = callback || function() {}; + + if (!settings.onwatch) { + settings.onwatch = callback || function () { + }; } - + $.proxy(settings.onwatch, this)(); - + return this; }, - + /** * 关闭实时预览 * Disable real-time watching - * + * * @returns {editormd} 返回editormd的实例对象 */ - - unwatch : function(callback) { - var settings = this.settings; + + unwatch: function (callback) { + var settings = this.settings; this.state.watching = settings.watch = false; this.preview.hide(); - - if (this.toolbar) - { - var watchIcon = settings.toolbarIconsClass.watch; + + if (this.toolbar) { + var watchIcon = settings.toolbarIconsClass.watch; var unWatchIcon = settings.toolbarIconsClass.unwatch; - - var icon = this.toolbar.find(".fa[name=watch]"); + + var icon = this.toolbar.find(".fa[name=watch]"); icon.parent().attr("title", settings.lang.toolbar.unwatch); icon.removeClass(watchIcon).addClass(unWatchIcon); } - + this.codeMirror.css("border-right", "none").width(this.editor.width()); - + this.resize(); - - if (!settings.onunwatch) - { - settings.onunwatch = callback || function() {}; + + if (!settings.onunwatch) { + settings.onunwatch = callback || function () { + }; } - + $.proxy(settings.onunwatch, this)(); - + return this; }, - + /** * 显示编辑器 * Show editor - * + * * @param {Function} [callback=function()] 回调函数 * @returns {editormd} 返回editormd的实例对象 */ - - show : function(callback) { - callback = callback || function() {}; - + + show: function (callback) { + callback = callback || function () { + }; + var _this = this; - this.editor.show(0, function() { + this.editor.show(0, function () { $.proxy(callback, _this)(); }); - + return this; }, - + /** * 隐藏编辑器 * Hide editor - * + * * @param {Function} [callback=function()] 回调函数 * @returns {editormd} 返回editormd的实例对象 */ - - hide : function(callback) { - callback = callback || function() {}; - + + hide: function (callback) { + callback = callback || function () { + }; + var _this = this; - this.editor.hide(0, function() { + this.editor.hide(0, function () { $.proxy(callback, _this)(); }); - + return this; }, - + /** * 隐藏编辑器部分,只预览HTML * Enter preview html state - * + * * @returns {editormd} 返回editormd的实例对象 */ - - previewing : function() { - - var _this = this; - var editor = this.editor; - var preview = this.preview; - var toolbar = this.toolbar; - var settings = this.settings; - var codeMirror = this.codeMirror; + + previewing: function () { + + var _this = this; + var editor = this.editor; + var preview = this.preview; + var toolbar = this.toolbar; + var settings = this.settings; + var codeMirror = this.codeMirror; var previewContainer = this.previewContainer; - + if ($.inArray(settings.mode, ["gfm", "markdown"]) < 0) { return this; } - + if (settings.toolbar && toolbar) { toolbar.toggle(); toolbar.find(".fa[name=preview]").toggleClass("active"); } - + codeMirror.toggle(); - - var escHandle = function(event) { + + var escHandle = function (event) { if (event.shiftKey && event.keyCode === 27) { _this.previewed(); } @@ -2492,303 +2353,282 @@ if (this.state.fullscreen) { preview.css("background", "#fff"); } - - editor.find("." + this.classPrefix + "preview-close-btn").show().bind(editormd.mouseOrTouch("click", "touchend"), function(){ + + editor.find("." + this.classPrefix + "preview-close-btn").show().bind(editormd.mouseOrTouch("click", "touchend"), function () { _this.previewed(); }); - - if (!settings.watch) - { + + if (!settings.watch) { this.save(); - } - else - { + } else { previewContainer.css("padding", ""); } - + previewContainer.addClass(this.classPrefix + "preview-active"); preview.show().css({ - position : "", - top : 0, - width : editor.width(), - height : (settings.autoHeight && !this.state.fullscreen) ? "auto" : editor.height() + position: "", + top: 0, + width: editor.width(), + height: (settings.autoHeight && !this.state.fullscreen) ? "auto" : editor.height() }); - - if (this.state.loaded) - { + + if (this.state.loaded) { $.proxy(settings.onpreviewing, this)(); } $(window).bind("keyup", escHandle); - } - else - { + } else { $(window).unbind("keyup", escHandle); this.previewed(); } }, - + /** * 显示编辑器部分,退出只预览HTML * Exit preview html state - * + * * @returns {editormd} 返回editormd的实例对象 */ - - previewed : function() { - - var editor = this.editor; - var preview = this.preview; - var toolbar = this.toolbar; - var settings = this.settings; + + previewed: function () { + + var editor = this.editor; + var preview = this.preview; + var toolbar = this.toolbar; + var settings = this.settings; var previewContainer = this.previewContainer; - var previewCloseBtn = editor.find("." + this.classPrefix + "preview-close-btn"); + var previewCloseBtn = editor.find("." + this.classPrefix + "preview-close-btn"); + + this.state.preview = false; - this.state.preview = false; - this.codeMirror.show(); - + if (settings.toolbar) { toolbar.show(); } - + preview[(settings.watch) ? "show" : "hide"](); - + previewCloseBtn.hide().unbind(editormd.mouseOrTouch("click", "touchend")); - + previewContainer.removeClass(this.classPrefix + "preview-active"); - - if (settings.watch) - { + + if (settings.watch) { previewContainer.css("padding", "20px"); } - - preview.css({ - background : null, - position : "absolute", - width : editor.width() / 2, - height : (settings.autoHeight && !this.state.fullscreen) ? "auto" : editor.height() - toolbar.height(), - top : (settings.toolbar) ? toolbar.height() : 0 + + preview.css({ + background: null, + position: "absolute", + width: editor.width() / 2, + height: (settings.autoHeight && !this.state.fullscreen) ? "auto" : editor.height() - toolbar.height(), + top: (settings.toolbar) ? toolbar.height() : 0 }); - if (this.state.loaded) - { + if (this.state.loaded) { $.proxy(settings.onpreviewed, this)(); } - + return this; }, - + /** * 编辑器全屏显示 * Fullscreen show - * + * * @returns {editormd} 返回editormd的实例对象 */ - - fullscreen : function() { - - var _this = this; - var state = this.state; - var editor = this.editor; - var preview = this.preview; - var toolbar = this.toolbar; - var settings = this.settings; - var fullscreenClass = this.classPrefix + "fullscreen"; - + + fullscreen: function () { + + var _this = this; + var state = this.state; + var editor = this.editor; + var preview = this.preview; + var toolbar = this.toolbar; + var settings = this.settings; + var fullscreenClass = this.classPrefix + "fullscreen"; + if (toolbar) { - toolbar.find(".fa[name=fullscreen]").parent().toggleClass("active"); - } - - var escHandle = function(event) { - if (!event.shiftKey && event.keyCode === 27) - { - if (state.fullscreen) - { + toolbar.find(".fa[name=fullscreen]").parent().toggleClass("active"); + } + + var escHandle = function (event) { + if (!event.shiftKey && event.keyCode === 27) { + if (state.fullscreen) { _this.fullscreenExit(); } } }; - if (!editor.hasClass(fullscreenClass)) - { + if (!editor.hasClass(fullscreenClass)) { state.fullscreen = true; $("html,body").css("overflow", "hidden"); - + editor.css({ - width : $(window).width(), - height : $(window).height() + width: $(window).width(), + height: $(window).height() }).addClass(fullscreenClass); this.resize(); - + $.proxy(settings.onfullscreen, this)(); $(window).bind("keyup", escHandle); - } - else - { - $(window).unbind("keyup", escHandle); + } else { + $(window).unbind("keyup", escHandle); this.fullscreenExit(); } return this; }, - + /** * 编辑器退出全屏显示 * Exit fullscreen state - * + * * @returns {editormd} 返回editormd的实例对象 */ - - fullscreenExit : function() { - - var editor = this.editor; - var settings = this.settings; - var toolbar = this.toolbar; - var fullscreenClass = this.classPrefix + "fullscreen"; - + + fullscreenExit: function () { + + var editor = this.editor; + var settings = this.settings; + var toolbar = this.toolbar; + var fullscreenClass = this.classPrefix + "fullscreen"; + this.state.fullscreen = false; - + if (toolbar) { - toolbar.find(".fa[name=fullscreen]").parent().removeClass("active"); + toolbar.find(".fa[name=fullscreen]").parent().removeClass("active"); } $("html,body").css("overflow", ""); editor.css({ - width : editor.data("oldWidth"), - height : editor.data("oldHeight") + width: editor.data("oldWidth"), + height: editor.data("oldHeight") }).removeClass(fullscreenClass); this.resize(); - + $.proxy(settings.onfullscreenExit, this)(); return this; }, - + /** * 加载并执行插件 * Load and execute the plugin - * + * * @param {String} name plugin name / function name * @param {String} path plugin load path * @returns {editormd} 返回editormd的实例对象 */ - - executePlugin : function(name, path) { - - var _this = this; - var cm = this.cm; + + executePlugin: function (name, path) { + + var _this = this; + var cm = this.cm; var settings = this.settings; - + path = settings.pluginPath + path; - - if (typeof define === "function") - { - if (typeof this[name] === "undefined") - { + + if (typeof define === "function") { + if (typeof this[name] === "undefined") { alert("Error: " + name + " plugin is not found, you are not load this plugin."); - + return this; } - + this[name](cm); - + return this; } - - if ($.inArray(path, editormd.loadFiles.plugin) < 0) - { - editormd.loadPlugin(path, function() { + + if ($.inArray(path, editormd.loadFiles.plugin) < 0) { + editormd.loadPlugin(path, function () { editormd.loadPlugins[name] = _this[name]; _this[name](cm); }); - } - else - { + } else { $.proxy(editormd.loadPlugins[name], this)(cm); } - + return this; }, - + /** * 搜索替换 * Search & replace - * + * * @param {String} command CodeMirror serach commands, "find, fintNext, fintPrev, clearSearch, replace, replaceAll" * @returns {editormd} return this */ - - search : function(command) { + + search: function (command) { var settings = this.settings; - - if (!settings.searchReplace) - { + + if (!settings.searchReplace) { alert("Error: settings.searchReplace == false"); return this; } - - if (!settings.readOnly) - { + + if (!settings.readOnly) { this.cm.execCommand(command || "find"); } - + return this; }, - - searchReplace : function() { + + searchReplace: function () { this.search("replace"); - + return this; }, - - searchReplaceAll : function() { + + searchReplaceAll: function () { this.search("replaceAll"); - + return this; } }; - - editormd.fn.init.prototype = editormd.fn; - + + editormd.fn.init.prototype = editormd.fn; + /** * 锁屏 * lock screen when dialog opening - * + * * @returns {void} */ - editormd.dialogLockScreen = function() { - var settings = this.settings || {dialogLockScreen : true}; - - if (settings.dialogLockScreen) - { + editormd.dialogLockScreen = function () { + var settings = this.settings || {dialogLockScreen: true}; + + if (settings.dialogLockScreen) { $("html,body").css("overflow", "hidden"); this.resize(); } }; - + /** * 显示透明背景层 * Display mask layer when dialog opening - * + * * @param {Object} dialog dialog jQuery object * @returns {void} */ - - editormd.dialogShowMask = function(dialog) { - var editor = this.editor; - var settings = this.settings || {dialogShowMask : true}; - + + editormd.dialogShowMask = function (dialog) { + var editor = this.editor; + var settings = this.settings || {dialogShowMask: true}; + dialog.css({ - top : ($(window).height() - dialog.height()) / 2 + "px", - left : ($(window).width() - dialog.width()) / 2 + "px" + top: ($(window).height() - dialog.height()) / 2 + "px", + left: ($(window).width() - dialog.width()) / 2 + "px" }); if (settings.dialogShowMask) { @@ -2797,224 +2637,199 @@ }; editormd.toolbarHandlers = { - undo : function() { + undo: function () { this.cm.undo(); }, - - redo : function() { + + redo: function () { this.cm.redo(); }, - - bold : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + + bold: function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); cm.replaceSelection("**" + selection + "**"); - if(selection === "") { + if (selection === "") { cm.setCursor(cursor.line, cursor.ch + 2); } }, - - del : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + + del: function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); cm.replaceSelection("~~" + selection + "~~"); - if(selection === "") { + if (selection === "") { cm.setCursor(cursor.line, cursor.ch + 2); } }, - italic : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + italic: function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); cm.replaceSelection("*" + selection + "*"); - if(selection === "") { + if (selection === "") { cm.setCursor(cursor.line, cursor.ch + 1); } }, - quote : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + quote: function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); - if (cursor.ch !== 0) - { + if (cursor.ch !== 0) { cm.setCursor(cursor.line, 0); cm.replaceSelection("> " + selection); cm.setCursor(cursor.line, cursor.ch + 2); - } - else - { + } else { cm.replaceSelection("> " + selection); } //cm.replaceSelection("> " + selection); //cm.setCursor(cursor.line, (selection === "") ? cursor.ch + 2 : cursor.ch + selection.length + 2); }, - - ucfirst : function() { - var cm = this.cm; - var selection = cm.getSelection(); + + ucfirst: function () { + var cm = this.cm; + var selection = cm.getSelection(); var selections = cm.listSelections(); cm.replaceSelection(editormd.firstUpperCase(selection)); cm.setSelections(selections); }, - - ucwords : function() { - var cm = this.cm; - var selection = cm.getSelection(); + + ucwords: function () { + var cm = this.cm; + var selection = cm.getSelection(); var selections = cm.listSelections(); cm.replaceSelection(editormd.wordsFirstUpperCase(selection)); cm.setSelections(selections); }, - - uppercase : function() { - var cm = this.cm; - var selection = cm.getSelection(); + + uppercase: function () { + var cm = this.cm; + var selection = cm.getSelection(); var selections = cm.listSelections(); cm.replaceSelection(selection.toUpperCase()); cm.setSelections(selections); }, - - lowercase : function() { - var cm = this.cm; - var cursor = cm.getCursor(); - var selection = cm.getSelection(); + + lowercase: function () { + var cm = this.cm; + var cursor = cm.getCursor(); + var selection = cm.getSelection(); var selections = cm.listSelections(); - + cm.replaceSelection(selection.toLowerCase()); cm.setSelections(selections); }, - h1 : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + h1: function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); - if (cursor.ch !== 0) - { + if (cursor.ch !== 0) { cm.setCursor(cursor.line, 0); cm.replaceSelection("# " + selection); cm.setCursor(cursor.line, cursor.ch + 2); - } - else - { + } else { cm.replaceSelection("# " + selection); } }, - h2 : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + h2: function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); - if (cursor.ch !== 0) - { + if (cursor.ch !== 0) { cm.setCursor(cursor.line, 0); cm.replaceSelection("## " + selection); cm.setCursor(cursor.line, cursor.ch + 3); - } - else - { + } else { cm.replaceSelection("## " + selection); } }, - h3 : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + h3: function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); - if (cursor.ch !== 0) - { + if (cursor.ch !== 0) { cm.setCursor(cursor.line, 0); cm.replaceSelection("### " + selection); cm.setCursor(cursor.line, cursor.ch + 4); - } - else - { + } else { cm.replaceSelection("### " + selection); } }, - h4 : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + h4: function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); - if (cursor.ch !== 0) - { + if (cursor.ch !== 0) { cm.setCursor(cursor.line, 0); cm.replaceSelection("#### " + selection); cm.setCursor(cursor.line, cursor.ch + 5); - } - else - { + } else { cm.replaceSelection("#### " + selection); } }, - h5 : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + h5: function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); - if (cursor.ch !== 0) - { + if (cursor.ch !== 0) { cm.setCursor(cursor.line, 0); cm.replaceSelection("##### " + selection); cm.setCursor(cursor.line, cursor.ch + 6); - } - else - { + } else { cm.replaceSelection("##### " + selection); } }, - h6 : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + h6: function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); - if (cursor.ch !== 0) - { + if (cursor.ch !== 0) { cm.setCursor(cursor.line, 0); cm.replaceSelection("###### " + selection); cm.setCursor(cursor.line, cursor.ch + 7); - } - else - { + } else { cm.replaceSelection("###### " + selection); } }, - "list-ul" : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + "list-ul": function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); - if (selection === "") - { + if (selection === "") { cm.replaceSelection("- " + selection); - } - else - { + } else { var selectionText = selection.split("\n"); - for (var i = 0, len = selectionText.length; i < len; i++) - { + for (var i = 0, len = selectionText.length; i < len; i++) { selectionText[i] = (selectionText[i] === "") ? "" : "- " + selectionText[i]; } @@ -3022,82 +2837,76 @@ } }, - "list-ol" : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + "list-ol": function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); - if(selection === "") - { + if (selection === "") { cm.replaceSelection("1. " + selection); - } - else - { + } else { var selectionText = selection.split("\n"); - for (var i = 0, len = selectionText.length; i < len; i++) - { - selectionText[i] = (selectionText[i] === "") ? "" : (i+1) + ". " + selectionText[i]; + for (var i = 0, len = selectionText.length; i < len; i++) { + selectionText[i] = (selectionText[i] === "") ? "" : (i + 1) + ". " + selectionText[i]; } cm.replaceSelection(selectionText.join("\n")); } }, - hr : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + hr: function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); cm.replaceSelection(((cursor.ch !== 0) ? "\n\n" : "\n") + "------------\n\n"); }, - tex : function() { - if (!this.settings.tex) - { + tex: function () { + if (!this.settings.tex) { alert("settings.tex === false"); return this; } - - var cm = this.cm; - var cursor = cm.getCursor(); + + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); cm.replaceSelection("$$" + selection + "$$"); - if(selection === "") { + if (selection === "") { cm.setCursor(cursor.line, cursor.ch + 2); } }, - link : function() { + link: function () { this.executePlugin("linkDialog", "link-dialog/link-dialog"); }, - "reference-link" : function() { + "reference-link": function () { this.executePlugin("referenceLinkDialog", "reference-link-dialog/reference-link-dialog"); }, - pagebreak : function() { - if (!this.settings.pageBreak) - { + pagebreak: function () { + if (!this.settings.pageBreak) { alert("settings.pageBreak === false"); return this; } - - var cm = this.cm; + + var cm = this.cm; var selection = cm.getSelection(); cm.replaceSelection("\r\n[========]\r\n"); }, - image : function() { + image: function () { this.executePlugin("imageDialog", "image-dialog/image-dialog"); }, - - code : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + + code: function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); cm.replaceSelection("`" + selection + "`"); @@ -3107,88 +2916,87 @@ } }, - "code-block" : function() { - this.executePlugin("codeBlockDialog", "code-block-dialog/code-block-dialog"); + "code-block": function () { + this.executePlugin("codeBlockDialog", "code-block-dialog/code-block-dialog"); }, - "preformatted-text" : function() { + "preformatted-text": function () { this.executePlugin("preformattedTextDialog", "preformatted-text-dialog/preformatted-text-dialog"); }, - - table : function() { - this.executePlugin("tableDialog", "table-dialog/table-dialog"); + + table: function () { + this.executePlugin("tableDialog", "table-dialog/table-dialog"); }, - - datetime : function() { - var cm = this.cm; + + datetime: function () { + var cm = this.cm; var selection = cm.getSelection(); - var date = new Date(); - var langName = this.settings.lang.name; - var datefmt = editormd.dateFormat() + " " + editormd.dateFormat((langName === "zh-cn" || langName === "zh-tw") ? "cn-week-day" : "week-day"); + var date = new Date(); + var langName = this.settings.lang.name; + var datefmt = editormd.dateFormat() + " " + editormd.dateFormat((langName === "zh-cn" || langName === "zh-tw") ? "cn-week-day" : "week-day"); cm.replaceSelection(datefmt); }, - - emoji : function() { + + emoji: function () { this.executePlugin("emojiDialog", "emoji-dialog/emoji-dialog"); }, - - "html-entities" : function() { + + "html-entities": function () { this.executePlugin("htmlEntitiesDialog", "html-entities-dialog/html-entities-dialog"); }, - - "goto-line" : function() { + + "goto-line": function () { this.executePlugin("gotoLineDialog", "goto-line-dialog/goto-line-dialog"); }, - watch : function() { + watch: function () { this[this.settings.watch ? "unwatch" : "watch"](); }, - preview : function() { + preview: function () { this.previewing(); }, - fullscreen : function() { + fullscreen: function () { this.fullscreen(); }, - clear : function() { + clear: function () { this.clear(); }, - - search : function() { + + search: function () { this.search(); }, - help : function() { + help: function () { this.executePlugin("helpDialog", "help-dialog/help-dialog"); }, - info : function() { + info: function () { this.showInfoDialog(); } }; - + editormd.keyMaps = { - "Ctrl-1" : "h1", - "Ctrl-2" : "h2", - "Ctrl-3" : "h3", - "Ctrl-4" : "h4", - "Ctrl-5" : "h5", - "Ctrl-6" : "h6", - "Ctrl-B" : "bold", // if this is string == editormd.toolbarHandlers.xxxx - "Ctrl-D" : "datetime", - - "Ctrl-E" : function() { // emoji - var cm = this.cm; - var cursor = cm.getCursor(); + "Ctrl-1": "h1", + "Ctrl-2": "h2", + "Ctrl-3": "h3", + "Ctrl-4": "h4", + "Ctrl-5": "h5", + "Ctrl-6": "h6", + "Ctrl-B": "bold", // if this is string == editormd.toolbarHandlers.xxxx + "Ctrl-D": "datetime", + + "Ctrl-E": function () { // emoji + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); - - if (!this.settings.emoji) - { + + if (!this.settings.emoji) { alert("Error: settings.emoji == false"); - return ; + return; } cm.replaceSelection(":" + selection + ":"); @@ -3197,35 +3005,34 @@ cm.setCursor(cursor.line, cursor.ch + 1); } }, - "Ctrl-Alt-G" : "goto-line", - "Ctrl-H" : "hr", - "Ctrl-I" : "italic", - "Ctrl-K" : "code", - - "Ctrl-L" : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + "Ctrl-Alt-G": "goto-line", + "Ctrl-H": "hr", + "Ctrl-I": "italic", + "Ctrl-K": "code", + + "Ctrl-L": function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); - - var title = (selection === "") ? "" : " \""+selection+"\""; - cm.replaceSelection("[" + selection + "]("+title+")"); + var title = (selection === "") ? "" : " \"" + selection + "\""; + + cm.replaceSelection("[" + selection + "](" + title + ")"); if (selection === "") { cm.setCursor(cursor.line, cursor.ch + 1); } }, - "Ctrl-U" : "list-ul", - - "Shift-Ctrl-A" : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + "Ctrl-U": "list-ul", + + "Shift-Ctrl-A": function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); - - if (!this.settings.atLink) - { + + if (!this.settings.atLink) { alert("Error: settings.atLink == false"); - return ; + return; } cm.replaceSelection("@" + selection); @@ -3234,229 +3041,217 @@ cm.setCursor(cursor.line, cursor.ch + 1); } }, - - "Shift-Ctrl-C" : "code", - "Shift-Ctrl-Q" : "quote", - "Shift-Ctrl-S" : "del", - "Shift-Ctrl-K" : "tex", // KaTeX - - "Shift-Alt-C" : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + + "Shift-Ctrl-C": "code", + "Shift-Ctrl-Q": "quote", + "Shift-Ctrl-S": "del", + "Shift-Ctrl-K": "tex", // KaTeX + + "Shift-Alt-C": function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); - + cm.replaceSelection(["```", selection, "```"].join("\n")); if (selection === "") { cm.setCursor(cursor.line, cursor.ch + 3); - } - }, - - "Shift-Ctrl-Alt-C" : "code-block", - "Shift-Ctrl-H" : "html-entities", - "Shift-Alt-H" : "help", - "Shift-Ctrl-E" : "emoji", - "Shift-Ctrl-U" : "uppercase", - "Shift-Alt-U" : "ucwords", - "Shift-Ctrl-Alt-U" : "ucfirst", - "Shift-Alt-L" : "lowercase", - - "Shift-Ctrl-I" : function() { - var cm = this.cm; - var cursor = cm.getCursor(); + } + }, + + "Shift-Ctrl-Alt-C": "code-block", + "Shift-Ctrl-H": "html-entities", + "Shift-Alt-H": "help", + "Shift-Ctrl-E": "emoji", + "Shift-Ctrl-U": "uppercase", + "Shift-Alt-U": "ucwords", + "Shift-Ctrl-Alt-U": "ucfirst", + "Shift-Alt-L": "lowercase", + + "Shift-Ctrl-I": function () { + var cm = this.cm; + var cursor = cm.getCursor(); var selection = cm.getSelection(); - - var title = (selection === "") ? "" : " \""+selection+"\""; - cm.replaceSelection("![" + selection + "]("+title+")"); + var title = (selection === "") ? "" : " \"" + selection + "\""; + + cm.replaceSelection("![" + selection + "](" + title + ")"); if (selection === "") { cm.setCursor(cursor.line, cursor.ch + 4); } }, - - "Shift-Ctrl-Alt-I" : "image", - "Shift-Ctrl-L" : "link", - "Shift-Ctrl-O" : "list-ol", - "Shift-Ctrl-P" : "preformatted-text", - "Shift-Ctrl-T" : "table", - "Shift-Alt-P" : "pagebreak", - "F9" : "watch", - "F10" : "preview", - "F11" : "fullscreen", + + "Shift-Ctrl-Alt-I": "image", + "Shift-Ctrl-L": "link", + "Shift-Ctrl-O": "list-ol", + "Shift-Ctrl-P": "preformatted-text", + "Shift-Ctrl-T": "table", + "Shift-Alt-P": "pagebreak", + "F9": "watch", + "F10": "preview", + "F11": "fullscreen", }; - + /** * 清除字符串两边的空格 * Clear the space of strings both sides. - * + * * @param {String} str string - * @returns {String} trimed string + * @returns {String} trimed string */ - - var trim = function(str) { + + var trim = function (str) { return (!String.prototype.trim) ? str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "") : str.trim(); }; - + editormd.trim = trim; - + /** * 所有单词首字母大写 * Words first to uppercase - * + * * @param {String} str string * @returns {String} string */ - + var ucwords = function (str) { - return str.toLowerCase().replace(/\b(\w)|\s(\w)/g, function($1) { + return str.toLowerCase().replace(/\b(\w)|\s(\w)/g, function ($1) { return $1.toUpperCase(); }); }; - + editormd.ucwords = editormd.wordsFirstUpperCase = ucwords; - + /** * 字符串首字母大写 * Only string first char to uppercase - * + * * @param {String} str string * @returns {String} string */ - - var firstUpperCase = function(str) { - return str.toLowerCase().replace(/\b(\w)/, function($1){ + + var firstUpperCase = function (str) { + return str.toLowerCase().replace(/\b(\w)/, function ($1) { return $1.toUpperCase(); }); }; - + var ucfirst = firstUpperCase; - + editormd.firstUpperCase = editormd.ucfirst = firstUpperCase; - + editormd.urls = { - atLinkBase : "https://github.com/" + atLinkBase: "https://github.com/" }; - + editormd.regexs = { - atLink : /@(\w+)/g, - email : /(\w+)@(\w+)\.(\w+)\.?(\w+)?/g, - emailLink : /(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g, - emoji : /:([\w\+-]+):/g, - emojiDatetime : /(\d{2}:\d{2}:\d{2})/g, - twemoji : /:(tw-([\w]+)-?(\w+)?):/g, - fontAwesome : /:(fa-([\w]+)(-(\w+)){0,}):/g, - editormdLogo : /:(editormd-logo-?(\w+)?):/g, - pageBreak : /^\[[=]{8,}\]$/ + atLink: /@(\w+)/g, + email: /(\w+)@(\w+)\.(\w+)\.?(\w+)?/g, + emailLink: /(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g, + emoji: /:([\w\+-]+):/g, + emojiDatetime: /(\d{2}:\d{2}:\d{2})/g, + twemoji: /:(tw-([\w]+)-?(\w+)?):/g, + fontAwesome: /:(fa-([\w]+)(-(\w+)){0,}):/g, + editormdLogo: /:(editormd-logo-?(\w+)?):/g, + pageBreak: /^\[[=]{8,}\]$/ }; // Emoji graphics files url path - editormd.emoji = { - path : "http://www.emoji-cheat-sheet.com/graphics/emojis/", - ext : ".png" + editormd.emoji = { + path: "http://www.emoji-cheat-sheet.com/graphics/emojis/", + ext: ".png" }; // Twitter Emoji (Twemoji) graphics files url path editormd.twemoji = { - path : "http://twemoji.maxcdn.com/36x36/", - ext : ".png" + path: "http://twemoji.maxcdn.com/36x36/", + ext: ".png" }; /** * 自定义marked的解析器 * Custom Marked renderer rules - * + * * @param {Array} markdownToC 传入用于接收TOC的数组 * @returns {Renderer} markedRenderer 返回marked的Renderer自定义对象 */ - editormd.markedRenderer = function(markdownToC, options) { + editormd.markedRenderer = function (markdownToC, options) { var defaults = { - toc : true, // Table of contents - tocm : false, - tocStartLevel : 1, // Said from H1 to create ToC - pageBreak : true, - atLink : true, // for @link - emailLink : true, // for mail address auto link - taskList : false, // Enable Github Flavored Markdown task lists - emoji : false, // :emoji: , Support Twemoji, fontAwesome, Editor.md logo emojis. - tex : false, // TeX(LaTeX), based on KaTeX - flowChart : false, // flowChart.js only support IE9+ - sequenceDiagram : false, // sequenceDiagram.js only support IE9+ + toc: true, // Table of contents + tocm: false, + tocStartLevel: 1, // Said from H1 to create ToC + pageBreak: true, + atLink: true, // for @link + emailLink: true, // for mail address auto link + taskList: false, // Enable Github Flavored Markdown task lists + emoji: false, // :emoji: , Support Twemoji, fontAwesome, Editor.md logo emojis. + tex: false, // TeX(LaTeX), based on KaTeX + flowChart: false, // flowChart.js only support IE9+ + sequenceDiagram: false, // sequenceDiagram.js only support IE9+ }; - - var settings = $.extend(defaults, options || {}); - var marked = editormd.$marked; - var markedRenderer = new marked.Renderer(); - markdownToC = markdownToC || []; - - var regexs = editormd.regexs; - var atLinkReg = regexs.atLink; - var emojiReg = regexs.emoji; - var emailReg = regexs.email; - var emailLinkReg = regexs.emailLink; - var twemojiReg = regexs.twemoji; - var faIconReg = regexs.fontAwesome; + + var settings = $.extend(defaults, options || {}); + var marked = editormd.$marked; + var markedRenderer = new marked.Renderer(); + markdownToC = markdownToC || []; + + var regexs = editormd.regexs; + var atLinkReg = regexs.atLink; + var emojiReg = regexs.emoji; + var emailReg = regexs.email; + var emailLinkReg = regexs.emailLink; + var twemojiReg = regexs.twemoji; + var faIconReg = regexs.fontAwesome; var editormdLogoReg = regexs.editormdLogo; - var pageBreakReg = regexs.pageBreak; + var pageBreakReg = regexs.pageBreak; + + markedRenderer.emoji = function (text) { - markedRenderer.emoji = function(text) { - - text = text.replace(editormd.regexs.emojiDatetime, function($1) { + text = text.replace(editormd.regexs.emojiDatetime, function ($1) { return $1.replace(/:/g, ":"); }); - + var matchs = text.match(emojiReg); if (!matchs || !settings.emoji) { return text; } - for (var i = 0, len = matchs.length; i < len; i++) - { + for (var i = 0, len = matchs.length; i < len; i++) { if (matchs[i] === ":+1:") { matchs[i] = ":\\+1:"; } - text = text.replace(new RegExp(matchs[i]), function($1, $2){ + text = text.replace(new RegExp(matchs[i]), function ($1, $2) { var faMatchs = $1.match(faIconReg); - var name = $1.replace(/:/g, ""); + var name = $1.replace(/:/g, ""); - if (faMatchs) - { - for (var fa = 0, len1 = faMatchs.length; fa < len1; fa++) - { + if (faMatchs) { + for (var fa = 0, len1 = faMatchs.length; fa < len1; fa++) { var faName = faMatchs[fa].replace(/:/g, ""); - + return ""; } - } - else - { + } else { var emdlogoMathcs = $1.match(editormdLogoReg); var twemojiMatchs = $1.match(twemojiReg); - if (emdlogoMathcs) - { - for (var x = 0, len2 = emdlogoMathcs.length; x < len2; x++) - { + if (emdlogoMathcs) { + for (var x = 0, len2 = emdlogoMathcs.length; x < len2; x++) { var logoName = emdlogoMathcs[x].replace(/:/g, ""); return ""; } - } - else if (twemojiMatchs) - { - for (var t = 0, len3 = twemojiMatchs.length; t < len3; t++) - { + } else if (twemojiMatchs) { + for (var t = 0, len3 = twemojiMatchs.length; t < len3; t++) { var twe = twemojiMatchs[t].replace(/:/g, "").replace("tw-", ""); return "\"twemoji-""; } - } - else - { + } else { var src = (name === "+1") ? "plus1" : name; - src = (src === "black_large_square") ? "black_square" : src; - src = (src === "moon") ? "waxing_gibbous_moon" : src; + src = (src === "black_large_square") ? "black_square" : src; + src = (src === "moon") ? "waxing_gibbous_moon" : src; return "\":""; } @@ -3467,25 +3262,22 @@ return text; }; - markedRenderer.atLink = function(text) { + markedRenderer.atLink = function (text) { - if (atLinkReg.test(text)) - { - if (settings.atLink) - { - text = text.replace(emailReg, function($1, $2, $3, $4) { + if (atLinkReg.test(text)) { + if (settings.atLink) { + text = text.replace(emailReg, function ($1, $2, $3, $4) { return $1.replace(/@/g, "_#_@_#_"); }); - text = text.replace(atLinkReg, function($1, $2) { + text = text.replace(atLinkReg, function ($1, $2) { return "" + $1 + ""; }).replace(/_#_@_#_/g, "@"); } - - if (settings.emailLink) - { - text = text.replace(emailLinkReg, function($1, $2, $3, $4, $5) { - return (!$2 && $.inArray($5, "jpg|jpeg|png|gif|webp|ico|icon|pdf".split("|")) < 0) ? ""+$1+"" : $1; + + if (settings.emailLink) { + text = text.replace(emailLinkReg, function ($1, $2, $3, $4, $5) { + return (!$2 && $.inArray($5, "jpg|jpeg|png|gif|webp|ico|icon|pdf".split("|")) < 0) ? "" + $1 + "" : $1; }); } @@ -3494,13 +3286,13 @@ return text; }; - + markedRenderer.link = function (href, title, text) { if (this.options.sanitize) { try { - var prot = decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase(); - } catch(e) { + var prot = decodeURIComponent(unescape(href)).replace(/[^\w:]/g, "").toLowerCase(); + } catch (e) { return ""; } @@ -3510,14 +3302,12 @@ } var out = "" + text.replace(/@/g, "@") + ""; } @@ -3529,336 +3319,302 @@ return out; }; - - markedRenderer.heading = function(text, level, raw) { - - var linkText = text; - var hasLinkReg = /\s*\]*)\>(.*)\<\/a\>\s*/; + + markedRenderer.heading = function (text, level, raw) { + + var linkText = text; + var hasLinkReg = /\s*\]*)\>(.*)\<\/a\>\s*/; var getLinkTextReg = /\s*\]+)\>([^\>]*)\<\/a\>\s*/g; - if (hasLinkReg.test(text)) - { + if (hasLinkReg.test(text)) { var tempText = []; - text = text.split(/\]+)\>([^\>]*)\<\/a\>/); + text = text.split(/\]+)\>([^\>]*)\<\/a\>/); - for (var i = 0, len = text.length; i < len; i++) - { + for (var i = 0, len = text.length; i < len; i++) { tempText.push(text[i].replace(/\s*href\=\"(.*)\"\s*/g, "")); } text = tempText.join(" "); } - + text = trim(text); - - var escapedText = text.toLowerCase().replace(/[^\w]+/g, "-"); + + var escapedText = text.toLowerCase().replace(/[^\w]+/g, "-"); var toc = { - text : text, - level : level, - slug : escapedText + text: text, + level: level, + slug: escapedText }; - + var isChinese = /^[\u4e00-\u9fa5]+$/.test(text); - var id = (isChinese) ? escape(text).replace(/\%/g, "") : text.toLowerCase().replace(/[^\w]+/g, "-"); + var id = (isChinese) ? escape(text).replace(/\%/g, "") : text.toLowerCase().replace(/[^\w]+/g, "-"); markdownToC.push(toc); - - var headingHTML = ""; - - headingHTML += ""; - headingHTML += ""; - headingHTML += (hasLinkReg) ? this.atLink(this.emoji(linkText)) : this.atLink(this.emoji(text)); - headingHTML += ""; + + var headingHTML = ""; + + headingHTML += ""; + headingHTML += ""; + headingHTML += (hasLinkReg) ? this.atLink(this.emoji(linkText)) : this.atLink(this.emoji(text)); + headingHTML += ""; return headingHTML; }; - - markedRenderer.pageBreak = function(text) { - if (pageBreakReg.test(text) && settings.pageBreak) - { + + markedRenderer.pageBreak = function (text) { + if (pageBreakReg.test(text) && settings.pageBreak) { text = "
      "; } - + return text; }; - markedRenderer.paragraph = function(text) { - var isTeXInline = /\$\$(.*)\$\$/g.test(text); - var isTeXLine = /^\$\$(.*)\$\$$/.test(text); - var isTeXAddClass = (isTeXLine) ? " class=\"" + editormd.classNames.tex + "\"" : ""; - var isToC = (settings.tocm) ? /^(\[TOC\]|\[TOCM\])$/.test(text) : /^\[TOC\]$/.test(text); - var isToCMenu = /^\[TOCM\]$/.test(text); - - if (!isTeXLine && isTeXInline) - { - text = text.replace(/(\$\$([^\$]*)\$\$)+/g, function($1, $2) { + markedRenderer.paragraph = function (text) { + var isTeXInline = /\$\$(.*)\$\$/g.test(text); + var isTeXLine = /^\$\$(.*)\$\$$/.test(text); + var isTeXAddClass = (isTeXLine) ? " class=\"" + editormd.classNames.tex + "\"" : ""; + var isToC = (settings.tocm) ? /^(\[TOC\]|\[TOCM\])$/.test(text) : /^\[TOC\]$/.test(text); + var isToCMenu = /^\[TOCM\]$/.test(text); + + if (!isTeXLine && isTeXInline) { + text = text.replace(/(\$\$([^\$]*)\$\$)+/g, function ($1, $2) { return "" + $2.replace(/\$/g, "") + ""; }); - } - else - { + } else { text = (isTeXLine) ? text.replace(/\$/g, "") : text; } - + var tocHTML = "
      " + text + "
      "; - - return (isToC) ? ( (isToCMenu) ? "
      " + tocHTML + "

      " : tocHTML ) - : ( (pageBreakReg.test(text)) ? this.pageBreak(text) : "" + this.atLink(this.emoji(text)) + "

      \n" ); + + return (isToC) ? ((isToCMenu) ? "
      " + tocHTML + "

      " : tocHTML) + : ((pageBreakReg.test(text)) ? this.pageBreak(text) : "" + this.atLink(this.emoji(text)) + "

      \n"); }; - markedRenderer.code = function (code, lang, escaped) { + markedRenderer.code = function (code, lang, escaped) { - if (lang === "seq" || lang === "sequence") - { + if (lang === "seq" || lang === "sequence") { return "
      " + code + "
      "; - } - else if ( lang === "flow") - { + } else if (lang === "flow") { return "
      " + code + "
      "; - } - else if ( lang === "math" || lang === "latex" || lang === "katex") - { + } else if (lang === "math" || lang === "latex" || lang === "katex") { return "

      " + code + "

      "; - } - else - { + } else { return marked.Renderer.prototype.code.apply(this, arguments); } }; - markedRenderer.tablecell = function(content, flags) { + markedRenderer.tablecell = function (content, flags) { var type = (flags.header) ? "th" : "td"; - var tag = (flags.align) ? "<" + type +" style=\"text-align:" + flags.align + "\">" : "<" + type + ">"; - + var tag = (flags.align) ? "<" + type + " style=\"text-align:" + flags.align + "\">" : "<" + type + ">"; + return tag + this.atLink(this.emoji(content)) + "\n"; }; - markedRenderer.listitem = function(text) { - if (settings.taskList && /^\s*\[[x\s]\]\s*/.test(text)) - { + markedRenderer.listitem = function (text) { + if (settings.taskList && /^\s*\[[x\s]\]\s*/.test(text)) { text = text.replace(/^\s*\[\s\]\s*/, " ") - .replace(/^\s*\[x\]\s*/, " "); + .replace(/^\s*\[x\]\s*/, " "); return "
    • " + this.atLink(this.emoji(text)) + "
    • "; - } - else - { + } else { return "
    • " + this.atLink(this.emoji(text)) + "
    • "; } }; - + return markedRenderer; }; - + /** * * 生成TOC(Table of Contents) * Creating ToC (Table of Contents) - * + * * @param {Array} toc 从marked获取的TOC数组列表 * @param {Element} container 插入TOC的容器元素 * @param {Integer} startLevel Hx 起始层级 * @returns {Object} tocContainer 返回ToC列表容器层的jQuery对象元素 */ - - editormd.markdownToCRenderer = function(toc, container, tocDropdown, startLevel) { - - var html = ""; - var lastLevel = 0; + + editormd.markdownToCRenderer = function (toc, container, tocDropdown, startLevel) { + + var html = ""; + var lastLevel = 0; var classPrefix = this.classPrefix; - - startLevel = startLevel || 1; - - for (var i = 0, len = toc.length; i < len; i++) - { - var text = toc[i].text; + + startLevel = startLevel || 1; + + for (var i = 0, len = toc.length; i < len; i++) { + var text = toc[i].text; var level = toc[i].level; - + if (level < startLevel) { continue; } - - if (level > lastLevel) - { + + if (level > lastLevel) { html += ""; - } - else if (level < lastLevel) - { + } else if (level < lastLevel) { html += (new Array(lastLevel - level + 2)).join(""); - } - else - { + } else { html += ""; } html += "
    • " + text + "