marty 0.5.12

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 (345) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +84 -0
  4. data/Rakefile +29 -0
  5. data/app/assets/javascripts/marty/application.js +15 -0
  6. data/app/assets/stylesheets/marty/application.css +13 -0
  7. data/app/components/marty/api_auth_view.rb +32 -0
  8. data/app/components/marty/auth_app.rb +55 -0
  9. data/app/components/marty/auth_app.rb~ +51 -0
  10. data/app/components/marty/auth_app/javascripts/auth_app.js +91 -0
  11. data/app/components/marty/auth_app/javascripts/auth_app.js~ +91 -0
  12. data/app/components/marty/cm_form_panel.rb~ +5 -0
  13. data/app/components/marty/cm_grid_panel.rb~ +35 -0
  14. data/app/components/marty/data_import_view.rb~ +142 -0
  15. data/app/components/marty/extras/layout.rb +46 -0
  16. data/app/components/marty/extras/layout.rb~ +46 -0
  17. data/app/components/marty/extras/misc.rb +18 -0
  18. data/app/components/marty/form.rb +6 -0
  19. data/app/components/marty/grid.rb +45 -0
  20. data/app/components/marty/grid_append_only.rb +12 -0
  21. data/app/components/marty/import_type_view.rb +53 -0
  22. data/app/components/marty/live_search_grid_panel.rb +46 -0
  23. data/app/components/marty/live_search_grid_panel.rb~ +49 -0
  24. data/app/components/marty/main_auth_app.rb +269 -0
  25. data/app/components/marty/main_auth_app.rb~ +238 -0
  26. data/app/components/marty/mcfly_grid_panel.rb +62 -0
  27. data/app/components/marty/mcfly_grid_panel.rb~ +80 -0
  28. data/app/components/marty/new_posting_form.rb +46 -0
  29. data/app/components/marty/new_posting_form.rb~ +46 -0
  30. data/app/components/marty/new_posting_window.rb +21 -0
  31. data/app/components/marty/new_posting_window.rb~ +21 -0
  32. data/app/components/marty/panel.rb +12 -0
  33. data/app/components/marty/pivot_grid.rb +52 -0
  34. data/app/components/marty/pivot_grid/endpoints.rb +45 -0
  35. data/app/components/marty/pivot_grid/javascripts/extensions.js +150 -0
  36. data/app/components/marty/pivot_grid/javascripts/pivot_grid.js +86 -0
  37. data/app/components/marty/pivot_grid/services.rb +44 -0
  38. data/app/components/marty/posting_grid.rb +139 -0
  39. data/app/components/marty/posting_grid.rb~ +140 -0
  40. data/app/components/marty/posting_window.rb +27 -0
  41. data/app/components/marty/promise_view.rb +177 -0
  42. data/app/components/marty/promise_view.rb~ +157 -0
  43. data/app/components/marty/promise_view/stylesheets/promise_view.css +26 -0
  44. data/app/components/marty/promise_view/stylesheets/promise_view.css~ +15 -0
  45. data/app/components/marty/report_form.rb +225 -0
  46. data/app/components/marty/report_form.rb~ +217 -0
  47. data/app/components/marty/report_select.rb +145 -0
  48. data/app/components/marty/report_select.rb~ +133 -0
  49. data/app/components/marty/reporting.rb +39 -0
  50. data/app/components/marty/reporting.rb~ +39 -0
  51. data/app/components/marty/script_detail.rb~ +430 -0
  52. data/app/components/marty/script_form.rb +233 -0
  53. data/app/components/marty/script_form.rb~ +233 -0
  54. data/app/components/marty/script_form/javascripts/Ext.ux.form.field.CodeMirror.js +698 -0
  55. data/app/components/marty/script_form/javascripts/Ext.ux.form.field.CodeMirror.js~ +909 -0
  56. data/app/components/marty/script_form/javascripts/codemirror.js +3130 -0
  57. data/app/components/marty/script_form/javascripts/mode/clike/clike.js +284 -0
  58. data/app/components/marty/script_form/javascripts/mode/clike/index.html +102 -0
  59. data/app/components/marty/script_form/javascripts/mode/clike/scala.html +766 -0
  60. data/app/components/marty/script_form/javascripts/mode/clojure/clojure.js +206 -0
  61. data/app/components/marty/script_form/javascripts/mode/clojure/index.html +67 -0
  62. data/app/components/marty/script_form/javascripts/mode/coffeescript/LICENSE +22 -0
  63. data/app/components/marty/script_form/javascripts/mode/coffeescript/coffeescript.js +346 -0
  64. data/app/components/marty/script_form/javascripts/mode/coffeescript/index.html +728 -0
  65. data/app/components/marty/script_form/javascripts/mode/commonlisp/commonlisp.js +101 -0
  66. data/app/components/marty/script_form/javascripts/mode/commonlisp/index.html +165 -0
  67. data/app/components/marty/script_form/javascripts/mode/css/css.js +448 -0
  68. data/app/components/marty/script_form/javascripts/mode/css/index.html +58 -0
  69. data/app/components/marty/script_form/javascripts/mode/css/test.js +501 -0
  70. data/app/components/marty/script_form/javascripts/mode/delorean/delorean.js +189 -0
  71. data/app/components/marty/script_form/javascripts/mode/diff/diff.js +32 -0
  72. data/app/components/marty/script_form/javascripts/mode/diff/index.html +105 -0
  73. data/app/components/marty/script_form/javascripts/mode/ecl/ecl.js +203 -0
  74. data/app/components/marty/script_form/javascripts/mode/ecl/index.html +42 -0
  75. data/app/components/marty/script_form/javascripts/mode/erlang/erlang.js +463 -0
  76. data/app/components/marty/script_form/javascripts/mode/erlang/index.html +63 -0
  77. data/app/components/marty/script_form/javascripts/mode/gfm/gfm.js +150 -0
  78. data/app/components/marty/script_form/javascripts/mode/gfm/index.html +48 -0
  79. data/app/components/marty/script_form/javascripts/mode/go/go.js +170 -0
  80. data/app/components/marty/script_form/javascripts/mode/go/index.html +73 -0
  81. data/app/components/marty/script_form/javascripts/mode/groovy/groovy.js +210 -0
  82. data/app/components/marty/script_form/javascripts/mode/groovy/index.html +72 -0
  83. data/app/components/marty/script_form/javascripts/mode/haskell/haskell.js +242 -0
  84. data/app/components/marty/script_form/javascripts/mode/haskell/index.html +61 -0
  85. data/app/components/marty/script_form/javascripts/mode/haxe/haxe.js +429 -0
  86. data/app/components/marty/script_form/javascripts/mode/haxe/index.html +91 -0
  87. data/app/components/marty/script_form/javascripts/mode/htmlembedded/htmlembedded.js +72 -0
  88. data/app/components/marty/script_form/javascripts/mode/htmlembedded/index.html +50 -0
  89. data/app/components/marty/script_form/javascripts/mode/htmlmixed/htmlmixed.js +84 -0
  90. data/app/components/marty/script_form/javascripts/mode/htmlmixed/index.html +52 -0
  91. data/app/components/marty/script_form/javascripts/mode/javascript/index.html +78 -0
  92. data/app/components/marty/script_form/javascripts/mode/javascript/javascript.js +361 -0
  93. data/app/components/marty/script_form/javascripts/mode/jinja2/index.html +38 -0
  94. data/app/components/marty/script_form/javascripts/mode/jinja2/jinja2.js +42 -0
  95. data/app/components/marty/script_form/javascripts/mode/less/index.html +740 -0
  96. data/app/components/marty/script_form/javascripts/mode/less/less.js +266 -0
  97. data/app/components/marty/script_form/javascripts/mode/lua/index.html +73 -0
  98. data/app/components/marty/script_form/javascripts/mode/lua/lua.js +140 -0
  99. data/app/components/marty/script_form/javascripts/mode/markdown/index.html +343 -0
  100. data/app/components/marty/script_form/javascripts/mode/markdown/markdown.js +382 -0
  101. data/app/components/marty/script_form/javascripts/mode/markdown/test.js +1084 -0
  102. data/app/components/marty/script_form/javascripts/mode/mysql/index.html +42 -0
  103. data/app/components/marty/script_form/javascripts/mode/mysql/mysql.js +186 -0
  104. data/app/components/marty/script_form/javascripts/mode/ntriples/index.html +33 -0
  105. data/app/components/marty/script_form/javascripts/mode/ntriples/ntriples.js +172 -0
  106. data/app/components/marty/script_form/javascripts/mode/ocaml/index.html +130 -0
  107. data/app/components/marty/script_form/javascripts/mode/ocaml/ocaml.js +114 -0
  108. data/app/components/marty/script_form/javascripts/mode/pascal/LICENSE +7 -0
  109. data/app/components/marty/script_form/javascripts/mode/pascal/index.html +49 -0
  110. data/app/components/marty/script_form/javascripts/mode/pascal/pascal.js +94 -0
  111. data/app/components/marty/script_form/javascripts/mode/perl/LICENSE +19 -0
  112. data/app/components/marty/script_form/javascripts/mode/perl/index.html +63 -0
  113. data/app/components/marty/script_form/javascripts/mode/perl/perl.js +816 -0
  114. data/app/components/marty/script_form/javascripts/mode/php/index.html +49 -0
  115. data/app/components/marty/script_form/javascripts/mode/php/php.js +148 -0
  116. data/app/components/marty/script_form/javascripts/mode/pig/index.html +43 -0
  117. data/app/components/marty/script_form/javascripts/mode/pig/pig.js +172 -0
  118. data/app/components/marty/script_form/javascripts/mode/plsql/index.html +63 -0
  119. data/app/components/marty/script_form/javascripts/mode/plsql/plsql.js +217 -0
  120. data/app/components/marty/script_form/javascripts/mode/properties/index.html +41 -0
  121. data/app/components/marty/script_form/javascripts/mode/properties/properties.js +63 -0
  122. data/app/components/marty/script_form/javascripts/mode/python/LICENSE.txt +21 -0
  123. data/app/components/marty/script_form/javascripts/mode/python/index.html +123 -0
  124. data/app/components/marty/script_form/javascripts/mode/python/python.js +338 -0
  125. data/app/components/marty/script_form/javascripts/mode/r/LICENSE +24 -0
  126. data/app/components/marty/script_form/javascripts/mode/r/index.html +74 -0
  127. data/app/components/marty/script_form/javascripts/mode/r/r.js +141 -0
  128. data/app/components/marty/script_form/javascripts/mode/rpm/changes/changes.js +19 -0
  129. data/app/components/marty/script_form/javascripts/mode/rpm/changes/index.html +54 -0
  130. data/app/components/marty/script_form/javascripts/mode/rpm/spec/index.html +100 -0
  131. data/app/components/marty/script_form/javascripts/mode/rpm/spec/spec.css +5 -0
  132. data/app/components/marty/script_form/javascripts/mode/rpm/spec/spec.js +66 -0
  133. data/app/components/marty/script_form/javascripts/mode/rst/index.html +526 -0
  134. data/app/components/marty/script_form/javascripts/mode/rst/rst.js +326 -0
  135. data/app/components/marty/script_form/javascripts/mode/ruby/LICENSE +24 -0
  136. data/app/components/marty/script_form/javascripts/mode/ruby/index.html +172 -0
  137. data/app/components/marty/script_form/javascripts/mode/ruby/ruby.js +195 -0
  138. data/app/components/marty/script_form/javascripts/mode/rust/index.html +49 -0
  139. data/app/components/marty/script_form/javascripts/mode/rust/rust.js +432 -0
  140. data/app/components/marty/script_form/javascripts/mode/scheme/index.html +65 -0
  141. data/app/components/marty/script_form/javascripts/mode/scheme/scheme.js +230 -0
  142. data/app/components/marty/script_form/javascripts/mode/shell/index.html +50 -0
  143. data/app/components/marty/script_form/javascripts/mode/shell/shell.js +118 -0
  144. data/app/components/marty/script_form/javascripts/mode/sieve/LICENSE +23 -0
  145. data/app/components/marty/script_form/javascripts/mode/sieve/index.html +81 -0
  146. data/app/components/marty/script_form/javascripts/mode/sieve/sieve.js +156 -0
  147. data/app/components/marty/script_form/javascripts/mode/smalltalk/index.html +56 -0
  148. data/app/components/marty/script_form/javascripts/mode/smalltalk/smalltalk.js +139 -0
  149. data/app/components/marty/script_form/javascripts/mode/smarty/index.html +83 -0
  150. data/app/components/marty/script_form/javascripts/mode/smarty/smarty.js +148 -0
  151. data/app/components/marty/script_form/javascripts/mode/sparql/index.html +41 -0
  152. data/app/components/marty/script_form/javascripts/mode/sparql/sparql.js +143 -0
  153. data/app/components/marty/script_form/javascripts/mode/stex/index.html +98 -0
  154. data/app/components/marty/script_form/javascripts/mode/stex/stex.js +182 -0
  155. data/app/components/marty/script_form/javascripts/mode/stex/test.js +343 -0
  156. data/app/components/marty/script_form/javascripts/mode/tiddlywiki/index.html +141 -0
  157. data/app/components/marty/script_form/javascripts/mode/tiddlywiki/tiddlywiki.css +14 -0
  158. data/app/components/marty/script_form/javascripts/mode/tiddlywiki/tiddlywiki.js +384 -0
  159. data/app/components/marty/script_form/javascripts/mode/tiki/index.html +83 -0
  160. data/app/components/marty/script_form/javascripts/mode/tiki/tiki.css +26 -0
  161. data/app/components/marty/script_form/javascripts/mode/tiki/tiki.js +309 -0
  162. data/app/components/marty/script_form/javascripts/mode/vb/LICENSE.txt +21 -0
  163. data/app/components/marty/script_form/javascripts/mode/vb/index.html +89 -0
  164. data/app/components/marty/script_form/javascripts/mode/vb/vb.js +260 -0
  165. data/app/components/marty/script_form/javascripts/mode/vbscript/index.html +43 -0
  166. data/app/components/marty/script_form/javascripts/mode/vbscript/vbscript.js +26 -0
  167. data/app/components/marty/script_form/javascripts/mode/velocity/index.html +104 -0
  168. data/app/components/marty/script_form/javascripts/mode/velocity/velocity.js +146 -0
  169. data/app/components/marty/script_form/javascripts/mode/verilog/index.html +211 -0
  170. data/app/components/marty/script_form/javascripts/mode/verilog/verilog.js +194 -0
  171. data/app/components/marty/script_form/javascripts/mode/xml/index.html +45 -0
  172. data/app/components/marty/script_form/javascripts/mode/xml/xml.js +318 -0
  173. data/app/components/marty/script_form/javascripts/mode/xquery/LICENSE +20 -0
  174. data/app/components/marty/script_form/javascripts/mode/xquery/index.html +223 -0
  175. data/app/components/marty/script_form/javascripts/mode/xquery/test/index.html +27 -0
  176. data/app/components/marty/script_form/javascripts/mode/xquery/test/testBase.js +42 -0
  177. data/app/components/marty/script_form/javascripts/mode/xquery/test/testEmptySequenceKeyword.js +16 -0
  178. data/app/components/marty/script_form/javascripts/mode/xquery/test/testMultiAttr.js +16 -0
  179. data/app/components/marty/script_form/javascripts/mode/xquery/test/testNamespaces.js +91 -0
  180. data/app/components/marty/script_form/javascripts/mode/xquery/test/testProcessingInstructions.js +16 -0
  181. data/app/components/marty/script_form/javascripts/mode/xquery/test/testQuotes.js +19 -0
  182. data/app/components/marty/script_form/javascripts/mode/xquery/xquery.js +451 -0
  183. data/app/components/marty/script_form/javascripts/mode/yaml/index.html +68 -0
  184. data/app/components/marty/script_form/javascripts/mode/yaml/yaml.js +95 -0
  185. data/app/components/marty/script_form/javascripts/util/closetag.js +164 -0
  186. data/app/components/marty/script_form/javascripts/util/dialog.css +27 -0
  187. data/app/components/marty/script_form/javascripts/util/dialog.js +70 -0
  188. data/app/components/marty/script_form/javascripts/util/foldcode.js +196 -0
  189. data/app/components/marty/script_form/javascripts/util/formatting.js +193 -0
  190. data/app/components/marty/script_form/javascripts/util/javascript-hint.js +134 -0
  191. data/app/components/marty/script_form/javascripts/util/loadmode.js +51 -0
  192. data/app/components/marty/script_form/javascripts/util/match-highlighter.js +44 -0
  193. data/app/components/marty/script_form/javascripts/util/multiplex.js +77 -0
  194. data/app/components/marty/script_form/javascripts/util/overlay.js +54 -0
  195. data/app/components/marty/script_form/javascripts/util/pig-hint.js +123 -0
  196. data/app/components/marty/script_form/javascripts/util/runmode-standalone.js +90 -0
  197. data/app/components/marty/script_form/javascripts/util/runmode.js +53 -0
  198. data/app/components/marty/script_form/javascripts/util/search.js +118 -0
  199. data/app/components/marty/script_form/javascripts/util/searchcursor.js +119 -0
  200. data/app/components/marty/script_form/javascripts/util/simple-hint.css +16 -0
  201. data/app/components/marty/script_form/javascripts/util/simple-hint.js +97 -0
  202. data/app/components/marty/script_form/javascripts/util/xml-hint.js +137 -0
  203. data/app/components/marty/script_form/stylesheets/codemirror.css +172 -0
  204. data/app/components/marty/script_form/stylesheets/delorean.css +10 -0
  205. data/app/components/marty/script_form/stylesheets/theme/ambiance.css +81 -0
  206. data/app/components/marty/script_form/stylesheets/theme/blackboard.css +25 -0
  207. data/app/components/marty/script_form/stylesheets/theme/cobalt.css +18 -0
  208. data/app/components/marty/script_form/stylesheets/theme/eclipse.css +25 -0
  209. data/app/components/marty/script_form/stylesheets/theme/elegant.css +10 -0
  210. data/app/components/marty/script_form/stylesheets/theme/erlang-dark.css +21 -0
  211. data/app/components/marty/script_form/stylesheets/theme/lesser-dark.css +44 -0
  212. data/app/components/marty/script_form/stylesheets/theme/monokai.css +28 -0
  213. data/app/components/marty/script_form/stylesheets/theme/neat.css +9 -0
  214. data/app/components/marty/script_form/stylesheets/theme/night.css +21 -0
  215. data/app/components/marty/script_form/stylesheets/theme/rubyblue.css +21 -0
  216. data/app/components/marty/script_form/stylesheets/theme/vibrant-ink.css +27 -0
  217. data/app/components/marty/script_form/stylesheets/theme/xq-dark.css +46 -0
  218. data/app/components/marty/script_grid.rb +104 -0
  219. data/app/components/marty/script_grid.rb~ +99 -0
  220. data/app/components/marty/script_tester.rb +114 -0
  221. data/app/components/marty/script_tester.rb~ +213 -0
  222. data/app/components/marty/scripting.rb +132 -0
  223. data/app/components/marty/scripting.rb~ +124 -0
  224. data/app/components/marty/select_report.rb~ +143 -0
  225. data/app/components/marty/simple_app.rb +97 -0
  226. data/app/components/marty/simple_app.rb~ +101 -0
  227. data/app/components/marty/simple_app/javascripts/simple_app.js +50 -0
  228. data/app/components/marty/simple_app/javascripts/statusbar_ext.js +8 -0
  229. data/app/components/marty/tag_grid.rb +83 -0
  230. data/app/components/marty/tag_grid.rb~ +89 -0
  231. data/app/components/marty/tree_panel.rb~ +256 -0
  232. data/app/components/marty/tree_panel/javascripts/tree_panel.js~ +317 -0
  233. data/app/components/marty/user_pivot.rb +128 -0
  234. data/app/components/marty/user_view.rb +181 -0
  235. data/app/components/marty/user_view.rb~ +188 -0
  236. data/app/controllers/marty/application_controller.rb +124 -0
  237. data/app/controllers/marty/application_controller.rb~ +133 -0
  238. data/app/controllers/marty/components_controller.rb +41 -0
  239. data/app/controllers/marty/components_controller.rb~ +37 -0
  240. data/app/controllers/marty/job_controller.rb +28 -0
  241. data/app/controllers/marty/job_controller.rb~ +28 -0
  242. data/app/controllers/marty/rpc_controller.rb +64 -0
  243. data/app/controllers/marty/rpc_controller.rb~ +61 -0
  244. data/app/helpers/marty/application_helper.rb +4 -0
  245. data/app/helpers/marty/script_set.rb +57 -0
  246. data/app/helpers/marty/script_set.rb~ +59 -0
  247. data/app/models/marty/api_auth.rb +44 -0
  248. data/app/models/marty/api_auth.rb~ +48 -0
  249. data/app/models/marty/base.rb +4 -0
  250. data/app/models/marty/data_change.rb +179 -0
  251. data/app/models/marty/data_change.rb~ +141 -0
  252. data/app/models/marty/enum.rb +22 -0
  253. data/app/models/marty/enum.rb~ +16 -0
  254. data/app/models/marty/import_type.rb +44 -0
  255. data/app/models/marty/import_type.rb~ +48 -0
  256. data/app/models/marty/poop.rb~ +169 -0
  257. data/app/models/marty/posting.rb +101 -0
  258. data/app/models/marty/posting.rb~ +86 -0
  259. data/app/models/marty/posting_type.rb +12 -0
  260. data/app/models/marty/posting_type.rb~ +21 -0
  261. data/app/models/marty/promise.rb +252 -0
  262. data/app/models/marty/promise.rb~ +196 -0
  263. data/app/models/marty/role.rb +6 -0
  264. data/app/models/marty/role.rb~ +10 -0
  265. data/app/models/marty/script.rb +144 -0
  266. data/app/models/marty/script.rb~ +62 -0
  267. data/app/models/marty/tag.rb +96 -0
  268. data/app/models/marty/tag.rb~ +91 -0
  269. data/app/models/marty/token.rb +30 -0
  270. data/app/models/marty/user.rb +146 -0
  271. data/app/models/marty/user.rb~ +148 -0
  272. data/app/models/marty/user_role.rb +7 -0
  273. data/app/models/marty/user_role.rb~ +13 -0
  274. data/app/views/layouts/marty/application.html.erb +12 -0
  275. data/app/views/layouts/marty/application.html.erb~ +11 -0
  276. data/config/locales/en.yml +134 -0
  277. data/config/routes.rb +6 -0
  278. data/config/routes.rb~ +10 -0
  279. data/db/migrate/001_create_marty_scripts.rb +14 -0
  280. data/db/migrate/003_create_marty_users.rb +12 -0
  281. data/db/migrate/004_create_marty_roles.rb +7 -0
  282. data/db/migrate/005_create_marty_user_roles.rb +14 -0
  283. data/db/migrate/006_create_marty_tokens.rb +14 -0
  284. data/db/migrate/008_create_marty_posting_types.rb +7 -0
  285. data/db/migrate/019_create_marty_postings.rb +18 -0
  286. data/db/migrate/019_create_marty_postings.rb~ +19 -0
  287. data/db/migrate/068_create_marty_import_types.rb +12 -0
  288. data/db/migrate/069_create_marty_import_synonyms.rb +15 -0
  289. data/db/migrate/070_create_versions.rb +18 -0
  290. data/db/migrate/071_add_object_changes_column_to_versions.rb +9 -0
  291. data/db/migrate/072_add_validation_function_to_import_types.rb +6 -0
  292. data/db/migrate/073_add_preprocess_function_to_import_types.rb +5 -0
  293. data/db/migrate/090_create_delayed_jobs.rb +22 -0
  294. data/db/migrate/091_create_marty_promises.rb +36 -0
  295. data/db/migrate/095_create_marty_tags.rb +14 -0
  296. data/db/migrate/095_create_marty_tags.rb~ +19 -0
  297. data/db/migrate/096_add_user_roles_to_import_types.rb +11 -0
  298. data/db/migrate/097_drop_versions.rb +9 -0
  299. data/db/migrate/098_create_marty_api_auths.rb +20 -0
  300. data/db/seeds.rb +48 -0
  301. data/lib/marty.rb +18 -0
  302. data/lib/marty.rb~ +13 -0
  303. data/lib/marty/content_handler.rb +97 -0
  304. data/lib/marty/content_handler.rb~ +93 -0
  305. data/lib/marty/data_conversion.rb +298 -0
  306. data/lib/marty/data_exporter.rb +150 -0
  307. data/lib/marty/data_exporter.rb~ +137 -0
  308. data/lib/marty/data_importer.rb +122 -0
  309. data/lib/marty/data_importer.rb~ +114 -0
  310. data/lib/marty/data_row_processor.rb~ +206 -0
  311. data/lib/marty/drop_folder_hook.rb~ +17 -0
  312. data/lib/marty/engine.rb +10 -0
  313. data/lib/marty/folder_hook.rb~ +9 -0
  314. data/lib/marty/lazy_column_loader.rb +57 -0
  315. data/lib/marty/lazy_column_loader.rb~ +47 -0
  316. data/lib/marty/mcfly_query.rb +189 -0
  317. data/lib/marty/mcfly_query.rb~ +188 -0
  318. data/lib/marty/migrations.rb +108 -0
  319. data/lib/marty/migrations.rb~ +65 -0
  320. data/lib/marty/monkey.rb +163 -0
  321. data/lib/marty/monkey.rb~ +160 -0
  322. data/lib/marty/permissions.rb +64 -0
  323. data/lib/marty/permissions.rb~ +69 -0
  324. data/lib/marty/promise.rb~ +41 -0
  325. data/lib/marty/promise_job.rb +123 -0
  326. data/lib/marty/promise_job.rb~ +121 -0
  327. data/lib/marty/promise_proxy.rb +94 -0
  328. data/lib/marty/promise_proxy.rb~ +69 -0
  329. data/lib/marty/railtie.rb +5 -0
  330. data/lib/marty/relation.rb +39 -0
  331. data/lib/marty/util.rb +110 -0
  332. data/lib/marty/util.rb~ +80 -0
  333. data/lib/marty/version.rb +3 -0
  334. data/lib/marty/version.rb~ +3 -0
  335. data/lib/marty/xl.rb +527 -0
  336. data/lib/marty/xl.rb~ +526 -0
  337. data/lib/pyxll/README.txt +19 -0
  338. data/lib/pyxll/README.txt~ +16 -0
  339. data/lib/pyxll/gemini.py +155 -0
  340. data/lib/pyxll/gemini.py~ +110 -0
  341. data/lib/pyxll/pyxll.cfg +12 -0
  342. data/lib/pyxll/pyxll.cfg~ +12 -0
  343. data/lib/pyxll/sample.xlsx +0 -0
  344. data/lib/tasks/marty_tasks.rake +37 -0
  345. metadata +517 -0
