milksteak 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (350) hide show
  1. data/.gitignore +1 -14
  2. data/.rspec +2 -0
  3. data/Gemfile +1 -1
  4. data/Guardfile +8 -0
  5. data/Rakefile +0 -1
  6. data/Readme.md +37 -0
  7. data/lib/helpers.rb +0 -0
  8. data/lib/milksteak/cms.rb +17 -0
  9. data/lib/milksteak/version.rb +1 -1
  10. data/lib/milksteak.rb +52 -1
  11. data/lib/models/page.rb +73 -0
  12. data/lib/models/user.rb +5 -0
  13. data/lib/public/milksteak/codemirror2/keymap/emacs.js +29 -0
  14. data/lib/public/milksteak/codemirror2/keymap/vim.js +347 -0
  15. data/lib/public/milksteak/codemirror2/lib/codemirror.css +110 -0
  16. data/lib/public/milksteak/codemirror2/lib/codemirror.js +2887 -0
  17. data/lib/public/milksteak/codemirror2/lib/util/dialog.css +23 -0
  18. data/lib/public/milksteak/codemirror2/lib/util/dialog.js +63 -0
  19. data/lib/public/milksteak/codemirror2/lib/util/foldcode.js +186 -0
  20. data/lib/public/milksteak/codemirror2/lib/util/formatting.js +294 -0
  21. data/lib/public/milksteak/codemirror2/lib/util/javascript-hint.js +132 -0
  22. data/lib/public/milksteak/codemirror2/lib/util/match-highlighter.js +44 -0
  23. data/lib/public/milksteak/codemirror2/lib/util/overlay.js +51 -0
  24. data/lib/public/milksteak/codemirror2/lib/util/runmode.js +49 -0
  25. data/lib/public/milksteak/codemirror2/lib/util/search.js +114 -0
  26. data/lib/public/milksteak/codemirror2/lib/util/searchcursor.js +117 -0
  27. data/lib/public/milksteak/codemirror2/lib/util/simple-hint.css +16 -0
  28. data/lib/public/milksteak/codemirror2/lib/util/simple-hint.js +66 -0
  29. data/lib/public/milksteak/codemirror2/mode/clike/clike.js +234 -0
  30. data/lib/public/milksteak/codemirror2/mode/clike/index.html +101 -0
  31. data/lib/public/milksteak/codemirror2/mode/clojure/clojure.js +207 -0
  32. data/lib/public/milksteak/codemirror2/mode/clojure/index.html +66 -0
  33. data/lib/public/milksteak/codemirror2/mode/coffeescript/LICENSE +22 -0
  34. data/lib/public/milksteak/codemirror2/mode/coffeescript/coffeescript.js +341 -0
  35. data/lib/public/milksteak/codemirror2/mode/coffeescript/index.html +721 -0
  36. data/lib/public/milksteak/codemirror2/mode/css/css.js +124 -0
  37. data/lib/public/milksteak/codemirror2/mode/css/index.html +55 -0
  38. data/lib/public/milksteak/codemirror2/mode/diff/diff.css +3 -0
  39. data/lib/public/milksteak/codemirror2/mode/diff/diff.js +13 -0
  40. data/lib/public/milksteak/codemirror2/mode/diff/index.html +99 -0
  41. data/lib/public/milksteak/codemirror2/mode/ecl/ecl.js +203 -0
  42. data/lib/public/milksteak/codemirror2/mode/ecl/index.html +42 -0
  43. data/lib/public/milksteak/codemirror2/mode/gfm/gfm.js +108 -0
  44. data/lib/public/milksteak/codemirror2/mode/gfm/index.html +47 -0
  45. data/lib/public/milksteak/codemirror2/mode/go/go.js +170 -0
  46. data/lib/public/milksteak/codemirror2/mode/go/index.html +72 -0
  47. data/lib/public/milksteak/codemirror2/mode/groovy/groovy.js +210 -0
  48. data/lib/public/milksteak/codemirror2/mode/groovy/index.html +71 -0
  49. data/lib/public/milksteak/codemirror2/mode/haskell/haskell.js +242 -0
  50. data/lib/public/milksteak/codemirror2/mode/haskell/index.html +60 -0
  51. data/lib/public/milksteak/codemirror2/mode/htmlembedded/htmlembedded.js +68 -0
  52. data/lib/public/milksteak/codemirror2/mode/htmlembedded/index.html +49 -0
  53. data/lib/public/milksteak/codemirror2/mode/htmlmixed/htmlmixed.js +83 -0
  54. data/lib/public/milksteak/codemirror2/mode/htmlmixed/index.html +51 -0
  55. data/lib/public/milksteak/codemirror2/mode/javascript/index.html +77 -0
  56. data/lib/public/milksteak/codemirror2/mode/javascript/javascript.js +360 -0
  57. data/lib/public/milksteak/codemirror2/mode/jinja2/index.html +37 -0
  58. data/lib/public/milksteak/codemirror2/mode/jinja2/jinja2.js +42 -0
  59. data/lib/public/milksteak/codemirror2/mode/less/index.html +577 -0
  60. data/lib/public/milksteak/codemirror2/mode/less/less.js +186 -0
  61. data/lib/public/milksteak/codemirror2/mode/lua/index.html +72 -0
  62. data/lib/public/milksteak/codemirror2/mode/lua/lua.js +140 -0
  63. data/lib/public/milksteak/codemirror2/mode/markdown/index.html +339 -0
  64. data/lib/public/milksteak/codemirror2/mode/markdown/markdown.js +276 -0
  65. data/lib/public/milksteak/codemirror2/mode/mysql/index.html +41 -0
  66. data/lib/public/milksteak/codemirror2/mode/mysql/mysql.js +188 -0
  67. data/lib/public/milksteak/codemirror2/mode/ntriples/index.html +32 -0
  68. data/lib/public/milksteak/codemirror2/mode/ntriples/ntriples.js +172 -0
  69. data/lib/public/milksteak/codemirror2/mode/pascal/LICENSE +7 -0
  70. data/lib/public/milksteak/codemirror2/mode/pascal/index.html +48 -0
  71. data/lib/public/milksteak/codemirror2/mode/pascal/pascal.js +94 -0
  72. data/lib/public/milksteak/codemirror2/mode/perl/LICENSE +19 -0
  73. data/lib/public/milksteak/codemirror2/mode/perl/index.html +62 -0
  74. data/lib/public/milksteak/codemirror2/mode/perl/perl.js +816 -0
  75. data/lib/public/milksteak/codemirror2/mode/php/index.html +48 -0
  76. data/lib/public/milksteak/codemirror2/mode/php/php.js +150 -0
  77. data/lib/public/milksteak/codemirror2/mode/plsql/index.html +62 -0
  78. data/lib/public/milksteak/codemirror2/mode/plsql/plsql.js +217 -0
  79. data/lib/public/milksteak/codemirror2/mode/properties/index.html +40 -0
  80. data/lib/public/milksteak/codemirror2/mode/properties/properties.css +3 -0
  81. data/lib/public/milksteak/codemirror2/mode/properties/properties.js +57 -0
  82. data/lib/public/milksteak/codemirror2/mode/python/LICENSE.txt +21 -0
  83. data/lib/public/milksteak/codemirror2/mode/python/index.html +122 -0
  84. data/lib/public/milksteak/codemirror2/mode/python/python.js +340 -0
  85. data/lib/public/milksteak/codemirror2/mode/r/LICENSE +24 -0
  86. data/lib/public/milksteak/codemirror2/mode/r/index.html +73 -0
  87. data/lib/public/milksteak/codemirror2/mode/r/r.js +141 -0
  88. data/lib/public/milksteak/codemirror2/mode/rpm/changes/changes.js +19 -0
  89. data/lib/public/milksteak/codemirror2/mode/rpm/changes/index.html +53 -0
  90. data/lib/public/milksteak/codemirror2/mode/rpm/spec/index.html +99 -0
  91. data/lib/public/milksteak/codemirror2/mode/rpm/spec/spec.css +5 -0
  92. data/lib/public/milksteak/codemirror2/mode/rpm/spec/spec.js +66 -0
  93. data/lib/public/milksteak/codemirror2/mode/rst/index.html +525 -0
  94. data/lib/public/milksteak/codemirror2/mode/rst/rst.js +326 -0
  95. data/lib/public/milksteak/codemirror2/mode/ruby/LICENSE +24 -0
  96. data/lib/public/milksteak/codemirror2/mode/ruby/index.html +171 -0
  97. data/lib/public/milksteak/codemirror2/mode/ruby/ruby.js +200 -0
  98. data/lib/public/milksteak/codemirror2/mode/rust/index.html +48 -0
  99. data/lib/public/milksteak/codemirror2/mode/rust/rust.js +432 -0
  100. data/lib/public/milksteak/codemirror2/mode/scheme/index.html +64 -0
  101. data/lib/public/milksteak/codemirror2/mode/scheme/scheme.js +202 -0
  102. data/lib/public/milksteak/codemirror2/mode/smalltalk/index.html +55 -0
  103. data/lib/public/milksteak/codemirror2/mode/smalltalk/smalltalk.js +139 -0
  104. data/lib/public/milksteak/codemirror2/mode/sparql/index.html +40 -0
  105. data/lib/public/milksteak/codemirror2/mode/sparql/sparql.js +143 -0
  106. data/lib/public/milksteak/codemirror2/mode/stex/index.html +95 -0
  107. data/lib/public/milksteak/codemirror2/mode/stex/stex.js +167 -0
  108. data/lib/public/milksteak/codemirror2/mode/tiddlywiki/index.html +183 -0
  109. data/lib/public/milksteak/codemirror2/mode/tiddlywiki/tiddlywiki.css +21 -0
  110. data/lib/public/milksteak/codemirror2/mode/tiddlywiki/tiddlywiki.js +374 -0
  111. data/lib/public/milksteak/codemirror2/mode/velocity/index.html +103 -0
  112. data/lib/public/milksteak/codemirror2/mode/velocity/velocity.js +146 -0
  113. data/lib/public/milksteak/codemirror2/mode/verilog/index.html +210 -0
  114. data/lib/public/milksteak/codemirror2/mode/verilog/verilog.js +194 -0
  115. data/lib/public/milksteak/codemirror2/mode/xml/index.html +45 -0
  116. data/lib/public/milksteak/codemirror2/mode/xml/xml.js +267 -0
  117. data/lib/public/milksteak/codemirror2/mode/xmlpure/index.html +59 -0
  118. data/lib/public/milksteak/codemirror2/mode/xmlpure/xmlpure.js +490 -0
  119. data/lib/public/milksteak/codemirror2/mode/yaml/index.html +67 -0
  120. data/lib/public/milksteak/codemirror2/mode/yaml/yaml.js +95 -0
  121. data/lib/public/milksteak/codemirror2/theme/cobalt.css +18 -0
  122. data/lib/public/milksteak/codemirror2/theme/eclipse.css +25 -0
  123. data/lib/public/milksteak/codemirror2/theme/elegant.css +10 -0
  124. data/lib/public/milksteak/codemirror2/theme/monokai.css +28 -0
  125. data/lib/public/milksteak/codemirror2/theme/neat.css +9 -0
  126. data/lib/public/milksteak/codemirror2/theme/night.css +21 -0
  127. data/lib/public/milksteak/codemirror2/theme/rubyblue.css +21 -0
  128. data/lib/public/milksteak/css/bootstrap-responsive.css +567 -0
  129. data/lib/public/milksteak/css/bootstrap-responsive.min.css +3 -0
  130. data/lib/public/milksteak/css/bootstrap.css +3365 -0
  131. data/lib/public/milksteak/css/bootstrap.min.css +610 -0
  132. data/lib/public/milksteak/css/calendrical.css +69 -0
  133. data/lib/public/milksteak/css/prettify.css +52 -0
  134. data/lib/public/milksteak/css/style.css +8 -0
  135. data/lib/public/milksteak/img/glyphicons-halflings-white.png +0 -0
  136. data/lib/public/milksteak/img/glyphicons-halflings.png +0 -0
  137. data/lib/public/milksteak/img/spinner.gif +0 -0
  138. data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.asp +44 -0
  139. data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.aspx +31 -0
  140. data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.cf +19 -0
  141. data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.jsp +49 -0
  142. data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.php +43 -0
  143. data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.pl +102 -0
  144. data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.py +25 -0
  145. data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree.rb +61 -0
  146. data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree_huck.lasso +36 -0
  147. data/lib/public/milksteak/jqueryFileTree/connectors/jqueryFileTree_sabourdin.lasso +48 -0
  148. data/lib/public/milksteak/jqueryFileTree/images/application.png +0 -0
  149. data/lib/public/milksteak/jqueryFileTree/images/code.png +0 -0
  150. data/lib/public/milksteak/jqueryFileTree/images/css.png +0 -0
  151. data/lib/public/milksteak/jqueryFileTree/images/db.png +0 -0
  152. data/lib/public/milksteak/jqueryFileTree/images/directory.png +0 -0
  153. data/lib/public/milksteak/jqueryFileTree/images/doc.png +0 -0
  154. data/lib/public/milksteak/jqueryFileTree/images/file.png +0 -0
  155. data/lib/public/milksteak/jqueryFileTree/images/film.png +0 -0
  156. data/lib/public/milksteak/jqueryFileTree/images/flash.png +0 -0
  157. data/lib/public/milksteak/jqueryFileTree/images/folder_open.png +0 -0
  158. data/lib/public/milksteak/jqueryFileTree/images/html.png +0 -0
  159. data/lib/public/milksteak/jqueryFileTree/images/java.png +0 -0
  160. data/lib/public/milksteak/jqueryFileTree/images/linux.png +0 -0
  161. data/lib/public/milksteak/jqueryFileTree/images/music.png +0 -0
  162. data/lib/public/milksteak/jqueryFileTree/images/pdf.png +0 -0
  163. data/lib/public/milksteak/jqueryFileTree/images/php.png +0 -0
  164. data/lib/public/milksteak/jqueryFileTree/images/picture.png +0 -0
  165. data/lib/public/milksteak/jqueryFileTree/images/ppt.png +0 -0
  166. data/lib/public/milksteak/jqueryFileTree/images/psd.png +0 -0
  167. data/lib/public/milksteak/jqueryFileTree/images/ruby.png +0 -0
  168. data/lib/public/milksteak/jqueryFileTree/images/script.png +0 -0
  169. data/lib/public/milksteak/jqueryFileTree/images/spinner.gif +0 -0
  170. data/lib/public/milksteak/jqueryFileTree/images/txt.png +0 -0
  171. data/lib/public/milksteak/jqueryFileTree/images/xls.png +0 -0
  172. data/lib/public/milksteak/jqueryFileTree/images/zip.png +0 -0
  173. data/lib/public/milksteak/jqueryFileTree/jqueryFileTree.css +91 -0
  174. data/lib/public/milksteak/jqueryFileTree/jqueryFileTree.js +95 -0
  175. data/lib/public/milksteak/js/app.js +0 -0
  176. data/lib/public/milksteak/js/backbone.js +1290 -0
  177. data/lib/public/milksteak/js/bootstrap-alert.js +91 -0
  178. data/lib/public/milksteak/js/bootstrap-button.js +98 -0
  179. data/lib/public/milksteak/js/bootstrap-carousel.js +154 -0
  180. data/lib/public/milksteak/js/bootstrap-collapse.js +136 -0
  181. data/lib/public/milksteak/js/bootstrap-dropdown.js +92 -0
  182. data/lib/public/milksteak/js/bootstrap-modal.js +209 -0
  183. data/lib/public/milksteak/js/bootstrap-popover.js +95 -0
  184. data/lib/public/milksteak/js/bootstrap-scrollspy.js +125 -0
  185. data/lib/public/milksteak/js/bootstrap-tab.js +130 -0
  186. data/lib/public/milksteak/js/bootstrap-tooltip.js +270 -0
  187. data/lib/public/milksteak/js/bootstrap-transition.js +51 -0
  188. data/lib/public/milksteak/js/bootstrap-typeahead.js +271 -0
  189. data/lib/public/milksteak/js/bootstrap.js +1722 -0
  190. data/lib/public/milksteak/js/bootstrap.min.js +1 -0
  191. data/lib/public/milksteak/js/jquery-ui.min.js +15 -0
  192. data/lib/public/milksteak/js/jquery.calendrical.js +490 -0
  193. data/lib/public/milksteak/js/jquery.easing.js +146 -0
  194. data/lib/public/milksteak/js/jquery.js +9252 -0
  195. data/lib/public/milksteak/js/mustache.js +536 -0
  196. data/lib/public/milksteak/js/prettify.js +28 -0
  197. data/lib/public/milksteak/js/underscore.js +999 -0
  198. data/lib/public/milksteak/markitup/.DS_Store +0 -0
  199. data/lib/public/milksteak/markitup/jquery.markitup.js +593 -0
  200. data/lib/public/milksteak/markitup/sets/default/images/bold.png +0 -0
  201. data/lib/public/milksteak/markitup/sets/default/images/clean.png +0 -0
  202. data/lib/public/milksteak/markitup/sets/default/images/image.png +0 -0
  203. data/lib/public/milksteak/markitup/sets/default/images/italic.png +0 -0
  204. data/lib/public/milksteak/markitup/sets/default/images/link.png +0 -0
  205. data/lib/public/milksteak/markitup/sets/default/images/list-bullet.png +0 -0
  206. data/lib/public/milksteak/markitup/sets/default/images/list-numeric.png +0 -0
  207. data/lib/public/milksteak/markitup/sets/default/images/picture.png +0 -0
  208. data/lib/public/milksteak/markitup/sets/default/images/preview.png +0 -0
  209. data/lib/public/milksteak/markitup/sets/default/images/stroke.png +0 -0
  210. data/lib/public/milksteak/markitup/sets/default/set.js +30 -0
  211. data/lib/public/milksteak/markitup/sets/default/style.css +34 -0
  212. data/lib/public/milksteak/markitup/sets/textile/images/bold.png +0 -0
  213. data/lib/public/milksteak/markitup/sets/textile/images/code.png +0 -0
  214. data/lib/public/milksteak/markitup/sets/textile/images/h1.png +0 -0
  215. data/lib/public/milksteak/markitup/sets/textile/images/h2.png +0 -0
  216. data/lib/public/milksteak/markitup/sets/textile/images/h3.png +0 -0
  217. data/lib/public/milksteak/markitup/sets/textile/images/h4.png +0 -0
  218. data/lib/public/milksteak/markitup/sets/textile/images/h5.png +0 -0
  219. data/lib/public/milksteak/markitup/sets/textile/images/h6.png +0 -0
  220. data/lib/public/milksteak/markitup/sets/textile/images/italic.png +0 -0
  221. data/lib/public/milksteak/markitup/sets/textile/images/link.png +0 -0
  222. data/lib/public/milksteak/markitup/sets/textile/images/list-bullet.png +0 -0
  223. data/lib/public/milksteak/markitup/sets/textile/images/list-numeric.png +0 -0
  224. data/lib/public/milksteak/markitup/sets/textile/images/paragraph.png +0 -0
  225. data/lib/public/milksteak/markitup/sets/textile/images/picture.png +0 -0
  226. data/lib/public/milksteak/markitup/sets/textile/images/preview.png +0 -0
  227. data/lib/public/milksteak/markitup/sets/textile/images/quotes.png +0 -0
  228. data/lib/public/milksteak/markitup/sets/textile/images/stroke.png +0 -0
  229. data/lib/public/milksteak/markitup/sets/textile/set.js +33 -0
  230. data/lib/public/milksteak/markitup/sets/textile/style.css +60 -0
  231. data/lib/public/milksteak/markitup/skins/markitup/images/bg-container.png +0 -0
  232. data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-bbcode.png +0 -0
  233. data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-dotclear.png +0 -0
  234. data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-html.png +0 -0
  235. data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-json.png +0 -0
  236. data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-markdown.png +0 -0
  237. data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-textile.png +0 -0
  238. data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-wiki.png +0 -0
  239. data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor-xml.png +0 -0
  240. data/lib/public/milksteak/markitup/skins/markitup/images/bg-editor.png +0 -0
  241. data/lib/public/milksteak/markitup/skins/markitup/images/handle.png +0 -0
  242. data/lib/public/milksteak/markitup/skins/markitup/images/menu.png +0 -0
  243. data/lib/public/milksteak/markitup/skins/markitup/images/submenu.png +0 -0
  244. data/lib/public/milksteak/markitup/skins/markitup/style.css +147 -0
  245. data/lib/public/milksteak/markitup/skins/simple/images/handle.png +0 -0
  246. data/lib/public/milksteak/markitup/skins/simple/images/menu.png +0 -0
  247. data/lib/public/milksteak/markitup/skins/simple/images/submenu.png +0 -0
  248. data/lib/public/milksteak/markitup/skins/simple/style.css +118 -0
  249. data/lib/public/milksteak/markitup/templates/preview.css +5 -0
  250. data/lib/public/milksteak/markitup/templates/preview.html +11 -0
  251. data/lib/public/milksteak/uploadify-v2.1.4/cancel.png +0 -0
  252. data/lib/public/milksteak/uploadify-v2.1.4/check.php +35 -0
  253. data/lib/public/milksteak/uploadify-v2.1.4/expressInstall.swf +0 -0
  254. data/lib/public/milksteak/uploadify-v2.1.4/jquery-1.4.2.min.js +154 -0
  255. data/lib/public/milksteak/uploadify-v2.1.4/jquery.uploadify.v2.1.4.js +296 -0
  256. data/lib/public/milksteak/uploadify-v2.1.4/jquery.uploadify.v2.1.4.min.js +26 -0
  257. data/lib/public/milksteak/uploadify-v2.1.4/swfobject.js +4 -0
  258. data/lib/public/milksteak/uploadify-v2.1.4/uploadify.allglyphs.swf +0 -0
  259. data/lib/public/milksteak/uploadify-v2.1.4/uploadify.css +53 -0
  260. data/lib/public/milksteak/uploadify-v2.1.4/uploadify.fla +0 -0
  261. data/lib/public/milksteak/uploadify-v2.1.4/uploadify.php +46 -0
  262. data/lib/public/milksteak/uploadify-v2.1.4/uploadify.swf +0 -0
  263. data/lib/public/milksteak/wmd/Markdown.Converter.js +1332 -0
  264. data/lib/public/milksteak/wmd/Markdown.Editor.js +2160 -0
  265. data/lib/public/milksteak/wmd/Markdown.Sanitizer.js +108 -0
  266. data/lib/public/milksteak/wmd/wmd-buttons.png +0 -0
  267. data/lib/public/milksteak/wmd/wmd.css +103 -0
  268. data/lib/public/milksteak/wymeditor/iframe/default/lbl-blockquote.png +0 -0
  269. data/lib/public/milksteak/wymeditor/iframe/default/lbl-h1.png +0 -0
  270. data/lib/public/milksteak/wymeditor/iframe/default/lbl-h2.png +0 -0
  271. data/lib/public/milksteak/wymeditor/iframe/default/lbl-h3.png +0 -0
  272. data/lib/public/milksteak/wymeditor/iframe/default/lbl-h4.png +0 -0
  273. data/lib/public/milksteak/wymeditor/iframe/default/lbl-h5.png +0 -0
  274. data/lib/public/milksteak/wymeditor/iframe/default/lbl-h6.png +0 -0
  275. data/lib/public/milksteak/wymeditor/iframe/default/lbl-p.png +0 -0
  276. data/lib/public/milksteak/wymeditor/iframe/default/lbl-pre.png +0 -0
  277. data/lib/public/milksteak/wymeditor/iframe/default/wymiframe.css +90 -0
  278. data/lib/public/milksteak/wymeditor/iframe/default/wymiframe.html +26 -0
  279. data/lib/public/milksteak/wymeditor/jquery.wymeditor.js +4688 -0
  280. data/lib/public/milksteak/wymeditor/jquery.wymeditor.min.js +1 -0
  281. data/lib/public/milksteak/wymeditor/jquery.wymeditor.pack.js +1 -0
  282. data/lib/public/milksteak/wymeditor/lang/bg.js +45 -0
  283. data/lib/public/milksteak/wymeditor/lang/ca.js +45 -0
  284. data/lib/public/milksteak/wymeditor/lang/cs.js +45 -0
  285. data/lib/public/milksteak/wymeditor/lang/cy.js +45 -0
  286. data/lib/public/milksteak/wymeditor/lang/de.js +45 -0
  287. data/lib/public/milksteak/wymeditor/lang/en.js +45 -0
  288. data/lib/public/milksteak/wymeditor/lang/es.js +45 -0
  289. data/lib/public/milksteak/wymeditor/lang/fa.js +46 -0
  290. data/lib/public/milksteak/wymeditor/lang/fi.js +44 -0
  291. data/lib/public/milksteak/wymeditor/lang/fr.js +45 -0
  292. data/lib/public/milksteak/wymeditor/lang/gl.js +45 -0
  293. data/lib/public/milksteak/wymeditor/lang/he.js +45 -0
  294. data/lib/public/milksteak/wymeditor/lang/hr.js +45 -0
  295. data/lib/public/milksteak/wymeditor/lang/hu.js +45 -0
  296. data/lib/public/milksteak/wymeditor/lang/it.js +45 -0
  297. data/lib/public/milksteak/wymeditor/lang/nb.js +45 -0
  298. data/lib/public/milksteak/wymeditor/lang/nl.js +45 -0
  299. data/lib/public/milksteak/wymeditor/lang/nn.js +45 -0
  300. data/lib/public/milksteak/wymeditor/lang/pl.js +45 -0
  301. data/lib/public/milksteak/wymeditor/lang/pt-br.js +45 -0
  302. data/lib/public/milksteak/wymeditor/lang/pt.js +45 -0
  303. data/lib/public/milksteak/wymeditor/lang/ru.js +45 -0
  304. data/lib/public/milksteak/wymeditor/lang/sv.js +45 -0
  305. data/lib/public/milksteak/wymeditor/lang/tr.js +45 -0
  306. data/lib/public/milksteak/wymeditor/lang/zh_cn.js +47 -0
  307. data/lib/public/milksteak/wymeditor/plugins/embed/jquery.wymeditor.embed.js +52 -0
  308. data/lib/public/milksteak/wymeditor/plugins/fullscreen/icon_fullscreen.gif +0 -0
  309. data/lib/public/milksteak/wymeditor/plugins/fullscreen/jquery.wymeditor.fullscreen.js +127 -0
  310. data/lib/public/milksteak/wymeditor/plugins/hovertools/jquery.wymeditor.hovertools.js +57 -0
  311. data/lib/public/milksteak/wymeditor/plugins/resizable/jquery.wymeditor.resizable.js +91 -0
  312. data/lib/public/milksteak/wymeditor/plugins/resizable/readme.txt +124 -0
  313. data/lib/public/milksteak/wymeditor/plugins/tidy/README +19 -0
  314. data/lib/public/milksteak/wymeditor/plugins/tidy/jquery.wymeditor.tidy.js +82 -0
  315. data/lib/public/milksteak/wymeditor/plugins/tidy/tidy.php +36 -0
  316. data/lib/public/milksteak/wymeditor/plugins/tidy/wand.png +0 -0
  317. data/lib/public/milksteak/wymeditor/skins/compact/icons.png +0 -0
  318. data/lib/public/milksteak/wymeditor/skins/compact/skin.css +134 -0
  319. data/lib/public/milksteak/wymeditor/skins/compact/skin.js +35 -0
  320. data/lib/public/milksteak/wymeditor/skins/default/icons.png +0 -0
  321. data/lib/public/milksteak/wymeditor/skins/default/skin.css +133 -0
  322. data/lib/public/milksteak/wymeditor/skins/default/skin.js +40 -0
  323. data/lib/public/milksteak/wymeditor/skins/minimal/images/bg.header.gif +0 -0
  324. data/lib/public/milksteak/wymeditor/skins/minimal/images/bg.selector.silver.gif +0 -0
  325. data/lib/public/milksteak/wymeditor/skins/minimal/images/bg.wymeditor.png +0 -0
  326. data/lib/public/milksteak/wymeditor/skins/minimal/images/icons.silver.gif +0 -0
  327. data/lib/public/milksteak/wymeditor/skins/minimal/skin.css +131 -0
  328. data/lib/public/milksteak/wymeditor/skins/minimal/skin.js +30 -0
  329. data/lib/public/milksteak/wymeditor/skins/silver/COPYING +674 -0
  330. data/lib/public/milksteak/wymeditor/skins/silver/README +27 -0
  331. data/lib/public/milksteak/wymeditor/skins/silver/images/bg.header.gif +0 -0
  332. data/lib/public/milksteak/wymeditor/skins/silver/images/bg.selector.silver.gif +0 -0
  333. data/lib/public/milksteak/wymeditor/skins/silver/images/bg.wymeditor.png +0 -0
  334. data/lib/public/milksteak/wymeditor/skins/silver/images/icons.silver.gif +0 -0
  335. data/lib/public/milksteak/wymeditor/skins/silver/skin.css +297 -0
  336. data/lib/public/milksteak/wymeditor/skins/silver/skin.js +61 -0
  337. data/lib/public/milksteak/wymeditor/skins/twopanels/icons.png +0 -0
  338. data/lib/public/milksteak/wymeditor/skins/twopanels/skin.css +134 -0
  339. data/lib/public/milksteak/wymeditor/skins/twopanels/skin.js +39 -0
  340. data/lib/public/milksteak/wymeditor/skins/wymeditor_icon.png +0 -0
  341. data/lib/views/layouts/admin.erb +8 -0
  342. data/lib/views/login.erb +1 -0
  343. data/milksteak.gemspec +30 -13
  344. data/spec/fixtures/pages/sample_page.yml +5 -0
  345. data/spec/lib/milksteak/cms_spec.rb +12 -0
  346. data/spec/models/page_spec.rb +58 -0
  347. data/spec/spec_helper.rb +19 -0
  348. metadata +429 -10
  349. data/LICENSE +0 -22
  350. data/README.md +0 -29
