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,200 @@
1
+ CodeMirror.defineMode("ruby", function(config, parserConfig) {
2
+ function wordObj(words) {
3
+ var o = {};
4
+ for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
5
+ return o;
6
+ }
7
+ var keywords = wordObj([
8
+ "alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else",
9
+ "elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or",
10
+ "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless",
11
+ "until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc",
12
+ "caller", "lambda", "proc", "public", "protected", "private", "require", "load",
13
+ "require_relative", "extend", "autoload"
14
+ ]);
15
+ var indentWords = wordObj(["def", "class", "case", "for", "while", "do", "module", "then",
16
+ "catch", "loop", "proc", "begin"]);
17
+ var dedentWords = wordObj(["end", "until"]);
18
+ var matching = {"[": "]", "{": "}", "(": ")"};
19
+ var curPunc;
20
+
21
+ function chain(newtok, stream, state) {
22
+ state.tokenize.push(newtok);
23
+ return newtok(stream, state);
24
+ }
25
+
26
+ function tokenBase(stream, state) {
27
+ curPunc = null;
28
+ if (stream.sol() && stream.match("=begin") && stream.eol()) {
29
+ state.tokenize.push(readBlockComment);
30
+ return "comment";
31
+ }
32
+ if (stream.eatSpace()) return null;
33
+ var ch = stream.next();
34
+ if (ch == "`" || ch == "'" || ch == '"' ||
35
+ (ch == "/" && !stream.eol() && stream.peek() != " ")) {
36
+ return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state);
37
+ } else if (ch == "%") {
38
+ var style, embed = false;
39
+ if (stream.eat("s")) style = "atom";
40
+ else if (stream.eat(/[WQ]/)) { style = "string"; embed = true; }
41
+ else if (stream.eat(/[wxqr]/)) style = "string";
42
+ var delim = stream.eat(/[^\w\s]/);
43
+ if (!delim) return "operator";
44
+ if (matching.propertyIsEnumerable(delim)) delim = matching[delim];
45
+ return chain(readQuoted(delim, style, embed, true), stream, state);
46
+ } else if (ch == "#") {
47
+ stream.skipToEnd();
48
+ return "comment";
49
+ } else if (ch == "<" && stream.eat("<")) {
50
+ stream.eat("-");
51
+ stream.eat(/[\'\"\`]/);
52
+ var match = stream.match(/^\w+/);
53
+ stream.eat(/[\'\"\`]/);
54
+ if (match) return chain(readHereDoc(match[0]), stream, state);
55
+ return null;
56
+ } else if (ch == "0") {
57
+ if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/);
58
+ else if (stream.eat("b")) stream.eatWhile(/[01]/);
59
+ else stream.eatWhile(/[0-7]/);
60
+ return "number";
61
+ } else if (/\d/.test(ch)) {
62
+ stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/);
63
+ return "number";
64
+ } else if (ch == "?") {
65
+ while (stream.match(/^\\[CM]-/)) {}
66
+ if (stream.eat("\\")) stream.eatWhile(/\w/);
67
+ else stream.next();
68
+ return "string";
69
+ } else if (ch == ":") {
70
+ if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state);
71
+ if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state);
72
+ stream.eatWhile(/[\w\?]/);
73
+ return "atom";
74
+ } else if (ch == "@") {
75
+ stream.eat("@");
76
+ stream.eatWhile(/[\w\?]/);
77
+ return "variable-2";
78
+ } else if (ch == "$") {
79
+ stream.next();
80
+ stream.eatWhile(/[\w\?]/);
81
+ return "variable-3";
82
+ } else if (/\w/.test(ch)) {
83
+ stream.eatWhile(/[\w\?]/);
84
+ if (stream.eat(":")) return "atom";
85
+ return "ident";
86
+ } else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) {
87
+ curPunc = "|";
88
+ return null;
89
+ } else if (/[\(\)\[\]{}\\;]/.test(ch)) {
90
+ curPunc = ch;
91
+ return null;
92
+ } else if (ch == "-" && stream.eat(">")) {
93
+ return "arrow";
94
+ } else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) {
95
+ stream.eatWhile(/[=+\-\/*:\.^%<>~|]/);
96
+ return "operator";
97
+ } else {
98
+ return null;
99
+ }
100
+ }
101
+
102
+ function tokenBaseUntilBrace() {
103
+ var depth = 1;
104
+ return function(stream, state) {
105
+ if (stream.peek() == "}") {
106
+ depth--;
107
+ if (depth == 0) {
108
+ state.tokenize.pop();
109
+ return state.tokenize[state.tokenize.length-1](stream, state);
110
+ }
111
+ } else if (stream.peek() == "{") {
112
+ depth++;
113
+ }
114
+ return tokenBase(stream, state);
115
+ };
116
+ }
117
+ function readQuoted(quote, style, embed, unescaped) {
118
+ return function(stream, state) {
119
+ var escaped = false, ch;
120
+ while ((ch = stream.next()) != null) {
121
+ if (ch == quote && (unescaped || !escaped)) {
122
+ state.tokenize.pop();
123
+ break;
124
+ }
125
+ if (embed && ch == "#" && !escaped && stream.eat("{")) {
126
+ state.tokenize.push(tokenBaseUntilBrace(arguments.callee));
127
+ break;
128
+ }
129
+ escaped = !escaped && ch == "\\";
130
+ }
131
+ return style;
132
+ };
133
+ }
134
+ function readHereDoc(phrase) {
135
+ return function(stream, state) {
136
+ if (stream.match(phrase)) state.tokenize.pop();
137
+ else stream.skipToEnd();
138
+ return "string";
139
+ };
140
+ }
141
+ function readBlockComment(stream, state) {
142
+ if (stream.sol() && stream.match("=end") && stream.eol())
143
+ state.tokenize.pop();
144
+ stream.skipToEnd();
145
+ return "comment";
146
+ }
147
+
148
+ return {
149
+ startState: function() {
150
+ return {tokenize: [tokenBase],
151
+ indented: 0,
152
+ context: {type: "top", indented: -config.indentUnit},
153
+ continuedLine: false,
154
+ lastTok: null,
155
+ varList: false};
156
+ },
157
+
158
+ token: function(stream, state) {
159
+ if (stream.sol()) state.indented = stream.indentation();
160
+ var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype;
161
+ if (style == "ident") {
162
+ var word = stream.current();
163
+ style = keywords.propertyIsEnumerable(stream.current()) ? "keyword"
164
+ : /^[A-Z]/.test(word) ? "tag"
165
+ : (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def"
166
+ : "variable";
167
+ if (indentWords.propertyIsEnumerable(word)) kwtype = "indent";
168
+ else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent";
169
+ else if ((word == "if" || word == "unless") && stream.column() == stream.indentation())
170
+ kwtype = "indent";
171
+ }
172
+ if (curPunc || (style && style != "comment")) state.lastTok = word || curPunc || style;
173
+ if (curPunc == "|") state.varList = !state.varList;
174
+
175
+ if (kwtype == "indent" || /[\(\[\{]/.test(curPunc))
176
+ state.context = {prev: state.context, type: curPunc || style, indented: state.indented};
177
+ else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev)
178
+ state.context = state.context.prev;
179
+
180
+ if (stream.eol())
181
+ state.continuedLine = (curPunc == "\\" || style == "operator");
182
+ return style;
183
+ },
184
+
185
+ indent: function(state, textAfter) {
186
+ if (state.tokenize[state.tokenize.length-1] != tokenBase) return 0;
187
+ var firstChar = textAfter && textAfter.charAt(0);
188
+ var ct = state.context;
189
+ var closing = ct.type == matching[firstChar] ||
190
+ ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter);
191
+ return ct.indented + (closing ? 0 : config.indentUnit) +
192
+ (state.continuedLine ? config.indentUnit : 0);
193
+ },
194
+ electricChars: "}de" // enD and rescuE
195
+
196
+ };
197
+ });
198
+
199
+ CodeMirror.defineMIME("text/x-ruby", "ruby");
200
+
@@ -0,0 +1,48 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror: Rust mode</title>
5
+ <link rel="stylesheet" href="../../lib/codemirror.css">
6
+ <script src="../../lib/codemirror.js"></script>
7
+ <script src="rust.js"></script>
8
+ <link rel="stylesheet" href="../../doc/docs.css">
9
+ <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
10
+ </head>
11
+ <body>
12
+ <h1>CodeMirror: Rust mode</h1>
13
+
14
+ <div><textarea id="code" name="code">
15
+ // Demo code.
16
+
17
+ type foo<T> = int;
18
+ enum bar {
19
+ some(int, foo<float>),
20
+ none
21
+ }
22
+
23
+ fn check_crate(x: int) {
24
+ let v = 10;
25
+ alt foo {
26
+ 1 to 3 {
27
+ print_foo();
28
+ if x {
29
+ blah() + 10;
30
+ }
31
+ }
32
+ (x, y) { "bye" }
33
+ _ { "hi" }
34
+ }
35
+ }
36
+ </textarea></div>
37
+
38
+ <script>
39
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
40
+ lineNumbers: true,
41
+ matchBrackets: true,
42
+ tabMode: "indent"
43
+ });
44
+ </script>
45
+
46
+ <p><strong>MIME types defined:</strong> <code>text/x-rustsrc</code>.</p>
47
+ </body>
48
+ </html>
@@ -0,0 +1,432 @@
1
+ CodeMirror.defineMode("rust", function() {
2
+ var indentUnit = 4, altIndentUnit = 2;
3
+ var valKeywords = {
4
+ "if": "if-style", "while": "if-style", "else": "else-style",
5
+ "do": "else-style", "ret": "else-style", "fail": "else-style",
6
+ "break": "atom", "cont": "atom", "const": "let", "resource": "fn",
7
+ "let": "let", "fn": "fn", "for": "for", "alt": "alt", "iface": "iface",
8
+ "impl": "impl", "type": "type", "enum": "enum", "mod": "mod",
9
+ "as": "op", "true": "atom", "false": "atom", "assert": "op", "check": "op",
10
+ "claim": "op", "native": "ignore", "unsafe": "ignore", "import": "else-style",
11
+ "export": "else-style", "copy": "op", "log": "op", "log_err": "op",
12
+ "use": "op", "bind": "op", "self": "atom"
13
+ };
14
+ var typeKeywords = function() {
15
+ var keywords = {"fn": "fn", "block": "fn", "obj": "obj"};
16
+ var atoms = "bool uint int i8 i16 i32 i64 u8 u16 u32 u64 float f32 f64 str char".split(" ");
17
+ for (var i = 0, e = atoms.length; i < e; ++i) keywords[atoms[i]] = "atom";
18
+ return keywords;
19
+ }();
20
+ var operatorChar = /[+\-*&%=<>!?|\.@]/;
21
+
22
+ // Tokenizer
23
+
24
+ // Used as scratch variable to communicate multiple values without
25
+ // consing up tons of objects.
26
+ var tcat, content;
27
+ function r(tc, style) {
28
+ tcat = tc;
29
+ return style;
30
+ }
31
+
32
+ function tokenBase(stream, state) {
33
+ var ch = stream.next();
34
+ if (ch == '"') {
35
+ state.tokenize = tokenString;
36
+ return state.tokenize(stream, state);
37
+ }
38
+ if (ch == "'") {
39
+ tcat = "atom";
40
+ if (stream.eat("\\")) {
41
+ if (stream.skipTo("'")) { stream.next(); return "string"; }
42
+ else { return "error"; }
43
+ } else {
44
+ stream.next();
45
+ return stream.eat("'") ? "string" : "error";
46
+ }
47
+ }
48
+ if (ch == "/") {
49
+ if (stream.eat("/")) { stream.skipToEnd(); return "comment"; }
50
+ if (stream.eat("*")) {
51
+ state.tokenize = tokenComment(1);
52
+ return state.tokenize(stream, state);
53
+ }
54
+ }
55
+ if (ch == "#") {
56
+ if (stream.eat("[")) { tcat = "open-attr"; return null; }
57
+ stream.eatWhile(/\w/);
58
+ return r("macro", "meta");
59
+ }
60
+ if (ch == ":" && stream.match(":<")) {
61
+ return r("op", null);
62
+ }
63
+ if (ch.match(/\d/) || (ch == "." && stream.eat(/\d/))) {
64
+ var flp = false;
65
+ if (!stream.match(/^x[\da-f]+/i) && !stream.match(/^b[01]+/)) {
66
+ stream.eatWhile(/\d/);
67
+ if (stream.eat(".")) { flp = true; stream.eatWhile(/\d/); }
68
+ if (stream.match(/^e[+\-]?\d+/i)) { flp = true; }
69
+ }
70
+ if (flp) stream.match(/^f(?:32|64)/);
71
+ else stream.match(/^[ui](?:8|16|32|64)/);
72
+ return r("atom", "number");
73
+ }
74
+ if (ch.match(/[()\[\]{}:;,]/)) return r(ch, null);
75
+ if (ch == "-" && stream.eat(">")) return r("->", null);
76
+ if (ch.match(operatorChar)) {
77
+ stream.eatWhile(operatorChar);
78
+ return r("op", null);
79
+ }
80
+ stream.eatWhile(/\w/);
81
+ content = stream.current();
82
+ if (stream.match(/^::\w/)) {
83
+ stream.backUp(1);
84
+ return r("prefix", "variable-2");
85
+ }
86
+ if (state.keywords.propertyIsEnumerable(content))
87
+ return r(state.keywords[content], content.match(/true|false/) ? "atom" : "keyword");
88
+ return r("name", "variable");
89
+ }
90
+
91
+ function tokenString(stream, state) {
92
+ var ch, escaped = false;
93
+ while (ch = stream.next()) {
94
+ if (ch == '"' && !escaped) {
95
+ state.tokenize = tokenBase;
96
+ return r("atom", "string");
97
+ }
98
+ escaped = !escaped && ch == "\\";
99
+ }
100
+ // Hack to not confuse the parser when a string is split in
101
+ // pieces.
102
+ return r("op", "string");
103
+ }
104
+
105
+ function tokenComment(depth) {
106
+ return function(stream, state) {
107
+ var lastCh = null, ch;
108
+ while (ch = stream.next()) {
109
+ if (ch == "/" && lastCh == "*") {
110
+ if (depth == 1) {
111
+ state.tokenize = tokenBase;
112
+ break;
113
+ } else {
114
+ state.tokenize = tokenComment(depth - 1);
115
+ return state.tokenize(stream, state);
116
+ }
117
+ }
118
+ if (ch == "*" && lastCh == "/") {
119
+ state.tokenize = tokenComment(depth + 1);
120
+ return state.tokenize(stream, state);
121
+ }
122
+ lastCh = ch;
123
+ }
124
+ return "comment";
125
+ };
126
+ }
127
+
128
+ // Parser
129
+
130
+ var cx = {state: null, stream: null, marked: null, cc: null};
131
+ function pass() {
132
+ for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
133
+ }
134
+ function cont() {
135
+ pass.apply(null, arguments);
136
+ return true;
137
+ }
138
+
139
+ function pushlex(type, info) {
140
+ var result = function() {
141
+ var state = cx.state;
142
+ state.lexical = {indented: state.indented, column: cx.stream.column(),
143
+ type: type, prev: state.lexical, info: info};
144
+ };
145
+ result.lex = true;
146
+ return result;
147
+ }
148
+ function poplex() {
149
+ var state = cx.state;
150
+ if (state.lexical.prev) {
151
+ if (state.lexical.type == ")")
152
+ state.indented = state.lexical.indented;
153
+ state.lexical = state.lexical.prev;
154
+ }
155
+ }
156
+ function typecx() { cx.state.keywords = typeKeywords; }
157
+ function valcx() { cx.state.keywords = valKeywords; }
158
+ poplex.lex = typecx.lex = valcx.lex = true;
159
+
160
+ function commasep(comb, end) {
161
+ function more(type) {
162
+ if (type == ",") return cont(comb, more);
163
+ if (type == end) return cont();
164
+ return cont(more);
165
+ }
166
+ return function(type) {
167
+ if (type == end) return cont();
168
+ return pass(comb, more);
169
+ };
170
+ }
171
+
172
+ function stat_of(comb, tag) {
173
+ return cont(pushlex("stat", tag), comb, poplex, block);
174
+ }
175
+ function block(type) {
176
+ if (type == "}") return cont();
177
+ if (type == "let") return stat_of(letdef1, "let");
178
+ if (type == "fn") return stat_of(fndef);
179
+ if (type == "type") return cont(pushlex("stat"), tydef, endstatement, poplex, block);
180
+ if (type == "enum") return stat_of(enumdef);
181
+ if (type == "mod") return stat_of(mod);
182
+ if (type == "iface") return stat_of(iface);
183
+ if (type == "impl") return stat_of(impl);
184
+ if (type == "open-attr") return cont(pushlex("]"), commasep(expression, "]"), poplex);
185
+ if (type == "ignore" || type.match(/[\]\);,]/)) return cont(block);
186
+ return pass(pushlex("stat"), expression, poplex, endstatement, block);
187
+ }
188
+ function endstatement(type) {
189
+ if (type == ";") return cont();
190
+ return pass();
191
+ }
192
+ function expression(type) {
193
+ if (type == "atom" || type == "name") return cont(maybeop);
194
+ if (type == "{") return cont(pushlex("}"), exprbrace, poplex);
195
+ if (type.match(/[\[\(]/)) return matchBrackets(type, expression);
196
+ if (type.match(/[\]\)\};,]/)) return pass();
197
+ if (type == "if-style") return cont(expression, expression);
198
+ if (type == "else-style" || type == "op") return cont(expression);
199
+ if (type == "for") return cont(pattern, maybetype, inop, expression, expression);
200
+ if (type == "alt") return cont(expression, altbody);
201
+ if (type == "fn") return cont(fndef);
202
+ if (type == "macro") return cont(macro);
203
+ return cont();
204
+ }
205
+ function maybeop(type) {
206
+ if (content == ".") return cont(maybeprop);
207
+ if (content == "::<"){return cont(typarams, maybeop);}
208
+ if (type == "op" || content == ":") return cont(expression);
209
+ if (type == "(" || type == "[") return matchBrackets(type, expression);
210
+ return pass();
211
+ }
212
+ function maybeprop(type) {
213
+ if (content.match(/^\w+$/)) {cx.marked = "variable"; return cont(maybeop);}
214
+ return pass(expression);
215
+ }
216
+ function exprbrace(type) {
217
+ if (type == "op") {
218
+ if (content == "|") return cont(blockvars, poplex, pushlex("}", "block"), block);
219
+ if (content == "||") return cont(poplex, pushlex("}", "block"), block);
220
+ }
221
+ if (content == "mutable" || (content.match(/^\w+$/) && cx.stream.peek() == ":"
222
+ && !cx.stream.match("::", false)))
223
+ return pass(record_of(expression));
224
+ return pass(block);
225
+ }
226
+ function record_of(comb) {
227
+ function ro(type) {
228
+ if (content == "mutable" || content == "with") {cx.marked = "keyword"; return cont(ro);}
229
+ if (content.match(/^\w*$/)) {cx.marked = "variable"; return cont(ro);}
230
+ if (type == ":") return cont(comb, ro);
231
+ if (type == "}") return cont();
232
+ return cont(ro);
233
+ }
234
+ return ro;
235
+ }
236
+ function blockvars(type) {
237
+ if (type == "name") {cx.marked = "def"; return cont(blockvars);}
238
+ if (type == "op" && content == "|") return cont();
239
+ return cont(blockvars);
240
+ }
241
+
242
+ function letdef1(type) {
243
+ if (type.match(/[\]\)\};]/)) return cont();
244
+ if (content == "=") return cont(expression, letdef2);
245
+ if (type == ",") return cont(letdef1);
246
+ return pass(pattern, maybetype, letdef1);
247
+ }
248
+ function letdef2(type) {
249
+ if (type.match(/[\]\)\};,]/)) return pass(letdef1);
250
+ else return pass(expression, letdef2);
251
+ }
252
+ function maybetype(type) {
253
+ if (type == ":") return cont(typecx, rtype, valcx);
254
+ return pass();
255
+ }
256
+ function inop(type) {
257
+ if (type == "name" && content == "in") {cx.marked = "keyword"; return cont();}
258
+ return pass();
259
+ }
260
+ function fndef(type) {
261
+ if (content == "@" || content == "~") {cx.marked = "keyword"; return cont(fndef);}
262
+ if (type == "name") {cx.marked = "def"; return cont(fndef);}
263
+ if (content == "<") return cont(typarams, fndef);
264
+ if (type == "{") return pass(expression);
265
+ if (type == "(") return cont(pushlex(")"), commasep(argdef, ")"), poplex, fndef);
266
+ if (type == "->") return cont(typecx, rtype, valcx, fndef);
267
+ if (type == ";") return cont();
268
+ return cont(fndef);
269
+ }
270
+ function tydef(type) {
271
+ if (type == "name") {cx.marked = "def"; return cont(tydef);}
272
+ if (content == "<") return cont(typarams, tydef);
273
+ if (content == "=") return cont(typecx, rtype, valcx);
274
+ return cont(tydef);
275
+ }
276
+ function enumdef(type) {
277
+ if (type == "name") {cx.marked = "def"; return cont(enumdef);}
278
+ if (content == "<") return cont(typarams, enumdef);
279
+ if (content == "=") return cont(typecx, rtype, valcx, endstatement);
280
+ if (type == "{") return cont(pushlex("}"), typecx, enumblock, valcx, poplex);
281
+ return cont(enumdef);
282
+ }
283
+ function enumblock(type) {
284
+ if (type == "}") return cont();
285
+ if (type == "(") return cont(pushlex(")"), commasep(rtype, ")"), poplex, enumblock);
286
+ if (content.match(/^\w+$/)) cx.marked = "def";
287
+ return cont(enumblock);
288
+ }
289
+ function mod(type) {
290
+ if (type == "name") {cx.marked = "def"; return cont(mod);}
291
+ if (type == "{") return cont(pushlex("}"), block, poplex);
292
+ return pass();
293
+ }
294
+ function iface(type) {
295
+ if (type == "name") {cx.marked = "def"; return cont(iface);}
296
+ if (content == "<") return cont(typarams, iface);
297
+ if (type == "{") return cont(pushlex("}"), block, poplex);
298
+ return pass();
299
+ }
300
+ function impl(type) {
301
+ if (content == "<") return cont(typarams, impl);
302
+ if (content == "of" || content == "for") {cx.marked = "keyword"; return cont(rtype, impl);}
303
+ if (type == "name") {cx.marked = "def"; return cont(impl);}
304
+ if (type == "{") return cont(pushlex("}"), block, poplex);
305
+ return pass();
306
+ }
307
+ function typarams(type) {
308
+ if (content == ">") return cont();
309
+ if (content == ",") return cont(typarams);
310
+ if (content == ":") return cont(rtype, typarams);
311
+ return pass(rtype, typarams);
312
+ }
313
+ function argdef(type) {
314
+ if (type == "name") {cx.marked = "def"; return cont(argdef);}
315
+ if (type == ":") return cont(typecx, rtype, valcx);
316
+ return pass();
317
+ }
318
+ function rtype(type) {
319
+ if (type == "name") {cx.marked = "variable-3"; return cont(rtypemaybeparam); }
320
+ if (content == "mutable") {cx.marked = "keyword"; return cont(rtype);}
321
+ if (type == "atom") return cont(rtypemaybeparam);
322
+ if (type == "op" || type == "obj") return cont(rtype);
323
+ if (type == "fn") return cont(fntype);
324
+ if (type == "{") return cont(pushlex("{"), record_of(rtype), poplex);
325
+ return matchBrackets(type, rtype);
326
+ }
327
+ function rtypemaybeparam(type) {
328
+ if (content == "<") return cont(typarams);
329
+ return pass();
330
+ }
331
+ function fntype(type) {
332
+ if (type == "(") return cont(pushlex("("), commasep(rtype, ")"), poplex, fntype);
333
+ if (type == "->") return cont(rtype);
334
+ return pass();
335
+ }
336
+ function pattern(type) {
337
+ if (type == "name") {cx.marked = "def"; return cont(patternmaybeop);}
338
+ if (type == "atom") return cont(patternmaybeop);
339
+ if (type == "op") return cont(pattern);
340
+ if (type.match(/[\]\)\};,]/)) return pass();
341
+ return matchBrackets(type, pattern);
342
+ }
343
+ function patternmaybeop(type) {
344
+ if (type == "op" && content == ".") return cont();
345
+ if (content == "to") {cx.marked = "keyword"; return cont(pattern);}
346
+ else return pass();
347
+ }
348
+ function altbody(type) {
349
+ if (type == "{") return cont(pushlex("}", "alt"), altblock1, poplex);
350
+ return pass();
351
+ }
352
+ function altblock1(type) {
353
+ if (type == "}") return cont();
354
+ if (type == "|") return cont(altblock1);
355
+ if (content == "when") {cx.marked = "keyword"; return cont(expression, altblock2);}
356
+ if (type.match(/[\]\);,]/)) return cont(altblock1);
357
+ return pass(pattern, altblock2);
358
+ }
359
+ function altblock2(type) {
360
+ if (type == "{") return cont(pushlex("}", "alt"), block, poplex, altblock1);
361
+ else return pass(altblock1);
362
+ }
363
+
364
+ function macro(type) {
365
+ if (type.match(/[\[\(\{]/)) return matchBrackets(type, expression);
366
+ return pass();
367
+ }
368
+ function matchBrackets(type, comb) {
369
+ if (type == "[") return cont(pushlex("]"), commasep(comb, "]"), poplex);
370
+ if (type == "(") return cont(pushlex(")"), commasep(comb, ")"), poplex);
371
+ if (type == "{") return cont(pushlex("}"), commasep(comb, "}"), poplex);
372
+ return cont();
373
+ }
374
+
375
+ function parse(state, stream, style) {
376
+ var cc = state.cc;
377
+ // Communicate our context to the combinators.
378
+ // (Less wasteful than consing up a hundred closures on every call.)
379
+ cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
380
+
381
+ while (true) {
382
+ var combinator = cc.length ? cc.pop() : block;
383
+ if (combinator(tcat)) {
384
+ while(cc.length && cc[cc.length - 1].lex)
385
+ cc.pop()();
386
+ return cx.marked || style;
387
+ }
388
+ }
389
+ }
390
+
391
+ return {
392
+ startState: function() {
393
+ return {
394
+ tokenize: tokenBase,
395
+ cc: [],
396
+ lexical: {indented: -indentUnit, column: 0, type: "top", align: false},
397
+ keywords: valKeywords,
398
+ indented: 0
399
+ };
400
+ },
401
+
402
+ token: function(stream, state) {
403
+ if (stream.sol()) {
404
+ if (!state.lexical.hasOwnProperty("align"))
405
+ state.lexical.align = false;
406
+ state.indented = stream.indentation();
407
+ }
408
+ if (stream.eatSpace()) return null;
409
+ tcat = content = null;
410
+ var style = state.tokenize(stream, state);
411
+ if (style == "comment") return style;
412
+ if (!state.lexical.hasOwnProperty("align"))
413
+ state.lexical.align = true;
414
+ if (tcat == "prefix") return style;
415
+ if (!content) content = stream.current();
416
+ return parse(state, stream, style);
417
+ },
418
+
419
+ indent: function(state, textAfter) {
420
+ if (state.tokenize != tokenBase) return 0;
421
+ var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical,
422
+ type = lexical.type, closing = firstChar == type;
423
+ if (type == "stat") return lexical.indented + indentUnit;
424
+ if (lexical.align) return lexical.column + (closing ? 0 : 1);
425
+ return lexical.indented + (closing ? 0 : (lexical.info == "alt" ? altIndentUnit : indentUnit));
426
+ },
427
+
428
+ electricChars: "{}"
429
+ };
430
+ });
431
+
432
+ CodeMirror.defineMIME("text/x-rustsrc", "rust");