marty 2.4.7 → 2.4.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile.dummy +8 -5
  3. data/Gemfile.lock +1 -1
  4. data/README.md +8 -0
  5. data/app/assets/javascripts/marty/application.js +1 -0
  6. data/app/assets/javascripts/marty/codemirror/codemirror.js +9730 -0
  7. data/app/{components/marty/script_form/client → assets/javascripts/marty/codemirror}/mode/delorean/delorean.js +0 -0
  8. data/app/assets/javascripts/marty/codemirror/mode/javascript/javascript.js +900 -0
  9. data/app/assets/javascripts/marty/codemirror/mode/python/python.js +399 -0
  10. data/app/{components/marty/script_form/client → assets/javascripts/marty/codemirror}/mode/ruby/ruby.js +135 -34
  11. data/app/{components/marty/script_form/client/Ext.ux.form.field.CodeMirror.js → assets/javascripts/marty/extjs/extensions/marty.js} +87 -6
  12. data/app/assets/stylesheets/marty/application.css +1 -13
  13. data/app/assets/stylesheets/marty/codemirror/codemirror.css +346 -0
  14. data/app/{components/marty/script_form/client → assets/stylesheets/marty/codemirror}/delorean.css +0 -0
  15. data/app/components/marty/auth_app/client/auth_app.js +82 -80
  16. data/app/components/marty/data_grid_view.rb +1 -54
  17. data/app/components/marty/data_grid_view/client/data_grid_view.js +49 -0
  18. data/app/components/marty/form.rb +1 -5
  19. data/app/components/marty/form/client/form.js +5 -0
  20. data/app/components/marty/grid.rb +1 -146
  21. data/app/components/marty/grid/client/grid.js +146 -0
  22. data/app/components/marty/import_view.rb +1 -32
  23. data/app/components/marty/import_view/client/import_view.js +32 -0
  24. data/app/components/marty/live_search_grid_panel.rb +1 -21
  25. data/app/components/marty/live_search_grid_panel/client/live_search_grid_panel.js +27 -0
  26. data/app/components/marty/main_auth_app.rb +4 -145
  27. data/app/components/marty/main_auth_app/client/main_auth_app.js +124 -0
  28. data/app/components/marty/mcfly_grid_panel.rb +1 -17
  29. data/app/components/marty/mcfly_grid_panel/client/mcfly_grid_panel.js +37 -0
  30. data/app/components/marty/new_posting_form.rb +1 -6
  31. data/app/components/marty/new_posting_form/client/new_posting_form.js +6 -0
  32. data/app/components/marty/panel.rb +1 -5
  33. data/app/components/marty/panel/client/panel.js +5 -0
  34. data/app/components/marty/posting_grid.rb +4 -55
  35. data/app/components/marty/posting_grid/client/posting_grid.js +50 -0
  36. data/app/components/marty/promise_view.rb +2 -75
  37. data/app/components/marty/promise_view/client/promise_view.css +12 -9
  38. data/app/components/marty/promise_view/client/promise_view.js +57 -0
  39. data/app/components/marty/report_form.rb +3 -69
  40. data/app/components/marty/report_form/client/report_form.js +78 -0
  41. data/app/components/marty/report_select.rb +1 -45
  42. data/app/components/marty/report_select/client/report_select.js +50 -0
  43. data/app/components/marty/reporting.rb +1 -8
  44. data/app/components/marty/reporting/client/reporting.js +8 -0
  45. data/app/components/marty/script_form.rb +2 -63
  46. data/app/components/marty/script_form/client/script_form.js +44 -0
  47. data/app/components/marty/script_tester.rb +1 -7
  48. data/app/components/marty/script_tester/client/script_tester.js +7 -0
  49. data/app/components/marty/scripting.rb +1 -55
  50. data/app/components/marty/scripting/client/scripting.js +62 -0
  51. data/app/components/marty/simple_app/client/simple_app.js +21 -13
  52. data/app/models/marty/promise.rb +22 -1
  53. data/app/views/layouts/marty/application.html.erb +8 -6
  54. data/docker-compose.dummy.yml +2 -0
  55. data/lib/marty/monkey.rb +0 -16
  56. data/lib/marty/version.rb +1 -1
  57. data/spec/dummy/config/initializers/assets.rb +1 -0
  58. data/spec/features/reporting_spec.rb +1 -0
  59. data/spec/features/scripting_spec.rb +4 -4
  60. data/spec/spec_helper.rb +1 -0
  61. data/spec/support/chromedriver.rb +5 -1
  62. data/spec/support/shared_connection_db_helpers.rb +42 -2
  63. metadata +29 -168
  64. data/app/assets/images/marty/.gitkeep +0 -0
  65. data/app/components/marty/mcfly_grid_panel/client/dup_in_form.js +0 -20
  66. data/app/components/marty/script_form/client/codemirror.css +0 -172
  67. data/app/components/marty/script_form/client/codemirror.js +0 -3130
  68. data/app/components/marty/script_form/client/mode/clike/clike.js +0 -284
  69. data/app/components/marty/script_form/client/mode/clike/index.html +0 -102
  70. data/app/components/marty/script_form/client/mode/clike/scala.html +0 -766
  71. data/app/components/marty/script_form/client/mode/clojure/clojure.js +0 -206
  72. data/app/components/marty/script_form/client/mode/clojure/index.html +0 -67
  73. data/app/components/marty/script_form/client/mode/coffeescript/LICENSE +0 -22
  74. data/app/components/marty/script_form/client/mode/coffeescript/coffeescript.js +0 -346
  75. data/app/components/marty/script_form/client/mode/coffeescript/index.html +0 -728
  76. data/app/components/marty/script_form/client/mode/commonlisp/commonlisp.js +0 -101
  77. data/app/components/marty/script_form/client/mode/commonlisp/index.html +0 -165
  78. data/app/components/marty/script_form/client/mode/css/css.js +0 -448
  79. data/app/components/marty/script_form/client/mode/css/index.html +0 -58
  80. data/app/components/marty/script_form/client/mode/css/test.js +0 -501
  81. data/app/components/marty/script_form/client/mode/diff/diff.js +0 -32
  82. data/app/components/marty/script_form/client/mode/diff/index.html +0 -105
  83. data/app/components/marty/script_form/client/mode/ecl/ecl.js +0 -203
  84. data/app/components/marty/script_form/client/mode/ecl/index.html +0 -42
  85. data/app/components/marty/script_form/client/mode/erlang/erlang.js +0 -463
  86. data/app/components/marty/script_form/client/mode/erlang/index.html +0 -63
  87. data/app/components/marty/script_form/client/mode/gfm/gfm.js +0 -150
  88. data/app/components/marty/script_form/client/mode/gfm/index.html +0 -48
  89. data/app/components/marty/script_form/client/mode/go/go.js +0 -170
  90. data/app/components/marty/script_form/client/mode/go/index.html +0 -73
  91. data/app/components/marty/script_form/client/mode/groovy/groovy.js +0 -210
  92. data/app/components/marty/script_form/client/mode/groovy/index.html +0 -72
  93. data/app/components/marty/script_form/client/mode/haskell/haskell.js +0 -242
  94. data/app/components/marty/script_form/client/mode/haskell/index.html +0 -61
  95. data/app/components/marty/script_form/client/mode/haxe/haxe.js +0 -429
  96. data/app/components/marty/script_form/client/mode/haxe/index.html +0 -91
  97. data/app/components/marty/script_form/client/mode/htmlembedded/htmlembedded.js +0 -72
  98. data/app/components/marty/script_form/client/mode/htmlembedded/index.html +0 -50
  99. data/app/components/marty/script_form/client/mode/htmlmixed/htmlmixed.js +0 -84
  100. data/app/components/marty/script_form/client/mode/htmlmixed/index.html +0 -52
  101. data/app/components/marty/script_form/client/mode/javascript/index.html +0 -78
  102. data/app/components/marty/script_form/client/mode/javascript/javascript.js +0 -361
  103. data/app/components/marty/script_form/client/mode/jinja2/index.html +0 -38
  104. data/app/components/marty/script_form/client/mode/jinja2/jinja2.js +0 -42
  105. data/app/components/marty/script_form/client/mode/less/index.html +0 -740
  106. data/app/components/marty/script_form/client/mode/less/less.js +0 -266
  107. data/app/components/marty/script_form/client/mode/lua/index.html +0 -73
  108. data/app/components/marty/script_form/client/mode/lua/lua.js +0 -140
  109. data/app/components/marty/script_form/client/mode/markdown/index.html +0 -343
  110. data/app/components/marty/script_form/client/mode/markdown/markdown.js +0 -382
  111. data/app/components/marty/script_form/client/mode/markdown/test.js +0 -1084
  112. data/app/components/marty/script_form/client/mode/mysql/index.html +0 -42
  113. data/app/components/marty/script_form/client/mode/mysql/mysql.js +0 -186
  114. data/app/components/marty/script_form/client/mode/ntriples/index.html +0 -33
  115. data/app/components/marty/script_form/client/mode/ntriples/ntriples.js +0 -172
  116. data/app/components/marty/script_form/client/mode/ocaml/index.html +0 -130
  117. data/app/components/marty/script_form/client/mode/ocaml/ocaml.js +0 -114
  118. data/app/components/marty/script_form/client/mode/pascal/LICENSE +0 -7
  119. data/app/components/marty/script_form/client/mode/pascal/index.html +0 -49
  120. data/app/components/marty/script_form/client/mode/pascal/pascal.js +0 -94
  121. data/app/components/marty/script_form/client/mode/perl/LICENSE +0 -19
  122. data/app/components/marty/script_form/client/mode/perl/index.html +0 -63
  123. data/app/components/marty/script_form/client/mode/perl/perl.js +0 -816
  124. data/app/components/marty/script_form/client/mode/php/index.html +0 -49
  125. data/app/components/marty/script_form/client/mode/php/php.js +0 -148
  126. data/app/components/marty/script_form/client/mode/pig/index.html +0 -43
  127. data/app/components/marty/script_form/client/mode/pig/pig.js +0 -172
  128. data/app/components/marty/script_form/client/mode/plsql/index.html +0 -63
  129. data/app/components/marty/script_form/client/mode/plsql/plsql.js +0 -217
  130. data/app/components/marty/script_form/client/mode/properties/index.html +0 -41
  131. data/app/components/marty/script_form/client/mode/properties/properties.js +0 -63
  132. data/app/components/marty/script_form/client/mode/python/LICENSE.txt +0 -21
  133. data/app/components/marty/script_form/client/mode/python/index.html +0 -123
  134. data/app/components/marty/script_form/client/mode/python/python.js +0 -338
  135. data/app/components/marty/script_form/client/mode/r/LICENSE +0 -24
  136. data/app/components/marty/script_form/client/mode/r/index.html +0 -74
  137. data/app/components/marty/script_form/client/mode/r/r.js +0 -141
  138. data/app/components/marty/script_form/client/mode/rpm/changes/changes.js +0 -19
  139. data/app/components/marty/script_form/client/mode/rpm/changes/index.html +0 -54
  140. data/app/components/marty/script_form/client/mode/rpm/spec/index.html +0 -100
  141. data/app/components/marty/script_form/client/mode/rpm/spec/spec.css +0 -5
  142. data/app/components/marty/script_form/client/mode/rpm/spec/spec.js +0 -66
  143. data/app/components/marty/script_form/client/mode/rst/index.html +0 -526
  144. data/app/components/marty/script_form/client/mode/rst/rst.js +0 -326
  145. data/app/components/marty/script_form/client/mode/ruby/LICENSE +0 -24
  146. data/app/components/marty/script_form/client/mode/ruby/index.html +0 -172
  147. data/app/components/marty/script_form/client/mode/rust/index.html +0 -49
  148. data/app/components/marty/script_form/client/mode/rust/rust.js +0 -432
  149. data/app/components/marty/script_form/client/mode/scheme/index.html +0 -65
  150. data/app/components/marty/script_form/client/mode/scheme/scheme.js +0 -230
  151. data/app/components/marty/script_form/client/mode/shell/index.html +0 -50
  152. data/app/components/marty/script_form/client/mode/shell/shell.js +0 -118
  153. data/app/components/marty/script_form/client/mode/sieve/LICENSE +0 -23
  154. data/app/components/marty/script_form/client/mode/sieve/index.html +0 -81
  155. data/app/components/marty/script_form/client/mode/sieve/sieve.js +0 -156
  156. data/app/components/marty/script_form/client/mode/smalltalk/index.html +0 -56
  157. data/app/components/marty/script_form/client/mode/smalltalk/smalltalk.js +0 -139
  158. data/app/components/marty/script_form/client/mode/smarty/index.html +0 -83
  159. data/app/components/marty/script_form/client/mode/smarty/smarty.js +0 -148
  160. data/app/components/marty/script_form/client/mode/sparql/index.html +0 -41
  161. data/app/components/marty/script_form/client/mode/sparql/sparql.js +0 -143
  162. data/app/components/marty/script_form/client/mode/stex/index.html +0 -98
  163. data/app/components/marty/script_form/client/mode/stex/stex.js +0 -182
  164. data/app/components/marty/script_form/client/mode/stex/test.js +0 -343
  165. data/app/components/marty/script_form/client/mode/tiddlywiki/index.html +0 -141
  166. data/app/components/marty/script_form/client/mode/tiddlywiki/tiddlywiki.css +0 -14
  167. data/app/components/marty/script_form/client/mode/tiddlywiki/tiddlywiki.js +0 -384
  168. data/app/components/marty/script_form/client/mode/tiki/index.html +0 -83
  169. data/app/components/marty/script_form/client/mode/tiki/tiki.css +0 -26
  170. data/app/components/marty/script_form/client/mode/tiki/tiki.js +0 -309
  171. data/app/components/marty/script_form/client/mode/vb/LICENSE.txt +0 -21
  172. data/app/components/marty/script_form/client/mode/vb/index.html +0 -89
  173. data/app/components/marty/script_form/client/mode/vb/vb.js +0 -260
  174. data/app/components/marty/script_form/client/mode/vbscript/index.html +0 -43
  175. data/app/components/marty/script_form/client/mode/vbscript/vbscript.js +0 -26
  176. data/app/components/marty/script_form/client/mode/velocity/index.html +0 -104
  177. data/app/components/marty/script_form/client/mode/velocity/velocity.js +0 -146
  178. data/app/components/marty/script_form/client/mode/verilog/index.html +0 -211
  179. data/app/components/marty/script_form/client/mode/verilog/verilog.js +0 -194
  180. data/app/components/marty/script_form/client/mode/xml/index.html +0 -45
  181. data/app/components/marty/script_form/client/mode/xml/xml.js +0 -318
  182. data/app/components/marty/script_form/client/mode/xquery/LICENSE +0 -20
  183. data/app/components/marty/script_form/client/mode/xquery/index.html +0 -223
  184. data/app/components/marty/script_form/client/mode/xquery/test/index.html +0 -27
  185. data/app/components/marty/script_form/client/mode/xquery/test/testBase.js +0 -42
  186. data/app/components/marty/script_form/client/mode/xquery/test/testEmptySequenceKeyword.js +0 -16
  187. data/app/components/marty/script_form/client/mode/xquery/test/testMultiAttr.js +0 -16
  188. data/app/components/marty/script_form/client/mode/xquery/test/testNamespaces.js +0 -91
  189. data/app/components/marty/script_form/client/mode/xquery/test/testProcessingInstructions.js +0 -16
  190. data/app/components/marty/script_form/client/mode/xquery/test/testQuotes.js +0 -19
  191. data/app/components/marty/script_form/client/mode/xquery/xquery.js +0 -451
  192. data/app/components/marty/script_form/client/mode/yaml/index.html +0 -68
  193. data/app/components/marty/script_form/client/mode/yaml/yaml.js +0 -95
  194. data/app/components/marty/script_form/client/theme/ambiance.css +0 -81
  195. data/app/components/marty/script_form/client/theme/blackboard.css +0 -25
  196. data/app/components/marty/script_form/client/theme/cobalt.css +0 -18
  197. data/app/components/marty/script_form/client/theme/eclipse.css +0 -25
  198. data/app/components/marty/script_form/client/theme/elegant.css +0 -10
  199. data/app/components/marty/script_form/client/theme/erlang-dark.css +0 -21
  200. data/app/components/marty/script_form/client/theme/lesser-dark.css +0 -44
  201. data/app/components/marty/script_form/client/theme/monokai.css +0 -28
  202. data/app/components/marty/script_form/client/theme/neat.css +0 -9
  203. data/app/components/marty/script_form/client/theme/night.css +0 -21
  204. data/app/components/marty/script_form/client/theme/rubyblue.css +0 -21
  205. data/app/components/marty/script_form/client/theme/vibrant-ink.css +0 -27
  206. data/app/components/marty/script_form/client/theme/xq-dark.css +0 -46
  207. data/app/components/marty/script_form/client/util/closetag.js +0 -164
  208. data/app/components/marty/script_form/client/util/dialog.css +0 -27
  209. data/app/components/marty/script_form/client/util/dialog.js +0 -70
  210. data/app/components/marty/script_form/client/util/foldcode.js +0 -196
  211. data/app/components/marty/script_form/client/util/formatting.js +0 -193
  212. data/app/components/marty/script_form/client/util/javascript-hint.js +0 -134
  213. data/app/components/marty/script_form/client/util/loadmode.js +0 -51
  214. data/app/components/marty/script_form/client/util/match-highlighter.js +0 -44
  215. data/app/components/marty/script_form/client/util/multiplex.js +0 -77
  216. data/app/components/marty/script_form/client/util/overlay.js +0 -54
  217. data/app/components/marty/script_form/client/util/pig-hint.js +0 -123
  218. data/app/components/marty/script_form/client/util/runmode-standalone.js +0 -90
  219. data/app/components/marty/script_form/client/util/runmode.js +0 -53
  220. data/app/components/marty/script_form/client/util/search.js +0 -118
  221. data/app/components/marty/script_form/client/util/searchcursor.js +0 -119
  222. data/app/components/marty/script_form/client/util/simple-hint.css +0 -16
  223. data/app/components/marty/script_form/client/util/simple-hint.js +0 -97
  224. data/app/components/marty/script_form/client/util/xml-hint.js +0 -137
  225. data/lib/marty/javascript/grid_view_in_form.js +0 -81
