mathtype_to_mathml_plus 0.0.15 → 0.0.16

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3344bf9e6c8052be836d6baf6106ed81214dceea8bb1d82c9b0da1430df680f
4
- data.tar.gz: 9338fa3961432ed52d15931e0388751e49a3f470e52a33faafd32e03ea52d303
3
+ metadata.gz: 9b15fa0c05743919898a991a7a53c2b2d0da86a83e319fb5b8c5f255673fd038
4
+ data.tar.gz: ab7d0f026646fc4b99ea6b75ef9cc2e6bab6822567a9ea28d4b711ae5da965bf
5
5
  SHA512:
6
- metadata.gz: 7f5ed70bf8b5c326f86d9ea426856228e1046f785bb1f38ee7014ed92efe6656f5bfbebedb34981174bd1734f40749f61f2de677c5f4becab7100aca975d9198
7
- data.tar.gz: 04c763240a0cdc8a5ac63766d3cb318cfb1bcc31759414cc947106144fde33fadf90c2d39d2e1a3d254d4322b4eb8e8439209b832a3239a18bf99d8f221ce9f5
6
+ metadata.gz: da7f9b9cf127b7f187d60b42416007a3281f501bf19fd19631d29817641078b27c5232340a8e36d8fb043d88da965bd30f10a34670a083a3d543140f5e5c1bde
7
+ data.tar.gz: ec9ced8fa21cbb413dbb9759ac9e94cabe185cfc2300669cc63200502ae6edfdff8e6c79052df65ccae117350a0a7d1fb7ed6d83becc82c74662d3f3f15c532e
data/convert.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require_relative 'lib/mathtype_to_mathml_plus'
2
2
 
3
- converter = MathTypeToMathMLPlus::Converter.new("oleObject4.bin")
3
+ converter = MathTypeToMathMLPlus::Converter.new("oleObject55.bin")
4
4
  xml = converter.convert
5
5
 
6
6
  puts xml
@@ -22,7 +22,7 @@ module Mathtype
22
22
  data = Mathtype3::Equation.read(@parser.equation).snapshot
23
23
  when 5
24
24
  data = Mathtype5::Equation.read(@parser.equation).snapshot
25
- end
25
+ end
26
26
  @builder = Nokogiri::XML::Builder.new do |xml|
27
27
  @xml = xml
28
28
  xml.root do
@@ -76,11 +76,13 @@ module Mathtype
76
76
  end
77
77
 
78
78
  def process_final_element(element, object)
79
+ return if object == "left"
80
+
79
81
  if object.is_a? Hash
80
82
  xml.send(element, object)
81
83
  else
82
84
  xml.send(element) { xml.text object }
83
- end
84
85
  end
86
+ end
85
87
  end
86
88
  end
@@ -1,3 +1,3 @@
1
1
  module MathTypeToMathMLPlus
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  end
@@ -0,0 +1,24 @@
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
+ xmlns:tr="http://transpect.io"
5
+ exclude-result-prefixes="xs"
6
+ version="2.0">
7
+ <xsl:function name="tr:decToHex" as="xs:string">
8
+ <xsl:param name="dec" as="xs:decimal"/>
9
+ <xsl:variable name="mod" select="1 + ($dec mod 16)"/>
10
+ <xsl:variable name="char" select="substring('0123456789ABCDEF', $mod, 1)"/>
11
+ <xsl:value-of
12
+ select="
13
+ concat(if ($dec - 16 gt 0) then
14
+ tr:decToHex(floor($dec div 16))
15
+ else
16
+ if ($dec = 16) then
17
+ 1
18
+ else
19
+ '', $char)"
20
+ />
21
+
22
+ </xsl:function>
23
+
24
+ </xsl:stylesheet>
@@ -0,0 +1,34 @@
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
+ xmlns:tr="http://transpect.io"
5
+ exclude-result-prefixes="xs"
6
+ version="2.0">
7
+ <xsl:function name="tr:hexToDec">
8
+ <xsl:param name="hex"/>
9
+ <xsl:variable name="dec"
10
+ select="string-length(substring-before('0123456789ABCDEF', substring($hex,1,1)))"/>
11
+ <xsl:choose>
12
+ <xsl:when test="matches($hex, '([0-9]*|[A-F]*)')">
13
+ <xsl:value-of
14
+ select="if ($hex = '') then 0
15
+ else $dec * tr:power(16, string-length($hex) - 1) + tr:hexToDec(substring($hex,2))"/>
16
+ </xsl:when>
17
+ <xsl:otherwise>
18
+ <xsl:message>Provided value is not hexadecimal...</xsl:message>
19
+ <xsl:value-of select="$hex"/>
20
+ </xsl:otherwise>
21
+ </xsl:choose>
22
+ </xsl:function>
23
+
24
+ <xsl:function name="tr:power">
25
+ <xsl:param name="base"/>
26
+ <xsl:param name="exp"/>
27
+ <xsl:sequence
28
+ select="if ($exp lt 0) then tr:power(1.0 div $base, -$exp)
29
+ else if ($exp eq 0)
30
+ then 1e0
31
+ else $base * tr:power($base, $exp - 1)"
32
+ />
33
+ </xsl:function>
34
+ </xsl:stylesheet>
@@ -0,0 +1,13 @@
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
+ xmlns:tr="http://transpect.io"
5
+ exclude-result-prefixes="xs"
6
+ version="2.0">
7
+ <xsl:function name="tr:symbol-map-base-uri-to-name" as="xs:string">
8
+ <xsl:param name="symbols" as="document-node(element(symbols))"/>
9
+ <xsl:sequence
10
+ select="($symbols/symbols/@mathtype-name, translate(replace(base-uri($symbols/symbols), '^.+/([^./]+)\.xml$', '$1'), '_', ' '))[1]"
11
+ />
12
+ </xsl:function>
13
+ </xsl:stylesheet>
data/lib/xsl/char.xsl CHANGED
@@ -235,7 +235,7 @@
235
235
 
