mathtype 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +40 -0
  7. data/Rakefile +2 -0
  8. data/lib/mathtype/version.rb +3 -0
  9. data/lib/mathtype.rb +61 -0
  10. data/lib/records/char.rb +84 -0
  11. data/lib/records/color.rb +13 -0
  12. data/lib/records/color_def.rb +37 -0
  13. data/lib/records/embell.rb +103 -0
  14. data/lib/records/encoding_def.rb +22 -0
  15. data/lib/records/end.rb +8 -0
  16. data/lib/records/eqn_prefs.rb +44 -0
  17. data/lib/records/font_def.rb +14 -0
  18. data/lib/records/font_style_def.rb +14 -0
  19. data/lib/records/future.rb +14 -0
  20. data/lib/records/line.rb +36 -0
  21. data/lib/records/matrix.rb +41 -0
  22. data/lib/records/mtef.rb +118 -0
  23. data/lib/records/nudge.rb +34 -0
  24. data/lib/records/pile.rb +28 -0
  25. data/lib/records/ruler.rb +22 -0
  26. data/lib/records/size.rb +44 -0
  27. data/lib/records/snapshot.rb +19 -0
  28. data/lib/records/tmpl.rb +449 -0
  29. data/lib/records/typesizes.rb +24 -0
  30. data/mathtype.gemspec +28 -0
  31. data/spec/fixtures/expected/embelishments.xml +848 -0
  32. data/spec/fixtures/expected/equation1.xml +492 -0
  33. data/spec/fixtures/expected/equation10.xml +369 -0
  34. data/spec/fixtures/expected/equation11.xml +370 -0
  35. data/spec/fixtures/expected/equation12.xml +433 -0
  36. data/spec/fixtures/expected/equation13.xml +680 -0
  37. data/spec/fixtures/expected/equation2.xml +429 -0
  38. data/spec/fixtures/expected/equation3.xml +1374 -0
  39. data/spec/fixtures/expected/equation4.xml +360 -0
  40. data/spec/fixtures/expected/equation5.xml +377 -0
  41. data/spec/fixtures/expected/equation6.xml +364 -0
  42. data/spec/fixtures/expected/equation7.xml +369 -0
  43. data/spec/fixtures/expected/equation8.xml +362 -0
  44. data/spec/fixtures/expected/equation9.xml +355 -0
  45. data/spec/fixtures/input/embelishments.bin +0 -0
  46. data/spec/fixtures/input/equation1.bin +0 -0
  47. data/spec/fixtures/input/equation10.bin +0 -0
  48. data/spec/fixtures/input/equation11.bin +0 -0
  49. data/spec/fixtures/input/equation12.bin +0 -0
  50. data/spec/fixtures/input/equation13.bin +0 -0
  51. data/spec/fixtures/input/equation2.bin +0 -0
  52. data/spec/fixtures/input/equation3.bin +0 -0
  53. data/spec/fixtures/input/equation4.bin +0 -0
  54. data/spec/fixtures/input/equation5.bin +0 -0
  55. data/spec/fixtures/input/equation6.bin +0 -0
  56. data/spec/fixtures/input/equation7.bin +0 -0
  57. data/spec/fixtures/input/equation8.bin +0 -0
  58. data/spec/fixtures/input/equation9.bin +0 -0
  59. data/spec/mathtype_spec.rb +16 -0
  60. data/spec/spec_helper.rb +64 -0
  61. metadata +233 -0