@@ -0,0 +1,343 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>CodeMirror: Markdown mode</title>
6
+ <link rel="stylesheet" href="../../lib/codemirror.css">
7
+ <script src="../../lib/codemirror.js"></script>
8
+ <script src="../xml/xml.js"></script>
9
+ <script src="markdown.js"></script>
10
+ <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
11
+ <link rel="stylesheet" href="../../doc/docs.css">
12
+ </head>
13
+ <body>
14
+ <h1>CodeMirror: Markdown mode</h1>
15
+
16
+ <!-- source: http://daringfireball.net/projects/markdown/basics.text -->
17
+ <form><textarea id="code" name="code">
18
+ Markdown: Basics
19
+ ================
20
+
21
+ &lt;ul id="ProjectSubmenu"&gt;
22
+ &lt;li&gt;&lt;a href="/projects/markdown/" title="Markdown Project Page"&gt;Main&lt;/a&gt;&lt;/li&gt;
23
+ &lt;li&gt;&lt;a class="selected" title="Markdown Basics"&gt;Basics&lt;/a&gt;&lt;/li&gt;
24
+ &lt;li&gt;&lt;a href="/projects/markdown/syntax" title="Markdown Syntax Documentation"&gt;Syntax&lt;/a&gt;&lt;/li&gt;
25
+ &lt;li&gt;&lt;a href="/projects/markdown/license" title="Pricing and License Information"&gt;License&lt;/a&gt;&lt;/li&gt;
26
+ &lt;li&gt;&lt;a href="/projects/markdown/dingus" title="Online Markdown Web Form"&gt;Dingus&lt;/a&gt;&lt;/li&gt;
27
+ &lt;/ul&gt;
28
+
29
+
30
+ Getting the Gist of Markdown's Formatting Syntax
31
+ ------------------------------------------------
32
+
33
+ This page offers a brief overview of what it's like to use Markdown.
34
+ The [syntax page] [s] provides complete, detailed documentation for
35
+ every feature, but Markdown should be very easy to pick up simply by
36
+ looking at a few examples of it in action. The examples on this page
37
+ are written in a before/after style, showing example syntax and the
38
+ HTML output produced by Markdown.
39
+
40
+ It's also helpful to simply try Markdown out; the [Dingus] [d] is a
41
+ web application that allows you type your own Markdown-formatted text
42
+ and translate it to XHTML.
43
+
44
+ **Note:** This document is itself written using Markdown; you
45
+ can [see the source for it by adding '.text' to the URL] [src].
46
+
47
+ [s]: /projects/markdown/syntax "Markdown Syntax"
48
+ [d]: /projects/markdown/dingus "Markdown Dingus"
49
+ [src]: /projects/markdown/basics.text
50
+
51
+
52
+ ## Paragraphs, Headers, Blockquotes ##
53
+
54
+ A paragraph is simply one or more consecutive lines of text, separated
55
+ by one or more blank lines. (A blank line is any line that looks like
56
+ a blank line -- a line containing nothing but spaces or tabs is
57
+ considered blank.) Normal paragraphs should not be indented with
58
+ spaces or tabs.
59
+
60
+ Markdown offers two styles of headers: *Setext* and *atx*.
61
+ Setext-style headers for `&lt;h1&gt;` and `&lt;h2&gt;` are created by
62
+ "underlining" with equal signs (`=`) and hyphens (`-`), respectively.
63
+ To create an atx-style header, you put 1-6 hash marks (`#`) at the
64
+ beginning of the line -- the number of hashes equals the resulting
65
+ HTML header level.
66
+
67
+ Blockquotes are indicated using email-style '`&gt;`' angle brackets.
68
+
69
+ Markdown:
70
+
71
+ A First Level Header
72
+ ====================
73
+
74
+ A Second Level Header
75
+ ---------------------
76
+
77
+ Now is the time for all good men to come to
78
+ the aid of their country. This is just a
79
+ regular paragraph.
80
+
81
+ The quick brown fox jumped over the lazy
82
+ dog's back.
83
+
84
+ ### Header 3
85
+
86
+ &gt; This is a blockquote.
87
+ &gt;
88
+ &gt; This is the second paragraph in the blockquote.
89
+ &gt;
90
+ &gt; ## This is an H2 in a blockquote
91
+
92
+
93
+ Output:
94
+
95
+ &lt;h1&gt;A First Level Header&lt;/h1&gt;
96
+
97
+ &lt;h2&gt;A Second Level Header&lt;/h2&gt;
98
+
99
+ &lt;p&gt;Now is the time for all good men to come to
100
+ the aid of their country. This is just a
101
+ regular paragraph.&lt;/p&gt;
102
+
103
+ &lt;p&gt;The quick brown fox jumped over the lazy
104
+ dog's back.&lt;/p&gt;
105
+
106
+ &lt;h3&gt;Header 3&lt;/h3&gt;
107
+
108
+ &lt;blockquote&gt;
109
+ &lt;p&gt;This is a blockquote.&lt;/p&gt;
110
+
111
+ &lt;p&gt;This is the second paragraph in the blockquote.&lt;/p&gt;
112
+
113
+ &lt;h2&gt;This is an H2 in a blockquote&lt;/h2&gt;
114
+ &lt;/blockquote&gt;
115
+
116
+
117
+
118
+ ### Phrase Emphasis ###
119
+
120
+ Markdown uses asterisks and underscores to indicate spans of emphasis.
121
+
122
+ Markdown:
123
+
124
+ Some of these words *are emphasized*.
125
+ Some of these words _are emphasized also_.
126
+
127
+ Use two asterisks for **strong emphasis**.
128
+ Or, if you prefer, __use two underscores instead__.
129
+
130
+ Output:
131
+
132
+ &lt;p&gt;Some of these words &lt;em&gt;are emphasized&lt;/em&gt;.
133
+ Some of these words &lt;em&gt;are emphasized also&lt;/em&gt;.&lt;/p&gt;
134
+
135
+ &lt;p&gt;Use two asterisks for &lt;strong&gt;strong emphasis&lt;/strong&gt;.
136
+ Or, if you prefer, &lt;strong&gt;use two underscores instead&lt;/strong&gt;.&lt;/p&gt;
137
+
138
+
139
+
140
+ ## Lists ##
141
+
142
+ Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
143
+ `+`, and `-`) as list markers. These three markers are
144
+ interchangable; this:
145
+
146
+ * Candy.
147
+ * Gum.
148
+ * Booze.
149
+
150
+ this:
151
+
152
+ + Candy.
153
+ + Gum.
154
+ + Booze.
155
+
156
+ and this:
157
+
158
+ - Candy.
159
+ - Gum.
160
+ - Booze.
161
+
162
+ all produce the same output:
163
+
164
+ &lt;ul&gt;
165
+ &lt;li&gt;Candy.&lt;/li&gt;
166
+ &lt;li&gt;Gum.&lt;/li&gt;
167
+ &lt;li&gt;Booze.&lt;/li&gt;
168
+ &lt;/ul&gt;
169
+
170
+ Ordered (numbered) lists use regular numbers, followed by periods, as
171
+ list markers:
172
+
173
+ 1. Red
174
+ 2. Green
175
+ 3. Blue
176
+
177
+ Output:
178
+
179
+ &lt;ol&gt;
180
+ &lt;li&gt;Red&lt;/li&gt;
181
+ &lt;li&gt;Green&lt;/li&gt;
182
+ &lt;li&gt;Blue&lt;/li&gt;
183
+ &lt;/ol&gt;
184
+
185
+ If you put blank lines between items, you'll get `&lt;p&gt;` tags for the
186
+ list item text. You can create multi-paragraph list items by indenting
187
+ the paragraphs by 4 spaces or 1 tab:
188
+
189
+ * A list item.
190
+
191
+ With multiple paragraphs.
192
+
193
+ * Another item in the list.
194
+
195
+ Output:
196
+
197
+ &lt;ul&gt;
198
+ &lt;li&gt;&lt;p&gt;A list item.&lt;/p&gt;
199
+ &lt;p&gt;With multiple paragraphs.&lt;/p&gt;&lt;/li&gt;
200
+ &lt;li&gt;&lt;p&gt;Another item in the list.&lt;/p&gt;&lt;/li&gt;
201
+ &lt;/ul&gt;
202
+
203
+
204
+
205
+ ### Links ###
206
+
207
+ Markdown supports two styles for creating links: *inline* and
208
+ *reference*. With both styles, you use square brackets to delimit the
209
+ text you want to turn into a link.
210
+
211
+ Inline-style links use parentheses immediately after the link text.
212
+ For example:
213
+
214
+ This is an [example link](http://example.com/).
215
+
216
+ Output:
217
+
218
+ &lt;p&gt;This is an &lt;a href="http://example.com/"&gt;
219
+ example link&lt;/a&gt;.&lt;/p&gt;
220
+
221
+ Optionally, you may include a title attribute in the parentheses:
222
+
223
+ This is an [example link](http://example.com/ "With a Title").
224
+
225
+ Output:
226
+
227
+ &lt;p&gt;This is an &lt;a href="http://example.com/" title="With a Title"&gt;
228
+ example link&lt;/a&gt;.&lt;/p&gt;
229
+
230
+ Reference-style links allow you to refer to your links by names, which
231
+ you define elsewhere in your document:
232
+
233
+ I get 10 times more traffic from [Google][1] than from
234
+ [Yahoo][2] or [MSN][3].
235
+
236
+ [1]: http://google.com/ "Google"
237
+ [2]: http://search.yahoo.com/ "Yahoo Search"
238
+ [3]: http://search.msn.com/ "MSN Search"
239
+
240
+ Output:
241
+
242
+ &lt;p&gt;I get 10 times more traffic from &lt;a href="http://google.com/"
243
+ title="Google"&gt;Google&lt;/a&gt; than from &lt;a href="http://search.yahoo.com/"
244
+ title="Yahoo Search"&gt;Yahoo&lt;/a&gt; or &lt;a href="http://search.msn.com/"
245
+ title="MSN Search"&gt;MSN&lt;/a&gt;.&lt;/p&gt;
246
+
247
+ The title attribute is optional. Link names may contain letters,
248
+ numbers and spaces, but are *not* case sensitive:
249
+
250
+ I start my morning with a cup of coffee and
251
+ [The New York Times][NY Times].
252
+
253
+ [ny times]: http://www.nytimes.com/
254
+
255
+ Output:
256
+
257
+ &lt;p&gt;I start my morning with a cup of coffee and
258
+ &lt;a href="http://www.nytimes.com/"&gt;The New York Times&lt;/a&gt;.&lt;/p&gt;
259
+
260
+
261
+ ### Images ###
262
+
263
+ Image syntax is very much like link syntax.
264
+
265
+ Inline (titles are optional):
266
+
267
+ ![alt text](/path/to/img.jpg "Title")
268
+
269
+ Reference-style:
270
+
271
+ ![alt text][id]
272
+
273
+ [id]: /path/to/img.jpg "Title"
274
+
275
+ Both of the above examples produce the same output:
276
+
277
+ &lt;img src="/path/to/img.jpg" alt="alt text" title="Title" /&gt;
278
+
279
+
280
+
281
+ ### Code ###
282
+
283
+ In a regular paragraph, you can create code span by wrapping text in
284
+ backtick quotes. Any ampersands (`&amp;`) and angle brackets (`&lt;` or
285
+ `&gt;`) will automatically be translated into HTML entities. This makes
286
+ it easy to use Markdown to write about HTML example code:
287
+
288
+ I strongly recommend against using any `&lt;blink&gt;` tags.
289
+
290
+ I wish SmartyPants used named entities like `&amp;mdash;`
291
+ instead of decimal-encoded entites like `&amp;#8212;`.
292
+
293
+ Output:
294
+
295
+ &lt;p&gt;I strongly recommend against using any
296
+ &lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;
297
+
298
+ &lt;p&gt;I wish SmartyPants used named entities like
299
+ &lt;code&gt;&amp;amp;mdash;&lt;/code&gt; instead of decimal-encoded
300
+ entites like &lt;code&gt;&amp;amp;#8212;&lt;/code&gt;.&lt;/p&gt;
301
+
302
+
303
+ To specify an entire block of pre-formatted code, indent every line of
304
+ the block by 4 spaces or 1 tab. Just like with code spans, `&amp;`, `&lt;`,
305
+ and `&gt;` characters will be escaped automatically.
306
+
307
+ Markdown:
308
+
309
+ If you want your page to validate under XHTML 1.0 Strict,
310
+ you've got to put paragraph tags in your blockquotes:
311
+
312
+ &lt;blockquote&gt;
313
+ &lt;p&gt;For example.&lt;/p&gt;
314
+ &lt;/blockquote&gt;
315
+
316
+ Output:
317
+
318
+ &lt;p&gt;If you want your page to validate under XHTML 1.0 Strict,
319
+ you've got to put paragraph tags in your blockquotes:&lt;/p&gt;
320
+
321
+ &lt;pre&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;
322
+ &amp;lt;p&amp;gt;For example.&amp;lt;/p&amp;gt;
323
+ &amp;lt;/blockquote&amp;gt;
324
+ &lt;/code&gt;&lt;/pre&gt;
325
+ </textarea></form>
326
+
327
+ <script>
328
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
329
+ mode: 'markdown',
330
+ lineNumbers: true,
331
+ matchBrackets: true,
332
+ theme: "default"
333
+ });
334
+ </script>
335
+
336
+ <p>Optionally depends on the XML mode for properly highlighted inline XML blocks.</p>
337
+
338
+ <p><strong>MIME types defined:</strong> <code>text/x-markdown</code>.</p>
339
+
340
+ <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#markdown_*">normal</a>, <a href="../../test/index.html#verbose,markdown_*">verbose</a>.</p>
341
+
342
+ </body>
343
+ </html>
@@ -0,0 +1,382 @@
1
+ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
2
+
3
+ var htmlFound = CodeMirror.mimeModes.hasOwnProperty("text/html");
4
+ var htmlMode = CodeMirror.getMode(cmCfg, htmlFound ? "text/html" : "text/plain");
5
+
6
+ var codeDepth = 0;
7
+ var prevLineHasContent = false
8
+ , thisLineHasContent = false;
9
+
10
+ var header = 'header'
11
+ , code = 'comment'
12
+ , quote = 'quote'
13
+ , list = 'string'
14
+ , hr = 'hr'
15
+ , linkinline = 'link'
16
+ , linkemail = 'link'
17
+ , linktext = 'link'
18
+ , linkhref = 'string'
19
+ , em = 'em'
20
+ , strong = 'strong'
21
+ , emstrong = 'emstrong';
22
+
23
+ var hrRE = /^([*\-=_])(?:\s*\1){2,}\s*$/
24
+ , ulRE = /^[*\-+]\s+/
25
+ , olRE = /^[0-9]+\.\s+/
26
+ , headerRE = /^(?:\={1,}|-{1,})$/
27
+ , textRE = /^[^\[*_\\<>` "'(]+/;
28
+
29
+ function switchInline(stream, state, f) {
30
+ state.f = state.inline = f;
31
+ return f(stream, state);
32
+ }
33
+
34
+ function switchBlock(stream, state, f) {
35
+ state.f = state.block = f;
36
+ return f(stream, state);
37
+ }
38
+
39
+
40
+ // Blocks
41
+
42
+ function blankLine(state) {
43
+ // Reset linkTitle state
44
+ state.linkTitle = false;
45
+ // Reset CODE state
46
+ state.code = false;
47
+ // Reset EM state
48
+ state.em = false;
49
+ // Reset STRONG state
50
+ state.strong = false;
51
+ // Reset state.quote
52
+ state.quote = false;
53
+ if (!htmlFound && state.f == htmlBlock) {
54
+ state.f = inlineNormal;
55
+ state.block = blockNormal;
56
+ }
57
+ return null;
58
+ }
59
+
60
+ function blockNormal(stream, state) {
61
+ var match;
62
+
63
+ if (state.list !== false && state.indentationDiff >= 0) { // Continued list
64
+ if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block
65
+ state.indentation -= state.indentationDiff;
66
+ }
67
+ state.list = null;
68
+ } else { // No longer a list
69
+ state.list = false;
70
+ }
71
+
72
+ if (state.indentationDiff >= 4) {
73
+ state.indentation -= 4;
74
+ stream.skipToEnd();
75
+ return code;
76
+ } else if (stream.eatSpace()) {
77
+ return null;
78
+ } else if (stream.peek() === '#' || (prevLineHasContent && stream.match(headerRE)) ) {
79
+ state.header = true;
80
+ } else if (stream.eat('>')) {
81
+ state.indentation++;
82
+ state.quote = true;
83
+ } else if (stream.peek() === '[') {
84
+ return switchInline(stream, state, footnoteLink);
85
+ } else if (stream.match(hrRE, true)) {
86
+ return hr;
87
+ } else if (match = stream.match(ulRE, true) || stream.match(olRE, true)) {
88
+ state.indentation += 4;
89
+ state.list = true;
90
+ }
91
+
92
+ return switchInline(stream, state, state.inline);
93
+ }
94
+
95
+ function htmlBlock(stream, state) {
96
+ var style = htmlMode.token(stream, state.htmlState);
97
+ if (htmlFound && style === 'tag' && state.htmlState.type !== 'openTag' && !state.htmlState.context) {
98
+ state.f = inlineNormal;
99
+ state.block = blockNormal;
100
+ }
101
+ if (state.md_inside && stream.current().indexOf(">")!=-1) {
102
+ state.f = inlineNormal;
103
+ state.block = blockNormal;
104
+ state.htmlState.context = undefined;
105
+ }
106
+ return style;
107
+ }
108
+
109
+
110
+ // Inline
111
+ function getType(state) {
112
+ var styles = [];
113
+
114
+ if (state.strong) { styles.push(state.em ? emstrong : strong); }
115
+ else if (state.em) { styles.push(em); }
116
+
117
+ if (state.code) { styles.push(code); }
118
+
119
+ if (state.header) { styles.push(header); }
120
+ if (state.quote) { styles.push(quote); }
121
+ if (state.list !== false) { styles.push(list); }
122
+
123
+ return styles.length ? styles.join(' ') : null;
124
+ }
125
+
126
+ function handleText(stream, state) {
127
+ if (stream.match(textRE, true)) {
128
+ return getType(state);
129
+ }
130
+ return undefined;
131
+ }
132
+
133
+ function inlineNormal(stream, state) {
134
+ var style = state.text(stream, state);
135
+ if (typeof style !== 'undefined')
136
+ return style;
137
+
138
+ if (state.list) { // List marker (*, +, -, 1., etc)
139
+ state.list = null;
140
+ return list;
141
+ }
142
+
143
+ var ch = stream.next();
144
+
145
+ if (ch === '\\') {
146
+ stream.next();
147
+ return getType(state);
148
+ }
149
+
150
+ // Matches link titles present on next line
151
+ if (state.linkTitle) {
152
+ state.linkTitle = false;
153
+ var matchCh = ch;
154
+ if (ch === '(') {
155
+ matchCh = ')';
156
+ }
157
+ matchCh = (matchCh+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
158
+ var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
159
+ if (stream.match(new RegExp(regex), true)) {
160
+ return linkhref;
161
+ }
162
+ }
163
+
164
+ if (ch === '`') {
165
+ var t = getType(state);
166
+ var before = stream.pos;
167
+ stream.eatWhile('`');
168
+ var difference = 1 + stream.pos - before;
169
+ if (!state.code) {
170
+ codeDepth = difference;
171
+ state.code = true;
172
+ return getType(state);
173
+ } else {
174
+ if (difference === codeDepth) { // Must be exact
175
+ state.code = false;
176
+ return t;
177
+ }
178
+ return getType(state);
179
+ }
180
+ } else if (state.code) {
181
+ return getType(state);
182
+ }
183
+
184
+ if (ch === '[' && stream.match(/.*\] ?(?:\(|\[)/, false)) {
185
+ return switchInline(stream, state, linkText);
186
+ }
187
+
188
+ if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, true)) {
189
+ return switchInline(stream, state, inlineElement(linkinline, '>'));
190
+ }
191
+
192
+ if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, true)) {
193
+ return switchInline(stream, state, inlineElement(linkemail, '>'));
194
+ }
195
+
196
+ if (ch === '<' && stream.match(/^\w/, false)) {
197
+ var md_inside = false;
198
+ if (stream.string.indexOf(">")!=-1) {
199
+ var atts = stream.string.substring(1,stream.string.indexOf(">"));
200
+ if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) {
201
+ state.md_inside = true;
202
+ }
203
+ }
204
+ stream.backUp(1);
205
+ return switchBlock(stream, state, htmlBlock);
206
+ }
207
+
208
+ if (ch === '<' && stream.match(/^\/\w*?>/)) {
209
+ state.md_inside = false;
210
+ return "tag";
211
+ }
212
+
213
+ var t = getType(state);
214
+ if (ch === '*' || ch === '_') {
215
+ if (state.strong === ch && stream.eat(ch)) { // Remove STRONG
216
+ state.strong = false;
217
+ return t;
218
+ } else if (!state.strong && stream.eat(ch)) { // Add STRONG
219
+ state.strong = ch;
220
+ return getType(state);
221
+ } else if (state.em === ch) { // Remove EM
222
+ state.em = false;
223
+ return t;
224
+ } else if (!state.em) { // Add EM
225
+ state.em = ch;
226
+ return getType(state);
227
+ }
228
+ } else if (ch === ' ') {
229
+ if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
230
+ if (stream.peek() === ' ') { // Surrounded by spaces, ignore
231
+ return getType(state);
232
+ } else { // Not surrounded by spaces, back up pointer
233
+ stream.backUp(1);
234
+ }
235
+ }
236
+ }
237
+
238
+ return getType(state);
239
+ }
240
+
241
+ function linkText(stream, state) {
242
+ while (!stream.eol()) {
243
+ var ch = stream.next();
244
+ if (ch === '\\') stream.next();
245
+ if (ch === ']') {
246
+ state.inline = state.f = linkHref;
247
+ return linktext;
248
+ }
249
+ }
250
+ return linktext;
251
+ }
252
+
253
+ function linkHref(stream, state) {
254
+ // Check if space, and return NULL if so (to avoid marking the space)
255
+ if(stream.eatSpace()){
256
+ return null;
257
+ }
258
+ var ch = stream.next();
259
+ if (ch === '(' || ch === '[') {
260
+ return switchInline(stream, state, inlineElement(linkhref, ch === '(' ? ')' : ']'));
261
+ }
262
+ return 'error';
263
+ }
264
+
265
+ function footnoteLink(stream, state) {
266
+ if (stream.match(/^[^\]]*\]:/, true)) {
267
+ state.f = footnoteUrl;
268
+ return linktext;
269
+ }
270
+ return switchInline(stream, state, inlineNormal);
271
+ }
272
+
273
+ function footnoteUrl(stream, state) {
274
+ // Check if space, and return NULL if so (to avoid marking the space)
275
+ if(stream.eatSpace()){
276
+ return null;
277
+ }
278
+ // Match URL
279
+ stream.match(/^[^\s]+/, true);
280
+ // Check for link title
281
+ if (stream.peek() === undefined) { // End of line, set flag to check next line
282
+ state.linkTitle = true;
283
+ } else { // More content on line, check if link title
284
+ stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
285
+ }
286
+ state.f = state.inline = inlineNormal;
287
+ return linkhref;
288
+ }
289
+
290
+ function inlineRE(endChar) {
291
+ if (!inlineRE[endChar]) {
292
+ // Escape endChar for RegExp (taken from http://stackoverflow.com/a/494122/526741)
293
+ endChar = (endChar+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
294
+ // Match any non-endChar, escaped character, as well as the closing
295
+ // endChar.
296
+ inlineRE[endChar] = new RegExp('^(?:[^\\\\]+?|\\\\.)*?(' + endChar + ')');
297
+ }
298
+ return inlineRE[endChar];
299
+ }
300
+
301
+ function inlineElement(type, endChar, next) {
302
+ next = next || inlineNormal;
303
+ return function(stream, state) {
304
+ stream.match(inlineRE(endChar));
305
+ state.inline = state.f = next;
306
+ return type;
307
+ };
308
+ }
309
+
310
+ return {
311
+ startState: function() {
312
+ return {
313
+ f: blockNormal,
314
+
315
+ block: blockNormal,
316
+ htmlState: CodeMirror.startState(htmlMode),
317
+ indentation: 0,
318
+
319
+ inline: inlineNormal,
320
+ text: handleText,
321
+ linkTitle: false,
322
+ em: false,
323
+ strong: false,
324
+ header: false,
325
+ list: false,
326
+ quote: false
327
+ };
328
+ },
329
+
330
+ copyState: function(s) {
331
+ return {
332
+ f: s.f,
333
+
334
+ block: s.block,
335
+ htmlState: CodeMirror.copyState(htmlMode, s.htmlState),
336
+ indentation: s.indentation,
337
+
338
+ inline: s.inline,
339
+ text: s.text,
340
+ linkTitle: s.linkTitle,
341
+ em: s.em,
342
+ strong: s.strong,
343
+ header: s.header,
344
+ list: s.list,
345
+ quote: s.quote,
346
+ md_inside: s.md_inside
347
+ };
348
+ },
349
+
350
+ token: function(stream, state) {
351
+ if (stream.sol()) {
352
+ if (stream.match(/^\s*$/, true)) {
353
+ prevLineHasContent = false;
354
+ return blankLine(state);
355
+ } else {
356
+ if(thisLineHasContent){
357
+ prevLineHasContent = true;
358
+ thisLineHasContent = false;
359
+ }
360
+ thisLineHasContent = true;
361
+ }
362
+
363
+ // Reset state.header
364
+ state.header = false;
365
+
366
+ state.f = state.block;
367
+ var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, ' ').length;
368
+ state.indentationDiff = indentation - state.indentation;
369
+ state.indentation = indentation;
370
+ if (indentation > 0) { return null; }
371
+ }
372
+ return state.f(stream, state);
373
+ },
374
+
375
+ blankLine: blankLine,
376
+
377
+ getType: getType
378
+ };
379
+
380
+ }, "xml");
381
+
382
+ CodeMirror.defineMIME("text/x-markdown", "markdown");