plurimath 0.11.0 → 0.11.3
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/.gitignore +3 -0
- data/.rubocop_todo.yml +311 -58
- data/Gemfile +3 -2
- data/README.adoc +331 -15
- data/lib/plurimath/asciimath/parse.rb +6 -1
- data/lib/plurimath/asciimath/transform.rb +2 -0
- data/lib/plurimath/base_number_prefix.rb +43 -0
- data/lib/plurimath/configuration.rb +9 -1
- data/lib/plurimath/deprecation.rb +2 -1
- data/lib/plurimath/errors/configuration_error.rb +5 -1
- data/lib/plurimath/errors/deprecation_error.rb +2 -1
- data/lib/plurimath/errors/evaluation/division_by_zero_error.rb +13 -0
- data/lib/plurimath/errors/evaluation/error.rb +9 -0
- data/lib/plurimath/errors/evaluation/invalid_binding_error.rb +14 -0
- data/lib/plurimath/errors/evaluation/invalid_binding_key_error.rb +14 -0
- data/lib/plurimath/errors/evaluation/math_domain_error.rb +9 -0
- data/lib/plurimath/errors/evaluation/missing_variable_error.rb +13 -0
- data/lib/plurimath/errors/evaluation/non_finite_result_error.rb +13 -0
- data/lib/plurimath/errors/evaluation/unsupported_expression_error.rb +13 -0
- data/lib/plurimath/errors/evaluation.rb +18 -0
- data/lib/plurimath/errors/invalid_number.rb +17 -0
- data/lib/plurimath/errors/unsupported_base.rb +18 -0
- data/lib/plurimath/errors/{formatter/unsupported_locale.rb → unsupported_locale.rb} +1 -1
- data/lib/plurimath/errors.rb +9 -0
- data/lib/plurimath/formatter/numbers/base_notation.rb +55 -27
- data/lib/plurimath/formatter/numbers/format_options.rb +123 -17
- data/lib/plurimath/formatter/numbers/formatted_notation.rb +62 -0
- data/lib/plurimath/formatter/numbers/formatted_number.rb +87 -0
- data/lib/plurimath/formatter/numbers/fraction.rb +8 -17
- data/lib/plurimath/formatter/numbers/integer.rb +3 -0
- data/lib/plurimath/formatter/numbers/mathml_renderer.rb +56 -0
- data/lib/plurimath/formatter/numbers/notation_renderer.rb +58 -28
- data/lib/plurimath/formatter/numbers/number_renderer.rb +26 -13
- data/lib/plurimath/formatter/numbers/omml_renderer.rb +74 -0
- data/lib/plurimath/formatter/numbers/precision_resolver.rb +16 -3
- data/lib/plurimath/formatter/numbers/sign_renderer.rb +2 -1
- data/lib/plurimath/formatter/numbers/significant.rb +4 -2
- data/lib/plurimath/formatter/numbers/source.rb +46 -6
- data/lib/plurimath/formatter/numbers/text_renderer.rb +52 -0
- data/lib/plurimath/formatter/numbers.rb +6 -2
- data/lib/plurimath/formatter/standard.rb +6 -0
- data/lib/plurimath/formatter/supported_locales.rb +1 -1
- data/lib/plurimath/formatter.rb +0 -2
- data/lib/plurimath/html/parse.rb +5 -0
- data/lib/plurimath/html/transform.rb +26 -12
- data/lib/plurimath/latex/parse.rb +5 -0
- data/lib/plurimath/latex/transform.rb +2 -0
- data/lib/plurimath/math/core.rb +69 -14
- data/lib/plurimath/math/evaluation/evaluator.rb +147 -0
- data/lib/plurimath/math/evaluation/expression_parser.rb +215 -0
- data/lib/plurimath/math/evaluation/iteration.rb +63 -0
- data/lib/plurimath/math/evaluation.rb +13 -0
- data/lib/plurimath/math/formula.rb +9 -0
- data/lib/plurimath/math/function/abs.rb +4 -0
- data/lib/plurimath/math/function/arccos.rb +4 -0
- data/lib/plurimath/math/function/arcsin.rb +4 -0
- data/lib/plurimath/math/function/arctan.rb +4 -0
- data/lib/plurimath/math/function/ceil.rb +4 -0
- data/lib/plurimath/math/function/cos.rb +4 -0
- data/lib/plurimath/math/function/cosh.rb +4 -0
- data/lib/plurimath/math/function/cot.rb +4 -0
- data/lib/plurimath/math/function/coth.rb +4 -0
- data/lib/plurimath/math/function/csc.rb +4 -0
- data/lib/plurimath/math/function/csch.rb +4 -0
- data/lib/plurimath/math/function/exp.rb +4 -0
- data/lib/plurimath/math/function/fenced.rb +4 -0
- data/lib/plurimath/math/function/floor.rb +4 -0
- data/lib/plurimath/math/function/frac.rb +7 -0
- data/lib/plurimath/math/function/gcd.rb +9 -0
- data/lib/plurimath/math/function/lcm.rb +9 -0
- data/lib/plurimath/math/function/lg.rb +4 -0
- data/lib/plurimath/math/function/ln.rb +4 -0
- data/lib/plurimath/math/function/log.rb +19 -0
- data/lib/plurimath/math/function/max.rb +4 -0
- data/lib/plurimath/math/function/min.rb +4 -0
- data/lib/plurimath/math/function/mod.rb +15 -0
- data/lib/plurimath/math/function/overleftrightarrow.rb +2 -2
- data/lib/plurimath/math/function/power.rb +10 -0
- data/lib/plurimath/math/function/prod.rb +10 -0
- data/lib/plurimath/math/function/root.rb +7 -0
- data/lib/plurimath/math/function/sec.rb +4 -0
- data/lib/plurimath/math/function/sech.rb +4 -0
- data/lib/plurimath/math/function/sin.rb +4 -0
- data/lib/plurimath/math/function/sinh.rb +4 -0
- data/lib/plurimath/math/function/sqrt.rb +4 -0
- data/lib/plurimath/math/function/sum.rb +10 -0
- data/lib/plurimath/math/function/tan.rb +4 -0
- data/lib/plurimath/math/function/tanh.rb +4 -0
- data/lib/plurimath/math/function/text.rb +17 -0
- data/lib/plurimath/math/number.rb +44 -23
- data/lib/plurimath/math/symbols/cdot.rb +4 -0
- data/lib/plurimath/math/symbols/div.rb +4 -0
- data/lib/plurimath/math/symbols/hat.rb +4 -0
- data/lib/plurimath/math/symbols/minus.rb +4 -0
- data/lib/plurimath/math/symbols/pi.rb +5 -1
- data/lib/plurimath/math/symbols/plus.rb +4 -0
- data/lib/plurimath/math/symbols/slash.rb +4 -0
- data/lib/plurimath/math/symbols/symbol.rb +45 -0
- data/lib/plurimath/math/symbols/times.rb +4 -0
- data/lib/plurimath/math.rb +5 -1
- data/lib/plurimath/mathml/constants.rb +18 -0
- data/lib/plurimath/number_formatter.rb +63 -3
- data/lib/plurimath/omml/formula_transformation.rb +2 -1
- data/lib/plurimath/omml/translator.rb +4 -1
- data/lib/plurimath/setup/opal.rb.erb +13 -0
- data/lib/plurimath/unicode_math/parse.rb +98 -54
- data/lib/plurimath/unicode_math/parser.rb +7 -4
- data/lib/plurimath/unicode_math/parsing_rules/absence_rules.rb +33 -21
- data/lib/plurimath/unicode_math/parsing_rules/common_rules.rb +28 -16
- data/lib/plurimath/unicode_math/parsing_rules/constants_rules.rb +18 -7
- data/lib/plurimath/unicode_math/parsing_rules/masked.rb +35 -15
- data/lib/plurimath/unicode_math/parsing_rules/sub_sup.rb +98 -72
- data/lib/plurimath/unicode_math/transform.rb +1 -0
- data/lib/plurimath/utility.rb +1 -1
- data/lib/plurimath/version.rb +1 -1
- data/lib/plurimath.rb +2 -0
- metadata +24 -5
- data/lib/plurimath/errors/formatter/unsupported_base.rb +0 -21
- data/lib/plurimath/formatter/numbers/parts_renderer.rb +0 -30
|
@@ -3,48 +3,59 @@
|
|
|
3
3
|
module Plurimath
|
|
4
4
|
module Math
|
|
5
5
|
class Number < Core
|
|
6
|
-
attr_accessor :value, :mini_sub_sized, :mini_sup_sized
|
|
6
|
+
attr_accessor :value, :mini_sub_sized, :mini_sup_sized, :base
|
|
7
7
|
|
|
8
|
-
def initialize(value = nil, mini_sub_sized: false, mini_sup_sized: false
|
|
8
|
+
def initialize(value = nil, mini_sub_sized: false, mini_sup_sized: false,
|
|
9
|
+
base: nil)
|
|
9
10
|
@value = value.is_a?(::Parslet::Slice) ? value.to_s : value
|
|
10
|
-
@mini_sub_sized = mini_sub_sized
|
|
11
|
-
@mini_sup_sized = mini_sup_sized
|
|
11
|
+
@mini_sub_sized = mini_sub_sized
|
|
12
|
+
@mini_sup_sized = mini_sup_sized
|
|
13
|
+
@base = base
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
def ==(object)
|
|
15
|
-
object.
|
|
17
|
+
object.is_a?(Number) &&
|
|
16
18
|
object.value == value &&
|
|
17
19
|
object.mini_sub_sized == mini_sub_sized &&
|
|
18
|
-
object.mini_sup_sized == mini_sup_sized
|
|
20
|
+
object.mini_sup_sized == mini_sup_sized &&
|
|
21
|
+
object.base == base
|
|
19
22
|
end
|
|
20
23
|
|
|
21
24
|
def element_order=(*); end
|
|
22
25
|
|
|
23
26
|
def to_asciimath(options:)
|
|
24
|
-
|
|
27
|
+
Formatter::Numbers::TextRenderer.render(
|
|
28
|
+
format_value_with_options(options), :asciimath
|
|
29
|
+
)
|
|
25
30
|
end
|
|
26
31
|
|
|
27
32
|
def to_mathml_without_math_tag(_, options:)
|
|
28
|
-
|
|
33
|
+
Formatter::Numbers::MathmlRenderer.render(format_value_with_options(options))
|
|
29
34
|
end
|
|
30
35
|
|
|
31
36
|
def to_latex(options:)
|
|
32
|
-
|
|
37
|
+
Formatter::Numbers::TextRenderer.render(
|
|
38
|
+
format_value_with_options(options), :latex
|
|
39
|
+
)
|
|
33
40
|
end
|
|
34
41
|
|
|
35
42
|
def to_html(options:)
|
|
36
|
-
|
|
43
|
+
Formatter::Numbers::TextRenderer.render(
|
|
44
|
+
format_value_with_options(options), :html
|
|
45
|
+
)
|
|
37
46
|
end
|
|
38
47
|
|
|
39
48
|
def to_omml_without_math_tag(_, options:)
|
|
40
|
-
[
|
|
49
|
+
[Formatter::Numbers::OmmlRenderer.render(format_value_with_options(options))]
|
|
41
50
|
end
|
|
42
51
|
|
|
43
52
|
def to_unicodemath(options:)
|
|
44
53
|
return mini_sub if mini_sub_sized
|
|
45
54
|
return mini_sup if mini_sup_sized
|
|
46
55
|
|
|
47
|
-
|
|
56
|
+
Formatter::Numbers::TextRenderer.render(
|
|
57
|
+
format_value_with_options(options), :unicodemath
|
|
58
|
+
)
|
|
48
59
|
end
|
|
49
60
|
|
|
50
61
|
def insert_t_tag(_, options:)
|
|
@@ -59,17 +70,26 @@ module Plurimath
|
|
|
59
70
|
|
|
60
71
|
def t_tag(options:)
|
|
61
72
|
Utility.ox_element("t",
|
|
62
|
-
namespace: "m") <<
|
|
73
|
+
namespace: "m") << formatted_value(options)
|
|
63
74
|
end
|
|
64
75
|
|
|
65
76
|
def nary_attr_value(options:)
|
|
66
|
-
format_value_with_options(options)
|
|
77
|
+
format_value_with_options(options).to_s
|
|
67
78
|
end
|
|
68
79
|
|
|
69
80
|
def validate_function_formula
|
|
70
81
|
false
|
|
71
82
|
end
|
|
72
83
|
|
|
84
|
+
def evaluate(_evaluator)
|
|
85
|
+
raw_value = value.to_s
|
|
86
|
+
return raw_value.to_i if raw_value.match?(/\A[+-]?\d+\z/)
|
|
87
|
+
|
|
88
|
+
Float(raw_value)
|
|
89
|
+
rescue ArgumentError
|
|
90
|
+
raise Errors::Evaluation::UnsupportedExpressionError, "number `#{raw_value}`"
|
|
91
|
+
end
|
|
92
|
+
|
|
73
93
|
def mini_sized?
|
|
74
94
|
mini_sub_sized || mini_sup_sized
|
|
75
95
|
end
|
|
@@ -98,15 +118,16 @@ module Plurimath
|
|
|
98
118
|
end
|
|
99
119
|
return value unless formatter
|
|
100
120
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
121
|
+
format = options[:format] || {}
|
|
122
|
+
format = format.merge(base: base) if base && !format.key?(:base)
|
|
123
|
+
|
|
124
|
+
formatter.format_number(options[:formula], self, format: format)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
private
|
|
128
|
+
|
|
129
|
+
def formatted_value(options)
|
|
130
|
+
format_value_with_options(options).to_s
|
|
110
131
|
end
|
|
111
132
|
end
|
|
112
133
|
end
|
|
@@ -10,7 +10,7 @@ module Plurimath
|
|
|
10
10
|
mathml: ["π", "𝜋"],
|
|
11
11
|
latex: ["pi", "uppi", "π", "𝜋"],
|
|
12
12
|
omml: ["π", "𝜋"],
|
|
13
|
-
html: ["π", "π", "𝜋"],
|
|
13
|
+
html: ["π", "π", "𝜋", "π", "𝜋"],
|
|
14
14
|
}.freeze
|
|
15
15
|
|
|
16
16
|
# output methods
|
|
@@ -37,6 +37,10 @@ module Plurimath
|
|
|
37
37
|
def to_html(**)
|
|
38
38
|
"π"
|
|
39
39
|
end
|
|
40
|
+
|
|
41
|
+
def reserved_constant
|
|
42
|
+
::Math::PI
|
|
43
|
+
end
|
|
40
44
|
end
|
|
41
45
|
end
|
|
42
46
|
end
|
|
@@ -108,6 +108,51 @@ module Plurimath
|
|
|
108
108
|
false
|
|
109
109
|
end
|
|
110
110
|
|
|
111
|
+
# Some parser paths emit basic operators as generic symbols instead
|
|
112
|
+
# of their semantic classes, and a hand-built Formula may hold any of
|
|
113
|
+
# them, so the generic symbol answers for every operator from its own
|
|
114
|
+
# value (parsed `+`/`^` arrive as Plus/Hat, so these are inert there).
|
|
115
|
+
def plus_operator?
|
|
116
|
+
value == "+"
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def minus_operator?
|
|
120
|
+
value == "-"
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def multiply_operator?
|
|
124
|
+
value == "*"
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def divide_operator?
|
|
128
|
+
value == "/"
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def power_operator?
|
|
132
|
+
value == "^"
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# A plain symbol names a variable through its `value`. Symbol
|
|
136
|
+
# subclasses (Pi, Plus, ...) carry no `value`, so they return nil here
|
|
137
|
+
# and are never treated as variables.
|
|
138
|
+
def variable_name
|
|
139
|
+
return if reserved_constant || value.nil? || value.empty? || operator?
|
|
140
|
+
|
|
141
|
+
value
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Symbol classes that represent constants (e.g. Pi) override
|
|
145
|
+
# #reserved_constant; everything else resolves through bindings.
|
|
146
|
+
def evaluate(evaluator)
|
|
147
|
+
constant = reserved_constant
|
|
148
|
+
return constant if constant
|
|
149
|
+
|
|
150
|
+
name = variable_name
|
|
151
|
+
evaluator.unsupported(self) unless name
|
|
152
|
+
|
|
153
|
+
evaluator.value_for(name)
|
|
154
|
+
end
|
|
155
|
+
|
|
111
156
|
def omml_nodes(_, options:)
|
|
112
157
|
Array(t_tag(options: options))
|
|
113
158
|
end
|
data/lib/plurimath/math.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
module Plurimath
|
|
4
4
|
module Math
|
|
5
5
|
autoload :Core, "#{__dir__}/math/core"
|
|
6
|
+
autoload :Evaluation, "#{__dir__}/math/evaluation"
|
|
6
7
|
autoload :Formula, "#{__dir__}/math/formula"
|
|
7
8
|
autoload :Function, "#{__dir__}/math/function"
|
|
8
9
|
autoload :InvalidTypeError, "#{__dir__}/errors/invalid_type_error"
|
|
@@ -32,7 +33,10 @@ module Plurimath
|
|
|
32
33
|
unknown_options = options.keys - SUPPORTED_PARSE_OPTIONS
|
|
33
34
|
raise_unknown_parse_options!(unknown_options) unless unknown_options.empty?
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
if options.key?(:locale) && !localized_parse_type?(type)
|
|
37
|
+
raise_unsupported_parse_option!(type,
|
|
38
|
+
:locale)
|
|
39
|
+
end
|
|
36
40
|
options = normalize_parse_options(options)
|
|
37
41
|
|
|
38
42
|
begin
|
|
@@ -174,6 +174,24 @@ module Plurimath
|
|
|
174
174
|
"+": "+",
|
|
175
175
|
"-": "-",
|
|
176
176
|
}.freeze
|
|
177
|
+
# Over/under accent decorations. In MathML these are only ever expressed
|
|
178
|
+
# as <mover>/<munder> with a base (recovered from their diacritic
|
|
179
|
+
# CHARACTER), never as a bare <mi>/<mo> identifier word. So a bare token
|
|
180
|
+
# whose text is one of these names is a literal identifier (e.g. the unit
|
|
181
|
+
# "bar"), not the accent. See unitsml/unitsdb#123.
|
|
182
|
+
ACCENT_WORDS = %w[
|
|
183
|
+
bar overline ul hat vec tilde dot ddot obrace ubrace overleftrightarrow
|
|
184
|
+
].freeze
|
|
185
|
+
|
|
186
|
+
# True when +string+ is a bare word naming an over/under accent. Such
|
|
187
|
+
# tokens are literal identifiers in MathML (the accent itself is a
|
|
188
|
+
# diacritic character inside <mover>/<munder>), so callers must not
|
|
189
|
+
# promote them to accent operators. AsciiMath/LaTeX word forms
|
|
190
|
+
# (bar(x), \bar{x}) are parsed elsewhere and never reach this predicate.
|
|
191
|
+
def self.accent_word?(string)
|
|
192
|
+
ACCENT_WORDS.include?(string&.strip)
|
|
193
|
+
end
|
|
194
|
+
|
|
177
195
|
CLASSES = %w[
|
|
178
196
|
mathfrak
|
|
179
197
|
underset
|
|
@@ -21,9 +21,26 @@ module Plurimath
|
|
|
21
21
|
locale: @locale,
|
|
22
22
|
precision: @precision,
|
|
23
23
|
format: {}
|
|
24
|
+
)
|
|
25
|
+
result = formatted_number(
|
|
26
|
+
number_string,
|
|
27
|
+
locale: locale,
|
|
28
|
+
precision: precision,
|
|
29
|
+
format: format,
|
|
30
|
+
)
|
|
31
|
+
result.to_s
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def formatted_number(
|
|
35
|
+
number_string,
|
|
36
|
+
locale: @locale,
|
|
37
|
+
precision: @precision,
|
|
38
|
+
format: {}
|
|
24
39
|
)
|
|
25
40
|
locale = supported_locale(locale)
|
|
26
|
-
|
|
41
|
+
format = validated_format(format)
|
|
42
|
+
base = format.fetch(:base, Formatter::Numbers::Base::DEFAULT_BASE)
|
|
43
|
+
source = Formatter::Numbers::Source.new(number_string, base: base)
|
|
27
44
|
options = format_options(source, locale, precision, format)
|
|
28
45
|
|
|
29
46
|
if options.notation_supported?
|
|
@@ -33,6 +50,14 @@ module Plurimath
|
|
|
33
50
|
render_localized_number(source, options)
|
|
34
51
|
end
|
|
35
52
|
|
|
53
|
+
# Formula-aware entry point. Returns a FormattedNumber,
|
|
54
|
+
# FormattedNotation, or String. Override in subclasses that need the
|
|
55
|
+
# Formula/Number context for rendering decisions; the default delegates
|
|
56
|
+
# to #formatted_number with the merged format hash.
|
|
57
|
+
def format_number(_formula, number, format: {})
|
|
58
|
+
formatted_number(number.value.to_s, format: format)
|
|
59
|
+
end
|
|
60
|
+
|
|
36
61
|
def twitter_cldr_reader(locale: @locale)
|
|
37
62
|
symbols_for(supported_locale(locale), {})
|
|
38
63
|
end
|
|
@@ -66,8 +91,8 @@ module Plurimath
|
|
|
66
91
|
def symbol_resolver(locale)
|
|
67
92
|
Formatter::Numbers::SymbolResolver.new(
|
|
68
93
|
locale,
|
|
69
|
-
localizer_symbols: localizer_symbols,
|
|
70
|
-
localize_number: localize_number,
|
|
94
|
+
localizer_symbols: validated_localizer_symbols(localizer_symbols),
|
|
95
|
+
localize_number: validated_localize_number(localize_number),
|
|
71
96
|
)
|
|
72
97
|
end
|
|
73
98
|
|
|
@@ -75,8 +100,43 @@ module Plurimath
|
|
|
75
100
|
symbol_resolver(locale).resolve.merge(format)
|
|
76
101
|
end
|
|
77
102
|
|
|
103
|
+
# Locale always falls back to :en for any unsupported value, including
|
|
104
|
+
# nil and non-string/symbol types; it never raises.
|
|
78
105
|
def supported_locale(locale)
|
|
106
|
+
return :en unless locale.is_a?(String) || locale.is_a?(Symbol)
|
|
107
|
+
|
|
79
108
|
Formatter::SupportedLocales::LOCALES.key?(locale.to_sym) ? locale.to_sym : :en
|
|
80
109
|
end
|
|
110
|
+
|
|
111
|
+
def validated_format(format)
|
|
112
|
+
return {} if format.nil?
|
|
113
|
+
unless format.is_a?(Hash)
|
|
114
|
+
raise Plurimath::ConfigurationError.new(
|
|
115
|
+
:invalid_formatter_option,
|
|
116
|
+
option: :format,
|
|
117
|
+
value: format,
|
|
118
|
+
supported: "a Hash of formatter options",
|
|
119
|
+
)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
format
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def validated_localize_number(value)
|
|
126
|
+
return value if value.nil? || value.is_a?(String)
|
|
127
|
+
|
|
128
|
+
raise Plurimath::ConfigurationError.new(
|
|
129
|
+
:invalid_formatter_option, option: :localize_number, value: value, supported: "a String"
|
|
130
|
+
)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def validated_localizer_symbols(value)
|
|
134
|
+
return {} if value.nil?
|
|
135
|
+
return value if value.is_a?(Hash)
|
|
136
|
+
|
|
137
|
+
raise Plurimath::ConfigurationError.new(
|
|
138
|
+
:invalid_formatter_option, option: :localizer_symbols, value: value, supported: "a Hash"
|
|
139
|
+
)
|
|
140
|
+
end
|
|
81
141
|
end
|
|
82
142
|
end
|
|
@@ -216,7 +216,8 @@ module Plurimath
|
|
|
216
216
|
def accent_value(value)
|
|
217
217
|
accent = value.first
|
|
218
218
|
unless accent.is_a?(Math::Function::UnaryFunction)
|
|
219
|
-
return Math::Function::Overset.new(accent, value.last,
|
|
219
|
+
return Math::Function::Overset.new(accent, value.last,
|
|
220
|
+
{ accent: true })
|
|
220
221
|
end
|
|
221
222
|
|
|
222
223
|
accent.attributes = { accent: true }
|
|
@@ -241,7 +241,10 @@ module Plurimath
|
|
|
241
241
|
chr = first_omml_child(pr&.chr)&.val
|
|
242
242
|
value = omml_argument_value(node.e)
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
if group_character_above?(pr)
|
|
245
|
+
return group_character_above_value(chr,
|
|
246
|
+
value)
|
|
247
|
+
end
|
|
245
248
|
|
|
246
249
|
group_character_below_value(chr, value)
|
|
247
250
|
end
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
# Preload Math namespace/core so symbol classes resolve correctly in Opal.
|
|
2
2
|
require 'plurimath/math'
|
|
3
3
|
require 'plurimath/math/core'
|
|
4
|
+
require 'plurimath/math/evaluation'
|
|
5
|
+
require 'plurimath/errors/evaluation'
|
|
6
|
+
require 'plurimath/errors/evaluation/error'
|
|
7
|
+
require 'plurimath/errors/evaluation/missing_variable_error'
|
|
8
|
+
require 'plurimath/errors/evaluation/unsupported_expression_error'
|
|
9
|
+
require 'plurimath/errors/evaluation/division_by_zero_error'
|
|
10
|
+
require 'plurimath/errors/evaluation/invalid_binding_error'
|
|
11
|
+
require 'plurimath/errors/evaluation/invalid_binding_key_error'
|
|
12
|
+
require 'plurimath/errors/evaluation/math_domain_error'
|
|
13
|
+
require 'plurimath/errors/evaluation/non_finite_result_error'
|
|
14
|
+
require 'plurimath/math/evaluation/evaluator'
|
|
15
|
+
require 'plurimath/math/evaluation/expression_parser'
|
|
16
|
+
require 'plurimath/math/evaluation/iteration'
|
|
4
17
|
require 'plurimath/math/symbols/symbol'
|
|
5
18
|
require 'plurimath/math/symbols/paren'
|
|
6
19
|
|