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,344 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>CodeMirror: Markdown mode</title>
|
6
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
7
|
+
<script src="../../lib/codemirror.js"></script>
|
8
|
+
<script src="../../lib/util/continuelist.js"></script>
|
9
|
+
<script src="../xml/xml.js"></script>
|
10
|
+
<script src="markdown.js"></script>
|
11
|
+
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
12
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
<h1>CodeMirror: Markdown mode</h1>
|
16
|
+
|
17
|
+
<!-- source: http://daringfireball.net/projects/markdown/basics.text -->
|
18
|
+
<form><textarea id="code" name="code">
|
19
|
+
Markdown: Basics
|
20
|
+
================
|
21
|
+
|
22
|
+
<ul id="ProjectSubmenu">
|
23
|
+
<li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
|
24
|
+
<li><a class="selected" title="Markdown Basics">Basics</a></li>
|
25
|
+
<li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li>
|
26
|
+
<li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
|
27
|
+
<li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
|
28
|
+
</ul>
|
29
|
+
|
30
|
+
|
31
|
+
Getting the Gist of Markdown's Formatting Syntax
|
32
|
+
------------------------------------------------
|
33
|
+
|
34
|
+
This page offers a brief overview of what it's like to use Markdown.
|
35
|
+
The [syntax page] [s] provides complete, detailed documentation for
|
36
|
+
every feature, but Markdown should be very easy to pick up simply by
|
37
|
+
looking at a few examples of it in action. The examples on this page
|
38
|
+
are written in a before/after style, showing example syntax and the
|
39
|
+
HTML output produced by Markdown.
|
40
|
+
|
41
|
+
It's also helpful to simply try Markdown out; the [Dingus] [d] is a
|
42
|
+
web application that allows you type your own Markdown-formatted text
|
43
|
+
and translate it to XHTML.
|
44
|
+
|
45
|
+
**Note:** This document is itself written using Markdown; you
|
46
|
+
can [see the source for it by adding '.text' to the URL] [src].
|
47
|
+
|
48
|
+
[s]: /projects/markdown/syntax "Markdown Syntax"
|
49
|
+
[d]: /projects/markdown/dingus "Markdown Dingus"
|
50
|
+
[src]: /projects/markdown/basics.text
|
51
|
+
|
52
|
+
|
53
|
+
## Paragraphs, Headers, Blockquotes ##
|
54
|
+
|
55
|
+
A paragraph is simply one or more consecutive lines of text, separated
|
56
|
+
by one or more blank lines. (A blank line is any line that looks like
|
57
|
+
a blank line -- a line containing nothing but spaces or tabs is
|
58
|
+
considered blank.) Normal paragraphs should not be indented with
|
59
|
+
spaces or tabs.
|
60
|
+
|
61
|
+
Markdown offers two styles of headers: *Setext* and *atx*.
|
62
|
+
Setext-style headers for `<h1>` and `<h2>` are created by
|
63
|
+
"underlining" with equal signs (`=`) and hyphens (`-`), respectively.
|
64
|
+
To create an atx-style header, you put 1-6 hash marks (`#`) at the
|
65
|
+
beginning of the line -- the number of hashes equals the resulting
|
66
|
+
HTML header level.
|
67
|
+
|
68
|
+
Blockquotes are indicated using email-style '`>`' angle brackets.
|
69
|
+
|
70
|
+
Markdown:
|
71
|
+
|
72
|
+
A First Level Header
|
73
|
+
====================
|
74
|
+
|
75
|
+
A Second Level Header
|
76
|
+
---------------------
|
77
|
+
|
78
|
+
Now is the time for all good men to come to
|
79
|
+
the aid of their country. This is just a
|
80
|
+
regular paragraph.
|
81
|
+
|
82
|
+
The quick brown fox jumped over the lazy
|
83
|
+
dog's back.
|
84
|
+
|
85
|
+
### Header 3
|
86
|
+
|
87
|
+
> This is a blockquote.
|
88
|
+
>
|
89
|
+
> This is the second paragraph in the blockquote.
|
90
|
+
>
|
91
|
+
> ## This is an H2 in a blockquote
|
92
|
+
|
93
|
+
|
94
|
+
Output:
|
95
|
+
|
96
|
+
<h1>A First Level Header</h1>
|
97
|
+
|
98
|
+
<h2>A Second Level Header</h2>
|
99
|
+
|
100
|
+
<p>Now is the time for all good men to come to
|
101
|
+
the aid of their country. This is just a
|
102
|
+
regular paragraph.</p>
|
103
|
+
|
104
|
+
<p>The quick brown fox jumped over the lazy
|
105
|
+
dog's back.</p>
|
106
|
+
|
107
|
+
<h3>Header 3</h3>
|
108
|
+
|
109
|
+
<blockquote>
|
110
|
+
<p>This is a blockquote.</p>
|
111
|
+
|
112
|
+
<p>This is the second paragraph in the blockquote.</p>
|
113
|
+
|
114
|
+
<h2>This is an H2 in a blockquote</h2>
|
115
|
+
</blockquote>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
### Phrase Emphasis ###
|
120
|
+
|
121
|
+
Markdown uses asterisks and underscores to indicate spans of emphasis.
|
122
|
+
|
123
|
+
Markdown:
|
124
|
+
|
125
|
+
Some of these words *are emphasized*.
|
126
|
+
Some of these words _are emphasized also_.
|
127
|
+
|
128
|
+
Use two asterisks for **strong emphasis**.
|
129
|
+
Or, if you prefer, __use two underscores instead__.
|
130
|
+
|
131
|
+
Output:
|
132
|
+
|
133
|
+
<p>Some of these words <em>are emphasized</em>.
|
134
|
+
Some of these words <em>are emphasized also</em>.</p>
|
135
|
+
|
136
|
+
<p>Use two asterisks for <strong>strong emphasis</strong>.
|
137
|
+
Or, if you prefer, <strong>use two underscores instead</strong>.</p>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
## Lists ##
|
142
|
+
|
143
|
+
Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
|
144
|
+
`+`, and `-`) as list markers. These three markers are
|
145
|
+
interchangable; this:
|
146
|
+
|
147
|
+
* Candy.
|
148
|
+
* Gum.
|
149
|
+
* Booze.
|
150
|
+
|
151
|
+
this:
|
152
|
+
|
153
|
+
+ Candy.
|
154
|
+
+ Gum.
|
155
|
+
+ Booze.
|
156
|
+
|
157
|
+
and this:
|
158
|
+
|
159
|
+
- Candy.
|
160
|
+
- Gum.
|
161
|
+
- Booze.
|
162
|
+
|
163
|
+
all produce the same output:
|
164
|
+
|
165
|
+
<ul>
|
166
|
+
<li>Candy.</li>
|
167
|
+
<li>Gum.</li>
|
168
|
+
<li>Booze.</li>
|
169
|
+
</ul>
|
170
|
+
|
171
|
+
Ordered (numbered) lists use regular numbers, followed by periods, as
|
172
|
+
list markers:
|
173
|
+
|
174
|
+
1. Red
|
175
|
+
2. Green
|
176
|
+
3. Blue
|
177
|
+
|
178
|
+
Output:
|
179
|
+
|
180
|
+
<ol>
|
181
|
+
<li>Red</li>
|
182
|
+
<li>Green</li>
|
183
|
+
<li>Blue</li>
|
184
|
+
</ol>
|
185
|
+
|
186
|
+
If you put blank lines between items, you'll get `<p>` tags for the
|
187
|
+
list item text. You can create multi-paragraph list items by indenting
|
188
|
+
the paragraphs by 4 spaces or 1 tab:
|
189
|
+
|
190
|
+
* A list item.
|
191
|
+
|
192
|
+
With multiple paragraphs.
|
193
|
+
|
194
|
+
* Another item in the list.
|
195
|
+
|
196
|
+
Output:
|
197
|
+
|
198
|
+
<ul>
|
199
|
+
<li><p>A list item.</p>
|
200
|
+
<p>With multiple paragraphs.</p></li>
|
201
|
+
<li><p>Another item in the list.</p></li>
|
202
|
+
</ul>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
### Links ###
|
207
|
+
|
208
|
+
Markdown supports two styles for creating links: *inline* and
|
209
|
+
*reference*. With both styles, you use square brackets to delimit the
|
210
|
+
text you want to turn into a link.
|
211
|
+
|
212
|
+
Inline-style links use parentheses immediately after the link text.
|
213
|
+
For example:
|
214
|
+
|
215
|
+
This is an [example link](http://example.com/).
|
216
|
+
|
217
|
+
Output:
|
218
|
+
|
219
|
+
<p>This is an <a href="http://example.com/">
|
220
|
+
example link</a>.</p>
|
221
|
+
|
222
|
+
Optionally, you may include a title attribute in the parentheses:
|
223
|
+
|
224
|
+
This is an [example link](http://example.com/ "With a Title").
|
225
|
+
|
226
|
+
Output:
|
227
|
+
|
228
|
+
<p>This is an <a href="http://example.com/" title="With a Title">
|
229
|
+
example link</a>.</p>
|
230
|
+
|
231
|
+
Reference-style links allow you to refer to your links by names, which
|
232
|
+
you define elsewhere in your document:
|
233
|
+
|
234
|
+
I get 10 times more traffic from [Google][1] than from
|
235
|
+
[Yahoo][2] or [MSN][3].
|
236
|
+
|
237
|
+
[1]: http://google.com/ "Google"
|
238
|
+
[2]: http://search.yahoo.com/ "Yahoo Search"
|
239
|
+
[3]: http://search.msn.com/ "MSN Search"
|
240
|
+
|
241
|
+
Output:
|
242
|
+
|
243
|
+
<p>I get 10 times more traffic from <a href="http://google.com/"
|
244
|
+
title="Google">Google</a> than from <a href="http://search.yahoo.com/"
|
245
|
+
title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
|
246
|
+
title="MSN Search">MSN</a>.</p>
|
247
|
+
|
248
|
+
The title attribute is optional. Link names may contain letters,
|
249
|
+
numbers and spaces, but are *not* case sensitive:
|
250
|
+
|
251
|
+
I start my morning with a cup of coffee and
|
252
|
+
[The New York Times][NY Times].
|
253
|
+
|
254
|
+
[ny times]: http://www.nytimes.com/
|
255
|
+
|
256
|
+
Output:
|
257
|
+
|
258
|
+
<p>I start my morning with a cup of coffee and
|
259
|
+
<a href="http://www.nytimes.com/">The New York Times</a>.</p>
|
260
|
+
|
261
|
+
|
262
|
+
### Images ###
|
263
|
+
|
264
|
+
Image syntax is very much like link syntax.
|
265
|
+
|
266
|
+
Inline (titles are optional):
|
267
|
+
|
268
|
+
![alt text](/path/to/img.jpg "Title")
|
269
|
+
|
270
|
+
Reference-style:
|
271
|
+
|
272
|
+
![alt text][id]
|
273
|
+
|
274
|
+
[id]: /path/to/img.jpg "Title"
|
275
|
+
|
276
|
+
Both of the above examples produce the same output:
|
277
|
+
|
278
|
+
<img src="/path/to/img.jpg" alt="alt text" title="Title" />
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
### Code ###
|
283
|
+
|
284
|
+
In a regular paragraph, you can create code span by wrapping text in
|
285
|
+
backtick quotes. Any ampersands (`&`) and angle brackets (`<` or
|
286
|
+
`>`) will automatically be translated into HTML entities. This makes
|
287
|
+
it easy to use Markdown to write about HTML example code:
|
288
|
+
|
289
|
+
I strongly recommend against using any `<blink>` tags.
|
290
|
+
|
291
|
+
I wish SmartyPants used named entities like `&mdash;`
|
292
|
+
instead of decimal-encoded entites like `&#8212;`.
|
293
|
+
|
294
|
+
Output:
|
295
|
+
|
296
|
+
<p>I strongly recommend against using any
|
297
|
+
<code>&lt;blink&gt;</code> tags.</p>
|
298
|
+
|
299
|
+
<p>I wish SmartyPants used named entities like
|
300
|
+
<code>&amp;mdash;</code> instead of decimal-encoded
|
301
|
+
entites like <code>&amp;#8212;</code>.</p>
|
302
|
+
|
303
|
+
|
304
|
+
To specify an entire block of pre-formatted code, indent every line of
|
305
|
+
the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`,
|
306
|
+
and `>` characters will be escaped automatically.
|
307
|
+
|
308
|
+
Markdown:
|
309
|
+
|
310
|
+
If you want your page to validate under XHTML 1.0 Strict,
|
311
|
+
you've got to put paragraph tags in your blockquotes:
|
312
|
+
|
313
|
+
<blockquote>
|
314
|
+
<p>For example.</p>
|
315
|
+
</blockquote>
|
316
|
+
|
317
|
+
Output:
|
318
|
+
|
319
|
+
<p>If you want your page to validate under XHTML 1.0 Strict,
|
320
|
+
you've got to put paragraph tags in your blockquotes:</p>
|
321
|
+
|
322
|
+
<pre><code>&lt;blockquote&gt;
|
323
|
+
&lt;p&gt;For example.&lt;/p&gt;
|
324
|
+
&lt;/blockquote&gt;
|
325
|
+
</code></pre>
|
326
|
+
</textarea></form>
|
327
|
+
|
328
|
+
<script>
|
329
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
330
|
+
mode: 'markdown',
|
331
|
+
lineNumbers: true,
|
332
|
+
theme: "default",
|
333
|
+
extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList"}
|
334
|
+
});
|
335
|
+
</script>
|
336
|
+
|
337
|
+
<p>Optionally depends on the XML mode for properly highlighted inline XML blocks.</p>
|
338
|
+
|
339
|
+
<p><strong>MIME types defined:</strong> <code>text/x-markdown</code>.</p>
|
340
|
+
|
341
|
+
<p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#markdown_*">normal</a>, <a href="../../test/index.html#verbose,markdown_*">verbose</a>.</p>
|
342
|
+
|
343
|
+
</body>
|
344
|
+
</html>
|
@@ -0,0 +1,474 @@
|
|
1
|
+
CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
2
|
+
|
3
|
+
var htmlFound = CodeMirror.mimeModes.hasOwnProperty("text/html");
|
4
|
+
var htmlMode = CodeMirror.getMode(cmCfg, htmlFound ? "text/html" : "text/plain");
|
5
|
+
var aliases = {
|
6
|
+
html: "htmlmixed",
|
7
|
+
js: "javascript",
|
8
|
+
json: "application/json",
|
9
|
+
c: "text/x-csrc",
|
10
|
+
"c++": "text/x-c++src",
|
11
|
+
java: "text/x-java",
|
12
|
+
csharp: "text/x-csharp",
|
13
|
+
"c#": "text/x-csharp"
|
14
|
+
};
|
15
|
+
|
16
|
+
var getMode = (function () {
|
17
|
+
var i, modes = {}, mimes = {}, mime;
|
18
|
+
|
19
|
+
var list = [];
|
20
|
+
for (var m in CodeMirror.modes)
|
21
|
+
if (CodeMirror.modes.propertyIsEnumerable(m)) list.push(m);
|
22
|
+
for (i = 0; i < list.length; i++) {
|
23
|
+
modes[list[i]] = list[i];
|
24
|
+
}
|
25
|
+
var mimesList = [];
|
26
|
+
for (var m in CodeMirror.mimeModes)
|
27
|
+
if (CodeMirror.mimeModes.propertyIsEnumerable(m))
|
28
|
+
mimesList.push({mime: m, mode: CodeMirror.mimeModes[m]});
|
29
|
+
for (i = 0; i < mimesList.length; i++) {
|
30
|
+
mime = mimesList[i].mime;
|
31
|
+
mimes[mime] = mimesList[i].mime;
|
32
|
+
}
|
33
|
+
|
34
|
+
for (var a in aliases) {
|
35
|
+
if (aliases[a] in modes || aliases[a] in mimes)
|
36
|
+
modes[a] = aliases[a];
|
37
|
+
}
|
38
|
+
|
39
|
+
return function (lang) {
|
40
|
+
return modes[lang] ? CodeMirror.getMode(cmCfg, modes[lang]) : null;
|
41
|
+
};
|
42
|
+
}());
|
43
|
+
|
44
|
+
// Should underscores in words open/close em/strong?
|
45
|
+
if (modeCfg.underscoresBreakWords === undefined)
|
46
|
+
modeCfg.underscoresBreakWords = true;
|
47
|
+
|
48
|
+
// Turn on fenced code blocks? ("```" to start/end)
|
49
|
+
if (modeCfg.fencedCodeBlocks === undefined) modeCfg.fencedCodeBlocks = false;
|
50
|
+
|
51
|
+
var codeDepth = 0;
|
52
|
+
var prevLineHasContent = false
|
53
|
+
, thisLineHasContent = false;
|
54
|
+
|
55
|
+
var header = 'header'
|
56
|
+
, code = 'comment'
|
57
|
+
, quote = 'quote'
|
58
|
+
, list = 'string'
|
59
|
+
, hr = 'hr'
|
60
|
+
, image = 'tag'
|
61
|
+
, linkinline = 'link'
|
62
|
+
, linkemail = 'link'
|
63
|
+
, linktext = 'link'
|
64
|
+
, linkhref = 'string'
|
65
|
+
, em = 'em'
|
66
|
+
, strong = 'strong'
|
67
|
+
, emstrong = 'emstrong';
|
68
|
+
|
69
|
+
var hrRE = /^([*\-=_])(?:\s*\1){2,}\s*$/
|
70
|
+
, ulRE = /^[*\-+]\s+/
|
71
|
+
, olRE = /^[0-9]+\.\s+/
|
72
|
+
, headerRE = /^(?:\={1,}|-{1,})$/
|
73
|
+
, textRE = /^[^!\[\]*_\\<>` "'(]+/;
|
74
|
+
|
75
|
+
function switchInline(stream, state, f) {
|
76
|
+
state.f = state.inline = f;
|
77
|
+
return f(stream, state);
|
78
|
+
}
|
79
|
+
|
80
|
+
function switchBlock(stream, state, f) {
|
81
|
+
state.f = state.block = f;
|
82
|
+
return f(stream, state);
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
// Blocks
|
87
|
+
|
88
|
+
function blankLine(state) {
|
89
|
+
// Reset linkTitle state
|
90
|
+
state.linkTitle = false;
|
91
|
+
// Reset EM state
|
92
|
+
state.em = false;
|
93
|
+
// Reset STRONG state
|
94
|
+
state.strong = false;
|
95
|
+
// Reset state.quote
|
96
|
+
state.quote = false;
|
97
|
+
if (!htmlFound && state.f == htmlBlock) {
|
98
|
+
state.f = inlineNormal;
|
99
|
+
state.block = blockNormal;
|
100
|
+
}
|
101
|
+
return null;
|
102
|
+
}
|
103
|
+
|
104
|
+
function blockNormal(stream, state) {
|
105
|
+
|
106
|
+
if (state.list !== false && state.indentationDiff >= 0) { // Continued list
|
107
|
+
if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block
|
108
|
+
state.indentation -= state.indentationDiff;
|
109
|
+
}
|
110
|
+
state.list = null;
|
111
|
+
} else { // No longer a list
|
112
|
+
state.list = false;
|
113
|
+
}
|
114
|
+
|
115
|
+
if (state.indentationDiff >= 4) {
|
116
|
+
state.indentation -= 4;
|
117
|
+
stream.skipToEnd();
|
118
|
+
return code;
|
119
|
+
} else if (stream.eatSpace()) {
|
120
|
+
return null;
|
121
|
+
} else if (stream.peek() === '#' || (prevLineHasContent && stream.match(headerRE)) ) {
|
122
|
+
state.header = true;
|
123
|
+
} else if (stream.eat('>')) {
|
124
|
+
state.indentation++;
|
125
|
+
state.quote = true;
|
126
|
+
} else if (stream.peek() === '[') {
|
127
|
+
return switchInline(stream, state, footnoteLink);
|
128
|
+
} else if (stream.match(hrRE, true)) {
|
129
|
+
return hr;
|
130
|
+
} else if (stream.match(ulRE, true) || stream.match(olRE, true)) {
|
131
|
+
state.indentation += 4;
|
132
|
+
state.list = true;
|
133
|
+
} else if (modeCfg.fencedCodeBlocks && stream.match(/^```([\w+#]*)/, true)) {
|
134
|
+
// try switching mode
|
135
|
+
state.localMode = getMode(RegExp.$1);
|
136
|
+
if (state.localMode) state.localState = state.localMode.startState();
|
137
|
+
switchBlock(stream, state, local);
|
138
|
+
return code;
|
139
|
+
}
|
140
|
+
|
141
|
+
return switchInline(stream, state, state.inline);
|
142
|
+
}
|
143
|
+
|
144
|
+
function htmlBlock(stream, state) {
|
145
|
+
var style = htmlMode.token(stream, state.htmlState);
|
146
|
+
if (htmlFound && style === 'tag' && state.htmlState.type !== 'openTag' && !state.htmlState.context) {
|
147
|
+
state.f = inlineNormal;
|
148
|
+
state.block = blockNormal;
|
149
|
+
}
|
150
|
+
if (state.md_inside && stream.current().indexOf(">")!=-1) {
|
151
|
+
state.f = inlineNormal;
|
152
|
+
state.block = blockNormal;
|
153
|
+
state.htmlState.context = undefined;
|
154
|
+
}
|
155
|
+
return style;
|
156
|
+
}
|
157
|
+
|
158
|
+
function local(stream, state) {
|
159
|
+
if (stream.sol() && stream.match(/^```/, true)) {
|
160
|
+
state.localMode = state.localState = null;
|
161
|
+
state.f = inlineNormal;
|
162
|
+
state.block = blockNormal;
|
163
|
+
return code;
|
164
|
+
} else if (state.localMode) {
|
165
|
+
return state.localMode.token(stream, state.localState);
|
166
|
+
} else {
|
167
|
+
stream.skipToEnd();
|
168
|
+
return code;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
// Inline
|
173
|
+
function getType(state) {
|
174
|
+
var styles = [];
|
175
|
+
|
176
|
+
if (state.strong) { styles.push(state.em ? emstrong : strong); }
|
177
|
+
else if (state.em) { styles.push(em); }
|
178
|
+
|
179
|
+
if (state.linkText) { styles.push(linktext); }
|
180
|
+
|
181
|
+
if (state.code) { styles.push(code); }
|
182
|
+
|
183
|
+
if (state.header) { styles.push(header); }
|
184
|
+
if (state.quote) { styles.push(quote); }
|
185
|
+
if (state.list !== false) { styles.push(list); }
|
186
|
+
|
187
|
+
return styles.length ? styles.join(' ') : null;
|
188
|
+
}
|
189
|
+
|
190
|
+
function handleText(stream, state) {
|
191
|
+
if (stream.match(textRE, true)) {
|
192
|
+
return getType(state);
|
193
|
+
}
|
194
|
+
return undefined;
|
195
|
+
}
|
196
|
+
|
197
|
+
function inlineNormal(stream, state) {
|
198
|
+
var style = state.text(stream, state);
|
199
|
+
if (typeof style !== 'undefined')
|
200
|
+
return style;
|
201
|
+
|
202
|
+
if (state.list) { // List marker (*, +, -, 1., etc)
|
203
|
+
state.list = null;
|
204
|
+
return list;
|
205
|
+
}
|
206
|
+
|
207
|
+
var ch = stream.next();
|
208
|
+
|
209
|
+
if (ch === '\\') {
|
210
|
+
stream.next();
|
211
|
+
return getType(state);
|
212
|
+
}
|
213
|
+
|
214
|
+
// Matches link titles present on next line
|
215
|
+
if (state.linkTitle) {
|
216
|
+
state.linkTitle = false;
|
217
|
+
var matchCh = ch;
|
218
|
+
if (ch === '(') {
|
219
|
+
matchCh = ')';
|
220
|
+
}
|
221
|
+
matchCh = (matchCh+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
|
222
|
+
var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
|
223
|
+
if (stream.match(new RegExp(regex), true)) {
|
224
|
+
return linkhref;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
// If this block is changed, it may need to be updated in GFM mode
|
229
|
+
if (ch === '`') {
|
230
|
+
var t = getType(state);
|
231
|
+
var before = stream.pos;
|
232
|
+
stream.eatWhile('`');
|
233
|
+
var difference = 1 + stream.pos - before;
|
234
|
+
if (!state.code) {
|
235
|
+
codeDepth = difference;
|
236
|
+
state.code = true;
|
237
|
+
return getType(state);
|
238
|
+
} else {
|
239
|
+
if (difference === codeDepth) { // Must be exact
|
240
|
+
state.code = false;
|
241
|
+
return t;
|
242
|
+
}
|
243
|
+
return getType(state);
|
244
|
+
}
|
245
|
+
} else if (state.code) {
|
246
|
+
return getType(state);
|
247
|
+
}
|
248
|
+
|
249
|
+
if (ch === '!' && stream.match(/\[.*\] ?(?:\(|\[)/, false)) {
|
250
|
+
stream.match(/\[.*\]/);
|
251
|
+
state.inline = state.f = linkHref;
|
252
|
+
return image;
|
253
|
+
}
|
254
|
+
|
255
|
+
if (ch === '[' && stream.match(/.*\](\(| ?\[)/, false)) {
|
256
|
+
state.linkText = true;
|
257
|
+
return getType(state);
|
258
|
+
}
|
259
|
+
|
260
|
+
if (ch === ']' && state.linkText) {
|
261
|
+
var type = getType(state);
|
262
|
+
state.linkText = false;
|
263
|
+
state.inline = state.f = linkHref;
|
264
|
+
return type;
|
265
|
+
}
|
266
|
+
|
267
|
+
if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, true)) {
|
268
|
+
return switchInline(stream, state, inlineElement(linkinline, '>'));
|
269
|
+
}
|
270
|
+
|
271
|
+
if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, true)) {
|
272
|
+
return switchInline(stream, state, inlineElement(linkemail, '>'));
|
273
|
+
}
|
274
|
+
|
275
|
+
if (ch === '<' && stream.match(/^\w/, false)) {
|
276
|
+
if (stream.string.indexOf(">")!=-1) {
|
277
|
+
var atts = stream.string.substring(1,stream.string.indexOf(">"));
|
278
|
+
if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) {
|
279
|
+
state.md_inside = true;
|
280
|
+
}
|
281
|
+
}
|
282
|
+
stream.backUp(1);
|
283
|
+
return switchBlock(stream, state, htmlBlock);
|
284
|
+
}
|
285
|
+
|
286
|
+
if (ch === '<' && stream.match(/^\/\w*?>/)) {
|
287
|
+
state.md_inside = false;
|
288
|
+
return "tag";
|
289
|
+
}
|
290
|
+
|
291
|
+
var ignoreUnderscore = false;
|
292
|
+
if (!modeCfg.underscoresBreakWords) {
|
293
|
+
if (ch === '_' && stream.peek() !== '_' && stream.match(/(\w)/, false)) {
|
294
|
+
var prevPos = stream.pos - 2;
|
295
|
+
if (prevPos >= 0) {
|
296
|
+
var prevCh = stream.string.charAt(prevPos);
|
297
|
+
if (prevCh !== '_' && prevCh.match(/(\w)/, false)) {
|
298
|
+
ignoreUnderscore = true;
|
299
|
+
}
|
300
|
+
}
|
301
|
+
}
|
302
|
+
}
|
303
|
+
var t = getType(state);
|
304
|
+
if (ch === '*' || (ch === '_' && !ignoreUnderscore)) {
|
305
|
+
if (state.strong === ch && stream.eat(ch)) { // Remove STRONG
|
306
|
+
state.strong = false;
|
307
|
+
return t;
|
308
|
+
} else if (!state.strong && stream.eat(ch)) { // Add STRONG
|
309
|
+
state.strong = ch;
|
310
|
+
return getType(state);
|
311
|
+
} else if (state.em === ch) { // Remove EM
|
312
|
+
state.em = false;
|
313
|
+
return t;
|
314
|
+
} else if (!state.em) { // Add EM
|
315
|
+
state.em = ch;
|
316
|
+
return getType(state);
|
317
|
+
}
|
318
|
+
} else if (ch === ' ') {
|
319
|
+
if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
|
320
|
+
if (stream.peek() === ' ') { // Surrounded by spaces, ignore
|
321
|
+
return getType(state);
|
322
|
+
} else { // Not surrounded by spaces, back up pointer
|
323
|
+
stream.backUp(1);
|
324
|
+
}
|
325
|
+
}
|
326
|
+
}
|
327
|
+
|
328
|
+
return getType(state);
|
329
|
+
}
|
330
|
+
|
331
|
+
function linkHref(stream, state) {
|
332
|
+
// Check if space, and return NULL if so (to avoid marking the space)
|
333
|
+
if(stream.eatSpace()){
|
334
|
+
return null;
|
335
|
+
}
|
336
|
+
var ch = stream.next();
|
337
|
+
if (ch === '(' || ch === '[') {
|
338
|
+
return switchInline(stream, state, inlineElement(linkhref, ch === '(' ? ')' : ']'));
|
339
|
+
}
|
340
|
+
return 'error';
|
341
|
+
}
|
342
|
+
|
343
|
+
function footnoteLink(stream, state) {
|
344
|
+
if (stream.match(/^[^\]]*\]:/, true)) {
|
345
|
+
state.f = footnoteUrl;
|
346
|
+
return linktext;
|
347
|
+
}
|
348
|
+
return switchInline(stream, state, inlineNormal);
|
349
|
+
}
|
350
|
+
|
351
|
+
function footnoteUrl(stream, state) {
|
352
|
+
// Check if space, and return NULL if so (to avoid marking the space)
|
353
|
+
if(stream.eatSpace()){
|
354
|
+
return null;
|
355
|
+
}
|
356
|
+
// Match URL
|
357
|
+
stream.match(/^[^\s]+/, true);
|
358
|
+
// Check for link title
|
359
|
+
if (stream.peek() === undefined) { // End of line, set flag to check next line
|
360
|
+
state.linkTitle = true;
|
361
|
+
} else { // More content on line, check if link title
|
362
|
+
stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
|
363
|
+
}
|
364
|
+
state.f = state.inline = inlineNormal;
|
365
|
+
return linkhref;
|
366
|
+
}
|
367
|
+
|
368
|
+
var savedInlineRE = [];
|
369
|
+
function inlineRE(endChar) {
|
370
|
+
if (!savedInlineRE[endChar]) {
|
371
|
+
// Escape endChar for RegExp (taken from http://stackoverflow.com/a/494122/526741)
|
372
|
+
endChar = (endChar+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
|
373
|
+
// Match any non-endChar, escaped character, as well as the closing
|
374
|
+
// endChar.
|
375
|
+
savedInlineRE[endChar] = new RegExp('^(?:[^\\\\]|\\\\.)*?(' + endChar + ')');
|
376
|
+
}
|
377
|
+
return savedInlineRE[endChar];
|
378
|
+
}
|
379
|
+
|
380
|
+
function inlineElement(type, endChar, next) {
|
381
|
+
next = next || inlineNormal;
|
382
|
+
return function(stream, state) {
|
383
|
+
stream.match(inlineRE(endChar));
|
384
|
+
state.inline = state.f = next;
|
385
|
+
return type;
|
386
|
+
};
|
387
|
+
}
|
388
|
+
|
389
|
+
return {
|
390
|
+
startState: function() {
|
391
|
+
prevLineHasContent = false;
|
392
|
+
thisLineHasContent = false;
|
393
|
+
return {
|
394
|
+
f: blockNormal,
|
395
|
+
|
396
|
+
block: blockNormal,
|
397
|
+
htmlState: CodeMirror.startState(htmlMode),
|
398
|
+
indentation: 0,
|
399
|
+
|
400
|
+
inline: inlineNormal,
|
401
|
+
text: handleText,
|
402
|
+
|
403
|
+
linkText: false,
|
404
|
+
linkTitle: false,
|
405
|
+
em: false,
|
406
|
+
strong: false,
|
407
|
+
header: false,
|
408
|
+
list: false,
|
409
|
+
quote: false
|
410
|
+
};
|
411
|
+
},
|
412
|
+
|
413
|
+
copyState: function(s) {
|
414
|
+
return {
|
415
|
+
f: s.f,
|
416
|
+
|
417
|
+
block: s.block,
|
418
|
+
htmlState: CodeMirror.copyState(htmlMode, s.htmlState),
|
419
|
+
indentation: s.indentation,
|
420
|
+
|
421
|
+
localMode: s.localMode,
|
422
|
+
localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,
|
423
|
+
|
424
|
+
inline: s.inline,
|
425
|
+
text: s.text,
|
426
|
+
linkTitle: s.linkTitle,
|
427
|
+
em: s.em,
|
428
|
+
strong: s.strong,
|
429
|
+
header: s.header,
|
430
|
+
list: s.list,
|
431
|
+
quote: s.quote,
|
432
|
+
md_inside: s.md_inside
|
433
|
+
};
|
434
|
+
},
|
435
|
+
|
436
|
+
token: function(stream, state) {
|
437
|
+
if (stream.sol()) {
|
438
|
+
if (stream.match(/^\s*$/, true)) {
|
439
|
+
prevLineHasContent = false;
|
440
|
+
return blankLine(state);
|
441
|
+
} else {
|
442
|
+
if(thisLineHasContent){
|
443
|
+
prevLineHasContent = true;
|
444
|
+
thisLineHasContent = false;
|
445
|
+
}
|
446
|
+
thisLineHasContent = true;
|
447
|
+
}
|
448
|
+
|
449
|
+
// Reset state.header
|
450
|
+
state.header = false;
|
451
|
+
|
452
|
+
// Reset state.code
|
453
|
+
state.code = false;
|
454
|
+
|
455
|
+
state.f = state.block;
|
456
|
+
var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, ' ').length;
|
457
|
+
var difference = Math.floor((indentation - state.indentation) / 4) * 4;
|
458
|
+
if (difference > 4) difference = 4;
|
459
|
+
indentation = state.indentation + difference;
|
460
|
+
state.indentationDiff = indentation - state.indentation;
|
461
|
+
state.indentation = indentation;
|
462
|
+
if (indentation > 0) { return null; }
|
463
|
+
}
|
464
|
+
return state.f(stream, state);
|
465
|
+
},
|
466
|
+
|
467
|
+
blankLine: blankLine,
|
468
|
+
|
469
|
+
getType: getType
|
470
|
+
};
|
471
|
+
|
472
|
+
}, "xml");
|
473
|
+
|
474
|
+
CodeMirror.defineMIME("text/x-markdown", "markdown");
|