swagr 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/swagr +15 -0
- data/examples/examples01/app.rb +6 -2
- data/examples/examples01/coffee/data_port.coffee +2 -0
- data/examples/examples01/static/css/codemirror.css +1247 -0
- data/examples/examples01/static/js/codemirror-compressed-3-0.js +5 -0
- data/examples/examples01/static/js/codemirror/keymap/emacs.js +30 -0
- data/examples/examples01/static/js/codemirror/keymap/vim.js +2298 -0
- data/examples/examples01/static/js/codemirror/lib/codemirror.css +239 -0
- data/examples/examples01/static/js/codemirror/lib/codemirror.js +4553 -0
- data/examples/examples01/static/js/codemirror/lib/util/closetag.js +85 -0
- data/examples/examples01/static/js/codemirror/lib/util/colorize.js +29 -0
- data/examples/examples01/static/js/codemirror/lib/util/continuecomment.js +36 -0
- data/examples/examples01/static/js/codemirror/lib/util/continuelist.js +28 -0
- data/examples/examples01/static/js/codemirror/lib/util/dialog.css +32 -0
- data/examples/examples01/static/js/codemirror/lib/util/dialog.js +75 -0
- data/examples/examples01/static/js/codemirror/lib/util/foldcode.js +182 -0
- data/examples/examples01/static/js/codemirror/lib/util/formatting.js +108 -0
- data/examples/examples01/static/js/codemirror/lib/util/javascript-hint.js +137 -0
- data/examples/examples01/static/js/codemirror/lib/util/loadmode.js +51 -0
- data/examples/examples01/static/js/codemirror/lib/util/match-highlighter.js +46 -0
- data/examples/examples01/static/js/codemirror/lib/util/matchbrackets.js +63 -0
- data/examples/examples01/static/js/codemirror/lib/util/multiplex.js +95 -0
- data/examples/examples01/static/js/codemirror/lib/util/overlay.js +59 -0
- data/examples/examples01/static/js/codemirror/lib/util/pig-hint.js +117 -0
- data/examples/examples01/static/js/codemirror/lib/util/runmode-standalone.js +90 -0
- data/examples/examples01/static/js/codemirror/lib/util/runmode.js +52 -0
- data/examples/examples01/static/js/codemirror/lib/util/search.js +119 -0
- data/examples/examples01/static/js/codemirror/lib/util/searchcursor.js +119 -0
- data/examples/examples01/static/js/codemirror/lib/util/simple-hint.css +16 -0
- data/examples/examples01/static/js/codemirror/lib/util/simple-hint.js +102 -0
- data/examples/examples01/static/js/codemirror/lib/util/xml-hint.js +131 -0
- data/examples/examples01/static/js/codemirror/mode/clike/clike.js +300 -0
- data/examples/examples01/static/js/codemirror/mode/clike/index.html +103 -0
- data/examples/examples01/static/js/codemirror/mode/clike/scala.html +767 -0
- data/examples/examples01/static/js/codemirror/mode/clojure/clojure.js +206 -0
- data/examples/examples01/static/js/codemirror/mode/clojure/index.html +67 -0
- data/examples/examples01/static/js/codemirror/mode/coffeescript/LICENSE +22 -0
- data/examples/examples01/static/js/codemirror/mode/coffeescript/coffeescript.js +346 -0
- data/examples/examples01/static/js/codemirror/mode/coffeescript/index.html +728 -0
- data/examples/examples01/static/js/codemirror/mode/commonlisp/commonlisp.js +101 -0
- data/examples/examples01/static/js/codemirror/mode/commonlisp/index.html +165 -0
- data/examples/examples01/static/js/codemirror/mode/css/css.js +465 -0
- data/examples/examples01/static/js/codemirror/mode/css/index.html +58 -0
- data/examples/examples01/static/js/codemirror/mode/css/test.js +501 -0
- data/examples/examples01/static/js/codemirror/mode/diff/diff.js +32 -0
- data/examples/examples01/static/js/codemirror/mode/diff/index.html +105 -0
- data/examples/examples01/static/js/codemirror/mode/ecl/ecl.js +192 -0
- data/examples/examples01/static/js/codemirror/mode/ecl/index.html +39 -0
- data/examples/examples01/static/js/codemirror/mode/erlang/erlang.js +463 -0
- data/examples/examples01/static/js/codemirror/mode/erlang/index.html +64 -0
- data/examples/examples01/static/js/codemirror/mode/gfm/gfm.js +94 -0
- data/examples/examples01/static/js/codemirror/mode/gfm/index.html +70 -0
- data/examples/examples01/static/js/codemirror/mode/gfm/test.js +225 -0
- data/examples/examples01/static/js/codemirror/mode/go/go.js +165 -0
- data/examples/examples01/static/js/codemirror/mode/go/index.html +74 -0
- data/examples/examples01/static/js/codemirror/mode/groovy/groovy.js +210 -0
- data/examples/examples01/static/js/codemirror/mode/groovy/index.html +73 -0
- data/examples/examples01/static/js/codemirror/mode/haskell/haskell.js +242 -0
- data/examples/examples01/static/js/codemirror/mode/haskell/index.html +62 -0
- data/examples/examples01/static/js/codemirror/mode/haxe/haxe.js +429 -0
- data/examples/examples01/static/js/codemirror/mode/haxe/index.html +90 -0
- data/examples/examples01/static/js/codemirror/mode/htmlembedded/htmlembedded.js +73 -0
- data/examples/examples01/static/js/codemirror/mode/htmlembedded/index.html +49 -0
- data/examples/examples01/static/js/codemirror/mode/htmlmixed/htmlmixed.js +84 -0
- data/examples/examples01/static/js/codemirror/mode/htmlmixed/index.html +52 -0
- data/examples/examples01/static/js/codemirror/mode/http/http.js +98 -0
- data/examples/examples01/static/js/codemirror/mode/http/index.html +32 -0
- data/examples/examples01/static/js/codemirror/mode/javascript/index.html +88 -0
- data/examples/examples01/static/js/codemirror/mode/javascript/javascript.js +411 -0
- data/examples/examples01/static/js/codemirror/mode/javascript/typescript.html +48 -0
- data/examples/examples01/static/js/codemirror/mode/jinja2/index.html +38 -0
- data/examples/examples01/static/js/codemirror/mode/jinja2/jinja2.js +42 -0
- data/examples/examples01/static/js/codemirror/mode/less/index.html +741 -0
- data/examples/examples01/static/js/codemirror/mode/less/less.js +266 -0
- data/examples/examples01/static/js/codemirror/mode/lua/index.html +74 -0
- data/examples/examples01/static/js/codemirror/mode/lua/lua.js +140 -0
- data/examples/examples01/static/js/codemirror/mode/markdown/index.html +344 -0
- data/examples/examples01/static/js/codemirror/mode/markdown/markdown.js +474 -0
- data/examples/examples01/static/js/codemirror/mode/markdown/test.js +1266 -0
- data/examples/examples01/static/js/codemirror/mode/mysql/index.html +41 -0
- data/examples/examples01/static/js/codemirror/mode/mysql/mysql.js +203 -0
- data/examples/examples01/static/js/codemirror/mode/ntriples/index.html +33 -0
- data/examples/examples01/static/js/codemirror/mode/ntriples/ntriples.js +170 -0
- data/examples/examples01/static/js/codemirror/mode/ocaml/index.html +131 -0
- data/examples/examples01/static/js/codemirror/mode/ocaml/ocaml.js +113 -0
- data/examples/examples01/static/js/codemirror/mode/pascal/LICENSE +7 -0
- data/examples/examples01/static/js/codemirror/mode/pascal/index.html +48 -0
- data/examples/examples01/static/js/codemirror/mode/pascal/pascal.js +94 -0
- data/examples/examples01/static/js/codemirror/mode/perl/LICENSE +19 -0
- data/examples/examples01/static/js/codemirror/mode/perl/index.html +62 -0
- data/examples/examples01/static/js/codemirror/mode/perl/perl.js +816 -0
- data/examples/examples01/static/js/codemirror/mode/php/index.html +51 -0
- data/examples/examples01/static/js/codemirror/mode/php/php.js +129 -0
- data/examples/examples01/static/js/codemirror/mode/pig/index.html +42 -0
- data/examples/examples01/static/js/codemirror/mode/pig/pig.js +171 -0
- data/examples/examples01/static/js/codemirror/mode/plsql/index.html +62 -0
- data/examples/examples01/static/js/codemirror/mode/plsql/plsql.js +216 -0
- data/examples/examples01/static/js/codemirror/mode/properties/index.html +41 -0
- data/examples/examples01/static/js/codemirror/mode/properties/properties.js +63 -0
- data/examples/examples01/static/js/codemirror/mode/python/LICENSE.txt +21 -0
- data/examples/examples01/static/js/codemirror/mode/python/index.html +124 -0
- data/examples/examples01/static/js/codemirror/mode/python/python.js +340 -0
- data/examples/examples01/static/js/codemirror/mode/r/LICENSE +24 -0
- data/examples/examples01/static/js/codemirror/mode/r/index.html +74 -0
- data/examples/examples01/static/js/codemirror/mode/r/r.js +141 -0
- data/examples/examples01/static/js/codemirror/mode/rpm/changes/changes.js +19 -0
- data/examples/examples01/static/js/codemirror/mode/rpm/changes/index.html +53 -0
- data/examples/examples01/static/js/codemirror/mode/rpm/spec/index.html +99 -0
- data/examples/examples01/static/js/codemirror/mode/rpm/spec/spec.css +5 -0
- data/examples/examples01/static/js/codemirror/mode/rpm/spec/spec.js +66 -0
- data/examples/examples01/static/js/codemirror/mode/rst/index.html +526 -0
- data/examples/examples01/static/js/codemirror/mode/rst/rst.js +314 -0
- data/examples/examples01/static/js/codemirror/mode/ruby/LICENSE +24 -0
- data/examples/examples01/static/js/codemirror/mode/ruby/index.html +173 -0
- data/examples/examples01/static/js/codemirror/mode/ruby/ruby.js +195 -0
- data/examples/examples01/static/js/codemirror/mode/rust/index.html +48 -0
- data/examples/examples01/static/js/codemirror/mode/rust/rust.js +432 -0
- data/examples/examples01/static/js/codemirror/mode/scheme/index.html +65 -0
- data/examples/examples01/static/js/codemirror/mode/scheme/scheme.js +230 -0
- data/examples/examples01/static/js/codemirror/mode/shell/index.html +51 -0
- data/examples/examples01/static/js/codemirror/mode/shell/shell.js +118 -0
- data/examples/examples01/static/js/codemirror/mode/sieve/LICENSE +23 -0
- data/examples/examples01/static/js/codemirror/mode/sieve/index.html +81 -0
- data/examples/examples01/static/js/codemirror/mode/sieve/sieve.js +156 -0
- data/examples/examples01/static/js/codemirror/mode/smalltalk/index.html +57 -0
- data/examples/examples01/static/js/codemirror/mode/smalltalk/smalltalk.js +139 -0
- data/examples/examples01/static/js/codemirror/mode/smarty/index.html +83 -0
- data/examples/examples01/static/js/codemirror/mode/smarty/smarty.js +148 -0
- data/examples/examples01/static/js/codemirror/mode/sparql/index.html +42 -0
- data/examples/examples01/static/js/codemirror/mode/sparql/sparql.js +143 -0
- data/examples/examples01/static/js/codemirror/mode/stex/index.html +98 -0
- data/examples/examples01/static/js/codemirror/mode/stex/stex.js +175 -0
- data/examples/examples01/static/js/codemirror/mode/stex/test.js +343 -0
- data/examples/examples01/static/js/codemirror/mode/tiddlywiki/index.html +142 -0
- data/examples/examples01/static/js/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/examples/examples01/static/js/codemirror/mode/tiddlywiki/tiddlywiki.js +353 -0
- data/examples/examples01/static/js/codemirror/mode/tiki/index.html +81 -0
- data/examples/examples01/static/js/codemirror/mode/tiki/tiki.css +26 -0
- data/examples/examples01/static/js/codemirror/mode/tiki/tiki.js +309 -0
- data/examples/examples01/static/js/codemirror/mode/vb/LICENSE.txt +21 -0
- data/examples/examples01/static/js/codemirror/mode/vb/index.html +88 -0
- data/examples/examples01/static/js/codemirror/mode/vb/vb.js +260 -0
- data/examples/examples01/static/js/codemirror/mode/vbscript/index.html +42 -0
- data/examples/examples01/static/js/codemirror/mode/vbscript/vbscript.js +26 -0
- data/examples/examples01/static/js/codemirror/mode/velocity/index.html +103 -0
- data/examples/examples01/static/js/codemirror/mode/velocity/velocity.js +144 -0
- data/examples/examples01/static/js/codemirror/mode/verilog/index.html +210 -0
- data/examples/examples01/static/js/codemirror/mode/verilog/verilog.js +182 -0
- data/examples/examples01/static/js/codemirror/mode/xml/index.html +45 -0
- data/examples/examples01/static/js/codemirror/mode/xml/xml.js +324 -0
- data/examples/examples01/static/js/codemirror/mode/xquery/LICENSE +20 -0
- data/examples/examples01/static/js/codemirror/mode/xquery/index.html +221 -0
- data/examples/examples01/static/js/codemirror/mode/xquery/test.js +77 -0
- data/examples/examples01/static/js/codemirror/mode/xquery/xquery.js +450 -0
- data/examples/examples01/static/js/codemirror/mode/yaml/index.html +68 -0
- data/examples/examples01/static/js/codemirror/mode/yaml/yaml.js +95 -0
- data/examples/examples01/static/js/codemirror/mode/z80/index.html +39 -0
- data/examples/examples01/static/js/codemirror/mode/z80/z80.js +113 -0
- data/examples/examples01/static/js/codemirror/theme/ambiance-mobile.css +6 -0
- data/examples/examples01/static/js/codemirror/theme/ambiance.css +76 -0
- data/examples/examples01/static/js/codemirror/theme/blackboard.css +25 -0
- data/examples/examples01/static/js/codemirror/theme/cobalt.css +18 -0
- data/examples/examples01/static/js/codemirror/theme/eclipse.css +25 -0
- data/examples/examples01/static/js/codemirror/theme/elegant.css +10 -0
- data/examples/examples01/static/js/codemirror/theme/erlang-dark.css +21 -0
- data/examples/examples01/static/js/codemirror/theme/lesser-dark.css +44 -0
- data/examples/examples01/static/js/codemirror/theme/monokai.css +28 -0
- data/examples/examples01/static/js/codemirror/theme/neat.css +9 -0
- data/examples/examples01/static/js/codemirror/theme/night.css +21 -0
- data/examples/examples01/static/js/codemirror/theme/rubyblue.css +21 -0
- data/examples/examples01/static/js/codemirror/theme/solarized.css +207 -0
- data/examples/examples01/static/js/codemirror/theme/twilight.css +26 -0
- data/examples/examples01/static/js/codemirror/theme/vibrant-ink.css +27 -0
- data/examples/examples01/static/js/codemirror/theme/xq-dark.css +46 -0
- data/examples/examples01/static/js/d3.v3.min.js +2 -2
- data/examples/examples01/static/test/cm.html +33 -0
- data/examples/examples01/views/about.slim +15 -0
- data/examples/examples01/views/index.slim +1 -1
- data/examples/examples01/views/layout.slim +1 -0
- data/examples/examples01/views/layout_cm.slim +17 -0
- data/examples/examples01/views/navbar.slim +4 -4
- data/lib/swagr/version.rb +1 -1
- data/templates/app.rb +4 -0
- data/templates/static/js/codemirror/keymap/emacs.js +30 -0
- data/templates/static/js/codemirror/keymap/vim.js +2298 -0
- data/templates/static/js/codemirror/lib/codemirror.css +239 -0
- data/templates/static/js/codemirror/lib/codemirror.js +4553 -0
- data/templates/static/js/codemirror/lib/util/closetag.js +85 -0
- data/templates/static/js/codemirror/lib/util/colorize.js +29 -0
- data/templates/static/js/codemirror/lib/util/continuecomment.js +36 -0
- data/templates/static/js/codemirror/lib/util/continuelist.js +28 -0
- data/templates/static/js/codemirror/lib/util/dialog.css +32 -0
- data/templates/static/js/codemirror/lib/util/dialog.js +75 -0
- data/templates/static/js/codemirror/lib/util/foldcode.js +182 -0
- data/templates/static/js/codemirror/lib/util/formatting.js +108 -0
- data/templates/static/js/codemirror/lib/util/javascript-hint.js +137 -0
- data/templates/static/js/codemirror/lib/util/loadmode.js +51 -0
- data/templates/static/js/codemirror/lib/util/match-highlighter.js +46 -0
- data/templates/static/js/codemirror/lib/util/matchbrackets.js +63 -0
- data/templates/static/js/codemirror/lib/util/multiplex.js +95 -0
- data/templates/static/js/codemirror/lib/util/overlay.js +59 -0
- data/templates/static/js/codemirror/lib/util/pig-hint.js +117 -0
- data/templates/static/js/codemirror/lib/util/runmode-standalone.js +90 -0
- data/templates/static/js/codemirror/lib/util/runmode.js +52 -0
- data/templates/static/js/codemirror/lib/util/search.js +119 -0
- data/templates/static/js/codemirror/lib/util/searchcursor.js +119 -0
- data/templates/static/js/codemirror/lib/util/simple-hint.css +16 -0
- data/templates/static/js/codemirror/lib/util/simple-hint.js +102 -0
- data/templates/static/js/codemirror/lib/util/xml-hint.js +131 -0
- data/templates/static/js/codemirror/mode/clike/clike.js +300 -0
- data/templates/static/js/codemirror/mode/clike/index.html +103 -0
- data/templates/static/js/codemirror/mode/clike/scala.html +767 -0
- data/templates/static/js/codemirror/mode/clojure/clojure.js +206 -0
- data/templates/static/js/codemirror/mode/clojure/index.html +67 -0
- data/templates/static/js/codemirror/mode/coffeescript/LICENSE +22 -0
- data/templates/static/js/codemirror/mode/coffeescript/coffeescript.js +346 -0
- data/templates/static/js/codemirror/mode/coffeescript/index.html +728 -0
- data/templates/static/js/codemirror/mode/commonlisp/commonlisp.js +101 -0
- data/templates/static/js/codemirror/mode/commonlisp/index.html +165 -0
- data/templates/static/js/codemirror/mode/css/css.js +465 -0
- data/templates/static/js/codemirror/mode/css/index.html +58 -0
- data/templates/static/js/codemirror/mode/css/test.js +501 -0
- data/templates/static/js/codemirror/mode/diff/diff.js +32 -0
- data/templates/static/js/codemirror/mode/diff/index.html +105 -0
- data/templates/static/js/codemirror/mode/ecl/ecl.js +192 -0
- data/templates/static/js/codemirror/mode/ecl/index.html +39 -0
- data/templates/static/js/codemirror/mode/erlang/erlang.js +463 -0
- data/templates/static/js/codemirror/mode/erlang/index.html +64 -0
- data/templates/static/js/codemirror/mode/gfm/gfm.js +94 -0
- data/templates/static/js/codemirror/mode/gfm/index.html +70 -0
- data/templates/static/js/codemirror/mode/gfm/test.js +225 -0
- data/templates/static/js/codemirror/mode/go/go.js +165 -0
- data/templates/static/js/codemirror/mode/go/index.html +74 -0
- data/templates/static/js/codemirror/mode/groovy/groovy.js +210 -0
- data/templates/static/js/codemirror/mode/groovy/index.html +73 -0
- data/templates/static/js/codemirror/mode/haskell/haskell.js +242 -0
- data/templates/static/js/codemirror/mode/haskell/index.html +62 -0
- data/templates/static/js/codemirror/mode/haxe/haxe.js +429 -0
- data/templates/static/js/codemirror/mode/haxe/index.html +90 -0
- data/templates/static/js/codemirror/mode/htmlembedded/htmlembedded.js +73 -0
- data/templates/static/js/codemirror/mode/htmlembedded/index.html +49 -0
- data/templates/static/js/codemirror/mode/htmlmixed/htmlmixed.js +84 -0
- data/templates/static/js/codemirror/mode/htmlmixed/index.html +52 -0
- data/templates/static/js/codemirror/mode/http/http.js +98 -0
- data/templates/static/js/codemirror/mode/http/index.html +32 -0
- data/templates/static/js/codemirror/mode/javascript/index.html +88 -0
- data/templates/static/js/codemirror/mode/javascript/javascript.js +411 -0
- data/templates/static/js/codemirror/mode/javascript/typescript.html +48 -0
- data/templates/static/js/codemirror/mode/jinja2/index.html +38 -0
- data/templates/static/js/codemirror/mode/jinja2/jinja2.js +42 -0
- data/templates/static/js/codemirror/mode/less/index.html +741 -0
- data/templates/static/js/codemirror/mode/less/less.js +266 -0
- data/templates/static/js/codemirror/mode/lua/index.html +74 -0
- data/templates/static/js/codemirror/mode/lua/lua.js +140 -0
- data/templates/static/js/codemirror/mode/markdown/index.html +344 -0
- data/templates/static/js/codemirror/mode/markdown/markdown.js +474 -0
- data/templates/static/js/codemirror/mode/markdown/test.js +1266 -0
- data/templates/static/js/codemirror/mode/mysql/index.html +41 -0
- data/templates/static/js/codemirror/mode/mysql/mysql.js +203 -0
- data/templates/static/js/codemirror/mode/ntriples/index.html +33 -0
- data/templates/static/js/codemirror/mode/ntriples/ntriples.js +170 -0
- data/templates/static/js/codemirror/mode/ocaml/index.html +131 -0
- data/templates/static/js/codemirror/mode/ocaml/ocaml.js +113 -0
- data/templates/static/js/codemirror/mode/pascal/LICENSE +7 -0
- data/templates/static/js/codemirror/mode/pascal/index.html +48 -0
- data/templates/static/js/codemirror/mode/pascal/pascal.js +94 -0
- data/templates/static/js/codemirror/mode/perl/LICENSE +19 -0
- data/templates/static/js/codemirror/mode/perl/index.html +62 -0
- data/templates/static/js/codemirror/mode/perl/perl.js +816 -0
- data/templates/static/js/codemirror/mode/php/index.html +51 -0
- data/templates/static/js/codemirror/mode/php/php.js +129 -0
- data/templates/static/js/codemirror/mode/pig/index.html +42 -0
- data/templates/static/js/codemirror/mode/pig/pig.js +171 -0
- data/templates/static/js/codemirror/mode/plsql/index.html +62 -0
- data/templates/static/js/codemirror/mode/plsql/plsql.js +216 -0
- data/templates/static/js/codemirror/mode/properties/index.html +41 -0
- data/templates/static/js/codemirror/mode/properties/properties.js +63 -0
- data/templates/static/js/codemirror/mode/python/LICENSE.txt +21 -0
- data/templates/static/js/codemirror/mode/python/index.html +124 -0
- data/templates/static/js/codemirror/mode/python/python.js +340 -0
- data/templates/static/js/codemirror/mode/r/LICENSE +24 -0
- data/templates/static/js/codemirror/mode/r/index.html +74 -0
- data/templates/static/js/codemirror/mode/r/r.js +141 -0
- data/templates/static/js/codemirror/mode/rpm/changes/changes.js +19 -0
- data/templates/static/js/codemirror/mode/rpm/changes/index.html +53 -0
- data/templates/static/js/codemirror/mode/rpm/spec/index.html +99 -0
- data/templates/static/js/codemirror/mode/rpm/spec/spec.css +5 -0
- data/templates/static/js/codemirror/mode/rpm/spec/spec.js +66 -0
- data/templates/static/js/codemirror/mode/rst/index.html +526 -0
- data/templates/static/js/codemirror/mode/rst/rst.js +314 -0
- data/templates/static/js/codemirror/mode/ruby/LICENSE +24 -0
- data/templates/static/js/codemirror/mode/ruby/index.html +173 -0
- data/templates/static/js/codemirror/mode/ruby/ruby.js +195 -0
- data/templates/static/js/codemirror/mode/rust/index.html +48 -0
- data/templates/static/js/codemirror/mode/rust/rust.js +432 -0
- data/templates/static/js/codemirror/mode/scheme/index.html +65 -0
- data/templates/static/js/codemirror/mode/scheme/scheme.js +230 -0
- data/templates/static/js/codemirror/mode/shell/index.html +51 -0
- data/templates/static/js/codemirror/mode/shell/shell.js +118 -0
- data/templates/static/js/codemirror/mode/sieve/LICENSE +23 -0
- data/templates/static/js/codemirror/mode/sieve/index.html +81 -0
- data/templates/static/js/codemirror/mode/sieve/sieve.js +156 -0
- data/templates/static/js/codemirror/mode/smalltalk/index.html +57 -0
- data/templates/static/js/codemirror/mode/smalltalk/smalltalk.js +139 -0
- data/templates/static/js/codemirror/mode/smarty/index.html +83 -0
- data/templates/static/js/codemirror/mode/smarty/smarty.js +148 -0
- data/templates/static/js/codemirror/mode/sparql/index.html +42 -0
- data/templates/static/js/codemirror/mode/sparql/sparql.js +143 -0
- data/templates/static/js/codemirror/mode/stex/index.html +98 -0
- data/templates/static/js/codemirror/mode/stex/stex.js +175 -0
- data/templates/static/js/codemirror/mode/stex/test.js +343 -0
- data/templates/static/js/codemirror/mode/tiddlywiki/index.html +142 -0
- data/templates/static/js/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/templates/static/js/codemirror/mode/tiddlywiki/tiddlywiki.js +353 -0
- data/templates/static/js/codemirror/mode/tiki/index.html +81 -0
- data/templates/static/js/codemirror/mode/tiki/tiki.css +26 -0
- data/templates/static/js/codemirror/mode/tiki/tiki.js +309 -0
- data/templates/static/js/codemirror/mode/vb/LICENSE.txt +21 -0
- data/templates/static/js/codemirror/mode/vb/index.html +88 -0
- data/templates/static/js/codemirror/mode/vb/vb.js +260 -0
- data/templates/static/js/codemirror/mode/vbscript/index.html +42 -0
- data/templates/static/js/codemirror/mode/vbscript/vbscript.js +26 -0
- data/templates/static/js/codemirror/mode/velocity/index.html +103 -0
- data/templates/static/js/codemirror/mode/velocity/velocity.js +144 -0
- data/templates/static/js/codemirror/mode/verilog/index.html +210 -0
- data/templates/static/js/codemirror/mode/verilog/verilog.js +182 -0
- data/templates/static/js/codemirror/mode/xml/index.html +45 -0
- data/templates/static/js/codemirror/mode/xml/xml.js +324 -0
- data/templates/static/js/codemirror/mode/xquery/LICENSE +20 -0
- data/templates/static/js/codemirror/mode/xquery/index.html +221 -0
- data/templates/static/js/codemirror/mode/xquery/test.js +77 -0
- data/templates/static/js/codemirror/mode/xquery/xquery.js +450 -0
- data/templates/static/js/codemirror/mode/yaml/index.html +68 -0
- data/templates/static/js/codemirror/mode/yaml/yaml.js +95 -0
- data/templates/static/js/codemirror/mode/z80/index.html +39 -0
- data/templates/static/js/codemirror/mode/z80/z80.js +113 -0
- data/templates/static/js/codemirror/theme/ambiance-mobile.css +6 -0
- data/templates/static/js/codemirror/theme/ambiance.css +76 -0
- data/templates/static/js/codemirror/theme/blackboard.css +25 -0
- data/templates/static/js/codemirror/theme/cobalt.css +18 -0
- data/templates/static/js/codemirror/theme/eclipse.css +25 -0
- data/templates/static/js/codemirror/theme/elegant.css +10 -0
- data/templates/static/js/codemirror/theme/erlang-dark.css +21 -0
- data/templates/static/js/codemirror/theme/lesser-dark.css +44 -0
- data/templates/static/js/codemirror/theme/monokai.css +28 -0
- data/templates/static/js/codemirror/theme/neat.css +9 -0
- data/templates/static/js/codemirror/theme/night.css +21 -0
- data/templates/static/js/codemirror/theme/rubyblue.css +21 -0
- data/templates/static/js/codemirror/theme/solarized.css +207 -0
- data/templates/static/js/codemirror/theme/twilight.css +26 -0
- data/templates/static/js/codemirror/theme/vibrant-ink.css +27 -0
- data/templates/static/js/codemirror/theme/xq-dark.css +46 -0
- data/templates/static/js/d3.v3.min.js +2 -2
- data/templates/static/test/cm.html +33 -0
- data/templates/views/about.slim +15 -0
- data/templates/views/index.slim +1 -1
- data/templates/views/layout.slim +1 -0
- data/templates/views/navbar.slim +4 -4
- metadata +347 -2
@@ -0,0 +1,85 @@
|
|
1
|
+
/**
|
2
|
+
* Tag-closer extension for CodeMirror.
|
3
|
+
*
|
4
|
+
* This extension adds an "autoCloseTags" option that can be set to
|
5
|
+
* either true to get the default behavior, or an object to further
|
6
|
+
* configure its behavior.
|
7
|
+
*
|
8
|
+
* These are supported options:
|
9
|
+
*
|
10
|
+
* `whenClosing` (default true)
|
11
|
+
* Whether to autoclose when the '/' of a closing tag is typed.
|
12
|
+
* `whenOpening` (default true)
|
13
|
+
* Whether to autoclose the tag when the final '>' of an opening
|
14
|
+
* tag is typed.
|
15
|
+
* `dontCloseTags` (default is empty tags for HTML, none for XML)
|
16
|
+
* An array of tag names that should not be autoclosed.
|
17
|
+
* `indentTags` (default is block tags for HTML, none for XML)
|
18
|
+
* An array of tag names that should, when opened, cause a
|
19
|
+
* blank line to be added inside the tag, and the blank line and
|
20
|
+
* closing line to be indented.
|
21
|
+
*
|
22
|
+
* See demos/closetag.html for a usage example.
|
23
|
+
*/
|
24
|
+
|
25
|
+
(function() {
|
26
|
+
CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) {
|
27
|
+
if (val && (old == CodeMirror.Init || !old)) {
|
28
|
+
var map = {name: "autoCloseTags"};
|
29
|
+
if (typeof val != "object" || val.whenClosing)
|
30
|
+
map["'/'"] = function(cm) { autoCloseTag(cm, '/'); };
|
31
|
+
if (typeof val != "object" || val.whenOpening)
|
32
|
+
map["'>'"] = function(cm) { autoCloseTag(cm, '>'); };
|
33
|
+
cm.addKeyMap(map);
|
34
|
+
} else if (!val && (old != CodeMirror.Init && old)) {
|
35
|
+
cm.removeKeyMap("autoCloseTags");
|
36
|
+
}
|
37
|
+
});
|
38
|
+
|
39
|
+
var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param",
|
40
|
+
"source", "track", "wbr"];
|
41
|
+
var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4",
|
42
|
+
"h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"];
|
43
|
+
|
44
|
+
function autoCloseTag(cm, ch) {
|
45
|
+
var pos = cm.getCursor(), tok = cm.getTokenAt(pos);
|
46
|
+
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
|
47
|
+
if (inner.mode.name != "xml") throw CodeMirror.Pass;
|
48
|
+
|
49
|
+
var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html";
|
50
|
+
var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
|
51
|
+
var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);
|
52
|
+
|
53
|
+
if (ch == ">" && state.tagName) {
|
54
|
+
var tagName = state.tagName;
|
55
|
+
if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
|
56
|
+
var lowerTagName = tagName.toLowerCase();
|
57
|
+
// Don't process the '>' at the end of an end-tag or self-closing tag
|
58
|
+
if (tok.type == "tag" && state.type == "closeTag" ||
|
59
|
+
/\/\s*$/.test(tok.string) ||
|
60
|
+
dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1)
|
61
|
+
throw CodeMirror.Pass;
|
62
|
+
|
63
|
+
var doIndent = indentTags && indexOf(indentTags, lowerTagName) > -1;
|
64
|
+
cm.replaceSelection(">" + (doIndent ? "\n\n" : "") + "</" + tagName + ">",
|
65
|
+
doIndent ? {line: pos.line + 1, ch: 0} : {line: pos.line, ch: pos.ch + 1});
|
66
|
+
if (doIndent) {
|
67
|
+
cm.indentLine(pos.line + 1);
|
68
|
+
cm.indentLine(pos.line + 2);
|
69
|
+
}
|
70
|
+
return;
|
71
|
+
} else if (ch == "/" && tok.type == "tag" && tok.string == "<") {
|
72
|
+
var tagName = state.context && state.context.tagName;
|
73
|
+
if (tagName) cm.replaceSelection("/" + tagName + ">", "end");
|
74
|
+
return;
|
75
|
+
}
|
76
|
+
throw CodeMirror.Pass;
|
77
|
+
}
|
78
|
+
|
79
|
+
function indexOf(collection, elt) {
|
80
|
+
if (collection.indexOf) return collection.indexOf(elt);
|
81
|
+
for (var i = 0, e = collection.length; i < e; ++i)
|
82
|
+
if (collection[i] == elt) return i;
|
83
|
+
return -1;
|
84
|
+
}
|
85
|
+
})();
|
@@ -0,0 +1,29 @@
|
|
1
|
+
CodeMirror.colorize = (function() {
|
2
|
+
|
3
|
+
var isBlock = /^(p|li|div|h\\d|pre|blockquote|td)$/;
|
4
|
+
|
5
|
+
function textContent(node, out) {
|
6
|
+
if (node.nodeType == 3) return out.push(node.nodeValue);
|
7
|
+
for (var ch = node.firstChild; ch; ch = ch.nextSibling) {
|
8
|
+
textContent(ch, out);
|
9
|
+
if (isBlock.test(node.nodeType)) out.push("\n");
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
return function(collection, defaultMode) {
|
14
|
+
if (!collection) collection = document.body.getElementsByTagName("pre");
|
15
|
+
|
16
|
+
for (var i = 0; i < collection.length; ++i) {
|
17
|
+
var node = collection[i];
|
18
|
+
var mode = node.getAttribute("data-lang") || defaultMode;
|
19
|
+
if (!mode) continue;
|
20
|
+
|
21
|
+
var text = [];
|
22
|
+
textContent(node, text);
|
23
|
+
node.innerHTML = "";
|
24
|
+
CodeMirror.runMode(text.join(""), mode, node);
|
25
|
+
|
26
|
+
node.className += " cm-s-default";
|
27
|
+
}
|
28
|
+
};
|
29
|
+
})();
|
@@ -0,0 +1,36 @@
|
|
1
|
+
(function() {
|
2
|
+
var modes = ["clike", "css", "javascript"];
|
3
|
+
for (var i = 0; i < modes.length; ++i)
|
4
|
+
CodeMirror.extendMode(modes[i], {blockCommentStart: "/*",
|
5
|
+
blockCommentEnd: "*/",
|
6
|
+
blockCommentContinue: " * "});
|
7
|
+
|
8
|
+
CodeMirror.commands.newlineAndIndentContinueComment = function(cm) {
|
9
|
+
var pos = cm.getCursor(), token = cm.getTokenAt(pos);
|
10
|
+
var mode = CodeMirror.innerMode(cm.getMode(), token.state).mode;
|
11
|
+
var space;
|
12
|
+
|
13
|
+
if (token.type == "comment" && mode.blockCommentStart) {
|
14
|
+
var end = token.string.indexOf(mode.blockCommentEnd);
|
15
|
+
var full = cm.getRange({line: pos.line, ch: 0}, {line: pos.line, ch: token.end}), found;
|
16
|
+
if (end != -1 && end == token.string.length - mode.blockCommentEnd.length) {
|
17
|
+
// Comment ended, don't continue it
|
18
|
+
} else if (token.string.indexOf(mode.blockCommentStart) == 0) {
|
19
|
+
space = full.slice(0, token.start);
|
20
|
+
if (!/^\s*$/.test(space)) {
|
21
|
+
space = "";
|
22
|
+
for (var i = 0; i < token.start; ++i) space += " ";
|
23
|
+
}
|
24
|
+
} else if ((found = full.indexOf(mode.blockCommentContinue)) != -1 &&
|
25
|
+
found + mode.blockCommentContinue.length > token.start &&
|
26
|
+
/^\s*$/.test(full.slice(0, found))) {
|
27
|
+
space = full.slice(0, found);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
if (space != null)
|
32
|
+
cm.replaceSelection("\n" + space + mode.blockCommentContinue, "end");
|
33
|
+
else
|
34
|
+
cm.execCommand("newlineAndIndent");
|
35
|
+
};
|
36
|
+
})();
|
@@ -0,0 +1,28 @@
|
|
1
|
+
(function() {
|
2
|
+
CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
|
3
|
+
var pos = cm.getCursor(), token = cm.getTokenAt(pos);
|
4
|
+
var space;
|
5
|
+
if (token.className == "string") {
|
6
|
+
var full = cm.getRange({line: pos.line, ch: 0}, {line: pos.line, ch: token.end});
|
7
|
+
var listStart = /\*|\d+\./, listContinue;
|
8
|
+
if (token.string.search(listStart) == 0) {
|
9
|
+
var reg = /^[\W]*(\d+)\./g;
|
10
|
+
var matches = reg.exec(full);
|
11
|
+
if(matches)
|
12
|
+
listContinue = (parseInt(matches[1]) + 1) + ". ";
|
13
|
+
else
|
14
|
+
listContinue = "* ";
|
15
|
+
space = full.slice(0, token.start);
|
16
|
+
if (!/^\s*$/.test(space)) {
|
17
|
+
space = "";
|
18
|
+
for (var i = 0; i < token.start; ++i) space += " ";
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
if (space != null)
|
24
|
+
cm.replaceSelection("\n" + space + listContinue, "end");
|
25
|
+
else
|
26
|
+
cm.execCommand("newlineAndIndent");
|
27
|
+
};
|
28
|
+
})();
|
@@ -0,0 +1,32 @@
|
|
1
|
+
.CodeMirror-dialog {
|
2
|
+
position: absolute;
|
3
|
+
left: 0; right: 0;
|
4
|
+
background: white;
|
5
|
+
z-index: 15;
|
6
|
+
padding: .1em .8em;
|
7
|
+
overflow: hidden;
|
8
|
+
color: #333;
|
9
|
+
}
|
10
|
+
|
11
|
+
.CodeMirror-dialog-top {
|
12
|
+
border-bottom: 1px solid #eee;
|
13
|
+
top: 0;
|
14
|
+
}
|
15
|
+
|
16
|
+
.CodeMirror-dialog-bottom {
|
17
|
+
border-top: 1px solid #eee;
|
18
|
+
bottom: 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
.CodeMirror-dialog input {
|
22
|
+
border: none;
|
23
|
+
outline: none;
|
24
|
+
background: transparent;
|
25
|
+
width: 20em;
|
26
|
+
color: inherit;
|
27
|
+
font-family: monospace;
|
28
|
+
}
|
29
|
+
|
30
|
+
.CodeMirror-dialog button {
|
31
|
+
font-size: 70%;
|
32
|
+
}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
// Open simple dialogs on top of an editor. Relies on dialog.css.
|
2
|
+
|
3
|
+
(function() {
|
4
|
+
function dialogDiv(cm, template, bottom) {
|
5
|
+
var wrap = cm.getWrapperElement();
|
6
|
+
var dialog;
|
7
|
+
dialog = wrap.appendChild(document.createElement("div"));
|
8
|
+
if (bottom) {
|
9
|
+
dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom";
|
10
|
+
} else {
|
11
|
+
dialog.className = "CodeMirror-dialog CodeMirror-dialog-top";
|
12
|
+
}
|
13
|
+
dialog.innerHTML = template;
|
14
|
+
return dialog;
|
15
|
+
}
|
16
|
+
|
17
|
+
CodeMirror.defineExtension("openDialog", function(template, callback, options) {
|
18
|
+
var dialog = dialogDiv(this, template, options && options.bottom);
|
19
|
+
var closed = false, me = this;
|
20
|
+
function close() {
|
21
|
+
if (closed) return;
|
22
|
+
closed = true;
|
23
|
+
dialog.parentNode.removeChild(dialog);
|
24
|
+
}
|
25
|
+
var inp = dialog.getElementsByTagName("input")[0], button;
|
26
|
+
if (inp) {
|
27
|
+
CodeMirror.on(inp, "keydown", function(e) {
|
28
|
+
if (e.keyCode == 13 || e.keyCode == 27) {
|
29
|
+
CodeMirror.e_stop(e);
|
30
|
+
close();
|
31
|
+
me.focus();
|
32
|
+
if (e.keyCode == 13) callback(inp.value);
|
33
|
+
}
|
34
|
+
});
|
35
|
+
inp.focus();
|
36
|
+
CodeMirror.on(inp, "blur", close);
|
37
|
+
} else if (button = dialog.getElementsByTagName("button")[0]) {
|
38
|
+
CodeMirror.on(button, "click", function() {
|
39
|
+
close();
|
40
|
+
me.focus();
|
41
|
+
});
|
42
|
+
button.focus();
|
43
|
+
CodeMirror.on(button, "blur", close);
|
44
|
+
}
|
45
|
+
return close;
|
46
|
+
});
|
47
|
+
|
48
|
+
CodeMirror.defineExtension("openConfirm", function(template, callbacks, options) {
|
49
|
+
var dialog = dialogDiv(this, template, options && options.bottom);
|
50
|
+
var buttons = dialog.getElementsByTagName("button");
|
51
|
+
var closed = false, me = this, blurring = 1;
|
52
|
+
function close() {
|
53
|
+
if (closed) return;
|
54
|
+
closed = true;
|
55
|
+
dialog.parentNode.removeChild(dialog);
|
56
|
+
me.focus();
|
57
|
+
}
|
58
|
+
buttons[0].focus();
|
59
|
+
for (var i = 0; i < buttons.length; ++i) {
|
60
|
+
var b = buttons[i];
|
61
|
+
(function(callback) {
|
62
|
+
CodeMirror.on(b, "click", function(e) {
|
63
|
+
CodeMirror.e_preventDefault(e);
|
64
|
+
close();
|
65
|
+
if (callback) callback(me);
|
66
|
+
});
|
67
|
+
})(callbacks[i]);
|
68
|
+
CodeMirror.on(b, "blur", function() {
|
69
|
+
--blurring;
|
70
|
+
setTimeout(function() { if (blurring <= 0) close(); }, 200);
|
71
|
+
});
|
72
|
+
CodeMirror.on(b, "focus", function() { ++blurring; });
|
73
|
+
}
|
74
|
+
});
|
75
|
+
})();
|
@@ -0,0 +1,182 @@
|
|
1
|
+
// the tagRangeFinder function is
|
2
|
+
// Copyright (C) 2011 by Daniel Glazman <daniel@glazman.org>
|
3
|
+
// released under the MIT license (../../LICENSE) like the rest of CodeMirror
|
4
|
+
CodeMirror.tagRangeFinder = function(cm, start) {
|
5
|
+
var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
6
|
+
var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
7
|
+
var xmlNAMERegExp = new RegExp("^[" + nameStartChar + "][" + nameChar + "]*");
|
8
|
+
|
9
|
+
var lineText = cm.getLine(start.line);
|
10
|
+
var found = false;
|
11
|
+
var tag = null;
|
12
|
+
var pos = start.ch;
|
13
|
+
while (!found) {
|
14
|
+
pos = lineText.indexOf("<", pos);
|
15
|
+
if (-1 == pos) // no tag on line
|
16
|
+
return;
|
17
|
+
if (pos + 1 < lineText.length && lineText[pos + 1] == "/") { // closing tag
|
18
|
+
pos++;
|
19
|
+
continue;
|
20
|
+
}
|
21
|
+
// ok we seem to have a start tag
|
22
|
+
if (!lineText.substr(pos + 1).match(xmlNAMERegExp)) { // not a tag name...
|
23
|
+
pos++;
|
24
|
+
continue;
|
25
|
+
}
|
26
|
+
var gtPos = lineText.indexOf(">", pos + 1);
|
27
|
+
if (-1 == gtPos) { // end of start tag not in line
|
28
|
+
var l = start.line + 1;
|
29
|
+
var foundGt = false;
|
30
|
+
var lastLine = cm.lineCount();
|
31
|
+
while (l < lastLine && !foundGt) {
|
32
|
+
var lt = cm.getLine(l);
|
33
|
+
gtPos = lt.indexOf(">");
|
34
|
+
if (-1 != gtPos) { // found a >
|
35
|
+
foundGt = true;
|
36
|
+
var slash = lt.lastIndexOf("/", gtPos);
|
37
|
+
if (-1 != slash && slash < gtPos) {
|
38
|
+
var str = lineText.substr(slash, gtPos - slash + 1);
|
39
|
+
if (!str.match( /\/\s*\>/ )) // yep, that's the end of empty tag
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
l++;
|
44
|
+
}
|
45
|
+
found = true;
|
46
|
+
}
|
47
|
+
else {
|
48
|
+
var slashPos = lineText.lastIndexOf("/", gtPos);
|
49
|
+
if (-1 == slashPos) { // cannot be empty tag
|
50
|
+
found = true;
|
51
|
+
// don't continue
|
52
|
+
}
|
53
|
+
else { // empty tag?
|
54
|
+
// check if really empty tag
|
55
|
+
var str = lineText.substr(slashPos, gtPos - slashPos + 1);
|
56
|
+
if (!str.match( /\/\s*\>/ )) { // finally not empty
|
57
|
+
found = true;
|
58
|
+
// don't continue
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
if (found) {
|
63
|
+
var subLine = lineText.substr(pos + 1);
|
64
|
+
tag = subLine.match(xmlNAMERegExp);
|
65
|
+
if (tag) {
|
66
|
+
// we have an element name, wooohooo !
|
67
|
+
tag = tag[0];
|
68
|
+
// do we have the close tag on same line ???
|
69
|
+
if (-1 != lineText.indexOf("</" + tag + ">", pos)) // yep
|
70
|
+
{
|
71
|
+
found = false;
|
72
|
+
}
|
73
|
+
// we don't, so we have a candidate...
|
74
|
+
}
|
75
|
+
else
|
76
|
+
found = false;
|
77
|
+
}
|
78
|
+
if (!found)
|
79
|
+
pos++;
|
80
|
+
}
|
81
|
+
|
82
|
+
if (found) {
|
83
|
+
var startTag = "(\\<\\/" + tag + "\\>)|(\\<" + tag + "\\>)|(\\<" + tag + "\\s)|(\\<" + tag + "$)";
|
84
|
+
var startTagRegExp = new RegExp(startTag);
|
85
|
+
var endTag = "</" + tag + ">";
|
86
|
+
var depth = 1;
|
87
|
+
var l = start.line + 1;
|
88
|
+
var lastLine = cm.lineCount();
|
89
|
+
while (l < lastLine) {
|
90
|
+
lineText = cm.getLine(l);
|
91
|
+
var match = lineText.match(startTagRegExp);
|
92
|
+
if (match) {
|
93
|
+
for (var i = 0; i < match.length; i++) {
|
94
|
+
if (match[i] == endTag)
|
95
|
+
depth--;
|
96
|
+
else
|
97
|
+
depth++;
|
98
|
+
if (!depth) return {from: {line: start.line, ch: gtPos + 1},
|
99
|
+
to: {line: l, ch: match.index}};
|
100
|
+
}
|
101
|
+
}
|
102
|
+
l++;
|
103
|
+
}
|
104
|
+
return;
|
105
|
+
}
|
106
|
+
};
|
107
|
+
|
108
|
+
CodeMirror.braceRangeFinder = function(cm, start) {
|
109
|
+
var line = start.line, lineText = cm.getLine(line);
|
110
|
+
var at = lineText.length, startChar, tokenType;
|
111
|
+
for (;;) {
|
112
|
+
var found = lineText.lastIndexOf("{", at);
|
113
|
+
if (found < start.ch) break;
|
114
|
+
tokenType = cm.getTokenAt({line: line, ch: found}).type;
|
115
|
+
if (!/^(comment|string)/.test(tokenType)) { startChar = found; break; }
|
116
|
+
at = found - 1;
|
117
|
+
}
|
118
|
+
if (startChar == null || lineText.lastIndexOf("}") > startChar) return;
|
119
|
+
var count = 1, lastLine = cm.lineCount(), end, endCh;
|
120
|
+
outer: for (var i = line + 1; i < lastLine; ++i) {
|
121
|
+
var text = cm.getLine(i), pos = 0;
|
122
|
+
for (;;) {
|
123
|
+
var nextOpen = text.indexOf("{", pos), nextClose = text.indexOf("}", pos);
|
124
|
+
if (nextOpen < 0) nextOpen = text.length;
|
125
|
+
if (nextClose < 0) nextClose = text.length;
|
126
|
+
pos = Math.min(nextOpen, nextClose);
|
127
|
+
if (pos == text.length) break;
|
128
|
+
if (cm.getTokenAt({line: i, ch: pos + 1}).type == tokenType) {
|
129
|
+
if (pos == nextOpen) ++count;
|
130
|
+
else if (!--count) { end = i; endCh = pos; break outer; }
|
131
|
+
}
|
132
|
+
++pos;
|
133
|
+
}
|
134
|
+
}
|
135
|
+
if (end == null || end == line + 1) return;
|
136
|
+
return {from: {line: line, ch: startChar + 1},
|
137
|
+
to: {line: end, ch: endCh}};
|
138
|
+
};
|
139
|
+
|
140
|
+
CodeMirror.indentRangeFinder = function(cm, start) {
|
141
|
+
var tabSize = cm.getOption("tabSize"), firstLine = cm.getLine(start.line);
|
142
|
+
var myIndent = CodeMirror.countColumn(firstLine, null, tabSize);
|
143
|
+
for (var i = start.line + 1, end = cm.lineCount(); i < end; ++i) {
|
144
|
+
var curLine = cm.getLine(i);
|
145
|
+
if (CodeMirror.countColumn(curLine, null, tabSize) < myIndent)
|
146
|
+
return {from: {line: start.line, ch: firstLine.length},
|
147
|
+
to: {line: i, ch: curLine.length}};
|
148
|
+
}
|
149
|
+
};
|
150
|
+
|
151
|
+
CodeMirror.newFoldFunction = function(rangeFinder, widget) {
|
152
|
+
if (widget == null) widget = "\u2194";
|
153
|
+
if (typeof widget == "string") {
|
154
|
+
var text = document.createTextNode(widget);
|
155
|
+
widget = document.createElement("span");
|
156
|
+
widget.appendChild(text);
|
157
|
+
widget.className = "CodeMirror-foldmarker";
|
158
|
+
}
|
159
|
+
|
160
|
+
return function(cm, pos) {
|
161
|
+
if (typeof pos == "number") pos = {line: pos, ch: 0};
|
162
|
+
var range = rangeFinder(cm, pos);
|
163
|
+
if (!range) return;
|
164
|
+
|
165
|
+
var present = cm.findMarksAt(range.from), cleared = 0;
|
166
|
+
for (var i = 0; i < present.length; ++i) {
|
167
|
+
if (present[i].__isFold) {
|
168
|
+
++cleared;
|
169
|
+
present[i].clear();
|
170
|
+
}
|
171
|
+
}
|
172
|
+
if (cleared) return;
|
173
|
+
|
174
|
+
var myWidget = widget.cloneNode(true);
|
175
|
+
CodeMirror.on(myWidget, "mousedown", function() {myRange.clear();});
|
176
|
+
var myRange = cm.markText(range.from, range.to, {
|
177
|
+
replacedWith: myWidget,
|
178
|
+
clearOnEnter: true,
|
179
|
+
__isFold: true
|
180
|
+
});
|
181
|
+
};
|
182
|
+
};
|