marty 2.4.7 → 2.4.8

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 (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,83 +0,0 @@
1
- <html xmlns="http://www.w3.org/1999/xhtml">
2
- <head>
3
- <meta charset="utf-8">
4
- <title>CodeMirror: Tiki wiki mode</title>
5
- <link rel="stylesheet" href="../../lib/codemirror.css">
6
- <script src="../../lib/codemirror.js"></script>
7
- <script src="tiki.js"></script>
8
- <link rel="stylesheet" href="tiki.css">
9
- <link rel="stylesheet" href="../../doc/docs.css">
10
- <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
11
- </head>
12
- <body style="padding: 20px;">
13
- <h1>CodeMirror: Tiki wiki mode</h1>
14
-
15
- <div><textarea id="code" name="code">
16
- Headings
17
- !Header 1
18
- !!Header 2
19
- !!!Header 3
20
- !!!!Header 4
21
- !!!!!Header 5
22
- !!!!!!Header 6
23
-
24
- Styling
25
- -=titlebar=-
26
- ^^ Box on multi
27
- lines
28
- of content^^
29
- __bold__
30
- ''italic''
31
- ===underline===
32
- ::center::
33
- --Line Through--
34
-
35
- Operators
36
- ~np~No parse~/np~
37
-
38
- Link
39
- [link|desc|nocache]
40
-
41
- Wiki
42
- ((Wiki))
43
- ((Wiki|desc))
44
- ((Wiki|desc|timeout))
45
-
46
- Table
47
- ||row1 col1|row1 col2|row1 col3
48
- row2 col1|row2 col2|row2 col3
49
- row3 col1|row3 col2|row3 col3||
50
-
51
- Lists:
52
- *bla
53
- **bla-1
54
- ++continue-bla-1
55
- ***bla-2
56
- ++continue-bla-1
57
- *bla
58
- +continue-bla
59
- #bla
60
- ** tra-la-la
61
- +continue-bla
62
- #bla
63
-
64
- Plugin (standard):
65
- {PLUGIN(attr="my attr")}
66
- Plugin Body
67
- {PLUGIN}
68
-
69
- Plugin (inline):
70
- {plugin attr="my attr"}
71
- </textarea></div>
72
-
73
- <script type="text/javascript">
74
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
75
- mode: 'tiki',
76
- lineNumbers: true,
77
- enterMode: 'keep',
78
- matchBrackets: true
79
- });
80
- </script>
81
-
82
- </body>
83
- </html>
@@ -1,26 +0,0 @@
1
- .cm-tw-syntaxerror {
2
- color: #FFFFFF;
3
- background-color: #990000;
4
- }
5
-
6
- .cm-tw-deleted {
7
- text-decoration: line-through;
8
- }
9
-
10
- .cm-tw-header5 {
11
- font-weight: bold;
12
- }
13
- .cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/
14
- padding-left: 10px;
15
- }
16
-
17
- .cm-tw-box {
18
- border-top-width: 0px ! important;
19
- border-style: solid;
20
- border-width: 1px;
21
- border-color: inherit;
22
- }
23
-
24
- .cm-tw-underline {
25
- text-decoration: underline;
26
- }
@@ -1,309 +0,0 @@
1
- CodeMirror.defineMode('tiki', function(config, parserConfig) {
2
- function inBlock(style, terminator, returnTokenizer) {
3
- return function(stream, state) {
4
- while (!stream.eol()) {
5
- if (stream.match(terminator)) {
6
- state.tokenize = inText;
7
- break;
8
- }
9
- stream.next();
10
- }
11
-
12
- if (returnTokenizer) state.tokenize = returnTokenizer;
13
-
14
- return style;
15
- };
16
- }
17
-
18
- function inLine(style, terminator) {
19
- return function(stream, state) {
20
- while(!stream.eol()) {
21
- stream.next();
22
- }
23
- state.tokenize = inText;
24
- return style;
25
- };
26
- }
27
-
28
- function inText(stream, state) {
29
- function chain(parser) {
30
- state.tokenize = parser;
31
- return parser(stream, state);
32
- }
33
-
34
- var sol = stream.sol();
35
- var ch = stream.next();
36
-
37
- //non start of line
38
- switch (ch) { //switch is generally much faster than if, so it is used here
39
- case "{": //plugin
40
- var type = stream.eat("/") ? "closeTag" : "openTag";
41
- stream.eatSpace();
42
- var tagName = "";
43
- var c;
44
- while ((c = stream.eat(/[^\s\u00a0=\"\'\/?(}]/))) tagName += c;
45
- state.tokenize = inPlugin;
46
- return "tag";
47
- break;
48
- case "_": //bold
49
- if (stream.eat("_")) {
50
- return chain(inBlock("strong", "__", inText));
51
- }
52
- break;
53
- case "'": //italics
54
- if (stream.eat("'")) {
55
- // Italic text
56
- return chain(inBlock("em", "''", inText));
57
- }
58
- break;
59
- case "(":// Wiki Link
60
- if (stream.eat("(")) {
61
- return chain(inBlock("variable-2", "))", inText));
62
- }
63
- break;
64
- case "[":// Weblink
65
- return chain(inBlock("variable-3", "]", inText));
66
- break;
67
- case "|": //table
68
- if (stream.eat("|")) {
69
- return chain(inBlock("comment", "||"));
70
- }
71
- break;
72
- case "-":
73
- if (stream.eat("=")) {//titleBar
74
- return chain(inBlock("header string", "=-", inText));
75
- } else if (stream.eat("-")) {//deleted
76
- return chain(inBlock("error tw-deleted", "--", inText));
77
- }
78
- break;
79
- case "=": //underline
80
- if (stream.match("==")) {
81
- return chain(inBlock("tw-underline", "===", inText));
82
- }
83
- break;
84
- case ":":
85
- if (stream.eat(":")) {
86
- return chain(inBlock("comment", "::"));
87
- }
88
- break;
89
- case "^": //box
90
- return chain(inBlock("tw-box", "^"));
91
- break;
92
- case "~": //np
93
- if (stream.match("np~")) {
94
- return chain(inBlock("meta", "~/np~"));
95
- }
96
- break;
97
- }
98
-
99
- //start of line types
100
- if (sol) {
101
- switch (ch) {
102
- case "!": //header at start of line
103
- if (stream.match('!!!!!')) {
104
- return chain(inLine("header string"));
105
- } else if (stream.match('!!!!')) {
106
- return chain(inLine("header string"));
107
- } else if (stream.match('!!!')) {
108
- return chain(inLine("header string"));
109
- } else if (stream.match('!!')) {
110
- return chain(inLine("header string"));
111
- } else {
112
- return chain(inLine("header string"));
113
- }
114
- break;
115
- case "*": //unordered list line item, or <li /> at start of line
116
- case "#": //ordered list line item, or <li /> at start of line
117
- case "+": //ordered list line item, or <li /> at start of line
118
- return chain(inLine("tw-listitem bracket"));
119
- break;
120
- }
121
- }
122
-
123
- //stream.eatWhile(/[&{]/); was eating up plugins, turned off to act less like html and more like tiki
124
- return null;
125
- }
126
-
127
- var indentUnit = config.indentUnit;
128
-
129
- // Return variables for tokenizers
130
- var pluginName, type;
131
- function inPlugin(stream, state) {
132
- var ch = stream.next();
133
- var peek = stream.peek();
134
-
135
- if (ch == "}") {
136
- state.tokenize = inText;
137
- //type = ch == ")" ? "endPlugin" : "selfclosePlugin"; inPlugin
138
- return "tag";
139
- } else if (ch == "(" || ch == ")") {
140
- return "bracket";
141
- } else if (ch == "=") {
142
- type = "equals";
143
-
144
- if (peek == ">") {
145
- ch = stream.next();
146
- peek = stream.peek();
147
- }
148
-
149
- //here we detect values directly after equal character with no quotes
150
- if (!/[\'\"]/.test(peek)) {
151
- state.tokenize = inAttributeNoQuote();
152
- }
153
- //end detect values
154
-
155
- return "operator";
156
- } else if (/[\'\"]/.test(ch)) {
157
- state.tokenize = inAttribute(ch);
158
- return state.tokenize(stream, state);
159
- } else {
160
- stream.eatWhile(/[^\s\u00a0=\"\'\/?]/);
161
- return "keyword";
162
- }
163
- }
164
-
165
- function inAttribute(quote) {
166
- return function(stream, state) {
167
- while (!stream.eol()) {
168
- if (stream.next() == quote) {
169
- state.tokenize = inPlugin;
170
- break;
171
- }
172
- }
173
- return "string";
174
- };
175
- }
176
-
177
- function inAttributeNoQuote() {
178
- return function(stream, state) {
179
- while (!stream.eol()) {
180
- var ch = stream.next();
181
- var peek = stream.peek();
182
- if (ch == " " || ch == "," || /[ )}]/.test(peek)) {
183
- state.tokenize = inPlugin;
184
- break;
185
- }
186
- }
187
- return "string";
188
- };
189
- }
190
-
191
- var curState, setStyle;
192
- function pass() {
193
- for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
194
- }
195
-
196
- function cont() {
197
- pass.apply(null, arguments);
198
- return true;
199
- }
200
-
201
- function pushContext(pluginName, startOfLine) {
202
- var noIndent = curState.context && curState.context.noIndent;
203
- curState.context = {
204
- prev: curState.context,
205
- pluginName: pluginName,
206
- indent: curState.indented,
207
- startOfLine: startOfLine,
208
- noIndent: noIndent
209
- };
210
- }
211
-
212
- function popContext() {
213
- if (curState.context) curState.context = curState.context.prev;
214
- }
215
-
216
- function element(type) {
217
- if (type == "openPlugin") {curState.pluginName = pluginName; return cont(attributes, endplugin(curState.startOfLine));}
218
- else if (type == "closePlugin") {
219
- var err = false;
220
- if (curState.context) {
221
- err = curState.context.pluginName != pluginName;
222
- popContext();
223
- } else {
224
- err = true;
225
- }
226
- if (err) setStyle = "error";
227
- return cont(endcloseplugin(err));
228
- }
229
- else if (type == "string") {
230
- if (!curState.context || curState.context.name != "!cdata") pushContext("!cdata");
231
- if (curState.tokenize == inText) popContext();
232
- return cont();
233
- }
234
- else return cont();
235
- }
236
-
237
- function endplugin(startOfLine) {
238
- return function(type) {
239
- if (
240
- type == "selfclosePlugin" ||
241
- type == "endPlugin"
242
- )
243
- return cont();
244
- if (type == "endPlugin") {pushContext(curState.pluginName, startOfLine); return cont();}
245
- return cont();
246
- };
247
- }
248
-
249
- function endcloseplugin(err) {
250
- return function(type) {
251
- if (err) setStyle = "error";
252
- if (type == "endPlugin") return cont();
253
- return pass();
254
- };
255
- }
256
-
257
- function attributes(type) {
258
- if (type == "keyword") {setStyle = "attribute"; return cont(attributes);}
259
- if (type == "equals") return cont(attvalue, attributes);
260
- return pass();
261
- }
262
- function attvalue(type) {
263
- if (type == "keyword") {setStyle = "string"; return cont();}
264
- if (type == "string") return cont(attvaluemaybe);
265
- return pass();
266
- }
267
- function attvaluemaybe(type) {
268
- if (type == "string") return cont(attvaluemaybe);
269
- else return pass();
270
- }
271
- return {
272
- startState: function() {
273
- return {tokenize: inText, cc: [], indented: 0, startOfLine: true, pluginName: null, context: null};
274
- },
275
- token: function(stream, state) {
276
- if (stream.sol()) {
277
- state.startOfLine = true;
278
- state.indented = stream.indentation();
279
- }
280
- if (stream.eatSpace()) return null;
281
-
282
- setStyle = type = pluginName = null;
283
- var style = state.tokenize(stream, state);
284
- if ((style || type) && style != "comment") {
285
- curState = state;
286
- while (true) {
287
- var comb = state.cc.pop() || element;
288
- if (comb(type || style)) break;
289
- }
290
- }
291
- state.startOfLine = false;
292
- return setStyle || style;
293
- },
294
- indent: function(state, textAfter) {
295
- var context = state.context;
296
- if (context && context.noIndent) return 0;
297
- if (context && /^{\//.test(textAfter))
298
- context = context.prev;
299
- while (context && !context.startOfLine)
300
- context = context.prev;
301
- if (context) return context.indent + indentUnit;
302
- else return 0;
303
- },
304
- electricChars: "/"
305
- };
306
- });
307
-
308
- //I figure, why not
309
- CodeMirror.defineMIME("text/tiki", "tiki");
@@ -1,21 +0,0 @@
1
- The MIT License
2
-
3
- Copyright (c) 2012 Codility Limited, 107 Cheapside, London EC2V 6DN, UK
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,89 +0,0 @@
1
- <html>
2
- <head>
3
- <meta charset="utf-8">
4
- <title>CodeMirror: VB.NET mode</title>
5
- <link rel="stylesheet" href="../../lib/codemirror.css">
6
- <script src="../../lib/codemirror.js"></script>
7
- <script src="vb.js"></script>
8
- <link rel="stylesheet" href="../../doc/docs.css">
9
- <link href="http://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet" type="text/css">
10
- <style>
11
- .CodeMirror {border: 1px solid #aaa; height:210px;}
12
- .CodeMirror-scroll { overflow-x: auto; height: 100%;}
13
- .CodeMirror pre { font-family: Inconsolata; font-size: 14px}
14
- </style>
15
- <script type="text/javascript" src="../../lib/util/runmode.js"></script>
16
- </head>
17
- <body onload="init()">
18
- <h1>CodeMirror: VB.NET mode</h1>
19
- <script type="text/javascript">
20
- function test(golden, text) {
21
- var ok = true;
22
- var i = 0;
23
- function callback(token, style, lineNo, pos){
24
- //console.log(String(token) + " " + String(style) + " " + String(lineNo) + " " + String(pos));
25
- var result = [String(token), String(style)];
26
- if (golden[i][0] != result[0] || golden[i][1] != result[1]){
27
- return "Error, expected: " + String(golden[i]) + ", got: " + String(result);
28
- ok = false;
29
- }
30
- i++;
31
- }
32
- CodeMirror.runMode(text, "text/x-vb",callback);
33
-
34
- if (ok) return "Tests OK";
35
- }
36
- function testTypes() {
37
- var golden = [['Integer','keyword'],[' ','null'],['Float','keyword']]
38
- var text = "Integer Float";
39
- return test(golden,text);
40
- }
41
- function testIf(){
42
- var golden = [['If','keyword'],[' ','null'],['True','keyword'],[' ','null'],['End','keyword'],[' ','null'],['If','keyword']];
43
- var text = 'If True End If';
44
- return test(golden, text);
45
- }
46
- function testDecl(){
47
- var golden = [['Dim','keyword'],[' ','null'],['x','variable'],[' ','null'],['as','keyword'],[' ','null'],['Integer','keyword']];
48
- var text = 'Dim x as Integer';
49
- return test(golden, text);
50
- }
51
- function testAll(){
52
- var result = "";
53
-
54
- result += testTypes() + "\n";
55
- result += testIf() + "\n";
56
- result += testDecl() + "\n";
57
- return result;
58
-
59
- }
60
- function initText(editor) {
61
- var content = 'Class rocket\nPrivate quality as Double\nPublic Sub launch() as String\nif quality > 0.8\nlaunch = "Successful"\nElse\nlaunch = "Failed"\nEnd If\nEnd sub\nEnd class\n';
62
- editor.setValue(content);
63
- for (var i =0; i< editor.lineCount(); i++) editor.indentLine(i);
64
- }
65
- function init() {
66
- editor = CodeMirror.fromTextArea(document.getElementById("solution"), {
67
- lineNumbers: true,
68
- matchBrackets: true,
69
- mode: "text/x-vb",
70
- readOnly: false,
71
- tabMode: "shift"
72
- });
73
- runTest();
74
- }
75
- function runTest() {
76
- document.getElementById('testresult').innerHTML = testAll();
77
- initText(editor);
78
-
79
- }
80
- </script>
81
-
82
-
83
- <div id="edit">
84
- <textarea style="width:95%;height:200px;padding:5px;" name="solution" id="solution" ></textarea>
85
- </div>
86
- <pre id="testresult"></pre>
87
- <p>MIME type defined: <code>text/x-vb</code>.</p>
88
-
89
- </body></html>