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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba6d3ad52704c02e2ec102cc69ca216f02c464ba6cde85c2f28024c66448a985
4
- data.tar.gz: 64fdd7184a0184c10b72acb00d2109f1b3512fc53392327a5f537d091d5796ce
3
+ metadata.gz: 73ce49b872adc3dd34de55efc6c45bdde6ab2ec5cfd04fc4192555639ed63fb3
4
+ data.tar.gz: f95a92886b915b6bf5c3b283368e84fcb4591b5b3f45e998a7ed13beb31e788f
5
5
  SHA512:
6
- metadata.gz: ea6f89410664900030c17478ed4cce6fb6a499974ef775f421fd1b720e7f28e123526eb1893889f42d8964928a1c2139387f2dae408a3ea19dffc50805430918
7
- data.tar.gz: 95c6df198bfdacb61f24606575d4fd5d517b1285750a4dd463f15cc0416513759aec67183eb3820c64c221d5154acbb826e0a74b7e9f797ddfff7cbb2bbae165
6
+ metadata.gz: 1cd76efd9fb572c3f921c44b0d2ee6f6748c9132ac5827d373e581ec19361609f73acb1bac3fb8f27bc6e5c53219353e363e5a05f71dacbfbef5eb7f1d88ca16
7
+ data.tar.gz: 03b6033f3576720dfaa823c808c9d29f1264813d8ec82b807f3bc72217263179f110f380b87fac3ea41157cbd4da189254a08edeb4089cb139221b6083bef86a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 0.3.4
4
+
5
+ - Convert `strong` and `em` elements when converting HTML documents.
6
+
3
7
  ## Version 0.3.3
4
8
 
5
9
  - Renable converting xml comments
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kramdown-prismic (0.3.3)
4
+ kramdown-prismic (0.3.4)
5
5
  kramdown (>= 1, < 3)
6
6
 
7
7
  GEM
@@ -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
  {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KramdownPrismic
4
- VERSION = '0.3.3'
4
+ VERSION = '0.3.4'
5
5
  end
@@ -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.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-20 00:00:00.000000000 Z
11
+ date: 2021-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown