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,124 @@
1
+ CodeMirror.defineMode("css", function(config) {
2
+ var indentUnit = config.indentUnit, type;
3
+ function ret(style, tp) {type = tp; return style;}
4
+
5
+ function tokenBase(stream, state) {
6
+ var ch = stream.next();
7
+ if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());}
8
+ else if (ch == "/" && stream.eat("*")) {
9
+ state.tokenize = tokenCComment;
10
+ return tokenCComment(stream, state);
11
+ }
12
+ else if (ch == "<" && stream.eat("!")) {
13
+ state.tokenize = tokenSGMLComment;
14
+ return tokenSGMLComment(stream, state);
15
+ }
16
+ else if (ch == "=") ret(null, "compare");
17
+ else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");
18
+ else if (ch == "\"" || ch == "'") {
19
+ state.tokenize = tokenString(ch);
20
+ return state.tokenize(stream, state);
21
+ }
22
+ else if (ch == "#") {
23
+ stream.eatWhile(/[\w\\\-]/);
24
+ return ret("atom", "hash");
25
+ }
26
+ else if (ch == "!") {
27
+ stream.match(/^\s*\w*/);
28
+ return ret("keyword", "important");
29
+ }
30
+ else if (/\d/.test(ch)) {
31
+ stream.eatWhile(/[\w.%]/);
32
+ return ret("number", "unit");
33
+ }
34
+ else if (/[,.+>*\/]/.test(ch)) {
35
+ return ret(null, "select-op");
36
+ }
37
+ else if (/[;{}:\[\]]/.test(ch)) {
38
+ return ret(null, ch);
39
+ }
40
+ else {
41
+ stream.eatWhile(/[\w\\\-]/);
42
+ return ret("variable", "variable");
43
+ }
44
+ }
45
+
46
+ function tokenCComment(stream, state) {
47
+ var maybeEnd = false, ch;
48
+ while ((ch = stream.next()) != null) {
49
+ if (maybeEnd && ch == "/") {
50
+ state.tokenize = tokenBase;
51
+ break;
52
+ }
53
+ maybeEnd = (ch == "*");
54
+ }
55
+ return ret("comment", "comment");
56
+ }
57
+
58
+ function tokenSGMLComment(stream, state) {
59
+ var dashes = 0, ch;
60
+ while ((ch = stream.next()) != null) {
61
+ if (dashes >= 2 && ch == ">") {
62
+ state.tokenize = tokenBase;
63
+ break;
64
+ }
65
+ dashes = (ch == "-") ? dashes + 1 : 0;
66
+ }
67
+ return ret("comment", "comment");
68
+ }
69
+
70
+ function tokenString(quote) {
71
+ return function(stream, state) {
72
+ var escaped = false, ch;
73
+ while ((ch = stream.next()) != null) {
74
+ if (ch == quote && !escaped)
75
+ break;
76
+ escaped = !escaped && ch == "\\";
77
+ }
78
+ if (!escaped) state.tokenize = tokenBase;
79
+ return ret("string", "string");
80
+ };
81
+ }
82
+
83
+ return {
84
+ startState: function(base) {
85
+ return {tokenize: tokenBase,
86
+ baseIndent: base || 0,
87
+ stack: []};
88
+ },
89
+
90
+ token: function(stream, state) {
91
+ if (stream.eatSpace()) return null;
92
+ var style = state.tokenize(stream, state);
93
+
94
+ var context = state.stack[state.stack.length-1];
95
+ if (type == "hash" && context == "rule") style = "atom";
96
+ else if (style == "variable") {
97
+ if (context == "rule") style = "number";
98
+ else if (!context || context == "@media{") style = "tag";
99
+ }
100
+
101
+ if (context == "rule" && /^[\{\};]$/.test(type))
102
+ state.stack.pop();
103
+ if (type == "{") {
104
+ if (context == "@media") state.stack[state.stack.length-1] = "@media{";
105
+ else state.stack.push("{");
106
+ }
107
+ else if (type == "}") state.stack.pop();
108
+ else if (type == "@media") state.stack.push("@media");
109
+ else if (context == "{" && type != "comment") state.stack.push("rule");
110
+ return style;
111
+ },
112
+
113
+ indent: function(state, textAfter) {
114
+ var n = state.stack.length;
115
+ if (/^\}/.test(textAfter))
116
+ n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1;
117
+ return state.baseIndent + n * indentUnit;
118
+ },
119
+
120
+ electricChars: "}"
121
+ };
122
+ });
123
+
124
+ CodeMirror.defineMIME("text/css", "css");
@@ -0,0 +1,55 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror: CSS mode</title>
5
+ <link rel="stylesheet" href="../../lib/codemirror.css">
6
+ <script src="../../lib/codemirror.js"></script>
7
+ <script src="css.js"></script>
8
+ <style>.CodeMirror {background: #f8f8f8;}</style>
9
+ <link rel="stylesheet" href="../../doc/docs.css">
10
+ </head>
11
+ <body>
12
+ <h1>CodeMirror: CSS mode</h1>
13
+ <form><textarea id="code" name="code">
14
+ /* Some example CSS */
15
+
16
+ @import url("something.css");
17
+
18
+ body {
19
+ margin: 0;
20
+ padding: 3em 6em;
21
+ font-family: tahoma, arial, sans-serif;
22
+ color: #000;
23
+ }
24
+
25
+ #navigation a {
26
+ font-weight: bold;
27
+ text-decoration: none !important;
28
+ }
29
+
30
+ h1 {
31
+ font-size: 2.5em;
32
+ }
33
+
34
+ h2 {
35
+ font-size: 1.7em;
36
+ }
37
+
38
+ h1:before, h2:before {
39
+ content: "::";
40
+ }
41
+
42
+ code {
43
+ font-family: courier, monospace;
44
+ font-size: 80%;
45
+ color: #418A8A;
46
+ }
47
+ </textarea></form>
48
+ <script>
49
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
50
+ </script>
51
+
52
+ <p><strong>MIME types defined:</strong> <code>text/css</code>.</p>
53
+
54
+ </body>
55
+ </html>
@@ -0,0 +1,3 @@
1
+ span.cm-rangeinfo {color: #a0b;}
2
+ span.cm-minus {color: red;}
3
+ span.cm-plus {color: #2b2;}
@@ -0,0 +1,13 @@
1
+ CodeMirror.defineMode("diff", function() {
2
+ return {
3
+ token: function(stream) {
4
+ var ch = stream.next();
5
+ stream.skipToEnd();
6
+ if (ch == "+") return "plus";
7
+ if (ch == "-") return "minus";
8
+ if (ch == "@") return "rangeinfo";
9
+ }
10
+ };
11
+ });
12
+
13
+ CodeMirror.defineMIME("text/x-diff", "diff");
@@ -0,0 +1,99 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror: Diff mode</title>
5
+ <link rel="stylesheet" href="../../lib/codemirror.css">
6
+ <script src="../../lib/codemirror.js"></script>
7
+ <script src="diff.js"></script>
8
+ <link rel="stylesheet" href="diff.css">
9
+ <style>.CodeMirror {border-top: 1px solid #ddd; border-bottom: 1px solid #ddd;}</style>
10
+ <link rel="stylesheet" href="../../doc/docs.css">
11
+ </head>
12
+ <body>
13
+ <h1>CodeMirror: Diff mode</h1>
14
+ <form><textarea id="code" name="code">
15
+ diff --git a/index.html b/index.html
16
+ index c1d9156..7764744 100644
17
+ --- a/index.html
18
+ +++ b/index.html
19
+ @@ -95,7 +95,8 @@ StringStream.prototype = {
20
+ <script>
21
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
22
+ lineNumbers: true,
23
+ - autoMatchBrackets: true
24
+ + autoMatchBrackets: true,
25
+ + onGutterClick: function(x){console.log(x);}
26
+ });
27
+ </script>
28
+ </body>
29
+ diff --git a/lib/codemirror.js b/lib/codemirror.js
30
+ index 04646a9..9a39cc7 100644
31
+ --- a/lib/codemirror.js
32
+ +++ b/lib/codemirror.js
33
+ @@ -399,10 +399,16 @@ var CodeMirror = (function() {
34
+ }
35
+
36
+ function onMouseDown(e) {
37
+ - var start = posFromMouse(e), last = start;
38
+ + var start = posFromMouse(e), last = start, target = e.target();
39
+ if (!start) return;
40
+ setCursor(start.line, start.ch, false);
41
+ if (e.button() != 1) return;
42
+ + if (target.parentNode == gutter) {
43
+ + if (options.onGutterClick)
44
+ + options.onGutterClick(indexOf(gutter.childNodes, target) + showingFrom);
45
+ + return;
46
+ + }
47
+ +
48
+ if (!focused) onFocus();
49
+
50
+ e.stop();
51
+ @@ -808,7 +814,7 @@ var CodeMirror = (function() {
52
+ for (var i = showingFrom; i < showingTo; ++i) {
53
+ var marker = lines[i].gutterMarker;
54
+ if (marker) html.push('<div class="' + marker.style + '">' + htmlEscape(marker.text) + '</div>');
55
+ - else html.push("<div>" + (options.lineNumbers ? i + 1 : "\u00a0") + "</div>");
56
+ + else html.push("<div>" + (options.lineNumbers ? i + options.firstLineNumber : "\u00a0") + "</div>");
57
+ }
58
+ gutter.style.display = "none"; // TODO test whether this actually helps
59
+ gutter.innerHTML = html.join("");
60
+ @@ -1371,10 +1377,8 @@ var CodeMirror = (function() {
61
+ if (option == "parser") setParser(value);
62
+ else if (option === "lineNumbers") setLineNumbers(value);
63
+ else if (option === "gutter") setGutter(value);
64
+ - else if (option === "readOnly") options.readOnly = value;
65
+ - else if (option === "indentUnit") {options.indentUnit = indentUnit = value; setParser(options.parser);}
66
+ - else if (/^(?:enterMode|tabMode|indentWithTabs|readOnly|autoMatchBrackets|undoDepth)$/.test(option)) options[option] = value;
67
+ - else throw new Error("Can't set option " + option);
68
+ + else if (option === "indentUnit") {options.indentUnit = value; setParser(options.parser);}
69
+ + else options[option] = value;
70
+ },
71
+ cursorCoords: cursorCoords,
72
+ undo: operation(undo),
73
+ @@ -1402,7 +1406,8 @@ var CodeMirror = (function() {
74
+ replaceRange: operation(replaceRange),
75
+
76
+ operation: function(f){return operation(f)();},
77
+ - refresh: function(){updateDisplay([{from: 0, to: lines.length}]);}
78
+ + refresh: function(){updateDisplay([{from: 0, to: lines.length}]);},
79
+ + getInputField: function(){return input;}
80
+ };
81
+ return instance;
82
+ }
83
+ @@ -1420,6 +1425,7 @@ var CodeMirror = (function() {
84
+ readOnly: false,
85
+ onChange: null,
86
+ onCursorActivity: null,
87
+ + onGutterClick: null,
88
+ autoMatchBrackets: false,
89
+ workTime: 200,
90
+ workDelay: 300,
91
+ </textarea></form>
92
+ <script>
93
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
94
+ </script>
95
+
96
+ <p><strong>MIME types defined:</strong> <code>text/x-diff</code>.</p>
97
+
98
+ </body>
99
+ </html>
@@ -0,0 +1,203 @@
1
+ CodeMirror.defineMode("ecl", function(config) {
2
+
3
+ function words(str) {
4
+ var obj = {}, words = str.split(" ");
5
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
6
+ return obj;
7
+ }
8
+
9
+ function metaHook(stream, state) {
10
+ if (!state.startOfLine) return false;
11
+ stream.skipToEnd();
12
+ return "meta";
13
+ }
14
+
15
+ function tokenAtString(stream, state) {
16
+ var next;
17
+ while ((next = stream.next()) != null) {
18
+ if (next == '"' && !stream.eat('"')) {
19
+ state.tokenize = null;
20
+ break;
21
+ }
22
+ }
23
+ return "string";
24
+ }
25
+
26
+ var indentUnit = config.indentUnit;
27
+ var keyword = words("abs acos allnodes ascii asin asstring atan atan2 ave case choose choosen choosesets clustersize combine correlation cos cosh count covariance cron dataset dedup define denormalize distribute distributed distribution ebcdic enth error evaluate event eventextra eventname exists exp failcode failmessage fetch fromunicode getisvalid global graph group hash hash32 hash64 hashcrc hashmd5 having if index intformat isvalid iterate join keyunicode length library limit ln local log loop map matched matchlength matchposition matchtext matchunicode max merge mergejoin min nolocal nonempty normalize parse pipe power preload process project pull random range rank ranked realformat recordof regexfind regexreplace regroup rejected rollup round roundup row rowdiff sample set sin sinh sizeof soapcall sort sorted sqrt stepped stored sum table tan tanh thisnode topn tounicode transfer trim truncate typeof ungroup unicodeorder variance which workunit xmldecode xmlencode xmltext xmlunicode");
28
+ var variable = words("apply assert build buildindex evaluate fail keydiff keypatch loadxml nothor notify output parallel sequential soapcall wait");
29
+ var variable_2 = words("__compressed__ all and any as atmost before beginc++ best between case const counter csv descend encrypt end endc++ endmacro except exclusive expire export extend false few first flat from full function group header heading hole ifblock import in interface joined keep keyed last left limit load local locale lookup macro many maxcount maxlength min skew module named nocase noroot noscan nosort not of only opt or outer overwrite packed partition penalty physicallength pipe quote record relationship repeat return right scan self separator service shared skew skip sql store terminator thor threshold token transform trim true type unicodeorder unsorted validate virtual whole wild within xml xpath");
30
+ var variable_3 = words("ascii big_endian boolean data decimal ebcdic integer pattern qstring real record rule set of string token udecimal unicode unsigned varstring varunicode");
31
+ var builtin = words("checkpoint deprecated failcode failmessage failure global independent onwarning persist priority recovery stored success wait when");
32
+ var blockKeywords = words("catch class do else finally for if switch try while");
33
+ var atoms = words("true false null");
34
+ var hooks = {"#": metaHook};
35
+ var multiLineStrings;
36
+ var isOperatorChar = /[+\-*&%=<>!?|\/]/;
37
+
38
+ var curPunc;
39
+
40
+ function tokenBase(stream, state) {
41
+ var ch = stream.next();
42
+ if (hooks[ch]) {
43
+ var result = hooks[ch](stream, state);
44
+ if (result !== false) return result;
45
+ }
46
+ if (ch == '"' || ch == "'") {
47
+ state.tokenize = tokenString(ch);
48
+ return state.tokenize(stream, state);
49
+ }
50
+ if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
51
+ curPunc = ch;
52
+ return null
53
+ }
54
+ if (/\d/.test(ch)) {
55
+ stream.eatWhile(/[\w\.]/);
56
+ return "number";
57
+ }
58
+ if (ch == "/") {
59
+ if (stream.eat("*")) {
60
+ state.tokenize = tokenComment;
61
+ return tokenComment(stream, state);
62
+ }
63
+ if (stream.eat("/")) {
64
+ stream.skipToEnd();
65
+ return "comment";
66
+ }
67
+ }
68
+ if (isOperatorChar.test(ch)) {
69
+ stream.eatWhile(isOperatorChar);
70
+ return "operator";
71
+ }
72
+ stream.eatWhile(/[\w\$_]/);
73
+ var cur = stream.current().toLowerCase();
74
+ if (keyword.propertyIsEnumerable(cur)) {
75
+ if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
76
+ return "keyword";
77
+ } else if (variable.propertyIsEnumerable(cur)) {
78
+ if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
79
+ return "variable";
80
+ } else if (variable_2.propertyIsEnumerable(cur)) {
81
+ if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
82
+ return "variable-2";
83
+ } else if (variable_3.propertyIsEnumerable(cur)) {
84
+ if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
85
+ return "variable-3";
86
+ } else if (builtin.propertyIsEnumerable(cur)) {
87
+ if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
88
+ return "builtin";
89
+ } else { //Data types are of from KEYWORD##
90
+ var i = cur.length - 1;
91
+ while(i >= 0 && (!isNaN(cur[i]) || cur[i] == '_'))
92
+ --i;
93
+
94
+ if (i > 0) {
95
+ var cur2 = cur.substr(0, i + 1);
96
+ if (variable_3.propertyIsEnumerable(cur2)) {
97
+ if (blockKeywords.propertyIsEnumerable(cur2)) curPunc = "newstatement";
98
+ return "variable-3";
99
+ }
100
+ }
101
+ }
102
+ if (atoms.propertyIsEnumerable(cur)) return "atom";
103
+ return "word";
104
+ }
105
+
106
+ function tokenString(quote) {
107
+ return function(stream, state) {
108
+ var escaped = false, next, end = false;
109
+ while ((next = stream.next()) != null) {
110
+ if (next == quote && !escaped) {end = true; break;}
111
+ escaped = !escaped && next == "\\";
112
+ }
113
+ if (end || !(escaped || multiLineStrings))
114
+ state.tokenize = tokenBase;
115
+ return "string";
116
+ };
117
+ }
118
+
119
+ function tokenComment(stream, state) {
120
+ var maybeEnd = false, ch;
121
+ while (ch = stream.next()) {
122
+ if (ch == "/" && maybeEnd) {
123
+ state.tokenize = tokenBase;
124
+ break;
125
+ }
126
+ maybeEnd = (ch == "*");
127
+ }
128
+ return "comment";
129
+ }
130
+
131
+ function Context(indented, column, type, align, prev) {
132
+ this.indented = indented;
133
+ this.column = column;
134
+ this.type = type;
135
+ this.align = align;
136
+ this.prev = prev;
137
+ }
138
+ function pushContext(state, col, type) {
139
+ return state.context = new Context(state.indented, col, type, null, state.context);
140
+ }
141
+ function popContext(state) {
142
+ var t = state.context.type;
143
+ if (t == ")" || t == "]" || t == "}")
144
+ state.indented = state.context.indented;
145
+ return state.context = state.context.prev;
146
+ }
147
+
148
+ // Interface
149
+
150
+ return {
151
+ startState: function(basecolumn) {
152
+ return {
153
+ tokenize: null,
154
+ context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
155
+ indented: 0,
156
+ startOfLine: true
157
+ };
158
+ },
159
+
160
+ token: function(stream, state) {
161
+ var ctx = state.context;
162
+ if (stream.sol()) {
163
+ if (ctx.align == null) ctx.align = false;
164
+ state.indented = stream.indentation();
165
+ state.startOfLine = true;
166
+ }
167
+ if (stream.eatSpace()) return null;
168
+ curPunc = null;
169
+ var style = (state.tokenize || tokenBase)(stream, state);
170
+ if (style == "comment" || style == "meta") return style;
171
+ if (ctx.align == null) ctx.align = true;
172
+
173
+ if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
174
+ else if (curPunc == "{") pushContext(state, stream.column(), "}");
175
+ else if (curPunc == "[") pushContext(state, stream.column(), "]");
176
+ else if (curPunc == "(") pushContext(state, stream.column(), ")");
177
+ else if (curPunc == "}") {
178
+ while (ctx.type == "statement") ctx = popContext(state);
179
+ if (ctx.type == "}") ctx = popContext(state);
180
+ while (ctx.type == "statement") ctx = popContext(state);
181
+ }
182
+ else if (curPunc == ctx.type) popContext(state);
183
+ else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
184
+ pushContext(state, stream.column(), "statement");
185
+ state.startOfLine = false;
186
+ return style;
187
+ },
188
+
189
+ indent: function(state, textAfter) {
190
+ if (state.tokenize != tokenBase && state.tokenize != null) return 0;
191
+ var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
192
+ if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
193
+ var closing = firstChar == ctx.type;
194
+ if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
195
+ else if (ctx.align) return ctx.column + (closing ? 0 : 1);
196
+ else return ctx.indented + (closing ? 0 : indentUnit);
197
+ },
198
+
199
+ electricChars: "{}"
200
+ };
201
+ });
202
+
203
+ CodeMirror.defineMIME("text/x-ecl");
@@ -0,0 +1,42 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror: ECL mode</title>
5
+ <link rel="stylesheet" href="../../lib/codemirror.css">
6
+ <script src="../../lib/codemirror.js"></script>
7
+ <script src="ecl.js"></script>
8
+ <link rel="stylesheet" href="../../doc/docs.css">
9
+ <style>.CodeMirror {border: 1px solid black;}</style>
10
+ </head>
11
+ <body>
12
+ <h1>CodeMirror: ECL mode</h1>
13
+ <form><textarea id="code" name="code">
14
+ /*
15
+ sample useless code to demonstrate ecl syntax highlighting
16
+ this is a multiline comment!
17
+ */
18
+
19
+ // this is a singleline comment!
20
+
21
+ import ut;
22
+ r :=
23
+ record
24
+ string22 s1 := '123';
25
+ integer4 i1 := 123;
26
+ end;
27
+ #option('tmp', true);
28
+ d := dataset('tmp::qb', r, thor);
29
+ output(d);
30
+ </textarea></form>
31
+ <script>
32
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
33
+ tabMode: "indent",
34
+ matchBrackets: true,
35
+ });
36
+ </script>
37
+
38
+ <p>Based on CodeMirror's clike mode. For more information see <a href="http://hpccsystems.com">HPCC Systems</a> web site.</p>
39
+ <p><strong>MIME types defined:</strong> <code>text/x-ecl</code>.</p>
40
+
41
+ </body>
42
+ </html>
@@ -0,0 +1,108 @@
1
+ CodeMirror.defineMode("gfm", function(config, parserConfig) {
2
+ var mdMode = CodeMirror.getMode(config, "markdown");
3
+ var aliases = {
4
+ html: "htmlmixed",
5
+ js: "javascript",
6
+ json: "application/json",
7
+ c: "text/x-csrc",
8
+ "c++": "text/x-c++src",
9
+ java: "text/x-java",
10
+ csharp: "text/x-csharp",
11
+ "c#": "text/x-csharp"
12
+ };
13
+
14
+ // make this lazy so that we don't need to load GFM last
15
+ var getMode = (function () {
16
+ var i, modes = {}, mimes = {}, mime;
17
+
18
+ var list = CodeMirror.listModes();
19
+ for (i = 0; i < list.length; i++) {
20
+ modes[list[i]] = list[i];
21
+ }
22
+ var mimesList = CodeMirror.listMIMEs();
23
+ for (i = 0; i < mimesList.length; i++) {
24
+ mime = mimesList[i].mime;
25
+ mimes[mime] = mimesList[i].mime;
26
+ }
27
+
28
+ for (var a in aliases) {
29
+ if (aliases[a] in modes || aliases[a] in mimes)
30
+ modes[a] = aliases[a];
31
+ }
32
+
33
+ return function (lang) {
34
+ return modes[lang] ? CodeMirror.getMode(config, modes[lang]) : null;
35
+ }
36
+ }());
37
+
38
+ function markdown(stream, state) {
39
+ // intercept fenced code blocks
40
+ if (stream.sol() && stream.match(/^```([\w+#]*)/)) {
41
+ // try switching mode
42
+ state.localMode = getMode(RegExp.$1)
43
+ if (state.localMode)
44
+ state.localState = state.localMode.startState();
45
+
46
+ state.token = local;
47
+ return 'code';
48
+ }
49
+
50
+ return mdMode.token(stream, state.mdState);
51
+ }
52
+
53
+ function local(stream, state) {
54
+ if (stream.sol() && stream.match(/^```/)) {
55
+ state.localMode = state.localState = null;
56
+ state.token = markdown;
57
+ return 'code';
58
+ }
59
+ else if (state.localMode) {
60
+ return state.localMode.token(stream, state.localState);
61
+ } else {
62
+ stream.skipToEnd();
63
+ return 'code';
64
+ }
65
+ }
66
+
67
+ // custom handleText to prevent emphasis in the middle of a word
68
+ // and add autolinking
69
+ function handleText(stream, mdState) {
70
+ var match;
71
+ if (stream.match(/^\w+:\/\/\S+/)) {
72
+ return 'linkhref';
73
+ }
74
+ if (stream.match(/^[^\[*\\<>` _][^\[*\\<>` ]*[^\[*\\<>` _]/)) {
75
+ return mdMode.getType(mdState);
76
+ }
77
+ if (match = stream.match(/^[^\[*\\<>` ]+/)) {
78
+ var word = match[0];
79
+ if (word[0] === '_' && word[word.length-1] === '_') {
80
+ stream.backUp(word.length);
81
+ return undefined;
82
+ }
83
+ return mdMode.getType(mdState);
84
+ }
85
+ if (stream.eatSpace()) {
86
+ return null;
87
+ }
88
+ }
89
+
90
+ return {
91
+ startState: function() {
92
+ var mdState = mdMode.startState();
93
+ mdState.text = handleText;
94
+ return {token: markdown, mode: "markdown", mdState: mdState,
95
+ localMode: null, localState: null};
96
+ },
97
+
98
+ copyState: function(state) {
99
+ return {token: state.token, mode: state.mode, mdState: CodeMirror.copyState(mdMode, state.mdState),
100
+ localMode: state.localMode,
101
+ localState: state.localMode ? CodeMirror.copyState(state.localMode, state.localState) : null};
102
+ },
103
+
104
+ token: function(stream, state) {
105
+ return state.token(stream, state);
106
+ }
107
+ }
108
+ });