active_admin_pro 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +20 -0
  3. data/README.md +5 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/javascripts/active_admin_pro.js +41 -0
  6. data/app/assets/javascripts/active_admin_pro/actions/new.js +8 -0
  7. data/app/assets/javascripts/active_admin_pro/actions/show.js +12 -0
  8. data/app/assets/javascripts/active_admin_pro/components/codemirror_input.js +92 -0
  9. data/app/assets/javascripts/active_admin_pro/components/flashes.js +9 -0
  10. data/app/assets/javascripts/active_admin_pro/components/link.js +23 -0
  11. data/app/assets/javascripts/active_admin_pro/components/phone_input.js +52 -0
  12. data/app/assets/javascripts/active_admin_pro/components/select_input.js +31 -0
  13. data/app/assets/javascripts/active_admin_pro/components/sortable_handle.js +8 -0
  14. data/app/assets/javascripts/active_admin_pro/components/summernote_input.js +132 -0
  15. data/app/assets/javascripts/active_admin_pro/components/text_input.js +47 -0
  16. data/app/assets/javascripts/active_admin_pro/components/time_zone_input.js +51 -0
  17. data/app/assets/javascripts/active_admin_pro/components/title_to_slug.js +16 -0
  18. data/app/assets/stylesheets/active_admin_pro.scss +20 -0
  19. data/app/assets/stylesheets/active_admin_pro/breakpoints.scss +3 -0
  20. data/app/assets/stylesheets/active_admin_pro/components/_input_variables.scss +9 -0
  21. data/app/assets/stylesheets/active_admin_pro/components/actions.scss +13 -0
  22. data/app/assets/stylesheets/active_admin_pro/components/boolean_input.scss +13 -0
  23. data/app/assets/stylesheets/active_admin_pro/components/button.scss +7 -0
  24. data/app/assets/stylesheets/active_admin_pro/components/check_boxes_input.scss +38 -0
  25. data/app/assets/stylesheets/active_admin_pro/components/codemirror_input.scss +53 -0
  26. data/app/assets/stylesheets/active_admin_pro/components/comments.scss +17 -0
  27. data/app/assets/stylesheets/active_admin_pro/components/datepicker.scss +108 -0
  28. data/app/assets/stylesheets/active_admin_pro/components/dialog.scss +66 -0
  29. data/app/assets/stylesheets/active_admin_pro/components/dropdown_menu_button.scss +40 -0
  30. data/app/assets/stylesheets/active_admin_pro/components/fieldset.scss +26 -0
  31. data/app/assets/stylesheets/active_admin_pro/components/file_input.scss +27 -0
  32. data/app/assets/stylesheets/active_admin_pro/components/has_many_fields.scss +4 -0
  33. data/app/assets/stylesheets/active_admin_pro/components/inline_errors.scss +7 -0
  34. data/app/assets/stylesheets/active_admin_pro/components/link.scss +16 -0
  35. data/app/assets/stylesheets/active_admin_pro/components/panel.scss +62 -0
  36. data/app/assets/stylesheets/active_admin_pro/components/phone_input.scss +31 -0
  37. data/app/assets/stylesheets/active_admin_pro/components/radio_input.scss +38 -0
  38. data/app/assets/stylesheets/active_admin_pro/components/segmented_control.scss +41 -0
  39. data/app/assets/stylesheets/active_admin_pro/components/select_input.scss +42 -0
  40. data/app/assets/stylesheets/active_admin_pro/components/sortable_handle.scss +21 -0
  41. data/app/assets/stylesheets/active_admin_pro/components/string_input.scss +85 -0
  42. data/app/assets/stylesheets/active_admin_pro/components/summernote_input.scss +190 -0
  43. data/app/assets/stylesheets/active_admin_pro/components/table.scss +100 -0
  44. data/app/assets/stylesheets/active_admin_pro/components/text_input.scss +55 -0
  45. data/app/assets/stylesheets/active_admin_pro/functions/color.scss +130 -0
  46. data/app/assets/stylesheets/active_admin_pro/functions/text-color.scss +35 -0
  47. data/app/assets/stylesheets/active_admin_pro/layout/actions/comments.scss +14 -0
  48. data/app/assets/stylesheets/active_admin_pro/layout/actions/index.scss +88 -0
  49. data/app/assets/stylesheets/active_admin_pro/layout/actions/show.scss +25 -0
  50. data/app/assets/stylesheets/active_admin_pro/layout/body.scss +60 -0
  51. data/app/assets/stylesheets/active_admin_pro/layout/desktop/action_items.scss +32 -0
  52. data/app/assets/stylesheets/active_admin_pro/layout/desktop/actions/comments.scss +10 -0
  53. data/app/assets/stylesheets/active_admin_pro/layout/desktop/active_admin_content.scss +22 -0
  54. data/app/assets/stylesheets/active_admin_pro/layout/desktop/breadcrumbs.scss +57 -0
  55. data/app/assets/stylesheets/active_admin_pro/layout/desktop/navigation.scss +197 -0
  56. data/app/assets/stylesheets/active_admin_pro/layout/desktop/sidebar.scss +5 -0
  57. data/app/assets/stylesheets/active_admin_pro/layout/desktop/title_bar.scss +24 -0
  58. data/app/assets/stylesheets/active_admin_pro/layout/desktop/wrapper.scss +5 -0
  59. data/app/assets/stylesheets/active_admin_pro/layout/filters.scss +41 -0
  60. data/app/assets/stylesheets/active_admin_pro/layout/flashes.scss +52 -0
  61. data/app/assets/stylesheets/active_admin_pro/layout/footer.scss +3 -0
  62. data/app/assets/stylesheets/active_admin_pro/layout/mobile/actions/index.scss +7 -0
  63. data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/dashboard.scss +105 -0
  64. data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/index.scss +20 -0
  65. data/app/assets/stylesheets/active_admin_pro/layout/tablet/actions/show.scss +78 -0
  66. data/app/assets/stylesheets/active_admin_pro/layout/tablet/active_admin_content.scss +9 -0
  67. data/app/assets/stylesheets/active_admin_pro/layout/tablet/flashes.scss +5 -0
  68. data/app/assets/stylesheets/active_admin_pro/layout/tablet/navigation.scss +48 -0
  69. data/app/assets/stylesheets/active_admin_pro/layout/tablet/title_bar.scss +53 -0
  70. data/app/assets/stylesheets/active_admin_pro/mixins/button.scss +48 -0
  71. data/app/assets/stylesheets/active_admin_pro/variables.scss +10 -0
  72. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon.scss +87 -0
  73. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/_bourbon-deprecated-upcoming.scss +411 -0
  74. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-color.scss +26 -0
  75. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-radius.scss +48 -0
  76. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-style.scss +25 -0
  77. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_border-width.scss +25 -0
  78. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_buttons.scss +64 -0
  79. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_clearfix.scss +25 -0
  80. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_ellipsis.scss +30 -0
  81. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_font-stacks.scss +31 -0
  82. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_hide-text.scss +27 -0
  83. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_margin.scss +26 -0
  84. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_padding.scss +26 -0
  85. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_position.scss +48 -0
  86. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_prefixer.scss +66 -0
  87. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_retina-image.scss +25 -0
  88. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_size.scss +51 -0
  89. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_text-inputs.scss +113 -0
  90. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_timing-functions.scss +34 -0
  91. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_triangle.scss +63 -0
  92. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/addons/_word-wrap.scss +29 -0
  93. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_animation.scss +43 -0
  94. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_appearance.scss +3 -0
  95. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_backface-visibility.scss +3 -0
  96. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_background-image.scss +42 -0
  97. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_background.scss +55 -0
  98. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_border-image.scss +59 -0
  99. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_calc.scss +4 -0
  100. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_columns.scss +47 -0
  101. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_filter.scss +4 -0
  102. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_flex-box.scss +287 -0
  103. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_font-face.scss +24 -0
  104. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_font-feature-settings.scss +4 -0
  105. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_hidpi-media-query.scss +10 -0
  106. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_hyphens.scss +4 -0
  107. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_image-rendering.scss +14 -0
  108. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_keyframes.scss +36 -0
  109. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_linear-gradient.scss +38 -0
  110. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_perspective.scss +8 -0
  111. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_placeholder.scss +8 -0
  112. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_radial-gradient.scss +39 -0
  113. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_selection.scss +42 -0
  114. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_text-decoration.scss +19 -0
  115. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_transform.scss +15 -0
  116. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_transition.scss +71 -0
  117. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/css3/_user-select.scss +3 -0
  118. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_assign-inputs.scss +11 -0
  119. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_contains-falsy.scss +20 -0
  120. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_contains.scss +26 -0
  121. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-length.scss +11 -0
  122. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-light.scss +21 -0
  123. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-number.scss +11 -0
  124. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_is-size.scss +13 -0
  125. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_modular-scale.scss +69 -0
  126. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_px-to-em.scss +13 -0
  127. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_px-to-rem.scss +15 -0
  128. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_shade.scss +24 -0
  129. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_strip-units.scss +17 -0
  130. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_tint.scss +24 -0
  131. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_transition-property-name.scss +22 -0
  132. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/functions/_unpack.scss +27 -0
  133. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_convert-units.scss +21 -0
  134. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_directional-values.scss +96 -0
  135. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_font-source-declaration.scss +43 -0
  136. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_gradient-positions-parser.scss +13 -0
  137. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-angle-parser.scss +25 -0
  138. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-gradient-parser.scss +41 -0
  139. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-positions-parser.scss +61 -0
  140. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_linear-side-corner-parser.scss +31 -0
  141. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-arg-parser.scss +69 -0
  142. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-gradient-parser.scss +50 -0
  143. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_radial-positions-parser.scss +18 -0
  144. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_render-gradients.scss +26 -0
  145. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_shape-size-stripper.scss +10 -0
  146. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/helpers/_str-to-num.scss +50 -0
  147. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_asset-pipeline.scss +7 -0
  148. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_prefixer.scss +9 -0
  149. data/app/assets/stylesheets/active_admin_pro/vendor/bourbon/settings/_px-to-em.scss +1 -0
  150. data/app/assets/stylesheets/active_admin_pro/vendor/neat.scss +22 -0
  151. data/app/assets/stylesheets/active_admin_pro/vendor/neat/_neat-helpers.scss +8 -0
  152. data/app/assets/stylesheets/active_admin_pro/vendor/neat/functions/_new-breakpoint.scss +49 -0
  153. data/app/assets/stylesheets/active_admin_pro/vendor/neat/functions/_private.scss +108 -0
  154. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_box-sizing.scss +11 -0
  155. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_direction-context.scss +31 -0
  156. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_display-context.scss +26 -0
  157. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_fill-parent.scss +22 -0
  158. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_media.scss +92 -0
  159. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_omega.scss +91 -0
  160. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_outer-container.scss +36 -0
  161. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_pad.scss +23 -0
  162. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_private.scss +35 -0
  163. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_row.scss +53 -0
  164. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_shift.scss +48 -0
  165. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_span-columns.scss +90 -0
  166. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_to-deprecate.scss +105 -0
  167. data/app/assets/stylesheets/active_admin_pro/vendor/neat/grid/_visual-grid.scss +40 -0
  168. data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_disable-warnings.scss +11 -0
  169. data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_grid.scss +53 -0
  170. data/app/assets/stylesheets/active_admin_pro/vendor/neat/settings/_visual-grid.scss +25 -0
  171. data/app/assets/stylesheets/active_admin_pro/vendor/normalize.css +423 -0
  172. data/app/assets/stylesheets/codemirror/themes/activeadmin_pro.scss +117 -0
  173. data/app/inputs/codemirror_input.rb +27 -0
  174. data/app/inputs/datepicker_input.rb +16 -0
  175. data/app/inputs/phone_input.rb +5 -0
  176. data/app/inputs/summernote_input.rb +5 -0
  177. data/app/inputs/time_zone_input.rb +43 -0
  178. data/app/models/activeadmin_pro/summernote_image.rb +5 -0
  179. data/config/initializers/active_admin.rb +50 -0
  180. data/config/locales/en.yml +55 -0
  181. data/lib/active_admin_pro/admin_user/admin_user.rb +52 -0
  182. data/lib/active_admin_pro/engine.rb +8 -0
  183. data/lib/active_admin_pro/summernote_image/summernote_image.rb +61 -0
  184. data/lib/active_admin_pro/user/user.rb +53 -0
  185. data/lib/active_admin_pro/version.rb +3 -0
  186. data/lib/activeadmin_pro.rb +9 -0
  187. data/lib/generators/activeadmin_pro/install_generator.rb +14 -0
  188. data/lib/tasks/activeadmin_pro_tasks.rake +4 -0
  189. data/spec/spec_helper.rb +34 -0
  190. data/vendor/assets/javascripts/bootstrap.js +1243 -0
  191. data/vendor/assets/javascripts/codemirror.js +8887 -0
  192. data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +183 -0
  193. data/vendor/assets/javascripts/codemirror/addons/comment/continuecomment.js +85 -0
  194. data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.css +32 -0
  195. data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.js +157 -0
  196. data/vendor/assets/javascripts/codemirror/addons/display/autorefresh.js +47 -0
  197. data/vendor/assets/javascripts/codemirror/addons/display/fullscreen.css +6 -0
  198. data/vendor/assets/javascripts/codemirror/addons/display/fullscreen.js +41 -0
  199. data/vendor/assets/javascripts/codemirror/addons/display/panel.js +112 -0
  200. data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +60 -0
  201. data/vendor/assets/javascripts/codemirror/addons/display/rulers.js +63 -0
  202. data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +195 -0
  203. data/vendor/assets/javascripts/codemirror/addons/edit/closetag.js +169 -0
  204. data/vendor/assets/javascripts/codemirror/addons/edit/continuelist.js +51 -0
  205. data/vendor/assets/javascripts/codemirror/addons/edit/matchbrackets.js +120 -0
  206. data/vendor/assets/javascripts/codemirror/addons/edit/matchtags.js +66 -0
  207. data/vendor/assets/javascripts/codemirror/addons/edit/trailingspace.js +27 -0
  208. data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +105 -0
  209. data/vendor/assets/javascripts/codemirror/addons/fold/comment-fold.js +57 -0
  210. data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +149 -0
  211. data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.css +20 -0
  212. data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.js +146 -0
  213. data/vendor/assets/javascripts/codemirror/addons/fold/indent-fold.js +44 -0
  214. data/vendor/assets/javascripts/codemirror/addons/fold/markdown-fold.js +49 -0
  215. data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +182 -0
  216. data/vendor/assets/javascripts/codemirror/addons/hint/anyword-hint.js +41 -0
  217. data/vendor/assets/javascripts/codemirror/addons/hint/css-hint.js +60 -0
  218. data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +348 -0
  219. data/vendor/assets/javascripts/codemirror/addons/hint/javascript-hint.js +146 -0
  220. data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.css +38 -0
  221. data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +386 -0
  222. data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +254 -0
  223. data/vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js +110 -0
  224. data/vendor/assets/javascripts/codemirror/addons/lint/coffeescript-lint.js +41 -0
  225. data/vendor/assets/javascripts/codemirror/addons/lint/css-lint.js +35 -0
  226. data/vendor/assets/javascripts/codemirror/addons/lint/html-lint.js +46 -0
  227. data/vendor/assets/javascripts/codemirror/addons/lint/javascript-lint.js +136 -0
  228. data/vendor/assets/javascripts/codemirror/addons/lint/json-lint.js +31 -0
  229. data/vendor/assets/javascripts/codemirror/addons/lint/lint.css +73 -0
  230. data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +231 -0
  231. data/vendor/assets/javascripts/codemirror/addons/lint/yaml-lint.js +28 -0
  232. data/vendor/assets/javascripts/codemirror/addons/merge/merge.css +112 -0
  233. data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +775 -0
  234. data/vendor/assets/javascripts/codemirror/addons/mode/loadmode.js +64 -0
  235. data/vendor/assets/javascripts/codemirror/addons/mode/multiplex.js +123 -0
  236. data/vendor/assets/javascripts/codemirror/addons/mode/multiplex_test.js +33 -0
  237. data/vendor/assets/javascripts/codemirror/addons/mode/overlay.js +85 -0
  238. data/vendor/assets/javascripts/codemirror/addons/mode/simple.js +213 -0
  239. data/vendor/assets/javascripts/codemirror/addons/runmode/colorize.js +40 -0
  240. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode-standalone.js +157 -0
  241. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.js +72 -0
  242. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +178 -0
  243. data/vendor/assets/javascripts/codemirror/addons/scroll/annotatescrollbar.js +115 -0
  244. data/vendor/assets/javascripts/codemirror/addons/scroll/scrollpastend.js +46 -0
  245. data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.css +66 -0
  246. data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.js +147 -0
  247. data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +128 -0
  248. data/vendor/assets/javascripts/codemirror/addons/search/matchesonscrollbar.css +8 -0
  249. data/vendor/assets/javascripts/codemirror/addons/search/matchesonscrollbar.js +97 -0
  250. data/vendor/assets/javascripts/codemirror/addons/search/search.js +228 -0
  251. data/vendor/assets/javascripts/codemirror/addons/search/searchcursor.js +189 -0
  252. data/vendor/assets/javascripts/codemirror/addons/selection/active-line.js +71 -0
  253. data/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js +118 -0
  254. data/vendor/assets/javascripts/codemirror/addons/selection/selection-pointer.js +98 -0
  255. data/vendor/assets/javascripts/codemirror/addons/tern/tern.css +87 -0
  256. data/vendor/assets/javascripts/codemirror/addons/tern/tern.js +700 -0
  257. data/vendor/assets/javascripts/codemirror/addons/tern/worker.js +44 -0
  258. data/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js +139 -0
  259. data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +366 -0
  260. data/vendor/assets/javascripts/codemirror/modes/css.js +823 -0
  261. data/vendor/assets/javascripts/codemirror/modes/diff.js +47 -0
  262. data/vendor/assets/javascripts/codemirror/modes/dockerfile.js +79 -0
  263. data/vendor/assets/javascripts/codemirror/modes/gfm.js +130 -0
  264. data/vendor/assets/javascripts/codemirror/modes/go.js +185 -0
  265. data/vendor/assets/javascripts/codemirror/modes/haml.js +159 -0
  266. data/vendor/assets/javascripts/codemirror/modes/handlebars.js +53 -0
  267. data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +28 -0
  268. data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +150 -0
  269. data/vendor/assets/javascripts/codemirror/modes/javascript.js +708 -0
  270. data/vendor/assets/javascripts/codemirror/modes/markdown.js +792 -0
  271. data/vendor/assets/javascripts/codemirror/modes/nginx.js +178 -0
  272. data/vendor/assets/javascripts/codemirror/modes/php.js +234 -0
  273. data/vendor/assets/javascripts/codemirror/modes/python.js +358 -0
  274. data/vendor/assets/javascripts/codemirror/modes/ruby.js +285 -0
  275. data/vendor/assets/javascripts/codemirror/modes/rust.js +58 -0
  276. data/vendor/assets/javascripts/codemirror/modes/sass.js +414 -0
  277. data/vendor/assets/javascripts/codemirror/modes/shell.js +139 -0
  278. data/vendor/assets/javascripts/codemirror/modes/xml.js +385 -0
  279. data/vendor/assets/javascripts/codemirror/modes/yaml.js +117 -0
  280. data/vendor/assets/javascripts/intl-tel-input.js +963 -0
  281. data/vendor/assets/javascripts/intl-tel-utils.js +480 -0
  282. data/vendor/assets/javascripts/slug.js +212 -0
  283. data/vendor/assets/javascripts/summernote.js +6939 -0
  284. data/vendor/assets/stylesheets/codemirror.css +334 -0
  285. data/vendor/assets/stylesheets/codemirror/themes/base16-dark.css +38 -0
  286. data/vendor/assets/stylesheets/codemirror/themes/base16-light.css +38 -0
  287. data/vendor/assets/stylesheets/codemirror/themes/dracula.css +41 -0
  288. data/vendor/assets/stylesheets/codemirror/themes/material.css +53 -0
  289. data/vendor/assets/stylesheets/codemirror/themes/monokai.css +35 -0
  290. data/vendor/assets/stylesheets/codemirror/themes/solarized.css +163 -0
  291. data/vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css +34 -0
  292. data/vendor/assets/stylesheets/intl-tel-input.scss +1054 -0
  293. data/vendor/assets/stylesheets/summernote-bs3.css +5425 -0
  294. data/vendor/assets/stylesheets/summernote.css +1 -0
  295. metadata +604 -0
