html_to_prosemirror 0.1.1 → 0.2.0

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: 7b5af058ad7514fd19c6c84dc683e2f9deadcb7a50a5bd36210d0177e481995c
4
- data.tar.gz: 0bee0c99a34d5a424a5fa8272b1880f6ea6294ceb40438554da838bcd1b1daee
3
+ metadata.gz: b97a5555fbe65c1c4d2473d443120dfc789fdcb008e120887e7d465e43693696
4
+ data.tar.gz: a391ed8f83a6774c0b0947d9d37eb4a1eabd59b21c2b78c2e6382fbbe20640a6
5
5
  SHA512:
6
- metadata.gz: 1a522f04a6d0e30cbf7204ed943c2c8c691a0961c505ca35af994bf06322799eac40bbd6201690101e0d04a217b9edcb6543ead128698879430f9e335de05a2f
7
- data.tar.gz: 31c226082188c7e41061b37f69625540efafefe57f74fa3054a4299223f47b1cd79c2fb13b45cf0df5015b507859b30ce90db1ff69f68c5a0c96d5c92c261218
6
+ metadata.gz: 1bd6eacbf9755bed1ecf969c956805d27a1700b8e464c5f0fad619e80ac778a729ab74b3cfeb2225de907467ab72690fbea01becc29997b6fd68a873cadd8521
7
+ data.tar.gz: 8ec7c313ba172d7ab08f1f11a5a27dd00e3b7c9e9c0860fe3b3a8bf3e74cf9958528870839aa6f19df15217ec22c02841a4d842e92f8092ad5825ecea39c7ed3
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  .DS_Store
13
+ html_to_prosemirror-*.gem
data/Gemfile.lock CHANGED
@@ -1,16 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- html_to_prosemirror (0.1.0)
4
+ html_to_prosemirror (0.2.0)
5
5
  nokogiri
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  diff-lcs (1.3)
11
- mini_portile2 (2.4.0)
12
- nokogiri (1.10.2)
13
- mini_portile2 (~> 2.4.0)
11
+ nokogiri (1.15.4-x86_64-linux)
12
+ racc (~> 1.4)
13
+ racc (1.7.1)
14
14
  rake (10.5.0)
15
15
  rspec (3.8.0)
16
16
  rspec-core (~> 3.8.0)
@@ -25,6 +25,7 @@ GEM
25
25
  diff-lcs (>= 1.2.0, < 2.0)
26
26
  rspec-support (~> 3.8.0)
27
27
  rspec-support (3.8.0)
28
+ yard (0.9.34)
28
29
 
29
30
  PLATFORMS
30
31
  ruby
@@ -34,6 +35,7 @@ DEPENDENCIES
34
35
  html_to_prosemirror!
35
36
  rake (~> 10.0)
36
37
  rspec (~> 3.0)
38
+ yard
37
39
 
38
40
  BUNDLED WITH
39
41
  1.17.2
@@ -1,3 +1,3 @@
1
1
  module HtmlToProsemirror
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -22,8 +22,9 @@ module HtmlToProsemirror
22
22
  class Error < StandardError; end
23
23
  # Your code goes here...
24
24
  class Renderer
25
- def initialize()
26
- @storedMarks = []
25
+ def initialize(case_type: :snake)
26
+ @case_type = case_type
27
+ @stored_marks = []
27
28
  @marks = [
28
29
  HtmlToProsemirror::Marks::Bold,
29
30
  HtmlToProsemirror::Marks::Code,
@@ -77,11 +78,14 @@ module HtmlToProsemirror
77
78
  content: render_children(child),
78
79
  })
79
80
  end
80
- if (@storedMarks.count > 0)
81
+ if (@stored_marks.count > 0)
81
82
  item = item.merge({
82
- marks: @storedMarks,
83
+ marks: @stored_marks,
83
84
  })
84
- @storedMarks = [];
85
+ @stored_marks = [];
86
+ end
87
+ if (@case_type === :lower_camel)
88
+ item = item.merge(type: item[:type].gsub(/_([a-z])/) { $1.upcase })
85
89
  end
86
90
  # if (child_node.wrapper)
87
91
  # item['content'] = [
@@ -95,7 +99,7 @@ module HtmlToProsemirror
95
99
 
96
100
  child_mark = get_matching_mark(child)
97
101
  if (child_mark)
98
- @storedMarks.push(child_mark.data())
102
+ @stored_marks.push(child_mark.data())
99
103
  if (child.children.length > 0)
100
104
  nodes = nodes + render_children(child)
101
105
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_to_prosemirror
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Kimball
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-04 00:00:00.000000000 Z
11
+ date: 2023-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -126,7 +126,7 @@ homepage: https://github.com/inputhq/html_to_prosemirror
126
126
  licenses:
127
127
  - MIT
128
128
  metadata: {}
129
- post_install_message:
129
+ post_install_message:
130
130
  rdoc_options: []
131
131
  require_paths:
132
132
  - lib
@@ -141,9 +141,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  requirements: []
144
- rubyforge_project:
145
- rubygems_version: 2.7.6
146
- signing_key:
144
+ rubygems_version: 3.3.26
145
+ signing_key:
147
146
  specification_version: 4
148
147
  summary: Takes HTML and outputs ProseMirror compatible JSON.
149
148
  test_files: []