236
236
  <!-- UNSUPPORTED: DELETE -->
237
237
  <xsl:template match="char[mt_code_value='0x007F']">
238
- <xsl:text>Unsupported character</xsl:text>
238
+ <xsl:text></xsl:text>
239
239
  </xsl:template>
240
240
 
241
241
  <!-- range: Latin-1 Supplement -->
@@ -357,12 +357,12 @@
357
357
 
358
358
  <!-- UNSUPPORTED: EQUIVALENT TO OR GREATER-THAN -->
359
359
  <xsl:template match="char[mt_code_value='0xE923' and variation='mathmode']">
360
- <xsl:text>Unsupported character</xsl:text>
360
+ <xsl:text></xsl:text>
361
361
  </xsl:template>
362
362
 
363
363
  <!-- UNSUPPORTED: EQUIVALENT TO OR GREATER-THAN -->
364
364
  <xsl:template match="char[mt_code_value='0xE923' and variation='textmode']">
365
- <xsl:text>Unsupported character</xsl:text>
365
+ <xsl:text></xsl:text>
366
366
  </xsl:template>
367
367
 
368
368
  <!-- TILDE WITH DOT -->
@@ -382,7 +382,7 @@
382
382
 
383
383
  <!-- UNSUPPORTED: TILDE WITH TWO DOTS -->
384
384
  <xsl:template match="char[mt_code_value='0xE925' and variation='textmode']">
385
- <xsl:text>Unsupported character</xsl:text>
385
+ <xsl:text></xsl:text>
386
386
  </xsl:template>
387
387
 
388
388
  <!-- GREATER-THAN EQUAL TO (DOUBLE) OR LESS-THAN -->
@@ -752,12 +752,12 @@
752
752
 
753
753
  <!-- UNSUPPORTED: range: Private Use Area -->
754
754
  <xsl:template match="char[mt_code_value='0xEF07' and variation='mathmode']">
755
- <xsl:text>Unsupported character</xsl:text>
755
+ <xsl:text></xsl:text>
756
756
  </xsl:template>
757
757
 
758
758
  <!-- UNSUPPORTED: range: Private Use Area -->
759
759
  <xsl:template match="char[mt_code_value='0xEF07' and variation='textmode']">
760
- <xsl:text>Unsupported character</xsl:text>
760
+ <xsl:text></xsl:text>
761
761
  </xsl:template>
762
762
 
763
763
  <!-- MT 1 POINT SPACE -->
@@ -788,7 +788,7 @@
788
788
 
789
789
  <!-- UNSUPPORTED: range: Private Use Area -->
790
790
  <xsl:template match="char[mt_code_value='0xF002' and variation='mathmode']">
791
- <xsl:text>Unsupported character</xsl:text>
791
+ <xsl:text></xsl:text>
792
792
  </xsl:template>
793
793
 
794
794
  <!-- MATHEMATICAL FRAKTUR CAPITAL D -->
@@ -818,7 +818,7 @@
818
818
 
