mathtype_to_mathml 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/lib/mathtype_to_mathml.rb +1 -1
  4. data/lib/mathtype_to_mathml/char_replacer.rb +60 -5
  5. data/lib/mathtype_to_mathml/version.rb +1 -1
  6. data/lib/transform.xsl +20 -41
  7. data/lib/xsl/box.xsl +42 -0
  8. data/lib/xsl/char.xsl +1820 -1
  9. data/lib/xsl/fence.xsl +228 -0
  10. data/lib/xsl/frac.xsl +46 -0
  11. data/lib/xsl/int.xsl +622 -0
  12. data/lib/xsl/lim.xsl +32 -0
  13. data/lib/xsl/product_coproduct.xsl +107 -0
  14. data/lib/xsl/sum.xsl +24 -0
  15. data/mathtype_to_mathml.gemspec +1 -1
  16. data/spec/fixtures/expected/280.xml +122 -0
  17. data/spec/fixtures/expected/281.xml +61 -0
  18. data/spec/fixtures/expected/299.xml +70 -0
  19. data/spec/fixtures/expected/326.xml +173 -0
  20. data/spec/fixtures/expected/424.xml +425 -0
  21. data/spec/fixtures/expected/450.xml +174 -0
  22. data/spec/fixtures/expected/452.xml +166 -0
  23. data/spec/fixtures/expected/478.xml +303 -0
  24. data/spec/fixtures/expected/boxes.xml +22 -0
  25. data/spec/fixtures/expected/equation14.xml +54 -0
  26. data/spec/fixtures/expected/fences.xml +64 -0
  27. data/spec/fixtures/expected/integrals.xml +264 -0
  28. data/spec/fixtures/expected/sums.xml +36 -0
  29. data/spec/fixtures/expected/unions_and_intersections.xml +140 -0
  30. data/spec/fixtures/input/280.bin +0 -0
  31. data/spec/fixtures/input/281.bin +0 -0
  32. data/spec/fixtures/input/299.bin +0 -0
  33. data/spec/fixtures/input/326.bin +0 -0
  34. data/spec/fixtures/input/424.bin +0 -0
  35. data/spec/fixtures/input/450.bin +0 -0
  36. data/spec/fixtures/input/452.bin +0 -0
  37. data/spec/fixtures/input/478.bin +0 -0
  38. data/spec/fixtures/input/boxes.bin +0 -0
  39. data/spec/fixtures/input/equation14.bin +0 -0
  40. data/spec/fixtures/input/fences.bin +0 -0
  41. data/spec/fixtures/input/integrals.bin +0 -0
  42. data/spec/fixtures/input/sums.bin +0 -0
  43. data/spec/fixtures/input/unions_and_intersections.bin +0 -0
  44. metadata +66 -5
  45. data/lib/xsl/brace.xsl +0 -55
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
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mathtype_to_mathml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - PLOS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-18 00:00:00.000000000 Z
11
+ date: 2015-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.0.5
89
+ version: 0.0.6
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.0.5
96
+ version: 0.0.6
97
97
  description: This gem can be used to convert MathType equations from a binary format
98
98
  (e.g. embedded in Word documents) to an open MathML representation. It achieves
99
99
  that in several stages, first using the "mathtype" gem to convert from a binary
@@ -118,22 +118,37 @@ files:
118
118
  - lib/mathtype_to_mathml/version.rb
119
119
  - lib/transform.xsl
120
120
  - lib/xsl/arrow.xsl
121
- - lib/xsl/brace.xsl
121
+ - lib/xsl/box.xsl
122
122
  - lib/xsl/char.xsl
123
123
  - lib/xsl/embellishment.xsl
124
+ - lib/xsl/fence.xsl
125
+ - lib/xsl/frac.xsl
126
+ - lib/xsl/int.xsl
127
+ - lib/xsl/lim.xsl
124
128
  - lib/xsl/matrix.xsl
125
129
  - lib/xsl/pile.xsl
130
+ - lib/xsl/product_coproduct.xsl
126
131
  - lib/xsl/subsup.xsl
127
132
  - lib/xsl/sum.xsl
128
133
  - lib/xsl/union_intersection.xsl
129
134
  - mathtype_to_mathml.gemspec