@@ -1,63 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <title>CodeMirror: Erlang mode</title>
6
- <link rel="stylesheet" href="../../lib/codemirror.css">
7
- <script src="../../lib/codemirror.js"></script>
8
- <script src="erlang.js"></script>
9
- <link rel="stylesheet" href="../../theme/erlang-dark.css">
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: Erlang mode</h1>
15
-
16
- <form><textarea id="code" name="code">
17
- %% -*- mode: erlang; erlang-indent-level: 2 -*-
18
- %%% Created : 7 May 2012 by mats cronqvist <masse@klarna.com>
19
-
20
- %% @doc
21
- %% Demonstrates how to print a record.
22
- %% @end
23
-
24
- -module('ex').
25
- -author('mats cronqvist').
26
- -export([demo/0,
27
- rec_info/1]).
28
-
29
- -record(demo,{a="One",b="Two",c="Three",d="Four"}).
30
-
31
- rec_info(demo) -> record_info(fields,demo).
32
-
33
- demo() -> expand_recs(?MODULE,#demo{a="A",b="BB"}).
34
-
35
- expand_recs(M,List) when is_list(List) ->
36
- [expand_recs(M,L)||L<-List];
37
- expand_recs(M,Tup) when is_tuple(Tup) ->
38
- case tuple_size(Tup) of
39
- L when L < 1 -> Tup;
40
- L ->
41
- try Fields = M:rec_info(element(1,Tup)),
42
- L = length(Fields)+1,
43
- lists:zip(Fields,expand_recs(M,tl(tuple_to_list(Tup))))
44
- catch _:_ ->
45
- list_to_tuple(expand_recs(M,tuple_to_list(Tup)))
46
- end
47
- end;
48
- expand_recs(_,Term) ->
49
- Term.
50
- </textarea></form>
51
-
52
- <script>
53
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
54
- lineNumbers: true,
55
- matchBrackets: true,
56
- extraKeys: {"Tab": "indentAuto"},
57
- theme: "erlang-dark"
58
- });
59
- </script>
60
-
61
- <p><strong>MIME types defined:</strong> <code>text/x-erlang</code>.</p>
62
- </body>
63
- </html>
@@ -1,150 +0,0 @@
1
- CodeMirror.defineMode("gfm", function(config, parserConfig) {
2
- var mdMode = CodeMirror.getMode(config, "markdown");
3
- var aliases = {
4
- html: "htmlmixed",
5
- js: "javascript",
6
- json: "application/json",
7
- c: "text/x-csrc",
8
- "c++": "text/x-c++src",
9
- java: "text/x-java",
10
- csharp: "text/x-csharp",
11
- "c#": "text/x-csharp"
12
- };
13
-
14
- // make this lazy so that we don't need to load GFM last
15
- var getMode = (function () {
16
- var i, modes = {}, mimes = {}, mime;
17
-
18
- var list = CodeMirror.listModes();
19
- for (i = 0; i < list.length; i++) {
20
- modes[list[i]] = list[i];
21
- }
22
- var mimesList = CodeMirror.listMIMEs();
23
- for (i = 0; i < mimesList.length; i++) {
24
- mime = mimesList[i].mime;
25
- mimes[mime] = mimesList[i].mime;
26
- }
27
-
28
- for (var a in aliases) {
29
- if (aliases[a] in modes || aliases[a] in mimes)
30
- modes[a] = aliases[a];
31
- }
32
-
33
- return function (lang) {
34
- return modes[lang] ? CodeMirror.getMode(config, modes[lang]) : null;
35
- };
36
- }());
37
-
38
- function markdown(stream, state) {
39
- // intercept fenced code blocks
40
- if (stream.sol() && stream.match(/^```([\w+#]*)/)) {
41
- // try switching mode
42
- state.localMode = getMode(RegExp.$1);
43
- if (state.localMode)
44
- state.localState = state.localMode.startState();
45
-
46
- state.token = local;
47
- return 'code';
48
- }
49
-
50
- return mdMode.token(stream, state.mdState);
51
- }
52
-
53
- function local(stream, state) {
54
- if (stream.sol() && stream.match(/^```/)) {
55
- state.localMode = state.localState = null;
56
- state.token = markdown;
57
- return 'code';
58
- }
59
- else if (state.localMode) {
60
- return state.localMode.token(stream, state.localState);
61
- } else {
62
- stream.skipToEnd();
63
- return 'code';
64
- }
65
- }
66
-
67
- // custom handleText to prevent emphasis in the middle of a word
68
- // and add autolinking
69
- function handleText(stream, mdState) {
70
- var match;
71
- if (stream.match(/^\w+:\/\/\S+/)) {
72
- return 'link';
73
- }
74
- if (stream.match(/^[^\[*\\<>` _][^\[*\\<>` ]*[^\[*\\<>` _]/)) {
75
- return mdMode.getType(mdState);
76
- }
77
- if (match = stream.match(/^[^\[*\\<>` ]+/)) {
78
- var word = match[0];
79
- if (word[0] === '_' && word[word.length-1] === '_') {
80
- stream.backUp(word.length);
81
- return undefined;
82
- }
83
- return mdMode.getType(mdState);
84
- }
85
- if (stream.eatSpace()) {
86
- return null;
87
- }
88
- }
89
-
90
- return {
91
- startState: function() {
92
- var mdState = mdMode.startState();
93
- mdState.text = handleText;
94
- return {token: markdown, mode: "markdown", mdState: mdState,
95
- localMode: null, localState: null};
96
- },
97
-
98
- copyState: function(state) {
99
- return {token: state.token, mdState: CodeMirror.copyState(mdMode, state.mdState),
100
- localMode: state.localMode,
101
- localState: state.localMode ? CodeMirror.copyState(state.localMode, state.localState) : null};
102
- },
103
-
104
- token: function(stream, state) {
105
- /* Parse GFM double bracket links */
106
- var ch;
107
- if ((ch = stream.peek()) != undefined && ch == '[') {
108
- stream.next(); // Advance the stream
109
-
110
- /* Only handle double bracket links */
111
- if ((ch = stream.peek()) == undefined || ch != '[') {
112
- stream.backUp(1);
113
- return state.token(stream, state);
114
- }
115
-
116
- while ((ch = stream.next()) != undefined && ch != ']') {}
117
-
118
- if (ch == ']' && (ch = stream.next()) != undefined && ch == ']')
119
- return 'link';
120
-
121
- /* If we did not find the second ']' */
122
- stream.backUp(1);
123
- }
124
-
125
- /* Match GFM latex formulas, as well as latex formulas within '$' */
126
- if (stream.match(/^\$[^\$]+\$/)) {
127
- return "string";
128
- }
129
-
130
- if (stream.match(/^\\\((.*?)\\\)/)) {
131
- return "string";
132
- }
133
-
134
- if (stream.match(/^\$\$[^\$]+\$\$/)) {
135
- return "string";
136
- }
137
-
138
- if (stream.match(/^\\\[(.*?)\\\]/)) {
139
- return "string";
140
- }
141
-
142
- return state.token(stream, state);
143
- },
144
-
145
- innerMode: function(state) {
146
- if (state.token == markdown) return {state: state.mdState, mode: mdMode};
147
- else return {state: state.localState, mode: state.localMode};
148
- }
149
- };
150
- }, "markdown");
@@ -1,48 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <title>CodeMirror: GFM 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/markdown.js"></script>
10
- <script src="gfm.js"></script>
11
- <script src="../javascript/javascript.js"></script>
12
- <link rel="stylesheet" href="../markdown/markdown.css">
13
- <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
14
- <link rel="stylesheet" href="../../doc/docs.css">
15
- </head>
16
- <body>
17
- <h1>CodeMirror: GFM mode</h1>
18
-
19
- <!-- source: http://daringfireball.net/projects/markdown/basics.text -->
20
- <form><textarea id="code" name="code">
21
- Github Flavored Markdown
22
- ========================
23
-
24
- Everything from markdown plus GFM features:
25
-
26
- ## Fenced code blocks
27
-
28
- ```javascript
29
- for (var i = 0; i &lt; items.length; i++) {
30
- console.log(items[i], i); // log them
31
- }
32
- ```
33
-
34
- See http://github.github.com/github-flavored-markdown/
35
-
36
- </textarea></form>
37
-
38
- <script>
39
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
40
- mode: 'gfm',
41
- lineNumbers: true,
42
- matchBrackets: true,
43
- theme: "default"
44
- });
45
- </script>
46
-
47
- </body>
48
- </html>
@@ -1,170 +0,0 @@
1
- CodeMirror.defineMode("go", function(config, parserConfig) {
2
- var indentUnit = config.indentUnit;
3
-
4
- var keywords = {
5
- "break":true, "case":true, "chan":true, "const":true, "continue":true,
6
- "default":true, "defer":true, "else":true, "fallthrough":true, "for":true,
7
- "func":true, "go":true, "goto":true, "if":true, "import":true,
8
- "interface":true, "map":true, "package":true, "range":true, "return":true,
9
- "select":true, "struct":true, "switch":true, "type":true, "var":true,
10
- "bool":true, "byte":true, "complex64":true, "complex128":true,
11
- "float32":true, "float64":true, "int8":true, "int16":true, "int32":true,
12
- "int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true,
13
- "uint64":true, "int":true, "uint":true, "uintptr":true
14
- };
15
-
16
- var atoms = {
17
- "true":true, "false":true, "iota":true, "nil":true, "append":true,
18
- "cap":true, "close":true, "complex":true, "copy":true, "imag":true,
19
- "len":true, "make":true, "new":true, "panic":true, "print":true,
20
- "println":true, "real":true, "recover":true
21
- };
22
-
23
- var blockKeywords = {
24
- "else":true, "for":true, "func":true, "if":true, "interface":true,
25
- "select":true, "struct":true, "switch":true
26
- };
27
-
28
- var isOperatorChar = /[+\-*&^%:=<>!|\/]/;
29
-
30
- var curPunc;
31
-
32
- function tokenBase(stream, state) {
33
- var ch = stream.next();
34
- if (ch == '"' || ch == "'" || ch == "`") {
35
- state.tokenize = tokenString(ch);
36
- return state.tokenize(stream, state);
37
- }
38
- if (/[\d\.]/.test(ch)) {
39
- if (ch == ".") {
40
- stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
41
- } else if (ch == "0") {
42
- stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
43
- } else {
44
- stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
45
- }
46
- return "number";
47
- }
48
- if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
49
- curPunc = ch;
50
- return null;
51
- }
52
- if (ch == "/") {
53
- if (stream.eat("*")) {
54
- state.tokenize = tokenComment;
55
- return tokenComment(stream, state);
56
- }
57
- if (stream.eat("/")) {
58
- stream.skipToEnd();
59
- return "comment";
60
- }
61
- }
62
- if (isOperatorChar.test(ch)) {
63
- stream.eatWhile(isOperatorChar);
64
- return "operator";
65
- }
66
- stream.eatWhile(/[\w\$_]/);
67
- var cur = stream.current();
68
- if (keywords.propertyIsEnumerable(cur)) {
69
- if (cur == "case" || cur == "default") curPunc = "case";
70
- return "keyword";
71
- }
72
- if (atoms.propertyIsEnumerable(cur)) return "atom";
73
- return "variable";
74
- }
75
-
76
- function tokenString(quote) {
77
- return function(stream, state) {
78
- var escaped = false, next, end = false;
79
- while ((next = stream.next()) != null) {
80
- if (next == quote && !escaped) {end = true; break;}
81
- escaped = !escaped && next == "\\";
82
- }
83
- if (end || !(escaped || quote == "`"))
84
- state.tokenize = tokenBase;
85
- return "string";
86
- };
87
- }
88
-
89
- function tokenComment(stream, state) {
90
- var maybeEnd = false, ch;
91
- while (ch = stream.next()) {
92
- if (ch == "/" && maybeEnd) {
93
- state.tokenize = tokenBase;
94
- break;
95
- }
96
- maybeEnd = (ch == "*");
97
- }
98
- return "comment";
99
- }
100
-
101
- function Context(indented, column, type, align, prev) {
102
- this.indented = indented;
103
- this.column = column;
104
- this.type = type;
105
- this.align = align;
106
- this.prev = prev;
107
- }
108
- function pushContext(state, col, type) {
109
- return state.context = new Context(state.indented, col, type, null, state.context);
110
- }
111
- function popContext(state) {
112
- var t = state.context.type;
113
- if (t == ")" || t == "]" || t == "}")
114
- state.indented = state.context.indented;
115
- return state.context = state.context.prev;
116
- }
117
-
118
- // Interface
119
-
120
- return {
121
- startState: function(basecolumn) {
122
- return {
123
- tokenize: null,
124
- context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
125
- indented: 0,
126
- startOfLine: true
127
- };
128
- },
129
-
130
- token: function(stream, state) {
131
- var ctx = state.context;
132
- if (stream.sol()) {
133
- if (ctx.align == null) ctx.align = false;
134
- state.indented = stream.indentation();
135
- state.startOfLine = true;
136
- if (ctx.type == "case") ctx.type = "}";
137
- }
138
- if (stream.eatSpace()) return null;
139
- curPunc = null;
140
- var style = (state.tokenize || tokenBase)(stream, state);
141
- if (style == "comment") return style;
142
- if (ctx.align == null) ctx.align = true;
143
-
144
- if (curPunc == "{") pushContext(state, stream.column(), "}");
145
- else if (curPunc == "[") pushContext(state, stream.column(), "]");
146
- else if (curPunc == "(") pushContext(state, stream.column(), ")");
147
- else if (curPunc == "case") ctx.type = "case";
148
- else if (curPunc == "}" && ctx.type == "}") ctx = popContext(state);
149
- else if (curPunc == ctx.type) popContext(state);
150
- state.startOfLine = false;
151
- return style;
152
- },
153
-
154
- indent: function(state, textAfter) {
155
- if (state.tokenize != tokenBase && state.tokenize != null) return 0;
156
- var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
157
- if (ctx.type == "case" && /^(?:case|default)\b/.test(textAfter)) {
158
- state.context.type = "}";
159
- return ctx.indented;
160
- }
161
- var closing = firstChar == ctx.type;
162
- if (ctx.align) return ctx.column + (closing ? 0 : 1);
163
- else return ctx.indented + (closing ? 0 : indentUnit);
164
- },
165
-
166
- electricChars: "{}:"
167
- };
168
- });
169
-
170
- CodeMirror.defineMIME("text/x-go", "go");
@@ -1,73 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <title>CodeMirror: Go mode</title>
6
- <link rel="stylesheet" href="../../lib/codemirror.css">
7
- <link rel="stylesheet" href="../../theme/elegant.css">
8
- <script src="../../lib/codemirror.js"></script>
9
- <script src="go.js"></script>
10
- <link rel="stylesheet" href="../../doc/docs.css">
11
- <style>.CodeMirror {border:1px solid #999; background:#ffc}</style>
12
- </head>
13
- <body>
14
- <h1>CodeMirror: Go mode</h1>
15
-
16
- <form><textarea id="code" name="code">
17
- // Prime Sieve in Go.
18
- // Taken from the Go specification.
19
- // Copyright © The Go Authors.
20
-
21
- package main
22
-
23
- import "fmt"
24
-
25
- // Send the sequence 2, 3, 4, ... to channel 'ch'.
26
- func generate(ch chan&lt;- int) {
27
- for i := 2; ; i++ {
28
- ch &lt;- i // Send 'i' to channel 'ch'
29
- }
30
- }
31
-
32
- // Copy the values from channel 'src' to channel 'dst',
33
- // removing those divisible by 'prime'.
34
- func filter(src &lt;-chan int, dst chan&lt;- int, prime int) {
35
- for i := range src { // Loop over values received from 'src'.
36
- if i%prime != 0 {
37
- dst &lt;- i // Send 'i' to channel 'dst'.
38
- }
39
- }
40
- }
41
-
42
- // The prime sieve: Daisy-chain filter processes together.
43
- func sieve() {
44
- ch := make(chan int) // Create a new channel.
45
- go generate(ch) // Start generate() as a subprocess.
46
- for {
47
- prime := &lt;-ch
48
- fmt.Print(prime, "\n")
49
- ch1 := make(chan int)
50
- go filter(ch, ch1, prime)
51
- ch = ch1
52
- }
53
- }
54
-
55
- func main() {
56
- sieve()
57
- }
58
- </textarea></form>
59
-
60
- <script>
61
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
62
- theme: "elegant",
63
- matchBrackets: true,
64
- indentUnit: 8,
65
- tabSize: 8,
66
- indentWithTabs: true,
67
- mode: "text/x-go"
68
- });
69
- </script>
70
-
71
- <p><strong>MIME type:</strong> <code>text/x-go</code></p>
72
- </body>
73
- </html>