math_ml 0.14 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +339 -0
- data/lib/math_ml/element.rb +233 -225
- data/lib/math_ml/latex/builtin/symbol.rb +546 -546
- data/lib/math_ml/latex/builtin.rb +3 -3
- data/lib/math_ml/latex.rb +1140 -1103
- data/lib/math_ml/string.rb +17 -16
- data/lib/math_ml/symbol/character_reference.rb +2100 -2101
- data/lib/math_ml/symbol/entity_reference.rb +2100 -2100
- data/lib/math_ml/symbol/utf8.rb +2100 -2102
- data/lib/math_ml/util.rb +350 -339
- data/lib/math_ml.rb +14 -14
- metadata +43 -75
- data/Rakefile +0 -60
- data/Rakefile.utirake +0 -392
- data/spec/math_ml/element_spec.rb +0 -32
- data/spec/math_ml/latex/macro_spec.rb +0 -122
- data/spec/math_ml/latex/parser_spec.rb +0 -580
- data/spec/math_ml/latex/scanner_spec.rb +0 -202
- data/spec/math_ml/string_spec.rb +0 -29
- data/spec/math_ml/util_spec.rb +0 -700
- data/spec/math_ml_spec.rb +0 -14
- data/spec/util.rb +0 -43
data/lib/math_ml/string.rb
CHANGED
@@ -6,27 +6,28 @@
|
|
6
6
|
# You can redistribute it and/or modify it under GPL2.
|
7
7
|
#
|
8
8
|
|
9
|
-
require
|
9
|
+
require 'math_ml'
|
10
10
|
|
11
11
|
module MathML
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
module String
|
13
|
+
@@mathml_latex_parser = nil
|
14
|
+
def self.mathml_latex_parser
|
15
|
+
@@mathml_latex_parser ||= MathML::LaTeX::Parser.new
|
16
|
+
@@mathml_latex_parser
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
@@mathml_latex_parser = mlp
|
22
|
-
end
|
19
|
+
def self.mathml_latex_parser=(mlp)
|
20
|
+
raise TypeError unless mlp.is_a?(MathML::LaTeX::Parser) || mlp.nil?
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
@@mathml_latex_parser = mlp
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_mathml(displaystyle = false)
|
26
|
+
MathML::String.mathml_latex_parser.parse(self, displaystyle)
|
27
|
+
end
|
28
|
+
end
|
28
29
|
end
|
29
30
|
|
30
31
|
class String
|
31
|
-
|
32
|
+
include MathML::String
|
32
33
|
end
|