135
+ - spec/fixtures/expected/280.xml
136
+ - spec/fixtures/expected/281.xml
137
+ - spec/fixtures/expected/299.xml
138
+ - spec/fixtures/expected/326.xml
139
+ - spec/fixtures/expected/424.xml
140
+ - spec/fixtures/expected/450.xml
141
+ - spec/fixtures/expected/452.xml
142
+ - spec/fixtures/expected/478.xml
130
143
  - spec/fixtures/expected/arrows.xml
144
+ - spec/fixtures/expected/boxes.xml
131
145
  - spec/fixtures/expected/embellishments.xml
132
146
  - spec/fixtures/expected/equation1.xml
133
147
  - spec/fixtures/expected/equation10.xml
134
148
  - spec/fixtures/expected/equation11.xml
135
149
  - spec/fixtures/expected/equation12.xml
136
150
  - spec/fixtures/expected/equation13.xml
151
+ - spec/fixtures/expected/equation14.xml
137
152
  - spec/fixtures/expected/equation2.xml
138
153
  - spec/fixtures/expected/equation3.xml
139
154
  - spec/fixtures/expected/equation4.xml
@@ -142,13 +157,27 @@ files:
142
157
  - spec/fixtures/expected/equation7.xml
143
158
  - spec/fixtures/expected/equation8.xml
144
159
  - spec/fixtures/expected/equation9.xml
160
+ - spec/fixtures/expected/fences.xml
161
+ - spec/fixtures/expected/integrals.xml
162
+ - spec/fixtures/expected/sums.xml
163
+ - spec/fixtures/expected/unions_and_intersections.xml
164
+ - spec/fixtures/input/280.bin
165
+ - spec/fixtures/input/281.bin
166
+ - spec/fixtures/input/299.bin
167
+ - spec/fixtures/input/326.bin
168
+ - spec/fixtures/input/424.bin
169
+ - spec/fixtures/input/450.bin
170
+ - spec/fixtures/input/452.bin
171
+ - spec/fixtures/input/478.bin
145
172
  - spec/fixtures/input/arrows.bin
173
+ - spec/fixtures/input/boxes.bin
146
174
  - spec/fixtures/input/embellishments.bin
147
175
  - spec/fixtures/input/equation1.bin
148
176
  - spec/fixtures/input/equation10.bin
149
177
  - spec/fixtures/input/equation11.bin
150
178
  - spec/fixtures/input/equation12.bin
151
179
  - spec/fixtures/input/equation13.bin
180
+ - spec/fixtures/input/equation14.bin
152
181
  - spec/fixtures/input/equation2.bin
153
182
  - spec/fixtures/input/equation3.bin
154
183
  - spec/fixtures/input/equation4.bin
@@ -157,6 +186,10 @@ files:
157
186
  - spec/fixtures/input/equation7.bin
158
187
  - spec/fixtures/input/equation8.bin
159
188
  - spec/fixtures/input/equation9.bin
189
+ - spec/fixtures/input/fences.bin
190
+ - spec/fixtures/input/integrals.bin
191
+ - spec/fixtures/input/sums.bin
192
+ - spec/fixtures/input/unions_and_intersections.bin
160
193
  - spec/html_output.rb
161
194
  - spec/mathtype_to_mathml_spec.rb
162
195
  - spec/spec_helper.rb
@@ -185,13 +218,23 @@ signing_key:
185
218
  specification_version: 4
186
219
  summary: Converts from a binary MathType format (MTEF) to MathML.
187
220
  test_files:
221
+ - spec/fixtures/expected/280.xml
222
+ - spec/fixtures/expected/281.xml
223
+ - spec/fixtures/expected/299.xml
224
+ - spec/fixtures/expected/326.xml
225
+ - spec/fixtures/expected/424.xml
226
+ - spec/fixtures/expected/450.xml
227
+ - spec/fixtures/expected/452.xml
228
+ - spec/fixtures/expected/478.xml
188
229
  - spec/fixtures/expected/arrows.xml
230
+ - spec/fixtures/expected/boxes.xml
189
231
  - spec/fixtures/expected/embellishments.xml
190
232
  - spec/fixtures/expected/equation1.xml
191
233
  - spec/fixtures/expected/equation10.xml
192
234
  - spec/fixtures/expected/equation11.xml
193
235
  - spec/fixtures/expected/equation12.xml
194
236
  - spec/fixtures/expected/equation13.xml
237
+ - spec/fixtures/expected/equation14.xml
195
238
  - spec/fixtures/expected/equation2.xml
196
239
  - spec/fixtures/expected/equation3.xml
197
240
  - spec/fixtures/expected/equation4.xml
