plurimath 0.8.25 → 0.8.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0d7ee4256ab83d3095548450106032cf44dea17f7cd3918094a4eb694a824d5
4
- data.tar.gz: 931df05dfa07ad97d8c7b1a39ecce17216e0587ffb36395b602f899a0ee15eb4
3
+ metadata.gz: 567734f98d50c880712b5f5e044b44698872fddb28f9a42d6db7f9be2c3d14f4
4
+ data.tar.gz: f070e5341608e4135e83c5715e2af06c849a56c28deeda6a3d69a6892af83d86
5
5
  SHA512:
6
- metadata.gz: e6d918b4b4991b767b261a3f12e80d167af6b8d5a0cf877c29741cf79e62c93727ebce68546410798ecfb31c5ae75030623c36a1bb595fd1d628fbb22f48790e
7
- data.tar.gz: 754a5efc72f878c15cf9066b352d4c45f3c647432c44bbb187249a7d86a4d62794fdcc1c264ff865e63833916f3e5f75177dccd20fd5137cbfebaa522b03346c
6
+ metadata.gz: cf74d549f20a7d2af98744ebbf10e1c68c78b550e11a2b56c7a66f1fb4ea68313044987144b26403f91658201c3a0892520434b7b6d2b10745dc2962cd9b96c4
7
+ data.tar.gz: a11b93465a74fd63518cb9c2336fcf7a843f067e32018f701a8d838276881b54a214453d1d4c5568ac82b7bd06f471de83961a8dfebe15eacc610f8bb0879c38
@@ -18,7 +18,7 @@ module Plurimath
18
18
  end
19
19
 
20
20
  def element_order=(value)
21
- @value = validated_order(value, rejectable_array: ["comment"])
21
+ @value = validated_order(value&.map(&:name), rejectable_array: ["comment"])
22
22
  end
23
23
 
24
24
  def content; end
@@ -308,7 +308,7 @@ module Plurimath
308
308
  end
309
309
 
310
310
  def element_order=(value)
311
- @value = validated_order(value)
311
+ @value = validated_order(value.map(&:name))
312
312
  end
313
313
 
314
314
  # Attributes start
@@ -186,7 +186,7 @@ module Plurimath
186
186
  end
187
187
 
188
188
  def element_order=(value)
189
- @parameter_two = validated_order(value)
189
+ @parameter_two = validated_order(value&.map(&:name))
190
190
  end
191
191
 
192
192
  def mi_value=(value)
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "unary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class None < UnaryFunction
10
+ include Mathml::Utility
11
+
9
12
  def to_asciimath(**); end
10
13
 
11
14
  def to_latex(**); end
@@ -27,7 +27,7 @@ module Plurimath
27
27
 
28
28
  def element_order=(value)
29
29
  @temp_mathml_order = validated_order(
30
- value,
30
+ value&.map(&:name),
31
31
  rejectable_array: ["comment"]
32
32
  )
33
33
  end
@@ -41,7 +41,7 @@ module Plurimath
41
41
  end
42
42
 
43
43
  def value=(value)
44
- @value = value.is_a?(Array) ? value.join : value.to_s
44
+ @value = value.is_a?(Array) ? value.join : value&.to_s
45
45
  end
46
46
 
47
47
  def to_mathml_without_math_tag(intent, **)
@@ -1,67 +1,67 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "constants"
4
+ require "mml"
4
5
 
5
6
  module Plurimath
6
7
  class Mathml
7
8
  class Parser
9
+ CONFIGURATION = {
10
+ Mml::MathWithNilNamespace => Plurimath::Math::Formula,
11
+ Mml::MathWithNamespace => Plurimath::Math::Formula,
12
+ Mml::Mmultiscripts => Plurimath::Math::Function::Multiscript,
13
+ Mml::Mlabeledtr => Plurimath::Math::Function::Mlabeledtr,
14
+ Mml::Munderover => Plurimath::Math::Function::Underover,
15
+ Mml::Semantics => Plurimath::Math::Function::Semantics,
16
+ Mml::Mscarries => Plurimath::Math::Function::Scarries,
17
+ Mml::Mfraction => Plurimath::Math::Function::Frac,
18
+ Mml::Menclose => Plurimath::Math::Function::Menclose,
19
+ Mml::Mlongdiv => Plurimath::Math::Function::Longdiv,
20
+ Mml::Mphantom => Plurimath::Math::Function::Phantom,
21
+ Mml::Msubsup => Plurimath::Math::Function::PowerBase,
22
+ Mml::Msgroup => Plurimath::Math::Function::Msgroup,
23
+ Mml::Mpadded => Plurimath::Math::Function::Mpadded,
24
+ Mml::Mfenced => Plurimath::Math::Function::Fenced,
25
+ Mml::Mstack => Plurimath::Math::Function::Stackrel,
26
+ Mml::Munder => Plurimath::Math::Function::Underset,
27
+ Mml::Msline => Plurimath::Math::Function::Msline,
28
+ Mml::Merror => Plurimath::Math::Function::Merror,
29
+ Mml::Mtable => Plurimath::Math::Function::Table,
30
+ Mml::Mstyle => Plurimath::Math::Formula::Mstyle,
31
+ Mml::Mglyph => Plurimath::Math::Function::Mglyph,
32
+ Mml::Mover => Plurimath::Math::Function::Overset,
33
+ Mml::Msqrt => Plurimath::Math::Function::Sqrt,
34
+ Mml::Mroot => Plurimath::Math::Function::Root,
35
+ Mml::Mtext => Plurimath::Math::Function::Text,
36
+ Mml::Mfrac => Plurimath::Math::Function::Frac,
37
+ Mml::Msrow => Plurimath::Math::Formula,
38
+ Mml::Msup => Plurimath::Math::Function::Power,
39
+ Mml::Msub => Plurimath::Math::Function::Base,
40
+ Mml::None => Plurimath::Math::Function::None,
41
+ Mml::Mrow => Plurimath::Math::Formula::Mrow,
42
+ Mml::Mtd => Plurimath::Math::Function::Td,
43
+ Mml::Mtr => Plurimath::Math::Function::Tr,
44
+ Mml::Mi => Plurimath::Math::Symbols::Symbol,
45
+ Mml::Mo => Plurimath::Math::Symbols::Symbol,
46
+ Mml::Ms => Plurimath::Math::Function::Ms,
47
+ Mml::Mn => Plurimath::Math::Number,
48
+ }
8
49
  attr_accessor :text
