html_to_prosemirror 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.document +5 -0
- data/.gitignore +1 -0
- data/Gemfile.lock +6 -4
- data/RELEASE.md +28 -0
- data/lib/html_to_prosemirror/version.rb +1 -1
- data/lib/html_to_prosemirror.rb +10 -7
- data/scripts/package +6 -0
- data/scripts/release +16 -0
- metadata +10 -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/.document
ADDED
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/RELEASE.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Releasing a new version of html_to_prosemirror
|
2
|
+
|
3
|
+
1. Create a list of all the changes since the prior release
|
4
|
+
1. Compare the latest release to master using https://github.com/inputhq/html_to_prosemirror/compare/`${latest}`...master
|
5
|
+
1. Open the linked pull requests from all the `Merge pull request #...` commits
|
6
|
+
1. For all non-documentation PRs, copy title (including pull request number) into markdown list items
|
7
|
+
1. (optional, but nice) Sort into logical buckets, like "support for additional endpoints", "enhancements", "bugfixes"
|
8
|
+
1. Reorganize to put the pull request number at the start of the line
|
9
|
+
1. Ensure there are no breaking changes _(if there are breaking changes you'll need to create a release branch without those changes or bump the major version)_
|
10
|
+
1. Update the version
|
11
|
+
1. Update the constant in `lib/html_to_prosemirror/version.rb`
|
12
|
+
1. Commit and push directly to master
|
13
|
+
1. Run the `script/release` script to cut a release
|
14
|
+
1. Draft a new release at https://github.com/inputhq/html_to_prosemirror.rb/releases/new containing the curated changelog
|
15
|
+
|
16
|
+
## Prerequisites
|
17
|
+
|
18
|
+
In order to create a release, you will need to be an owner of the html_to_prosemirror gem on Rubygems.
|
19
|
+
|
20
|
+
Verify with:
|
21
|
+
```
|
22
|
+
gem owner html_to_prosemirror
|
23
|
+
```
|
24
|
+
|
25
|
+
An existing owner can add new owners with:
|
26
|
+
```
|
27
|
+
gem owner html_to_prosemirror --add EMAIL
|
28
|
+
```
|
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,
|
@@ -47,7 +48,6 @@ module HtmlToProsemirror
|
|
47
48
|
|
48
49
|
def render(value)
|
49
50
|
minified = minify_html(value.strip! || value)
|
50
|
-
puts minified
|
51
51
|
@document = Nokogiri::HTML.fragment(minified)
|
52
52
|
content = render_children(@document)
|
53
53
|
return {
|
@@ -78,11 +78,14 @@ module HtmlToProsemirror
|
|
78
78
|
content: render_children(child),
|
79
79
|
})
|
80
80
|
end
|
81
|
-
if (@
|
81
|
+
if (@stored_marks.count > 0)
|
82
82
|
item = item.merge({
|
83
|
-
marks: @
|
83
|
+
marks: @stored_marks,
|
84
84
|
})
|
85
|
-
@
|
85
|
+
@stored_marks = [];
|
86
|
+
end
|
87
|
+
if (@case_type === :lower_camel)
|
88
|
+
item = item.merge(type: item[:type].gsub(/_([a-z])/) { $1.upcase })
|
86
89
|
end
|
87
90
|
# if (child_node.wrapper)
|
88
91
|
# item['content'] = [
|
@@ -96,7 +99,7 @@ module HtmlToProsemirror
|
|
96
99
|
|
97
100
|
child_mark = get_matching_mark(child)
|
98
101
|
if (child_mark)
|
99
|
-
@
|
102
|
+
@stored_marks.push(child_mark.data())
|
100
103
|
if (child.children.length > 0)
|
101
104
|
nodes = nodes + render_children(child)
|
102
105
|
end
|
data/scripts/package
ADDED
data/scripts/release
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
# Usage: script/release
|
3
|
+
# Build the package, tag a commit, push it to origin, and then release the
|
4
|
+
# package publicly.
|
5
|
+
|
6
|
+
set -e
|
7
|
+
|
8
|
+
version="$(script/package | grep Version: | awk '{print $2}')"
|
9
|
+
[ -n "$version" ] || exit 1
|
10
|
+
|
11
|
+
echo $version
|
12
|
+
git commit --allow-empty -a -m "Release $version"
|
13
|
+
git tag "v$version"
|
14
|
+
git push origin
|
15
|
+
git push origin "v$version"
|
16
|
+
gem push pkg/*-${version}.gem
|
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
|
@@ -87,6 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".document"
|
90
91
|
- ".gitignore"
|
91
92
|
- ".rspec"
|
92
93
|
- ".travis.yml"
|
@@ -95,6 +96,7 @@ files:
|
|
95
96
|
- Gemfile.lock
|
96
97
|
- LICENSE.txt
|
97
98
|
- README.md
|
99
|
+
- RELEASE.md
|
98
100
|
- Rakefile
|
99
101
|
- bin/console
|
100
102
|
- bin/setup
|
@@ -118,11 +120,13 @@ files:
|
|
118
120
|
- lib/html_to_prosemirror/nodes/text.rb
|
119
121
|
- lib/html_to_prosemirror/nodes/user.rb
|
120
122
|
- lib/html_to_prosemirror/version.rb
|
123
|
+
- scripts/package
|
124
|
+
- scripts/release
|
121
125
|
homepage: https://github.com/inputhq/html_to_prosemirror
|
122
126
|
licenses:
|
123
127
|
- MIT
|
124
128
|
metadata: {}
|
125
|
-
post_install_message:
|
129
|
+
post_install_message:
|
126
130
|
rdoc_options: []
|
127
131
|
require_paths:
|
128
132
|
- lib
|
@@ -137,9 +141,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
141
|
- !ruby/object:Gem::Version
|
138
142
|
version: '0'
|
139
143
|
requirements: []
|
140
|
-
|
141
|
-
|
142
|
-
signing_key:
|
144
|
+
rubygems_version: 3.3.26
|
145
|
+
signing_key:
|
143
146
|
specification_version: 4
|
144
147
|
summary: Takes HTML and outputs ProseMirror compatible JSON.
|
145
148
|
test_files: []
|