@@ -200,13 +243,27 @@ test_files:
200
243
  - spec/fixtures/expected/equation7.xml
201
244
  - spec/fixtures/expected/equation8.xml
202
245
  - spec/fixtures/expected/equation9.xml
246
+ - spec/fixtures/expected/fences.xml
247
+ - spec/fixtures/expected/integrals.xml
248
+ - spec/fixtures/expected/sums.xml
249
+ - spec/fixtures/expected/unions_and_intersections.xml
250
+ - spec/fixtures/input/280.bin
251
+ - spec/fixtures/input/281.bin
252
+ - spec/fixtures/input/299.bin
253
+ - spec/fixtures/input/326.bin
254
+ - spec/fixtures/input/424.bin
255
+ - spec/fixtures/input/450.bin
256
+ - spec/fixtures/input/452.bin
257
+ - spec/fixtures/input/478.bin
203
258
  - spec/fixtures/input/arrows.bin
259
+ - spec/fixtures/input/boxes.bin
204
260
  - spec/fixtures/input/embellishments.bin
205
261
  - spec/fixtures/input/equation1.bin
206
262
  - spec/fixtures/input/equation10.bin
207
263
  - spec/fixtures/input/equation11.bin
208
264
  - spec/fixtures/input/equation12.bin
209
265
  - spec/fixtures/input/equation13.bin
266
+ - spec/fixtures/input/equation14.bin
210
267
  - spec/fixtures/input/equation2.bin
211
268
  - spec/fixtures/input/equation3.bin
212
269
  - spec/fixtures/input/equation4.bin
@@ -215,6 +272,10 @@ test_files:
215
272
  - spec/fixtures/input/equation7.bin
216
273
  - spec/fixtures/input/equation8.bin
217
274
  - spec/fixtures/input/equation9.bin
275
+ - spec/fixtures/input/fences.bin
276
+ - spec/fixtures/input/integrals.bin
277
+ - spec/fixtures/input/sums.bin
278
+ - spec/fixtures/input/unions_and_intersections.bin
218
279
  - spec/html_output.rb
219
280
  - spec/mathtype_to_mathml_spec.rb
220
281
  - spec/spec_helper.rb
data/lib/xsl/brace.xsl DELETED
@@ -1,55 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
4
- exclude-result-prefixes="xs"
5
- version="1.0">
6
-
7
- <!-- Braces -->
8
-
9
- <xsl:template match="tmpl[selector='tmBRACK' ]">
10
- <mrow><mo>[</mo>
11
- <xsl:apply-templates select="slot[1]"/> <mo>]</mo>
12
- </mrow>
13
- </xsl:template>
14
-
15
- <xsl:template match="tmpl[selector='tmBRACE' ]">
16
- <mrow><mo>{</mo>
17
- <xsl:apply-templates select="slot[1]"/> <mo>}</mo>
18
- </mrow>
19
- </xsl:template>
20
-
21
- <xsl:template match="tmpl[selector='tmANGLE' ]">
22
- <mrow><mo>&#x2329;</mo>
23
- <xsl:apply-templates select="slot[1]"/> <mo>&#x232A;</mo>
24
- </mrow>
25
- </xsl:template>
26
-
27
- <!-- Dirac -->
28
-
29
- <xsl:template match="tmpl[selector='tmDIRAC' and variation='tvDI_RIGHT']">
30
- <mrow>
31
- <mo>|</mo>
32
- <xsl:apply-templates select="slot[2]"/>
33
- <mo>&#x232A;</mo>
34
- </mrow>
35
- </xsl:template>
36
-
37
-
38
- <xsl:template match="tmpl[selector='tmDIRAC' and variation='tvDI_LEFT']">
39
- <mrow>
40
- <mo>&#x2329;</mo>
41
- <xsl:apply-templates select="slot[1]"/>
42
- <mo>|</mo>
43
- </mrow>
44
- </xsl:template>
45
-
46
- <xsl:template match="tmpl[selector='tmDIRAC' and variation='tvDI_LEFT' and variation='tvDI_RIGHT']">
47
- <mrow>
48
- <mo>&#x2329;</mo>
49
- <xsl:apply-templates select="slot[1]"/>
50
- <mo>|</mo>
51
- <xsl:apply-templates select="slot[2]"/>
52
- <mo>&#x232A;</mo>
53
- </mrow>
54
- </xsl:template>
55
- </xsl:stylesheet>