50
+ @@models_set = false
9
51
 
10
52
  def initialize(text)
11
- mml_config
53
+ mml_config unless @@models_set
12
54
  @text = text
13
55
  end
14
56
 
15
57
  def parse
16
58
  namespace_exist = text.split(">").first.include?(" xmlns=")
17
- ::Mml.parse(text, namespace_exist: namespace_exist)
59
+ Mml.parse(text, namespace_exist: namespace_exist)
18
60
  end
19
61
 
20
- private
21
-
22
62
  def mml_config
23
- return if ::Mml.respond_to?(:config)
24
-
25
- ::Mml::Configuration.config = {
26
- mmultiscripts: Plurimath::Math::Function::Multiscript,
27
- mlabeledtr: Plurimath::Math::Function::Mlabeledtr,
28
- munderover: Plurimath::Math::Function::Underover,
29
- semantics: Plurimath::Math::Function::Semantics,
30
- mscarries: Plurimath::Math::Function::Scarries,
31
- mfraction: Plurimath::Math::Function::Frac,
32
- menclose: Plurimath::Math::Function::Menclose,
33
- mlongdiv: Plurimath::Math::Function::Longdiv,
34
- mphantom: Plurimath::Math::Function::Phantom,
35
- msubsup: Plurimath::Math::Function::PowerBase,
36
- msgroup: Plurimath::Math::Function::Msgroup,
37
- mpadded: Plurimath::Math::Function::Mpadded,
38
- mfenced: Plurimath::Math::Function::Fenced,
39
- mstack: Plurimath::Math::Function::Stackrel,
40
- munder: Plurimath::Math::Function::Underset,
41
- msline: Plurimath::Math::Function::Msline,
42
- merror: Plurimath::Math::Function::Merror,
43
- mtable: Plurimath::Math::Function::Table,
44
- mstyle: Plurimath::Math::Formula::Mstyle,
45
- mglyph: Plurimath::Math::Function::Mglyph,
46
- mover: Plurimath::Math::Function::Overset,
47
- msqrt: Plurimath::Math::Function::Sqrt,
48
- mroot: Plurimath::Math::Function::Root,
49
- mtext: Plurimath::Math::Function::Text,
50
- mfrac: Plurimath::Math::Function::Frac,
51
- msrow: Plurimath::Math::Formula,
52
- msup: Plurimath::Math::Function::Power,
53
- msub: Plurimath::Math::Function::Base,
54
- none: Plurimath::Math::Function::None,
55
- mrow: Plurimath::Math::Formula::Mrow,
56
- math: Plurimath::Math::Formula,
57
- mtd: Plurimath::Math::Function::Td,
58
- mtr: Plurimath::Math::Function::Tr,
59
- mi: Plurimath::Math::Symbols::Symbol,
60
- mo: Plurimath::Math::Symbols::Symbol,
61
- ms: Plurimath::Math::Function::Ms,
62
- mn: Plurimath::Math::Number,
63
- }
64
- require "mml"
63
+ Mml::Configuration.custom_models = CONFIGURATION
64
+ @@models_set = true
65
65
  end
66
66
  end
67
67
  end
@@ -104,6 +104,8 @@ module Plurimath
104
104
  when Array
105
105
  array_validations(value)
106
106
  when Math::Symbols::Symbol
107
+ return value if value.value.nil?
108
+
107
109
  mathml_symbol_to_class(value.value)
108
110
  when String
109
111
  mathml_symbol_to_class(value)
@@ -12,7 +12,7 @@ module Plurimath
12
12
  attr_accessor :temp_mathml_order
13
13
 
14
14
  def element_order=(value)
15
- @temp_mathml_order = Array(validated_order(value))
15
+ @temp_mathml_order = Array(validated_order(value&.map(&:name)))
16
16
  end
17
17
 
18
18
  def clear_temp_order
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Plurimath
4
- VERSION = "0.8.25"
4
+ VERSION = "0.8.26"
5
5
  end
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.8.25
4
+ version: 0.8.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-07 00:00:00.000000000 Z
11
+ date: 2025-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ox