prosemirror_to_html 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 310a6a3549a6e796525d9623874469d85368541498a971568dba4b037c0c7289
4
+ data.tar.gz: 55412b082912e22860b238005c78aee0323d420bce0e8964f9e7d5c227c2cebd
5
+ SHA512:
6
+ metadata.gz: 99009e84b817e6d7a19cc168bdf1a1548ed70ae48b6f67240fbb7fa0ecfef9942b373232fb7d662d9c4df93922aa7864c7166e78b37c5ca26e4464ae9ea48ba5
7
+ data.tar.gz: 435eba416a8990cf8c989596e0b5a6b02aeab2fa4e25dfec02472f710b80d2cf4a3937988c0baf29d9d159f795d63e0327722e3c56538a818871120adbdd4c5d
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ features/**/*.feature
4
+ -
5
+ LICENSE.md
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .DS_Store
13
+ prosemirror_to_html-*.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.1
7
+ before_install: gem install bundler -v 1.17.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at bvkimball@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in prosemirror_to_html.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ prosemirror_to_html (0.1.0)
5
+ nokogiri
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.3)
11
+ mini_portile2 (2.4.0)
12
+ nokogiri (1.10.2)
13
+ mini_portile2 (~> 2.4.0)
14
+ rake (10.5.0)
15
+ rspec (3.8.0)
16
+ rspec-core (~> 3.8.0)
17
+ rspec-expectations (~> 3.8.0)
18
+ rspec-mocks (~> 3.8.0)
19
+ rspec-core (3.8.0)
20
+ rspec-support (~> 3.8.0)
21
+ rspec-expectations (3.8.2)
22
+ diff-lcs (>= 1.2.0, < 2.0)
23
+ rspec-support (~> 3.8.0)
24
+ rspec-mocks (3.8.0)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.8.0)
27
+ rspec-support (3.8.0)
28
+ yard (0.9.19)
29
+
30
+ PLATFORMS
31
+ ruby
32
+
33
+ DEPENDENCIES
34
+ bundler (~> 2.0.1)
35
+ prosemirror_to_html!
36
+ rake (~> 10.0)
37
+ rspec (~> 3.0)
38
+ yard
39
+
40
+ BUNDLED WITH
41
+ 2.0.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Brian Kimball
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # ProsemirrorToHtml
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/prosemirror_to_html`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'prosemirror_to_html'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install prosemirror_to_html
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/prosemirror_to_html. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the ProsemirrorToHtml project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/prosemirror_to_html/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :test => :spec
7
+ task :default => :spec
8
+
9
+ namespace :doc do
10
+ begin
11
+ require 'yard'
12
+ YARD::Rake::YardocTask.new do |task|
13
+ task.files = ['README.md', 'LICENSE.md', 'lib/**/*.rb']
14
+ task.options = [
15
+ '--output-dir', 'doc/yard',
16
+ '--markup', 'markdown',
17
+ ]
18
+ end
19
+ rescue LoadError
20
+ end
21
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "prosemirror_to_html"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,148 @@
1
+ require "prosemirror_to_html/version"
2
+ require "prosemirror_to_html/marks/mark"
3
+ require "prosemirror_to_html/marks/bold"
4
+ require "prosemirror_to_html/marks/code"
5
+ require "prosemirror_to_html/marks/italic"
6
+ require "prosemirror_to_html/marks/link"
7
+ require "prosemirror_to_html/nodes/node"
8
+ require "prosemirror_to_html/nodes/bullet_list"
9
+ require "prosemirror_to_html/nodes/code_block_wrapper"
10
+ require "prosemirror_to_html/nodes/code_block"
11
+ require "prosemirror_to_html/nodes/hard_break"
12
+ require "prosemirror_to_html/nodes/heading"
13
+ require "prosemirror_to_html/nodes/image"
14
+ require "prosemirror_to_html/nodes/list_item"
15
+ require "prosemirror_to_html/nodes/ordered_list"
16
+ require "prosemirror_to_html/nodes/paragraph"
17
+ require "prosemirror_to_html/nodes/text"
18
+ require "prosemirror_to_html/nodes/user"
19
+ require 'nokogiri'
20
+ require 'json'
21
+ require "ostruct"
22
+
23
+ module ProsemirrorToHtml
24
+ class Error < StandardError; end
25
+ # Your code goes here...
26
+ class Renderer
27
+ def initialize()
28
+ @storedMarks = []
29
+ @marks = [
30
+ ProsemirrorToHtml::Marks::Bold,
31
+ ProsemirrorToHtml::Marks::Code,
32
+ ProsemirrorToHtml::Marks::Italic,
33
+ ProsemirrorToHtml::Marks::Link
34
+ ]
35
+ @nodes = [
36
+ ProsemirrorToHtml::Nodes::BulletList,
37
+ ProsemirrorToHtml::Nodes::CodeBlockWrapper,
38
+ ProsemirrorToHtml::Nodes::CodeBlock,
39
+ ProsemirrorToHtml::Nodes::HardBreak,
40
+ ProsemirrorToHtml::Nodes::Heading,
41
+ ProsemirrorToHtml::Nodes::Image,
42
+ ProsemirrorToHtml::Nodes::ListItem,
43
+ ProsemirrorToHtml::Nodes::OrderedList,
44
+ ProsemirrorToHtml::Nodes::Paragraph,
45
+ # ProsemirrorToHtml::Nodes::Text,
46
+ ProsemirrorToHtml::Nodes::User
47
+ ]
48
+ end
49
+
50
+ def addNode(node)
51
+ @nodes.push(node)
52
+ end
53
+ def addNodes(nodes)
54
+ nodes.each do |node|
55
+ addNode(node);
56
+ end
57
+ end
58
+ def addMark(mark)
59
+ @marks.push(mark)
60
+ end
61
+ def addMarks(marks)
62
+ marks.each do |mark|
63
+ addMark(mark);
64
+ end
65
+ end
66
+
67
+ def render(hash)
68
+ html = ""
69
+ json = hash.to_json
70
+ object = JSON.parse(json, object_class: OpenStruct)
71
+ object.content.each do |node|
72
+ html += renderNode(node)
73
+ end
74
+
75
+ html
76
+ end
77
+ private
78
+ def renderNode(item)
79
+ html = []
80
+ if item.marks
81
+ item.marks.each do |m|
82
+ mark = get_matching_mark(m)
83
+ html.push(renderOpeningTag(mark.tag)) if mark
84
+ end
85
+ end
86
+
87
+ node = get_matching_node(item)
88
+ html.push(renderOpeningTag(node.tag)) if node
89
+
90
+ if item.content
91
+ item.content.each do |content|
92
+ html.push(renderNode(content))
93
+ end
94
+ elsif item.text
95
+ html.push(item.text)
96
+ end
97
+
98
+ html.push(renderClosingTag(node.tag)) if node
99
+ if item.marks
100
+ item.marks.reverse.each do |m|
101
+ mark = get_matching_mark(m)
102
+ html.push(renderClosingTag(mark.tag)) if mark
103
+ end
104
+ end
105
+ return html.join("");
106
+ end
107
+
108
+ def renderOpeningTag(tags)
109
+ return "<#{tags}>" if tags.is_a? String
110
+ all = tags.map do |tag|
111
+ return "<#{tags}>" if tag.is_a? String
112
+ h = "<#{tag[:tag]}"
113
+ tag[:attrs].to_h.each_pair { |key, value| h += " #{key}=\"#{value}\"" } if tag[:attrs]
114
+ "#{h}>"
115
+ end
116
+ return all.join('')
117
+ end
118
+
119
+ def renderClosingTag(tags)
120
+ return "</#{tags}>" if tags.is_a? String
121
+ all = tags.reverse.map do |tag|
122
+ return "</#{tag}>" if tag.is_a? String
123
+ "</#{tag[:tag]}>"
124
+ end
125
+ return all.join('')
126
+ end
127
+
128
+ # Find which Node matches the Html Node
129
+ def get_matching_node(item)
130
+ return get_matching_class(item, @nodes)
131
+ end
132
+ # Find which Mark matches the HtmlElement
133
+ def get_matching_mark(item)
134
+ return get_matching_class(item, @marks)
135
+ end
136
+ # Find which class matches the HtmlElement
137
+ def get_matching_class(node, classes)
138
+ found = classes.select do |clazz|
139
+ instance = clazz.new(node)
140
+ if (instance.matching())
141
+ return instance
142
+ end
143
+ end
144
+ found.first
145
+ end
146
+
147
+ end
148
+ end
@@ -0,0 +1,14 @@
1
+ module ProsemirrorToHtml
2
+ module Marks
3
+ class Bold < Mark
4
+
5
+ def matching
6
+ @node.type === 'bold'
7
+ end
8
+
9
+ def tag
10
+ 'strong'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module ProsemirrorToHtml
2
+ module Marks
3
+ class Code < Mark
4
+
5
+ def matching
6
+ @node.type === 'code'
7
+ end
8
+
9
+ def tag
10
+ 'code'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module ProsemirrorToHtml
2
+ module Marks
3
+ class Italic < Mark
4
+
5
+ def matching
6
+ @node.type === 'italic'
7
+ end
8
+
9
+ def tag
10
+ 'em'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,17 @@
1
+ module ProsemirrorToHtml
2
+ module Marks
3
+ class Link < Mark
4
+
5
+ def matching
6
+ @node.type === 'link'
7
+ end
8
+
9
+ def tag
10
+ [{
11
+ tag: "a",
12
+ attrs: @node.attrs
13
+ }]
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,24 @@
1
+ module ProsemirrorToHtml
2
+ module Marks
3
+ class Mark
4
+ attr_writer :type
5
+
6
+ def type
7
+ @type || 'mark'
8
+ end
9
+
10
+ def initialize(data)
11
+ @node = data
12
+ end
13
+
14
+ def matching
15
+ false
16
+ end
17
+
18
+ def tag
19
+ nil
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,14 @@
1
+ module ProsemirrorToHtml
2
+ module Nodes
3
+ class BulletList < Node
4
+
5
+ def matching
6
+ @node.type === 'bullet_list'
7
+ end
8
+
9
+ def data
10
+ 'ul'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ module ProsemirrorToHtml
2
+ module Nodes
3
+ class CodeBlock < Node
4
+
5
+ def matching
6
+ @node.type === 'code_block'
7
+ end
8
+
9
+ def tag
10
+ ['pre', 'tag']
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ module ProsemirrorToHtml
2
+ module Nodes
3
+ class CodeBlockWrapper < Node
4
+ def matching
5
+ @node.name === 'pre'
6
+ end
7
+
8
+ def data
9
+ nil
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ module ProsemirrorToHtml
2
+ module Nodes
3
+ class HardBreak < Node
4
+
5
+ def matching
6
+ @node.type === 'hard_break'
7
+ end
8
+
9
+ def data
10
+ 'br'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ module ProsemirrorToHtml
2
+ module Nodes
3
+ class Heading < Node
4
+
5
+ def matching
6
+ @node.type === 'heading'
7
+ end
8
+
9
+ def tag
10
+ "h#{@node.attrs.level}"
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module ProsemirrorToHtml
2
+ module Nodes
3
+ class Image < Node
4
+
5
+ def matching
6
+ @node.type === 'img'
7
+ end
8
+
9
+ def tag
10
+ # doc.img(:src => @node.attrs.src)
11
+ 'img'
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,18 @@
1
+ module ProsemirrorToHtml
2
+ module Nodes
3
+ class ListItem < Node
4
+ # def initialize(dom_node)
5
+ # super(dom_node)
6
+ # @wrapper = { type: 'paragraph' }
7
+ # end
8
+
9
+ def matching
10
+ @node.type === 'list_item'
11
+ end
12
+
13
+ def tag
14
+ 'li'
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,29 @@
1
+ module ProsemirrorToHtml
2
+ module Nodes
3
+
4
+ class Node
5
+ attr_writer :wrapper
6
+ attr_writer :type
7
+
8
+ def type
9
+ @type || 'node'
10
+ end
11
+
12
+ def initialize(data)
13
+ @node = data
14
+ end
15
+
16
+ def matching
17
+ false
18
+ end
19
+
20
+ def tag
21
+ nil
22
+ end
23
+
24
+ def text
25
+ nil
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,14 @@
1
+ module ProsemirrorToHtml
2
+ module Nodes
3
+ class OrderedList < Node
4
+
5
+ def matching
6
+ @node.type === 'ordered_list'
7
+ end
8
+
9
+ def data
10
+ 'ol'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module ProsemirrorToHtml
2
+ module Nodes
3
+ class Paragraph < Node
4
+
5
+ def matching
6
+ @node.type === 'paragraph'
7
+ end
8
+
9
+ def tag
10
+ 'p'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module ProsemirrorToHtml
2
+ module Nodes
3
+ class Text < Node
4
+
5
+ def matching
6
+ @node.type === 'text'
7
+ end
8
+
9
+ def tag
10
+ @node.text
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module ProsemirrorToHtml
2
+ module Nodes
3
+ class User < Node
4
+
5
+ def matching
6
+ @node.natypeme === 'user'
7
+ end
8
+
9
+ def tag
10
+ nil
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module ProsemirrorToHtml
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,46 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "prosemirror_to_html/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "prosemirror_to_html"
8
+ spec.version = ProsemirrorToHtml::VERSION
9
+ spec.authors = ["Brian Kimball"]
10
+ spec.email = ["bvkimball@gmail.com"]
11
+
12
+ spec.summary = %q{Takes ProseMirror compatible JSON and outputs HTML.}
13
+ spec.description = %q{Takes ProseMirror compatible JSON and outputs HTML.}
14
+ spec.homepage = "https://github.com/inputhq/prosemirror_to_html"
15
+ spec.license = "MIT"
16
+
17
+
18
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
20
+ # if spec.respond_to?(:metadata)
21
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
22
+
23
+ # spec.metadata["homepage_uri"] = spec.homepage
24
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
25
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
26
+ # else
27
+ # raise "RubyGems 2.0 or newer is required to protect against " \
28
+ # "public gem pushes."
29
+ # end
30
+
31
+ # Specify which files should be added to the gem when it is released.
32
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
33
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
34
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
35
+ end
36
+ spec.bindir = "exe"
37
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
+ spec.require_paths = ["lib"]
39
+
40
+ spec.add_development_dependency "bundler", "~> 2.0.1"
41
+ spec.add_development_dependency "rake", "~> 10.0"
42
+ spec.add_development_dependency "rspec", "~> 3.0"
43
+ spec.add_development_dependency "yard"
44
+ spec.add_dependency "nokogiri"
45
+
46
+ end
data/scripts/package ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ # Usage: script/gem
3
+ # Updates the gemspec and builds a new gem in the pkg directory.
4
+
5
+ gem build *.gemspec
6
+ mv *.gem pkg
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 ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: prosemirror_to_html
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Brian Kimball
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-04-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.1
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: yard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: nokogiri
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Takes ProseMirror compatible JSON and outputs HTML.
84
+ email:
85
+ - bvkimball@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".document"
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
94
+ - CODE_OF_CONDUCT.md
95
+ - Gemfile
96
+ - Gemfile.lock
97
+ - LICENSE.txt
98
+ - README.md
99
+ - Rakefile
100
+ - bin/console
101
+ - bin/setup
102
+ - lib/prosemirror_to_html.rb
103
+ - lib/prosemirror_to_html/marks/bold.rb
104
+ - lib/prosemirror_to_html/marks/code.rb
105
+ - lib/prosemirror_to_html/marks/italic.rb
106
+ - lib/prosemirror_to_html/marks/link.rb
107
+ - lib/prosemirror_to_html/marks/mark.rb
108
+ - lib/prosemirror_to_html/nodes/bullet_list.rb
109
+ - lib/prosemirror_to_html/nodes/code_block.rb
110
+ - lib/prosemirror_to_html/nodes/code_block_wrapper.rb
111
+ - lib/prosemirror_to_html/nodes/hard_break.rb
112
+ - lib/prosemirror_to_html/nodes/heading.rb
113
+ - lib/prosemirror_to_html/nodes/image.rb
114
+ - lib/prosemirror_to_html/nodes/list_item.rb
115
+ - lib/prosemirror_to_html/nodes/node.rb
116
+ - lib/prosemirror_to_html/nodes/ordered_list.rb
117
+ - lib/prosemirror_to_html/nodes/paragraph.rb
118
+ - lib/prosemirror_to_html/nodes/text.rb
119
+ - lib/prosemirror_to_html/nodes/user.rb
120
+ - lib/prosemirror_to_html/version.rb
121
+ - prosemirror_to_html.gemspec
122
+ - scripts/package
123
+ - scripts/release
124
+ homepage: https://github.com/inputhq/prosemirror_to_html
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.7.6
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: Takes ProseMirror compatible JSON and outputs HTML.
148
+ test_files: []