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,314 @@
|
|
1
|
+
CodeMirror.defineMode('rst', function(config, options) {
|
2
|
+
function setState(state, fn, ctx) {
|
3
|
+
state.fn = fn;
|
4
|
+
setCtx(state, ctx);
|
5
|
+
}
|
6
|
+
|
7
|
+
function setCtx(state, ctx) {
|
8
|
+
state.ctx = ctx || {};
|
9
|
+
}
|
10
|
+
|
11
|
+
function setNormal(state, ch) {
|
12
|
+
if (ch && (typeof ch !== 'string')) {
|
13
|
+
var str = ch.current();
|
14
|
+
ch = str[str.length-1];
|
15
|
+
}
|
16
|
+
|
17
|
+
setState(state, normal, {back: ch});
|
18
|
+
}
|
19
|
+
|
20
|
+
function hasMode(mode) {
|
21
|
+
return mode && CodeMirror.modes.hasOwnProperty(mode);
|
22
|
+
}
|
23
|
+
|
24
|
+
function getMode(mode) {
|
25
|
+
if (hasMode(mode)) {
|
26
|
+
return CodeMirror.getMode(config, mode);
|
27
|
+
} else {
|
28
|
+
return null;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
var verbatimMode = getMode(options.verbatim);
|
33
|
+
var pythonMode = getMode('python');
|
34
|
+
|
35
|
+
var reSection = /^[!"#$%&'()*+,-./:;<=>?@[\\\]^_`{|}~]/;
|
36
|
+
var reDirective = /^\s*\w([-:.\w]*\w)?::(\s|$)/;
|
37
|
+
var reHyperlink = /^\s*_[\w-]+:(\s|$)/;
|
38
|
+
var reFootnote = /^\s*\[(\d+|#)\](\s|$)/;
|
39
|
+
var reCitation = /^\s*\[[A-Za-z][\w-]*\](\s|$)/;
|
40
|
+
var reFootnoteRef = /^\[(\d+|#)\]_/;
|
41
|
+
var reCitationRef = /^\[[A-Za-z][\w-]*\]_/;
|
42
|
+
var reDirectiveMarker = /^\.\.(\s|$)/;
|
43
|
+
var reVerbatimMarker = /^::\s*$/;
|
44
|
+
var rePreInline = /^[-\s"([{</:]/;
|
45
|
+
var rePostInline = /^[-\s`'")\]}>/:.,;!?\\_]/;
|
46
|
+
var reExamples = /^\s+(>>>|In \[\d+\]:)\s/;
|
47
|
+
|
48
|
+
function normal(stream, state) {
|
49
|
+
var ch, sol, i;
|
50
|
+
|
51
|
+
if (stream.eat(/\\/)) {
|
52
|
+
ch = stream.next();
|
53
|
+
setNormal(state, ch);
|
54
|
+
return null;
|
55
|
+
}
|
56
|
+
|
57
|
+
sol = stream.sol();
|
58
|
+
|
59
|
+
if (sol && (ch = stream.eat(reSection))) {
|
60
|
+
for (i = 0; stream.eat(ch); i++);
|
61
|
+
|
62
|
+
if (i >= 3 && stream.match(/^\s*$/)) {
|
63
|
+
setNormal(state, null);
|
64
|
+
return 'header';
|
65
|
+
} else {
|
66
|
+
stream.backUp(i + 1);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
if (sol && stream.match(reDirectiveMarker)) {
|
71
|
+
if (!stream.eol()) {
|
72
|
+
setState(state, directive);
|
73
|
+
}
|
74
|
+
return 'meta';
|
75
|
+
}
|
76
|
+
|
77
|
+
if (stream.match(reVerbatimMarker)) {
|
78
|
+
if (!verbatimMode) {
|
79
|
+
setState(state, verbatim);
|
80
|
+
} else {
|
81
|
+
var mode = verbatimMode;
|
82
|
+
|
83
|
+
setState(state, verbatim, {
|
84
|
+
mode: mode,
|
85
|
+
local: mode.startState()
|
86
|
+
});
|
87
|
+
}
|
88
|
+
return 'meta';
|
89
|
+
}
|
90
|
+
|
91
|
+
if (sol && stream.match(reExamples, false)) {
|
92
|
+
if (!pythonMode) {
|
93
|
+
setState(state, verbatim);
|
94
|
+
return 'meta';
|
95
|
+
} else {
|
96
|
+
var mode = pythonMode;
|
97
|
+
|
98
|
+
setState(state, verbatim, {
|
99
|
+
mode: mode,
|
100
|
+
local: mode.startState()
|
101
|
+
});
|
102
|
+
|
103
|
+
return null;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
function testBackward(re) {
|
108
|
+
return sol || !state.ctx.back || re.test(state.ctx.back);
|
109
|
+
}
|
110
|
+
|
111
|
+
function testForward(re) {
|
112
|
+
return stream.eol() || stream.match(re, false);
|
113
|
+
}
|
114
|
+
|
115
|
+
function testInline(re) {
|
116
|
+
return stream.match(re) && testBackward(/\W/) && testForward(/\W/);
|
117
|
+
}
|
118
|
+
|
119
|
+
if (testInline(reFootnoteRef)) {
|
120
|
+
setNormal(state, stream);
|
121
|
+
return 'footnote';
|
122
|
+
}
|
123
|
+
|
124
|
+
if (testInline(reCitationRef)) {
|
125
|
+
setNormal(state, stream);
|
126
|
+
return 'citation';
|
127
|
+
}
|
128
|
+
|
129
|
+
ch = stream.next();
|
130
|
+
|
131
|
+
if (testBackward(rePreInline)) {
|
132
|
+
if ((ch === ':' || ch === '|') && stream.eat(/\S/)) {
|
133
|
+
var token;
|
134
|
+
|
135
|
+
if (ch === ':') {
|
136
|
+
token = 'builtin';
|
137
|
+
} else {
|
138
|
+
token = 'atom';
|
139
|
+
}
|
140
|
+
|
141
|
+
setState(state, inline, {
|
142
|
+
ch: ch,
|
143
|
+
wide: false,
|
144
|
+
prev: null,
|
145
|
+
token: token
|
146
|
+
});
|
147
|
+
|
148
|
+
return token;
|
149
|
+
}
|
150
|
+
|
151
|
+
if (ch === '*' || ch === '`') {
|
152
|
+
var orig = ch,
|
153
|
+
wide = false;
|
154
|
+
|
155
|
+
ch = stream.next();
|
156
|
+
|
157
|
+
if (ch == orig) {
|
158
|
+
wide = true;
|
159
|
+
ch = stream.next();
|
160
|
+
}
|
161
|
+
|
162
|
+
if (ch && !/\s/.test(ch)) {
|
163
|
+
var token;
|
164
|
+
|
165
|
+
if (orig === '*') {
|
166
|
+
token = wide ? 'strong' : 'em';
|
167
|
+
} else {
|
168
|
+
token = wide ? 'string' : 'string-2';
|
169
|
+
}
|
170
|
+
|
171
|
+
setState(state, inline, {
|
172
|
+
ch: orig, // inline() has to know what to search for
|
173
|
+
wide: wide, // are we looking for `ch` or `chch`
|
174
|
+
prev: null, // terminator must not be preceeded with whitespace
|
175
|
+
token: token // I don't want to recompute this all the time
|
176
|
+
});
|
177
|
+
|
178
|
+
return token;
|
179
|
+
}
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
setNormal(state, ch);
|
184
|
+
return null;
|
185
|
+
}
|
186
|
+
|
187
|
+
function inline(stream, state) {
|
188
|
+
var ch = stream.next(),
|
189
|
+
token = state.ctx.token;
|
190
|
+
|
191
|
+
function finish(ch) {
|
192
|
+
state.ctx.prev = ch;
|
193
|
+
return token;
|
194
|
+
}
|
195
|
+
|
196
|
+
if (ch != state.ctx.ch) {
|
197
|
+
return finish(ch);
|
198
|
+
}
|
199
|
+
|
200
|
+
if (/\s/.test(state.ctx.prev)) {
|
201
|
+
return finish(ch);
|
202
|
+
}
|
203
|
+
|
204
|
+
if (state.ctx.wide) {
|
205
|
+
ch = stream.next();
|
206
|
+
|
207
|
+
if (ch != state.ctx.ch) {
|
208
|
+
return finish(ch);
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
if (!stream.eol() && !rePostInline.test(stream.peek())) {
|
213
|
+
if (state.ctx.wide) {
|
214
|
+
stream.backUp(1);
|
215
|
+
}
|
216
|
+
|
217
|
+
return finish(ch);
|
218
|
+
}
|
219
|
+
|
220
|
+
setState(state, normal);
|
221
|
+
setNormal(state, ch);
|
222
|
+
|
223
|
+
return token;
|
224
|
+
}
|
225
|
+
|
226
|
+
function directive(stream, state) {
|
227
|
+
var token = null;
|
228
|
+
|
229
|
+
if (stream.match(reDirective)) {
|
230
|
+
token = 'attribute';
|
231
|
+
} else if (stream.match(reHyperlink)) {
|
232
|
+
token = 'link';
|
233
|
+
} else if (stream.match(reFootnote)) {
|
234
|
+
token = 'quote';
|
235
|
+
} else if (stream.match(reCitation)) {
|
236
|
+
token = 'quote';
|
237
|
+
} else {
|
238
|
+
stream.eatSpace();
|
239
|
+
|
240
|
+
if (stream.eol()) {
|
241
|
+
setNormal(state, stream);
|
242
|
+
return null;
|
243
|
+
} else {
|
244
|
+
stream.skipToEnd();
|
245
|
+
setState(state, comment);
|
246
|
+
return 'comment';
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
// FIXME this is unreachable
|
251
|
+
setState(state, body, {start: true});
|
252
|
+
return token;
|
253
|
+
}
|
254
|
+
|
255
|
+
function body(stream, state) {
|
256
|
+
var token = 'body';
|
257
|
+
|
258
|
+
if (!state.ctx.start || stream.sol()) {
|
259
|
+
return block(stream, state, token);
|
260
|
+
}
|
261
|
+
|
262
|
+
stream.skipToEnd();
|
263
|
+
setCtx(state);
|
264
|
+
|
265
|
+
return token;
|
266
|
+
}
|
267
|
+
|
268
|
+
function comment(stream, state) {
|
269
|
+
return block(stream, state, 'comment');
|
270
|
+
}
|
271
|
+
|
272
|
+
function verbatim(stream, state) {
|
273
|
+
if (!verbatimMode) {
|
274
|
+
return block(stream, state, 'meta');
|
275
|
+
} else {
|
276
|
+
if (stream.sol()) {
|
277
|
+
if (!stream.eatSpace()) {
|
278
|
+
setNormal(state, stream);
|
279
|
+
}
|
280
|
+
|
281
|
+
return null;
|
282
|
+
}
|
283
|
+
|
284
|
+
return verbatimMode.token(stream, state.ctx.local);
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
function block(stream, state, token) {
|
289
|
+
if (stream.eol() || stream.eatSpace()) {
|
290
|
+
stream.skipToEnd();
|
291
|
+
return token;
|
292
|
+
} else {
|
293
|
+
setNormal(state, stream);
|
294
|
+
return null;
|
295
|
+
}
|
296
|
+
}
|
297
|
+
|
298
|
+
return {
|
299
|
+
startState: function() {
|
300
|
+
return {fn: normal, ctx: {}};
|
301
|
+
},
|
302
|
+
|
303
|
+
copyState: function(state) {
|
304
|
+
return {fn: state.fn, ctx: state.ctx};
|
305
|
+
},
|
306
|
+
|
307
|
+
token: function(stream, state) {
|
308
|
+
var token = state.fn(stream, state);
|
309
|
+
return token;
|
310
|
+
}
|
311
|
+
};
|
312
|
+
}, "python");
|
313
|
+
|
314
|
+
CodeMirror.defineMIME("text/x-rst", "rst");
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (c) 2011, Ubalo, Inc.
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
* Redistributions of source code must retain the above copyright
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
|
+
* Redistributions in binary form must reproduce the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
|
+
* Neither the name of the Ubalo, Inc. nor the names of its
|
12
|
+
contributors may be used to endorse or promote products derived
|
13
|
+
from this software without specific prior written permission.
|
14
|
+
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
|
19
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,173 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>CodeMirror: Ruby mode</title>
|
6
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
7
|
+
<script src="../../lib/codemirror.js"></script>
|
8
|
+
<script src="../../lib/util/matchbrackets.js"></script>
|
9
|
+
<script src="ruby.js"></script>
|
10
|
+
<style>
|
11
|
+
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
12
|
+
.cm-s-default span.cm-arrow { color: red; }
|
13
|
+
</style>
|
14
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
15
|
+
</head>
|
16
|
+
<body>
|
17
|
+
<h1>CodeMirror: Ruby mode</h1>
|
18
|
+
<form><textarea id="code" name="code">
|
19
|
+
# Code from http://sandbox.mc.edu/~bennet/ruby/code/poly_rb.html
|
20
|
+
#
|
21
|
+
# This program evaluates polynomials. It first asks for the coefficients
|
22
|
+
# of a polynomial, which must be entered on one line, highest-order first.
|
23
|
+
# It then requests values of x and will compute the value of the poly for
|
24
|
+
# each x. It will repeatly ask for x values, unless you the user enters
|
25
|
+
# a blank line. It that case, it will ask for another polynomial. If the
|
26
|
+
# user types quit for either input, the program immediately exits.
|
27
|
+
#
|
28
|
+
|
29
|
+
#
|
30
|
+
# Function to evaluate a polynomial at x. The polynomial is given
|
31
|
+
# as a list of coefficients, from the greatest to the least.
|
32
|
+
def polyval(x, coef)
|
33
|
+
sum = 0
|
34
|
+
coef = coef.clone # Don't want to destroy the original
|
35
|
+
while true
|
36
|
+
sum += coef.shift # Add and remove the next coef
|
37
|
+
break if coef.empty? # If no more, done entirely.
|
38
|
+
sum *= x # This happens the right number of times.
|
39
|
+
end
|
40
|
+
return sum
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# Function to read a line containing a list of integers and return
|
45
|
+
# them as an array of integers. If the string conversion fails, it
|
46
|
+
# throws TypeError. If the input line is the word 'quit', then it
|
47
|
+
# converts it to an end-of-file exception
|
48
|
+
def readints(prompt)
|
49
|
+
# Read a line
|
50
|
+
print prompt
|
51
|
+
line = readline.chomp
|
52
|
+
raise EOFError.new if line == 'quit' # You can also use a real EOF.
|
53
|
+
|
54
|
+
# Go through each item on the line, converting each one and adding it
|
55
|
+
# to retval.
|
56
|
+
retval = [ ]
|
57
|
+
for str in line.split(/\s+/)
|
58
|
+
if str =~ /^\-?\d+$/
|
59
|
+
retval.push(str.to_i)
|
60
|
+
else
|
61
|
+
raise TypeError.new
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
return retval
|
66
|
+
end
|
67
|
+
|
68
|
+
#
|
69
|
+
# Take a coeff and an exponent and return the string representation, ignoring
|
70
|
+
# the sign of the coefficient.
|
71
|
+
def term_to_str(coef, exp)
|
72
|
+
ret = ""
|
73
|
+
|
74
|
+
# Show coeff, unless it's 1 or at the right
|
75
|
+
coef = coef.abs
|
76
|
+
ret = coef.to_s unless coef == 1 && exp > 0
|
77
|
+
ret += "x" if exp > 0 # x if exponent not 0
|
78
|
+
ret += "^" + exp.to_s if exp > 1 # ^exponent, if > 1.
|
79
|
+
|
80
|
+
return ret
|
81
|
+
end
|
82
|
+
|
83
|
+
#
|
84
|
+
# Create a string of the polynomial in sort-of-readable form.
|
85
|
+
def polystr(p)
|
86
|
+
# Get the exponent of first coefficient, plus 1.
|
87
|
+
exp = p.length
|
88
|
+
|
89
|
+
# Assign exponents to each term, making pairs of coeff and exponent,
|
90
|
+
# Then get rid of the zero terms.
|
91
|
+
p = (p.map { |c| exp -= 1; [ c, exp ] }).select { |p| p[0] != 0 }
|
92
|
+
|
93
|
+
# If there's nothing left, it's a zero
|
94
|
+
return "0" if p.empty?
|
95
|
+
|
96
|
+
# *** Now p is a non-empty list of [ coef, exponent ] pairs. ***
|
97
|
+
|
98
|
+
# Convert the first term, preceded by a "-" if it's negative.
|
99
|
+
result = (if p[0][0] < 0 then "-" else "" end) + term_to_str(*p[0])
|
100
|
+
|
101
|
+
# Convert the rest of the terms, in each case adding the appropriate
|
102
|
+
# + or - separating them.
|
103
|
+
for term in p[1...p.length]
|
104
|
+
# Add the separator then the rep. of the term.
|
105
|
+
result += (if term[0] < 0 then " - " else " + " end) +
|
106
|
+
term_to_str(*term)
|
107
|
+
end
|
108
|
+
|
109
|
+
return result
|
110
|
+
end
|
111
|
+
|
112
|
+
#
|
113
|
+
# Run until some kind of endfile.
|
114
|
+
begin
|
115
|
+
# Repeat until an exception or quit gets us out.
|
116
|
+
while true
|
117
|
+
# Read a poly until it works. An EOF will except out of the
|
118
|
+
# program.
|
119
|
+
print "\n"
|
120
|
+
begin
|
121
|
+
poly = readints("Enter a polynomial coefficients: ")
|
122
|
+
rescue TypeError
|
123
|
+
print "Try again.\n"
|
124
|
+
retry
|
125
|
+
end
|
126
|
+
break if poly.empty?
|
127
|
+
|
128
|
+
# Read and evaluate x values until the user types a blank line.
|
129
|
+
# Again, an EOF will except out of the pgm.
|
130
|
+
while true
|
131
|
+
# Request an integer.
|
132
|
+
print "Enter x value or blank line: "
|
133
|
+
x = readline.chomp
|
134
|
+
break if x == ''
|
135
|
+
raise EOFError.new if x == 'quit'
|
136
|
+
|
137
|
+
# If it looks bad, let's try again.
|
138
|
+
if x !~ /^\-?\d+$/
|
139
|
+
print "That doesn't look like an integer. Please try again.\n"
|
140
|
+
next
|
141
|
+
end
|
142
|
+
|
143
|
+
# Convert to an integer and print the result.
|
144
|
+
x = x.to_i
|
145
|
+
print "p(x) = ", polystr(poly), "\n"
|
146
|
+
print "p(", x, ") = ", polyval(x, poly), "\n"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
rescue EOFError
|
150
|
+
print "\n=== EOF ===\n"
|
151
|
+
rescue Interrupt, SignalException
|
152
|
+
print "\n=== Interrupted ===\n"
|
153
|
+
else
|
154
|
+
print "--- Bye ---\n"
|
155
|
+
end
|
156
|
+
</textarea></form>
|
157
|
+
<script>
|
158
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
159
|
+
mode: "text/x-ruby",
|
160
|
+
tabMode: "indent",
|
161
|
+
matchBrackets: true,
|
162
|
+
indentUnit: 4
|
163
|
+
});
|
164
|
+
</script>
|
165
|
+
|
166
|
+
<p><strong>MIME types defined:</strong> <code>text/x-ruby</code>.</p>
|
167
|
+
|
168
|
+
<p>Development of the CodeMirror Ruby mode was kindly sponsored
|
169
|
+
by <a href="http://ubalo.com/">Ubalo</a>, who hold
|
170
|
+
the <a href="LICENSE">license</a>.</p>
|
171
|
+
|
172
|
+
</body>
|
173
|
+
</html>
|