omml2mathml 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,39 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "omml2mathml/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omml2mathml"
8
+ spec.version = Omml2Mathml::VERSION
9
+ spec.authors = ["Ribose Inc."]
10
+ spec.email = ["open.source@ribose.com"]
11
+
12
+ spec.summary = "Convert Office Math Markup to MathML"
13
+ spec.description = <<~DESCRIPTION
14
+ This is a Ruby gem for converting Office Math Markup (OMML) into MathML within Word HTML documents.
15
+ DESCRIPTION
16
+
17
+ spec.homepage = "https://github.com/riboseinc/omml2mathml"
18
+ spec.license = "BSD-2-Clause"
19
+
20
+ spec.bindir = "bin"
21
+ spec.require_paths = ["lib"]
22
+ spec.files = `git ls-files`.split("\n")
23
+ spec.test_files = `git ls-files -- {spec}/*`.split("\n")
24
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
25
+
26
+ spec.add_dependency "nokogiri"
27
+ spec.add_dependency "ruby-xslt"
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.15"
30
+ spec.add_development_dependency "byebug", "~> 9.1"
31
+ spec.add_development_dependency "equivalent-xml", "~> 0.6"
32
+ spec.add_development_dependency "guard", "~> 2.14"
33
+ spec.add_development_dependency "guard-rspec", "~> 4.7"
34
+ spec.add_development_dependency "rake", "~> 12.0"
35
+ spec.add_development_dependency "rspec", "~> 3.6"
36
+ spec.add_development_dependency "rubocop", "~> 0.50"
37
+ spec.add_development_dependency "simplecov", "~> 0.15"
38
+ spec.add_development_dependency "timecop", "~> 0.9"
39
+ end
@@ -0,0 +1,59 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Omml2Mathml do
4
+ it "has a version number" do
5
+ expect(Omml2Mathml::VERSION).not_to be nil
6
+ end
7
+
8
+ it "processes a document" do
9
+ html = Omml2Mathml.convert("spec/test.html").sub(/<\?xml[^>]+>/, "").sub(/<!DOCTYPE[^>]+>/, "")
10
+ expect(html).to be_equivalent_to <<~"OUTPUT"
11
+ <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
12
+
13
+ <head>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
15
+ <meta name="ProgId" content="Word.Document"/>
16
+ <meta name="Generator" content="Microsoft Word 15"/>
17
+ <meta name="Originator" content="Microsoft Word 15"/>
18
+ <link rel="File-List" href="Part%201_General.fld/filelist.xml"/>
19
+ <link rel="Edit-Time-Data" href="Part%201_General.fld/editdata.mso"/>
20
+ </head>
21
+
22
+ <body lang="EL" link="blue" vlink="purple" style="tab-interval:20.0pt" xml:lang="EL">
23
+
24
+ <div class="WordSection3">
25
+
26
+ <p class="MsoNormal"><span lang="EN-US" style="mso-fareast-font-family:SimSun;&#10;mso-fareast-theme-font:minor-fareast;mso-ansi-language:EN-US;mso-fareast-language:&#10;ZH-CN" xml:lang="EN-US">This standard applies to the elliptic curves over the finite field </span><mml:math>
27
+ <mml:msub>
28
+ <mml:mrow>
29
+ <mml:mrow>
30
+ <mml:mi>F</mml:mi>
31
+ </mml:mrow>
32
+ </mml:mrow>
33
+ <mml:mrow>
34
+ <mml:mrow>
35
+ <mml:mi>p</mml:mi>
36
+ </mml:mrow>
37
+ </mml:mrow>
38
+ </mml:msub>
39
+ </mml:math><span lang="EN-US" style="mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;&#10;mso-ansi-language:EN-US;mso-fareast-language:ZH-CN" xml:lang="EN-US"><span style="mso-spacerun:yes">&#xA0;</span>(the prime </span><mml:math>
40
+ <mml:mi>p</mml:mi><mml:msup>
41
+ <mml:mrow>
42
+ <mml:mrow>
43
+ <mml:mn>2</mml:mn>
44
+ </mml:mrow>
45
+ </mml:mrow>
46
+ <mml:mrow>
47
+ <mml:mrow>
48
+ <mml:mn>191</mml:mn>
49
+ </mml:mrow>
50
+ </mml:mrow>
51
+ </mml:msup>
52
+ </mml:math><span lang="EN-US" style="mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;&#10;mso-ansi-language:EN-US;mso-fareast-language:ZH-CN" xml:lang="EN-US">).<p/></span></p>
53
+
54
+ </div>
55
+ </body>
56
+ </html>
57
+ OUTPUT
58
+ end
59
+ end
@@ -0,0 +1,24 @@
1
+ require "rspec"
2
+ require "simplecov"
3
+ SimpleCov.start do
4
+ add_filter "/spec/"
5
+ end
6
+
7
+ require "bundler/setup"
8
+ require "omml2mathml"
9
+ require "rspec/matchers"
10
+ require "equivalent-xml"
11
+
12
+ #require_relative "lib/omml2mathml/convert"
13
+
14
+ RSpec.configure do |config|
15
+ # Enable flags like --only-failures and --next-failure
16
+ config.example_status_persistence_file_path = ".rspec_status"
17
+
18
+ # Disable RSpec exposing methods globally on `Module` and `main`
19
+ config.disable_monkey_patching!
20
+
21
+ config.expect_with :rspec do |c|
22
+ c.syntax = :expect
23
+ end
24
+ end
data/spec/test.html ADDED
@@ -0,0 +1,73 @@
1
+ <html xmlns:v="urn:schemas-microsoft-com:vml"
2
+ xmlns:o="urn:schemas-microsoft-com:office:office"
3
+ xmlns:w="urn:schemas-microsoft-com:office:word"
4
+ xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
5
+ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
6
+ xmlns="http://www.w3.org/TR/REC-html40">
7
+
8
+ <head>
9
+ <meta http-equiv=Content-Type content="text/html; charset=utf-8">
10
+ <meta name=ProgId content=Word.Document>
11
+ <meta name=Generator content="Microsoft Word 15">
12
+ <meta name=Originator content="Microsoft Word 15">
13
+ <link rel=File-List href="Part%201_General.fld/filelist.xml">
14
+ <link rel=Edit-Time-Data href="Part%201_General.fld/editdata.mso">
15
+ </head>
16
+
17
+ <body lang=EL link=blue vlink=purple style='tab-interval:20.0pt'>
18
+
19
+ <div class=WordSection3>
20
+
21
+ <p class=MsoNormal><span lang=EN-US style='mso-fareast-font-family:SimSun;
22
+ mso-fareast-theme-font:minor-fareast;mso-ansi-language:EN-US;mso-fareast-language:
23
+ ZH-CN'>This standard applies to the elliptic curves over the finite field </span><!--[if gte msEquation 12]><m:oMath><m:sSub><m:sSubPr><span
24
+ style='font-family:"Cambria Math",serif;mso-ascii-font-family:"Cambria Math";
25
+ mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;
26
+ mso-hansi-font-family:"Cambria Math";mso-ansi-language:EN-US;mso-fareast-language:
27
+ ZH-CN;font-style:italic;mso-bidi-font-style:normal'><m:ctrlPr></m:ctrlPr></span></m:sSubPr><m:e><i
28
+ style='mso-bidi-font-style:normal'><span lang=EN-US style='font-family:"Cambria Math",serif;
29
+ mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;
30
+ mso-ansi-language:EN-US;mso-fareast-language:ZH-CN'><m:r>F</m:r></span></i></m:e><m:sub><i
31
+ style='mso-bidi-font-style:normal'><span lang=EN-US style='font-family:"Cambria Math",serif;
32
+ mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;
33
+ mso-ansi-language:EN-US;mso-fareast-language:ZH-CN'><m:r>p</m:r></span></i></m:sub></m:sSub></m:oMath><![endif]--><![if !msEquation]><span
34
+ lang=EN-GB style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Cambria",serif;
35
+ mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:Cambria;position:relative;
36
+ top:4.0pt;mso-text-raise:-4.0pt;mso-ansi-language:EN-GB;mso-fareast-language:
37
+ FR;mso-bidi-language:AR-SA'><!--[if gte vml 1]><v:shape id="_x0000_i1025"
38
+ type="#_x0000_t75" style='width:5pt;height:7pt'>
39
+ <v:imagedata src="Part%201_General.fld/image031.emz" o:title="" chromakey="white"/>
40
+ </v:shape><![endif]--><![if !vml]><img width=5 height=7
41
+ src="Part%201_General.fld/image032.jpg" v:shapes="_x0000_i1025"><![endif]></span><![endif]><span
42
+ lang=EN-US style='mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;
43
+ mso-ansi-language:EN-US;mso-fareast-language:ZH-CN'><span
44
+ style='mso-spacerun:yes'> </span>(the prime </span><!--[if gte msEquation 12]><m:oMath><i
45
+ style='mso-bidi-font-style:normal'><span lang=EN-US style='font-family:"Cambria Math",serif;
46
+ mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;
47
+ mso-ansi-language:EN-US;mso-fareast-language:ZH-CN'><m:r>p</m:r><m:r>&gt;</m:r></span></i><m:sSup><m:sSupPr><span
48
+ style='font-family:"Cambria Math",serif;mso-ascii-font-family:"Cambria Math";
49
+ mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;
50
+ mso-hansi-font-family:"Cambria Math";mso-ansi-language:EN-US;mso-fareast-language:
51
+ ZH-CN;font-style:italic;mso-bidi-font-style:normal'><m:ctrlPr></m:ctrlPr></span></m:sSupPr><m:e><i
52
+ style='mso-bidi-font-style:normal'><span lang=EN-US style='font-family:"Cambria Math",serif;
53
+ mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;
54
+ mso-ansi-language:EN-US;mso-fareast-language:ZH-CN'><m:r>2</m:r></span></i></m:e><m:sup><i
55
+ style='mso-bidi-font-style:normal'><span lang=EN-US style='font-family:"Cambria Math",serif;
56
+ mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;
57
+ mso-ansi-language:EN-US;mso-fareast-language:ZH-CN'><m:r>191</m:r></span></i></m:sup></m:sSup></m:oMath><![endif]--><![if !msEquation]><span
58
+ lang=EN-GB style='font-size:11.0pt;mso-bidi-font-size:10.0pt;font-family:"Cambria",serif;
59
+ mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:Cambria;position:relative;
60
+ top:2.0pt;mso-text-raise:-2.0pt;mso-ansi-language:EN-GB;mso-fareast-language:
61
+ FR;mso-bidi-language:AR-SA'><!--[if gte vml 1]><v:shape id="_x0000_i1025"
62
+ type="#_x0000_t75" style='width:21pt;height:7pt'>
63
+ <v:imagedata src="Part%201_General.fld/image033.emz" o:title="" chromakey="white"/>
64
+ </v:shape><![endif]--><![if !vml]><img width=21 height=7
65
+ src="Part%201_General.fld/image034.jpg" v:shapes="_x0000_i1025"><![endif]></span><![endif]><span
66
+ lang=EN-US style='mso-fareast-font-family:SimSun;mso-fareast-theme-font:minor-fareast;
67
+ mso-ansi-language:EN-US;mso-fareast-language:ZH-CN'>).<o:p></o:p></span></p>
68
+
69
+ </div>
70
+ </body>
71
+ </html>
72
+
73
+
metadata ADDED
@@ -0,0 +1,231 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omml2mathml
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ribose Inc.
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-03-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ruby-xslt
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.15'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.15'
55
+ - !ruby/object:Gem::Dependency
56
+ name: byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '9.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '9.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: equivalent-xml
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.6'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.6'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.14'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.14'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '4.7'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '4.7'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '12.0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '12.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.6'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.6'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.50'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.50'
153
+ - !ruby/object:Gem::Dependency
154
+ name: simplecov
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '0.15'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '0.15'
167
+ - !ruby/object:Gem::Dependency
168
+ name: timecop
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.9'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.9'
181
+ description: 'This is a Ruby gem for converting Office Math Markup (OMML) into MathML
182
+ within Word HTML documents.
183
+
184
+ '
185
+ email:
186
+ - open.source@ribose.com
187
+ executables: []
188
+ extensions: []
189
+ extra_rdoc_files: []
190
+ files:
191
+ - Gemfile
192
+ - LICENSE
193
+ - README.adoc
194
+ - Rakefile
195
+ - bin/console
196
+ - bin/rspec
197
+ - bin/setup
198
+ - lib/omml2mathml.rb
199
+ - lib/omml2mathml/convert.rb
200
+ - lib/omml2mathml/omml2mml.xsl
201
+ - lib/omml2mathml/version.rb
202
+ - lib/omml2mathml/xhtml-mathml.xsl
203
+ - omml2mathml.gemspec
204
+ - spec/omml2mathml_spec.rb
205
+ - spec/spec_helper.rb
206
+ - spec/test.html
207
+ homepage: https://github.com/riboseinc/omml2mathml
208
+ licenses:
209
+ - BSD-2-Clause
210
+ metadata: {}
211
+ post_install_message:
212
+ rdoc_options: []
213
+ require_paths:
214
+ - lib
215
+ required_ruby_version: !ruby/object:Gem::Requirement
216
+ requirements:
217
+ - - ">="
218
+ - !ruby/object:Gem::Version
219
+ version: 2.4.0
220
+ required_rubygems_version: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - ">="
223
+ - !ruby/object:Gem::Version
224
+ version: '0'
225
+ requirements: []
226
+ rubyforge_project:
227
+ rubygems_version: 2.6.12
228
+ signing_key:
229
+ specification_version: 4
230
+ summary: Convert Office Math Markup to MathML
231
+ test_files: []