mathtype_to_mathml_plus 0.0.8

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.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +2 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +3 -0
  6. data/Gemfile +6 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +45 -0
  9. data/Rakefile +7 -0
  10. data/lib/mathtype_to_mathml/char_replacer.rb +366 -0
  11. data/lib/mathtype_to_mathml/mover.rb +151 -0
  12. data/lib/mathtype_to_mathml/version.rb +3 -0
  13. data/lib/mathtype_to_mathml.rb +45 -0
  14. data/lib/transform.xsl +53 -0
  15. data/lib/xsl/arrow.xsl +319 -0
  16. data/lib/xsl/box.xsl +42 -0
  17. data/lib/xsl/char.xsl +1854 -0
  18. data/lib/xsl/embellishment.xsl +389 -0
  19. data/lib/xsl/fence.xsl +228 -0
  20. data/lib/xsl/frac.xsl +46 -0
  21. data/lib/xsl/int.xsl +622 -0
  22. data/lib/xsl/lim.xsl +32 -0
  23. data/lib/xsl/long_division.xsl +32 -0
  24. data/lib/xsl/long_embellishment.xsl +150 -0
  25. data/lib/xsl/matrix.xsl +115 -0
  26. data/lib/xsl/pile.xsl +54 -0
  27. data/lib/xsl/product_coproduct.xsl +107 -0
  28. data/lib/xsl/subsup.xsl +55 -0
  29. data/lib/xsl/sum.xsl +81 -0
  30. data/lib/xsl/union_intersection.xsl +104 -0
  31. data/mathtype_to_mathml.gemspec +29 -0
  32. data/spec/fixtures/expected/280.xml +122 -0
  33. data/spec/fixtures/expected/281.xml +60 -0
  34. data/spec/fixtures/expected/299.xml +70 -0
  35. data/spec/fixtures/expected/326.xml +173 -0
  36. data/spec/fixtures/expected/424.xml +425 -0
  37. data/spec/fixtures/expected/450.xml +174 -0
  38. data/spec/fixtures/expected/452.xml +166 -0
  39. data/spec/fixtures/expected/478.xml +303 -0
  40. data/spec/fixtures/expected/629.xml +98 -0
  41. data/spec/fixtures/expected/arrows.xml +389 -0
  42. data/spec/fixtures/expected/boxes.xml +22 -0
  43. data/spec/fixtures/expected/embellishments.xml +178 -0
  44. data/spec/fixtures/expected/embellishments_roots_long_divisions.xml +162 -0
  45. data/spec/fixtures/expected/equation1.xml +52 -0
  46. data/spec/fixtures/expected/equation10.xml +19 -0
  47. data/spec/fixtures/expected/equation11.xml +17 -0
  48. data/spec/fixtures/expected/equation12.xml +34 -0
  49. data/spec/fixtures/expected/equation13.xml +113 -0
  50. data/spec/fixtures/expected/equation14.xml +54 -0
  51. data/spec/fixtures/expected/equation2.xml +33 -0
  52. data/spec/fixtures/expected/equation3.xml +324 -0
  53. data/spec/fixtures/expected/equation4.xml +14 -0
  54. data/spec/fixtures/expected/equation5.xml +23 -0
  55. data/spec/fixtures/expected/equation6.xml +13 -0
  56. data/spec/fixtures/expected/equation7.xml +19 -0
  57. data/spec/fixtures/expected/equation8.xml +17 -0
  58. data/spec/fixtures/expected/equation9.xml +15 -0
  59. data/spec/fixtures/expected/fences.xml +64 -0
  60. data/spec/fixtures/expected/integrals.xml +264 -0
  61. data/spec/fixtures/expected/matrices.xml +253 -0
  62. data/spec/fixtures/expected/sums.xml +36 -0
  63. data/spec/fixtures/expected/unions_and_intersections.xml +140 -0
  64. data/spec/fixtures/input/280.bin +0 -0
  65. data/spec/fixtures/input/281.bin +0 -0
  66. data/spec/fixtures/input/299.bin +0 -0
  67. data/spec/fixtures/input/326.bin +0 -0
  68. data/spec/fixtures/input/424.bin +0 -0
  69. data/spec/fixtures/input/450.bin +0 -0
  70. data/spec/fixtures/input/452.bin +0 -0
  71. data/spec/fixtures/input/478.bin +0 -0
  72. data/spec/fixtures/input/629.bin +0 -0
  73. data/spec/fixtures/input/arrows.bin +0 -0
  74. data/spec/fixtures/input/boxes.bin +0 -0
  75. data/spec/fixtures/input/embellishments.bin +0 -0
  76. data/spec/fixtures/input/embellishments_roots_long_divisions.bin +0 -0
  77. data/spec/fixtures/input/equation1.bin +0 -0
  78. data/spec/fixtures/input/equation10.bin +0 -0
  79. data/spec/fixtures/input/equation11.bin +0 -0
  80. data/spec/fixtures/input/equation12.bin +0 -0
  81. data/spec/fixtures/input/equation13.bin +0 -0
  82. data/spec/fixtures/input/equation14.bin +0 -0
  83. data/spec/fixtures/input/equation2.bin +0 -0
  84. data/spec/fixtures/input/equation3.bin +0 -0
  85. data/spec/fixtures/input/equation4.bin +0 -0
  86. data/spec/fixtures/input/equation5.bin +0 -0
  87. data/spec/fixtures/input/equation6.bin +0 -0
  88. data/spec/fixtures/input/equation7.bin +0 -0
  89. data/spec/fixtures/input/equation8.bin +0 -0
  90. data/spec/fixtures/input/equation9.bin +0 -0
  91. data/spec/fixtures/input/fences.bin +0 -0
  92. data/spec/fixtures/input/integrals.bin +0 -0
  93. data/spec/fixtures/input/matrices.bin +0 -0
  94. data/spec/fixtures/input/sums.bin +0 -0
  95. data/spec/fixtures/input/unions_and_intersections.bin +0 -0
  96. data/spec/html_output.rb +28 -0
  97. data/spec/mathtype_to_mathml_spec.rb +16 -0
  98. data/spec/spec_helper.rb +4 -0
  99. metadata +305 -0
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,28 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require "mathtype_to_mathml"
3
+ require "nokogiri"
4
+
5
+ builder = Nokogiri::HTML::Builder.new do |html|
6
+ html.html do
7
+ html.body do
8
+ Dir.glob("spec/fixtures/input/*.bin") do |equation|
9
+ html.div do |div|
10
+ div.h3 equation
11
+ div.p "Output", "style" => "text-align: center;"
12
+ div.p do |p|
13
+ p << MathTypeToMathML::Converter.new(equation).convert
14
+ end
15
+ expected_xml = "#{File.basename(equation, ".*")}.xml"
16
+ expected = File.open("spec/fixtures/expected/" + expected_xml).read
17
+ div.p "Expected", "style" => "text-align: center;"
18
+ div.p do |p|
19
+ p << expected
20
+ end
21
+ div.hr
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ puts builder.to_html
@@ -0,0 +1,16 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe MathTypeToMathML do
4
+ it 'has a version number' do
5
+ expect(MathTypeToMathML::VERSION).not_to be nil
6
+ end
7
+
8
+ Dir.glob("spec/fixtures/input/*.bin") do |equation|
9
+ it "converted #{equation} matches expected output" do
10
+ xml = MathTypeToMathML::Converter.new(equation).convert
11
+ expected_xml = "#{File.basename(equation, ".*")}.xml"
12
+ expected = File.open("spec/fixtures/expected/" + expected_xml).read
13
+ expect(xml).to be_equivalent_to(expected)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,4 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'mathtype_to_mathml'
3
+ require 'rspec/matchers'
4
+ require 'equivalent-xml'
metadata ADDED
@@ -0,0 +1,305 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mathtype_to_mathml_plus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.8
5
+ platform: ruby
6
+ authors:
7
+ - Jure Triglav
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: bundler
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.7'
19
+ type: :development
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '1.7'
26
+ - !ruby/object:Gem::Dependency
27
+ name: rake
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '10.0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '10.0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: rspec
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.3'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.3'
54
+ - !ruby/object:Gem::Dependency
55
+ name: pry
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0.10'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '0.10'
68
+ - !ruby/object:Gem::Dependency
69
+ name: equivalent-xml
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '0.6'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0.6'
82
+ - !ruby/object:Gem::Dependency
83
+ name: nokogiri
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.6'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '1.6'
96
+ - !ruby/object:Gem::Dependency
97
+ name: mathtype
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: 0.0.8
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: 0.0.8
110
+ description: This gem can be used to convert MathType equations from a binary format
111
+ (e.g. embedded in Word documents) to an open MathML representation. It achieves
112
+ that in several stages, first using the "mathtype" gem to convert from a binary
113
+ to an XML form of MTEF, and second, using XSLTs to convert XML to MathML.
114
+ email:
115
+ - juretriglav@gmail.com
116
+ executables: []
117
+ extensions: []
118
+ extra_rdoc_files: []
119
+ files:
120
+ - ".gitignore"
121
+ - ".rspec"
122
+ - ".ruby-version"
123
+ - ".travis.yml"
124
+ - Gemfile
125
+ - LICENSE.txt
126
+ - README.md
127
+ - Rakefile
128
+ - lib/mathtype_to_mathml.rb
129
+ - lib/mathtype_to_mathml/char_replacer.rb
130
+ - lib/mathtype_to_mathml/mover.rb
131
+ - lib/mathtype_to_mathml/version.rb
132
+ - lib/transform.xsl
133
+ - lib/xsl/arrow.xsl
134
+ - lib/xsl/box.xsl
135
+ - lib/xsl/char.xsl
136
+ - lib/xsl/embellishment.xsl
137
+ - lib/xsl/fence.xsl
138
+ - lib/xsl/frac.xsl
139
+ - lib/xsl/int.xsl
140
+ - lib/xsl/lim.xsl
141
+ - lib/xsl/long_division.xsl
142
+ - lib/xsl/long_embellishment.xsl
143
+ - lib/xsl/matrix.xsl
144
+ - lib/xsl/pile.xsl
145
+ - lib/xsl/product_coproduct.xsl
146
+ - lib/xsl/subsup.xsl
147
+ - lib/xsl/sum.xsl
148
+ - lib/xsl/union_intersection.xsl
149
+ - mathtype_to_mathml.gemspec
150
+ - spec/fixtures/expected/280.xml
151
+ - spec/fixtures/expected/281.xml
152
+ - spec/fixtures/expected/299.xml
153
+ - spec/fixtures/expected/326.xml
154
+ - spec/fixtures/expected/424.xml
155
+ - spec/fixtures/expected/450.xml
156
+ - spec/fixtures/expected/452.xml
157
+ - spec/fixtures/expected/478.xml
158
+ - spec/fixtures/expected/629.xml
159
+ - spec/fixtures/expected/arrows.xml
160
+ - spec/fixtures/expected/boxes.xml
161
+ - spec/fixtures/expected/embellishments.xml
162
+ - spec/fixtures/expected/embellishments_roots_long_divisions.xml
163
+ - spec/fixtures/expected/equation1.xml
164
+ - spec/fixtures/expected/equation10.xml
165
+ - spec/fixtures/expected/equation11.xml
166
+ - spec/fixtures/expected/equation12.xml
167
+ - spec/fixtures/expected/equation13.xml
168
+ - spec/fixtures/expected/equation14.xml
169
+ - spec/fixtures/expected/equation2.xml
170
+ - spec/fixtures/expected/equation3.xml
171
+ - spec/fixtures/expected/equation4.xml
172
+ - spec/fixtures/expected/equation5.xml
173
+ - spec/fixtures/expected/equation6.xml
174
+ - spec/fixtures/expected/equation7.xml
175
+ - spec/fixtures/expected/equation8.xml
176
+ - spec/fixtures/expected/equation9.xml
177
+ - spec/fixtures/expected/fences.xml
178
+ - spec/fixtures/expected/integrals.xml
179
+ - spec/fixtures/expected/matrices.xml
180
+ - spec/fixtures/expected/sums.xml
181
+ - spec/fixtures/expected/unions_and_intersections.xml
182
+ - spec/fixtures/input/280.bin
183
+ - spec/fixtures/input/281.bin
184
+ - spec/fixtures/input/299.bin
185
+ - spec/fixtures/input/326.bin
186
+ - spec/fixtures/input/424.bin
187
+ - spec/fixtures/input/450.bin
188
+ - spec/fixtures/input/452.bin
189
+ - spec/fixtures/input/478.bin
190
+ - spec/fixtures/input/629.bin
191
+ - spec/fixtures/input/arrows.bin
192
+ - spec/fixtures/input/boxes.bin
193
+ - spec/fixtures/input/embellishments.bin
194
+ - spec/fixtures/input/embellishments_roots_long_divisions.bin
195
+ - spec/fixtures/input/equation1.bin
196
+ - spec/fixtures/input/equation10.bin
197
+ - spec/fixtures/input/equation11.bin
198
+ - spec/fixtures/input/equation12.bin
199
+ - spec/fixtures/input/equation13.bin
200
+ - spec/fixtures/input/equation14.bin
201
+ - spec/fixtures/input/equation2.bin
202
+ - spec/fixtures/input/equation3.bin
203
+ - spec/fixtures/input/equation4.bin
204
+ - spec/fixtures/input/equation5.bin
205
+ - spec/fixtures/input/equation6.bin
206
+ - spec/fixtures/input/equation7.bin
207
+ - spec/fixtures/input/equation8.bin
208
+ - spec/fixtures/input/equation9.bin
209
+ - spec/fixtures/input/fences.bin
210
+ - spec/fixtures/input/integrals.bin
211
+ - spec/fixtures/input/matrices.bin
212
+ - spec/fixtures/input/sums.bin
213
+ - spec/fixtures/input/unions_and_intersections.bin
214
+ - spec/html_output.rb
215
+ - spec/mathtype_to_mathml_spec.rb
216
+ - spec/spec_helper.rb
217
+ homepage: ''
218
+ licenses:
219
+ - MIT
220
+ metadata: {}
221
+ rdoc_options: []
222
+ require_paths:
223
+ - lib
224
+ required_ruby_version: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - ">="
227
+ - !ruby/object:Gem::Version
228
+ version: '0'
229
+ required_rubygems_version: !ruby/object:Gem::Requirement
230
+ requirements:
231
+ - - ">="
232
+ - !ruby/object:Gem::Version
233
+ version: '0'
234
+ requirements: []
235
+ rubygems_version: 3.6.7
236
+ specification_version: 4
237
+ summary: Converts from a binary MathType format (MTEF) to MathML.
238
+ test_files:
239
+ - spec/fixtures/expected/280.xml
240
+ - spec/fixtures/expected/281.xml
241
+ - spec/fixtures/expected/299.xml
242
+ - spec/fixtures/expected/326.xml
243
+ - spec/fixtures/expected/424.xml
244
+ - spec/fixtures/expected/450.xml
245
+ - spec/fixtures/expected/452.xml
246
+ - spec/fixtures/expected/478.xml
247
+ - spec/fixtures/expected/629.xml
248
+ - spec/fixtures/expected/arrows.xml
249
+ - spec/fixtures/expected/boxes.xml
250
+ - spec/fixtures/expected/embellishments.xml
251
+ - spec/fixtures/expected/embellishments_roots_long_divisions.xml
252
+ - spec/fixtures/expected/equation1.xml
253
+ - spec/fixtures/expected/equation10.xml
254
+ - spec/fixtures/expected/equation11.xml
255
+ - spec/fixtures/expected/equation12.xml
256
+ - spec/fixtures/expected/equation13.xml
257
+ - spec/fixtures/expected/equation14.xml
258
+ - spec/fixtures/expected/equation2.xml
259
+ - spec/fixtures/expected/equation3.xml
260
+ - spec/fixtures/expected/equation4.xml
261
+ - spec/fixtures/expected/equation5.xml
262
+ - spec/fixtures/expected/equation6.xml
263
+ - spec/fixtures/expected/equation7.xml
264
+ - spec/fixtures/expected/equation8.xml
265
+ - spec/fixtures/expected/equation9.xml
266
+ - spec/fixtures/expected/fences.xml
267
+ - spec/fixtures/expected/integrals.xml
268
+ - spec/fixtures/expected/matrices.xml
269
+ - spec/fixtures/expected/sums.xml
270
+ - spec/fixtures/expected/unions_and_intersections.xml
271
+ - spec/fixtures/input/280.bin
272
+ - spec/fixtures/input/281.bin
273
+ - spec/fixtures/input/299.bin
274
+ - spec/fixtures/input/326.bin
275
+ - spec/fixtures/input/424.bin
276
+ - spec/fixtures/input/450.bin
277
+ - spec/fixtures/input/452.bin
278
+ - spec/fixtures/input/478.bin
279
+ - spec/fixtures/input/629.bin
280
+ - spec/fixtures/input/arrows.bin
281
+ - spec/fixtures/input/boxes.bin
282
+ - spec/fixtures/input/embellishments.bin
283
+ - spec/fixtures/input/embellishments_roots_long_divisions.bin
284
+ - spec/fixtures/input/equation1.bin
285
+ - spec/fixtures/input/equation10.bin
286
+ - spec/fixtures/input/equation11.bin
287
+ - spec/fixtures/input/equation12.bin
288
+ - spec/fixtures/input/equation13.bin
289
+ - spec/fixtures/input/equation14.bin
290
+ - spec/fixtures/input/equation2.bin
291
+ - spec/fixtures/input/equation3.bin
292
+ - spec/fixtures/input/equation4.bin
293
+ - spec/fixtures/input/equation5.bin
294
+ - spec/fixtures/input/equation6.bin
295
+ - spec/fixtures/input/equation7.bin
296
+ - spec/fixtures/input/equation8.bin
297
+ - spec/fixtures/input/equation9.bin
298
+ - spec/fixtures/input/fences.bin
299
+ - spec/fixtures/input/integrals.bin
300
+ - spec/fixtures/input/matrices.bin
301
+ - spec/fixtures/input/sums.bin
302
+ - spec/fixtures/input/unions_and_intersections.bin
303
+ - spec/html_output.rb
304
+ - spec/mathtype_to_mathml_spec.rb
305
+ - spec/spec_helper.rb