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 +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +6 -4
- data/lib/html_to_prosemirror/version.rb +1 -1
- data/lib/html_to_prosemirror.rb +10 -6
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b97a5555fbe65c1c4d2473d443120dfc789fdcb008e120887e7d465e43693696
|
4
|
+
data.tar.gz: a391ed8f83a6774c0b0947d9d37eb4a1eabd59b21c2b78c2e6382fbbe20640a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bd6eacbf9755bed1ecf969c956805d27a1700b8e464c5f0fad619e80ac778a729ab74b3cfeb2225de907467ab72690fbea01becc29997b6fd68a873cadd8521
|
7
|
+
data.tar.gz: 8ec7c313ba172d7ab08f1f11a5a27dd00e3b7c9e9c0860fe3b3a8bf3e74cf9958528870839aa6f19df15217ec22c02841a4d842e92f8092ad5825ecea39c7ed3
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
html_to_prosemirror (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
|
-
|
12
|
-
|
13
|
-
|
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
|
data/lib/html_to_prosemirror.rb
CHANGED
@@ -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
|
-
@
|
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 (@
|
81
|
+
if (@stored_marks.count > 0)
|
81
82
|
item = item.merge({
|
82
|
-
marks: @
|
83
|
+
marks: @stored_marks,
|
83
84
|
})
|
84
|
-
@
|
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
|
-
@
|
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.
|
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:
|
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
|
-
|
145
|
-
|
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: []
|