swagr 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (359) hide show
  1. data/bin/swagr +15 -0
  2. data/examples/examples01/app.rb +6 -2
  3. data/examples/examples01/coffee/data_port.coffee +2 -0
  4. data/examples/examples01/static/css/codemirror.css +1247 -0
  5. data/examples/examples01/static/js/codemirror-compressed-3-0.js +5 -0
  6. data/examples/examples01/static/js/codemirror/keymap/emacs.js +30 -0
  7. data/examples/examples01/static/js/codemirror/keymap/vim.js +2298 -0
  8. data/examples/examples01/static/js/codemirror/lib/codemirror.css +239 -0
  9. data/examples/examples01/static/js/codemirror/lib/codemirror.js +4553 -0
  10. data/examples/examples01/static/js/codemirror/lib/util/closetag.js +85 -0
  11. data/examples/examples01/static/js/codemirror/lib/util/colorize.js +29 -0
  12. data/examples/examples01/static/js/codemirror/lib/util/continuecomment.js +36 -0
  13. data/examples/examples01/static/js/codemirror/lib/util/continuelist.js +28 -0
  14. data/examples/examples01/static/js/codemirror/lib/util/dialog.css +32 -0
  15. data/examples/examples01/static/js/codemirror/lib/util/dialog.js +75 -0
  16. data/examples/examples01/static/js/codemirror/lib/util/foldcode.js +182 -0
  17. data/examples/examples01/static/js/codemirror/lib/util/formatting.js +108 -0
  18. data/examples/examples01/static/js/codemirror/lib/util/javascript-hint.js +137 -0
  19. data/examples/examples01/static/js/codemirror/lib/util/loadmode.js +51 -0
  20. data/examples/examples01/static/js/codemirror/lib/util/match-highlighter.js +46 -0
  21. data/examples/examples01/static/js/codemirror/lib/util/matchbrackets.js +63 -0
  22. data/examples/examples01/static/js/codemirror/lib/util/multiplex.js +95 -0
  23. data/examples/examples01/static/js/codemirror/lib/util/overlay.js +59 -0
  24. data/examples/examples01/static/js/codemirror/lib/util/pig-hint.js +117 -0
  25. data/examples/examples01/static/js/codemirror/lib/util/runmode-standalone.js +90 -0
  26. data/examples/examples01/static/js/codemirror/lib/util/runmode.js +52 -0
  27. data/examples/examples01/static/js/codemirror/lib/util/search.js +119 -0
  28. data/examples/examples01/static/js/codemirror/lib/util/searchcursor.js +119 -0
  29. data/examples/examples01/static/js/codemirror/lib/util/simple-hint.css +16 -0
  30. data/examples/examples01/static/js/codemirror/lib/util/simple-hint.js +102 -0
  31. data/examples/examples01/static/js/codemirror/lib/util/xml-hint.js +131 -0
  32. data/examples/examples01/static/js/codemirror/mode/clike/clike.js +300 -0
  33. data/examples/examples01/static/js/codemirror/mode/clike/index.html +103 -0
  34. data/examples/examples01/static/js/codemirror/mode/clike/scala.html +767 -0
  35. data/examples/examples01/static/js/codemirror/mode/clojure/clojure.js +206 -0
  36. data/examples/examples01/static/js/codemirror/mode/clojure/index.html +67 -0
  37. data/examples/examples01/static/js/codemirror/mode/coffeescript/LICENSE +22 -0
  38. data/examples/examples01/static/js/codemirror/mode/coffeescript/coffeescript.js +346 -0
  39. data/examples/examples01/static/js/codemirror/mode/coffeescript/index.html +728 -0
  40. data/examples/examples01/static/js/codemirror/mode/commonlisp/commonlisp.js +101 -0
  41. data/examples/examples01/static/js/codemirror/mode/commonlisp/index.html +165 -0
  42. data/examples/examples01/static/js/codemirror/mode/css/css.js +465 -0
  43. data/examples/examples01/static/js/codemirror/mode/css/index.html +58 -0
  44. data/examples/examples01/static/js/codemirror/mode/css/test.js +501 -0
  45. data/examples/examples01/static/js/codemirror/mode/diff/diff.js +32 -0
  46. data/examples/examples01/static/js/codemirror/mode/diff/index.html +105 -0
  47. data/examples/examples01/static/js/codemirror/mode/ecl/ecl.js +192 -0
  48. data/examples/examples01/static/js/codemirror/mode/ecl/index.html +39 -0
  49. data/examples/examples01/static/js/codemirror/mode/erlang/erlang.js +463 -0
  50. data/examples/examples01/static/js/codemirror/mode/erlang/index.html +64 -0
  51. data/examples/examples01/static/js/codemirror/mode/gfm/gfm.js +94 -0
  52. data/examples/examples01/static/js/codemirror/mode/gfm/index.html +70 -0
  53. data/examples/examples01/static/js/codemirror/mode/gfm/test.js +225 -0
  54. data/examples/examples01/static/js/codemirror/mode/go/go.js +165 -0
  55. data/examples/examples01/static/js/codemirror/mode/go/index.html +74 -0
  56. data/examples/examples01/static/js/codemirror/mode/groovy/groovy.js +210 -0
  57. data/examples/examples01/static/js/codemirror/mode/groovy/index.html +73 -0
  58. data/examples/examples01/static/js/codemirror/mode/haskell/haskell.js +242 -0
  59. data/examples/examples01/static/js/codemirror/mode/haskell/index.html +62 -0
  60. data/examples/examples01/static/js/codemirror/mode/haxe/haxe.js +429 -0
  61. data/examples/examples01/static/js/codemirror/mode/haxe/index.html +90 -0
  62. data/examples/examples01/static/js/codemirror/mode/htmlembedded/htmlembedded.js +73 -0
  63. data/examples/examples01/static/js/codemirror/mode/htmlembedded/index.html +49 -0
  64. data/examples/examples01/static/js/codemirror/mode/htmlmixed/htmlmixed.js +84 -0
  65. data/examples/examples01/static/js/codemirror/mode/htmlmixed/index.html +52 -0
  66. data/examples/examples01/static/js/codemirror/mode/http/http.js +98 -0
  67. data/examples/examples01/static/js/codemirror/mode/http/index.html +32 -0
  68. data/examples/examples01/static/js/codemirror/mode/javascript/index.html +88 -0
  69. data/examples/examples01/static/js/codemirror/mode/javascript/javascript.js +411 -0
  70. data/examples/examples01/static/js/codemirror/mode/javascript/typescript.html +48 -0
  71. data/examples/examples01/static/js/codemirror/mode/jinja2/index.html +38 -0
  72. data/examples/examples01/static/js/codemirror/mode/jinja2/jinja2.js +42 -0
  73. data/examples/examples01/static/js/codemirror/mode/less/index.html +741 -0
  74. data/examples/examples01/static/js/codemirror/mode/less/less.js +266 -0
  75. data/examples/examples01/static/js/codemirror/mode/lua/index.html +74 -0
  76. data/examples/examples01/static/js/codemirror/mode/lua/lua.js +140 -0
  77. data/examples/examples01/static/js/codemirror/mode/markdown/index.html +344 -0
  78. data/examples/examples01/static/js/codemirror/mode/markdown/markdown.js +474 -0
  79. data/examples/examples01/static/js/codemirror/mode/markdown/test.js +1266 -0
  80. data/examples/examples01/static/js/codemirror/mode/mysql/index.html +41 -0
  81. data/examples/examples01/static/js/codemirror/mode/mysql/mysql.js +203 -0
  82. data/examples/examples01/static/js/codemirror/mode/ntriples/index.html +33 -0
  83. data/examples/examples01/static/js/codemirror/mode/ntriples/ntriples.js +170 -0
  84. data/examples/examples01/static/js/codemirror/mode/ocaml/index.html +131 -0
  85. data/examples/examples01/static/js/codemirror/mode/ocaml/ocaml.js +113 -0
  86. data/examples/examples01/static/js/codemirror/mode/pascal/LICENSE +7 -0
  87. data/examples/examples01/static/js/codemirror/mode/pascal/index.html +48 -0
  88. data/examples/examples01/static/js/codemirror/mode/pascal/pascal.js +94 -0
  89. data/examples/examples01/static/js/codemirror/mode/perl/LICENSE +19 -0
  90. data/examples/examples01/static/js/codemirror/mode/perl/index.html +62 -0
  91. data/examples/examples01/static/js/codemirror/mode/perl/perl.js +816 -0
  92. data/examples/examples01/static/js/codemirror/mode/php/index.html +51 -0
  93. data/examples/examples01/static/js/codemirror/mode/php/php.js +129 -0
  94. data/examples/examples01/static/js/codemirror/mode/pig/index.html +42 -0
  95. data/examples/examples01/static/js/codemirror/mode/pig/pig.js +171 -0
  96. data/examples/examples01/static/js/codemirror/mode/plsql/index.html +62 -0
  97. data/examples/examples01/static/js/codemirror/mode/plsql/plsql.js +216 -0
  98. data/examples/examples01/static/js/codemirror/mode/properties/index.html +41 -0
  99. data/examples/examples01/static/js/codemirror/mode/properties/properties.js +63 -0
  100. data/examples/examples01/static/js/codemirror/mode/python/LICENSE.txt +21 -0
  101. data/examples/examples01/static/js/codemirror/mode/python/index.html +124 -0
  102. data/examples/examples01/static/js/codemirror/mode/python/python.js +340 -0
  103. data/examples/examples01/static/js/codemirror/mode/r/LICENSE +24 -0
  104. data/examples/examples01/static/js/codemirror/mode/r/index.html +74 -0
  105. data/examples/examples01/static/js/codemirror/mode/r/r.js +141 -0
  106. data/examples/examples01/static/js/codemirror/mode/rpm/changes/changes.js +19 -0
  107. data/examples/examples01/static/js/codemirror/mode/rpm/changes/index.html +53 -0
  108. data/examples/examples01/static/js/codemirror/mode/rpm/spec/index.html +99 -0
  109. data/examples/examples01/static/js/codemirror/mode/rpm/spec/spec.css +5 -0
  110. data/examples/examples01/static/js/codemirror/mode/rpm/spec/spec.js +66 -0
  111. data/examples/examples01/static/js/codemirror/mode/rst/index.html +526 -0
  112. data/examples/examples01/static/js/codemirror/mode/rst/rst.js +314 -0
  113. data/examples/examples01/static/js/codemirror/mode/ruby/LICENSE +24 -0
  114. data/examples/examples01/static/js/codemirror/mode/ruby/index.html +173 -0
  115. data/examples/examples01/static/js/codemirror/mode/ruby/ruby.js +195 -0
  116. data/examples/examples01/static/js/codemirror/mode/rust/index.html +48 -0
  117. data/examples/examples01/static/js/codemirror/mode/rust/rust.js +432 -0
  118. data/examples/examples01/static/js/codemirror/mode/scheme/index.html +65 -0
  119. data/examples/examples01/static/js/codemirror/mode/scheme/scheme.js +230 -0
  120. data/examples/examples01/static/js/codemirror/mode/shell/index.html +51 -0
  121. data/examples/examples01/static/js/codemirror/mode/shell/shell.js +118 -0
  122. data/examples/examples01/static/js/codemirror/mode/sieve/LICENSE +23 -0
  123. data/examples/examples01/static/js/codemirror/mode/sieve/index.html +81 -0
  124. data/examples/examples01/static/js/codemirror/mode/sieve/sieve.js +156 -0
  125. data/examples/examples01/static/js/codemirror/mode/smalltalk/index.html +57 -0
  126. data/examples/examples01/static/js/codemirror/mode/smalltalk/smalltalk.js +139 -0
  127. data/examples/examples01/static/js/codemirror/mode/smarty/index.html +83 -0
  128. data/examples/examples01/static/js/codemirror/mode/smarty/smarty.js +148 -0
  129. data/examples/examples01/static/js/codemirror/mode/sparql/index.html +42 -0
  130. data/examples/examples01/static/js/codemirror/mode/sparql/sparql.js +143 -0
  131. data/examples/examples01/static/js/codemirror/mode/stex/index.html +98 -0
  132. data/examples/examples01/static/js/codemirror/mode/stex/stex.js +175 -0
  133. data/examples/examples01/static/js/codemirror/mode/stex/test.js +343 -0
  134. data/examples/examples01/static/js/codemirror/mode/tiddlywiki/index.html +142 -0
  135. data/examples/examples01/static/js/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
  136. data/examples/examples01/static/js/codemirror/mode/tiddlywiki/tiddlywiki.js +353 -0
  137. data/examples/examples01/static/js/codemirror/mode/tiki/index.html +81 -0
  138. data/examples/examples01/static/js/codemirror/mode/tiki/tiki.css +26 -0
  139. data/examples/examples01/static/js/codemirror/mode/tiki/tiki.js +309 -0
  140. data/examples/examples01/static/js/codemirror/mode/vb/LICENSE.txt +21 -0
  141. data/examples/examples01/static/js/codemirror/mode/vb/index.html +88 -0
  142. data/examples/examples01/static/js/codemirror/mode/vb/vb.js +260 -0
  143. data/examples/examples01/static/js/codemirror/mode/vbscript/index.html +42 -0
  144. data/examples/examples01/static/js/codemirror/mode/vbscript/vbscript.js +26 -0
  145. data/examples/examples01/static/js/codemirror/mode/velocity/index.html +103 -0
  146. data/examples/examples01/static/js/codemirror/mode/velocity/velocity.js +144 -0
  147. data/examples/examples01/static/js/codemirror/mode/verilog/index.html +210 -0
  148. data/examples/examples01/static/js/codemirror/mode/verilog/verilog.js +182 -0
  149. data/examples/examples01/static/js/codemirror/mode/xml/index.html +45 -0
  150. data/examples/examples01/static/js/codemirror/mode/xml/xml.js +324 -0
  151. data/examples/examples01/static/js/codemirror/mode/xquery/LICENSE +20 -0
  152. data/examples/examples01/static/js/codemirror/mode/xquery/index.html +221 -0
  153. data/examples/examples01/static/js/codemirror/mode/xquery/test.js +77 -0
  154. data/examples/examples01/static/js/codemirror/mode/xquery/xquery.js +450 -0
  155. data/examples/examples01/static/js/codemirror/mode/yaml/index.html +68 -0
  156. data/examples/examples01/static/js/codemirror/mode/yaml/yaml.js +95 -0
  157. data/examples/examples01/static/js/codemirror/mode/z80/index.html +39 -0
  158. data/examples/examples01/static/js/codemirror/mode/z80/z80.js +113 -0
  159. data/examples/examples01/static/js/codemirror/theme/ambiance-mobile.css +6 -0
  160. data/examples/examples01/static/js/codemirror/theme/ambiance.css +76 -0
  161. data/examples/examples01/static/js/codemirror/theme/blackboard.css +25 -0
  162. data/examples/examples01/static/js/codemirror/theme/cobalt.css +18 -0
  163. data/examples/examples01/static/js/codemirror/theme/eclipse.css +25 -0
  164. data/examples/examples01/static/js/codemirror/theme/elegant.css +10 -0
  165. data/examples/examples01/static/js/codemirror/theme/erlang-dark.css +21 -0
  166. data/examples/examples01/static/js/codemirror/theme/lesser-dark.css +44 -0
  167. data/examples/examples01/static/js/codemirror/theme/monokai.css +28 -0
  168. data/examples/examples01/static/js/codemirror/theme/neat.css +9 -0
  169. data/examples/examples01/static/js/codemirror/theme/night.css +21 -0
  170. data/examples/examples01/static/js/codemirror/theme/rubyblue.css +21 -0
  171. data/examples/examples01/static/js/codemirror/theme/solarized.css +207 -0
  172. data/examples/examples01/static/js/codemirror/theme/twilight.css +26 -0
  173. data/examples/examples01/static/js/codemirror/theme/vibrant-ink.css +27 -0
  174. data/examples/examples01/static/js/codemirror/theme/xq-dark.css +46 -0
  175. data/examples/examples01/static/js/d3.v3.min.js +2 -2
  176. data/examples/examples01/static/test/cm.html +33 -0
  177. data/examples/examples01/views/about.slim +15 -0
  178. data/examples/examples01/views/index.slim +1 -1
  179. data/examples/examples01/views/layout.slim +1 -0
  180. data/examples/examples01/views/layout_cm.slim +17 -0
  181. data/examples/examples01/views/navbar.slim +4 -4
  182. data/lib/swagr/version.rb +1 -1
  183. data/templates/app.rb +4 -0
  184. data/templates/static/js/codemirror/keymap/emacs.js +30 -0
  185. data/templates/static/js/codemirror/keymap/vim.js +2298 -0
  186. data/templates/static/js/codemirror/lib/codemirror.css +239 -0
  187. data/templates/static/js/codemirror/lib/codemirror.js +4553 -0
  188. data/templates/static/js/codemirror/lib/util/closetag.js +85 -0
  189. data/templates/static/js/codemirror/lib/util/colorize.js +29 -0
  190. data/templates/static/js/codemirror/lib/util/continuecomment.js +36 -0
  191. data/templates/static/js/codemirror/lib/util/continuelist.js +28 -0
  192. data/templates/static/js/codemirror/lib/util/dialog.css +32 -0
  193. data/templates/static/js/codemirror/lib/util/dialog.js +75 -0
  194. data/templates/static/js/codemirror/lib/util/foldcode.js +182 -0
  195. data/templates/static/js/codemirror/lib/util/formatting.js +108 -0
  196. data/templates/static/js/codemirror/lib/util/javascript-hint.js +137 -0
  197. data/templates/static/js/codemirror/lib/util/loadmode.js +51 -0
  198. data/templates/static/js/codemirror/lib/util/match-highlighter.js +46 -0
  199. data/templates/static/js/codemirror/lib/util/matchbrackets.js +63 -0
  200. data/templates/static/js/codemirror/lib/util/multiplex.js +95 -0
  201. data/templates/static/js/codemirror/lib/util/overlay.js +59 -0
  202. data/templates/static/js/codemirror/lib/util/pig-hint.js +117 -0
  203. data/templates/static/js/codemirror/lib/util/runmode-standalone.js +90 -0
  204. data/templates/static/js/codemirror/lib/util/runmode.js +52 -0
  205. data/templates/static/js/codemirror/lib/util/search.js +119 -0
  206. data/templates/static/js/codemirror/lib/util/searchcursor.js +119 -0
  207. data/templates/static/js/codemirror/lib/util/simple-hint.css +16 -0
  208. data/templates/static/js/codemirror/lib/util/simple-hint.js +102 -0
  209. data/templates/static/js/codemirror/lib/util/xml-hint.js +131 -0
  210. data/templates/static/js/codemirror/mode/clike/clike.js +300 -0
  211. data/templates/static/js/codemirror/mode/clike/index.html +103 -0
  212. data/templates/static/js/codemirror/mode/clike/scala.html +767 -0
  213. data/templates/static/js/codemirror/mode/clojure/clojure.js +206 -0
  214. data/templates/static/js/codemirror/mode/clojure/index.html +67 -0
  215. data/templates/static/js/codemirror/mode/coffeescript/LICENSE +22 -0
  216. data/templates/static/js/codemirror/mode/coffeescript/coffeescript.js +346 -0
  217. data/templates/static/js/codemirror/mode/coffeescript/index.html +728 -0
  218. data/templates/static/js/codemirror/mode/commonlisp/commonlisp.js +101 -0
  219. data/templates/static/js/codemirror/mode/commonlisp/index.html +165 -0
  220. data/templates/static/js/codemirror/mode/css/css.js +465 -0
  221. data/templates/static/js/codemirror/mode/css/index.html +58 -0
  222. data/templates/static/js/codemirror/mode/css/test.js +501 -0
  223. data/templates/static/js/codemirror/mode/diff/diff.js +32 -0
  224. data/templates/static/js/codemirror/mode/diff/index.html +105 -0
  225. data/templates/static/js/codemirror/mode/ecl/ecl.js +192 -0
  226. data/templates/static/js/codemirror/mode/ecl/index.html +39 -0
  227. data/templates/static/js/codemirror/mode/erlang/erlang.js +463 -0
  228. data/templates/static/js/codemirror/mode/erlang/index.html +64 -0
  229. data/templates/static/js/codemirror/mode/gfm/gfm.js +94 -0
  230. data/templates/static/js/codemirror/mode/gfm/index.html +70 -0
  231. data/templates/static/js/codemirror/mode/gfm/test.js +225 -0
  232. data/templates/static/js/codemirror/mode/go/go.js +165 -0
  233. data/templates/static/js/codemirror/mode/go/index.html +74 -0
  234. data/templates/static/js/codemirror/mode/groovy/groovy.js +210 -0
  235. data/templates/static/js/codemirror/mode/groovy/index.html +73 -0
  236. data/templates/static/js/codemirror/mode/haskell/haskell.js +242 -0
  237. data/templates/static/js/codemirror/mode/haskell/index.html +62 -0
  238. data/templates/static/js/codemirror/mode/haxe/haxe.js +429 -0
  239. data/templates/static/js/codemirror/mode/haxe/index.html +90 -0
  240. data/templates/static/js/codemirror/mode/htmlembedded/htmlembedded.js +73 -0
  241. data/templates/static/js/codemirror/mode/htmlembedded/index.html +49 -0
  242. data/templates/static/js/codemirror/mode/htmlmixed/htmlmixed.js +84 -0
  243. data/templates/static/js/codemirror/mode/htmlmixed/index.html +52 -0
  244. data/templates/static/js/codemirror/mode/http/http.js +98 -0
  245. data/templates/static/js/codemirror/mode/http/index.html +32 -0
  246. data/templates/static/js/codemirror/mode/javascript/index.html +88 -0
  247. data/templates/static/js/codemirror/mode/javascript/javascript.js +411 -0
  248. data/templates/static/js/codemirror/mode/javascript/typescript.html +48 -0
  249. data/templates/static/js/codemirror/mode/jinja2/index.html +38 -0
  250. data/templates/static/js/codemirror/mode/jinja2/jinja2.js +42 -0
  251. data/templates/static/js/codemirror/mode/less/index.html +741 -0
  252. data/templates/static/js/codemirror/mode/less/less.js +266 -0
  253. data/templates/static/js/codemirror/mode/lua/index.html +74 -0
  254. data/templates/static/js/codemirror/mode/lua/lua.js +140 -0
  255. data/templates/static/js/codemirror/mode/markdown/index.html +344 -0
  256. data/templates/static/js/codemirror/mode/markdown/markdown.js +474 -0
  257. data/templates/static/js/codemirror/mode/markdown/test.js +1266 -0
  258. data/templates/static/js/codemirror/mode/mysql/index.html +41 -0
  259. data/templates/static/js/codemirror/mode/mysql/mysql.js +203 -0
  260. data/templates/static/js/codemirror/mode/ntriples/index.html +33 -0
  261. data/templates/static/js/codemirror/mode/ntriples/ntriples.js +170 -0
  262. data/templates/static/js/codemirror/mode/ocaml/index.html +131 -0
  263. data/templates/static/js/codemirror/mode/ocaml/ocaml.js +113 -0
  264. data/templates/static/js/codemirror/mode/pascal/LICENSE +7 -0
  265. data/templates/static/js/codemirror/mode/pascal/index.html +48 -0
  266. data/templates/static/js/codemirror/mode/pascal/pascal.js +94 -0
  267. data/templates/static/js/codemirror/mode/perl/LICENSE +19 -0
  268. data/templates/static/js/codemirror/mode/perl/index.html +62 -0
  269. data/templates/static/js/codemirror/mode/perl/perl.js +816 -0
  270. data/templates/static/js/codemirror/mode/php/index.html +51 -0
  271. data/templates/static/js/codemirror/mode/php/php.js +129 -0
  272. data/templates/static/js/codemirror/mode/pig/index.html +42 -0
  273. data/templates/static/js/codemirror/mode/pig/pig.js +171 -0
  274. data/templates/static/js/codemirror/mode/plsql/index.html +62 -0
  275. data/templates/static/js/codemirror/mode/plsql/plsql.js +216 -0
  276. data/templates/static/js/codemirror/mode/properties/index.html +41 -0
  277. data/templates/static/js/codemirror/mode/properties/properties.js +63 -0
  278. data/templates/static/js/codemirror/mode/python/LICENSE.txt +21 -0
  279. data/templates/static/js/codemirror/mode/python/index.html +124 -0
  280. data/templates/static/js/codemirror/mode/python/python.js +340 -0
  281. data/templates/static/js/codemirror/mode/r/LICENSE +24 -0
  282. data/templates/static/js/codemirror/mode/r/index.html +74 -0
  283. data/templates/static/js/codemirror/mode/r/r.js +141 -0
  284. data/templates/static/js/codemirror/mode/rpm/changes/changes.js +19 -0
  285. data/templates/static/js/codemirror/mode/rpm/changes/index.html +53 -0
  286. data/templates/static/js/codemirror/mode/rpm/spec/index.html +99 -0
  287. data/templates/static/js/codemirror/mode/rpm/spec/spec.css +5 -0
  288. data/templates/static/js/codemirror/mode/rpm/spec/spec.js +66 -0
  289. data/templates/static/js/codemirror/mode/rst/index.html +526 -0
  290. data/templates/static/js/codemirror/mode/rst/rst.js +314 -0
  291. data/templates/static/js/codemirror/mode/ruby/LICENSE +24 -0
  292. data/templates/static/js/codemirror/mode/ruby/index.html +173 -0
  293. data/templates/static/js/codemirror/mode/ruby/ruby.js +195 -0
  294. data/templates/static/js/codemirror/mode/rust/index.html +48 -0
  295. data/templates/static/js/codemirror/mode/rust/rust.js +432 -0
  296. data/templates/static/js/codemirror/mode/scheme/index.html +65 -0
  297. data/templates/static/js/codemirror/mode/scheme/scheme.js +230 -0
  298. data/templates/static/js/codemirror/mode/shell/index.html +51 -0
  299. data/templates/static/js/codemirror/mode/shell/shell.js +118 -0
  300. data/templates/static/js/codemirror/mode/sieve/LICENSE +23 -0
  301. data/templates/static/js/codemirror/mode/sieve/index.html +81 -0
  302. data/templates/static/js/codemirror/mode/sieve/sieve.js +156 -0
  303. data/templates/static/js/codemirror/mode/smalltalk/index.html +57 -0
  304. data/templates/static/js/codemirror/mode/smalltalk/smalltalk.js +139 -0
  305. data/templates/static/js/codemirror/mode/smarty/index.html +83 -0
  306. data/templates/static/js/codemirror/mode/smarty/smarty.js +148 -0
  307. data/templates/static/js/codemirror/mode/sparql/index.html +42 -0
  308. data/templates/static/js/codemirror/mode/sparql/sparql.js +143 -0
  309. data/templates/static/js/codemirror/mode/stex/index.html +98 -0
  310. data/templates/static/js/codemirror/mode/stex/stex.js +175 -0
  311. data/templates/static/js/codemirror/mode/stex/test.js +343 -0
  312. data/templates/static/js/codemirror/mode/tiddlywiki/index.html +142 -0
  313. data/templates/static/js/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
  314. data/templates/static/js/codemirror/mode/tiddlywiki/tiddlywiki.js +353 -0
  315. data/templates/static/js/codemirror/mode/tiki/index.html +81 -0
  316. data/templates/static/js/codemirror/mode/tiki/tiki.css +26 -0
  317. data/templates/static/js/codemirror/mode/tiki/tiki.js +309 -0
  318. data/templates/static/js/codemirror/mode/vb/LICENSE.txt +21 -0
  319. data/templates/static/js/codemirror/mode/vb/index.html +88 -0
  320. data/templates/static/js/codemirror/mode/vb/vb.js +260 -0
  321. data/templates/static/js/codemirror/mode/vbscript/index.html +42 -0
  322. data/templates/static/js/codemirror/mode/vbscript/vbscript.js +26 -0
  323. data/templates/static/js/codemirror/mode/velocity/index.html +103 -0
  324. data/templates/static/js/codemirror/mode/velocity/velocity.js +144 -0
  325. data/templates/static/js/codemirror/mode/verilog/index.html +210 -0
  326. data/templates/static/js/codemirror/mode/verilog/verilog.js +182 -0
  327. data/templates/static/js/codemirror/mode/xml/index.html +45 -0
  328. data/templates/static/js/codemirror/mode/xml/xml.js +324 -0
  329. data/templates/static/js/codemirror/mode/xquery/LICENSE +20 -0
  330. data/templates/static/js/codemirror/mode/xquery/index.html +221 -0
  331. data/templates/static/js/codemirror/mode/xquery/test.js +77 -0
  332. data/templates/static/js/codemirror/mode/xquery/xquery.js +450 -0
  333. data/templates/static/js/codemirror/mode/yaml/index.html +68 -0
  334. data/templates/static/js/codemirror/mode/yaml/yaml.js +95 -0
  335. data/templates/static/js/codemirror/mode/z80/index.html +39 -0
  336. data/templates/static/js/codemirror/mode/z80/z80.js +113 -0
  337. data/templates/static/js/codemirror/theme/ambiance-mobile.css +6 -0
  338. data/templates/static/js/codemirror/theme/ambiance.css +76 -0
  339. data/templates/static/js/codemirror/theme/blackboard.css +25 -0
  340. data/templates/static/js/codemirror/theme/cobalt.css +18 -0
  341. data/templates/static/js/codemirror/theme/eclipse.css +25 -0
  342. data/templates/static/js/codemirror/theme/elegant.css +10 -0
  343. data/templates/static/js/codemirror/theme/erlang-dark.css +21 -0
  344. data/templates/static/js/codemirror/theme/lesser-dark.css +44 -0
  345. data/templates/static/js/codemirror/theme/monokai.css +28 -0
  346. data/templates/static/js/codemirror/theme/neat.css +9 -0
  347. data/templates/static/js/codemirror/theme/night.css +21 -0
  348. data/templates/static/js/codemirror/theme/rubyblue.css +21 -0
  349. data/templates/static/js/codemirror/theme/solarized.css +207 -0
  350. data/templates/static/js/codemirror/theme/twilight.css +26 -0
  351. data/templates/static/js/codemirror/theme/vibrant-ink.css +27 -0
  352. data/templates/static/js/codemirror/theme/xq-dark.css +46 -0
  353. data/templates/static/js/d3.v3.min.js +2 -2
  354. data/templates/static/test/cm.html +33 -0
  355. data/templates/views/about.slim +15 -0
  356. data/templates/views/index.slim +1 -1
  357. data/templates/views/layout.slim +1 -0
  358. data/templates/views/navbar.slim +4 -4
  359. 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
