kramdown-prismic 0.3.0 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{Changelog.md → CHANGELOG.md} +18 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +1 -1
- data/README.md +20 -3
- data/Rakefile +3 -2
- data/bin/html2prismic +6 -0
- data/bin/markdown2prismic +6 -0
- data/bin/prismic2markdown +8 -0
- data/kramdown-prismic.gemspec +12 -8
- data/kramdown1.gemfile +2 -0
- data/kramdown2.gemfile +2 -0
- data/lib/kramdown/converter/prismic.rb +89 -38
- data/lib/kramdown/parser/prismic.rb +60 -29
- data/lib/kramdown-prismic/version.rb +3 -1
- data/lib/kramdown-prismic.rb +2 -0
- data/test/converter_test.rb +208 -105
- data/test/parser_test.rb +173 -52
- metadata +10 -5
- data/.travis.yml +0 -6
data/lib/kramdown-prismic.rb
CHANGED
data/test/converter_test.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'minitest/autorun'
|
3
5
|
require 'kramdown-prismic'
|
4
6
|
|
@@ -9,12 +11,12 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
9
11
|
{
|
10
12
|
type: "heading#{heading + 1}",
|
11
13
|
content: {
|
12
|
-
text:
|
14
|
+
text: 'This is the document title',
|
13
15
|
spans: []
|
14
16
|
}
|
15
17
|
}
|
16
18
|
]
|
17
|
-
markdown = "#{
|
19
|
+
markdown = "#{'#' * (heading + 1)} This is the document title"
|
18
20
|
assert_equal expected, Kramdown::Document.new(markdown, input: :kramdown).to_prismic
|
19
21
|
end
|
20
22
|
end
|
@@ -22,26 +24,26 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
22
24
|
def test_convert_heading7
|
23
25
|
expected = [
|
24
26
|
{
|
25
|
-
type:
|
27
|
+
type: 'heading6',
|
26
28
|
content: {
|
27
|
-
text:
|
29
|
+
text: '# This is the document title',
|
28
30
|
spans: []
|
29
31
|
}
|
30
32
|
}
|
31
33
|
]
|
32
|
-
markdown =
|
34
|
+
markdown = '####### This is the document title'
|
33
35
|
assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
|
34
36
|
end
|
35
37
|
|
36
38
|
def test_convert_heading_with_spans
|
37
39
|
expected = [
|
38
40
|
{
|
39
|
-
type:
|
41
|
+
type: 'heading2',
|
40
42
|
content: {
|
41
|
-
text:
|
43
|
+
text: 'This is a document title',
|
42
44
|
spans: [
|
43
45
|
{
|
44
|
-
type:
|
46
|
+
type: 'em',
|
45
47
|
start: 0,
|
46
48
|
end: 4
|
47
49
|
}
|
@@ -49,56 +51,56 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
49
51
|
}
|
50
52
|
}
|
51
53
|
]
|
52
|
-
markdown =
|
54
|
+
markdown = '## *This* is a document title'
|
53
55
|
assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
|
54
56
|
end
|
55
57
|
|
56
58
|
def test_convert_paragraph
|
57
59
|
expected = [
|
58
60
|
{
|
59
|
-
type:
|
61
|
+
type: 'paragraph',
|
60
62
|
content: {
|
61
|
-
text:
|
63
|
+
text: 'This is a paragraph',
|
62
64
|
spans: []
|
63
65
|
}
|
64
66
|
}
|
65
67
|
]
|
66
|
-
markdown =
|
68
|
+
markdown = 'This is a paragraph'
|
67
69
|
assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
|
68
70
|
end
|
69
71
|
|
70
72
|
def test_convert_paragraph_with_spans
|
71
73
|
expected = [
|
72
74
|
{
|
73
|
-
type:
|
75
|
+
type: 'paragraph',
|
74
76
|
content: {
|
75
|
-
text:
|
77
|
+
text: 'This is a paragraph',
|
76
78
|
spans: [
|
77
79
|
{
|
78
|
-
type:
|
80
|
+
type: 'hyperlink',
|
79
81
|
start: 0,
|
80
82
|
end: 19,
|
81
83
|
data: {
|
82
|
-
url:
|
84
|
+
url: 'https://prismic.io'
|
83
85
|
}
|
84
86
|
}
|
85
87
|
]
|
86
88
|
}
|
87
89
|
}
|
88
90
|
]
|
89
|
-
markdown =
|
91
|
+
markdown = '[This is a paragraph](https://prismic.io)'
|
90
92
|
assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
|
91
93
|
end
|
92
94
|
|
93
95
|
def test_convert_paragraph_with_strong
|
94
96
|
expected = [
|
95
97
|
{
|
96
|
-
type:
|
98
|
+
type: 'paragraph',
|
97
99
|
content: {
|
98
|
-
text:
|
100
|
+
text: 'This is a paragraph',
|
99
101
|
spans: [
|
100
102
|
{
|
101
|
-
type:
|
103
|
+
type: 'strong',
|
102
104
|
start: 0,
|
103
105
|
end: 19
|
104
106
|
}
|
@@ -106,19 +108,19 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
106
108
|
}
|
107
109
|
}
|
108
110
|
]
|
109
|
-
markdown =
|
111
|
+
markdown = '**This is a paragraph**'
|
110
112
|
assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
|
111
113
|
end
|
112
114
|
|
113
115
|
def test_convert_paragraph_with_strong2
|
114
116
|
expected = [
|
115
117
|
{
|
116
|
-
type:
|
118
|
+
type: 'paragraph',
|
117
119
|
content: {
|
118
|
-
text:
|
120
|
+
text: 'This is a paragraph',
|
119
121
|
spans: [
|
120
122
|
{
|
121
|
-
type:
|
123
|
+
type: 'strong',
|
122
124
|
start: 0,
|
123
125
|
end: 4
|
124
126
|
}
|
@@ -126,19 +128,39 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
126
128
|
}
|
127
129
|
}
|
128
130
|
]
|
129
|
-
markdown =
|
131
|
+
markdown = '**This** is a paragraph'
|
130
132
|
assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
|
131
133
|
end
|
132
134
|
|
135
|
+
def test_convert_html_strong
|
136
|
+
expected = [
|
137
|
+
{
|
138
|
+
type: 'paragraph',
|
139
|
+
content: {
|
140
|
+
text: 'This is a paragraph',
|
141
|
+
spans: [
|
142
|
+
{
|
143
|
+
type: 'strong',
|
144
|
+
start: 0,
|
145
|
+
end: 19
|
146
|
+
}
|
147
|
+
]
|
148
|
+
}
|
149
|
+
}
|
150
|
+
]
|
151
|
+
markdown = '<strong>This is a paragraph</strong>'
|
152
|
+
assert_equal expected, Kramdown::Document.new(markdown, input: :html).to_prismic
|
153
|
+
end
|
154
|
+
|
133
155
|
def test_convert_paragraph_with_em
|
134
156
|
expected = [
|
135
157
|
{
|
136
|
-
type:
|
158
|
+
type: 'paragraph',
|
137
159
|
content: {
|
138
|
-
text:
|
160
|
+
text: 'This is a paragraph',
|
139
161
|
spans: [
|
140
162
|
{
|
141
|
-
type:
|
163
|
+
type: 'em',
|
142
164
|
start: 0,
|
143
165
|
end: 4
|
144
166
|
}
|
@@ -146,19 +168,39 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
146
168
|
}
|
147
169
|
}
|
148
170
|
]
|
149
|
-
markdown =
|
171
|
+
markdown = '*This* is a paragraph'
|
150
172
|
assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
|
151
173
|
end
|
152
174
|
|
175
|
+
def test_convert_html_em
|
176
|
+
expected = [
|
177
|
+
{
|
178
|
+
type: 'paragraph',
|
179
|
+
content: {
|
180
|
+
text: 'This',
|
181
|
+
spans: [
|
182
|
+
{
|
183
|
+
type: 'em',
|
184
|
+
start: 0,
|
185
|
+
end: 4
|
186
|
+
}
|
187
|
+
]
|
188
|
+
}
|
189
|
+
}
|
190
|
+
]
|
191
|
+
markdown = '<em>This</em>'
|
192
|
+
assert_equal expected, Kramdown::Document.new(markdown, input: :html).to_prismic
|
193
|
+
end
|
194
|
+
|
153
195
|
def test_convert_list_o
|
154
196
|
expected = [
|
155
197
|
{
|
156
|
-
type:
|
198
|
+
type: 'o-list-item',
|
157
199
|
content: {
|
158
|
-
text:
|
200
|
+
text: 'This is a list item',
|
159
201
|
spans: [
|
160
202
|
{
|
161
|
-
type:
|
203
|
+
type: 'em',
|
162
204
|
start: 0,
|
163
205
|
end: 4
|
164
206
|
}
|
@@ -166,9 +208,9 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
166
208
|
}
|
167
209
|
},
|
168
210
|
{
|
169
|
-
type:
|
211
|
+
type: 'o-list-item',
|
170
212
|
content: {
|
171
|
-
text:
|
213
|
+
text: 'This is a second list item',
|
172
214
|
spans: []
|
173
215
|
}
|
174
216
|
}
|
@@ -180,12 +222,12 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
180
222
|
def test_convert_list_u
|
181
223
|
expected = [
|
182
224
|
{
|
183
|
-
type:
|
225
|
+
type: 'list-item',
|
184
226
|
content: {
|
185
|
-
text:
|
227
|
+
text: 'This is a list item',
|
186
228
|
spans: [
|
187
229
|
{
|
188
|
-
type:
|
230
|
+
type: 'em',
|
189
231
|
start: 0,
|
190
232
|
end: 4
|
191
233
|
}
|
@@ -193,9 +235,9 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
193
235
|
}
|
194
236
|
},
|
195
237
|
{
|
196
|
-
type:
|
238
|
+
type: 'list-item',
|
197
239
|
content: {
|
198
|
-
text:
|
240
|
+
text: 'This is a second list item',
|
199
241
|
spans: []
|
200
242
|
}
|
201
243
|
}
|
@@ -207,16 +249,16 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
207
249
|
def test_convert_nested_ul
|
208
250
|
expected = [
|
209
251
|
{
|
210
|
-
type:
|
252
|
+
type: 'list-item',
|
211
253
|
content: {
|
212
254
|
text: "item1\n",
|
213
255
|
spans: []
|
214
256
|
}
|
215
257
|
},
|
216
258
|
{
|
217
|
-
type:
|
259
|
+
type: 'list-item',
|
218
260
|
content: {
|
219
|
-
text:
|
261
|
+
text: 'item2',
|
220
262
|
spans: []
|
221
263
|
}
|
222
264
|
}
|
@@ -230,23 +272,23 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
230
272
|
def test_convert_nested_nested_ul
|
231
273
|
expected = [
|
232
274
|
{
|
233
|
-
type:
|
275
|
+
type: 'list-item',
|
234
276
|
content: {
|
235
277
|
text: "item1\n",
|
236
278
|
spans: []
|
237
279
|
}
|
238
280
|
},
|
239
281
|
{
|
240
|
-
type:
|
282
|
+
type: 'list-item',
|
241
283
|
content: {
|
242
284
|
text: "item2\n",
|
243
285
|
spans: []
|
244
286
|
}
|
245
287
|
},
|
246
288
|
{
|
247
|
-
type:
|
289
|
+
type: 'list-item',
|
248
290
|
content: {
|
249
|
-
text:
|
291
|
+
text: 'item3',
|
250
292
|
spans: []
|
251
293
|
}
|
252
294
|
}
|
@@ -260,7 +302,7 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
260
302
|
def test_convert_preformatted
|
261
303
|
expected = [
|
262
304
|
{
|
263
|
-
type:
|
305
|
+
type: 'preformatted',
|
264
306
|
content: {
|
265
307
|
text: "This is a pre block\n",
|
266
308
|
spans: []
|
@@ -274,9 +316,9 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
274
316
|
def test_convert_blockquote
|
275
317
|
expected = [
|
276
318
|
{
|
277
|
-
type:
|
319
|
+
type: 'preformatted',
|
278
320
|
content: {
|
279
|
-
text:
|
321
|
+
text: 'This is a blockquote',
|
280
322
|
spans: []
|
281
323
|
}
|
282
324
|
}
|
@@ -287,17 +329,18 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
287
329
|
|
288
330
|
def test_convert_empty
|
289
331
|
expected = []
|
290
|
-
markdown =
|
332
|
+
markdown = ''
|
291
333
|
assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
|
292
334
|
end
|
293
335
|
|
294
336
|
def test_convert_span_blank
|
295
337
|
expected = [
|
296
|
-
{
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
338
|
+
{
|
339
|
+
type: 'o-list-item',
|
340
|
+
content: {
|
341
|
+
text: 'Testtest',
|
342
|
+
spans: []
|
343
|
+
}
|
301
344
|
}
|
302
345
|
]
|
303
346
|
markdown = "\n1. Test\n\n test\n"
|
@@ -306,16 +349,16 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
306
349
|
|
307
350
|
def test_convert_hr
|
308
351
|
expected = []
|
309
|
-
markdown =
|
352
|
+
markdown = '---'
|
310
353
|
assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
|
311
354
|
end
|
312
355
|
|
313
356
|
def test_convert_img
|
314
357
|
expected = [
|
315
358
|
{
|
316
|
-
type:
|
359
|
+
type: 'image',
|
317
360
|
content: {
|
318
|
-
text:
|
361
|
+
text: '',
|
319
362
|
spans: []
|
320
363
|
},
|
321
364
|
data: {
|
@@ -326,7 +369,7 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
326
369
|
}
|
327
370
|
}
|
328
371
|
]
|
329
|
-
markdown =
|
372
|
+
markdown = '![alt text](/img.png)'
|
330
373
|
doc = Kramdown::Document.new(markdown)
|
331
374
|
assert_equal expected, doc.to_prismic
|
332
375
|
assert_equal 0, doc.warnings.size
|
@@ -335,9 +378,9 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
335
378
|
def test_convert_double_img
|
336
379
|
expected = [
|
337
380
|
{
|
338
|
-
type:
|
381
|
+
type: 'image',
|
339
382
|
content: {
|
340
|
-
text:
|
383
|
+
text: '',
|
341
384
|
spans: []
|
342
385
|
},
|
343
386
|
data: {
|
@@ -348,9 +391,9 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
348
391
|
}
|
349
392
|
},
|
350
393
|
{
|
351
|
-
type:
|
394
|
+
type: 'image',
|
352
395
|
content: {
|
353
|
-
text:
|
396
|
+
text: '',
|
354
397
|
spans: []
|
355
398
|
},
|
356
399
|
data: {
|
@@ -361,7 +404,7 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
361
404
|
}
|
362
405
|
}
|
363
406
|
]
|
364
|
-
markdown =
|
407
|
+
markdown = '![](/img.png)![](/img2.png)'
|
365
408
|
doc = Kramdown::Document.new(markdown)
|
366
409
|
assert_equal expected, doc.to_prismic
|
367
410
|
assert_equal 2, doc.warnings.size
|
@@ -370,9 +413,9 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
370
413
|
def test_convert_img_with_link
|
371
414
|
expected = [
|
372
415
|
{
|
373
|
-
type:
|
416
|
+
type: 'image',
|
374
417
|
content: {
|
375
|
-
text:
|
418
|
+
text: '',
|
376
419
|
spans: []
|
377
420
|
},
|
378
421
|
data: {
|
@@ -381,12 +424,12 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
381
424
|
},
|
382
425
|
alt: 'alt text',
|
383
426
|
linkTo: {
|
384
|
-
url:
|
427
|
+
url: 'https://example.net/'
|
385
428
|
}
|
386
429
|
}
|
387
430
|
}
|
388
431
|
]
|
389
|
-
markdown =
|
432
|
+
markdown = '[![alt text](/img.png)](https://example.net/)'
|
390
433
|
doc = Kramdown::Document.new(markdown)
|
391
434
|
assert_equal expected, doc.to_prismic
|
392
435
|
assert_equal 0, doc.warnings.size
|
@@ -395,29 +438,28 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
395
438
|
def test_convert_entity
|
396
439
|
expected = [
|
397
440
|
{
|
398
|
-
type:
|
441
|
+
type: 'paragraph',
|
399
442
|
content: {
|
400
443
|
text: "\u00a0",
|
401
444
|
spans: []
|
402
445
|
}
|
403
446
|
}
|
404
447
|
]
|
405
|
-
markdown =
|
448
|
+
markdown = ' '
|
406
449
|
assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
|
407
450
|
end
|
408
451
|
|
409
|
-
[['mdash'
|
410
|
-
['ndash'
|
411
|
-
['hellip'
|
412
|
-
['laquo'
|
413
|
-
['raquo'
|
414
|
-
['laquo_space'
|
415
|
-
['raquo_space'
|
416
|
-
].each do |symbol|
|
452
|
+
[['mdash', ' ---', ' —'],
|
453
|
+
['ndash', ' --', ' –'],
|
454
|
+
['hellip', ' ...', ' …'],
|
455
|
+
['laquo', ' <<', ' «'],
|
456
|
+
['raquo', '>>', '»'],
|
457
|
+
['laquo_space', ' << T', ' « T'],
|
458
|
+
['raquo_space', ' >>', ' »']].each do |symbol|
|
417
459
|
define_method "test_convert_typographic_symbols_#{symbol[0]}" do
|
418
460
|
expected = [
|
419
461
|
{
|
420
|
-
type:
|
462
|
+
type: 'paragraph',
|
421
463
|
content: {
|
422
464
|
text: "Hello#{symbol[2]}",
|
423
465
|
spans: []
|
@@ -431,11 +473,12 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
431
473
|
|
432
474
|
def test_convert_smart_quote
|
433
475
|
expected = [
|
434
|
-
{
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
476
|
+
{
|
477
|
+
type: 'paragraph',
|
478
|
+
content: {
|
479
|
+
text: "Test\u2019",
|
480
|
+
spans: []
|
481
|
+
}
|
439
482
|
}
|
440
483
|
]
|
441
484
|
markdown = "Test'"
|
@@ -445,14 +488,14 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
445
488
|
def test_convert_inline_code
|
446
489
|
expected = [
|
447
490
|
{
|
448
|
-
type:
|
491
|
+
type: 'paragraph',
|
449
492
|
content: {
|
450
|
-
text:
|
493
|
+
text: 'Hello code',
|
451
494
|
spans: []
|
452
495
|
}
|
453
496
|
}
|
454
497
|
]
|
455
|
-
markdown =
|
498
|
+
markdown = 'Hello `code`'
|
456
499
|
doc = Kramdown::Document.new(markdown)
|
457
500
|
assert_equal expected, doc.to_prismic
|
458
501
|
assert_equal 1, doc.warnings.size
|
@@ -460,20 +503,54 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
460
503
|
|
461
504
|
def test_convert_br
|
462
505
|
expected = [
|
463
|
-
{
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
506
|
+
{
|
507
|
+
type: 'paragraph',
|
508
|
+
content: {
|
509
|
+
text: "Test\n",
|
510
|
+
spans: []
|
511
|
+
}
|
512
|
+
}
|
513
|
+
]
|
514
|
+
html = '<p>Test<br></p>'
|
515
|
+
assert_equal expected, Kramdown::Document.new(html, input: :html).to_prismic
|
516
|
+
end
|
517
|
+
|
518
|
+
def test_convert_html_with_no_tags
|
519
|
+
expected = [
|
520
|
+
{
|
521
|
+
type: 'paragraph',
|
522
|
+
content: {
|
523
|
+
text: "Test\n",
|
524
|
+
spans: []
|
525
|
+
}
|
468
526
|
}
|
469
527
|
]
|
470
|
-
html =
|
528
|
+
html = 'Test'
|
471
529
|
assert_equal expected, Kramdown::Document.new(html, input: :html).to_prismic
|
472
530
|
end
|
473
531
|
|
532
|
+
def test_convert_iframe
|
533
|
+
expected = [
|
534
|
+
{
|
535
|
+
type: 'embed',
|
536
|
+
content: {
|
537
|
+
text: '',
|
538
|
+
spans: []
|
539
|
+
},
|
540
|
+
data: {
|
541
|
+
embed_url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
|
542
|
+
type: 'link'
|
543
|
+
}
|
544
|
+
}
|
545
|
+
]
|
546
|
+
html = '<iframe src="https://www.youtube.com/watch?v=dQw4w9WgXcQ"></iframe>'
|
547
|
+
doc = Kramdown::Document.new(html, input: :markdown)
|
548
|
+
assert_equal expected, doc.to_prismic
|
549
|
+
end
|
550
|
+
|
474
551
|
def test_convert_html
|
475
552
|
expected = []
|
476
|
-
html =
|
553
|
+
html = '<div></div>'
|
477
554
|
doc = Kramdown::Document.new(html, input: :markdown)
|
478
555
|
assert_equal expected, doc.to_prismic
|
479
556
|
assert_equal 1, doc.warnings.size
|
@@ -482,14 +559,14 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
482
559
|
def test_convert_span_html
|
483
560
|
expected = [
|
484
561
|
{
|
485
|
-
type:
|
562
|
+
type: 'paragraph',
|
486
563
|
content: {
|
487
|
-
text:
|
564
|
+
text: '',
|
488
565
|
spans: []
|
489
566
|
}
|
490
567
|
}
|
491
568
|
]
|
492
|
-
html =
|
569
|
+
html = '<br>'
|
493
570
|
doc = Kramdown::Document.new(html, input: :markdown)
|
494
571
|
assert_equal expected, doc.to_prismic
|
495
572
|
assert_equal 1, doc.warnings.size
|
@@ -497,7 +574,7 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
497
574
|
|
498
575
|
def test_convert_table
|
499
576
|
expected = []
|
500
|
-
markdown =
|
577
|
+
markdown = '| First cell|Second cell|Third cell|'
|
501
578
|
doc = Kramdown::Document.new(markdown, input: :kramdown)
|
502
579
|
assert_equal expected, doc.to_prismic
|
503
580
|
assert_equal 1, doc.warnings.size
|
@@ -513,7 +590,7 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
513
590
|
|
514
591
|
def test_convert_math
|
515
592
|
expected = []
|
516
|
-
markdown =
|
593
|
+
markdown = '$$ 5 + 5 $$'
|
517
594
|
doc = Kramdown::Document.new(markdown, input: :kramdown)
|
518
595
|
assert_equal expected, doc.to_prismic
|
519
596
|
assert_equal 1, doc.warnings.size
|
@@ -522,12 +599,13 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
522
599
|
def test_convert_footnote
|
523
600
|
expected = [
|
524
601
|
{
|
525
|
-
type:
|
602
|
+
type: 'paragraph',
|
526
603
|
content: {
|
527
|
-
text:
|
604
|
+
text: 'test',
|
528
605
|
spans: []
|
529
606
|
}
|
530
|
-
}
|
607
|
+
}
|
608
|
+
]
|
531
609
|
markdown = "test[^1]\n\n[^1]: test"
|
532
610
|
doc = Kramdown::Document.new(markdown, input: :kramdown)
|
533
611
|
assert_equal expected, doc.to_prismic
|
@@ -537,18 +615,43 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
537
615
|
def test_convert_abbreviation
|
538
616
|
expected = [
|
539
617
|
{
|
540
|
-
type:
|
618
|
+
type: 'paragraph',
|
541
619
|
content: {
|
542
|
-
text:
|
620
|
+
text: 'HTML',
|
543
621
|
spans: []
|
544
622
|
}
|
545
|
-
}
|
623
|
+
}
|
624
|
+
]
|
546
625
|
markdown = "HTML\n\n*[HTML]: test"
|
547
626
|
doc = Kramdown::Document.new(markdown, input: :kramdown)
|
548
627
|
assert_equal expected, doc.to_prismic
|
549
628
|
assert_equal 1, doc.warnings.size
|
550
629
|
end
|
551
630
|
|
631
|
+
def test_convert_xml_comment
|
632
|
+
expected = []
|
633
|
+
markdown = "<!-- Main -->"
|
634
|
+
doc = Kramdown::Document.new(markdown, input: :kramdown)
|
635
|
+
assert_equal expected, doc.to_prismic
|
636
|
+
assert_equal 1, doc.warnings.size
|
637
|
+
end
|
638
|
+
|
639
|
+
def test_convert_span_xml_comment
|
640
|
+
expected = [
|
641
|
+
{
|
642
|
+
type: 'paragraph',
|
643
|
+
content: {
|
644
|
+
text: 'test test',
|
645
|
+
spans: []
|
646
|
+
}
|
647
|
+
}
|
648
|
+
]
|
649
|
+
markdown = "test <!-- Main --> test"
|
650
|
+
doc = Kramdown::Document.new(markdown, input: :kramdown)
|
651
|
+
assert_equal expected, doc.to_prismic
|
652
|
+
assert_equal 1, doc.warnings.size
|
653
|
+
end
|
654
|
+
|
552
655
|
def test_convert_comment
|
553
656
|
expected = []
|
554
657
|
markdown = "{::comment}\nComment\n{:/comment}"
|