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,210 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>CodeMirror: Verilog mode</title>
|
6
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
7
|
+
<script src="../../lib/codemirror.js"></script>
|
8
|
+
<script src="verilog.js"></script>
|
9
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
10
|
+
<style>.CodeMirror {border: 2px inset #dee;}</style>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<h1>CodeMirror: Verilog mode</h1>
|
14
|
+
|
15
|
+
<form><textarea id="code" name="code">
|
16
|
+
/* Verilog demo code */
|
17
|
+
|
18
|
+
//////////////////////////////////////////////////////////////////////
|
19
|
+
//// ////
|
20
|
+
//// wb_master_model.v ////
|
21
|
+
//// ////
|
22
|
+
//// This file is part of the SPI IP core project ////
|
23
|
+
//// http://www.opencores.org/projects/spi/ ////
|
24
|
+
//// ////
|
25
|
+
//// Author(s): ////
|
26
|
+
//// - Simon Srot (simons@opencores.org) ////
|
27
|
+
//// ////
|
28
|
+
//// Based on: ////
|
29
|
+
//// - i2c/bench/verilog/wb_master_model.v ////
|
30
|
+
//// Copyright (C) 2001 Richard Herveille ////
|
31
|
+
//// ////
|
32
|
+
//// All additional information is avaliable in the Readme.txt ////
|
33
|
+
//// file. ////
|
34
|
+
//// ////
|
35
|
+
//////////////////////////////////////////////////////////////////////
|
36
|
+
//// ////
|
37
|
+
//// Copyright (C) 2002 Authors ////
|
38
|
+
//// ////
|
39
|
+
//// This source file may be used and distributed without ////
|
40
|
+
//// restriction provided that this copyright statement is not ////
|
41
|
+
//// removed from the file and that any derivative work contains ////
|
42
|
+
//// the original copyright notice and the associated disclaimer. ////
|
43
|
+
//// ////
|
44
|
+
//// This source file is free software; you can redistribute it ////
|
45
|
+
//// and/or modify it under the terms of the GNU Lesser General ////
|
46
|
+
//// Public License as published by the Free Software Foundation; ////
|
47
|
+
//// either version 2.1 of the License, or (at your option) any ////
|
48
|
+
//// later version. ////
|
49
|
+
//// ////
|
50
|
+
//// This source is distributed in the hope that it will be ////
|
51
|
+
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
52
|
+
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
53
|
+
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
54
|
+
//// details. ////
|
55
|
+
//// ////
|
56
|
+
//// You should have received a copy of the GNU Lesser General ////
|
57
|
+
//// Public License along with this source; if not, download it ////
|
58
|
+
//// from http://www.opencores.org/lgpl.shtml ////
|
59
|
+
//// ////
|
60
|
+
//////////////////////////////////////////////////////////////////////
|
61
|
+
|
62
|
+
`include "timescale.v"
|
63
|
+
|
64
|
+
module wb_master_model(clk, rst, adr, din, dout, cyc, stb, we, sel, ack, err, rty);
|
65
|
+
|
66
|
+
parameter dwidth = 32;
|
67
|
+
parameter awidth = 32;
|
68
|
+
|
69
|
+
input clk, rst;
|
70
|
+
output [awidth -1:0] adr;
|
71
|
+
input [dwidth -1:0] din;
|
72
|
+
output [dwidth -1:0] dout;
|
73
|
+
output cyc, stb;
|
74
|
+
output we;
|
75
|
+
output [dwidth/8 -1:0] sel;
|
76
|
+
input ack, err, rty;
|
77
|
+
|
78
|
+
// Internal signals
|
79
|
+
reg [awidth -1:0] adr;
|
80
|
+
reg [dwidth -1:0] dout;
|
81
|
+
reg cyc, stb;
|
82
|
+
reg we;
|
83
|
+
reg [dwidth/8 -1:0] sel;
|
84
|
+
|
85
|
+
reg [dwidth -1:0] q;
|
86
|
+
|
87
|
+
// Memory Logic
|
88
|
+
initial
|
89
|
+
begin
|
90
|
+
adr = {awidth{1'bx}};
|
91
|
+
dout = {dwidth{1'bx}};
|
92
|
+
cyc = 1'b0;
|
93
|
+
stb = 1'bx;
|
94
|
+
we = 1'hx;
|
95
|
+
sel = {dwidth/8{1'bx}};
|
96
|
+
#1;
|
97
|
+
end
|
98
|
+
|
99
|
+
// Wishbone write cycle
|
100
|
+
task wb_write;
|
101
|
+
input delay;
|
102
|
+
integer delay;
|
103
|
+
|
104
|
+
input [awidth -1:0] a;
|
105
|
+
input [dwidth -1:0] d;
|
106
|
+
|
107
|
+
begin
|
108
|
+
|
109
|
+
// wait initial delay
|
110
|
+
repeat(delay) @(posedge clk);
|
111
|
+
|
112
|
+
// assert wishbone signal
|
113
|
+
#1;
|
114
|
+
adr = a;
|
115
|
+
dout = d;
|
116
|
+
cyc = 1'b1;
|
117
|
+
stb = 1'b1;
|
118
|
+
we = 1'b1;
|
119
|
+
sel = {dwidth/8{1'b1}};
|
120
|
+
@(posedge clk);
|
121
|
+
|
122
|
+
// wait for acknowledge from slave
|
123
|
+
while(~ack) @(posedge clk);
|
124
|
+
|
125
|
+
// negate wishbone signals
|
126
|
+
#1;
|
127
|
+
cyc = 1'b0;
|
128
|
+
stb = 1'bx;
|
129
|
+
adr = {awidth{1'bx}};
|
130
|
+
dout = {dwidth{1'bx}};
|
131
|
+
we = 1'hx;
|
132
|
+
sel = {dwidth/8{1'bx}};
|
133
|
+
|
134
|
+
end
|
135
|
+
endtask
|
136
|
+
|
137
|
+
// Wishbone read cycle
|
138
|
+
task wb_read;
|
139
|
+
input delay;
|
140
|
+
integer delay;
|
141
|
+
|
142
|
+
input [awidth -1:0] a;
|
143
|
+
output [dwidth -1:0] d;
|
144
|
+
|
145
|
+
begin
|
146
|
+
|
147
|
+
// wait initial delay
|
148
|
+
repeat(delay) @(posedge clk);
|
149
|
+
|
150
|
+
// assert wishbone signals
|
151
|
+
#1;
|
152
|
+
adr = a;
|
153
|
+
dout = {dwidth{1'bx}};
|
154
|
+
cyc = 1'b1;
|
155
|
+
stb = 1'b1;
|
156
|
+
we = 1'b0;
|
157
|
+
sel = {dwidth/8{1'b1}};
|
158
|
+
@(posedge clk);
|
159
|
+
|
160
|
+
// wait for acknowledge from slave
|
161
|
+
while(~ack) @(posedge clk);
|
162
|
+
|
163
|
+
// negate wishbone signals
|
164
|
+
#1;
|
165
|
+
cyc = 1'b0;
|
166
|
+
stb = 1'bx;
|
167
|
+
adr = {awidth{1'bx}};
|
168
|
+
dout = {dwidth{1'bx}};
|
169
|
+
we = 1'hx;
|
170
|
+
sel = {dwidth/8{1'bx}};
|
171
|
+
d = din;
|
172
|
+
|
173
|
+
end
|
174
|
+
endtask
|
175
|
+
|
176
|
+
// Wishbone compare cycle (read data from location and compare with expected data)
|
177
|
+
task wb_cmp;
|
178
|
+
input delay;
|
179
|
+
integer delay;
|
180
|
+
|
181
|
+
input [awidth -1:0] a;
|
182
|
+
input [dwidth -1:0] d_exp;
|
183
|
+
|
184
|
+
begin
|
185
|
+
wb_read (delay, a, q);
|
186
|
+
|
187
|
+
if (d_exp !== q) begin
|
188
|
+
$display("\n--- ERROR: At address 0x%0x, got 0x%0x, expected 0x%0x at time %t", a, q, d_exp, $time);
|
189
|
+
$stop;
|
190
|
+
end
|
191
|
+
end
|
192
|
+
endtask
|
193
|
+
|
194
|
+
endmodule
|
195
|
+
</textarea></form>
|
196
|
+
|
197
|
+
<script>
|
198
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
199
|
+
lineNumbers: true,
|
200
|
+
mode: "text/x-verilog"
|
201
|
+
});
|
202
|
+
</script>
|
203
|
+
|
204
|
+
<p>Simple mode that tries to handle Verilog-like languages as well as it
|
205
|
+
can. Takes one configuration parameters: <code>keywords</code>, an
|
206
|
+
object whose property names are the keywords in the language.</p>
|
207
|
+
|
208
|
+
<p><strong>MIME types defined:</strong> <code>text/x-verilog</code> (Verilog code).</p>
|
209
|
+
</body>
|
210
|
+
</html>
|
@@ -0,0 +1,182 @@
|
|
1
|
+
CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
2
|
+
var indentUnit = config.indentUnit,
|
3
|
+
keywords = parserConfig.keywords || {},
|
4
|
+
blockKeywords = parserConfig.blockKeywords || {},
|
5
|
+
atoms = parserConfig.atoms || {},
|
6
|
+
hooks = parserConfig.hooks || {},
|
7
|
+
multiLineStrings = parserConfig.multiLineStrings;
|
8
|
+
var isOperatorChar = /[&|~><!\)\(*#%@+\/=?\:;}{,\.\^\-\[\]]/;
|
9
|
+
|
10
|
+
var curPunc;
|
11
|
+
|
12
|
+
function tokenBase(stream, state) {
|
13
|
+
var ch = stream.next();
|
14
|
+
if (hooks[ch]) {
|
15
|
+
var result = hooks[ch](stream, state);
|
16
|
+
if (result !== false) return result;
|
17
|
+
}
|
18
|
+
if (ch == '"') {
|
19
|
+
state.tokenize = tokenString(ch);
|
20
|
+
return state.tokenize(stream, state);
|
21
|
+
}
|
22
|
+
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
23
|
+
curPunc = ch;
|
24
|
+
return null;
|
25
|
+
}
|
26
|
+
if (/[\d']/.test(ch)) {
|
27
|
+
stream.eatWhile(/[\w\.']/);
|
28
|
+
return "number";
|
29
|
+
}
|
30
|
+
if (ch == "/") {
|
31
|
+
if (stream.eat("*")) {
|
32
|
+
state.tokenize = tokenComment;
|
33
|
+
return tokenComment(stream, state);
|
34
|
+
}
|
35
|
+
if (stream.eat("/")) {
|
36
|
+
stream.skipToEnd();
|
37
|
+
return "comment";
|
38
|
+
}
|
39
|
+
}
|
40
|
+
if (isOperatorChar.test(ch)) {
|
41
|
+
stream.eatWhile(isOperatorChar);
|
42
|
+
return "operator";
|
43
|
+
}
|
44
|
+
stream.eatWhile(/[\w\$_]/);
|
45
|
+
var cur = stream.current();
|
46
|
+
if (keywords.propertyIsEnumerable(cur)) {
|
47
|
+
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
48
|
+
return "keyword";
|
49
|
+
}
|
50
|
+
if (atoms.propertyIsEnumerable(cur)) return "atom";
|
51
|
+
return "variable";
|
52
|
+
}
|
53
|
+
|
54
|
+
function tokenString(quote) {
|
55
|
+
return function(stream, state) {
|
56
|
+
var escaped = false, next, end = false;
|
57
|
+
while ((next = stream.next()) != null) {
|
58
|
+
if (next == quote && !escaped) {end = true; break;}
|
59
|
+
escaped = !escaped && next == "\\";
|
60
|
+
}
|
61
|
+
if (end || !(escaped || multiLineStrings))
|
62
|
+
state.tokenize = tokenBase;
|
63
|
+
return "string";
|
64
|
+
};
|
65
|
+
}
|
66
|
+
|
67
|
+
function tokenComment(stream, state) {
|
68
|
+
var maybeEnd = false, ch;
|
69
|
+
while (ch = stream.next()) {
|
70
|
+
if (ch == "/" && maybeEnd) {
|
71
|
+
state.tokenize = tokenBase;
|
72
|
+
break;
|
73
|
+
}
|
74
|
+
maybeEnd = (ch == "*");
|
75
|
+
}
|
76
|
+
return "comment";
|
77
|
+
}
|
78
|
+
|
79
|
+
function Context(indented, column, type, align, prev) {
|
80
|
+
this.indented = indented;
|
81
|
+
this.column = column;
|
82
|
+
this.type = type;
|
83
|
+
this.align = align;
|
84
|
+
this.prev = prev;
|
85
|
+
}
|
86
|
+
function pushContext(state, col, type) {
|
87
|
+
return state.context = new Context(state.indented, col, type, null, state.context);
|
88
|
+
}
|
89
|
+
function popContext(state) {
|
90
|
+
var t = state.context.type;
|
91
|
+
if (t == ")" || t == "]" || t == "}")
|
92
|
+
state.indented = state.context.indented;
|
93
|
+
return state.context = state.context.prev;
|
94
|
+
}
|
95
|
+
|
96
|
+
// Interface
|
97
|
+
|
98
|
+
return {
|
99
|
+
startState: function(basecolumn) {
|
100
|
+
return {
|
101
|
+
tokenize: null,
|
102
|
+
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
103
|
+
indented: 0,
|
104
|
+
startOfLine: true
|
105
|
+
};
|
106
|
+
},
|
107
|
+
|
108
|
+
token: function(stream, state) {
|
109
|
+
var ctx = state.context;
|
110
|
+
if (stream.sol()) {
|
111
|
+
if (ctx.align == null) ctx.align = false;
|
112
|
+
state.indented = stream.indentation();
|
113
|
+
state.startOfLine = true;
|
114
|
+
}
|
115
|
+
if (stream.eatSpace()) return null;
|
116
|
+
curPunc = null;
|
117
|
+
var style = (state.tokenize || tokenBase)(stream, state);
|
118
|
+
if (style == "comment" || style == "meta") return style;
|
119
|
+
if (ctx.align == null) ctx.align = true;
|
120
|
+
|
121
|
+
if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
|
122
|
+
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
123
|
+
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
124
|
+
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
125
|
+
else if (curPunc == "}") {
|
126
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
127
|
+
if (ctx.type == "}") ctx = popContext(state);
|
128
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
129
|
+
}
|
130
|
+
else if (curPunc == ctx.type) popContext(state);
|
131
|
+
else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
|
132
|
+
pushContext(state, stream.column(), "statement");
|
133
|
+
state.startOfLine = false;
|
134
|
+
return style;
|
135
|
+
},
|
136
|
+
|
137
|
+
indent: function(state, textAfter) {
|
138
|
+
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
|
139
|
+
var firstChar = textAfter && textAfter.charAt(0), ctx = state.context, closing = firstChar == ctx.type;
|
140
|
+
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
|
141
|
+
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
142
|
+
else return ctx.indented + (closing ? 0 : indentUnit);
|
143
|
+
},
|
144
|
+
|
145
|
+
electricChars: "{}"
|
146
|
+
};
|
147
|
+
});
|
148
|
+
|
149
|
+
(function() {
|
150
|
+
function words(str) {
|
151
|
+
var obj = {}, words = str.split(" ");
|
152
|
+
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
153
|
+
return obj;
|
154
|
+
}
|
155
|
+
|
156
|
+
var verilogKeywords = "always and assign automatic begin buf bufif0 bufif1 case casex casez cell cmos config " +
|
157
|
+
"deassign default defparam design disable edge else end endcase endconfig endfunction endgenerate endmodule " +
|
158
|
+
"endprimitive endspecify endtable endtask event for force forever fork function generate genvar highz0 " +
|
159
|
+
"highz1 if ifnone incdir include initial inout input instance integer join large liblist library localparam " +
|
160
|
+
"macromodule medium module nand negedge nmos nor noshowcancelled not notif0 notif1 or output parameter pmos " +
|
161
|
+
"posedge primitive pull0 pull1 pulldown pullup pulsestyle_onevent pulsestyle_ondetect rcmos real realtime " +
|
162
|
+
"reg release repeat rnmos rpmos rtran rtranif0 rtranif1 scalared showcancelled signed small specify specparam " +
|
163
|
+
"strong0 strong1 supply0 supply1 table task time tran tranif0 tranif1 tri tri0 tri1 triand trior trireg " +
|
164
|
+
"unsigned use vectored wait wand weak0 weak1 while wire wor xnor xor";
|
165
|
+
|
166
|
+
var verilogBlockKeywords = "begin bufif0 bufif1 case casex casez config else end endcase endconfig endfunction " +
|
167
|
+
"endgenerate endmodule endprimitive endspecify endtable endtask for forever function generate if ifnone " +
|
168
|
+
"macromodule module primitive repeat specify table task while";
|
169
|
+
|
170
|
+
function metaHook(stream) {
|
171
|
+
stream.eatWhile(/[\w\$_]/);
|
172
|
+
return "meta";
|
173
|
+
}
|
174
|
+
|
175
|
+
CodeMirror.defineMIME("text/x-verilog", {
|
176
|
+
name: "verilog",
|
177
|
+
keywords: words(verilogKeywords),
|
178
|
+
blockKeywords: words(verilogBlockKeywords),
|
179
|
+
atoms: words("null"),
|
180
|
+
hooks: {"`": metaHook, "$": metaHook}
|
181
|
+
});
|
182
|
+
}());
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>CodeMirror: XML mode</title>
|
6
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
7
|
+
<script src="../../lib/codemirror.js"></script>
|
8
|
+
<script src="xml.js"></script>
|
9
|
+
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
10
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<h1>CodeMirror: XML mode</h1>
|
14
|
+
<form><textarea id="code" name="code">
|
15
|
+
<html style="color: green">
|
16
|
+
<!-- this is a comment -->
|
17
|
+
<head>
|
18
|
+
<title>HTML Example</title>
|
19
|
+
</head>
|
20
|
+
<body>
|
21
|
+
The indentation tries to be <em>somewhat &quot;do what
|
22
|
+
I mean&quot;</em>... but might not match your style.
|
23
|
+
</body>
|
24
|
+
</html>
|
25
|
+
</textarea></form>
|
26
|
+
<script>
|
27
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
28
|
+
mode: {name: "xml", alignCDATA: true},
|
29
|
+
lineNumbers: true
|
30
|
+
});
|
31
|
+
</script>
|
32
|
+
<p>The XML mode supports two configuration parameters:</p>
|
33
|
+
<dl>
|
34
|
+
<dt><code>htmlMode (boolean)</code></dt>
|
35
|
+
<dd>This switches the mode to parse HTML instead of XML. This
|
36
|
+
means attributes do not have to be quoted, and some elements
|
37
|
+
(such as <code>br</code>) do not require a closing tag.</dd>
|
38
|
+
<dt><code>alignCDATA (boolean)</code></dt>
|
39
|
+
<dd>Setting this to true will force the opening tag of CDATA
|
40
|
+
blocks to not be indented.</dd>
|
41
|
+
</dl>
|
42
|
+
|
43
|
+
<p><strong>MIME types defined:</strong> <code>application/xml</code>, <code>text/html</code>.</p>
|
44
|
+
</body>
|
45
|
+
</html>
|
@@ -0,0 +1,324 @@
|
|
1
|
+
CodeMirror.defineMode("xml", function(config, parserConfig) {
|
2
|
+
var indentUnit = config.indentUnit;
|
3
|
+
var Kludges = parserConfig.htmlMode ? {
|
4
|
+
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
|
5
|
+
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
|
6
|
+
'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
|
7
|
+
'track': true, 'wbr': true},
|
8
|
+
implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
|
9
|
+
'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
|
10
|
+
'th': true, 'tr': true},
|
11
|
+
contextGrabbers: {
|
12
|
+
'dd': {'dd': true, 'dt': true},
|
13
|
+
'dt': {'dd': true, 'dt': true},
|
14
|
+
'li': {'li': true},
|
15
|
+
'option': {'option': true, 'optgroup': true},
|
16
|
+
'optgroup': {'optgroup': true},
|
17
|
+
'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
|
18
|
+
'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
|
19
|
+
'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
|
20
|
+
'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
|
21
|
+
'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
|
22
|
+
'rp': {'rp': true, 'rt': true},
|
23
|
+
'rt': {'rp': true, 'rt': true},
|
24
|
+
'tbody': {'tbody': true, 'tfoot': true},
|
25
|
+
'td': {'td': true, 'th': true},
|
26
|
+
'tfoot': {'tbody': true},
|
27
|
+
'th': {'td': true, 'th': true},
|
28
|
+
'thead': {'tbody': true, 'tfoot': true},
|
29
|
+
'tr': {'tr': true}
|
30
|
+
},
|
31
|
+
doNotIndent: {"pre": true},
|
32
|
+
allowUnquoted: true,
|
33
|
+
allowMissing: true
|
34
|
+
} : {
|
35
|
+
autoSelfClosers: {},
|
36
|
+
implicitlyClosed: {},
|
37
|
+
contextGrabbers: {},
|
38
|
+
doNotIndent: {},
|
39
|
+
allowUnquoted: false,
|
40
|
+
allowMissing: false
|
41
|
+
};
|
42
|
+
var alignCDATA = parserConfig.alignCDATA;
|
43
|
+
|
44
|
+
// Return variables for tokenizers
|
45
|
+
var tagName, type;
|
46
|
+
|
47
|
+
function inText(stream, state) {
|
48
|
+
function chain(parser) {
|
49
|
+
state.tokenize = parser;
|
50
|
+
return parser(stream, state);
|
51
|
+
}
|
52
|
+
|
53
|
+
var ch = stream.next();
|
54
|
+
if (ch == "<") {
|
55
|
+
if (stream.eat("!")) {
|
56
|
+
if (stream.eat("[")) {
|
57
|
+
if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
|
58
|
+
else return null;
|
59
|
+
}
|
60
|
+
else if (stream.match("--")) return chain(inBlock("comment", "-->"));
|
61
|
+
else if (stream.match("DOCTYPE", true, true)) {
|
62
|
+
stream.eatWhile(/[\w\._\-]/);
|
63
|
+
return chain(doctype(1));
|
64
|
+
}
|
65
|
+
else return null;
|
66
|
+
}
|
67
|
+
else if (stream.eat("?")) {
|
68
|
+
stream.eatWhile(/[\w\._\-]/);
|
69
|
+
state.tokenize = inBlock("meta", "?>");
|
70
|
+
return "meta";
|
71
|
+
}
|
72
|
+
else {
|
73
|
+
var isClose = stream.eat("/");
|
74
|
+
tagName = "";
|
75
|
+
var c;
|
76
|
+
while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
|
77
|
+
if (!tagName) return "error";
|
78
|
+
type = isClose ? "closeTag" : "openTag";
|
79
|
+
state.tokenize = inTag;
|
80
|
+
return "tag";
|
81
|
+
}
|
82
|
+
}
|
83
|
+
else if (ch == "&") {
|
84
|
+
var ok;
|
85
|
+
if (stream.eat("#")) {
|
86
|
+
if (stream.eat("x")) {
|
87
|
+
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
|
88
|
+
} else {
|
89
|
+
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
|
90
|
+
}
|
91
|
+
} else {
|
92
|
+
ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
|
93
|
+
}
|
94
|
+
return ok ? "atom" : "error";
|
95
|
+
}
|
96
|
+
else {
|
97
|
+
stream.eatWhile(/[^&<]/);
|
98
|
+
return null;
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
function inTag(stream, state) {
|
103
|
+
var ch = stream.next();
|
104
|
+
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
|
105
|
+
state.tokenize = inText;
|
106
|
+
type = ch == ">" ? "endTag" : "selfcloseTag";
|
107
|
+
return "tag";
|
108
|
+
}
|
109
|
+
else if (ch == "=") {
|
110
|
+
type = "equals";
|
111
|
+
return null;
|
112
|
+
}
|
113
|
+
else if (/[\'\"]/.test(ch)) {
|
114
|
+
state.tokenize = inAttribute(ch);
|
115
|
+
return state.tokenize(stream, state);
|
116
|
+
}
|
117
|
+
else {
|
118
|
+
stream.eatWhile(/[^\s\u00a0=<>\"\']/);
|
119
|
+
return "word";
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
function inAttribute(quote) {
|
124
|
+
return function(stream, state) {
|
125
|
+
while (!stream.eol()) {
|
126
|
+
if (stream.next() == quote) {
|
127
|
+
state.tokenize = inTag;
|
128
|
+
break;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
return "string";
|
132
|
+
};
|
133
|
+
}
|
134
|
+
|
135
|
+
function inBlock(style, terminator) {
|
136
|
+
return function(stream, state) {
|
137
|
+
while (!stream.eol()) {
|
138
|
+
if (stream.match(terminator)) {
|
139
|
+
state.tokenize = inText;
|
140
|
+
break;
|
141
|
+
}
|
142
|
+
stream.next();
|
143
|
+
}
|
144
|
+
return style;
|
145
|
+
};
|
146
|
+
}
|
147
|
+
function doctype(depth) {
|
148
|
+
return function(stream, state) {
|
149
|
+
var ch;
|
150
|
+
while ((ch = stream.next()) != null) {
|
151
|
+
if (ch == "<") {
|
152
|
+
state.tokenize = doctype(depth + 1);
|
153
|
+
return state.tokenize(stream, state);
|
154
|
+
} else if (ch == ">") {
|
155
|
+
if (depth == 1) {
|
156
|
+
state.tokenize = inText;
|
157
|
+
break;
|
158
|
+
} else {
|
159
|
+
state.tokenize = doctype(depth - 1);
|
160
|
+
return state.tokenize(stream, state);
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
return "meta";
|
165
|
+
};
|
166
|
+
}
|
167
|
+
|
168
|
+
var curState, setStyle;
|
169
|
+
function pass() {
|
170
|
+
for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
|
171
|
+
}
|
172
|
+
function cont() {
|
173
|
+
pass.apply(null, arguments);
|
174
|
+
return true;
|
175
|
+
}
|
176
|
+
|
177
|
+
function pushContext(tagName, startOfLine) {
|
178
|
+
var noIndent = Kludges.doNotIndent.hasOwnProperty(tagName) || (curState.context && curState.context.noIndent);
|
179
|
+
curState.context = {
|
180
|
+
prev: curState.context,
|
181
|
+
tagName: tagName,
|
182
|
+
indent: curState.indented,
|
183
|
+
startOfLine: startOfLine,
|
184
|
+
noIndent: noIndent
|
185
|
+
};
|
186
|
+
}
|
187
|
+
function popContext() {
|
188
|
+
if (curState.context) curState.context = curState.context.prev;
|
189
|
+
}
|
190
|
+
|
191
|
+
function element(type) {
|
192
|
+
if (type == "openTag") {
|
193
|
+
curState.tagName = tagName;
|
194
|
+
return cont(attributes, endtag(curState.startOfLine));
|
195
|
+
} else if (type == "closeTag") {
|
196
|
+
var err = false;
|
197
|
+
if (curState.context) {
|
198
|
+
if (curState.context.tagName != tagName) {
|
199
|
+
if (Kludges.implicitlyClosed.hasOwnProperty(curState.context.tagName.toLowerCase())) {
|
200
|
+
popContext();
|
201
|
+
}
|
202
|
+
err = !curState.context || curState.context.tagName != tagName;
|
203
|
+
}
|
204
|
+
} else {
|
205
|
+
err = true;
|
206
|
+
}
|
207
|
+
if (err) setStyle = "error";
|
208
|
+
return cont(endclosetag(err));
|
209
|
+
}
|
210
|
+
return cont();
|
211
|
+
}
|
212
|
+
function endtag(startOfLine) {
|
213
|
+
return function(type) {
|
214
|
+
var tagName = curState.tagName;
|
215
|
+
curState.tagName = null;
|
216
|
+
if (type == "selfcloseTag" ||
|
217
|
+
(type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(tagName.toLowerCase()))) {
|
218
|
+
maybePopContext(tagName.toLowerCase());
|
219
|
+
return cont();
|
220
|
+
}
|
221
|
+
if (type == "endTag") {
|
222
|
+
maybePopContext(tagName.toLowerCase());
|
223
|
+
pushContext(tagName, startOfLine);
|
224
|
+
return cont();
|
225
|
+
}
|
226
|
+
return cont();
|
227
|
+
};
|
228
|
+
}
|
229
|
+
function endclosetag(err) {
|
230
|
+
return function(type) {
|
231
|
+
if (err) setStyle = "error";
|
232
|
+
if (type == "endTag") { popContext(); return cont(); }
|
233
|
+
setStyle = "error";
|
234
|
+
return cont(arguments.callee);
|
235
|
+
};
|
236
|
+
}
|
237
|
+
function maybePopContext(nextTagName) {
|
238
|
+
var parentTagName;
|
239
|
+
while (true) {
|
240
|
+
if (!curState.context) {
|
241
|
+
return;
|
242
|
+
}
|
243
|
+
parentTagName = curState.context.tagName.toLowerCase();
|
244
|
+
if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) ||
|
245
|
+
!Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
|
246
|
+
return;
|
247
|
+
}
|
248
|
+
popContext();
|
249
|
+
}
|
250
|
+
}
|
251
|
+
|
252
|
+
function attributes(type) {
|
253
|
+
if (type == "word") {setStyle = "attribute"; return cont(attribute, attributes);}
|
254
|
+
if (type == "endTag" || type == "selfcloseTag") return pass();
|
255
|
+
setStyle = "error";
|
256
|
+
return cont(attributes);
|
257
|
+
}
|
258
|
+
function attribute(type) {
|
259
|
+
if (type == "equals") return cont(attvalue, attributes);
|
260
|
+
if (!Kludges.allowMissing) setStyle = "error";
|
261
|
+
else if (type == "word") setStyle = "attribute";
|
262
|
+
return (type == "endTag" || type == "selfcloseTag") ? pass() : cont();
|
263
|
+
}
|
264
|
+
function attvalue(type) {
|
265
|
+
if (type == "string") return cont(attvaluemaybe);
|
266
|
+
if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();}
|
267
|
+
setStyle = "error";
|
268
|
+
return (type == "endTag" || type == "selfCloseTag") ? pass() : cont();
|
269
|
+
}
|
270
|
+
function attvaluemaybe(type) {
|
271
|
+
if (type == "string") return cont(attvaluemaybe);
|
272
|
+
else return pass();
|
273
|
+
}
|
274
|
+
|
275
|
+
return {
|
276
|
+
startState: function() {
|
277
|
+
return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, context: null};
|
278
|
+
},
|
279
|
+
|
280
|
+
token: function(stream, state) {
|
281
|
+
if (stream.sol()) {
|
282
|
+
state.startOfLine = true;
|
283
|
+
state.indented = stream.indentation();
|
284
|
+
}
|
285
|
+
if (stream.eatSpace()) return null;
|
286
|
+
|
287
|
+
setStyle = type = tagName = null;
|
288
|
+
var style = state.tokenize(stream, state);
|
289
|
+
state.type = type;
|
290
|
+
if ((style || type) && style != "comment") {
|
291
|
+
curState = state;
|
292
|
+
while (true) {
|
293
|
+
var comb = state.cc.pop() || element;
|
294
|
+
if (comb(type || style)) break;
|
295
|
+
}
|
296
|
+
}
|
297
|
+
state.startOfLine = false;
|
298
|
+
return setStyle || style;
|
299
|
+
},
|
300
|
+
|
301
|
+
indent: function(state, textAfter, fullLine) {
|
302
|
+
var context = state.context;
|
303
|
+
if ((state.tokenize != inTag && state.tokenize != inText) ||
|
304
|
+
context && context.noIndent)
|
305
|
+
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
|
306
|
+
if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
|
307
|
+
if (context && /^<\//.test(textAfter))
|
308
|
+
context = context.prev;
|
309
|
+
while (context && !context.startOfLine)
|
310
|
+
context = context.prev;
|
311
|
+
if (context) return context.indent + indentUnit;
|
312
|
+
else return 0;
|
313
|
+
},
|
314
|
+
|
315
|
+
electricChars: "/",
|
316
|
+
|
317
|
+
configuration: parserConfig.htmlMode ? "html" : "xml"
|
318
|
+
};
|
319
|
+
});
|
320
|
+
|
321
|
+
CodeMirror.defineMIME("text/xml", "xml");
|
322
|
+
CodeMirror.defineMIME("application/xml", "xml");
|
323
|
+
if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
|
324
|
+
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
|