kit_cms 2.3.9 → 2.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. data/app/assets/images/mercury/dashboard.png +0 -0
  2. data/app/assets/images/mercury/info.png +0 -0
  3. data/app/assets/images/mercury/insertsPanel.png +0 -0
  4. data/app/assets/images/mercury/related.png +0 -0
  5. data/app/assets/images/mercury/view.png +0 -0
  6. data/app/assets/javascripts/{kit/best_in_place.js → best_in_place.js} +0 -0
  7. data/app/assets/javascripts/codemirror/editor.js +1 -1
  8. data/app/assets/javascripts/codemirror/sass.js +349 -0
  9. data/app/assets/javascripts/{kit/fancybox → fancybox}/ajax.txt +0 -0
  10. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/blank.gif +0 -0
  11. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_close.png +0 -0
  12. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_loading.png +0 -0
  13. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_nav_left.png +0 -0
  14. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_nav_right.png +0 -0
  15. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_e.png +0 -0
  16. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_n.png +0 -0
  17. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_ne.png +0 -0
  18. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_nw.png +0 -0
  19. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_s.png +0 -0
  20. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_se.png +0 -0
  21. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_sw.png +0 -0
  22. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_w.png +0 -0
  23. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_title_left.png +0 -0
  24. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_title_main.png +0 -0
  25. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_title_over.png +0 -0
  26. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_title_right.png +0 -0
  27. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox-x.png +0 -0
  28. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox-y.png +0 -0
  29. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox.css +0 -0
  30. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox.js +0 -0
  31. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox.png +0 -0
  32. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/jquery.mousewheel-3.0.4.pack.js +0 -0
  33. data/app/assets/javascripts/{kit/fancybox → fancybox}/index.html +0 -0
  34. data/app/assets/javascripts/{kit/fancybox → fancybox}/style.css +0 -0
  35. data/app/assets/javascripts/{kit/gadash-1.0.js → gadash-1.0.js} +0 -0
  36. data/app/assets/javascripts/{kit/jquery-ui.js → jquery-ui.js} +0 -0
  37. data/app/assets/javascripts/{kit/jquery.contextmenu.js → jquery.contextmenu.js} +0 -0
  38. data/app/assets/javascripts/{kit/jquery.fileupload-ui.js → jquery.fileupload-ui.js} +0 -0
  39. data/app/assets/javascripts/{kit/jquery.fileupload.js → jquery.fileupload.js} +0 -0
  40. data/app/assets/javascripts/{kit/jquery.js → jquery.js} +0 -0
  41. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/bg.jpg +0 -0
  42. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/d.png +0 -0
  43. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/doc.png +0 -0
  44. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/dot_for_ie.gif +0 -0
  45. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/gear.png +0 -0
  46. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/style.css +0 -0
  47. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/throbber.gif +0 -0
  48. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/bg.jpg +0 -0
  49. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/d.png +0 -0
  50. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/doc.png +0 -0
  51. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/dot_for_ie.gif +0 -0
  52. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/gear.png +0 -0
  53. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/style.css +0 -0
  54. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/throbber.gif +0 -0
  55. data/app/assets/javascripts/{kit/jquery.validate.js → jquery.validate.js} +0 -0
  56. data/app/assets/javascripts/jqueryui.js +4 -0
  57. data/app/assets/javascripts/{kit/jsplumb-min.js → jsplumb-min.js} +0 -0
  58. data/app/assets/javascripts/{kit_admin.js → kit/cms.js} +5 -4
  59. data/app/assets/javascripts/kit/{mercury-editor.js.erb → editor.js} +5 -4
  60. data/app/assets/javascripts/kit/kit.js +12 -0
  61. data/app/assets/javascripts/kit/utilities.js +0 -15
  62. data/app/assets/javascripts/{kit/underscore.js → underscore.js} +0 -0
  63. data/app/assets/javascripts/{kit/waypoint.js → waypoint.js} +0 -0
  64. data/app/assets/stylesheets/codemirror/editor.css +6 -0
  65. data/app/assets/stylesheets/codemirror/style.css +2 -2
  66. data/app/assets/stylesheets/codemirror/theme.css +26 -1
  67. data/app/assets/stylesheets/{kit_admin.css → kit/admin.css} +0 -0
  68. data/app/assets/stylesheets/kit/cms.css +35 -0
  69. data/app/assets/stylesheets/{mercury_editor.css → kit/editor.css} +9 -0
  70. data/app/assets/stylesheets/{kit.css → kit/kit.css} +4 -4
  71. data/app/controllers/admin/ad_units_controller.rb +1 -1
  72. data/app/controllers/admin/block_controller.rb +1 -1
  73. data/app/controllers/admin/block_instance_controller.rb +1 -1
  74. data/app/controllers/admin/blocks_controller.rb +1 -1
  75. data/app/controllers/admin/calendar_entries_controller.rb +1 -1
  76. data/app/controllers/admin/calendars_controller.rb +1 -1
  77. data/app/controllers/admin/content_controller.rb +1 -1
  78. data/app/controllers/admin/dashboard_controller.rb +15 -6
  79. data/app/controllers/admin/forum_controller.rb +1 -1
  80. data/app/controllers/admin/help_controller.rb +1 -1
  81. data/app/controllers/admin/mapping_controller.rb +1 -1
  82. data/app/controllers/admin/newsletter_controller.rb +1 -1
  83. data/app/controllers/admin/page_template_terms_controller.rb +1 -1
  84. data/app/controllers/admin/page_templates_controller.rb +1 -1
  85. data/app/controllers/admin/preference_controller.rb +1 -1
  86. data/app/controllers/admin/snippet_controller.rb +1 -1
  87. data/app/controllers/admin/todo_controller.rb +2 -2
  88. data/app/controllers/admin/user_controller.rb +1 -1
  89. data/app/controllers/admin/views_controller.rb +1 -1
  90. data/app/controllers/admin_controller.rb +1 -1
  91. data/app/controllers/asset_controller.rb +1 -1
  92. data/app/controllers/calendar_controller.rb +1 -1
  93. data/app/controllers/category_controller.rb +2 -2
  94. data/app/controllers/menu_controller.rb +1 -1
  95. data/app/controllers/pages_controller.rb +5 -5
  96. data/app/controllers/utility_controller.rb +1 -1
  97. data/app/helpers/kit_helper.rb +5 -17
  98. data/app/helpers/kit_modules_helper.rb +1 -1
  99. data/app/models/asset.rb +2 -0
  100. data/app/models/block.rb +1 -0
  101. data/app/models/block_instance.rb +8 -3
  102. data/app/models/html_asset.rb +1 -0
  103. data/app/models/layout.rb +1 -0
  104. data/app/models/page.rb +2 -3
  105. data/app/models/page_template.rb +2 -0
  106. data/app/views/admin/blocks/_form.html.haml +1 -1
  107. data/app/views/admin/dashboard/system.html.haml +1 -0
  108. data/app/views/admin/help/edit.html.haml +1 -1
  109. data/app/views/admin/html_asset/show.html.haml +1 -1
  110. data/app/views/admin/layouts/show.html.haml +2 -2
  111. data/app/views/admin/page_templates/_form.html.haml +1 -1
  112. data/app/views/admin/snippet/edit.html.erb +1 -1
  113. data/app/views/admin/snippet/new.html.erb +1 -1
  114. data/app/views/admin/stylesheet/show.html.haml +1 -1
  115. data/app/views/asset/index.html.haml +0 -3
  116. data/app/views/layouts/_cms-common.html.erb +1 -1
  117. data/app/views/layouts/_kit_header.html.haml +2 -2
  118. data/app/views/layouts/{cms-boxed.html.haml → cms.html.haml} +1 -1
  119. data/app/views/layouts/mercury-editor.html.erb +2 -8
  120. data/app/views/pages/content_edit.html.haml +1 -1
  121. data/app/views/utility/_cm_editor.html.erb +19 -0
  122. data/app/views/utility/mercury_html.html.haml +0 -3
  123. data/lib/kit_cms.rb +2 -0
  124. metadata +66 -196
  125. data/app/assets/javascripts/admin/advertisments.js +0 -2
  126. data/app/assets/javascripts/admin/kit_engagement.js +0 -2
  127. data/app/assets/javascripts/admin/order.js +0 -2
  128. data/app/assets/javascripts/kit.js +0 -14
  129. data/app/assets/javascripts/kit/ace/ace.js +0 -11
  130. data/app/assets/javascripts/kit/ace/ext-static_highlight.js +0 -1
  131. data/app/assets/javascripts/kit/ace/ext-textarea.js +0 -1
  132. data/app/assets/javascripts/kit/ace/keybinding-emacs.js +0 -1
  133. data/app/assets/javascripts/kit/ace/keybinding-vim.js +0 -1
  134. data/app/assets/javascripts/kit/ace/mode-abap.js +0 -1
  135. data/app/assets/javascripts/kit/ace/mode-asciidoc.js +0 -1
  136. data/app/assets/javascripts/kit/ace/mode-c9search.js +0 -1
  137. data/app/assets/javascripts/kit/ace/mode-c_cpp.js +0 -1
  138. data/app/assets/javascripts/kit/ace/mode-clojure.js +0 -1
  139. data/app/assets/javascripts/kit/ace/mode-coffee.js +0 -1
  140. data/app/assets/javascripts/kit/ace/mode-coldfusion.js +0 -1
  141. data/app/assets/javascripts/kit/ace/mode-csharp.js +0 -1
  142. data/app/assets/javascripts/kit/ace/mode-css.js +0 -1
  143. data/app/assets/javascripts/kit/ace/mode-dart.js +0 -1
  144. data/app/assets/javascripts/kit/ace/mode-diff.js +0 -1
  145. data/app/assets/javascripts/kit/ace/mode-dot.js +0 -1
  146. data/app/assets/javascripts/kit/ace/mode-glsl.js +0 -1
  147. data/app/assets/javascripts/kit/ace/mode-golang.js +0 -1
  148. data/app/assets/javascripts/kit/ace/mode-groovy.js +0 -1
  149. data/app/assets/javascripts/kit/ace/mode-haml.js +0 -1
  150. data/app/assets/javascripts/kit/ace/mode-haxe.js +0 -1
  151. data/app/assets/javascripts/kit/ace/mode-html.js +0 -1
  152. data/app/assets/javascripts/kit/ace/mode-jade.js +0 -1
  153. data/app/assets/javascripts/kit/ace/mode-java.js +0 -1
  154. data/app/assets/javascripts/kit/ace/mode-javascript.js +0 -1
  155. data/app/assets/javascripts/kit/ace/mode-json.js +0 -1
  156. data/app/assets/javascripts/kit/ace/mode-jsp.js +0 -1
  157. data/app/assets/javascripts/kit/ace/mode-jsx.js +0 -1
  158. data/app/assets/javascripts/kit/ace/mode-latex.js +0 -1
  159. data/app/assets/javascripts/kit/ace/mode-less.js +0 -1
  160. data/app/assets/javascripts/kit/ace/mode-liquid.js +0 -1
  161. data/app/assets/javascripts/kit/ace/mode-lisp.js +0 -1
  162. data/app/assets/javascripts/kit/ace/mode-lua.js +0 -1
  163. data/app/assets/javascripts/kit/ace/mode-luapage.js +0 -1
  164. data/app/assets/javascripts/kit/ace/mode-lucene.js +0 -1
  165. data/app/assets/javascripts/kit/ace/mode-makefile.js +0 -1
  166. data/app/assets/javascripts/kit/ace/mode-markdown.js +0 -1
  167. data/app/assets/javascripts/kit/ace/mode-objectivec.js +0 -1
  168. data/app/assets/javascripts/kit/ace/mode-ocaml.js +0 -1
  169. data/app/assets/javascripts/kit/ace/mode-perl.js +0 -1
  170. data/app/assets/javascripts/kit/ace/mode-pgsql.js +0 -1
  171. data/app/assets/javascripts/kit/ace/mode-php.js +0 -1
  172. data/app/assets/javascripts/kit/ace/mode-powershell.js +0 -1
  173. data/app/assets/javascripts/kit/ace/mode-python.js +0 -1
  174. data/app/assets/javascripts/kit/ace/mode-r.js +0 -1
  175. data/app/assets/javascripts/kit/ace/mode-rdoc.js +0 -1
  176. data/app/assets/javascripts/kit/ace/mode-rhtml.js +0 -1
  177. data/app/assets/javascripts/kit/ace/mode-ruby.js +0 -1
  178. data/app/assets/javascripts/kit/ace/mode-sass.js +0 -0
  179. data/app/assets/javascripts/kit/ace/mode-scad.js +0 -1
  180. data/app/assets/javascripts/kit/ace/mode-scala.js +0 -1
  181. data/app/assets/javascripts/kit/ace/mode-scss.js +0 -1
  182. data/app/assets/javascripts/kit/ace/mode-sh.js +0 -1
  183. data/app/assets/javascripts/kit/ace/mode-sql.js +0 -1
  184. data/app/assets/javascripts/kit/ace/mode-stylus.js +0 -1
  185. data/app/assets/javascripts/kit/ace/mode-svg.js +0 -1
  186. data/app/assets/javascripts/kit/ace/mode-tcl.js +0 -1
  187. data/app/assets/javascripts/kit/ace/mode-text.js +0 -0
  188. data/app/assets/javascripts/kit/ace/mode-textile.js +0 -1
  189. data/app/assets/javascripts/kit/ace/mode-typescript.js +0 -1
  190. data/app/assets/javascripts/kit/ace/mode-xml.js +0 -1
  191. data/app/assets/javascripts/kit/ace/mode-xquery.js +0 -1
  192. data/app/assets/javascripts/kit/ace/mode-yaml.js +0 -1
  193. data/app/assets/javascripts/kit/ace/theme-ambiance.js +0 -1
  194. data/app/assets/javascripts/kit/ace/theme-chaos.js +0 -1
  195. data/app/assets/javascripts/kit/ace/theme-chrome.js +0 -1
  196. data/app/assets/javascripts/kit/ace/theme-clouds.js +0 -1
  197. data/app/assets/javascripts/kit/ace/theme-clouds_midnight.js +0 -1
  198. data/app/assets/javascripts/kit/ace/theme-cobalt.js +0 -1
  199. data/app/assets/javascripts/kit/ace/theme-crimson_editor.js +0 -1
  200. data/app/assets/javascripts/kit/ace/theme-dawn.js +0 -1
  201. data/app/assets/javascripts/kit/ace/theme-dreamweaver.js +0 -1
  202. data/app/assets/javascripts/kit/ace/theme-eclipse.js +0 -1
  203. data/app/assets/javascripts/kit/ace/theme-github.js +0 -1
  204. data/app/assets/javascripts/kit/ace/theme-idle_fingers.js +0 -1
  205. data/app/assets/javascripts/kit/ace/theme-kr.js +0 -1
  206. data/app/assets/javascripts/kit/ace/theme-merbivore.js +0 -1
  207. data/app/assets/javascripts/kit/ace/theme-merbivore_soft.js +0 -1
  208. data/app/assets/javascripts/kit/ace/theme-mono_industrial.js +0 -1
  209. data/app/assets/javascripts/kit/ace/theme-monokai.js +0 -1
  210. data/app/assets/javascripts/kit/ace/theme-pastel_on_dark.js +0 -1
  211. data/app/assets/javascripts/kit/ace/theme-solarized_dark.js +0 -1
  212. data/app/assets/javascripts/kit/ace/theme-solarized_light.js +0 -1
  213. data/app/assets/javascripts/kit/ace/theme-textmate.js +0 -1
  214. data/app/assets/javascripts/kit/ace/theme-tomorrow.js +0 -1
  215. data/app/assets/javascripts/kit/ace/theme-tomorrow_night.js +0 -1
  216. data/app/assets/javascripts/kit/ace/theme-tomorrow_night_blue.js +0 -1
  217. data/app/assets/javascripts/kit/ace/theme-tomorrow_night_bright.js +0 -1
  218. data/app/assets/javascripts/kit/ace/theme-tomorrow_night_eighties.js +0 -1
  219. data/app/assets/javascripts/kit/ace/theme-twilight.js +0 -1
  220. data/app/assets/javascripts/kit/ace/theme-vibrant_ink.js +0 -1
  221. data/app/assets/javascripts/kit/ace/theme-xcode.js +0 -1
  222. data/app/assets/javascripts/kit/ace/worker-coffee.js +0 -1
  223. data/app/assets/javascripts/kit/ace/worker-css.js +0 -1
  224. data/app/assets/javascripts/kit/ace/worker-javascript.js +0 -1
  225. data/app/assets/javascripts/kit/ace/worker-json.js +0 -1
  226. data/app/assets/javascripts/kit/ace/worker-xquery.js +0 -1
  227. data/app/assets/javascripts/kit/jquery-ui.min.js +0 -126
  228. data/app/assets/javascripts/kit/jquery.markitup.js +0 -635
  229. data/app/assets/javascripts/kit/jquery.min.js +0 -3
  230. data/app/assets/javascripts/kit/rails_admin/application.js +0 -7
  231. data/app/assets/javascripts/kit/rails_admin/jquery-1.5.1.min.js +0 -16
  232. data/app/assets/javascripts/kit/rails_admin/jquery-ui-1.8.10.min.js +0 -405
  233. data/app/assets/javascripts/kit/rails_admin/jquery.colorpicker.js +0 -484
  234. data/app/assets/javascripts/kit/rails_admin/jquery.ui.timepicker.js +0 -915
  235. data/app/assets/javascripts/kit/rails_admin/ra.datetimepicker.js +0 -67
  236. data/app/assets/javascripts/kit/rails_admin/ra.filtering-multiselect.js +0 -274
  237. data/app/assets/javascripts/kit/rails_admin/ra.filtering-select.js +0 -179
  238. data/app/assets/javascripts/kit/rails_admin/ra.remote-form.js +0 -111
  239. data/app/assets/javascripts/kit/rails_admin/ra.timeline.js +0 -206
  240. data/app/assets/javascripts/kit/rails_admin/rails.js +0 -289
  241. data/app/assets/stylesheets/application.css +0 -5
  242. data/app/assets/stylesheets/kit/rails_admin/aristo/images/bg_fallback.png +0 -0
  243. data/app/assets/stylesheets/kit/rails_admin/aristo/images/icon_sprite.png +0 -0
  244. data/app/assets/stylesheets/kit/rails_admin/aristo/images/progress_bar.gif +0 -0
  245. data/app/assets/stylesheets/kit/rails_admin/aristo/images/slider_handles.png +0 -0
  246. data/app/assets/stylesheets/kit/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
  247. data/app/assets/stylesheets/kit/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
  248. data/app/assets/stylesheets/kit/rails_admin/aristo/jquery-ui-1.8.7.custom.css +0 -703
  249. data/app/assets/stylesheets/kit/rails_admin/base.css +0 -349
  250. data/app/assets/stylesheets/kit/rails_admin/dashboard.css +0 -88
  251. data/app/assets/stylesheets/kit/rails_admin/form.css +0 -147
  252. data/app/assets/stylesheets/kit/rails_admin/jquery.colorpicker.css +0 -179
  253. data/app/assets/stylesheets/kit/rails_admin/jquery.ui.timepicker.css +0 -39
  254. data/app/assets/stylesheets/kit/rails_admin/list.css +0 -127
  255. data/app/assets/stylesheets/kit/rails_admin/ra.filtering-multiselect.css +0 -113
  256. data/app/assets/stylesheets/kit/rails_admin/ra.filtering-select.css +0 -7
  257. data/app/assets/stylesheets/kit/rails_admin/ra.timeline.css +0 -77
  258. data/app/assets/stylesheets/kit/ui.tar.gz +0 -0
  259. data/app/assets/stylesheets/mercury_overrides.css +0 -23
  260. data/app/views/layouts/cms.html.erb +0 -66
  261. data/app/views/utility/_ace_editor.html.erb +0 -10