+ &lt;ul id="ProjectSubmenu"&gt;
23
+ &lt;li&gt;&lt;a href="/projects/markdown/" title="Markdown Project Page"&gt;Main&lt;/a&gt;&lt;/li&gt;
24
+ &lt;li&gt;&lt;a class="selected" title="Markdown Basics"&gt;Basics&lt;/a&gt;&lt;/li&gt;
25
+ &lt;li&gt;&lt;a href="/projects/markdown/syntax" title="Markdown Syntax Documentation"&gt;Syntax&lt;/a&gt;&lt;/li&gt;
26
+ &lt;li&gt;&lt;a href="/projects/markdown/license" title="Pricing and License Information"&gt;License&lt;/a&gt;&lt;/li&gt;
27
+ &lt;li&gt;&lt;a href="/projects/markdown/dingus" title="Online Markdown Web Form"&gt;Dingus&lt;/a&gt;&lt;/li&gt;
28
+ &lt;/ul&gt;
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 `&lt;h1&gt;` and `&lt;h2&gt;` 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 '`&gt;`' 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
+ &gt; This is a blockquote.
88
+ &gt;
89
+ &gt; This is the second paragraph in the blockquote.
90
+ &gt;
91
+ &gt; ## This is an H2 in a blockquote
92
+
93
+
94
+ Output:
95
+
96
+ &lt;h1&gt;A First Level Header&lt;/h1&gt;
97
+
98
+ &lt;h2&gt;A Second Level Header&lt;/h2&gt;
99
+
100
+ &lt;p&gt;Now is the time for all good men to come to
101
+ the aid of their country. This is just a
102
+ regular paragraph.&lt;/p&gt;
103
+
104
+ &lt;p&gt;The quick brown fox jumped over the lazy
105
+ dog's back.&lt;/p&gt;
106
+
107
+ &lt;h3&gt;Header 3&lt;/h3&gt;
108
+
109
+ &lt;blockquote&gt;
110
+ &lt;p&gt;This is a blockquote.&lt;/p&gt;
111
+
112
+ &lt;p&gt;This is the second paragraph in the blockquote.&lt;/p&gt;
113
+
114
+ &lt;h2&gt;This is an H2 in a blockquote&lt;/h2&gt;
115
+ &lt;/blockquote&gt;
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
+ &lt;p&gt;Some of these words &lt;em&gt;are emphasized&lt;/em&gt;.
134
+ Some of these words &lt;em&gt;are emphasized also&lt;/em&gt;.&lt;/p&gt;
135
+
136
+ &lt;p&gt;Use two asterisks for &lt;strong&gt;strong emphasis&lt;/strong&gt;.
137
+ Or, if you prefer, &lt;strong&gt;use two underscores instead&lt;/strong&gt;.&lt;/p&gt;
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
+ &lt;ul&gt;
166
+ &lt;li&gt;Candy.&lt;/li&gt;
167
+ &lt;li&gt;Gum.&lt;/li&gt;
168
+ &lt;li&gt;Booze.&lt;/li&gt;
169
+ &lt;/ul&gt;
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
+ &lt;ol&gt;
181
+ &lt;li&gt;Red&lt;/li&gt;
182
+ &lt;li&gt;Green&lt;/li&gt;
183
+ &lt;li&gt;Blue&lt;/li&gt;
184
+ &lt;/ol&gt;
185
+
186
+ If you put blank lines between items, you'll get `&lt;p&gt;` 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
+ &lt;ul&gt;
199
+ &lt;li&gt;&lt;p&gt;A list item.&lt;/p&gt;
200
+ &lt;p&gt;With multiple paragraphs.&lt;/p&gt;&lt;/li&gt;
201
+ &lt;li&gt;&lt;p&gt;Another item in the list.&lt;/p&gt;&lt;/li&gt;
202
+ &lt;/ul&gt;
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
+ &lt;p&gt;This is an &lt;a href="http://example.com/"&gt;
220
+ example link&lt;/a&gt;.&lt;/p&gt;
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
+ &lt;p&gt;This is an &lt;a href="http://example.com/" title="With a Title"&gt;
229
+ example link&lt;/a&gt;.&lt;/p&gt;
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
+ &lt;p&gt;I get 10 times more traffic from &lt;a href="http://google.com/"
244
+ title="Google"&gt;Google&lt;/a&gt; than from &lt;a href="http://search.yahoo.com/"
245
+ title="Yahoo Search"&gt;Yahoo&lt;/a&gt; or &lt;a href="http://search.msn.com/"
246
+ title="MSN Search"&gt;MSN&lt;/a&gt;.&lt;/p&gt;
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
+ &lt;p&gt;I start my morning with a cup of coffee and
259
+ &lt;a href="http://www.nytimes.com/"&gt;The New York Times&lt;/a&gt;.&lt;/p&gt;
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
+ &lt;img src="/path/to/img.jpg" alt="alt text" title="Title" /&gt;
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 (`&amp;`) and angle brackets (`&lt;` or
286
+ `&gt;`) 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 `&lt;blink&gt;` tags.
290
+
291
+ I wish SmartyPants used named entities like `&amp;mdash;`
292
+ instead of decimal-encoded entites like `&amp;#8212;`.
293
+
294
+ Output:
295
+
296
+ &lt;p&gt;I strongly recommend against using any
297
+ &lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;
298
+
299
+ &lt;p&gt;I wish SmartyPants used named entities like
300
+ &lt;code&gt;&amp;amp;mdash;&lt;/code&gt; instead of decimal-encoded
301
+ entites like &lt;code&gt;&amp;amp;#8212;&lt;/code&gt;.&lt;/p&gt;
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, `&amp;`, `&lt;`,
306
+ and `&gt;` 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
+ &lt;blockquote&gt;
314
+ &lt;p&gt;For example.&lt;/p&gt;
315
+ &lt;/blockquote&gt;
316
+
317
+ Output:
318
+
319
+ &lt;p&gt;If you want your page to validate under XHTML 1.0 Strict,
320
+ you've got to put paragraph tags in your blockquotes:&lt;/p&gt;
321
+
322
+ &lt;pre&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;
323
+ &amp;lt;p&amp;gt;For example.&amp;lt;/p&amp;gt;
324
+ &amp;lt;/blockquote&amp;gt;
325
+ &lt;/code&gt;&lt;/pre&gt;
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");