kramdown-prismic 0.2.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,54 +1,84 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Kramdown
2
4
  module Parser
3
5
  class Prismic < Base
4
6
  def parse
5
7
  @root.options[:encoding] = 'UTF-8'
6
- @root.children = @source.map do |block|
7
- type = block[:type]
8
- if type.match(/heading/)
9
- type = 'heading'
10
- end
11
- element = send("parse_#{type}", block)
12
- parse_spans(element, block)
13
- element
8
+ @root.children = @source.reduce([]) do |memo, block|
9
+ parse_element(block, memo)
14
10
  end
15
11
  end
16
12
 
17
13
  private
18
14
 
15
+ def parse_element(block, memo)
16
+ type = block[:type].gsub('-', '_')
17
+ type = 'heading' if type.match(/heading/)
18
+ if type == 'list_item'
19
+ parse_list(:ul, block, memo)
20
+ memo
21
+ elsif type == 'o_list_item'
22
+ parse_list(:ol, block, memo)
23
+ memo
24
+ else
25
+ element = send("parse_#{type}", block)
26
+ parse_spans(element, block)
27
+ memo << element
28
+ end
29
+ end
30
+
19
31
  def parse_heading(block)
20
32
  level = block[:type].match(/heading([1-6])/)[1].to_i
21
- Kramdown::Element.new(:header, nil, nil, {level: level, raw_text: ''})
33
+ Element.new(:header, nil, nil, { level: level, raw_text: '' })
22
34
  end
23
35
 
24
- def parse_paragraph(block)
25
- Kramdown::Element.new(:p)
36
+ def parse_paragraph(_block)
37
+ Element.new(:p)
26
38
  end
27
39
 
28
40
  def parse_image(block)
29
- p = Kramdown::Element.new(:p)
30
- img = Kramdown::Element.new(:img, nil, {"src" => block[:data][:origin][:url], "alt" => block[:data][:alt]})
31
- p.children << img
41
+ p = Element.new(:p)
42
+ img = Element.new(:img, nil, { 'src' => block[:data][:origin][:url], 'alt' => block[:data][:alt] })
43
+ if block[:data][:linkTo]
44
+ a = Element.new(:a, nil, { 'href' => block[:data][:linkTo][:url] })
45
+ a.children << img
46
+ p.children << a
47
+ else
48
+ p.children << img
49
+ end
32
50
  p
33
51
  end
34
52
 
35
- def parse_preformatted(block)
36
- Kramdown::Element.new(:blockquote)
53
+ def parse_preformatted(_block)
54
+ Element.new(:blockquote)
55
+ end
56
+
57
+ def parse_list(type, block, memo)
58
+ list = memo.last
59
+ unless list && list.type == type
60
+ list = Element.new(type)
61
+ memo << list
62
+ end
63
+ li = Element.new(:li, nil, nil)
64
+ list.children << li
65
+ p = Element.new(:p, nil, nil, transparent: true)
66
+ li.children << p
67
+ parse_spans(p, block)
37
68
  end
38
69
 
39
70
  def parse_embed(block)
40
- Kramdown::Element.new(:html_element, 'iframe', { src: block[:data][:embed_url] })
71
+ Element.new(:html_element, 'iframe', { src: block[:data][:embed_url] })
41
72
  end
42
73
 
43
74
  def parse_spans(element, block)
44
75
  stack = []
45
76
 
46
77
  (block[:content][:text].size + 1).times do |index|
47
-
48
78
  starting_spans = find_starting_spans_for(block, index)
49
79
  ending_spans = find_ending_spans_for(block, index)
50
80
 
51
- ending_spans.each do |ending_span|
81
+ ending_spans.each do |_ending_span|
52
82
  el = stack.pop
53
83
  if stack.empty?
54
84
  element.children << el
@@ -57,22 +87,23 @@ module Kramdown
57
87
  end
58
88
  end
59
89
  starting_spans.each do |starting_span|
60
- stack << if starting_span[:type] == "hyperlink"
61
- Element.new(:a, nil, {'href' => starting_span[:data][:url]})
62
- else
63
- Element.new(starting_span[:type].to_sym)
64
- end
90
+ stack << if starting_span[:type] == 'hyperlink'
91
+ Element.new(:a, nil, { 'href' => starting_span[:data][:url] })
92
+ else
93
+ Element.new(starting_span[:type].to_sym)
94
+ end
65
95
  end
