kramdown-prismic 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -2
- data/lib/kramdown/converter/prismic.rb +6 -2
- data/lib/kramdown-prismic/version.rb +1 -1
- data/test/converter_test.rb +48 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7a99099eccb44fd82519a9894193733e143af6fbe445a88db2f805cb44fd58d
|
4
|
+
data.tar.gz: 68f3628a12418f3b49db676257266100c54a8a5962e88c5a5dd38bae7ac33ec5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c98ec156b50ac771e18415a770068c2a84911d34fe2b2fe083c7eab4a3f0e311d0aad0a71ed625e4a4d85da49fb6f9cb612f317a2a87814dbca93505cb2a977
|
7
|
+
data.tar.gz: 65f6a3250e46ec0e6d256fa42cebd6feb5036ca4564ee5d3ff172bf911a7b520119451fec8bde608108f57d79850b3a7a7619adc29a4119b61553ba91d59d08a
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -282,8 +282,12 @@ module Kramdown
|
|
282
282
|
memo[:text] += element.value
|
283
283
|
end
|
284
284
|
|
285
|
-
def extract_span_html_element(
|
286
|
-
|
285
|
+
def extract_span_html_element(element, memo)
|
286
|
+
if respond_to?("extract_span_#{element.value}", true)
|
287
|
+
send("extract_span_#{element.value}", element, memo)
|
288
|
+
else
|
289
|
+
warning("translating html element '#{element.value}' is not supported")
|
290
|
+
end
|
287
291
|
end
|
288
292
|
|
289
293
|
def extract_span_footnote(_element, _memo)
|
data/test/converter_test.rb
CHANGED
@@ -322,7 +322,7 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
322
322
|
assert_equal 2, doc.warnings.size
|
323
323
|
end
|
324
324
|
|
325
|
-
|
325
|
+
def test_convert_heading_in_list
|
326
326
|
expected = [
|
327
327
|
{
|
328
328
|
type: 'list-item',
|
@@ -576,11 +576,16 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
576
576
|
end
|
577
577
|
|
578
578
|
def test_convert_html_with_no_tags
|
579
|
+
expected_text = if Gem::Version.new(Kramdown::VERSION) >= Gem::Version.new("2.3.2")
|
580
|
+
"Test "
|
581
|
+
else
|
582
|
+
"Test\n"
|
583
|
+
end
|
579
584
|
expected = [
|
580
585
|
{
|
581
586
|
type: 'paragraph',
|
582
587
|
content: {
|
583
|
-
text:
|
588
|
+
text: expected_text,
|
584
589
|
spans: []
|
585
590
|
}
|
586
591
|
}
|
@@ -616,12 +621,34 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
616
621
|
assert_equal 1, doc.warnings.size
|
617
622
|
end
|
618
623
|
|
619
|
-
def
|
624
|
+
def test_convert_span_html_strong
|
620
625
|
expected = [
|
621
626
|
{
|
622
627
|
type: 'paragraph',
|
623
628
|
content: {
|
624
|
-
text: '',
|
629
|
+
text: 'This is a paragraph',
|
630
|
+
spans: [
|
631
|
+
{
|
632
|
+
type: 'strong',
|
633
|
+
start: 10,
|
634
|
+
end: 20
|
635
|
+
}
|
636
|
+
]
|
637
|
+
}
|
638
|
+
}
|
639
|
+
]
|
640
|
+
html = '<p>This is a <strong> paragraph</strong></p>'
|
641
|
+
doc = Kramdown::Document.new(html, input: :html)
|
642
|
+
assert_equal expected, doc.to_prismic
|
643
|
+
assert_equal 0, doc.warnings.size
|
644
|
+
end
|
645
|
+
|
646
|
+
def test_convert_span_html_br
|
647
|
+
expected = [
|
648
|
+
{
|
649
|
+
type: 'paragraph',
|
650
|
+
content: {
|
651
|
+
text: "\n",
|
625
652
|
spans: []
|
626
653
|
}
|
627
654
|
}
|
@@ -629,7 +656,24 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
629
656
|
html = '<br>'
|
630
657
|
doc = Kramdown::Document.new(html, input: :markdown)
|
631
658
|
assert_equal expected, doc.to_prismic
|
659
|
+
assert_equal 0, doc.warnings.size
|
660
|
+
end
|
661
|
+
|
662
|
+
def test_convert_span_html_unknown
|
663
|
+
expected = [
|
664
|
+
{
|
665
|
+
type: 'paragraph',
|
666
|
+
content: {
|
667
|
+
text: 'This is a ',
|
668
|
+
spans: []
|
669
|
+
}
|
670
|
+
}
|
671
|
+
]
|
672
|
+
html = '<p>This is a <details>detail</details></p>'
|
673
|
+
doc = Kramdown::Document.new(html, input: :html)
|
674
|
+
assert_equal expected, doc.to_prismic
|
632
675
|
assert_equal 1, doc.warnings.size
|
676
|
+
assert_equal "translating html element 'details' is not supported", doc.warnings.first
|
633
677
|
end
|
634
678
|
|
635
679
|
def test_convert_table
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kramdown-prismic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- François de Metz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|