plurimath 0.11.1 → 0.11.4
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 +108 -175
- data/Gemfile +1 -0
- data/README.adoc +282 -6
- 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/cli.rb +1 -1
- data/lib/plurimath/configuration.rb +9 -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.rb +1 -0
- data/lib/plurimath/formatter/numbers/base_notation.rb +54 -31
- 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 +1 -1
- data/lib/plurimath/formatter/numbers/mathml_renderer.rb +56 -0
- data/lib/plurimath/formatter/numbers/notation_renderer.rb +30 -29
- data/lib/plurimath/formatter/numbers/number_renderer.rb +10 -9
- data/lib/plurimath/formatter/numbers/omml_renderer.rb +74 -0
- data/lib/plurimath/formatter/numbers/source.rb +29 -4
- data/lib/plurimath/formatter/numbers/text_renderer.rb +52 -0
- data/lib/plurimath/formatter/numbers.rb +6 -2
- data/lib/plurimath/html/parse.rb +5 -0
- data/lib/plurimath/html/transform.rb +2 -0
- data/lib/plurimath/latex/parse.rb +5 -0
- data/lib/plurimath/latex/transform.rb +2 -0
- data/lib/plurimath/math/core.rb +52 -0
- 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 +10 -1
- 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/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 +40 -29
- 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 +1 -0
- data/lib/plurimath/mathml/constants.rb +18 -0
- data/lib/plurimath/number_formatter.rb +47 -28
- data/lib/plurimath/omml/formula_transformation.rb +17 -2
- data/lib/plurimath/omml/translator.rb +2 -0
- data/lib/plurimath/setup/opal.rb.erb +13 -0
- data/lib/plurimath/unicode_math/parse.rb +5 -1
- data/lib/plurimath/unicode_math/transform.rb +469 -755
- data/lib/plurimath/utility.rb +2 -2
- data/lib/plurimath/version.rb +1 -1
- data/lib/plurimath.rb +1 -0
- data/plurimath.gemspec +1 -1
- metadata +23 -5
- data/lib/plurimath/formatter/numbers/parts_renderer.rb +0 -30
data/lib/plurimath/utility.rb
CHANGED
|
@@ -437,7 +437,7 @@ lang: nil)
|
|
|
437
437
|
symbol = Mathml::Constants::UNICODE_SYMBOLS[unicode.strip.to_sym]
|
|
438
438
|
if classes.include?(symbol&.strip)
|
|
439
439
|
get_class(symbol.strip).new
|
|
440
|
-
elsif classes.any?(string&.strip)
|
|
440
|
+
elsif classes.any?(string&.strip) && !(lang == :mathml && Mathml::Constants.accent_word?(string))
|
|
441
441
|
get_class(string.strip).new
|
|
442
442
|
elsif omml
|
|
443
443
|
text_classes(string,
|
|
@@ -552,7 +552,7 @@ lang: nil)
|
|
|
552
552
|
if value.last.is_a?(Math::Function::UnaryFunction)
|
|
553
553
|
value.last.parameter_one = value.shift if value.length > 1
|
|
554
554
|
value.last.attributes = attrs.transform_values do |v|
|
|
555
|
-
|
|
555
|
+
v.to_s == "true"
|
|
556
556
|
end
|
|
557
557
|
end
|
|
558
558
|
value
|
data/lib/plurimath/version.rb
CHANGED
data/lib/plurimath.rb
CHANGED
|
@@ -7,6 +7,7 @@ require "plurimath/xml_engine"
|
|
|
7
7
|
|
|
8
8
|
module Plurimath
|
|
9
9
|
autoload :Asciimath, "plurimath/asciimath"
|
|
10
|
+
autoload :BaseNumberPrefix, "plurimath/base_number_prefix"
|
|
10
11
|
autoload :Cli, "plurimath/cli" unless RUBY_ENGINE == "opal"
|
|
11
12
|
autoload :Configuration, "plurimath/configuration"
|
|
12
13
|
autoload :Deprecation, "plurimath/deprecation"
|
data/plurimath.gemspec
CHANGED
|
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
spec.add_dependency "htmlentities"
|
|
32
32
|
spec.add_dependency "lutaml-model", "~> 0.8.0"
|
|
33
33
|
spec.add_dependency "mml", "~> 2.3.6"
|
|
34
|
-
spec.add_dependency "omml", "~> 0.2.
|
|
34
|
+
spec.add_dependency "omml", "~> 0.2.5"
|
|
35
35
|
spec.add_dependency "ostruct"
|
|
36
36
|
spec.add_dependency "ox"
|
|
37
37
|
spec.add_dependency "parslet"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: plurimath
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bigdecimal
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 0.2.
|
|
75
|
+
version: 0.2.5
|
|
76
76
|
type: :runtime
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 0.2.
|
|
82
|
+
version: 0.2.5
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: ostruct
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -192,6 +192,7 @@ files:
|
|
|
192
192
|
- lib/plurimath/asciimath/parse.rb
|
|
193
193
|
- lib/plurimath/asciimath/parser.rb
|
|
194
194
|
- lib/plurimath/asciimath/transform.rb
|
|
195
|
+
- lib/plurimath/base_number_prefix.rb
|
|
195
196
|
- lib/plurimath/cli.rb
|
|
196
197
|
- lib/plurimath/configuration.rb
|
|
197
198
|
- lib/plurimath/deprecation.rb
|
|
@@ -199,6 +200,15 @@ files:
|
|
|
199
200
|
- lib/plurimath/errors/configuration_error.rb
|
|
200
201
|
- lib/plurimath/errors/deprecation_error.rb
|
|
201
202
|
- lib/plurimath/errors/error.rb
|
|
203
|
+
- lib/plurimath/errors/evaluation.rb
|
|
204
|
+
- lib/plurimath/errors/evaluation/division_by_zero_error.rb
|
|
205
|
+
- lib/plurimath/errors/evaluation/error.rb
|
|
206
|
+
- lib/plurimath/errors/evaluation/invalid_binding_error.rb
|
|
207
|
+
- lib/plurimath/errors/evaluation/invalid_binding_key_error.rb
|
|
208
|
+
- lib/plurimath/errors/evaluation/math_domain_error.rb
|
|
209
|
+
- lib/plurimath/errors/evaluation/missing_variable_error.rb
|
|
210
|
+
- lib/plurimath/errors/evaluation/non_finite_result_error.rb
|
|
211
|
+
- lib/plurimath/errors/evaluation/unsupported_expression_error.rb
|
|
202
212
|
- lib/plurimath/errors/invalid_number.rb
|
|
203
213
|
- lib/plurimath/errors/invalid_type_error.rb
|
|
204
214
|
- lib/plurimath/errors/omml/unsupported_node_error.rb
|
|
@@ -212,17 +222,21 @@ files:
|
|
|
212
222
|
- lib/plurimath/formatter/numbers/base_notation.rb
|
|
213
223
|
- lib/plurimath/formatter/numbers/digit_sequence.rb
|
|
214
224
|
- lib/plurimath/formatter/numbers/format_options.rb
|
|
225
|
+
- lib/plurimath/formatter/numbers/formatted_notation.rb
|
|
226
|
+
- lib/plurimath/formatter/numbers/formatted_number.rb
|
|
215
227
|
- lib/plurimath/formatter/numbers/fraction.rb
|
|
216
228
|
- lib/plurimath/formatter/numbers/integer.rb
|
|
229
|
+
- lib/plurimath/formatter/numbers/mathml_renderer.rb
|
|
217
230
|
- lib/plurimath/formatter/numbers/notation_renderer.rb
|
|
218
231
|
- lib/plurimath/formatter/numbers/number_renderer.rb
|
|
232
|
+
- lib/plurimath/formatter/numbers/omml_renderer.rb
|
|
219
233
|
- lib/plurimath/formatter/numbers/parts.rb
|
|
220
|
-
- lib/plurimath/formatter/numbers/parts_renderer.rb
|
|
221
234
|
- lib/plurimath/formatter/numbers/precision_resolver.rb
|
|
222
235
|
- lib/plurimath/formatter/numbers/sign_renderer.rb
|
|
223
236
|
- lib/plurimath/formatter/numbers/significant.rb
|
|
224
237
|
- lib/plurimath/formatter/numbers/source.rb
|
|
225
238
|
- lib/plurimath/formatter/numbers/symbol_resolver.rb
|
|
239
|
+
- lib/plurimath/formatter/numbers/text_renderer.rb
|
|
226
240
|
- lib/plurimath/formatter/standard.rb
|
|
227
241
|
- lib/plurimath/formatter/supported_locales.rb
|
|
228
242
|
- lib/plurimath/html.rb
|
|
@@ -238,6 +252,10 @@ files:
|
|
|
238
252
|
- lib/plurimath/latex/transform.rb
|
|
239
253
|
- lib/plurimath/math.rb
|
|
240
254
|
- lib/plurimath/math/core.rb
|
|
255
|
+
- lib/plurimath/math/evaluation.rb
|
|
256
|
+
- lib/plurimath/math/evaluation/evaluator.rb
|
|
257
|
+
- lib/plurimath/math/evaluation/expression_parser.rb
|
|
258
|
+
- lib/plurimath/math/evaluation/iteration.rb
|
|
241
259
|
- lib/plurimath/math/formula.rb
|
|
242
260
|
- lib/plurimath/math/formula/mrow.rb
|
|
243
261
|
- lib/plurimath/math/formula/mstyle.rb
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Plurimath
|
|
4
|
-
module Formatter
|
|
5
|
-
module Numbers
|
|
6
|
-
# Renders already-transformed Parts into localized integer/fraction text.
|
|
7
|
-
class PartsRenderer
|
|
8
|
-
def initialize(integer_formatter:, fraction_formatter:)
|
|
9
|
-
@integer_formatter = integer_formatter
|
|
10
|
-
@fraction_formatter = fraction_formatter
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def render(parts)
|
|
14
|
-
rendered = integer_formatter.format_groups(parts.integer_digits)
|
|
15
|
-
return rendered unless parts.fractional?
|
|
16
|
-
|
|
17
|
-
"#{rendered}#{fraction_formatter.decimal}#{formatted_fraction(parts)}"
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
private
|
|
21
|
-
|
|
22
|
-
attr_reader :fraction_formatter, :integer_formatter
|
|
23
|
-
|
|
24
|
-
def formatted_fraction(parts)
|
|
25
|
-
fraction_formatter.format_groups(parts.fraction_digits)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|