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,242 @@
1
+ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
2
+
3
+ function switchState(source, setState, f) {
4
+ setState(f);
5
+ return f(source, setState);
6
+ }
7
+
8
+ // These should all be Unicode extended, as per the Haskell 2010 report
9
+ var smallRE = /[a-z_]/;
10
+ var largeRE = /[A-Z]/;
11
+ var digitRE = /[0-9]/;
12
+ var hexitRE = /[0-9A-Fa-f]/;
13
+ var octitRE = /[0-7]/;
14
+ var idRE = /[a-z_A-Z0-9']/;
15
+ var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:]/;
16
+ var specialRE = /[(),;[\]`{}]/;
17
+ var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
18
+
19
+ function normal(source, setState) {
20
+ if (source.eatWhile(whiteCharRE)) {
21
+ return null;
22
+ }
23
+
24
+ var ch = source.next();
25
+ if (specialRE.test(ch)) {
26
+ if (ch == '{' && source.eat('-')) {
27
+ var t = "comment";
28
+ if (source.eat('#')) {
29
+ t = "meta";
30
+ }
31
+ return switchState(source, setState, ncomment(t, 1));
32
+ }
33
+ return null;
34
+ }
35
+
36
+ if (ch == '\'') {
37
+ if (source.eat('\\')) {
38
+ source.next(); // should handle other escapes here
39
+ }
40
+ else {
41
+ source.next();
42
+ }
43
+ if (source.eat('\'')) {
44
+ return "string";
45
+ }
46
+ return "error";
47
+ }
48
+
49
+ if (ch == '"') {
50
+ return switchState(source, setState, stringLiteral);
51
+ }
52
+
53
+ if (largeRE.test(ch)) {
54
+ source.eatWhile(idRE);
55
+ if (source.eat('.')) {
56
+ return "qualifier";
57
+ }
58
+ return "variable-2";
59
+ }
60
+
61
+ if (smallRE.test(ch)) {
62
+ source.eatWhile(idRE);
63
+ return "variable";
64
+ }
65
+
66
+ if (digitRE.test(ch)) {
67
+ if (ch == '0') {
68
+ if (source.eat(/[xX]/)) {
69
+ source.eatWhile(hexitRE); // should require at least 1
70
+ return "integer";
71
+ }
72
+ if (source.eat(/[oO]/)) {
73
+ source.eatWhile(octitRE); // should require at least 1
74
+ return "number";
75
+ }
76
+ }
77
+ source.eatWhile(digitRE);
78
+ var t = "number";
79
+ if (source.eat('.')) {
80
+ t = "number";
81
+ source.eatWhile(digitRE); // should require at least 1
82
+ }
83
+ if (source.eat(/[eE]/)) {
84
+ t = "number";
85
+ source.eat(/[-+]/);
86
+ source.eatWhile(digitRE); // should require at least 1
87
+ }
88
+ return t;
89
+ }
90
+
91
+ if (symbolRE.test(ch)) {
92
+ if (ch == '-' && source.eat(/-/)) {
93
+ source.eatWhile(/-/);
94
+ if (!source.eat(symbolRE)) {
95
+ source.skipToEnd();
96
+ return "comment";
97
+ }
98
+ }
99
+ var t = "variable";
100
+ if (ch == ':') {
101
+ t = "variable-2";
102
+ }
103
+ source.eatWhile(symbolRE);
104
+ return t;
105
+ }
106
+
107
+ return "error";
108
+ }
109
+
110
+ function ncomment(type, nest) {
111
+ if (nest == 0) {
112
+ return normal;
113
+ }
114
+ return function(source, setState) {
115
+ var currNest = nest;
116
+ while (!source.eol()) {
117
+ var ch = source.next();
118
+ if (ch == '{' && source.eat('-')) {
119
+ ++currNest;
120
+ }
121
+ else if (ch == '-' && source.eat('}')) {
122
+ --currNest;
123
+ if (currNest == 0) {
124
+ setState(normal);
125
+ return type;
126
+ }
127
+ }
128
+ }
129
+ setState(ncomment(type, currNest));
130
+ return type;
131
+ }
132
+ }
133
+
134
+ function stringLiteral(source, setState) {
135
+ while (!source.eol()) {
136
+ var ch = source.next();
137
+ if (ch == '"') {
138
+ setState(normal);
139
+ return "string";
140
+ }
141
+ if (ch == '\\') {
142
+ if (source.eol() || source.eat(whiteCharRE)) {
143
+ setState(stringGap);
144
+ return "string";
145
+ }
146
+ if (source.eat('&')) {
147
+ }
148
+ else {
149
+ source.next(); // should handle other escapes here
150
+ }
151
+ }
152
+ }
153
+ setState(normal);
154
+ return "error";
155
+ }
156
+
157
+ function stringGap(source, setState) {
158
+ if (source.eat('\\')) {
159
+ return switchState(source, setState, stringLiteral);
160
+ }
161
+ source.next();
162
+ setState(normal);
163
+ return "error";
164
+ }
165
+
166
+
167
+ var wellKnownWords = (function() {
168
+ var wkw = {};
169
+ function setType(t) {
170
+ return function () {
171
+ for (var i = 0; i < arguments.length; i++)
172
+ wkw[arguments[i]] = t;
173
+ }
174
+ }
175
+
176
+ setType("keyword")(
177
+ "case", "class", "data", "default", "deriving", "do", "else", "foreign",
178
+ "if", "import", "in", "infix", "infixl", "infixr", "instance", "let",
179
+ "module", "newtype", "of", "then", "type", "where", "_");
180
+
181
+ setType("keyword")(
182
+ "\.\.", ":", "::", "=", "\\", "\"", "<-", "->", "@", "~", "=>");
183
+
184
+ setType("builtin")(
185
+ "!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<=", "=<<",
186
+ "==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*", "**");
187
+
188
+ setType("builtin")(
189
+ "Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum", "Eq",
190
+ "False", "FilePath", "Float", "Floating", "Fractional", "Functor", "GT",
191
+ "IO", "IOError", "Int", "Integer", "Integral", "Just", "LT", "Left",
192
+ "Maybe", "Monad", "Nothing", "Num", "Ord", "Ordering", "Rational", "Read",
193
+ "ReadS", "Real", "RealFloat", "RealFrac", "Right", "Show", "ShowS",
194
+ "String", "True");
195
+
196
+ setType("builtin")(
197
+ "abs", "acos", "acosh", "all", "and", "any", "appendFile", "asTypeOf",
198
+ "asin", "asinh", "atan", "atan2", "atanh", "break", "catch", "ceiling",
199
+ "compare", "concat", "concatMap", "const", "cos", "cosh", "curry",
200
+ "cycle", "decodeFloat", "div", "divMod", "drop", "dropWhile", "either",
201
+ "elem", "encodeFloat", "enumFrom", "enumFromThen", "enumFromThenTo",
202
+ "enumFromTo", "error", "even", "exp", "exponent", "fail", "filter",
203
+ "flip", "floatDigits", "floatRadix", "floatRange", "floor", "fmap",
204
+ "foldl", "foldl1", "foldr", "foldr1", "fromEnum", "fromInteger",
205
+ "fromIntegral", "fromRational", "fst", "gcd", "getChar", "getContents",
206
+ "getLine", "head", "id", "init", "interact", "ioError", "isDenormalized",
207
+ "isIEEE", "isInfinite", "isNaN", "isNegativeZero", "iterate", "last",
208
+ "lcm", "length", "lex", "lines", "log", "logBase", "lookup", "map",
209
+ "mapM", "mapM_", "max", "maxBound", "maximum", "maybe", "min", "minBound",
210
+ "minimum", "mod", "negate", "not", "notElem", "null", "odd", "or",
211
+ "otherwise", "pi", "pred", "print", "product", "properFraction",
212
+ "putChar", "putStr", "putStrLn", "quot", "quotRem", "read", "readFile",
213
+ "readIO", "readList", "readLn", "readParen", "reads", "readsPrec",
214
+ "realToFrac", "recip", "rem", "repeat", "replicate", "return", "reverse",
215
+ "round", "scaleFloat", "scanl", "scanl1", "scanr", "scanr1", "seq",
216
+ "sequence", "sequence_", "show", "showChar", "showList", "showParen",
217
+ "showString", "shows", "showsPrec", "significand", "signum", "sin",
218
+ "sinh", "snd", "span", "splitAt", "sqrt", "subtract", "succ", "sum",
219
+ "tail", "take", "takeWhile", "tan", "tanh", "toEnum", "toInteger",
220
+ "toRational", "truncate", "uncurry", "undefined", "unlines", "until",
221
+ "unwords", "unzip", "unzip3", "userError", "words", "writeFile", "zip",
222
+ "zip3", "zipWith", "zipWith3");
223
+
224
+ return wkw;
225
+ })();
226
+
227
+
228
+
229
+ return {
230
+ startState: function () { return { f: normal }; },
231
+ copyState: function (s) { return { f: s.f }; },
232
+
233
+ token: function(stream, state) {
234
+ var t = state.f(stream, function(s) { state.f = s; });
235
+ var w = stream.current();
236
+ return (w in wellKnownWords) ? wellKnownWords[w] : t;
237
+ }
238
+ };
239
+
240
+ });
241
+
242
+ CodeMirror.defineMIME("text/x-haskell", "haskell");
@@ -0,0 +1,60 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror: Haskell mode</title>
5
+ <link rel="stylesheet" href="../../lib/codemirror.css">
6
+ <script src="../../lib/codemirror.js"></script>
7
+ <script src="haskell.js"></script>
8
+ <link rel="stylesheet" href="../../theme/elegant.css">
9
+ <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
10
+ <link rel="stylesheet" href="../../doc/docs.css">
11
+ </head>
12
+ <body>
13
+ <h1>CodeMirror: Haskell mode</h1>
14
+
15
+ <form><textarea id="code" name="code">
16
+ module UniquePerms (
17
+ uniquePerms
18
+ )
19
+ where
20
+
21
+ -- | Find all unique permutations of a list where there might be duplicates.
22
+ uniquePerms :: (Eq a) => [a] -> [[a]]
23
+ uniquePerms = permBag . makeBag
24
+
25
+ -- | An unordered collection where duplicate values are allowed,
26
+ -- but represented with a single value and a count.
27
+ type Bag a = [(a, Int)]
28
+
29
+ makeBag :: (Eq a) => [a] -> Bag a
30
+ makeBag [] = []
31
+ makeBag (a:as) = mix a $ makeBag as
32
+ where
33
+ mix a [] = [(a,1)]
34
+ mix a (bn@(b,n):bs) | a == b = (b,n+1):bs
35
+ | otherwise = bn : mix a bs
36
+
37
+ permBag :: Bag a -> [[a]]
38
+ permBag [] = [[]]
39
+ permBag bs = concatMap (\(f,cs) -> map (f:) $ permBag cs) . oneOfEach $ bs
40
+ where
41
+ oneOfEach [] = []
42
+ oneOfEach (an@(a,n):bs) =
43
+ let bs' = if n == 1 then bs else (a,n-1):bs
44
+ in (a,bs') : mapSnd (an:) (oneOfEach bs)
45
+
46
+ apSnd f (a,b) = (a, f b)
47
+ mapSnd = map . apSnd
48
+ </textarea></form>
49
+
50
+ <script>
51
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
52
+ lineNumbers: true,
53
+ matchBrackets: true,
54
+ theme: "elegant"
55
+ });
56
+ </script>
57
+
58
+ <p><strong>MIME types defined:</strong> <code>text/x-haskell</code>.</p>
59
+ </body>
60
+ </html>
@@ -0,0 +1,68 @@
1
+ CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
2
+
3
+ //config settings
4
+ var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i,
5
+ scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i;
6
+
7
+ //inner modes
8
+ var scriptingMode, htmlMixedMode;
9
+
10
+ //tokenizer when in html mode
11
+ function htmlDispatch(stream, state) {
12
+ if (stream.match(scriptStartRegex, false)) {
13
+ state.token=scriptingDispatch;
14
+ return scriptingMode.token(stream, state.scriptState);
15
+ }
16
+ else
17
+ return htmlMixedMode.token(stream, state.htmlState);
18
+ }
19
+
20
+ //tokenizer when in scripting mode
21
+ function scriptingDispatch(stream, state) {
22
+ if (stream.match(scriptEndRegex, false)) {
23
+ state.token=htmlDispatch;
24
+ return htmlMixedMode.token(stream, state.htmlState);
25
+ }
26
+ else
27
+ return scriptingMode.token(stream, state.scriptState);
28
+ }
29
+
30
+
31
+ return {
32
+ startState: function() {
33
+ scriptingMode = scriptingMode || CodeMirror.getMode(config, parserConfig.scriptingModeSpec);
34
+ htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed");
35
+ return {
36
+ token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch,
37
+ htmlState : htmlMixedMode.startState(),
38
+ scriptState : scriptingMode.startState()
39
+ }
40
+ },
41
+
42
+ token: function(stream, state) {
43
+ return state.token(stream, state);
44
+ },
45
+
46
+ indent: function(state, textAfter) {
47
+ if (state.token == htmlDispatch)
48
+ return htmlMixedMode.indent(state.htmlState, textAfter);
49
+ else
50
+ return scriptingMode.indent(state.scriptState, textAfter);
51
+ },
52
+
53
+ copyState: function(state) {
54
+ return {
55
+ token : state.token,
56
+ htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState),
57
+ scriptState : CodeMirror.copyState(scriptingMode, state.scriptState)
58
+ }
59
+ },
60
+
61
+
62
+ electricChars: "/{}:"
63
+ }
64
+ });
65
+
66
+ CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"});
67
+ CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
68
+ CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingModeSpec:"text/x-java"});
@@ -0,0 +1,49 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror: Html Embedded Scripts 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="../javascript/javascript.js"></script>
9
+ <script src="../css/css.js"></script>
10
+ <script src="../htmlmixed/htmlmixed.js"></script>
11
+ <script src="htmlembedded.js"></script>
12
+ <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
13
+ <link rel="stylesheet" href="../../doc/docs.css">
14
+ </head>
15
+ <body>
16
+ <h1>CodeMirror: Html Embedded Scripts mode</h1>
17
+
18
+ <form><textarea id="code" name="code">
19
+ <%
20
+ function hello(who) {
21
+ return "Hello " + who;
22
+ }
23
+ %>
24
+ This is an example of EJS (embedded javascript)
25
+ <p>The program says <%= hello("world") %>.</p>
26
+ <script>
27
+ alert("And here is some normal JS code"); // also colored
28
+ </script>
29
+ </textarea></form>
30
+
31
+ <script>
32
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
33
+ lineNumbers: true,
34
+ matchBrackets: true,
35
+ mode: "application/x-ejs",
36
+ indentUnit: 4,
37
+ indentWithTabs: true,
38
+ enterMode: "keep",
39
+ tabMode: "shift"
40
+ });
41
+ </script>
42
+
43
+ <p>Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on
44
+ JavaScript, CSS and XML.<br />Other dependancies include those of the scriping language chosen.</p>
45
+
46
+ <p><strong>MIME types defined:</strong> <code>application/x-aspx</code> (ASP.NET),
47
+ <code>application/x-ejs</code> (Embedded Javascript), <code>application/x-jsp</code> (JavaServer Pages)</p>
48
+ </body>
49
+ </html>
@@ -0,0 +1,83 @@
1
+ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
2
+ var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
3
+ var jsMode = CodeMirror.getMode(config, "javascript");
4
+ var cssMode = CodeMirror.getMode(config, "css");
5
+
6
+ function html(stream, state) {
7
+ var style = htmlMode.token(stream, state.htmlState);
8
+ if (style == "tag" && stream.current() == ">" && state.htmlState.context) {
9
+ if (/^script$/i.test(state.htmlState.context.tagName)) {
10
+ state.token = javascript;
11
+ state.localState = jsMode.startState(htmlMode.indent(state.htmlState, ""));
12
+ state.mode = "javascript";
13
+ }
14
+ else if (/^style$/i.test(state.htmlState.context.tagName)) {
15
+ state.token = css;
16
+ state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
17
+ state.mode = "css";
18
+ }
19
+ }
20
+ return style;
21
+ }
22
+ function maybeBackup(stream, pat, style) {
23
+ var cur = stream.current();
24
+ var close = cur.search(pat);
25
+ if (close > -1) stream.backUp(cur.length - close);
26
+ return style;
27
+ }
28
+ function javascript(stream, state) {
29
+ if (stream.match(/^<\/\s*script\s*>/i, false)) {
30
+ state.token = html;
31
+ state.curState = null;
32
+ state.mode = "html";
33
+ return html(stream, state);
34
+ }
35
+ return maybeBackup(stream, /<\/\s*script\s*>/,
36
+ jsMode.token(stream, state.localState));
37
+ }
38
+ function css(stream, state) {
39
+ if (stream.match(/^<\/\s*style\s*>/i, false)) {
40
+ state.token = html;
41
+ state.localState = null;
42
+ state.mode = "html";
43
+ return html(stream, state);
44
+ }
45
+ return maybeBackup(stream, /<\/\s*style\s*>/,
46
+ cssMode.token(stream, state.localState));
47
+ }
48
+
49
+ return {
50
+ startState: function() {
51
+ var state = htmlMode.startState();
52
+ return {token: html, localState: null, mode: "html", htmlState: state};
53
+ },
54
+
55
+ copyState: function(state) {
56
+ if (state.localState)
57
+ var local = CodeMirror.copyState(state.token == css ? cssMode : jsMode, state.localState);
58
+ return {token: state.token, localState: local, mode: state.mode,
59
+ htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
60
+ },
61
+
62
+ token: function(stream, state) {
63
+ return state.token(stream, state);
64
+ },
65
+
66
+ indent: function(state, textAfter) {
67
+ if (state.token == html || /^\s*<\//.test(textAfter))
68
+ return htmlMode.indent(state.htmlState, textAfter);
69
+ else if (state.token == javascript)
70
+ return jsMode.indent(state.localState, textAfter);
71
+ else
72
+ return cssMode.indent(state.localState, textAfter);
73
+ },
74
+
75
+ compareStates: function(a, b) {
76
+ return htmlMode.compareStates(a.htmlState, b.htmlState);
77
+ },
78
+
79
+ electricChars: "/{}:"
80
+ }
81
+ });
82
+
83
+ CodeMirror.defineMIME("text/html", "htmlmixed");
@@ -0,0 +1,51 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror: HTML mixed 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="../javascript/javascript.js"></script>
9
+ <script src="../css/css.js"></script>
10
+ <script src="htmlmixed.js"></script>
11
+ <link rel="stylesheet" href="../../doc/docs.css">
12
+ <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
13
+ </head>
14
+ <body>
15
+ <h1>CodeMirror: HTML mixed mode</h1>
16
+ <form><textarea id="code" name="code">
17
+ <html style="color: green">
18
+ <!-- this is a comment -->
19
+ <head>
20
+ <title>Mixed HTML Example</title>
21
+ <style type="text/css">
22
+ h1 {font-family: comic sans; color: #f0f;}
23
+ div {background: yellow !important;}
24
+ body {
25
+ max-width: 50em;
26
+ margin: 1em 2em 1em 5em;
27
+ }
28
+ </style>
29
+ </head>
30
+ <body>
31
+ <h1>Mixed HTML Example</h1>
32
+ <script>
33
+ function jsFunc(arg1, arg2) {
34
+ if (arg1 && arg2) document.body.innerHTML = "achoo";
35
+ }
36
+ </script>
37
+ </body>
38
+ </html>
39
+ </textarea></form>
40
+ <script>
41
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "text/html", tabMode: "indent"});
42
+ </script>
43
+
44
+ <p>The HTML mixed mode depends on the XML, JavaScript, and CSS modes.</p>
45
+
46
+ <p><strong>MIME types defined:</strong> <code>text/html</code>
47
+ (redefined, only takes effect if you load this parser after the
48
+ XML parser).</p>
49
+
50
+ </body>
51
+ </html>
@@ -0,0 +1,77 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror: JavaScript mode</title>
5
+ <link rel="stylesheet" href="../../lib/codemirror.css">
6
+ <script src="../../lib/codemirror.js"></script>
7
+ <script src="javascript.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: JavaScript mode</h1>
13
+
14
+ <div><textarea id="code" name="code">
15
+ // Demo code (the actual new parser character stream implementation)
16
+
17
+ function StringStream(string) {
18
+ this.pos = 0;
19
+ this.string = string;
20
+ }
21
+
22
+ StringStream.prototype = {
23
+ done: function() {return this.pos >= this.string.length;},
24
+ peek: function() {return this.string.charAt(this.pos);},
25
+ next: function() {
26
+ if (this.pos &lt; this.string.length)
27
+ return this.string.charAt(this.pos++);
28
+ },
29
+ eat: function(match) {
30
+ var ch = this.string.charAt(this.pos);
31
+ if (typeof match == "string") var ok = ch == match;
32
+ else var ok = ch &amp;&amp; match.test ? match.test(ch) : match(ch);
33
+ if (ok) {this.pos++; return ch;}
34
+ },
35
+ eatWhile: function(match) {
36
+ var start = this.pos;
37
+ while (this.eat(match));
38
+ if (this.pos > start) return this.string.slice(start, this.pos);
39
+ },
40
+ backUp: function(n) {this.pos -= n;},
41
+ column: function() {return this.pos;},
42
+ eatSpace: function() {
43
+ var start = this.pos;
44
+ while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
45
+ return this.pos - start;
46
+ },
47
+ match: function(pattern, consume, caseInsensitive) {
48
+ if (typeof pattern == "string") {
49
+ function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
50
+ if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
51
+ if (consume !== false) this.pos += str.length;
52
+ return true;
53
+ }
54
+ }
55
+ else {
56
+ var match = this.string.slice(this.pos).match(pattern);
57
+ if (match &amp;&amp; consume !== false) this.pos += match[0].length;
58
+ return match;
59
+ }
60
+ }
61
+ };
62
+ </textarea></div>
63
+
64
+ <script>
65
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
66
+ lineNumbers: true,
67
+ matchBrackets: true
68
+ });
69
+ </script>
70
+
71
+ <p>JavaScript mode supports a single configuration
72
+ option, <code>json</code>, which will set the mode to expect JSON
73
+ data rather than a JavaScript program.</p>
74
+
75
+ <p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>.</p>
76
+ </body>
77
+ </html>