@@ -0,0 +1,355 @@
1
+ <?xml version="1.0"?>
2
+ <root>
3
+ <mtef>
4
+ <mtef_version>5</mtef_version>
5
+ <platform>0</platform>
6
+ <product>0</product>
7
+ <product_version>6</product_version>
8
+ <product_subversion>7</product_subversion>
9
+ <application_key>DSMT6</application_key>
10
+ <equation_options>0</equation_options>
11
+ <future>
12
+ <skip>3</skip>
13
+ </future>
14
+ <encoding_def>
15
+ <name>MacRoman</name>
16
+ </encoding_def>
17
+ <font_def>
18
+ <enc_def_index>5</enc_def_index>
19
+ <font_name>Cambria</font_name>
20
+ </font_def>
21
+ <font_def>
22
+ <enc_def_index>3</enc_def_index>
23
+ <font_name>Symbol</font_name>
24
+ </font_def>
25
+ <font_def>
26
+ <enc_def_index>5</enc_def_index>
27
+ <font_name>Courier</font_name>
28
+ </font_def>
29
+ <font_def>
30
+ <enc_def_index>4</enc_def_index>
31
+ <font_name>MT Extra</font_name>
32
+ </font_def>
33
+ <eqn_prefs>
34
+ <options>0</options>
35
+ <sizes_count>8</sizes_count>
36
+ <sizes>
37
+ <unit>2</unit>
38
+ <nibbles>1</nibbles>
39
+ <nibbles>2</nibbles>
40
+ <nibbles>15</nibbles>
41
+ </sizes>
42
+ <sizes>
43
+ <unit>4</unit>
44
+ <nibbles>5</nibbles>
45
+ <nibbles>8</nibbles>
46
+ <nibbles>15</nibbles>
47
+ </sizes>
48
+ <sizes>
49
+ <unit>4</unit>
50
+ <nibbles>4</nibbles>
51
+ <nibbles>2</nibbles>
52
+ <nibbles>15</nibbles>
53
+ </sizes>
54
+ <sizes>
55
+ <unit>4</unit>
56
+ <nibbles>1</nibbles>
57
+ <nibbles>5</nibbles>
58
+ <nibbles>0</nibbles>
59
+ <nibbles>15</nibbles>
60
+ </sizes>
61
+ <sizes>
62
+ <unit>1</unit>
63
+ <nibbles>0</nibbles>
64
+ <nibbles>0</nibbles>
65
+ <nibbles>15</nibbles>
66
+ </sizes>
67
+ <sizes>
68
+ <unit>4</unit>
69
+ <nibbles>7</nibbles>
70
+ <nibbles>5</nibbles>
71
+ <nibbles>15</nibbles>
72
+ </sizes>
73
+ <sizes>
74
+ <unit>4</unit>
75
+ <nibbles>1</nibbles>
76
+ <nibbles>5</nibbles>
77
+ <nibbles>0</nibbles>
78
+ <nibbles>15</nibbles>
79
+ </sizes>
80
+ <sizes>
81
+ <unit>1</unit>
82
+ <nibbles>15</nibbles>
83
+ </sizes>
84
+ <spaces_count>33</spaces_count>
85
+ <spaces>
86
+ <unit>4</unit>
87
+ <nibbles>1</nibbles>
88
+ <nibbles>5</nibbles>
89
+ <nibbles>0</nibbles>
90
+ <nibbles>15</nibbles>
91
+ </spaces>
92
+ <spaces>
93
+ <unit>1</unit>
94
+ <nibbles>5</nibbles>
95
+ <nibbles>0</nibbles>
96
+ <nibbles>15</nibbles>
97
+ </spaces>
98
+ <spaces>
99
+ <unit>4</unit>
100
+ <nibbles>1</nibbles>
101
+ <nibbles>0</nibbles>
102
+ <nibbles>0</nibbles>
103
+ <nibbles>15</nibbles>
104
+ </spaces>
105
+ <spaces>
106
+ <unit>4</unit>
107
+ <nibbles>5</nibbles>
108
+ <nibbles>15</nibbles>
109
+ </spaces>
110
+ <spaces>
111
+ <unit>2</unit>
112
+ <nibbles>5</nibbles>
113
+ <nibbles>15</nibbles>
114
+ </spaces>
115
+ <spaces>
116
+ <unit>8</unit>
117
+ <nibbles>15</nibbles>
118
+ </spaces>
119
+ <spaces>
120
+ <unit>4</unit>
121
+ <nibbles>2</nibbles>
122
+ <nibbles>5</nibbles>
123
+ <nibbles>15</nibbles>
124
+ </spaces>
125
+ <spaces>
126
+ <unit>4</unit>
127
+ <nibbles>1</nibbles>
128
+ <nibbles>0</nibbles>
129
+ <nibbles>0</nibbles>
130
+ <nibbles>15</nibbles>
131
+ </spaces>
132
+ <spaces>
133
+ <unit>1</unit>
134
+ <nibbles>0</nibbles>
135
+ <nibbles>0</nibbles>
136
+ <nibbles>15</nibbles>
137
+ </spaces>
138
+ <spaces>
139
+ <unit>4</unit>
140
+ <nibbles>3</nibbles>
141
+ <nibbles>5</nibbles>
142
+ <nibbles>15</nibbles>
143
+ </spaces>
144
+ <spaces>
145
+ <unit>4</unit>
146
+ <nibbles>1</nibbles>
147
+ <nibbles>0</nibbles>
148
+ <nibbles>0</nibbles>
149
+ <nibbles>15</nibbles>
150
+ </spaces>
151
+ <spaces>
152
+ <unit>8</unit>
153
+ <nibbles>15</nibbles>
154
+ </spaces>
155
+ <spaces>
156
+ <unit>4</unit>
157
+ <nibbles>5</nibbles>
158
+ <nibbles>15</nibbles>
159
+ </spaces>
160
+ <spaces>
161
+ <unit>2</unit>
162
+ <nibbles>10</nibbles>
163
+ <nibbles>5</nibbles>
164
+ <nibbles>15</nibbles>
165
+ </spaces>
166
+ <spaces>
167
+ <unit>4</unit>
168
+ <nibbles>8</nibbles>
169
+ <nibbles>15</nibbles>
170
+ </spaces>
171
+ <spaces>
172
+ <unit>8</unit>
173
+ <nibbles>15</nibbles>
174
+ </spaces>
175
+ <spaces>
176
+ <unit>4</unit>
177
+ <nibbles>1</nibbles>
178
+ <nibbles>0</nibbles>
179
+ <nibbles>0</nibbles>
180
+ <nibbles>15</nibbles>
181
+ </spaces>
182
+ <spaces>
183
+ <unit>1</unit>
184
+ <nibbles>0</nibbles>
185
+ <nibbles>0</nibbles>
186
+ <nibbles>15</nibbles>
187
+ </spaces>
188
+ <spaces>
189
+ <unit>4</unit>
190
+ <nibbles>0</nibbles>
191
+ <nibbles>15</nibbles>
192
+ </spaces>
193
+ <spaces>
194
+ <unit>8</unit>
195
+ <nibbles>15</nibbles>
196
+ </spaces>
197
+ <spaces>
198
+ <unit>4</unit>
199
+ <nibbles>1</nibbles>
200
+ <nibbles>7</nibbles>
201
+ <nibbles>15</nibbles>
202
+ </spaces>
203
+ <spaces>
204
+ <unit>4</unit>
205
+ <nibbles>8</nibbles>
206
+ <nibbles>15</nibbles>
207
+ </spaces>
208
+ <spaces>
209
+ <unit>1</unit>
210
+ <nibbles>0</nibbles>
211
+ <nibbles>0</nibbles>
212
+ <nibbles>15</nibbles>
213
+ </spaces>
214
+ <spaces>
215
+ <unit>4</unit>
216
+ <nibbles>1</nibbles>
217
+ <nibbles>2</nibbles>
218
+ <nibbles>10</nibbles>
219
+ <nibbles>5</nibbles>
220
+ <nibbles>15</nibbles>
221
+ </spaces>
222
+ <spaces>
223
+ <unit>4</unit>
224
+ <nibbles>4</nibbles>
225
+ <nibbles>5</nibbles>
226
+ <nibbles>15</nibbles>
227
+ </spaces>
228
+ <spaces>
229
+ <unit>4</unit>
230
+ <nibbles>5</nibbles>
231
+ <nibbles>15</nibbles>
232
+ </spaces>
233
+ <spaces>
234
+ <unit>5</unit>
235
+ <nibbles>15</nibbles>
236
+ </spaces>
237
+ <spaces>
238
+ <unit>4</unit>
239
+ <nibbles>5</nibbles>
240
+ <nibbles>15</nibbles>
241
+ </spaces>
242
+ <spaces>
243
+ <unit>5</unit>
244
+ <nibbles>15</nibbles>
245
+ </spaces>
246
+ <spaces>
247
+ <unit>4</unit>
248
+ <nibbles>1</nibbles>
249
+ <nibbles>0</nibbles>
250
+ <nibbles>15</nibbles>
251
+ </spaces>
252
+ <spaces>
253
+ <unit>4</unit>
254
+ <nibbles>2</nibbles>
255
+ <nibbles>0</nibbles>
256
+ <nibbles>15</nibbles>
257
+ </spaces>
258
+ <spaces>
259
+ <unit>4</unit>
260
+ <nibbles>2</nibbles>
261
+ <nibbles>0</nibbles>
262
+ <nibbles>15</nibbles>
263
+ </spaces>
264
+ <spaces>
265
+ <unit>4</unit>
266
+ <nibbles>2</nibbles>
267
+ <nibbles>0</nibbles>
268
+ <nibbles>15</nibbles>
269
+ </spaces>
270
+ <styles_count>12</styles_count>
271
+ <styles>
272
+ <font_def>1</font_def>
273
+ <font_style>0</font_style>
274
+ </styles>
275
+ <styles>
276
+ <font_def>1</font_def>
277
+ <font_style>0</font_style>
278
+ </styles>
279
+ <styles>
280
+ <font_def>1</font_def>
281
+ <font_style>2</font_style>
282
+ </styles>
283
+ <styles>
284
+ <font_def>2</font_def>
285
+ <font_style>2</font_style>
286
+ </styles>
287
+ <styles>
288
+ <font_def>2</font_def>
289
+ <font_style>0</font_style>
290
+ </styles>
291
+ <styles>
292
+ <font_def>2</font_def>
293
+ <font_style>0</font_style>
294
+ </styles>
295
+ <styles>
296
+ <font_def>1</font_def>
297
+ <font_style>1</font_style>
298
+ </styles>
299
+ <styles>
300
+ <font_def>1</font_def>
301
+ <font_style>0</font_style>
302
+ </styles>
303
+ <styles>
304
+ <font_def>3</font_def>
305
+ <font_style>0</font_style>
306
+ </styles>
307
+ <styles>
308
+ <font_def>1</font_def>
309
+ <font_style>0</font_style>
310
+ </styles>
311
+ <styles>
312
+ <font_def>4</font_def>
313
+ <font_style>0</font_style>
314
+ </styles>
315
+ <styles>
316
+ <font_def>0</font_def>
317
+ </styles>
318
+ </eqn_prefs>
319
+ <full/>
320
+ <slot>
321
+ <options>0</options>
322
+ <tmpl>
323
+ <selector>tmUNION</selector>
324
+ <variation>tvBO_INT</variation>
325
+ <template_specific_options>0</template_specific_options>
326
+ <slot>
327
+ <options>0</options>
328
+ <char>
329
+ <typeface>3</typeface>
330
+ <mt_code_value>0x0073</mt_code_value>
331
+ <options>0</options>
332
+ </char>
333
+ <end/>
334
+ </slot>
335
+ <sub/>
336
+ <slot>
337
+ <options>1</options>
338
+ </slot>
339
+ <slot>
340
+ <options>1</options>
341
+ </slot>
342
+ <sym/>
343
+ <char>
344
+ <typeface>11</typeface>
345
+ <mt_code_value>0x222A</mt_code_value>
346
+ <options>4</options>
347
+ <font_position>85</font_position>
348
+ </char>
349
+ <end/>
350
+ </tmpl>
351
+ <end/>
352
+ </slot>
353
+ <end/>
354
+ </mtef>
355
+ </root>
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,16 @@
1
+ require "spec_helper"
2
+
3
+ require "pry"
4
+ RSpec.describe Mathtype do
5
+ Dir.glob("spec/fixtures/input/*.bin") do |equation|
6
+ it "converted #{equation} matches expected output" do
7
+ xml = Mathtype::Converter.new(equation).to_xml
8
+ expected_xml = "#{File.basename(equation, ".*")}.xml"
9
+ # File.open("spec/fixtures/expected/" + expected_xml, "w+") do |file|
10
+ # file.write xml
11
+ # end
12
+ expected = File.open("spec/fixtures/expected/" + expected_xml).read
13
+ expect(xml).to eq(expected)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,64 @@
1
+ require "bindata"
2
+ require "ole/storage"
3
+ require "nokogiri"
4
+ require "mathtype"
5
+
6
+ RSpec.configure do |config|
7
+ config.expect_with :rspec do |expectations|
8
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
9
+ end
10
+
11
+ config.mock_with :rspec do |mocks|
12
+ mocks.verify_partial_doubles = true
13
+ end
14
+
15
+ # These two settings work together to allow you to limit a spec run
16
+ # to individual examples or groups you care about by tagging them with
17
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
18
+ # get run.
19
+ config.filter_run :focus
20
+ config.run_all_when_everything_filtered = true
21
+
22
+ # Allows RSpec to persist some state between runs in order to support
23
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
24
+ # you configure your source control system to ignore this file.
25
+ config.example_status_persistence_file_path = "spec/examples.txt"
26
+
27
+ # Limits the available syntax to the non-monkey patched syntax that is
28
+ # recommended. For more details, see:
29
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
30
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
31
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
32
+ config.disable_monkey_patching!
33
+
34
+ # This setting enables warnings. It's recommended, but in some cases may
35
+ # be too noisy due to issues in dependencies.
36
+ config.warnings = true
37
+
38
+ # Many RSpec users commonly either run the entire suite or an individual
39
+ # file, and it's useful to allow more verbose output when running an
40
+ # individual spec file.
41
+ if config.files_to_run.one?
42
+ # Use the documentation formatter for detailed output,
43
+ # unless a formatter has already been configured
44
+ # (e.g. via a command-line flag).
45
+ config.default_formatter = 'doc'
46
+ end
47
+
48
+ # Print the 10 slowest examples and example groups at the
49
+ # end of the spec run, to help surface which specs are running
50
+ # particularly slow.
51
+ config.profile_examples = 10
52
+
53
+ # Run specs in random order to surface order dependencies. If you find an
54
+ # order dependency and want to debug it, you can fix the order by providing
55
+ # the seed, which is printed after each run.
56
+ # --seed 1234
57
+ config.order = :random
58
+
59
+ # Seed global randomization in this process using the `--seed` CLI option.
60
+ # Setting this allows you to use `--seed` to deterministically reproduce
61
+ # test failures related to randomization by passing the same `--seed` value
62
+ # as the one that triggered the failure.
63
+ Kernel.srand config.seed
64
+ end