mathtype_to_mathml_plus 0.0.8 → 0.0.9
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 +4 -4
- data/README.md +2 -2
- data/lib/mathtype_to_mathml/char_replacer.rb +1 -1
- data/lib/mathtype_to_mathml/mover.rb +1 -1
- data/lib/mathtype_to_mathml/version.rb +2 -2
- data/lib/mathtype_to_mathml.rb +1 -1
- data/mathtype_to_mathml.gemspec +1 -1
- data/spec/html_output.rb +1 -1
- data/spec/mathtype_to_mathml_spec.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 67f28b4614c6ea1668d0f0cbd40e39b42271c38ffee8d0d6a68640313afaff01
|
|
4
|
+
data.tar.gz: e743c7cbd14fcda8239f6c64e09ba56870402f50e386e3e607382ceada2b6a64
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4015d2219c1ffc8f075609fbe0d21b5f960ab8db17a1779859420c4e52016126fc78d191cdcc2ad935e93402a6bd6a12df8ba1bf5321d35e4bdec5910d6b3eeb
|
|
7
|
+
data.tar.gz: a38e176f9e15b8c55d27ab148e59b24671b7b9a6b2246a5e84c7b99d32319b508ad4bb2325ae5bf7795fde47cb8c7703b987e724d26ef3212ff5d64a4f944051
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MathTypeToMathMLPlus
|
|
2
2
|
|
|
3
3
|
This gem can be used to convert MathType equations from a binary format (e.g. embedded in Word documents) to an open MathML representation. It achieves that in several stages, first using the [`mathtype`](https://github.com/jure/mathtype) gem to convert from a binary to an XML form of MTEF, and second, using XSLTs to convert XML to MathML.
|
|
4
4
|
|
|
@@ -23,7 +23,7 @@ Or install it yourself as:
|
|
|
23
23
|
To convert a MathType equation embedded in a Word document (the file is usually named something like `oleObject1.bin`):
|
|
24
24
|
|
|
25
25
|
```
|
|
26
|
-
mathml =
|
|
26
|
+
mathml = MathTypeToMathMLPlus::Converter.new(`oleObject1.bin`).convert
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
This will return a MathML string of the MathType equation.
|
|
@@ -20,7 +20,7 @@ require "nokogiri"
|
|
|
20
20
|
# Additionally, Mover inverts <emb>ellishments from <char><emb></emb></char> to
|
|
21
21
|
# <emb><char></char></emb>.
|
|
22
22
|
|
|
23
|
-
module
|
|
23
|
+
module MathTypeToMathMLPlus
|
|
24
24
|
class Mover
|
|
25
25
|
attr_reader :mathtype
|
|
26
26
|
attr_accessor :last_preceding_siblings
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module
|
|
2
|
-
VERSION = "0.0.
|
|
1
|
+
module MathTypeToMathMLPlus
|
|
2
|
+
VERSION = "0.0.9"
|
|
3
3
|
end
|
data/lib/mathtype_to_mathml.rb
CHANGED
|
@@ -4,7 +4,7 @@ require "mathtype"
|
|
|
4
4
|
require_relative "mathtype_to_mathml/mover"
|
|
5
5
|
require_relative "mathtype_to_mathml/char_replacer"
|
|
6
6
|
|
|
7
|
-
module
|
|
7
|
+
module MathTypeToMathMLPlus
|
|
8
8
|
class Converter
|
|
9
9
|
def initialize(mathtype)
|
|
10
10
|
@xslt = Nokogiri::XSLT(File.open(path_to_xslt))
|
data/mathtype_to_mathml.gemspec
CHANGED
|
@@ -5,7 +5,7 @@ require 'mathtype_to_mathml/version'
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "mathtype_to_mathml_plus"
|
|
8
|
-
spec.version =
|
|
8
|
+
spec.version = MathTypeToMathMLPlus::VERSION
|
|
9
9
|
spec.authors = ["Jure Triglav"]
|
|
10
10
|
spec.email = ["juretriglav@gmail.com"]
|
|
11
11
|
spec.summary = %q{Converts from a binary MathType format (MTEF) to MathML.}
|
data/spec/html_output.rb
CHANGED
|
@@ -10,7 +10,7 @@ builder = Nokogiri::HTML::Builder.new do |html|
|
|
|
10
10
|
div.h3 equation
|
|
11
11
|
div.p "Output", "style" => "text-align: center;"
|
|
12
12
|
div.p do |p|
|
|
13
|
-
p <<
|
|
13
|
+
p << MathTypeToMathMLPlus::Converter.new(equation).convert
|
|
14
14
|
end
|
|
15
15
|
expected_xml = "#{File.basename(equation, ".*")}.xml"
|
|
16
16
|
expected = File.open("spec/fixtures/expected/" + expected_xml).read
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
require "spec_helper"
|
|
2
2
|
|
|
3
|
-
RSpec.describe
|
|
3
|
+
RSpec.describe MathTypeToMathMLPlus do
|
|
4
4
|
it 'has a version number' do
|
|
5
|
-
expect(
|
|
5
|
+
expect(MathTypeToMathMLPlus::VERSION).not_to be nil
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
Dir.glob("spec/fixtures/input/*.bin") do |equation|
|
|
9
9
|
it "converted #{equation} matches expected output" do
|
|
10
|
-
xml =
|
|
10
|
+
xml = MathTypeToMathMLPlus::Converter.new(equation).convert
|
|
11
11
|
expected_xml = "#{File.basename(equation, ".*")}.xml"
|
|
12
12
|
expected = File.open("spec/fixtures/expected/" + expected_xml).read
|
|
13
13
|
expect(xml).to be_equivalent_to(expected)
|