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,1084 +0,0 @@
1
- // Initiate ModeTest and set defaults
2
- var MT = ModeTest;
3
- MT.modeName = 'markdown';
4
- MT.modeOptions = {};
5
-
6
- MT.testMode(
7
- 'plainText',
8
- 'foo',
9
- [
10
- null, 'foo'
11
- ]
12
- );
13
-
14
- // Code blocks using 4 spaces (regardless of CodeMirror.tabSize value)
15
- MT.testMode(
16
- 'codeBlocksUsing4Spaces',
17
- ' foo',
18
- [
19
- null, ' ',
20
- 'comment', 'foo'
21
- ]
22
- );
23
-
24
- // Code blocks using 1 tab (regardless of CodeMirror.indentWithTabs value)
25
- MT.testMode(
26
- 'codeBlocksUsing1Tab',
27
- '\tfoo',
28
- [
29
- null, '\t',
30
- 'comment', 'foo'
31
- ]
32
- );
33
-
34
- // Inline code using backticks
35
- MT.testMode(
36
- 'inlineCodeUsingBackticks',
37
- 'foo `bar`',
38
- [
39
- null, 'foo ',
40
- 'comment', '`bar`'
41
- ]
42
- );
43
-
44
- // Unclosed backticks
45
- // Instead of simply marking as CODE, it would be nice to have an
46
- // incomplete flag for CODE, that is styled slightly different.
47
- MT.testMode(
48
- 'unclosedBackticks',
49
- 'foo `bar',
50
- [
51
- null, 'foo ',
52
- 'comment', '`bar'
53
- ]
54
- );
55
-
56
- // Per documentation: "To include a literal backtick character within a
57
- // code span, you can use multiple backticks as the opening and closing
58
- // delimiters"
59
- MT.testMode(
60
- 'doubleBackticks',
61
- '``foo ` bar``',
62
- [
63
- 'comment', '``foo ` bar``'
64
- ]
65
- );
66
-
67
- // Tests based on Dingus
68
- // http://daringfireball.net/projects/markdown/dingus
69
- //
70
- // Multiple backticks within an inline code block
71
- MT.testMode(
72
- 'consecutiveBackticks',
73
- '`foo```bar`',
74
- [
75
- 'comment', '`foo```bar`'
76
- ]
77
- );
78
- // Multiple backticks within an inline code block with a second code block
79
- MT.testMode(
80
- 'consecutiveBackticks',
81
- '`foo```bar` hello `world`',
82
- [
83
- 'comment', '`foo```bar`',
84
- null, ' hello ',
85
- 'comment', '`world`'
86
- ]
87
- );
88
- // Unclosed with several different groups of backticks
89
- MT.testMode(
90
- 'unclosedBackticks',
91
- '``foo ``` bar` hello',
92
- [
93
- 'comment', '``foo ``` bar` hello'
94
- ]
95
- );
96
- // Closed with several different groups of backticks
97
- MT.testMode(
98
- 'closedBackticks',
99
- '``foo ``` bar` hello`` world',
100
- [
101
- 'comment', '``foo ``` bar` hello``',
102
- null, ' world'
103
- ]
104
- );
105
-
106
- // atx headers
107
- // http://daringfireball.net/projects/markdown/syntax#header
108
- //
109
- // H1
110
- MT.testMode(
111
- 'atxH1',
112
- '# foo',
113
- [
114
- 'header', '# foo'
115
- ]
116
- );
117
- // H2
118
- MT.testMode(
119
- 'atxH2',
120
- '## foo',
121
- [
122
- 'header', '## foo'
123
- ]
124
- );
125
- // H3
126
- MT.testMode(
127
- 'atxH3',
128
- '### foo',
129
- [
130
- 'header', '### foo'
131
- ]
132
- );
133
- // H4
134
- MT.testMode(
135
- 'atxH4',
136
- '#### foo',
137
- [
138
- 'header', '#### foo'
139
- ]
140
- );
141
- // H5
142
- MT.testMode(
143
- 'atxH5',
144
- '##### foo',
145
- [
146
- 'header', '##### foo'
147
- ]
148
- );
149
- // H6
150
- MT.testMode(
151
- 'atxH6',
152
- '###### foo',
153
- [
154
- 'header', '###### foo'
155
- ]
156
- );
157
- // H6 - 7x '#' should still be H6, per Dingus
158
- // http://daringfireball.net/projects/markdown/dingus
159
- MT.testMode(
160
- 'atxH6NotH7',
161
- '####### foo',
162
- [
163
- 'header', '####### foo'
164
- ]
165
- );
166
-
167
- // Setext headers - H1, H2
168
- // Per documentation, "Any number of underlining =’s or -’s will work."
169
- // http://daringfireball.net/projects/markdown/syntax#header
170
- // Ideally, the text would be marked as `header` as well, but this is
171
- // not really feasible at the moment. So, instead, we're testing against
172
- // what works today, to avoid any regressions.
173
- //
174
- // Check if single underlining = works
175
- MT.testMode(
176
- 'setextH1',
177
- 'foo\n=',
178
- [
179
- null, 'foo',
180
- 'header', '='
181
- ]
182
- );
183
- // Check if 3+ ='s work
184
- MT.testMode(
185
- 'setextH1',
186
- 'foo\n===',
187
- [
188
- null, 'foo',
189
- 'header', '==='
190
- ]
191
- );
192
- // Check if single underlining - works
193
- MT.testMode(
194
- 'setextH2',
195
- 'foo\n-',
196
- [
197
- null, 'foo',
198
- 'header', '-'
199
- ]
200
- );
201
- // Check if 3+ -'s work
202
- MT.testMode(
203
- 'setextH2',
204
- 'foo\n---',
205
- [
206
- null, 'foo',
207
- 'header', '---'
208
- ]
209
- );
210
-
211
- // Single-line blockquote with trailing space
212
- MT.testMode(
213
- 'blockquoteSpace',
214
- '> foo',
215
- [
216
- 'quote', '> foo'
217
- ]
218
- );
219
-
220
- // Single-line blockquote
221
- MT.testMode(
222
- 'blockquoteNoSpace',
223
- '>foo',
224
- [
225
- 'quote', '>foo'
226
- ]
227
- );
228
-
229
- // Single-line blockquote followed by normal paragraph
230
- MT.testMode(
231
- 'blockquoteThenParagraph',
232
- '>foo\n\nbar',
233
- [
234
- 'quote', '>foo',
235
- null, 'bar'
236
- ]
237
- );
238
-
239
- // Multi-line blockquote (lazy mode)
240
- MT.testMode(
241
- 'multiBlockquoteLazy',
242
- '>foo\nbar',
243
- [
244
- 'quote', '>foo',
245
- 'quote', 'bar'
246
- ]
247
- );
248
-
249
- // Multi-line blockquote followed by normal paragraph (lazy mode)
250
- MT.testMode(
251
- 'multiBlockquoteLazyThenParagraph',
252
- '>foo\nbar\n\nhello',
253
- [
254
- 'quote', '>foo',
255
- 'quote', 'bar',
256
- null, 'hello'
257
- ]
258
- );
259
-
260
- // Multi-line blockquote (non-lazy mode)
261
- MT.testMode(
262
- 'multiBlockquote',
263
- '>foo\n>bar',
264
- [
265
- 'quote', '>foo',
266
- 'quote', '>bar'
267
- ]
268
- );
269
-
270
- // Multi-line blockquote followed by normal paragraph (non-lazy mode)
271
- MT.testMode(
272
- 'multiBlockquoteThenParagraph',
273
- '>foo\n>bar\n\nhello',
274
- [
275
- 'quote', '>foo',
276
- 'quote', '>bar',
277
- null, 'hello'
278
- ]
279
- );
280
-
281
- // Check list types
282
- MT.testMode(
283
- 'listAsterisk',
284
- '* foo\n* bar',
285
- [
286
- 'string', '* foo',
287
- 'string', '* bar'
288
- ]
289
- );
290
- MT.testMode(
291
- 'listPlus',
292
- '+ foo\n+ bar',
293
- [
294
- 'string', '+ foo',
295
- 'string', '+ bar'
296
- ]
297
- );
298
- MT.testMode(
299
- 'listDash',
300
- '- foo\n- bar',
301
- [
302
- 'string', '- foo',
303
- 'string', '- bar'
304
- ]
305
- );
306
- MT.testMode(
307
- 'listNumber',
308
- '1. foo\n2. bar',
309
- [
310
- 'string', '1. foo',
311
- 'string', '2. bar'
312
- ]
313
- );
314
-
315
- // Formatting in lists (*)
316
- MT.testMode(
317
- 'listAsteriskFormatting',
318
- '* *foo* bar\n\n* **foo** bar\n\n* ***foo*** bar\n\n* `foo` bar',
319
- [
320
- 'string', '* ',
321
- 'string em', '*foo*',
322
- 'string', ' bar',
323
- 'string', '* ',
324
- 'string strong', '**foo**',
325
- 'string', ' bar',
326
- 'string', '* ',
327
- 'string strong', '**',
328
- 'string emstrong', '*foo**',
329
- 'string em', '*',
330
- 'string', ' bar',
331
- 'string', '* ',
332
- 'string comment', '`foo`',
333
- 'string', ' bar'
334
- ]
335
- );
336
- // Formatting in lists (+)
337
- MT.testMode(
338
- 'listPlusFormatting',
339
- '+ *foo* bar\n\n+ **foo** bar\n\n+ ***foo*** bar\n\n+ `foo` bar',
340
- [
341
- 'string', '+ ',
342
- 'string em', '*foo*',
343
- 'string', ' bar',
344
- 'string', '+ ',
345
- 'string strong', '**foo**',
346
- 'string', ' bar',
347
- 'string', '+ ',
348
- 'string strong', '**',
349
- 'string emstrong', '*foo**',
350
- 'string em', '*',
351
- 'string', ' bar',
352
- 'string', '+ ',
353
- 'string comment', '`foo`',
354
- 'string', ' bar'
355
- ]
356
- );
357
- // Formatting in lists (-)
358
- MT.testMode(
359
- 'listDashFormatting',
360
- '- *foo* bar\n\n- **foo** bar\n\n- ***foo*** bar\n\n- `foo` bar',
361
- [
362
- 'string', '- ',
363
- 'string em', '*foo*',
364
- 'string', ' bar',
365
- 'string', '- ',
366
- 'string strong', '**foo**',
367
- 'string', ' bar',
368
- 'string', '- ',
369
- 'string strong', '**',
370
- 'string emstrong', '*foo**',
371
- 'string em', '*',
372
- 'string', ' bar',
373
- 'string', '- ',
374
- 'string comment', '`foo`',
375
- 'string', ' bar'
376
- ]
377
- );
378
- // Formatting in lists (1.)
379
- MT.testMode(
380
- 'listNumberFormatting',
381
- '1. *foo* bar\n\n2. **foo** bar\n\n3. ***foo*** bar\n\n4. `foo` bar',
382
- [
383
- 'string', '1. ',
384
- 'string em', '*foo*',
385
- 'string', ' bar',
386
- 'string', '2. ',
387
- 'string strong', '**foo**',
388
- 'string', ' bar',
389
- 'string', '3. ',
390
- 'string strong', '**',
391
- 'string emstrong', '*foo**',
392
- 'string em', '*',
393
- 'string', ' bar',
394
- 'string', '4. ',
395
- 'string comment', '`foo`',
396
- 'string', ' bar'
397
- ]
398
- );
399
-
400
- // Paragraph lists
401
- MT.testMode(
402
- 'listParagraph',
403
- '* foo\n\n* bar',
404
- [
405
- 'string', '* foo',
406
- 'string', '* bar'
407
- ]
408
- );
409
-
410
- // Multi-paragraph lists
411
- //
412
- // 4 spaces
413
- MT.testMode(
414
- 'listMultiParagraph',
415
- '* foo\n\n* bar\n\n hello',
416
- [
417
- 'string', '* foo',
418
- 'string', '* bar',
419
- null, ' ',
420
- 'string', 'hello'
421
- ]
422
- );
423
- // 4 spaces, extra blank lines (should still be list, per Dingus)
424
- MT.testMode(
425
- 'listMultiParagraphExtra',
426
- '* foo\n\n* bar\n\n\n hello',
427
- [
428
- 'string', '* foo',
429
- 'string', '* bar',
430
- null, ' ',
431
- 'string', 'hello'
432
- ]
433
- );
434
- // 4 spaces, plus 1 space (should still be list, per Dingus)
435
- MT.testMode(
436
- 'listMultiParagraphExtraSpace',
437
- '* foo\n\n* bar\n\n hello\n\n world',
438
- [
439
- 'string', '* foo',
440
- 'string', '* bar',
441
- null, ' ',
442
- 'string', 'hello',
443
- null, ' ',
444
- 'string', 'world'
445
- ]
446
- );
447
- // 1 tab
448
- MT.testMode(
449
- 'listTab',
450
- '* foo\n\n* bar\n\n\thello',
451
- [
452
- 'string', '* foo',
453
- 'string', '* bar',
454
- null, '\t',
455
- 'string', 'hello'
456
- ]
457
- );
458
- // No indent
459
- MT.testMode(
460
- 'listNoIndent',
461
- '* foo\n\n* bar\n\nhello',
462
- [
463
- 'string', '* foo',
464
- 'string', '* bar',
465
- null, 'hello'
466
- ]
467
- );
468
- // Blockquote
469
- MT.testMode(
470
- 'blockquote',
471
- '* foo\n\n* bar\n\n > hello',
472
- [
473
- 'string', '* foo',
474
- 'string', '* bar',
475
- null, ' ',
476
- 'string quote', '> hello'
477
- ]
478
- );
479
- // Code block
480
- MT.testMode(
481
- 'blockquoteCode',
482
- '* foo\n\n* bar\n\n > hello\n\n world',
483
- [
484
- 'string', '* foo',
485
- 'string', '* bar',
486
- null, ' ',
487
- 'comment', '> hello',
488
- null, ' ',
489
- 'string', 'world'
490
- ]
491
- );
492
- // Code block followed by text
493
- MT.testMode(
494
- 'blockquoteCodeText',
495
- '* foo\n\n bar\n\n hello\n\n world',
496
- [
497
- 'string', '* foo',
498
- null, ' ',
499
- 'string', 'bar',
500
- null, ' ',
501
- 'comment', 'hello',
502
- null, ' ',
503
- 'string', 'world'
504
- ]
505
- );
506
-
507
- // Nested list
508
- //
509
- // *
510
- MT.testMode(
511
- 'listAsteriskNested',
512
- '* foo\n\n * bar',
513
- [
514
- 'string', '* foo',
515
- null, ' ',
516
- 'string', '* bar'
517
- ]
518
- );
519
- // +
520
- MT.testMode(
521
- 'listPlusNested',
522
- '+ foo\n\n + bar',
523
- [
524
- 'string', '+ foo',
525
- null, ' ',
526
- 'string', '+ bar'
527
- ]
528
- );
529
- // -
530
- MT.testMode(
531
- 'listDashNested',
532
- '- foo\n\n - bar',
533
- [
534
- 'string', '- foo',
535
- null, ' ',
536
- 'string', '- bar'
537
- ]
538
- );
539
- // 1.
540
- MT.testMode(
541
- 'listNumberNested',
542
- '1. foo\n\n 2. bar',
543
- [
544
- 'string', '1. foo',
545
- null, ' ',
546
- 'string', '2. bar'
547
- ]
548
- );
549
- // Mixed
550
- MT.testMode(
551
- 'listMixed',
552
- '* foo\n\n + bar\n\n - hello\n\n 1. world',
553
- [
554
- 'string', '* foo',
555
- null, ' ',
556
- 'string', '+ bar',
557
- null, ' ',
558
- 'string', '- hello',
559
- null, ' ',
560
- 'string', '1. world'
561
- ]
562
- );
563
- // Blockquote
564
- MT.testMode(
565
- 'listBlockquote',
566
- '* foo\n\n + bar\n\n > hello',
567
- [
568
- 'string', '* foo',
569
- null, ' ',
570
- 'string', '+ bar',
571
- null, ' ',
572
- 'quote string', '> hello'
573
- ]
574
- );
575
- // Code
576
- MT.testMode(
577
- 'listCode',
578
- '* foo\n\n + bar\n\n hello',
579
- [
580
- 'string', '* foo',
581
- null, ' ',
582
- 'string', '+ bar',
583
- null, ' ',
584
- 'comment', 'hello'
585
- ]
586
- );
587
- // Code followed by text
588
- MT.testMode(
589
- 'listCodeText',
590
- '* foo\n\n bar\n\nhello',
591
- [
592
- 'string', '* foo',
593
- null, ' ',
594
- 'comment', 'bar',
595
- null, 'hello'
596
- ]
597
- );
598
-
599
- // Following tests directly from official Markdown documentation
600
- // http://daringfireball.net/projects/markdown/syntax#hr
601
- MT.testMode(
602
- 'hrSpace',
603
- '* * *',
604
- [
605
- 'hr', '* * *'
606
- ]
607
- );
608
-
609
- MT.testMode(
610
- 'hr',
611
- '***',
612
- [
613
- 'hr', '***'
614
- ]
615
- );
616
-
617
- MT.testMode(
618
- 'hrLong',
619
- '*****',
620
- [
621
- 'hr', '*****'
622
- ]
623
- );
624
-
625
- MT.testMode(
626
- 'hrSpaceDash',
627
- '- - -',
628
- [
629
- 'hr', '- - -'
630
- ]
631
- );
632
-
633
- MT.testMode(
634
- 'hrDashLong',
635
- '---------------------------------------',
636
- [
637
- 'hr', '---------------------------------------'
638
- ]
639
- );
640
-
641
- // Inline link with title
642
- MT.testMode(
643
- 'linkTitle',
644
- '[foo](http://example.com/ "bar") hello',
645
- [
646
- 'link', '[foo]',
647
- 'string', '(http://example.com/ "bar")',
648
- null, ' hello'
649
- ]
650
- );
651
-
652
- // Inline link without title
653
- MT.testMode(
654
- 'linkNoTitle',
655
- '[foo](http://example.com/) bar',
656
- [
657
- 'link', '[foo]',
658
- 'string', '(http://example.com/)',
659
- null, ' bar'
660
- ]
661
- );
662
-
663
- // Reference-style links
664
- MT.testMode(
665
- 'linkReference',
666
- '[foo][bar] hello',
667
- [
668
- 'link', '[foo]',
669
- 'string', '[bar]',
670
- null, ' hello'
671
- ]
672
- );
673
-
674
- // Reference-style links with optional space separator (per docuentation)
675
- // "You can optionally use a space to separate the sets of brackets"
676
- MT.testMode(
677
- 'linkReferenceSpace',
678
- '[foo] [bar] hello',
679
- [
680
- 'link', '[foo]',
681
- null, ' ',
682
- 'string', '[bar]',
683
- null, ' hello'
684
- ]
685
- );
686
- // Should only allow a single space ("...use *a* space...")
687
- MT.testMode(
688
- 'linkReferenceDoubleSpace',
689
- '[foo] [bar] hello',
690
- [
691
- null, '[foo] [bar] hello'
692
- ]
693
- );
694
-
695
- // Reference-style links with implicit link name
696
- MT.testMode(
697
- 'linkImplicit',
698
- '[foo][] hello',
699
- [
700
- 'link', '[foo]',
701
- 'string', '[]',
702
- null, ' hello'
703
- ]
704
- );
705
-
706
- // @todo It would be nice if, at some point, the document was actually
707
- // checked to see if the referenced link exists
708
-
709
- // Link label, for reference-style links (taken from documentation)
710
- //
711
- // No title
712
- MT.testMode(
713
- 'labelNoTitle',
714
- '[foo]: http://example.com/',
715
- [
716
- 'link', '[foo]:',
717
- null, ' ',
718
- 'string', 'http://example.com/'
719
- ]
720
- );
721
- // Space in ID and title
722
- MT.testMode(
723
- 'labelSpaceTitle',
724
- '[foo bar]: http://example.com/ "hello"',
725
- [
726
- 'link', '[foo bar]:',
727
- null, ' ',
728
- 'string', 'http://example.com/ "hello"'
729
- ]
730
- );
731
- // Double title
732
- MT.testMode(
733
- 'labelDoubleTitle',
734
- '[foo bar]: http://example.com/ "hello" "world"',
735
- [
736
- 'link', '[foo bar]:',
737
- null, ' ',
738
- 'string', 'http://example.com/ "hello"',
739
- null, ' "world"'
740
- ]
741
- );
742
- // Double quotes around title
743
- MT.testMode(
744
- 'labelTitleDoubleQuotes',
745
- '[foo]: http://example.com/ "bar"',
746
- [
747
- 'link', '[foo]:',
748
- null, ' ',
749
- 'string', 'http://example.com/ "bar"'
750
- ]
751
- );
752
- // Single quotes around title
753
- MT.testMode(
754
- 'labelTitleSingleQuotes',
755
- '[foo]: http://example.com/ \'bar\'',
756
- [
757
- 'link', '[foo]:',
758
- null, ' ',
759
- 'string', 'http://example.com/ \'bar\''
760
- ]
761
- );
762
- // Parentheses around title
763
- MT.testMode(
764
- 'labelTitleParenthese',
765
- '[foo]: http://example.com/ (bar)',
766
- [
767
- 'link', '[foo]:',
768
- null, ' ',
769
- 'string', 'http://example.com/ (bar)'
770
- ]
771
- );
772
- // Invalid title
773
- MT.testMode(
774
- 'labelTitleInvalid',
775
- '[foo]: http://example.com/ bar',
776
- [
777
- 'link', '[foo]:',
778
- null, ' ',
779
- 'string', 'http://example.com/',
780
- null, ' bar'
781
- ]
782
- );
783
- // Angle brackets around URL
784
- MT.testMode(
785
- 'labelLinkAngleBrackets',
786
- '[foo]: <http://example.com/> "bar"',
787
- [
788
- 'link', '[foo]:',
789
- null, ' ',
790
- 'string', '<http://example.com/> "bar"'
791
- ]
792
- );
793
- // Title on next line per documentation (double quotes)
794
- MT.testMode(
795
- 'labelTitleNextDoubleQuotes',
796
- '[foo]: http://example.com/\n"bar" hello',
797
- [
798
- 'link', '[foo]:',
799
- null, ' ',
800
- 'string', 'http://example.com/',
801
- 'string', '"bar"',
802
- null, ' hello'
803
- ]
804
- );
805
- // Title on next line per documentation (single quotes)
806
- MT.testMode(
807
- 'labelTitleNextSingleQuotes',
808
- '[foo]: http://example.com/\n\'bar\' hello',
809
- [
810
- 'link', '[foo]:',
811
- null, ' ',
812
- 'string', 'http://example.com/',
813
- 'string', '\'bar\'',
814
- null, ' hello'
815
- ]
816
- );
817
- // Title on next line per documentation (parentheses)
818
- MT.testMode(
819
- 'labelTitleNextParenthese',
820
- '[foo]: http://example.com/\n(bar) hello',
821
- [
822
- 'link', '[foo]:',
823
- null, ' ',
824
- 'string', 'http://example.com/',
825
- 'string', '(bar)',
826
- null, ' hello'
827
- ]
828
- );
829
- // Title on next line per documentation (mixed)
830
- MT.testMode(
831
- 'labelTitleNextMixed',
832
- '[foo]: http://example.com/\n(bar" hello',
833
- [
834
- 'link', '[foo]:',
835
- null, ' ',
836
- 'string', 'http://example.com/',
837
- null, '(bar" hello'
838
- ]
839
- );
840
-
841
- // Automatic links
842
- MT.testMode(
843
- 'linkWeb',
844
- '<http://example.com/> foo',
845
- [
846
- 'link', '<http://example.com/>',
847
- null, ' foo'
848
- ]
849
- );
850
-
851
- // Automatic email links
852
- MT.testMode(
853
- 'linkEmail',
854
- '<user@example.com> foo',
855
- [
856
- 'link', '<user@example.com>',
857
- null, ' foo'
858
- ]
859
- );
860
-
861
- // Single asterisk
862
- MT.testMode(
863
- 'emAsterisk',
864
- '*foo* bar',
865
- [
866
- 'em', '*foo*',
867
- null, ' bar'
868
- ]
869
- );
870
-
871
- // Single underscore
872
- MT.testMode(
873
- 'emUnderscore',
874
- '_foo_ bar',
875
- [
876
- 'em', '_foo_',
877
- null, ' bar'
878
- ]
879
- );
880
-
881
- // Emphasis characters within a word
882
- MT.testMode(
883
- 'emInWordAsterisk',
884
- 'foo*bar*hello',
885
- [
886
- null, 'foo',
887
- 'em', '*bar*',
888
- null, 'hello'
889
- ]
890
- );
891
- MT.testMode(
892
- 'emInWordUnderscore',
893
- 'foo_bar_hello',
894
- [
895
- null, 'foo',
896
- 'em', '_bar_',
897
- null, 'hello'
898
- ]
899
- );
900
- // Per documentation: "...surround an * or _ with spaces, it’ll be
901
- // treated as a literal asterisk or underscore."
902
- //
903
- // Inside EM
904
- MT.testMode(
905
- 'emEscapedBySpaceIn',
906
- 'foo _bar _ hello_ world',
907
- [
908
- null, 'foo ',
909
- 'em', '_bar _ hello_',
910
- null, ' world'
911
- ]
912
- );
913
- // Outside EM
914
- MT.testMode(
915
- 'emEscapedBySpaceOut',
916
- 'foo _ bar_hello_world',
917
- [
918
- null, 'foo _ bar',
919
- 'em', '_hello_',
920
- null, 'world'
921
- ]
922
- );
923
-
924
- // Unclosed emphasis characters
925
- // Instead of simply marking as EM / STRONG, it would be nice to have an
926
- // incomplete flag for EM and STRONG, that is styled slightly different.
927
- MT.testMode(
928
- 'emIncompleteAsterisk',
929
- 'foo *bar',
930
- [
931
- null, 'foo ',
932
- 'em', '*bar'
933
- ]
934
- );
935
- MT.testMode(
936
- 'emIncompleteUnderscore',
937
- 'foo _bar',
938
- [
939
- null, 'foo ',
940
- 'em', '_bar'
941
- ]
942
- );
943
-
944
- // Double asterisk
945
- MT.testMode(
946
- 'strongAsterisk',
947
- '**foo** bar',
948
- [
949
- 'strong', '**foo**',
950
- null, ' bar'
951
- ]
952
- );
953
-
954
- // Double underscore
955
- MT.testMode(
956
- 'strongUnderscore',
957
- '__foo__ bar',
958
- [
959
- 'strong', '__foo__',
960
- null, ' bar'
961
- ]
962
- );
963
-
964
- // Triple asterisk
965
- MT.testMode(
966
- 'emStrongAsterisk',
967
- '*foo**bar*hello** world',
968
- [
969
- 'em', '*foo',
970
- 'emstrong', '**bar*',
971
- 'strong', 'hello**',
972
- null, ' world'
973
- ]
974
- );
975
-
976
- // Triple underscore
977
- MT.testMode(
978
- 'emStrongUnderscore',
979
- '_foo__bar_hello__ world',
980
- [
981
- 'em', '_foo',
982
- 'emstrong', '__bar_',
983
- 'strong', 'hello__',
984
- null, ' world'
985
- ]
986
- );
987
-
988
- // Triple mixed
989
- // "...same character must be used to open and close an emphasis span.""
990
- MT.testMode(
991
- 'emStrongMixed',
992
- '_foo**bar*hello__ world',
993
- [
994
- 'em', '_foo',
995
- 'emstrong', '**bar*hello__ world'
996
- ]
997
- );
998
-
999
- MT.testMode(
1000
- 'emStrongMixed',
1001
- '*foo__bar_hello** world',
1002
- [
1003
- 'em', '*foo',
1004
- 'emstrong', '__bar_hello** world'
1005
- ]
1006
- );
1007
-
1008
- // These characters should be escaped:
1009
- // \ backslash
1010
- // ` backtick
1011
- // * asterisk
1012
- // _ underscore
1013
- // {} curly braces
1014
- // [] square brackets
1015
- // () parentheses
1016
- // # hash mark
1017
- // + plus sign
1018
- // - minus sign (hyphen)
1019
- // . dot
1020
- // ! exclamation mark
1021
- //
1022
- // Backtick (code)
1023
- MT.testMode(
1024
- 'escapeBacktick',
1025
- 'foo \\`bar\\`',
1026
- [
1027
- null, 'foo \\`bar\\`'
1028
- ]
1029
- );
1030
- MT.testMode(
1031
- 'doubleEscapeBacktick',
1032
- 'foo \\\\`bar\\\\`',
1033
- [
1034
- null, 'foo \\\\',
1035
- 'comment', '`bar\\\\`'
1036
- ]
1037
- );
1038
- // Asterisk (em)
1039
- MT.testMode(
1040
- 'escapeAsterisk',
1041
- 'foo \\*bar\\*',
1042
- [
1043
- null, 'foo \\*bar\\*'
1044
- ]
1045
- );
1046
- MT.testMode(
1047
- 'doubleEscapeAsterisk',
1048
- 'foo \\\\*bar\\\\*',
1049
- [
1050
- null, 'foo \\\\',
1051
- 'em', '*bar\\\\*'
1052
- ]
1053
- );
1054
- // Underscore (em)
1055
- MT.testMode(
1056
- 'escapeUnderscore',
1057
- 'foo \\_bar\\_',
1058
- [
1059
- null, 'foo \\_bar\\_'
1060
- ]
1061
- );
1062
- MT.testMode(
1063
- 'doubleEscapeUnderscore',
1064
- 'foo \\\\_bar\\\\_',
1065
- [
1066
- null, 'foo \\\\',
1067
- 'em', '_bar\\\\_'
1068
- ]
1069
- );
1070
- // Hash mark (headers)
1071
- MT.testMode(
1072
- 'escapeHash',
1073
- '\\# foo',
1074
- [
1075
- null, '\\# foo'
1076
- ]
1077
- );
1078
- MT.testMode(
1079
- 'doubleEscapeHash',
1080
- '\\\\# foo',
1081
- [
1082
- null, '\\\\# foo'
1083
- ]
1084
- );