erp_app 3.0.10 → 3.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. data/lib/erp_app/version.rb +1 -1
  2. data/public/javascripts/erp_app/codemirror/README.md +1 -1
  3. data/public/javascripts/erp_app/codemirror/doc/compress.html +11 -3
  4. data/public/javascripts/erp_app/codemirror/doc/docs.css +16 -5
  5. data/public/javascripts/erp_app/codemirror/doc/internals.html +6 -3
  6. data/public/javascripts/erp_app/codemirror/doc/manual.html +103 -41
  7. data/public/javascripts/erp_app/codemirror/doc/oldrelease.html +43 -5
  8. data/public/javascripts/erp_app/codemirror/doc/reporting.html +6 -3
  9. data/public/javascripts/erp_app/codemirror/doc/upgrade_v2.2.html +7 -4
  10. data/public/javascripts/erp_app/codemirror/keymap/vim.js +10 -6
  11. data/public/javascripts/erp_app/codemirror/lib/codemirror.css +16 -12
  12. data/public/javascripts/erp_app/codemirror/lib/codemirror.js +699 -787
  13. data/public/javascripts/erp_app/codemirror/lib/util/closetag.js +35 -35
  14. data/public/javascripts/erp_app/codemirror/lib/util/dialog.js +4 -1
  15. data/public/javascripts/erp_app/codemirror/lib/util/formatting.js +147 -253
  16. data/public/javascripts/erp_app/codemirror/lib/util/javascript-hint.js +3 -3
  17. data/public/javascripts/erp_app/codemirror/lib/util/loadmode.js +1 -1
  18. data/public/javascripts/erp_app/codemirror/lib/util/multiplex.js +5 -9
  19. data/public/javascripts/erp_app/codemirror/lib/util/overlay.js +3 -1
  20. data/public/javascripts/erp_app/codemirror/lib/util/pig-hint.js +1 -1
  21. data/public/javascripts/erp_app/codemirror/lib/util/runmode-standalone.js +90 -0
  22. data/public/javascripts/erp_app/codemirror/lib/util/runmode.js +8 -4
  23. data/public/javascripts/erp_app/codemirror/lib/util/search.js +4 -4
  24. data/public/javascripts/erp_app/codemirror/lib/util/searchcursor.js +13 -11
  25. data/public/javascripts/erp_app/codemirror/lib/util/simple-hint.js +89 -68
  26. data/public/javascripts/erp_app/codemirror/lib/util/xml-hint.js +8 -8
  27. data/public/javascripts/erp_app/codemirror/mode/clike/clike.js +6 -2
  28. data/public/javascripts/erp_app/codemirror/mode/clike/index.html +1 -0
  29. data/public/javascripts/erp_app/codemirror/mode/clike/scala.html +1 -0
  30. data/public/javascripts/erp_app/codemirror/mode/clojure/clojure.js +8 -9
  31. data/public/javascripts/erp_app/codemirror/mode/clojure/index.html +1 -0
  32. data/public/javascripts/erp_app/codemirror/mode/coffeescript/coffeescript.js +3 -3
  33. data/public/javascripts/erp_app/codemirror/mode/coffeescript/index.html +1 -0
  34. data/public/javascripts/erp_app/codemirror/mode/commonlisp/commonlisp.js +101 -0
  35. data/public/javascripts/erp_app/codemirror/mode/commonlisp/index.html +165 -0
  36. data/public/javascripts/erp_app/codemirror/mode/css/css.js +339 -15
  37. data/public/javascripts/erp_app/codemirror/mode/css/index.html +3 -0
  38. data/public/javascripts/erp_app/codemirror/mode/css/test.js +501 -0
  39. data/public/javascripts/erp_app/codemirror/mode/diff/index.html +1 -0
  40. data/public/javascripts/erp_app/codemirror/mode/ecl/ecl.js +1 -1
  41. data/public/javascripts/erp_app/codemirror/mode/erlang/index.html +1 -0
  42. data/public/javascripts/erp_app/codemirror/mode/gfm/gfm.js +10 -4
  43. data/public/javascripts/erp_app/codemirror/mode/gfm/index.html +1 -0
  44. data/public/javascripts/erp_app/codemirror/mode/go/go.js +2 -2
  45. data/public/javascripts/erp_app/codemirror/mode/go/index.html +1 -0
  46. data/public/javascripts/erp_app/codemirror/mode/groovy/groovy.js +1 -1
  47. data/public/javascripts/erp_app/codemirror/mode/groovy/index.html +1 -0
  48. data/public/javascripts/erp_app/codemirror/mode/haskell/haskell.js +2 -2
  49. data/public/javascripts/erp_app/codemirror/mode/haskell/index.html +1 -0
  50. data/public/javascripts/erp_app/codemirror/mode/haxe/haxe.js +4 -7
  51. data/public/javascripts/erp_app/codemirror/mode/haxe/index.html +1 -0
  52. data/public/javascripts/erp_app/codemirror/mode/htmlembedded/htmlembedded.js +8 -4
  53. data/public/javascripts/erp_app/codemirror/mode/htmlembedded/index.html +1 -0
  54. data/public/javascripts/erp_app/codemirror/mode/htmlmixed/htmlmixed.js +12 -13
  55. data/public/javascripts/erp_app/codemirror/mode/htmlmixed/index.html +1 -0
  56. data/public/javascripts/erp_app/codemirror/mode/javascript/index.html +1 -0
  57. data/public/javascripts/erp_app/codemirror/mode/javascript/javascript.js +3 -3
  58. data/public/javascripts/erp_app/codemirror/mode/jinja2/index.html +1 -0
  59. data/public/javascripts/erp_app/codemirror/mode/less/index.html +124 -2
  60. data/public/javascripts/erp_app/codemirror/mode/less/less.js +94 -60
  61. data/public/javascripts/erp_app/codemirror/mode/lua/index.html +1 -0
  62. data/public/javascripts/erp_app/codemirror/mode/markdown/index.html +3 -0
  63. data/public/javascripts/erp_app/codemirror/mode/markdown/markdown.js +134 -20
  64. data/public/javascripts/erp_app/codemirror/mode/markdown/test.js +1084 -0
  65. data/public/javascripts/erp_app/codemirror/mode/mysql/index.html +1 -0
  66. data/public/javascripts/erp_app/codemirror/mode/ntriples/index.html +1 -0
  67. data/public/javascripts/erp_app/codemirror/mode/ntriples/ntriples.js +4 -4
  68. data/public/javascripts/erp_app/codemirror/mode/ocaml/ocaml.js +1 -1
  69. data/public/javascripts/erp_app/codemirror/mode/pascal/index.html +1 -0
  70. data/public/javascripts/erp_app/codemirror/mode/pascal/pascal.js +1 -1
  71. data/public/javascripts/erp_app/codemirror/mode/perl/index.html +1 -0
  72. data/public/javascripts/erp_app/codemirror/mode/perl/perl.js +71 -71
  73. data/public/javascripts/erp_app/codemirror/mode/php/index.html +1 -0
  74. data/public/javascripts/erp_app/codemirror/mode/php/php.js +7 -9
  75. data/public/javascripts/erp_app/codemirror/mode/pig/index.html +1 -0
  76. data/public/javascripts/erp_app/codemirror/mode/pig/pig.js +3 -3
  77. data/public/javascripts/erp_app/codemirror/mode/plsql/index.html +1 -0
  78. data/public/javascripts/erp_app/codemirror/mode/properties/index.html +1 -0
  79. data/public/javascripts/erp_app/codemirror/mode/python/index.html +1 -0
  80. data/public/javascripts/erp_app/codemirror/mode/python/python.js +1 -1
  81. data/public/javascripts/erp_app/codemirror/mode/r/index.html +1 -0
  82. data/public/javascripts/erp_app/codemirror/mode/rpm/changes/index.html +1 -0
  83. data/public/javascripts/erp_app/codemirror/mode/rpm/spec/index.html +1 -0
  84. data/public/javascripts/erp_app/codemirror/mode/rst/index.html +1 -0
  85. data/public/javascripts/erp_app/codemirror/mode/ruby/index.html +1 -0
  86. data/public/javascripts/erp_app/codemirror/mode/rust/index.html +1 -0
  87. data/public/javascripts/erp_app/codemirror/mode/scheme/index.html +1 -0
  88. data/public/javascripts/erp_app/codemirror/mode/scheme/scheme.js +1 -1
  89. data/public/javascripts/erp_app/codemirror/mode/shell/shell.js +2 -2
  90. data/public/javascripts/erp_app/codemirror/mode/sieve/LICENSE +23 -0
  91. data/public/javascripts/erp_app/codemirror/mode/sieve/index.html +81 -0
  92. data/public/javascripts/erp_app/codemirror/mode/sieve/sieve.js +156 -0
  93. data/public/javascripts/erp_app/codemirror/mode/smalltalk/index.html +1 -0
  94. data/public/javascripts/erp_app/codemirror/mode/smalltalk/smalltalk.js +2 -2
  95. data/public/javascripts/erp_app/codemirror/mode/smarty/index.html +1 -0
  96. data/public/javascripts/erp_app/codemirror/mode/smarty/smarty.js +2 -2
  97. data/public/javascripts/erp_app/codemirror/mode/sparql/index.html +1 -0
  98. data/public/javascripts/erp_app/codemirror/mode/stex/index.html +3 -0
  99. data/public/javascripts/erp_app/codemirror/mode/stex/stex.js +1 -1
  100. data/public/javascripts/erp_app/codemirror/mode/stex/test.js +343 -0
  101. data/public/javascripts/erp_app/codemirror/mode/tiddlywiki/index.html +1 -0
  102. data/public/javascripts/erp_app/codemirror/mode/tiki/index.html +1 -0
  103. data/public/javascripts/erp_app/codemirror/mode/tiki/tiki.js +4 -11
  104. data/public/javascripts/erp_app/codemirror/mode/vb/index.html +1 -0
  105. data/public/javascripts/erp_app/codemirror/mode/vb/vb.js +2 -2
  106. data/public/javascripts/erp_app/codemirror/mode/vbscript/index.html +1 -0
  107. data/public/javascripts/erp_app/codemirror/mode/velocity/index.html +1 -0
  108. data/public/javascripts/erp_app/codemirror/mode/velocity/velocity.js +1 -1
  109. data/public/javascripts/erp_app/codemirror/mode/verilog/index.html +1 -0
  110. data/public/javascripts/erp_app/codemirror/mode/verilog/verilog.js +1 -1
  111. data/public/javascripts/erp_app/codemirror/mode/xml/index.html +2 -1
  112. data/public/javascripts/erp_app/codemirror/mode/xml/xml.js +2 -10
  113. data/public/javascripts/erp_app/codemirror/mode/xquery/index.html +3 -2
  114. data/public/javascripts/erp_app/codemirror/mode/xquery/xquery.js +7 -4
  115. data/public/javascripts/erp_app/codemirror/mode/yaml/index.html +1 -0
  116. data/public/javascripts/erp_app/codemirror/package.json +15 -23
  117. data/public/javascripts/erp_app/codemirror/test/driver.js +109 -22
  118. data/public/javascripts/erp_app/codemirror/test/index.html +129 -16
  119. data/public/javascripts/erp_app/codemirror/test/lint/lint.js +120 -0
  120. data/public/javascripts/erp_app/codemirror/test/lint/parse-js.js +1372 -0
  121. data/public/javascripts/erp_app/codemirror/test/mode_test.css +0 -12
  122. data/public/javascripts/erp_app/codemirror/test/mode_test.js +66 -27
  123. data/public/javascripts/erp_app/codemirror/test/phantom_driver.js +30 -0
  124. data/public/javascripts/erp_app/codemirror/test/run.js +32 -0
  125. data/public/javascripts/erp_app/codemirror/test/test.js +213 -8
  126. data/public/javascripts/erp_app/shared/dynamic_editable_grid.js +33 -27
  127. data/public/javascripts/erp_app/shared/dynamic_editable_grid_loader_panel.js +2 -1
  128. metadata +15 -3
  129. data/public/javascripts/erp_app/codemirror/mode/stex/test.html +0 -263
@@ -0,0 +1,1084 @@
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
+ );