kramdown-prismic 0.3.3 → 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 +4 -0
- data/Gemfile.lock +1 -1
- data/lib/kramdown/converter/prismic.rb +17 -0
- data/lib/kramdown-prismic/version.rb +1 -1
- data/test/converter_test.rb +40 -0
- 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: 73ce49b872adc3dd34de55efc6c45bdde6ab2ec5cfd04fc4192555639ed63fb3
|
4
|
+
data.tar.gz: f95a92886b915b6bf5c3b283368e84fcb4591b5b3f45e998a7ed13beb31e788f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cd76efd9fb572c3f921c44b0d2ee6f6748c9132ac5827d373e581ec19361609f73acb1bac3fb8f27bc6e5c53219353e363e5a05f71dacbfbef5eb7f1d88ca16
|
7
|
+
data.tar.gz: 03b6033f3576720dfaa823c808c9d29f1264813d8ec82b807f3bc72217263179f110f380b87fac3ea41157cbd4da189254a08edeb4089cb139221b6083bef86a
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -148,6 +148,23 @@ module Kramdown
|
|
148
148
|
}
|
149
149
|
end
|
150
150
|
|
151
|
+
def convert_strong(element)
|
152
|
+
convert_sub_html_element(element, 'strong')
|
153
|
+
end
|
154
|
+
|
155
|
+
def convert_em(element)
|
156
|
+
convert_sub_html_element(element, 'em')
|
157
|
+
end
|
158
|
+
|
159
|
+
def convert_sub_html_element(element, type)
|
160
|
+
content = extract_content(element)
|
161
|
+
content[:spans].push({ type: type, start: 0, end: content[:text].size })
|
162
|
+
{
|
163
|
+
type: 'paragraph',
|
164
|
+
content: content
|
165
|
+
}
|
166
|
+
end
|
167
|
+
|
151
168
|
def convert_html_element(element)
|
152
169
|
if element.value == 'iframe'
|
153
170
|
{
|
data/test/converter_test.rb
CHANGED
@@ -132,6 +132,26 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
132
132
|
assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
|
133
133
|
end
|
134
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
|
+
|
135
155
|
def test_convert_paragraph_with_em
|
136
156
|
expected = [
|
137
157
|
{
|
@@ -152,6 +172,26 @@ class KramdownPrismicConverterTest < Minitest::Test
|
|
152
172
|
assert_equal expected, Kramdown::Document.new(markdown, input: :markdown).to_prismic
|
153
173
|
end
|
154
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
|
+
|
155
195
|
def test_convert_list_o
|
156
196
|
expected = [
|
157
197
|
{
|
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.4
|
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: 2021-08-
|
11
|
+
date: 2021-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|