openwebslides-converter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +54 -0
  3. data/.rdoc_options +16 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +16 -0
  6. data/.travis.yml +6 -0
  7. data/Gemfile +5 -0
  8. data/LICENSE.md +20 -0
  9. data/README.md +23 -0
  10. data/Rakefile +24 -0
  11. data/lib/openwebslides/converter.rb +8 -0
  12. data/lib/openwebslides/converter/content.rb +13 -0
  13. data/lib/openwebslides/converter/content/content_item.rb +12 -0
  14. data/lib/openwebslides/converter/content/heading.rb +13 -0
  15. data/lib/openwebslides/converter/content/paragraph.rb +13 -0
  16. data/lib/openwebslides/converter/content/properties/container.rb +21 -0
  17. data/lib/openwebslides/converter/content/properties/identifier.rb +41 -0
  18. data/lib/openwebslides/converter/content/properties/metadata.rb +24 -0
  19. data/lib/openwebslides/converter/content/properties/subable.rb +21 -0
  20. data/lib/openwebslides/converter/content/properties/text.rb +21 -0
  21. data/lib/openwebslides/converter/content/properties/type.rb +21 -0
  22. data/lib/openwebslides/converter/content/root.rb +11 -0
  23. data/lib/openwebslides/converter/helpers/sanitization.rb +21 -0
  24. data/lib/openwebslides/converter/pressbooks.rb +181 -0
  25. data/lib/openwebslides/converter/result.rb +16 -0
  26. data/lib/openwebslides/converter/version.rb +7 -0
  27. data/openwebslides-converter.gemspec +43 -0
  28. data/spec/content/content_item_spec.rb +25 -0
  29. data/spec/content/heading_spec.rb +27 -0
  30. data/spec/content/paragraph_spec.rb +27 -0
  31. data/spec/content/properties/container_spec.rb +48 -0
  32. data/spec/content/properties/identifier_spec.rb +51 -0
  33. data/spec/content/properties/metadata_spec.rb +48 -0
  34. data/spec/content/properties/subable_spec.rb +48 -0
  35. data/spec/content/properties/text_spec.rb +48 -0
  36. data/spec/content/properties/type_spec.rb +48 -0
  37. data/spec/content/root_spec.rb +26 -0
  38. data/spec/converter_spec.rb +10 -0
  39. data/spec/spec_helper.rb +11 -0
  40. metadata +221 -0
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Content::Properties::Subable do
6
+ ##
7
+ # Configuration
8
+ #
9
+ ##
10
+ # Stubs and mocks
11
+ #
12
+ ##
13
+ # Test variables
14
+ #
15
+ let(:object) do
16
+ obj = Object.new
17
+ # Always include Identifier as top of the #to_h chain
18
+ obj.extend Content::Properties::Identifier
19
+ obj.extend described_class
20
+
21
+ obj
22
+ end
23
+
24
+ ##
25
+ # Subject
26
+ #
27
+ subject { object }
28
+
29
+ ##
30
+ # Tests
31
+ #
32
+ describe 'included properties' do
33
+ it { is_expected.to respond_to :sub_item_ids }
34
+ it { is_expected.to respond_to :to_h }
35
+
36
+ it 'sets a default value for the property' do
37
+ expect(subject.sub_item_ids).not_to be_nil
38
+ end
39
+ end
40
+
41
+ describe 'methods' do
42
+ describe '#to_h' do
43
+ it 'returns a hash with the property' do
44
+ expect(subject.to_h).to include :sub_item_ids
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Content::Properties::Text do
6
+ ##
7
+ # Configuration
8
+ #
9
+ ##
10
+ # Stubs and mocks
11
+ #
12
+ ##
13
+ # Test variables
14
+ #
15
+ let(:object) do
16
+ obj = Object.new
17
+ # Always include Identifier as top of the #to_h chain
18
+ obj.extend Content::Properties::Identifier
19
+ obj.extend described_class
20
+
21
+ obj
22
+ end
23
+
24
+ ##
25
+ # Subject
26
+ #
27
+ subject { object }
28
+
29
+ ##
30
+ # Tests
31
+ #
32
+ describe 'included properties' do
33
+ it { is_expected.to respond_to :text }
34
+ it { is_expected.to respond_to :to_h }
35
+
36
+ it 'sets a default value for the property' do
37
+ expect(subject.text).not_to be_nil
38
+ end
39
+ end
40
+
41
+ describe 'methods' do
42
+ describe '#to_h' do
43
+ it 'returns a hash with the property' do
44
+ expect(subject.to_h).to include :text
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Content::Properties::Type do
6
+ ##
7
+ # Configuration
8
+ #
9
+ ##
10
+ # Stubs and mocks
11
+ #
12
+ ##
13
+ # Test variables
14
+ #
15
+ let(:object) do
16
+ obj = Object.new
17
+ # Always include Identifier as top of the #to_h chain
18
+ obj.extend Content::Properties::Identifier
19
+ obj.extend described_class
20
+
21
+ obj
22
+ end
23
+
24
+ ##
25
+ # Subject
26
+ #
27
+ subject { object }
28
+
29
+ ##
30
+ # Tests
31
+ #
32
+ describe 'included properties' do
33
+ it { is_expected.to respond_to :type }
34
+ it { is_expected.to respond_to :to_h }
35
+
36
+ it 'sets a default value for the property' do
37
+ expect(subject.type).not_to be_nil
38
+ end
39
+ end
40
+
41
+ describe 'methods' do
42
+ describe '#to_h' do
43
+ it 'returns a hash with the property' do
44
+ expect(subject.to_h).to include :type
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Content::Root do
6
+ ##
7
+ # Configuration
8
+ #
9
+ ##
10
+ # Stubs and mocks
11
+ #
12
+ ##
13
+ # Test variables
14
+ #
15
+ ##
16
+ # Subject
17
+ #
18
+ ##
19
+ # Tests
20
+ #
21
+ describe 'included properties' do
22
+ it { is_expected.to respond_to :id }
23
+ it { is_expected.to respond_to :type }
24
+ it { is_expected.to respond_to :child_item_ids }
25
+ end
26
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'openwebslides/converter'
5
+
6
+ describe OpenWebslides::Converter do
7
+ it 'should have a VERSION constant' do
8
+ expect(OpenWebslides::Converter::VERSION).to_not be_empty
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec'
4
+ require 'simplecov'
5
+ require 'coveralls'
6
+
7
+ Coveralls.wear!
8
+
9
+ require 'openwebslides/converter'
10
+
11
+ include OpenWebslides::Converter
metadata ADDED
@@ -0,0 +1,221 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: openwebslides-converter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Florian Dejonckheere
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-09-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: reverse_markdown
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.10'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.10'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.8'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.8'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rdoc
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '4.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '4.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.58'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.58'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubygems-tasks
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.2'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.2'
139
+ description: Converts arbitrary content data formats to Open Webslides data format
140
+ email: florian@floriandejonckheere.be
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - ".gitignore"
146
+ - ".rdoc_options"
147
+ - ".rspec"
148
+ - ".rubocop.yml"
149
+ - ".ruby-gemset"
150
+ - ".ruby-version"
151
+ - ".travis.yml"
152
+ - Gemfile
153
+ - LICENSE.md
154
+ - README.md
155
+ - Rakefile
156
+ - lib/openwebslides/converter.rb
157
+ - lib/openwebslides/converter/content.rb
158
+ - lib/openwebslides/converter/content/content_item.rb
159
+ - lib/openwebslides/converter/content/heading.rb
160
+ - lib/openwebslides/converter/content/paragraph.rb
161
+ - lib/openwebslides/converter/content/properties/container.rb
162
+ - lib/openwebslides/converter/content/properties/identifier.rb
163
+ - lib/openwebslides/converter/content/properties/metadata.rb
164
+ - lib/openwebslides/converter/content/properties/subable.rb
165
+ - lib/openwebslides/converter/content/properties/text.rb
166
+ - lib/openwebslides/converter/content/properties/type.rb
167
+ - lib/openwebslides/converter/content/root.rb
168
+ - lib/openwebslides/converter/helpers/sanitization.rb
169
+ - lib/openwebslides/converter/pressbooks.rb
170
+ - lib/openwebslides/converter/result.rb
171
+ - lib/openwebslides/converter/version.rb
172
+ - openwebslides-converter.gemspec
173
+ - spec/content/content_item_spec.rb
174
+ - spec/content/heading_spec.rb
175
+ - spec/content/paragraph_spec.rb
176
+ - spec/content/properties/container_spec.rb
177
+ - spec/content/properties/identifier_spec.rb
178
+ - spec/content/properties/metadata_spec.rb
179
+ - spec/content/properties/subable_spec.rb
180
+ - spec/content/properties/text_spec.rb
181
+ - spec/content/properties/type_spec.rb
182
+ - spec/content/root_spec.rb
183
+ - spec/converter_spec.rb
184
+ - spec/spec_helper.rb
185
+ homepage: https://rubygems.org/gems/openwebslides-converter
186
+ licenses:
187
+ - MIT
188
+ metadata: {}
189
+ post_install_message:
190
+ rdoc_options: []
191
+ require_paths:
192
+ - lib
193
+ required_ruby_version: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ required_rubygems_version: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: '0'
203
+ requirements: []
204
+ rubyforge_project:
205
+ rubygems_version: 2.7.3
206
+ signing_key:
207
+ specification_version: 4
208
+ summary: Open Webslides Converter
209
+ test_files:
210
+ - spec/content/content_item_spec.rb
211
+ - spec/content/heading_spec.rb
212
+ - spec/content/paragraph_spec.rb
213
+ - spec/content/properties/container_spec.rb
214
+ - spec/content/properties/identifier_spec.rb
215
+ - spec/content/properties/metadata_spec.rb
216
+ - spec/content/properties/subable_spec.rb
217
+ - spec/content/properties/text_spec.rb
218
+ - spec/content/properties/type_spec.rb
219
+ - spec/content/root_spec.rb
220
+ - spec/converter_spec.rb
221
+ - spec/spec_helper.rb