66
96
 
67
97
  char = block[:content][:text][index]
68
98
  next if char.nil?
99
+
69
100
  current_text = if stack.empty?
70
- element.children.last
71
- else
72
- stack[-1].children.last
73
- end
101
+ element.children.last
102
+ else
103
+ stack[-1].children.last
104
+ end
74
105
  if current_text.nil? || current_text.type != :text
75
- current_text = Element.new(:text, "")
106
+ current_text = Element.new(:text, '')
76
107
  if stack.empty?
77
108
  element.children << current_text
78
109
  else
@@ -1,4 +1,5 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  require 'minitest/autorun'
3
4
  require 'kramdown-prismic'
4
5
 
@@ -9,12 +10,12 @@ class KramdownPrismicConverterTest < Minitest::Test
9
10
  {
10
11
  type: "heading#{heading + 1}",
11
12
  content: {
12
- text: "This is the document title",
13
+ text: 'This is the document title',
13
14
  spans: []
14
15
  }
15
16
  }
16
17
  ]
17
- markdown = "#{"#" * (heading + 1)} This is the document title"
18
+ markdown = "#{'#' * (heading + 1)} This is the document title"
18
19
  assert_equal expected, Kramdown::Document.new(markdown, input: :kramdown).to_prismic
19
20
  end
20
21
  end
@@ -22,26 +23,26 @@ class KramdownPrismicConverterTest < Minitest::Test
22
23
  def test_convert_heading7
23
24
  expected = [
24
25
  {
25
- type: "heading6",
26
+ type: 'heading6',
26
27
  content: {
27
- text: "# This is the document title",
28
+ text: '# This is the document title',
28
29
  spans: []
29
30
  }
30
31
  }
31
32
  ]
32
- markdown = "####### This is the document title"
33
+ markdown = '####### This is the document title'
33
34
  assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
34
35
  end
35
36
 
36
37
  def test_convert_heading_with_spans