Binary file
Binary file
Binary file
@@ -3,9 +3,9 @@
3
3
  *= require "./codemirror"
4
4
  *= require "./overlay"
5
5
  *= require "./htmlmixed"
6
+ *= require "./sass"
6
7
  *= require "./css"
7
8
  *= require "./xml"
8
- *= require "./css"
9
9
  *= require "./javascript"
10
10
  *= require "./dialog"
11
11
  *= require "./match-highlighter"
@@ -0,0 +1,349 @@
1
+ CodeMirror.defineMode("sass", function(config) {
2
+ var tokenRegexp = function(words){
3
+ return new RegExp("^" + words.join("|"));
4
+ };
5
+
6
+ var tags = ["&", "a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","command","datalist","dd","del","details","dfn","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","keygen","kbd","label","legend","li","link","map","mark","menu","meta","meter","nav","noframes","noscript","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strike","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr"];
7
+ var keywords = ["true", "false", "null", "auto"];
8
+ var keywordsRegexp = new RegExp("^" + keywords.join("|"));
9
+
10
+ var operators = ["\\(", "\\)", "=", ">", "<", "==", ">=", "<=", "\\+", "-", "\\!=", "/", "\\*", "%", "and", "or", "not"];
11
+ var opRegexp = tokenRegexp(operators);
12
+
13
+ function htmlTag(val){
14
+ for(var i=0; i<tags.length; i++){
15
+ if(val === tags[i]){
16
+ return true;
17
+ }
18
+ }
19
+ }
20
+
21
+
22
+ var pseudoElements = [':first-line', ':hover', ':first-letter', ':active', ':visited', ':before', ':after', ':link', ':focus', ':first-child', ':lang'];
23
+ var pseudoElementsRegexp = new RegExp("^(" + pseudoElements.join("\\b|") + ")");
24
+
25
+ var urlTokens = function(stream, state){
26
+ var ch = stream.peek();
27
+
28
+ if (ch === ")"){
29
+ stream.next();
30
+ state.tokenizer = tokenBase;
31
+ return "operator";
32
+ }else if (ch === "("){
33
+ stream.next();
34
+ stream.eatSpace();
35
+
36
+ return "operator";
37
+ }else if (ch === "'" || ch === '"'){
38
+ state.tokenizer = buildStringTokenizer(stream.next());
39
+ return "string";
40
+ }else{
41
+ state.tokenizer = buildStringTokenizer(")", false);
42
+ return "string";
43
+ }
44
+ };
45
+ var multilineComment = function(stream, state) {
46
+ if (stream.skipTo("*/")){
47
+ stream.next();
48
+ stream.next();
49
+ state.tokenizer = tokenBase;
50
+ }else {
51
+ stream.next();
52
+ }
53
+
54
+ return "comment";
55
+ };
56
+
57
+ var buildStringTokenizer = function(quote, greedy){
58
+ if(greedy == null){ greedy = true; }
59
+
60
+ function stringTokenizer(stream, state){
61
+ var nextChar = stream.next();
62
+ var peekChar = stream.peek();
63
+ var previousChar = stream.string.charAt(stream.pos-2);
64
+
65
+ var endingString = ((nextChar !== "\\" && peekChar === quote) || (nextChar === quote && previousChar !== "\\"));
66
+
67
+ /*
68
+ console.log("previousChar: " + previousChar);
69
+ console.log("nextChar: " + nextChar);
70
+ console.log("peekChar: " + peekChar);
71
+ console.log("ending: " + endingString);
72
+ */
73
+
74
+ if (endingString){
75
+ if (nextChar !== quote && greedy) { stream.next(); }
76
+ state.tokenizer = tokenBase;
77
+ return "string";
78
+ }else if (nextChar === "#" && peekChar === "{"){
79
+ state.tokenizer = buildInterpolationTokenizer(stringTokenizer);
80
+ stream.next();
81
+ return "operator";
82
+ }else {
83
+ return "string";
84
+ }
85
+ }
86
+
87
+ return stringTokenizer;
88
+ };
89
+
90
+ var buildInterpolationTokenizer = function(currentTokenizer){
91
+ return function(stream, state){
92
+ if (stream.peek() === "}"){
93
+ stream.next();
94
+ state.tokenizer = currentTokenizer;
95
+ return "operator";
96
+ }else{
97
+ return tokenBase(stream, state);
98
+ }
99
+ };
100
+ };
101
+
102
+ var indent = function(state){
103
+ if (state.indentCount == 0){
104
+ state.indentCount++;
105
+ var lastScopeOffset = state.scopes[0].offset;
106
+ var currentOffset = lastScopeOffset + config.indentUnit;
107
+ state.scopes.unshift({ offset:currentOffset });
108
+ }
109
+ };
110
+
111
+ var dedent = function(state){
112
+ if (state.scopes.length == 1) { return; }
113
+
114
+ state.scopes.shift();
115
+ };
116
+
117
+ var tokenBase = function(stream, state) {
118
+ var ch = stream.peek();
119
+
120
+ // Single line Comment
121
+ if (stream.match('//')) {
122
+ stream.skipToEnd();
123
+ return "comment";
124
+ }
125
+
126
+ // Multiline Comment
127
+ if (stream.match('/*')){
128
+ state.tokenizer = multilineComment;
129
+ return state.tokenizer(stream, state);
130
+ }
131
+
132
+ // Interpolation
133
+ if (stream.match('#{')){
134
+ state.tokenizer = buildInterpolationTokenizer(tokenBase);
135
+ return "operator";
136
+ }
137
+
138
+ if (ch === "."){
139
+ stream.next();
140
+
141
+ // Match class selectors
142
+ if (stream.match(/^[\w-]+/)){
143
+ indent(state);
144
+ return "atom";
145
+ }else if (stream.peek() === "#"){
146
+ indent(state);
147
+ return "atom";
148
+ }else{
149
+ return "operator";
150
+ }
151
+ }
152
+
153
+ if (ch === "#"){
154
+ stream.next();
155
+
156
+ // Hex numbers
157
+ if (stream.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)){
158
+ return "number";
159
+ }
160
+
161
+ // ID selectors
162
+ if (stream.match(/^[\w-]+/)){
163
+ indent(state);
164
+ return "atom";
165
+ }
166
+
167
+ if (stream.peek() === "#"){
168
+ indent(state);
169
+ return "atom";
170
+ }
171
+ }
172
+
173
+ // Numbers
174
+ if (stream.match(/^-?[0-9\.]+/)){
175
+ return "number";
176
+ }
177
+
178
+ // Units
179
+ if (stream.match(/^(px|em|in)\b/)){
180
+ return "unit";
181
+ }
182
+
183
+ if (stream.match(keywordsRegexp)){
184
+ return "keyword";
185
+ }
186
+
187
+ if (stream.match(/^url/) && stream.peek() === "("){
188
+ state.tokenizer = urlTokens;
189
+ return "atom";
190
+ }
191
+
192
+ // Variables
193
+ if (ch === "$"){
194
+ stream.next();
195
+ stream.eatWhile(/[\w-]/);
196
+
197
+ if (stream.peek() === ":"){
198
+ stream.next();
199
+ return "variable-2";
200
+ }else{
201
+ return "variable-3";
202
+ }
203
+ }
204
+
205
+ if (ch === "!"){
206
+ stream.next();
207
+
208
+ if (stream.match(/^[\w]+/)){
209
+ return "keyword";
210
+ }
211
+
212
+ return "operator";
213
+ }
214
+
215
+ if (ch === "="){
216
+ stream.next();
217
+
218
+ // Match shortcut mixin definition
219
+ if (stream.match(/^[\w-]+/)){
220
+ indent(state);
221
+ return "meta";
222
+ }else {
223
+ return "operator";
224
+ }
225
+ }
226
+
227
+ if (ch === "+"){
228
+ stream.next();
229
+
230
+ // Match shortcut mixin definition
231
+ if (stream.match(/^[\w-]+/)){
232
+ return "variable-3";
233
+ }else {
234
+ return "operator";
235
+ }
236
+ }
237
+
238
+ // Indent Directives
239
+ if (stream.match(/^@(else if|if|media|else|for|each|while|mixin|function)/)){
240
+ indent(state);
241
+ return "meta";
242
+ }
243
+
244
+ // Other Directives
245
+ if (ch === "@"){
246
+ stream.next();
247
+ stream.eatWhile(/[\w-]/);
248
+ return "meta";
249
+ }
250
+
251
+ // Strings
252
+ if (ch === '"' || ch === "'"){
253
+ stream.next();
254
+ state.tokenizer = buildStringTokenizer(ch);
255
+ return "string";
256
+ }
257
+
258
+ // Pseudo element selectors
259
+ if (stream.match(pseudoElementsRegexp)){
260
+ return "keyword";
261
+ }
262
+
263
+ // atoms
264
+ if (stream.eatWhile(/[\w-&]/)){
265
+
266
+ var current = stream.current();
267
+ // matches a property definition
268
+ if (stream.peek() === ":"){
269
+ // if this is an html tag and it has a pseudo selector, then it's an atom
270
+ if (htmlTag(current) && stream.match(pseudoElementsRegexp, false)){
271
+ return "atom";
272
+ }else{
273
+ stream.next();
274
+ return "property";
275
+ }
276
+ }
277
+ return "atom";
278
+ }
279
+
280
+ if (stream.match(opRegexp)){
281
+ return "operator";
282
+ }
283
+
284
+ // If we haven't returned by now, we move 1 character
285
+ // and return an error
286
+ stream.next();
287
+ return 'error';
288
+ };
289
+
290
+ var tokenLexer = function(stream, state) {
291
+ if (stream.sol()){
292
+ state.indentCount = 0;
293
+ }
294
+ var style = state.tokenizer(stream, state);
295
+ var current = stream.current();
296
+
297
+ if (current === "@return"){
298
+ dedent(state);
299
+ }
300
+
301
+ if (style === "atom" && htmlTag(current)){
302
+ indent(state);
303
+ }
304
+
305
+ if (style !== "error"){
306
+ var startOfToken = stream.pos - current.length;
307
+ var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount);
308
+
309
+ var newScopes = [];
310
+
311
+ for (var i = 0; i < state.scopes.length; i++){
312
+ var scope = state.scopes[i];
313
+
314
+ if (scope.offset <= withCurrentIndent){
315
+ newScopes.push(scope);
316
+ }
317
+ }
318
+
319
+ state.scopes = newScopes;
320
+ }
321
+
322
+
323
+ return style;
324
+ };
325
+
326
+ return {
327
+ startState: function() {
328
+ return {
329
+ tokenizer: tokenBase,
330
+ scopes: [{offset: 0, type: 'sass'}],
331
+ definedVars: [],
332
+ definedMixins: [],
333
+ };
334
+ },
335
+ token: function(stream, state) {
336
+ var style = tokenLexer(stream, state);
337
+
338
+ state.lastToken = { style: style, content: stream.current() };
339
+
340
+ return style;
341
+ },
342
+
343
+ indent: function(state) {
344
+ return state.scopes[0].offset;
345
+ }
346
+ };
347
+ });
348
+
349
+ CodeMirror.defineMIME("text/x-sass", "sass");