819
819
  <!-- UNSUPPORTED -->
820
820
  <xsl:template match="char[mt_code_value='0xF007' and variation='mathmode']">
821
- <xsl:text>Unsupported character</xsl:text>
821
+ <xsl:text></xsl:text>
822
822
  </xsl:template>
823
823
 
824
824
  <!-- MATHEMATICAL FRAKTUR CAPITAL I -->
@@ -828,7 +828,7 @@
828
828
 
829
829
  <!-- UNSUPPORTED -->
830
830
  <xsl:template match="char[mt_code_value='0xF008' and variation='mathmode']">
831
- <xsl:text>Unsupported character</xsl:text>
831
+ <xsl:text></xsl:text>
832
832
  </xsl:template>
833
833
  <!-- MATHEMATICAL FRAKTUR CAPITAL J -->
834
834
  <xsl:template match="char[mt_code_value='0xF009' and variation='mathmode']">
@@ -877,7 +877,7 @@
877
877
 
878
878
  <!-- UNSUPPORTED -->
879
879
  <xsl:template match="char[mt_code_value='0xF011' and variation='mathmode']">
880
- <xsl:text>Unsupported character</xsl:text>
880
+ <xsl:text></xsl:text>
881
881
  </xsl:template>
882
882
  <!-- MATHEMATICAL FRAKTUR CAPITAL S -->
883
883
  <xsl:template match="char[mt_code_value='0xF012' and variation='mathmode']">
@@ -921,7 +921,7 @@
921
921
 
922
922
  <!-- UNSUPPORTED -->
923
923
  <xsl:template match="char[mt_code_value='0xF019' and variation='mathmode']">
924
- <xsl:text>Unsupported character</xsl:text>
924
+ <xsl:text></xsl:text>
925
925
  </xsl:template>
926
926
  <!-- MATHEMATICAL FRAKTUR SMALL A -->
927
927
  <xsl:template match="char[mt_code_value='0xF01A' and variation='mathmode']">
@@ -1071,7 +1071,7 @@
1071
1071
 
1072
1072
  <!-- UNSUPPORTED -->
1073
1073
  <xsl:template match="char[mt_code_value='0xF082' and variation='mathmode']">
1074
- <xsl:text>Unsupported character</xsl:text>
1074
+ <xsl:text></xsl:text>
1075
1075
  </xsl:template>
1076
1076
  <!-- MATHEMATICAL DOUBLE-STRUCK CAPITAL D -->
1077
1077
  <xsl:template match="char[mt_code_value='0xF083' and variation='mathmode']">
@@ -1100,7 +1100,7 @@
1100
1100
 
1101
1101
  <!-- UNSUPPORTED -->
1102
1102
  <xsl:template match="char[mt_code_value='0xF087' and variation='mathmode']">
1103
- <xsl:text>Unsupported character</xsl:text>
1103
+ <xsl:text></xsl:text>
1104
1104
  </xsl:template>
1105
1105
  <!-- MATHEMATICAL DOUBLE-STRUCK CAPITAL I -->
1106
1106
  <xsl:template match="char[mt_code_value='0xF088' and variation='mathmode']">
@@ -1134,7 +1134,7 @@
1134
1134
 
1135
1135
  <!-- UNSUPPORTED -->
1136
1136
  <xsl:template match="char[mt_code_value='0xF08D' and variation='mathmode']">
1137
- <xsl:text>Unsupported character</xsl:text>
1137
+ <xsl:text></xsl:text>
1138
1138
  </xsl:template>
1139
1139
  <!-- MATHEMATICAL DOUBLE-STRUCK CAPITAL O -->
1140
1140
  <xsl:template match="char[mt_code_value='0xF08E' and variation='mathmode']">
@@ -1148,7 +1148,7 @@
1148
1148
 
1149
1149
  <!-- UNSUPPORTED -->
1150
1150
  <xsl:template match="char[mt_code_value='0xF08F' and variation='mathmode']">
1151
- <xsl:text>Unsupported character</xsl:text>
1151
+ <xsl:text></xsl:text>
1152
1152
  </xsl:template>
1153
1153
  <!-- MATHEMATICAL DOUBLE-STRUCK CAPITAL Q -->
1154
1154
  <xsl:template match="char[mt_code_value='0x211A' and variation='mathmode']">
@@ -1157,7 +1157,7 @@
1157
1157
 
1158
1158
  <!-- UNSUPPORTED -->
1159
1159
  <xsl:template match="char[mt_code_value='0xF090' and variation='mathmode']">