@@ -0,0 +1,792 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"), require("../xml/xml"), require("../meta"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror", "../xml/xml", "../meta"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
15
+
16
+ var htmlFound = CodeMirror.modes.hasOwnProperty("xml");
17
+ var htmlMode = CodeMirror.getMode(cmCfg, htmlFound ? {name: "xml", htmlMode: true} : "text/plain");
18
+
19
+ function getMode(name) {
20
+ if (CodeMirror.findModeByName) {
21
+ var found = CodeMirror.findModeByName(name);
22
+ if (found) name = found.mime || found.mimes[0];
23
+ }
24
+ var mode = CodeMirror.getMode(cmCfg, name);
25
+ return mode.name == "null" ? null : mode;
26
+ }
27
+
28
+ // Should characters that affect highlighting be highlighted separate?
29
+ // Does not include characters that will be output (such as `1.` and `-` for lists)
30
+ if (modeCfg.highlightFormatting === undefined)
31
+ modeCfg.highlightFormatting = false;
32
+
33
+ // Maximum number of nested blockquotes. Set to 0 for infinite nesting.
34
+ // Excess `>` will emit `error` token.
35
+ if (modeCfg.maxBlockquoteDepth === undefined)
36
+ modeCfg.maxBlockquoteDepth = 0;
37
+
38
+ // Should underscores in words open/close em/strong?
39
+ if (modeCfg.underscoresBreakWords === undefined)
40
+ modeCfg.underscoresBreakWords = true;
41
+
42
+ // Use `fencedCodeBlocks` to configure fenced code blocks. false to
43
+ // disable, string to specify a precise regexp that the fence should
44
+ // match, and true to allow three or more backticks or tildes (as
45
+ // per CommonMark).
46
+
47
+ // Turn on task lists? ("- [ ] " and "- [x] ")
48
+ if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;
49
+
50
+ // Turn on strikethrough syntax
51
+ if (modeCfg.strikethrough === undefined)
52
+ modeCfg.strikethrough = false;
53
+
54
+ var codeDepth = 0;
55
+
56
+ var header = 'header'
57
+ , code = 'comment'
58
+ , quote = 'quote'
59
+ , list1 = 'variable-2'
60
+ , list2 = 'variable-3'
61
+ , list3 = 'keyword'
62
+ , hr = 'hr'
63
+ , image = 'tag'
64
+ , formatting = 'formatting'
65
+ , linkinline = 'link'
66
+ , linkemail = 'link'
67
+ , linktext = 'link'
68
+ , linkhref = 'string'
69
+ , em = 'em'
70
+ , strong = 'strong'
71
+ , strikethrough = 'strikethrough';
72
+
73
+ var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/
74
+ , ulRE = /^[*\-+]\s+/
75
+ , olRE = /^[0-9]+([.)])\s+/
76
+ , taskListRE = /^\[(x| )\](?=\s)/ // Must follow ulRE or olRE
77
+ , atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/
78
+ , setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/
79
+ , textRE = /^[^#!\[\]*_\\<>` "'(~]+/
80
+ , fencedCodeRE = new RegExp("^(" + (modeCfg.fencedCodeBlocks === true ? "~~~+|```+" : modeCfg.fencedCodeBlocks) +
81
+ ")[ \\t]*([\\w+#]*)");
82
+
83
+ function switchInline(stream, state, f) {
84
+ state.f = state.inline = f;
85
+ return f(stream, state);
86
+ }
87
+
88
+ function switchBlock(stream, state, f) {
89
+ state.f = state.block = f;
90
+ return f(stream, state);
91
+ }
92
+
93
+ function lineIsEmpty(line) {
94
+ return !line || !/\S/.test(line.string)
95
+ }
96
+
97
+ // Blocks
98
+
99
+ function blankLine(state) {
100
+ // Reset linkTitle state
101
+ state.linkTitle = false;
102
+ // Reset EM state
103
+ state.em = false;
104
+ // Reset STRONG state
105
+ state.strong = false;
106
+ // Reset strikethrough state
107
+ state.strikethrough = false;
108
+ // Reset state.quote
109
+ state.quote = 0;
110
+ // Reset state.indentedCode
111
+ state.indentedCode = false;
112
+ if (!htmlFound && state.f == htmlBlock) {
113
+ state.f = inlineNormal;
114
+ state.block = blockNormal;
115
+ }
116
+ // Reset state.trailingSpace
117
+ state.trailingSpace = 0;
118
+ state.trailingSpaceNewLine = false;
119
+ // Mark this line as blank
120
+ state.prevLine = state.thisLine
121
+ state.thisLine = null
122
+ return null;
123
+ }
124
+
125
+ function blockNormal(stream, state) {
126
+
127
+ var sol = stream.sol();
128
+
129
+ var prevLineIsList = state.list !== false,
130
+ prevLineIsIndentedCode = state.indentedCode;
131
+
132
+ state.indentedCode = false;
133
+
134
+ if (prevLineIsList) {
135
+ if (state.indentationDiff >= 0) { // Continued list
136
+ if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block
137
+ state.indentation -= state.indentationDiff;
138
+ }
139
+ state.list = null;
140
+ } else if (state.indentation > 0) {
141
+ state.list = null;
142
+ state.listDepth = Math.floor(state.indentation / 4);
143
+ } else { // No longer a list
144
+ state.list = false;
145
+ state.listDepth = 0;
146
+ }
147
+ }
148
+
149
+ var match = null;
150
+ if (state.indentationDiff >= 4) {
151
+ stream.skipToEnd();
152
+ if (prevLineIsIndentedCode || lineIsEmpty(state.prevLine)) {
153
+ state.indentation -= 4;
154
+ state.indentedCode = true;
155
+ return code;
156
+ } else {
157
+ return null;
158
+ }
159
+ } else if (stream.eatSpace()) {
160
+ return null;
161
+ } else if ((match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
162
+ state.header = match[1].length;
163
+ if (modeCfg.highlightFormatting) state.formatting = "header";
164
+ state.f = state.inline;
165
+ return getType(state);
166
+ } else if (!lineIsEmpty(state.prevLine) && !state.quote && !prevLineIsList &&
167
+ !prevLineIsIndentedCode && (match = stream.match(setextHeaderRE))) {
168
+ state.header = match[0].charAt(0) == '=' ? 1 : 2;
169
+ if (modeCfg.highlightFormatting) state.formatting = "header";
170
+ state.f = state.inline;
171
+ return getType(state);
172
+ } else if (stream.eat('>')) {
173
+ state.quote = sol ? 1 : state.quote + 1;
174
+ if (modeCfg.highlightFormatting) state.formatting = "quote";
175
+ stream.eatSpace();
176
+ return getType(state);
177
+ } else if (stream.peek() === '[') {
178
+ return switchInline(stream, state, footnoteLink);
179
+ } else if (stream.match(hrRE, true)) {
180
+ state.hr = true;
181
+ return hr;
182
+ } else if ((lineIsEmpty(state.prevLine) || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) {
183
+ var listType = null;
184
+ if (stream.match(ulRE, true)) {
185
+ listType = 'ul';
186
+ } else {
187
+ stream.match(olRE, true);
188
+ listType = 'ol';
189
+ }
190
+ state.indentation = stream.column() + stream.current().length;
191
+ state.list = true;
192
+ state.listDepth++;
193
+ if (modeCfg.taskLists && stream.match(taskListRE, false)) {
194
+ state.taskList = true;
195
+ }
196
+ state.f = state.inline;
197
+ if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
198
+ return getType(state);
199
+ } else if (modeCfg.fencedCodeBlocks && (match = stream.match(fencedCodeRE, true))) {
200
+ state.fencedChars = match[1]
201
+ // try switching mode
202
+ state.localMode = getMode(match[2]);
203
+ if (state.localMode) state.localState = state.localMode.startState();
204
+ state.f = state.block = local;
205
+ if (modeCfg.highlightFormatting) state.formatting = "code-block";
206
+ state.code = true;
207
+ return getType(state);
208
+ }
209
+
210
+ return switchInline(stream, state, state.inline);
211
+ }
212
+
213
+ function htmlBlock(stream, state) {
214
+ var style = htmlMode.token(stream, state.htmlState);
215
+ if ((htmlFound && state.htmlState.tagStart === null &&
216
+ (!state.htmlState.context && state.htmlState.tokenize.isInText)) ||
217
+ (state.md_inside && stream.current().indexOf(">") > -1)) {
218
+ state.f = inlineNormal;
219
+ state.block = blockNormal;
220
+ state.htmlState = null;
221
+ }
222
+ return style;
223
+ }
224
+
225
+ function local(stream, state) {
226
+ if (stream.sol() && state.fencedChars && stream.match(state.fencedChars, false)) {
227
+ state.localMode = state.localState = null;
228
+ state.f = state.block = leavingLocal;
229
+ return null;
230
+ } else if (state.localMode) {
231
+ return state.localMode.token(stream, state.localState);
232
+ } else {
233
+ stream.skipToEnd();
234
+ return code;
235
+ }
236
+ }
237
+
238
+ function leavingLocal(stream, state) {
239
+ stream.match(state.fencedChars);
240
+ state.block = blockNormal;
241
+ state.f = inlineNormal;
242
+ state.fencedChars = null;
243
+ if (modeCfg.highlightFormatting) state.formatting = "code-block";
244
+ state.code = true;
245
+ var returnType = getType(state);
246
+ state.code = false;
247
+ return returnType;
248
+ }
249
+
250
+ // Inline
251
+ function getType(state) {
252
+ var styles = [];
253
+
254
+ if (state.formatting) {
255
+ styles.push(formatting);
256
+
257
+ if (typeof state.formatting === "string") state.formatting = [state.formatting];
258
+
259
+ for (var i = 0; i < state.formatting.length; i++) {
260
+ styles.push(formatting + "-" + state.formatting[i]);
261
+
262
+ if (state.formatting[i] === "header") {
263
+ styles.push(formatting + "-" + state.formatting[i] + "-" + state.header);
264
+ }
265
+
266
+ // Add `formatting-quote` and `formatting-quote-#` for blockquotes
267
+ // Add `error` instead if the maximum blockquote nesting depth is passed
268
+ if (state.formatting[i] === "quote") {
269
+ if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
270
+ styles.push(formatting + "-" + state.formatting[i] + "-" + state.quote);
271
+ } else {
272
+ styles.push("error");
273
+ }
274
+ }
275
+ }
276
+ }
277
+
278
+ if (state.taskOpen) {
279
+ styles.push("meta");
280
+ return styles.length ? styles.join(' ') : null;
281
+ }
282
+ if (state.taskClosed) {
283
+ styles.push("property");
284
+ return styles.length ? styles.join(' ') : null;
285
+ }
286
+
287
+ if (state.linkHref) {
288
+ styles.push(linkhref, "url");
289
+ } else { // Only apply inline styles to non-url text
290
+ if (state.strong) { styles.push(strong); }
291
+ if (state.em) { styles.push(em); }
292
+ if (state.strikethrough) { styles.push(strikethrough); }
293
+
294
+ if (state.linkText) { styles.push(linktext); }
295
+
296
+ if (state.code) { styles.push(code); }
297
+ }
298
+
299
+ if (state.header) { styles.push(header); styles.push(header + "-" + state.header); }
300
+
301
+ if (state.quote) {
302
+ styles.push(quote);
303
+
304
+ // Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth
305
+ if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
306
+ styles.push(quote + "-" + state.quote);
307
+ } else {
308
+ styles.push(quote + "-" + modeCfg.maxBlockquoteDepth);
309
+ }
310
+ }
311
+
312
+ if (state.list !== false) {
313
+ var listMod = (state.listDepth - 1) % 3;
314
+ if (!listMod) {
315
+ styles.push(list1);
316
+ } else if (listMod === 1) {
317
+ styles.push(list2);
318
+ } else {
319
+ styles.push(list3);
320
+ }
321
+ }
322
+
323
+ if (state.trailingSpaceNewLine) {
324
+ styles.push("trailing-space-new-line");
325
+ } else if (state.trailingSpace) {
326
+ styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b"));
327
+ }
328
+
329
+ return styles.length ? styles.join(' ') : null;
330
+ }
331
+
332
+ function handleText(stream, state) {
333
+ if (stream.match(textRE, true)) {
334
+ return getType(state);
335
+ }
336
+ return undefined;
337
+ }
338
+
339
+ function inlineNormal(stream, state) {
340
+ var style = state.text(stream, state);
341
+ if (typeof style !== 'undefined')
342
+ return style;
343
+
344
+ if (state.list) { // List marker (*, +, -, 1., etc)
345
+ state.list = null;
346
+ return getType(state);
347
+ }
348
+
349
+ if (state.taskList) {
350
+ var taskOpen = stream.match(taskListRE, true)[1] !== "x";
351
+ if (taskOpen) state.taskOpen = true;
352
+ else state.taskClosed = true;
353
+ if (modeCfg.highlightFormatting) state.formatting = "task";
354
+ state.taskList = false;
355
+ return getType(state);
356
+ }
357
+
358
+ state.taskOpen = false;
359
+ state.taskClosed = false;
360
+
361
+ if (state.header && stream.match(/^#+$/, true)) {
362
+ if (modeCfg.highlightFormatting) state.formatting = "header";
363
+ return getType(state);
364
+ }
365
+
366
+ // Get sol() value now, before character is consumed
367
+ var sol = stream.sol();
368
+
369
+ var ch = stream.next();
370
+
371
+ if (ch === '\\') {
372
+ stream.next();
373
+ if (modeCfg.highlightFormatting) {
374
+ var type = getType(state);
375
+ return type ? type + " formatting-escape" : "formatting-escape";
376
+ }
377
+ }
378
+
379
+ // Matches link titles present on next line
380
+ if (state.linkTitle) {
381
+ state.linkTitle = false;
382
+ var matchCh = ch;
383
+ if (ch === '(') {
384
+ matchCh = ')';
385
+ }
386
+ matchCh = (matchCh+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
387
+ var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
388
+ if (stream.match(new RegExp(regex), true)) {
389
+ return linkhref;
390
+ }
391
+ }
392
+
393
+ // If this block is changed, it may need to be updated in GFM mode
394
+ if (ch === '`') {
395
+ var previousFormatting = state.formatting;
396
+ if (modeCfg.highlightFormatting) state.formatting = "code";
397
+ var t = getType(state);
398
+ var before = stream.pos;
399
+ stream.eatWhile('`');
400
+ var difference = 1 + stream.pos - before;
401
+ if (!state.code) {
402
+ codeDepth = difference;
403
+ state.code = true;
404
+ return getType(state);
405
+ } else {
406
+ if (difference === codeDepth) { // Must be exact
407
+ state.code = false;
408
+ return t;
409
+ }
410
+ state.formatting = previousFormatting;
411
+ return getType(state);
412
+ }
413
+ } else if (state.code) {
414
+ return getType(state);
415
+ }
416
+
417
+ if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
418
+ stream.match(/\[[^\]]*\]/);
419
+ state.inline = state.f = linkHref;
420
+ return image;
421
+ }
422
+
423
+ if (ch === '[' && stream.match(/.*\](\(.*\)| ?\[.*\])/, false)) {
424
+ state.linkText = true;
425
+ if (modeCfg.highlightFormatting) state.formatting = "link";
426
+ return getType(state);
427
+ }
428
+
429
+ if (ch === ']' && state.linkText && stream.match(/\(.*\)| ?\[.*\]/, false)) {
430
+ if (modeCfg.highlightFormatting) state.formatting = "link";
431
+ var type = getType(state);
432
+ state.linkText = false;
433
+ state.inline = state.f = linkHref;
434
+ return type;
435
+ }
436
+
437
+ if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
438
+ state.f = state.inline = linkInline;
439
+ if (modeCfg.highlightFormatting) state.formatting = "link";
440
+ var type = getType(state);
441
+ if (type){
442
+ type += " ";
443
+ } else {
444
+ type = "";
445
+ }
446
+ return type + linkinline;
447
+ }
448
+
449
+ if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
450
+ state.f = state.inline = linkInline;
451
+ if (modeCfg.highlightFormatting) state.formatting = "link";
452
+ var type = getType(state);
453
+ if (type){
454
+ type += " ";
455
+ } else {
456
+ type = "";
457
+ }
458
+ return type + linkemail;
459
+ }
460
+
461
+ if (ch === '<' && stream.match(/^(!--|\w)/, false)) {
462
+ var end = stream.string.indexOf(">", stream.pos);
463
+ if (end != -1) {
464
+ var atts = stream.string.substring(stream.start, end);
465
+ if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) state.md_inside = true;
466
+ }
467
+ stream.backUp(1);
468
+ state.htmlState = CodeMirror.startState(htmlMode);
469
+ return switchBlock(stream, state, htmlBlock);
470
+ }
471
+
472
+ if (ch === '<' && stream.match(/^\/\w*?>/)) {
473
+ state.md_inside = false;
474
+ return "tag";
475
+ }
476
+
477
+ var ignoreUnderscore = false;
478
+ if (!modeCfg.underscoresBreakWords) {
479
+ if (ch === '_' && stream.peek() !== '_' && stream.match(/(\w)/, false)) {
480
+ var prevPos = stream.pos - 2;
481
+ if (prevPos >= 0) {
482
+ var prevCh = stream.string.charAt(prevPos);
483
+ if (prevCh !== '_' && prevCh.match(/(\w)/, false)) {
484
+ ignoreUnderscore = true;
485
+ }
486
+ }
487
+ }
488
+ }
489
+ if (ch === '*' || (ch === '_' && !ignoreUnderscore)) {
490
+ if (sol && stream.peek() === ' ') {
491
+ // Do nothing, surrounded by newline and space
492
+ } else if (state.strong === ch && stream.eat(ch)) { // Remove STRONG
493
+ if (modeCfg.highlightFormatting) state.formatting = "strong";
494
+ var t = getType(state);
495
+ state.strong = false;
496
+ return t;
497
+ } else if (!state.strong && stream.eat(ch)) { // Add STRONG
498
+ state.strong = ch;
499
+ if (modeCfg.highlightFormatting) state.formatting = "strong";
500
+ return getType(state);
501
+ } else if (state.em === ch) { // Remove EM
502
+ if (modeCfg.highlightFormatting) state.formatting = "em";
503
+ var t = getType(state);
504
+ state.em = false;
505
+ return t;
506
+ } else if (!state.em) { // Add EM
507
+ state.em = ch;
508
+ if (modeCfg.highlightFormatting) state.formatting = "em";
509
+ return getType(state);
510
+ }
511
+ } else if (ch === ' ') {
512
+ if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
513
+ if (stream.peek() === ' ') { // Surrounded by spaces, ignore
514
+ return getType(state);
515
+ } else { // Not surrounded by spaces, back up pointer
516
+ stream.backUp(1);
517
+ }
518
+ }
519
+ }
520
+
521
+ if (modeCfg.strikethrough) {
522
+ if (ch === '~' && stream.eatWhile(ch)) {
523
+ if (state.strikethrough) {// Remove strikethrough
524
+ if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
525
+ var t = getType(state);
526
+ state.strikethrough = false;
527
+ return t;
528
+ } else if (stream.match(/^[^\s]/, false)) {// Add strikethrough
529
+ state.strikethrough = true;
530
+ if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
531
+ return getType(state);
532
+ }
533
+ } else if (ch === ' ') {
534
+ if (stream.match(/^~~/, true)) { // Probably surrounded by space
535
+ if (stream.peek() === ' ') { // Surrounded by spaces, ignore
536
+ return getType(state);
537
+ } else { // Not surrounded by spaces, back up pointer
538
+ stream.backUp(2);
539
+ }
540
+ }
541
+ }
542
+ }
543
+
544
+ if (ch === ' ') {
545
+ if (stream.match(/ +$/, false)) {
546
+ state.trailingSpace++;
547
+ } else if (state.trailingSpace) {
548
+ state.trailingSpaceNewLine = true;
549
+ }
550
+ }
551
+
552
+ return getType(state);
553
+ }
554
+
555
+ function linkInline(stream, state) {
556
+ var ch = stream.next();
557
+
558
+ if (ch === ">") {
559
+ state.f = state.inline = inlineNormal;
560
+ if (modeCfg.highlightFormatting) state.formatting = "link";
561
+ var type = getType(state);
562
+ if (type){
563
+ type += " ";
564
+ } else {
565
+ type = "";
566
+ }
567
+ return type + linkinline;
568
+ }
569
+
570
+ stream.match(/^[^>]+/, true);
571
+
572
+ return linkinline;
573
+ }
574
+
575
+ function linkHref(stream, state) {
576
+ // Check if space, and return NULL if so (to avoid marking the space)
577
+ if(stream.eatSpace()){
578
+ return null;
579
+ }
580
+ var ch = stream.next();
581
+ if (ch === '(' || ch === '[') {
582
+ state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]");
583
+ if (modeCfg.highlightFormatting) state.formatting = "link-string";
584
+ state.linkHref = true;
585
+ return getType(state);
586
+ }
587
+ return 'error';
588
+ }
589
+
590
+ function getLinkHrefInside(endChar) {
591
+ return function(stream, state) {
592
+ var ch = stream.next();
593
+
594
+ if (ch === endChar) {
595
+ state.f = state.inline = inlineNormal;
596
+ if (modeCfg.highlightFormatting) state.formatting = "link-string";
597
+ var returnState = getType(state);
598
+ state.linkHref = false;
599
+ return returnState;
600
+ }
601
+
602
+ if (stream.match(inlineRE(endChar), true)) {
603
+ stream.backUp(1);
604
+ }
605
+
606
+ state.linkHref = true;
607
+ return getType(state);
608
+ };
609
+ }
610
+
611
+ function footnoteLink(stream, state) {
612
+ if (stream.match(/^[^\]]*\]:/, false)) {
613
+ state.f = footnoteLinkInside;
614
+ stream.next(); // Consume [
615
+ if (modeCfg.highlightFormatting) state.formatting = "link";
616
+ state.linkText = true;
617
+ return getType(state);
618
+ }
619
+ return switchInline(stream, state, inlineNormal);
620
+ }
621
+
622
+ function footnoteLinkInside(stream, state) {
623
+ if (stream.match(/^\]:/, true)) {
624
+ state.f = state.inline = footnoteUrl;
625
+ if (modeCfg.highlightFormatting) state.formatting = "link";
626
+ var returnType = getType(state);
627
+ state.linkText = false;
628
+ return returnType;
629
+ }
630
+
631
+ stream.match(/^[^\]]+/, true);
632
+
633
+ return linktext;
634
+ }
635
+
636
+ function footnoteUrl(stream, state) {
637
+ // Check if space, and return NULL if so (to avoid marking the space)
638
+ if(stream.eatSpace()){
639
+ return null;
640
+ }
641
+ // Match URL
642
+ stream.match(/^[^\s]+/, true);
643
+ // Check for link title
644
+ if (stream.peek() === undefined) { // End of line, set flag to check next line
645
+ state.linkTitle = true;
646
+ } else { // More content on line, check if link title
647
+ stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
648
+ }
649
+ state.f = state.inline = inlineNormal;
650
+ return linkhref + " url";
651
+ }
652
+
653
+ var savedInlineRE = [];
654
+ function inlineRE(endChar) {
655
+ if (!savedInlineRE[endChar]) {
656
+ // Escape endChar for RegExp (taken from http://stackoverflow.com/a/494122/526741)
657
+ endChar = (endChar+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
658
+ // Match any non-endChar, escaped character, as well as the closing
659
+ // endChar.
660
+ savedInlineRE[endChar] = new RegExp('^(?:[^\\\\]|\\\\.)*?(' + endChar + ')');
661
+ }
662
+ return savedInlineRE[endChar];
663
+ }
664
+
665
+ var mode = {
666
+ startState: function() {
667
+ return {
668
+ f: blockNormal,
669
+
670
+ prevLine: null,
671
+ thisLine: null,
672
+
673
+ block: blockNormal,
674
+ htmlState: null,
675
+ indentation: 0,
676
+
677
+ inline: inlineNormal,
678
+ text: handleText,
679
+
680
+ formatting: false,
681
+ linkText: false,
682
+ linkHref: false,
683
+ linkTitle: false,
684
+ em: false,
685
+ strong: false,
686
+ header: 0,
687
+ hr: false,
688
+ taskList: false,
689
+ list: false,
690
+ listDepth: 0,
691
+ quote: 0,
692
+ trailingSpace: 0,
693
+ trailingSpaceNewLine: false,
694
+ strikethrough: false,
695
+ fencedChars: null
696
+ };
697
+ },
698
+
699
+ copyState: function(s) {
700
+ return {
701
+ f: s.f,
702
+
703
+ prevLine: s.prevLine,
704
+ thisLine: s.this,
705
+
706
+ block: s.block,
707
+ htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),
708
+ indentation: s.indentation,
709
+
710
+ localMode: s.localMode,
711
+ localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,
712
+
713
+ inline: s.inline,
714
+ text: s.text,
715
+ formatting: false,
716
+ linkTitle: s.linkTitle,
717
+ code: s.code,
718
+ em: s.em,
719
+ strong: s.strong,
720
+ strikethrough: s.strikethrough,
721
+ header: s.header,
722
+ hr: s.hr,
723
+ taskList: s.taskList,
724
+ list: s.list,
725
+ listDepth: s.listDepth,
726
+ quote: s.quote,
727
+ indentedCode: s.indentedCode,
728
+ trailingSpace: s.trailingSpace,
729
+ trailingSpaceNewLine: s.trailingSpaceNewLine,
730
+ md_inside: s.md_inside,
731
+ fencedChars: s.fencedChars
732
+ };
733
+ },
734
+
735
+ token: function(stream, state) {
736
+
737
+ // Reset state.formatting
738
+ state.formatting = false;
739
+
740
+ if (stream != state.thisLine) {
741
+ var forceBlankLine = state.header || state.hr;
742
+
743
+ // Reset state.header and state.hr
744
+ state.header = 0;
745
+ state.hr = false;
746
+
747
+ if (stream.match(/^\s*$/, true) || forceBlankLine) {
748
+ blankLine(state);
749
+ if (!forceBlankLine) return null
750
+ state.prevLine = null
751
+ }
752
+
753
+ state.prevLine = state.thisLine
754
+ state.thisLine = stream
755
+
756
+ // Reset state.taskList
757
+ state.taskList = false;
758
+
759
+ // Reset state.trailingSpace
760
+ state.trailingSpace = 0;
761
+ state.trailingSpaceNewLine = false;
762
+
763
+ state.f = state.block;
764
+ var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, ' ').length;
765
+ var difference = Math.floor((indentation - state.indentation) / 4) * 4;
766
+ if (difference > 4) difference = 4;
767
+ var adjustedIndentation = state.indentation + difference;
768
+ state.indentationDiff = adjustedIndentation - state.indentation;
769
+ state.indentation = adjustedIndentation;
770
+ if (indentation > 0) return null;
771
+ }
772
+ return state.f(stream, state);
773
+ },
774
+
775
+ innerMode: function(state) {
776
+ if (state.block == htmlBlock) return {state: state.htmlState, mode: htmlMode};
777
+ if (state.localState) return {state: state.localState, mode: state.localMode};
778
+ return {state: state, mode: mode};
779
+ },
780
+
781
+ blankLine: blankLine,
782
+
783
+ getType: getType,
784
+
785
+ fold: "markdown"
786
+ };
787
+ return mode;
788
+ }, "xml");
789
+
790
+ CodeMirror.defineMIME("text/x-markdown", "markdown");
791
+
792
+ });