@@ -0,0 +1,339 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror: Markdown mode</title>
5
+ <link rel="stylesheet" href="../../lib/codemirror.css">
6
+ <script src="../../lib/codemirror.js"></script>
7
+ <script src="../xml/xml.js"></script>
8
+ <script src="markdown.js"></script>
9
+ <link rel="stylesheet" href="markdown.css">
10
+ <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
11
+ <link rel="stylesheet" href="../../doc/docs.css">
12
+ </head>
13
+ <body>
14
+ <h1>CodeMirror: Markdown mode</h1>
15
+
16
+ <!-- source: http://daringfireball.net/projects/markdown/basics.text -->
17
+ <form><textarea id="code" name="code">
18
+ Markdown: Basics
19
+ ================
20
+
21
+ &lt;ul id="ProjectSubmenu"&gt;
22
+ &lt;li&gt;&lt;a href="/projects/markdown/" title="Markdown Project Page"&gt;Main&lt;/a&gt;&lt;/li&gt;
23
+ &lt;li&gt;&lt;a class="selected" title="Markdown Basics"&gt;Basics&lt;/a&gt;&lt;/li&gt;
24
+ &lt;li&gt;&lt;a href="/projects/markdown/syntax" title="Markdown Syntax Documentation"&gt;Syntax&lt;/a&gt;&lt;/li&gt;
25
+ &lt;li&gt;&lt;a href="/projects/markdown/license" title="Pricing and License Information"&gt;License&lt;/a&gt;&lt;/li&gt;
26
+ &lt;li&gt;&lt;a href="/projects/markdown/dingus" title="Online Markdown Web Form"&gt;Dingus&lt;/a&gt;&lt;/li&gt;
27
+ &lt;/ul&gt;
28
+
29
+
30
+ Getting the Gist of Markdown's Formatting Syntax
31
+ ------------------------------------------------
32
+
33
+ This page offers a brief overview of what it's like to use Markdown.
34
+ The [syntax page] [s] provides complete, detailed documentation for
35
+ every feature, but Markdown should be very easy to pick up simply by
36
+ looking at a few examples of it in action. The examples on this page
37
+ are written in a before/after style, showing example syntax and the
38
+ HTML output produced by Markdown.
39
+
40
+ It's also helpful to simply try Markdown out; the [Dingus] [d] is a
41
+ web application that allows you type your own Markdown-formatted text
42
+ and translate it to XHTML.
43
+
44
+ **Note:** This document is itself written using Markdown; you
45
+ can [see the source for it by adding '.text' to the URL] [src].
46
+
47
+ [s]: /projects/markdown/syntax "Markdown Syntax"
48
+ [d]: /projects/markdown/dingus "Markdown Dingus"
49
+ [src]: /projects/markdown/basics.text
50
+
51
+
52
+ ## Paragraphs, Headers, Blockquotes ##
53
+
54
+ A paragraph is simply one or more consecutive lines of text, separated
55
+ by one or more blank lines. (A blank line is any line that looks like
56
+ a blank line -- a line containing nothing but spaces or tabs is
57
+ considered blank.) Normal paragraphs should not be indented with
58
+ spaces or tabs.
59
+
60
+ Markdown offers two styles of headers: *Setext* and *atx*.
61
+ Setext-style headers for `&lt;h1&gt;` and `&lt;h2&gt;` are created by
62
+ "underlining" with equal signs (`=`) and hyphens (`-`), respectively.
63
+ To create an atx-style header, you put 1-6 hash marks (`#`) at the
64
+ beginning of the line -- the number of hashes equals the resulting
65
+ HTML header level.
66
+
67
+ Blockquotes are indicated using email-style '`&gt;`' angle brackets.
68
+
69
+ Markdown:
70
+
71
+ A First Level Header
72
+ ====================
73
+
74
+ A Second Level Header
75
+ ---------------------
76
+
77
+ Now is the time for all good men to come to
78
+ the aid of their country. This is just a
79
+ regular paragraph.
80
+
81
+ The quick brown fox jumped over the lazy
82
+ dog's back.
83
+
84
+ ### Header 3
85
+
86
+ &gt; This is a blockquote.
87
+ &gt;
88
+ &gt; This is the second paragraph in the blockquote.
89
+ &gt;
90
+ &gt; ## This is an H2 in a blockquote
91
+
92
+
93
+ Output:
94
+
95
+ &lt;h1&gt;A First Level Header&lt;/h1&gt;
96
+
97
+ &lt;h2&gt;A Second Level Header&lt;/h2&gt;
98
+
99
+ &lt;p&gt;Now is the time for all good men to come to
100
+ the aid of their country. This is just a
101
+ regular paragraph.&lt;/p&gt;
102
+
103
+ &lt;p&gt;The quick brown fox jumped over the lazy
104
+ dog's back.&lt;/p&gt;
105
+
106
+ &lt;h3&gt;Header 3&lt;/h3&gt;
107
+
108
+ &lt;blockquote&gt;
109
+ &lt;p&gt;This is a blockquote.&lt;/p&gt;
110
+
111
+ &lt;p&gt;This is the second paragraph in the blockquote.&lt;/p&gt;
112
+
113
+ &lt;h2&gt;This is an H2 in a blockquote&lt;/h2&gt;
114
+ &lt;/blockquote&gt;
115
+
116
+
117
+
118
+ ### Phrase Emphasis ###
119
+
120
+ Markdown uses asterisks and underscores to indicate spans of emphasis.
121
+
122
+ Markdown:
123
+
124
+ Some of these words *are emphasized*.
125
+ Some of these words _are emphasized also_.
126
+
127
+ Use two asterisks for **strong emphasis**.
128
+ Or, if you prefer, __use two underscores instead__.
129
+
130
+ Output:
131
+
132
+ &lt;p&gt;Some of these words &lt;em&gt;are emphasized&lt;/em&gt;.
133
+ Some of these words &lt;em&gt;are emphasized also&lt;/em&gt;.&lt;/p&gt;
134
+
135
+ &lt;p&gt;Use two asterisks for &lt;strong&gt;strong emphasis&lt;/strong&gt;.
136
+ Or, if you prefer, &lt;strong&gt;use two underscores instead&lt;/strong&gt;.&lt;/p&gt;
137
+
138
+
139
+
140
+ ## Lists ##
141
+
142
+ Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
143
+ `+`, and `-`) as list markers. These three markers are
144
+ interchangable; this:
145
+
146
+ * Candy.
147
+ * Gum.
148
+ * Booze.
149
+
150
+ this:
151
+
152
+ + Candy.
153
+ + Gum.
154
+ + Booze.
155
+
156
+ and this:
157
+
158
+ - Candy.
159
+ - Gum.
160
+ - Booze.
161
+
162
+ all produce the same output:
163
+
164
+ &lt;ul&gt;
165
+ &lt;li&gt;Candy.&lt;/li&gt;
166
+ &lt;li&gt;Gum.&lt;/li&gt;
167
+ &lt;li&gt;Booze.&lt;/li&gt;
168
+ &lt;/ul&gt;
169
+
170
+ Ordered (numbered) lists use regular numbers, followed by periods, as
171
+ list markers:
172
+
173
+ 1. Red
174
+ 2. Green
175
+ 3. Blue
176
+
177
+ Output:
178
+
179
+ &lt;ol&gt;
180
+ &lt;li&gt;Red&lt;/li&gt;
181
+ &lt;li&gt;Green&lt;/li&gt;
182
+ &lt;li&gt;Blue&lt;/li&gt;
183
+ &lt;/ol&gt;
184
+
185
+ If you put blank lines between items, you'll get `&lt;p&gt;` tags for the
186
+ list item text. You can create multi-paragraph list items by indenting
187
+ the paragraphs by 4 spaces or 1 tab:
188
+
189
+ * A list item.
190
+
191
+ With multiple paragraphs.
192
+
193
+ * Another item in the list.
194
+
195
+ Output:
196
+
197
+ &lt;ul&gt;
198
+ &lt;li&gt;&lt;p&gt;A list item.&lt;/p&gt;
199
+ &lt;p&gt;With multiple paragraphs.&lt;/p&gt;&lt;/li&gt;
200
+ &lt;li&gt;&lt;p&gt;Another item in the list.&lt;/p&gt;&lt;/li&gt;
201
+ &lt;/ul&gt;
202
+
203
+
204
+
205
+ ### Links ###
206
+
207
+ Markdown supports two styles for creating links: *inline* and
208
+ *reference*. With both styles, you use square brackets to delimit the
209
+ text you want to turn into a link.
210
+
211
+ Inline-style links use parentheses immediately after the link text.
212
+ For example:
213
+
214
+ This is an [example link](http://example.com/).
215
+
216
+ Output:
217
+
218
+ &lt;p&gt;This is an &lt;a href="http://example.com/"&gt;
219
+ example link&lt;/a&gt;.&lt;/p&gt;
220
+
221
+ Optionally, you may include a title attribute in the parentheses:
222
+
223
+ This is an [example link](http://example.com/ "With a Title").
224
+
225
+ Output:
226
+
227
+ &lt;p&gt;This is an &lt;a href="http://example.com/" title="With a Title"&gt;
228
+ example link&lt;/a&gt;.&lt;/p&gt;
229
+
230
+ Reference-style links allow you to refer to your links by names, which
231
+ you define elsewhere in your document:
232
+
233
+ I get 10 times more traffic from [Google][1] than from
234
+ [Yahoo][2] or [MSN][3].
235
+
236
+ [1]: http://google.com/ "Google"
237
+ [2]: http://search.yahoo.com/ "Yahoo Search"
238
+ [3]: http://search.msn.com/ "MSN Search"
239
+
240
+ Output:
241
+
242
+ &lt;p&gt;I get 10 times more traffic from &lt;a href="http://google.com/"
243
+ title="Google"&gt;Google&lt;/a&gt; than from &lt;a href="http://search.yahoo.com/"
244
+ title="Yahoo Search"&gt;Yahoo&lt;/a&gt; or &lt;a href="http://search.msn.com/"
245
+ title="MSN Search"&gt;MSN&lt;/a&gt;.&lt;/p&gt;
246
+
247
+ The title attribute is optional. Link names may contain letters,
248
+ numbers and spaces, but are *not* case sensitive:
249
+
250
+ I start my morning with a cup of coffee and
251
+ [The New York Times][NY Times].
252
+
253
+ [ny times]: http://www.nytimes.com/
254
+
255
+ Output:
256
+
257
+ &lt;p&gt;I start my morning with a cup of coffee and
258
+ &lt;a href="http://www.nytimes.com/"&gt;The New York Times&lt;/a&gt;.&lt;/p&gt;
259
+
260
+
261
+ ### Images ###
262
+
263
+ Image syntax is very much like link syntax.
264
+
265
+ Inline (titles are optional):
266
+
267
+ ![alt text](/path/to/img.jpg "Title")
268
+
269
+ Reference-style:
270
+
271
+ ![alt text][id]
272
+
273
+ [id]: /path/to/img.jpg "Title"
274
+
275
+ Both of the above examples produce the same output:
276
+
277
+ &lt;img src="/path/to/img.jpg" alt="alt text" title="Title" /&gt;
278
+
279
+
280
+
281
+ ### Code ###
282
+
283
+ In a regular paragraph, you can create code span by wrapping text in
284
+ backtick quotes. Any ampersands (`&amp;`) and angle brackets (`&lt;` or
285
+ `&gt;`) will automatically be translated into HTML entities. This makes
286
+ it easy to use Markdown to write about HTML example code:
287
+
288
+ I strongly recommend against using any `&lt;blink&gt;` tags.
289
+
290
+ I wish SmartyPants used named entities like `&amp;mdash;`
291
+ instead of decimal-encoded entites like `&amp;#8212;`.
292
+
293
+ Output:
294
+
295
+ &lt;p&gt;I strongly recommend against using any
296
+ &lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;
297
+
298
+ &lt;p&gt;I wish SmartyPants used named entities like
299
+ &lt;code&gt;&amp;amp;mdash;&lt;/code&gt; instead of decimal-encoded
300
+ entites like &lt;code&gt;&amp;amp;#8212;&lt;/code&gt;.&lt;/p&gt;
301
+
302
+
303
+ To specify an entire block of pre-formatted code, indent every line of
304
+ the block by 4 spaces or 1 tab. Just like with code spans, `&amp;`, `&lt;`,
305
+ and `&gt;` characters will be escaped automatically.
306
+
307
+ Markdown:
308
+
309
+ If you want your page to validate under XHTML 1.0 Strict,
310
+ you've got to put paragraph tags in your blockquotes:
311
+
312
+ &lt;blockquote&gt;
313
+ &lt;p&gt;For example.&lt;/p&gt;
314
+ &lt;/blockquote&gt;
315
+
316
+ Output:
317
+
318
+ &lt;p&gt;If you want your page to validate under XHTML 1.0 Strict,
319
+ you've got to put paragraph tags in your blockquotes:&lt;/p&gt;
320
+
321
+ &lt;pre&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;
322
+ &amp;lt;p&amp;gt;For example.&amp;lt;/p&amp;gt;
323
+ &amp;lt;/blockquote&amp;gt;
324
+ &lt;/code&gt;&lt;/pre&gt;
325
+ </textarea></form>
326
+
327
+ <script>
328
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
329
+ mode: 'markdown',
330
+ lineNumbers: true,
331
+ matchBrackets: true,
332
+ theme: "default"
333
+ });
334
+ </script>
335
+
336
+ <p><strong>MIME types defined:</strong> <code>text/x-markdown</code>.</p>
337
+
338
+ </body>
339
+ </html>
@@ -0,0 +1,276 @@
1
+ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
2
+
3
+ var htmlMode = CodeMirror.getMode(cmCfg, { name: 'xml', htmlMode: true });
4
+
5
+ var header = 'header'
6
+ , code = 'comment'
7
+ , quote = 'quote'
8
+ , list = 'string'
9
+ , hr = 'hr'
10
+ , linktext = 'link'
11
+ , linkhref = 'string'
12
+ , em = 'em'
13
+ , strong = 'strong'
14
+ , emstrong = 'emstrong';
15
+
16
+ var hrRE = /^[*-=_]/
17
+ , ulRE = /^[*-+]\s+/
18
+ , olRE = /^[0-9]+\.\s+/
19
+ , headerRE = /^(?:\={3,}|-{3,})$/
20
+ , codeRE = /^(k:\t|\s{4,})/
21
+ , textRE = /^[^\[*_\\<>`]+/;
22
+
23
+ function switchInline(stream, state, f) {
24
+ state.f = state.inline = f;
25
+ return f(stream, state);
26
+ }
27
+
28
+ function switchBlock(stream, state, f) {
29
+ state.f = state.block = f;
30
+ return f(stream, state);
31
+ }
32
+
33
+
34
+ // Blocks
35
+
36
+ function blockNormal(stream, state) {
37
+ var match;
38
+ if (stream.match(codeRE)) {
39
+ stream.skipToEnd();
40
+ return code;
41
+ } else if (stream.eatSpace()) {
42
+ return null;
43
+ } else if (stream.peek() === '#' || stream.match(headerRE)) {
44
+ state.header = true;
45
+ } else if (stream.eat('>')) {
46
+ state.indentation++;
47
+ state.quote = true;
48
+ } else if (stream.peek() === '[') {
49
+ return switchInline(stream, state, footnoteLink);
50
+ } else if (hrRE.test(stream.peek())) {
51
+ var re = new RegExp('(?:\s*['+stream.peek()+']){3,}$');
52
+ if (stream.match(re, true)) {
53
+ return hr;
54
+ }
55
+ } else if (match = stream.match(ulRE, true) || stream.match(olRE, true)) {
56
+ state.indentation += match[0].length;
57
+ return list;
58
+ }
59
+
60
+ return switchInline(stream, state, state.inline);
61
+ }
62
+
63
+ function htmlBlock(stream, state) {
64
+ var style = htmlMode.token(stream, state.htmlState);
65
+ if (style === 'tag' && state.htmlState.type !== 'openTag' && !state.htmlState.context) {
66
+ state.f = inlineNormal;
67
+ state.block = blockNormal;
68
+ }
69
+ return style;
70
+ }
71
+
72
+
73
+ // Inline
74
+ function getType(state) {
75
+
76
+ // Set defaults
77
+ returnValue = '';
78
+
79
+ // Strong / Emphasis
80
+ if(state.strong){
81
+ if(state.em){
82
+ returnValue += (returnValue ? ' ' : '') + emstrong;
83
+ } else {
84
+ returnValue += (returnValue ? ' ' : '') + strong;
85
+ }
86
+ } else {
87
+ if(state.em){
88
+ returnValue += (returnValue ? ' ' : '') + em;
89
+ }
90
+ }
91
+
92
+ // Header
93
+ if(state.header){
94
+ returnValue += (returnValue ? ' ' : '') + header;
95
+ }
96
+
97
+ // Quotes
98
+ if(state.quote){
99
+ returnValue += (returnValue ? ' ' : '') + quote;
100
+ }
101
+
102
+ // Check valud and return
103
+ if(!returnValue){
104
+ returnValue = null;
105
+ }
106
+ return returnValue;
107
+
108
+ }
109
+
110
+ function handleText(stream, state) {
111
+ if (stream.match(textRE, true)) {
112
+ return getType(state);
113
+ }
114
+ return undefined;
115
+ }
116
+
117
+ function inlineNormal(stream, state) {
118
+ var style = state.text(stream, state)
119
+ if (typeof style !== 'undefined')
120
+ return style;
121
+
122
+ var ch = stream.next();
123
+
124
+ if (ch === '\\') {
125
+ stream.next();
126
+ return getType(state);
127
+ }
128
+ if (ch === '`') {
129
+ return switchInline(stream, state, inlineElement(code, '`'));
130
+ }
131
+ if (ch === '[') {
132
+ return switchInline(stream, state, linkText);
133
+ }
134
+ if (ch === '<' && stream.match(/^\w/, false)) {
135
+ stream.backUp(1);
136
+ return switchBlock(stream, state, htmlBlock);
137
+ }
138
+
139
+ var t = getType(state);
140
+ if (ch === '*' || ch === '_') {
141
+ if (stream.eat(ch)) {
142
+ return (state.strong = !state.strong) ? getType(state) : t;
143
+ }
144
+ return (state.em = !state.em) ? getType(state) : t;
145
+ }
146
+
147
+ return getType(state);
148
+ }
149
+
150
+ function linkText(stream, state) {
151
+ while (!stream.eol()) {
152
+ var ch = stream.next();
153
+ if (ch === '\\') stream.next();
154
+ if (ch === ']') {
155
+ state.inline = state.f = linkHref;
156
+ return linktext;
157
+ }
158
+ }
159
+ return linktext;
160
+ }
161
+
162
+ function linkHref(stream, state) {
163
+ stream.eatSpace();
164
+ var ch = stream.next();
165
+ if (ch === '(' || ch === '[') {
166
+ return switchInline(stream, state, inlineElement(linkhref, ch === '(' ? ')' : ']'));
167
+ }
168
+ return 'error';
169
+ }
170
+
171
+ function footnoteLink(stream, state) {
172
+ if (stream.match(/^[^\]]*\]:/, true)) {
173
+ state.f = footnoteUrl;
174
+ return linktext;
175
+ }
176
+ return switchInline(stream, state, inlineNormal);
177
+ }
178
+
179
+ function footnoteUrl(stream, state) {
180
+ stream.eatSpace();
181
+ stream.match(/^[^\s]+/, true);
182
+ state.f = state.inline = inlineNormal;
183
+ return linkhref;
184
+ }
185
+
186
+ function inlineRE(endChar) {
187
+ if (!inlineRE[endChar]) {
188
+ // match any not-escaped-non-endChar and any escaped char
189
+ // then match endChar or eol
190
+ inlineRE[endChar] = new RegExp('^(?:[^\\\\\\' + endChar + ']|\\\\.)*(?:\\' + endChar + '|$)');
191
+ }
192
+ return inlineRE[endChar];
193
+ }
194
+
195
+ function inlineElement(type, endChar, next) {
196
+ next = next || inlineNormal;
197
+ return function(stream, state) {
198
+ stream.match(inlineRE(endChar));
199
+ state.inline = state.f = next;
200
+ return type;
201
+ };
202
+ }
203
+
204
+ return {
205
+ startState: function() {
206
+ return {
207
+ f: blockNormal,
208
+
209
+ block: blockNormal,
210
+ htmlState: htmlMode.startState(),
211
+ indentation: 0,
212
+
213
+ inline: inlineNormal,
214
+ text: handleText,
215
+ em: false,
216
+ strong: false,
217
+ header: false,
218
+ quote: false
219
+ };
220
+ },
221
+
222
+ copyState: function(s) {
223
+ return {
224
+ f: s.f,
225
+
226
+ block: s.block,
227
+ htmlState: CodeMirror.copyState(htmlMode, s.htmlState),
228
+ indentation: s.indentation,
229
+
230
+ inline: s.inline,
231
+ text: s.text,
232
+ em: s.em,
233
+ strong: s.strong,
234
+ header: s.header,
235
+ quote: s.quote
236
+ };
237
+ },
238
+
239
+ token: function(stream, state) {
240
+ if (stream.sol()) {
241
+ // Reset EM state
242
+ state.em = false;
243
+ // Reset STRONG state
244
+ state.strong = false;
245
+ // Reset state.header
246
+ state.header = false;
247
+ // Reset state.quote
248
+ state.quote = false;
249
+
250
+ state.f = state.block;
251
+ var previousIndentation = state.indentation
252
+ , currentIndentation = 0;
253
+ while (previousIndentation > 0) {
254
+ if (stream.eat(' ')) {
255
+ previousIndentation--;
256
+ currentIndentation++;
257
+ } else if (previousIndentation >= 4 && stream.eat('\t')) {
258
+ previousIndentation -= 4;
259
+ currentIndentation += 4;
260
+ } else {
261
+ break;
262
+ }
263
+ }
264
+ state.indentation = currentIndentation;
265
+
266
+ if (currentIndentation > 0) return null;
267
+ }
268
+ return state.f(stream, state);
269
+ },
270
+
271
+ getType: getType
272
+ };
273
+
274
+ });
275
+
276
+ CodeMirror.defineMIME("text/x-markdown", "markdown");
@@ -0,0 +1,41 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror: MySQL mode</title>
5
+ <link rel="stylesheet" href="../../lib/codemirror.css">
6
+ <script src="../../lib/codemirror.js"></script>
7
+ <script src="mysql.js"></script>
8
+ <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
9
+ <link rel="stylesheet" href="../../doc/docs.css">
10
+ </head>
11
+ <body>
12
+ <h1>CodeMirror: MySQL mode</h1>
13
+ <form><textarea id="code" name="code">
14
+ -- Comment for the code
15
+ -- MySQL Mode for CodeMirror2 by MySQLTools http://github.com/partydroid/MySQL-Tools
16
+ SELECT UNIQUE `var1` as `variable`,
17
+ MAX(`var5`) as `max`,
18
+ MIN(`var5`) as `min`,
19
+ STDEV(`var5`) as `dev`
20
+ FROM `table`
21
+
22
+ LEFT JOIN `table2` ON `var2` = `variable`
23
+
24
+ ORDER BY `var3` DESC
25
+ GROUP BY `groupvar`
26
+
27
+ LIMIT 0,30;
28
+
29
+ </textarea></form>
30
+ <script>
31
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
32
+ mode: "text/x-mysql",
33
+ tabMode: "indent",
34
+ matchBrackets: true
35
+ });
36
+ </script>
37
+
38
+ <p><strong>MIME types defined:</strong> <code>text/x-mysql</code>.</p>
39
+
40
+ </body>
41
+ </html>