1160
- <xsl:text>Unsupported character</xsl:text>
1160
+ <xsl:text></xsl:text>
1161
1161
  </xsl:template>
1162
1162
 
1163
1163
  <!-- MATHEMATICAL DOUBLE-STRUCK CAPITAL R -->
@@ -1167,7 +1167,7 @@
1167
1167
 
1168
1168
  <!-- UNSUPPORTED -->
1169
1169
  <xsl:template match="char[mt_code_value='0xF091' and variation='mathmode']">
1170
- <xsl:text>Unsupported character</xsl:text>
1170
+ <xsl:text></xsl:text>
1171
1171
  </xsl:template>
1172
1172
 
1173
1173
  <!-- MATHEMATICAL DOUBLE-STRUCK CAPITAL S -->
@@ -1212,7 +1212,7 @@
1212
1212
 
1213
1213
  <!-- UNSUPPORTED -->
1214
1214
  <xsl:template match="char[mt_code_value='0xF099' and variation='mathmode']">
1215
- <xsl:text>Unsupported character</xsl:text>
1215
+ <xsl:text></xsl:text>
1216
1216
  </xsl:template>
1217
1217
 
1218
1218
  <!-- MATHEMATICAL DOUBLE-STRUCK SMALL A -->
@@ -1415,7 +1415,7 @@
1415
1415
 
1416
1416
  <!-- UNSUPPORTED -->
1417
1417
  <xsl:template match="char[mt_code_value='0xF101' and variation='mathmode']">
1418
- <xsl:text>Unsupported character</xsl:text>
1418
+ <xsl:text></xsl:text>
1419
1419
  </xsl:template>
1420
1420
 
1421
1421
  <!-- MATHEMATICAL SCRIPT CAPITAL C -->
@@ -1440,7 +1440,7 @@
1440
1440
 
1441
1441
  <!-- UNSUPPORTED -->
1442
1442
  <xsl:template match="char[mt_code_value='0xF104' and variation='mathmode']">
1443
- <xsl:text>Unsupported character</xsl:text>
1443
+ <xsl:text></xsl:text>
1444
1444
  </xsl:template>
1445
1445
 
1446
1446
  <!-- MATHEMATICAL SCRIPT CAPITAL F -->
@@ -1455,7 +1455,7 @@
1455
1455
 
1456
1456
  <!-- UNSUPPORTED -->
1457
1457
  <xsl:template match="char[mt_code_value='0xF105' and variation='mathmode']">
1458
- <xsl:text>Unsupported character</xsl:text>
1458
+ <xsl:text></xsl:text>
1459
1459
  </xsl:template>
1460
1460
 
1461
1461
  <!-- MATHEMATICAL SCRIPT CAPITAL G -->
@@ -1475,7 +1475,7 @@
1475
1475
 
1476
1476
  <!-- UNSUPPORTED -->
1477
1477
  <xsl:template match="char[mt_code_value='0xF107' and variation='mathmode']">
1478
- <xsl:text>Unsupported character</xsl:text>
1478
+ <xsl:text></xsl:text>
1479
1479
  </xsl:template>
1480
1480
 
1481
1481
  <!-- MATHEMATICAL SCRIPT CAPITAL I -->
@@ -1490,7 +1490,7 @@
1490
1490
 
1491
1491
  <!-- UNSUPPORTED -->
1492
1492
  <xsl:template match="char[mt_code_value='0xF108' and variation='mathmode']">
1493
- <xsl:text>Unsupported character</xsl:text>
1493
+ <xsl:text></xsl:text>
1494
1494
  </xsl:template>
1495
1495
 
1496
1496
  <!-- MATHEMATICAL SCRIPT CAPITAL J -->
@@ -1515,7 +1515,7 @@
1515
1515
 
1516
1516
  <!-- UNSUPPORTED -->
1517
1517
  <xsl:template match="char[mt_code_value='0xF10B' and variation='mathmode']">
1518
- <xsl:text>Unsupported character</xsl:text>
1518
+ <xsl:text></xsl:text>
1519
1519
  </xsl:template>
1520
1520
 
1521
1521
  <!-- MATHEMATICAL SCRIPT CAPITAL M -->
@@ -1530,7 +1530,7 @@
1530
1530
 
1531
1531
  <!-- UNSUPPORTED -->
1532
1532
  <xsl:template match="char[mt_code_value='0xF10C' and variation='mathmode']">