37
38
  expected = [
38
39
  {
39
- type: "heading2",
40
+ type: 'heading2',
40
41
  content: {
41
- text: "This is a document title",
42
+ text: 'This is a document title',
42
43
  spans: [
43
44
  {
44
- type: "em",
45
+ type: 'em',
45
46
  start: 0,
46
47
  end: 4
47
48
  }
@@ -49,56 +50,56 @@ class KramdownPrismicConverterTest < Minitest::Test
49
50
  }
50
51
  }
51
52
  ]
52
- markdown = "## *This* is a document title"
53
+ markdown = '## *This* is a document title'
53
54
  assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
54
55
  end
55
56
 
56
57
  def test_convert_paragraph
57
58
  expected = [
58
59
  {
59
- type: "paragraph",
60
+ type: 'paragraph',
60
61
  content: {
61
- text: "This is a paragraph",
62
+ text: 'This is a paragraph',
62
63
  spans: []
63
64
  }
64
65
  }
65
66
  ]
66
- markdown = "This is a paragraph"
67
+ markdown = 'This is a paragraph'
67
68
  assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
68
69
  end
69
70
 
70
71
  def test_convert_paragraph_with_spans
71
72
  expected = [
72
73
  {
73
- type: "paragraph",
74
+ type: 'paragraph',
74
75
  content: {
75
- text: "This is a paragraph",
76
+ text: 'This is a paragraph',
76
77
  spans: [
77
78
  {
78
- type: "hyperlink",
79
+ type: 'hyperlink',
79
80
  start: 0,
80
81
  end: 19,
81
82
  data: {
82
- url: "https://prismic.io"
83
+ url: 'https://prismic.io'
83
84
  }
84
85
  }
85
86
  ]
86
87
  }
87
88
  }
88
89
  ]
89
- markdown = "[This is a paragraph](https://prismic.io)"
90
+ markdown = '[This is a paragraph](https://prismic.io)'
90
91
  assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
91
92
  end
92
93
 
93
94
  def test_convert_paragraph_with_strong
94
95
  expected = [
95
96
  {
96
- type: "paragraph",
97
+ type: 'paragraph',
97
98
  content: {
98
- text: "This is a paragraph",
99
+ text: 'This is a paragraph',
99
100
  spans: [
100
101
  {
101
- type: "strong",
102
+ type: 'strong',
102
103
  start: 0,
103
104
  end: 19
104
105
  }
@@ -106,19 +107,19 @@ class KramdownPrismicConverterTest < Minitest::Test
106
107
  }
107
108
  }
108
109
  ]
109
- markdown = "**This is a paragraph**"
110
+ markdown = '**This is a paragraph**'
110
111
  assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
111
112
  end
112
113
 
113
114
  def test_convert_paragraph_with_strong2
114
115
  expected = [
115
116
  {
116
- type: "paragraph",
117
+ type: 'paragraph',
117
118
  content: {
118
- text: "This is a paragraph",
119
+ text: 'This is a paragraph',
119
120
  spans: [
120
121
  {
121
- type: "strong",
122
+ type: 'strong',
122
123
  start: 0,
123
124
  end: 4
124
125
  }
@@ -126,19 +127,19 @@ class KramdownPrismicConverterTest < Minitest::Test
126
127
  }
127
128
  }
128
129
  ]
129
- markdown = "**This** is a paragraph"
130
+ markdown = '**This** is a paragraph'
130
131
  assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
131
132
  end
132
133
 
133
134
  def test_convert_paragraph_with_em
134
135
  expected = [
135
136
  {
136
- type: "paragraph",
137
+ type: 'paragraph',
137
138
  content: {
138
- text: "This is a paragraph",
139
+ text: 'This is a paragraph',
139
140
  spans: [
140
141
  {
141
- type: "em",
142
+ type: 'em',
142
143
  start: 0,
143
144
  end: 4
144
145
  }
@@ -146,19 +147,19 @@ class KramdownPrismicConverterTest < Minitest::Test
146
147
  }
147
148
  }
148
149
  ]
149
- markdown = "*This* is a paragraph"
150
+ markdown = '*This* is a paragraph'
150
151
  assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
151
152
  end
152
153
 
153
154
  def test_convert_list_o
154
155
  expected = [
155
156
  {
156
- type: "o-list-item",
157
+ type: 'o-list-item',
157
158
  content: {
158
- text: "This is a list item",
159
+ text: 'This is a list item',
159
160
  spans: [
160
161
  {
161
- type: "em",
162
+ type: 'em',
162
163
  start: 0,
163
164
  end: 4
164
165
  }
@@ -166,9 +167,9 @@ class KramdownPrismicConverterTest < Minitest::Test
166
167
  }
167
168
  },
168
169
  {
169
- type: "o-list-item",
170
+ type: 'o-list-item',
170
171
  content: {
171
- text: "This is a second list item",
172
+ text: 'This is a second list item',
172
173
  spans: []
173
174
  }
174
175
  }
@@ -180,12 +181,12 @@ class KramdownPrismicConverterTest < Minitest::Test
180
181
  def test_convert_list_u
181
182
  expected = [
182
183
  {
183
- type: "list-item",
184
+ type: 'list-item',
184
185
  content: {
185
- text: "This is a list item",
186
+ text: 'This is a list item',
186
187
  spans: [
187
188
  {
188
- type: "em",
189
+ type: 'em',
189
190
  start: 0,
190
191
  end: 4
191
192
  }
@@ -193,9 +194,9 @@ class KramdownPrismicConverterTest < Minitest::Test
193
194
  }
194
195
  },
195
196
  {
196
- type: "list-item",
197
+ type: 'list-item',
197
198
  content: {
198
- text: "This is a second list item",
199
+ text: 'This is a second list item',
199
200
  spans: []
200
201
  }
201
202
  }
@@ -207,16 +208,16 @@ class KramdownPrismicConverterTest < Minitest::Test
207
208
  def test_convert_nested_ul
208
209
  expected = [
209
210
  {
210
- type: "list-item",
211
+ type: 'list-item',
211
212
  content: {
212
213
  text: "item1\n",
213
214
  spans: []
214
215
  }
215
216
  },
216
217
  {
217
- type: "list-item",
218
+ type: 'list-item',
218
219
  content: {
219
- text: "item2",
220
+ text: 'item2',
220
221
  spans: []
221
222
  }
222
223
  }
@@ -230,23 +231,23 @@ class KramdownPrismicConverterTest < Minitest::Test
230
231
  def test_convert_nested_nested_ul
231
232
  expected = [
232
233
  {
233
- type: "list-item",
234
+ type: 'list-item',
234
235
  content: {
235
236
  text: "item1\n",
236
237
  spans: []
237
238
  }
238
239
  },
239
240
  {
240
- type: "list-item",
241
+ type: 'list-item',
241
242
  content: {
242
243
  text: "item2\n",
243
244
  spans: []
244
245
  }
245
246
  },
246
247
  {
247
- type: "list-item",
248
+ type: 'list-item',
248
249
  content: {
249
- text: "item3",
250
+ text: 'item3',
250
251
  spans: []
251
252
  }
252
253
  }
@@ -260,7 +261,7 @@ class KramdownPrismicConverterTest < Minitest::Test
260
261
  def test_convert_preformatted
261
262
  expected = [
262
263
  {
263
- type: "preformatted",
264
+ type: 'preformatted',
264
265
  content: {
265
266
  text: "This is a pre block\n",
266
267
  spans: []
@@ -274,9 +275,9 @@ class KramdownPrismicConverterTest < Minitest::Test
274
275
  def test_convert_blockquote
275
276
  expected = [
276
277
  {
277
- type: "preformatted",
278
+ type: 'preformatted',
278
279
  content: {
279
- text: "This is a blockquote",
280
+ text: 'This is a blockquote',
280
281
  spans: []
281
282
  }
282
283
  }
@@ -287,17 +288,18 @@ class KramdownPrismicConverterTest < Minitest::Test
287
288
 
288
289
  def test_convert_empty
289
290
  expected = []
290
- markdown = ""
291
+ markdown = ''
291
292
  assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
292
293
  end
293
294
 
294
295
  def test_convert_span_blank
295
296
  expected = [
296
- {type: "o-list-item",
297
- content: {
298
- text: "Testtest",
299
- spans: []
300
- }
297
+ {
298
+ type: 'o-list-item',
299
+ content: {
300
+ text: 'Testtest',
301
+ spans: []
302
+ }
301
303
  }
302
304
  ]
303
305
  markdown = "\n1. Test\n\n test\n"
@@ -306,16 +308,16 @@ class KramdownPrismicConverterTest < Minitest::Test
306
308
 
307
309
  def test_convert_hr
308
310
  expected = []
309
- markdown = "---"
311
+ markdown = '---'
310
312
  assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
311
313
  end
312
314
 
313
315
  def test_convert_img
314
316
  expected = [
315
317
  {
316
- type: "image",
318
+ type: 'image',
317
319
  content: {
318
- text: "",
320
+ text: '',
319
321
  spans: []
320
322
  },
321
323
  data: {
@@ -326,7 +328,7 @@ class KramdownPrismicConverterTest < Minitest::Test
326
328
  }
327
329
  }
328
330
  ]
329
- markdown = "![alt text](/img.png)"
331
+ markdown = '![alt text](/img.png)'
330
332
  doc = Kramdown::Document.new(markdown)
331
333
  assert_equal expected, doc.to_prismic
332
334
  assert_equal 0, doc.warnings.size
@@ -335,9 +337,9 @@ class KramdownPrismicConverterTest < Minitest::Test
335
337
  def test_convert_double_img
336
338
  expected = [
337
339
  {
338
- type: "image",
340
+ type: 'image',
339
341
  content: {
340
- text: "",
342
+ text: '',
341
343
  spans: []
342
344
  },
343
345
  data: {
@@ -348,9 +350,9 @@ class KramdownPrismicConverterTest < Minitest::Test
348
350
  }
349
351
  },
350
352
  {
351
- type: "image",
353
+ type: 'image',
352
354
  content: {
353
- text: "",
355
+ text: '',
354
356
  spans: []
355
357
  },
356
358
  data: {
@@ -361,38 +363,62 @@ class KramdownPrismicConverterTest < Minitest::Test
361
363
  }
362
364
  }
363
365
  ]
364
- markdown = "![](/img.png)![](/img2.png)"
366
+ markdown = '![](/img.png)![](/img2.png)'
365
367
  doc = Kramdown::Document.new(markdown)
366
368
  assert_equal expected, doc.to_prismic
367
369
  assert_equal 2, doc.warnings.size
368
370
  end
369
371
 
372
+ def test_convert_img_with_link
373
+ expected = [
374
+ {
375
+ type: 'image',
376
+ content: {
377
+ text: '',
378
+ spans: []
379
+ },
380
+ data: {
381
+ origin: {
382
+ url: '/img.png'
383
+ },
384
+ alt: 'alt text',
385
+ linkTo: {
386
+ url: 'https://example.net/'
387
+ }
388
+ }
389
+ }
390
+ ]
391
+ markdown = '[![alt text](/img.png)](https://example.net/)'
392
+ doc = Kramdown::Document.new(markdown)
393
+ assert_equal expected, doc.to_prismic
394
+ assert_equal 0, doc.warnings.size
395
+ end
396
+
370
397
  def test_convert_entity
371
398
  expected = [
372
399
  {
373
- type: "paragraph",
400
+ type: 'paragraph',
374
401
  content: {
375
402
  text: "\u00a0",
376
403
  spans: []
377
404
  }
378
405
  }
379
406
  ]
380
- markdown = "&nbsp;"
407
+ markdown = '&nbsp;'
381
408
  assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
382
409
  end
383
410
 
384
- [['mdash' , ' ---', ' —'],
385
- ['ndash' , ' --', ' –'],
386
- ['hellip' , ' ...', ' …'],
387
- ['laquo' , ' <<', ' «'],
388
- ['raquo' , '>>', '»'],
389
- ['laquo_space' , ' << T', ' « T'],
390
- ['raquo_space' , ' >>', ' »']
391
- ].each do |symbol|
411
+ [['mdash', ' ---', ' —'],
412
+ ['ndash', ' --', ' –'],
413
+ ['hellip', ' ...', ' …'],
414
+ ['laquo', ' <<', ' «'],
415
+ ['raquo', '>>', '»'],
416
+ ['laquo_space', ' << T', ' « T'],
417
+ ['raquo_space', ' >>', ' »']].each do |symbol|
392
418
  define_method "test_convert_typographic_symbols_#{symbol[0]}" do
393
419
  expected = [
394
420
  {
395
- type: "paragraph",
421
+ type: 'paragraph',
396
422
  content: {
397
423
  text: "Hello#{symbol[2]}",
398
424
  spans: []
@@ -406,11 +432,12 @@ class KramdownPrismicConverterTest < Minitest::Test
406
432
 
407
433
  def test_convert_smart_quote
408
434
  expected = [
409
- {type: "paragraph",
410
- content: {
411
- text: "Test\u2019",
412
- spans: []
413
- }
435
+ {
436
+ type: 'paragraph',
437
+ content: {
438
+ text: "Test\u2019",
439
+ spans: []
440
+ }
414
441
  }
415
442
  ]
416
443
  markdown = "Test'"
@@ -420,14 +447,14 @@ class KramdownPrismicConverterTest < Minitest::Test
420
447
  def test_convert_inline_code
421
448
  expected = [
422
449
  {
423
- type: "paragraph",
450
+ type: 'paragraph',
424
451
  content: {
425
- text: "Hello code",
452
+ text: 'Hello code',
426
453
  spans: []
427
454
  }
428
455
  }
429
456
  ]
430
- markdown = "Hello `code`"
457
+ markdown = 'Hello `code`'
431
458
  doc = Kramdown::Document.new(markdown)
432
459
  assert_equal expected, doc.to_prismic
433
460
  assert_equal 1, doc.warnings.size
@@ -435,20 +462,54 @@ class KramdownPrismicConverterTest < Minitest::Test
435
462
 
436
463
  def test_convert_br
437
464
  expected = [
438
- {type: "paragraph",
439
- content: {
440
- text: "Test\n",
441
- spans: []
442
- }
465
+ {
466
+ type: 'paragraph',
467
+ content: {
468
+ text: "Test\n",
469
+ spans: []
470
+ }
471
+ }
472
+ ]
473
+ html = '<p>Test<br></p>'
474
+ assert_equal expected, Kramdown::Document.new(html, input: :html).to_prismic
475
+ end
476
+
477
+ def test_convert_html_with_no_tags
478
+ expected = [
479
+ {
480
+ type: 'paragraph',
481
+ content: {
482
+ text: "Test\n",
483
+ spans: []
484
+ }
443
485
  }
444
486
  ]
445
- html = "<p>Test<br></p>"
487
+ html = 'Test'
446
488
  assert_equal expected, Kramdown::Document.new(html, input: :html).to_prismic
447
489
  end
448
490
 
491
+ def test_convert_iframe
492
+ expected = [
493
+ {
494
+ type: 'embed',
495
+ content: {
496
+ text: '',
497
+ spans: []
498
+ },
499
+ data: {
500
+ embed_url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
501
+ type: 'link'
502
+ }
503
+ }
504
+ ]
505
+ html = '<iframe src="https://www.youtube.com/watch?v=dQw4w9WgXcQ"></iframe>'
506
+ doc = Kramdown::Document.new(html, input: :markdown)
507
+ assert_equal expected, doc.to_prismic
508
+ end
509
+
449
510
  def test_convert_html
450
511
  expected = []
451
- html = "<div></div>"
512
+ html = '<div></div>'
452
513
  doc = Kramdown::Document.new(html, input: :markdown)
453
514
  assert_equal expected, doc.to_prismic
454
515
  assert_equal 1, doc.warnings.size
@@ -457,14 +518,14 @@ class KramdownPrismicConverterTest < Minitest::Test
457
518
  def test_convert_span_html
458
519
  expected = [
459
520
  {
460
- type: "paragraph",
521
+ type: 'paragraph',
461
522
  content: {
462
- text: "",
523
+ text: '',
463
524
  spans: []
464
525
  }
465
526
  }
466
527
  ]
467
- html = "<br>"
528
+ html = '<br>'
468
529
  doc = Kramdown::Document.new(html, input: :markdown)
469
530
  assert_equal expected, doc.to_prismic
470
531
  assert_equal 1, doc.warnings.size
@@ -472,7 +533,7 @@ class KramdownPrismicConverterTest < Minitest::Test
472
533
 
473
534
  def test_convert_table
474
535
  expected = []
475
- markdown = "| First cell|Second cell|Third cell|"
536
+ markdown = '| First cell|Second cell|Third cell|'
476
537
  doc = Kramdown::Document.new(markdown, input: :kramdown)
477
538
  assert_equal expected, doc.to_prismic
478
539
  assert_equal 1, doc.warnings.size
@@ -488,7 +549,7 @@ class KramdownPrismicConverterTest < Minitest::Test
488
549
 
489
550
  def test_convert_math
490
551
  expected = []
491
- markdown = "$$ 5 + 5 $$"
552
+ markdown = '$$ 5 + 5 $$'
492
553
  doc = Kramdown::Document.new(markdown, input: :kramdown)
493
554
  assert_equal expected, doc.to_prismic
494
555
  assert_equal 1, doc.warnings.size
@@ -497,12 +558,13 @@ class KramdownPrismicConverterTest < Minitest::Test
497
558
  def test_convert_footnote
498
559
  expected = [
499
560
  {
500
- type: "paragraph",
561
+ type: 'paragraph',
501
562
  content: {
502
- text: "test",
563
+ text: 'test',
503
564
  spans: []
504
565
  }
505
- }]
566
+ }
567
+ ]
506
568
  markdown = "test[^1]\n\n[^1]: test"
507
569
  doc = Kramdown::Document.new(markdown, input: :kramdown)
508
570
  assert_equal expected, doc.to_prismic
@@ -512,12 +574,13 @@ class KramdownPrismicConverterTest < Minitest::Test
512
574
  def test_convert_abbreviation
513
575
  expected = [
514
576
  {
515
- type: "paragraph",
577
+ type: 'paragraph',
516
578
  content: {
517
- text: "HTML",
579
+ text: 'HTML',
518
580
  spans: []
519
581
  }
520
- }]
582
+ }
583
+ ]
521
584
  markdown = "HTML\n\n*[HTML]: test"
522
585
  doc = Kramdown::Document.new(markdown, input: :kramdown)
523
586
  assert_equal expected, doc.to_prismic
@@ -532,22 +595,6 @@ class KramdownPrismicConverterTest < Minitest::Test
532
595
  assert_equal 1, doc.warnings.size
533
596
  end
534
597
 
535
- def test_convert_xml_comment
536
- expected = []
537
- markdown = "<!-- a *comment* -->"
538
- doc = Kramdown::Document.new(markdown, input: :kramdown)
539
- assert_equal expected, doc.to_prismic
540
- assert_equal 1, doc.warnings.size
541
- end
542
-
543
- def test_convert_xml_pi
544
- expected = []
545
- markdown = "<? a processing `instruction`?>"
546
- doc = Kramdown::Document.new(markdown, input: :kramdown)
547
- assert_equal expected, doc.to_prismic
548
- assert_equal 1, doc.warnings.size
549
- end
550
-
551
598
  def test_convert_raw
552
599
  expected = []
553
600
  markdown = "{::nomarkdown}\nComment\n{:/nomarkdown}"