1533
- <xsl:text>Unsupported character</xsl:text>
1533
+ <xsl:text></xsl:text>
1534
1534
  </xsl:template>
1535
1535
 
1536
1536
  <!-- MATHEMATICAL SCRIPT CAPITAL N -->
@@ -1560,7 +1560,7 @@
1560
1560
 
1561
1561
  <!-- UNSUPPORTED -->
1562
1562
  <xsl:template match="char[mt_code_value='0xF10F' and variation='mathmode']">
1563
- <xsl:text>Unsupported character</xsl:text>
1563
+ <xsl:text></xsl:text>
1564
1564
  </xsl:template>
1565
1565
 
1566
1566
  <!-- MATHEMATICAL SCRIPT CAPITAL Q -->
@@ -1580,7 +1580,7 @@
1580
1580
 
1581
1581
  <!-- UNSUPPORTED -->
1582
1582
  <xsl:template match="char[mt_code_value='0xF111' and variation='mathmode']">
1583
- <xsl:text>Unsupported character</xsl:text>
1583
+ <xsl:text></xsl:text>
1584
1584
  </xsl:template>
1585
1585
 
1586
1586
  <!-- MATHEMATICAL SCRIPT CAPITAL S -->
@@ -1655,7 +1655,7 @@
1655
1655
 
1656
1656
  <!-- UNSUPPORTED -->
1657
1657
  <xsl:template match="char[mt_code_value='0xF11E' and variation='mathmode']">
1658
- <xsl:text>Unsupported character</xsl:text>
1658
+ <xsl:text></xsl:text>
1659
1659
  </xsl:template>
1660
1660
 
1661
1661
  <!-- MATHEMATICAL SCRIPT SMALL F -->
@@ -1675,7 +1675,7 @@
1675
1675
 
1676
1676
  <!-- UNSUPPORTED -->
1677
1677
  <xsl:template match="char[mt_code_value='0xF120' and variation='mathmode']">
1678
- <xsl:text>Unsupported character</xsl:text>
1678
+ <xsl:text></xsl:text>
1679
1679
  </xsl:template>
1680
1680
 
1681
1681
  <!-- MATHEMATICAL SCRIPT SMALL H -->
@@ -1710,7 +1710,7 @@
1710
1710
 
1711
1711
  <!-- UNSUPPORTED -->
1712
1712
  <xsl:template match="char[mt_code_value='0xF125' and variation='mathmode']">
1713
- <xsl:text>Unsupported character</xsl:text>
1713
+ <xsl:text></xsl:text>
1714
1714
  </xsl:template>
1715
1715
 
1716
1716
  <!-- MATHEMATICAL SCRIPT SMALL M -->
@@ -1735,7 +1735,7 @@
1735
1735
 
1736
1736
  <!-- UNSUPPORTED -->
1737
1737
  <xsl:template match="char[mt_code_value='0xF128' and variation='mathmode']">
1738
- <xsl:text>Unsupported character</xsl:text>
1738
+ <xsl:text></xsl:text>
1739
1739
  </xsl:template>
1740
1740
 
1741
1741
  <!-- MATHEMATICAL SCRIPT SMALL P -->
data/oleObject10.bin ADDED
Binary file
data/oleObject11.bin CHANGED
Binary file
data/oleObject55.bin ADDED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mathtype_to_mathml_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vu
@@ -257,6 +257,9 @@ files:
257
257
  - lib/mathtype_to_mathml_plus/mover.rb
258
258
  - lib/mathtype_to_mathml_plus/version.rb
259
259
  - lib/transform.xsl
260
+ - lib/util/decToHex.xsl
261
+ - lib/util/hexToDec.xsl
262
+ - lib/util/symbol-map-base-uri-to-name.xsl
260
263
  - lib/xsl/arrow.xsl
261
264
  - lib/xsl/box.xsl
262
265
  - lib/xsl/char.xsl
@@ -317,12 +320,14 @@ files:
317
320
  - mathtype.log
318
321
  - mathtype_to_mathml.gemspec
319
322
  - oleObject1.bin
323
+ - oleObject10.bin
320
324
  - oleObject11.bin
321
325
  - oleObject17.bin
322
326
  - oleObject2.bin
323
327
  - oleObject3.bin
324
328
  - oleObject4.bin
325
329
  - oleObject5.bin
330
+ - oleObject55.bin
326
331
  - spec/fixtures/expected/280.xml
327
332
  - spec/fixtures/expected/281.xml
328
333
  - spec/fixtures/expected/299.xml