mml 2.0.1 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4edc2cd98bf5ea40cd990bc2f7de88334fda8964d0d50b5c7a3347624276dca6
4
- data.tar.gz: aaec60ab3f027aa98e7f1bc8690551714414f463802cd981c6f724da8c4c8e9a
3
+ metadata.gz: b4534e22a8c030145f41918044bbfb90390f9dc769cb6cc6c00494bfd308f959
4
+ data.tar.gz: 935e60485c754b7c5cc9d0a3a7e7a07e4674ba584f5f439de2d77f2428b0a406
5
5
  SHA512:
6
- metadata.gz: d6db4bcf4ae1dd66116a5e6e5a90915f2e03ccf205840752fcf682f693e0078a46a38a89f5fa7178101d2fa0400c4638d3afda8561ecc6cdd7ec04f75b5b7b6f
7
- data.tar.gz: 412834bc7a1872505e480d35c01a58c35cde48eeac5525239d6da2d0622e67597a2735ada95baf0f9fa77c4155c330e8597b98b960282e364d3399a8f5de37d3
6
+ metadata.gz: e535b06933158eed3b043dc21464c2b2f1d199a7b3f8d563bf4065173e28219dd76dbd5c8d874f5e7f6617d5ffa13140befe1c4d92c5bbe79b8603c16245d5bb
7
+ data.tar.gz: d45a10ba72fe8c6830cfc4d7e481837e8035807a22f7f4e16f7c117e99d967fd014bea1b5d0eb778fca11daa1754ba7443891729a89d74b7e6f1db09125a1c0d
data/.rubocop.yml CHANGED
@@ -1,11 +1,14 @@
1
- AllCops:
2
- TargetRubyVersion: 3.0
3
-
4
- Style/StringLiterals:
5
- EnforcedStyle: double_quotes
1
+ inherit_from:
2
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
3
+ - .rubocop_todo.yml
6
4
 
7
- Style/StringLiteralsInInterpolation:
8
- EnforcedStyle: double_quotes
5
+ require:
6
+ - rubocop-performance
7
+ - rubocop-rake
8
+ - rubocop-rspec
9
9
 
10
- Documentation:
11
- Enabled: false
10
+ AllCops:
11
+ TargetRubyVersion: 3.0
12
+ NewCops: enable
13
+ Exclude:
14
+ - 'vendor/**/*'
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,115 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2025-03-29 09:22:55 UTC using RuboCop version 1.75.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: Include.
12
+ # Include: **/*.gemspec
13
+ Gemspec/AddRuntimeDependency:
14
+ Exclude:
15
+ - 'mml.gemspec'
16
+
17
+ # Offense count: 1
18
+ # This cop supports safe autocorrection (--autocorrect).
19
+ # Configuration parameters: Severity, Include.
20
+ # Include: **/*.gemspec
21
+ Gemspec/DeprecatedAttributeAssignment:
22
+ Exclude:
23
+ - 'mml.gemspec'
24
+
25
+ # Offense count: 1
26
+ # This cop supports safe autocorrection (--autocorrect).
27
+ # Configuration parameters: Severity, Include.
28
+ # Include: **/*.gemspec
29
+ Gemspec/RequireMFA:
30
+ Exclude:
31
+ - 'mml.gemspec'
32
+
33
+ # Offense count: 1
34
+ # This cop supports safe autocorrection (--autocorrect).
35
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
36
+ # SupportedStyles: with_first_argument, with_fixed_indentation
37
+ Layout/ArgumentAlignment:
38
+ Exclude:
39
+ - 'lib/mml/common_attributes.rb'
40
+
41
+ # Offense count: 6
42
+ # This cop supports safe autocorrection (--autocorrect).
43
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
44
+ # SupportedHashRocketStyles: key, separator, table
45
+ # SupportedColonStyles: key, separator, table
46
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
47
+ Layout/HashAlignment:
48
+ Exclude:
49
+ - 'lib/mml/mscarries.rb'
50
+ - 'lib/mml/mstyle.rb'
51
+
52
+ # Offense count: 1
53
+ # This cop supports safe autocorrection (--autocorrect).
54
+ # Configuration parameters: EnforcedStyle.
55
+ # SupportedStyles: normal, indented_internal_methods
56
+ Layout/IndentationConsistency:
57
+ Exclude:
58
+ - 'mml.gemspec'
59
+
60
+ # Offense count: 8
61
+ # This cop supports safe autocorrection (--autocorrect).
62
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
63
+ # URISchemes: http, https
64
+ Layout/LineLength:
65
+ Exclude:
66
+ - 'lib/mml/common_attributes.rb'
67
+ - 'lib/mml/mscarries.rb'
68
+ - 'lib/mml/mstyle.rb'
69
+ - 'mml.gemspec'
70
+
71
+ # Offense count: 7
72
+ # This cop supports safe autocorrection (--autocorrect).
73
+ # Configuration parameters: AllowInHeredoc.
74
+ Layout/TrailingWhitespace:
75
+ Exclude:
76
+ - 'lib/mml/common_attributes.rb'
77
+ - 'lib/mml/mscarries.rb'
78
+ - 'lib/mml/mstyle.rb'
79
+
80
+ # Offense count: 1
81
+ # Configuration parameters: Prefixes, AllowedPatterns.
82
+ # Prefixes: when, with, without
83
+ RSpec/ContextWording:
84
+ Exclude:
85
+ - 'spec/mml_spec.rb'
86
+
87
+ # Offense count: 5
88
+ # This cop supports unsafe autocorrection (--autocorrect-all).
89
+ # Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
90
+ # SupportedStyles: described_class, explicit
91
+ RSpec/DescribedClass:
92
+ Exclude:
93
+ - 'spec/mml_spec.rb'
94
+
95
+ # Offense count: 2
96
+ # This cop supports safe autocorrection (--autocorrect).
97
+ Style/FileRead:
98
+ Exclude:
99
+ - 'spec/mml_spec.rb'
100
+
101
+ # Offense count: 2
102
+ # This cop supports safe autocorrection (--autocorrect).
103
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
104
+ # SupportedStyles: single_quotes, double_quotes
105
+ Style/StringLiterals:
106
+ Exclude:
107
+ - 'mml.gemspec'
108
+
109
+ # Offense count: 2
110
+ # This cop supports safe autocorrection (--autocorrect).
111
+ # Configuration parameters: EnforcedStyle.
112
+ # SupportedStyles: single_quotes, double_quotes
113
+ Style/StringLiteralsInInterpolation:
114
+ Exclude:
115
+ - 'spec/mml_spec.rb'
data/Gemfile CHANGED
@@ -12,4 +12,5 @@ gem "rake", "~> 12.0"
12
12
  gem "rspec", "~> 3.0"
13
13
  gem "rubocop"
14
14
  gem "rubocop-performance"
15
- gem "rubocop-rails"
15
+ gem "rubocop-rake"
16
+ gem "rubocop-rspec"
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mml
4
+ Mml::Configuration::SUPPORTED_TAGS.each do |tag|
5
+ # `autoload` is `require`, not `require_relative`
6
+ autoload(tag.to_s.capitalize.to_sym, "mml/#{tag}.rb")
7
+ end
8
+
9
+ class CommonAttributes < Lutaml::Model::Serializable
10
+ Mml::Configuration::SUPPORTED_TAGS.each do |tag|
11
+ attribute :"#{tag}_value", Mml.const_get(tag.to_s.capitalize),
12
+ collection: true
13
+ end
14
+
15
+ xml do
16
+ no_root
17
+
18
+ Mml::Configuration::SUPPORTED_TAGS.each do |tag|
19
+ map_element tag, to: :"#{tag}_value"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Mml
4
4
  module Configuration
5
- SUPPORTED_TAGS = %w[
5
+ SUPPORTED_TAGS = %i[
6
6
  mmultiscripts
7
7
  maligngroup
8
8
  malignmark
@@ -42,6 +42,38 @@ module Mml
42
42
  ms
43
43
  ].freeze
44
44
 
45
+ COMMON_ATTRIBUTES_CLASSES = %w[
46
+ MathWithNilNamespace
47
+ MathWithNamespace
48
+ Mmultiscripts
49
+ Munderover
50
+ Semantics
51
+ Mscarries
52
+ Mfraction
53
+ Mlongdiv
54
+ Mphantom
55
+ Menclose
56
+ Mfenced
57
+ Mpadded
58
+ Msubsup
59
+ Msgroup
60
+ Mscarry
61
+ Munder
62
+ Mstyle
63
+ Mstack
64
+ Merror
65
+ Mover
66
+ Mfrac
67
+ Msrow
68
+ Mroot
69
+ Msqrt
70
+ Mrow
71
+ Msub
72
+ Msup
73
+ Mtd
74
+ Ms
75
+ ].freeze
76
+
45
77
  module_function
46
78
 
47
79
  def config
@@ -2,20 +2,12 @@
2
2
 
3
3
  module Mml
4
4
  class MathWithNamespace < Lutaml::Model::Serializable
5
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
6
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
7
- end
8
-
9
5
  attribute :display, :string
10
6
 
11
7
  xml do
12
8
  root "math", mixed: true
13
9
  namespace "http://www.w3.org/1998/Math/MathML", nil
14
10
 
15
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
16
- map_element tag.to_sym, to: :"#{tag}_value"
17
- end
18
-
19
11
  map_attribute :display, to: :display
20
12
  end
21
13
  end
@@ -2,19 +2,11 @@
2
2
 
3
3
  module Mml
4
4
  class MathWithNilNamespace < Lutaml::Model::Serializable
5
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
6
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
7
- end
8
-
9
5
  attribute :display, :string
10
6
 
11
7
  xml do
12
8
  root "math", mixed: true
13
9
 
14
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
15
- map_element tag.to_sym, to: :"#{tag}_value"
16
- end
17
-
18
10
  map_attribute :display, to: :display
19
11
  end
20
12
  end
data/lib/mml/menclose.rb CHANGED
@@ -5,9 +5,6 @@ module Mml
5
5
  attribute :mathcolor, :string
6
6
  attribute :mathbackground, :string
7
7
  attribute :notation, :string
8
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
9
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
10
- end
11
8
 
12
9
  xml do
13
10
  root "menclose", mixed: true
@@ -15,9 +12,6 @@ module Mml
15
12
  map_attribute "mathcolor", to: :mathcolor, namespace: nil
16
13
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
17
14
  map_attribute "notation", to: :notation, namespace: nil
18
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
19
- map_element tag.to_sym, to: :"#{tag}_value"
20
- end
21
15
  end
22
16
  end
23
17
  end
data/lib/mml/merror.rb CHANGED
@@ -4,18 +4,12 @@ module Mml
4
4
  class Merror < Lutaml::Model::Serializable
5
5
  attribute :mathbackground, :string
6
6
  attribute :mathcolor, :string
7
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
8
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
9
- end
10
7
 
11
8
  xml do
12
9
  root "merror", mixed: true
13
10
 
14
11
  map_attribute "mathcolor", to: :mathcolor, namespace: nil
15
12
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
16
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
17
- map_element tag.to_sym, to: :"#{tag}_value"
18
- end
19
13
  end
20
14
  end
21
15
  end
data/lib/mml/mfenced.rb CHANGED
@@ -8,9 +8,6 @@ module Mml
8
8
  attribute :content, :string
9
9
  attribute :close, :string
10
10
  attribute :open, :string
11
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
12
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
13
- end
14
11
 
15
12
  xml do
16
13
  root "mfenced", mixed: true
@@ -22,10 +19,6 @@ module Mml
22
19
  map_attribute "mathcolor", to: :mathcolor, namespace: nil
23
20
  map_attribute "close", to: :close, namespace: nil
24
21
  map_attribute "open", to: :open, namespace: nil
25
-
26
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
27
- map_element tag.to_sym, to: :"#{tag}_value"
28
- end
29
22
  end
30
23
  end
31
24
  end
data/lib/mml/mfrac.rb CHANGED
@@ -8,9 +8,6 @@ module Mml
8
8
  attribute :numalign, :string
9
9
  attribute :denomalign, :string
10
10
  attribute :bevelled, :string
11
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
12
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
13
- end
14
11
 
15
12
  xml do
16
13
  root "mfrac", mixed: true
@@ -21,9 +18,6 @@ module Mml
21
18
  map_attribute "numalign", to: :numalign, namespace: nil
22
19
  map_attribute "denomalign", to: :denomalign, namespace: nil
23
20
  map_attribute "bevelled", to: :bevelled, namespace: nil
24
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
25
- map_element tag.to_sym, to: :"#{tag}_value"
26
- end
27
21
  end
28
22
  end
29
23
  end
data/lib/mml/mfraction.rb CHANGED
@@ -8,9 +8,6 @@ module Mml
8
8
  attribute :numalign, :string
9
9
  attribute :denomalign, :string
10
10
  attribute :bevelled, :string
11
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
12
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
13
- end
14
11
 
15
12
  xml do
16
13
  root "mfraction", mixed: true
@@ -21,9 +18,6 @@ module Mml
21
18
  map_attribute "numalign", to: :numalign, namespace: nil
22
19
  map_attribute "denomalign", to: :denomalign, namespace: nil
23
20
  map_attribute "bevelled", to: :bevelled, namespace: nil
24
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
25
- map_element tag.to_sym, to: :"#{tag}_value"
26
- end
27
21
  end
28
22
  end
29
23
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mml
4
+ autoload(:Mtd, "mml/mtd")
5
+
4
6
  class Mlabeledtr < Lutaml::Model::Serializable
5
7
  attribute :mathbackground, :string
6
8
  attribute :columnalign, :string
data/lib/mml/mlongdiv.rb CHANGED
@@ -7,9 +7,6 @@ module Mml
7
7
  attribute :mathcolor, :string
8
8
  attribute :position, :integer
9
9
  attribute :shift, :integer
10
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
11
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
12
- end
13
10
 
14
11
  xml do
15
12
  root "mlongdiv", mixed: true
@@ -19,9 +16,6 @@ module Mml
19
16
  map_attribute "mathcolor", to: :mathcolor, namespace: nil
20
17
  map_attribute "position", to: :position, namespace: nil
21
18
  map_attribute "shift", to: :shift, namespace: nil
22
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
23
- map_element tag.to_sym, to: :"#{tag}_value"
24
- end
25
19
  end
26
20
  end
27
21
  end
@@ -1,15 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mml
4
+ autoload(:Mprescripts, "mml/mprescripts")
5
+
4
6
  class Mmultiscripts < Lutaml::Model::Serializable
5
7
  attribute :mathcolor, :string
6
8
  attribute :mathbackground, :string
7
9
  attribute :subscriptshift, :string
8
10
  attribute :superscriptshift, :string
9
11
  attribute :mprescripts_value, Mprescripts
10
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
11
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
12
- end
13
12
 
14
13
  xml do
15
14
  root "mmultiscripts", mixed: true
@@ -19,9 +18,6 @@ module Mml
19
18
  map_attribute "subscriptshift", to: :subscriptshift, namespace: nil
20
19
  map_attribute "superscriptshift", to: :superscriptshift, namespace: nil
21
20
  map_element "mprescripts", to: :mprescripts_value
22
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
23
- map_element tag.to_sym, to: :"#{tag}_value"
24
- end
25
21
  end
26
22
  end
27
23
  end
data/lib/mml/mover.rb CHANGED
@@ -6,9 +6,6 @@ module Mml
6
6
  attribute :mathcolor, :string
7
7
  attribute :accent, :string
8
8
  attribute :align, :string
9
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
10
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
11
- end
12
9
 
13
10
  xml do
14
11
  root "mover", mixed: true
@@ -17,9 +14,6 @@ module Mml
17
14
  map_attribute "mathcolor", to: :mathcolor, namespace: nil
18
15
  map_attribute "accent", to: :accent, namespace: nil
19
16
  map_attribute "align", to: :align, namespace: nil
20
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
21
- map_element tag.to_sym, to: :"#{tag}_value"
22
- end
23
17
  end
24
18
  end
25
19
  end
data/lib/mml/mpadded.rb CHANGED
@@ -9,9 +9,6 @@ module Mml
9
9
  attribute :lspace, :string
10
10
  attribute :depth, :string
11
11
  attribute :width, :string
12
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
13
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
14
- end
15
12
 
16
13
  xml do
17
14
  root "mpadded", mixed: true
@@ -23,9 +20,6 @@ module Mml
23
20
  map_attribute "lspace", to: :lspace, namespace: nil
24
21
  map_attribute "depth", to: :depth, namespace: nil
25
22
  map_attribute "width", to: :width, namespace: nil
26
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
27
- map_element tag.to_sym, to: :"#{tag}_value"
28
- end
29
23
  end
30
24
  end
31
25
  end
data/lib/mml/mphantom.rb CHANGED
@@ -4,18 +4,12 @@ module Mml
4
4
  class Mphantom < Lutaml::Model::Serializable
5
5
  attribute :mathcolor, :string
6
6
  attribute :mathbackground, :string
7
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
8
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
9
- end
10
7
 
11
8
  xml do
12
9
  root "mphantom", mixed: true
13
10
 
14
11
  map_attribute "mathcolor", to: :mathcolor, namespace: nil
15
12
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
16
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
17
- map_element tag.to_sym, to: :"#{tag}_value"
18
- end
19
13
  end
20
14
  end
21
15
  end
data/lib/mml/mroot.rb CHANGED
@@ -4,18 +4,12 @@ module Mml
4
4
  class Mroot < Lutaml::Model::Serializable
5
5
  attribute :mathcolor, :string
6
6
  attribute :mathbackground, :string
7
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
8
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
9
- end
10
7
 
11
8
  xml do
12
9
  root "mroot", mixed: true
13
10
 
14
11
  map_attribute "mathcolor", to: :mathcolor, namespace: nil
15
12
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
16
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
17
- map_element tag.to_sym, to: :"#{tag}_value"
18
- end
19
13
  end
20
14
  end
21
15
  end
data/lib/mml/mrow.rb CHANGED
@@ -8,10 +8,6 @@ module Mml
8
8
  attribute :intent, :string
9
9
  attribute :dir, :string
10
10
 
11
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
12
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
13
- end
14
-
15
11
  xml do
16
12
  root "mrow", mixed: true
17
13
 
@@ -20,10 +16,6 @@ module Mml
20
16
  map_attribute "intent", to: :intent, namespace: nil
21
17
  map_attribute "mathcolor", to: :mathcolor, namespace: nil
22
18
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
23
-
24
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
25
- map_element tag, to: :"#{tag}_value"
26
- end
27
19
  end
28
20
  end
29
21
  end
data/lib/mml/ms.rb CHANGED
@@ -16,9 +16,6 @@ module Mml
16
16
  attribute :color, :string
17
17
  attribute :value, :string
18
18
  attribute :dir, :string
19
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
20
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
21
- end
22
19
 
23
20
  xml do
24
21
  root "ms", mixed: true
@@ -37,9 +34,6 @@ module Mml
37
34
  map_attribute "rquote", to: :rquote, namespace: nil
38
35
  map_attribute "color", to: :color, namespace: nil
39
36
  map_attribute "dir", to: :dir, namespace: nil
40
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
41
- map_element tag.to_sym, to: :"#{tag}_value"
42
- end
43
37
  end
44
38
  end
45
39
  end
data/lib/mml/mscarries.rb CHANGED
@@ -8,22 +8,17 @@ module Mml
8
8
  attribute :position, :integer
9
9
  attribute :location, :string
10
10
  attribute :crossout, :string
11
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
12
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
13
- end
14
11
 
15
12
  xml do
16
13
  root "mscarries", mixed: true
17
14
 
18
- map_attribute "scriptsizemultiplier", to: :scriptsizemultiplier, namespace: nil
15
+ map_attribute "scriptsizemultiplier", to: :scriptsizemultiplier,
16
+ namespace: nil
19
17
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
20
18
  map_attribute "mathcolor", to: :mathcolor, namespace: nil
21
19
  map_attribute "position", to: :position, namespace: nil
22
20
  map_attribute "location", to: :location, namespace: nil
23
21
  map_attribute "crossout", to: :crossout, namespace: nil
24
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
25
- map_element tag.to_sym, to: :"#{tag}_value"
26
- end
27
22
  end
28
23
  end
29
24
  end
data/lib/mml/mscarry.rb CHANGED
@@ -6,9 +6,6 @@ module Mml
6
6
  attribute :mathbackground, :string
7
7
  attribute :location, :string
8
8
  attribute :crossout, :string
9
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
10
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
11
- end
12
9
 
13
10
  xml do
14
11
  root "mscarry", mixed: true
@@ -17,9 +14,6 @@ module Mml
17
14
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
18
15
  map_attribute "location", to: :location, namespace: nil
19
16
  map_attribute "crossout", to: :crossout, namespace: nil
20
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
21
- map_element tag.to_sym, to: :"#{tag}_value"
22
- end
23
17
  end
24
18
  end
25
19
  end
data/lib/mml/msgroup.rb CHANGED
@@ -6,14 +6,8 @@ module Mml
6
6
  attribute :mathbackground, :string
7
7
  attribute :position, :integer
8
8
  attribute :shift, :integer
9
- attribute :mscarries_value, Mscarries, collection: true
10
- attribute :msrow_value, Msrow, collection: true
11
9
  attribute :msgroup_text, :string
12
10
 
13
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
14
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
15
- end
16
-
17
11
  xml do
18
12
  root "msgroup", mixed: true
19
13
 
@@ -22,9 +16,6 @@ module Mml
22
16
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
23
17
  map_attribute "position", to: :position, namespace: nil
24
18
  map_attribute "shift", to: :shift, namespace: nil
25
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
26
- map_element tag.to_sym, to: :"#{tag}_value"
27
- end
28
19
  end
29
20
  end
30
21
  end
data/lib/mml/msqrt.rb CHANGED
@@ -4,19 +4,12 @@ module Mml
4
4
  class Msqrt < Lutaml::Model::Serializable
5
5
  attribute :mathcolor, :string
6
6
  attribute :mathbackground, :string
7
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
8
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
9
- end
10
7
 
11
8
  xml do
12
9
  root "msqrt", mixed: true
13
10
 
14
11
  map_attribute "mathcolor", to: :mathcolor, namespace: nil
15
12
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
16
-
17
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
18
- map_element tag.to_sym, to: :"#{tag}_value"
19
- end
20
13
  end
21
14
  end
22
15
  end
data/lib/mml/msrow.rb CHANGED
@@ -5,9 +5,6 @@ module Mml
5
5
  attribute :mathcolor, :string
6
6
  attribute :mathbackground, :string
7
7
  attribute :position, :integer
8
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
9
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
10
- end
11
8
 
12
9
  xml do
13
10
  root "msrow", mixed: true
@@ -15,10 +12,6 @@ module Mml
15
12
  map_attribute "mathcolor", to: :mathcolor, namespace: nil
16
13
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
17
14
  map_attribute "position", to: :position, namespace: nil
18
-
19
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
20
- map_element tag, to: :"#{tag}_value"
21
- end
22
15
  end
23
16
  end
24
17
  end
data/lib/mml/mstack.rb CHANGED
@@ -8,9 +8,6 @@ module Mml
8
8
  attribute :stackalign, :string
9
9
  attribute :charalign, :string
10
10
  attribute :charspacing, :string
11
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
12
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
13
- end
14
11
 
15
12
  xml do
16
13
  root "mstack", mixed: true
@@ -21,9 +18,6 @@ module Mml
21
18
  map_attribute "stackalign", to: :stackalign, namespace: nil
22
19
  map_attribute "charalign", to: :charalign, namespace: nil
23
20
  map_attribute "charspacing", to: :charspacing, namespace: nil
24
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
25
- map_element tag, to: :"#{tag}_value"
26
- end
27
21
  end
28
22
  end
29
23
  end
data/lib/mml/mstyle.rb CHANGED
@@ -99,9 +99,6 @@ module Mml
99
99
  attribute :thickmathspace, :string
100
100
  attribute :verythickmathspace, :string
101
101
  attribute :veryverythickmathspace, :string
102
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
103
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
104
- end
105
102
 
106
103
  # rubocop:disable Metrics/BlockLength
107
104
  xml do
@@ -111,9 +108,11 @@ module Mml
111
108
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
112
109
  map_attribute "scriptlevel", to: :scriptlevel, namespace: nil
113
110
  map_attribute "displaystyle", to: :displaystyle, namespace: nil
114
- map_attribute "scriptsizemultiplier", to: :scriptsizemultiplier, namespace: nil
111
+ map_attribute "scriptsizemultiplier", to: :scriptsizemultiplier,
112
+ namespace: nil
115
113
  map_attribute "scriptminsize", to: :scriptminsize, namespace: nil
116
- map_attribute "infixlinebreakstyle", to: :infixlinebreakstyle, namespace: nil
114
+ map_attribute "infixlinebreakstyle", to: :infixlinebreakstyle,
115
+ namespace: nil
117
116
  map_attribute "decimalpoint", to: :decimalpoint, namespace: nil
118
117
  map_attribute "accent", to: :accent, namespace: nil
119
118
  map_attribute "accentunder", to: :accentunder, namespace: nil
@@ -196,16 +195,16 @@ module Mml
196
195
  map_attribute "fontsize", to: :fontsize, namespace: nil
197
196
  map_attribute "color", to: :color, namespace: nil
198
197
  map_attribute "background", to: :background, namespace: nil
199
- map_attribute "veryverythinmathspace", to: :veryverythinmathspace, namespace: nil
198
+ map_attribute "veryverythinmathspace", to: :veryverythinmathspace,
199
+ namespace: nil
200
200
  map_attribute "verythinmathspace", to: :verythinmathspace, namespace: nil
201
201
  map_attribute "thinmathspace", to: :thinmathspace, namespace: nil
202
202
  map_attribute "mediummathspace", to: :mediummathspace, namespace: nil
203
203
  map_attribute "thickmathspace", to: :thickmathspace, namespace: nil
204
- map_attribute "verythickmathspace", to: :verythickmathspace, namespace: nil
205
- map_attribute "veryverythickmathspace", to: :veryverythickmathspace, namespace: nil
206
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
207
- map_element tag.to_sym, to: :"#{tag}_value"
208
- end
204
+ map_attribute "verythickmathspace", to: :verythickmathspace,
205
+ namespace: nil
206
+ map_attribute "veryverythickmathspace", to: :veryverythickmathspace,
207
+ namespace: nil
209
208
  end
210
209
  # rubocop:enable Metrics/BlockLength
211
210
  end
data/lib/mml/msub.rb CHANGED
@@ -5,9 +5,6 @@ module Mml
5
5
  attribute :mathbackground, :string
6
6
  attribute :subscriptshift, :string
7
7
  attribute :mathcolor, :string
8
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
9
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
10
- end
11
8
 
12
9
  xml do
13
10
  root "msub", mixed: true
@@ -15,9 +12,6 @@ module Mml
15
12
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
16
13
  map_attribute "subscriptshift", to: :subscriptshift, namespace: nil
17
14
  map_attribute "mathcolor", to: :mathcolor, namespace: nil
18
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
19
- map_element tag.to_sym, to: :"#{tag}_value"
20
- end
21
15
  end
22
16
  end
23
17
  end
data/lib/mml/msubsup.rb CHANGED
@@ -6,9 +6,6 @@ module Mml
6
6
  attribute :mathbackground, :string
7
7
  attribute :subscriptshift, :string
8
8
  attribute :superscriptshift, :string
9
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
10
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
11
- end
12
9
 
13
10
  xml do
14
11
  root "msubsup", mixed: true
@@ -17,9 +14,6 @@ module Mml
17
14
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
18
15
  map_attribute "subscriptshift", to: :subscriptshift, namespace: nil
19
16
  map_attribute "superscriptshift", to: :superscriptshift, namespace: nil
20
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
21
- map_element tag.to_sym, to: :"#{tag}_value"
22
- end
23
17
  end
24
18
  end
25
19
  end
data/lib/mml/msup.rb CHANGED
@@ -5,9 +5,6 @@ module Mml
5
5
  attribute :mathcolor, :string
6
6
  attribute :mathbackground, :string
7
7
  attribute :superscriptshift, :string
8
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
9
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
10
- end
11
8
 
12
9
  xml do
13
10
  root "msup", mixed: true
@@ -15,9 +12,6 @@ module Mml
15
12
  map_attribute "mathcolor", to: :mathcolor, namespace: nil
16
13
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
17
14
  map_attribute "superscriptshift", to: :superscriptshift, namespace: nil
18
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
19
- map_element tag.to_sym, to: :"#{tag}_value"
20
- end
21
15
  end
22
16
  end
23
17
  end
data/lib/mml/mtable.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mml
4
+ autoload(:Mlabeledtr, "mml/mlabeledtr")
5
+ autoload(:Mtr, "mml/mtr")
4
6
  class Mtable < Lutaml::Model::Serializable
5
7
  attribute :mathcolor, :string
6
8
  attribute :mathbackground, :string
data/lib/mml/mtd.rb CHANGED
@@ -6,9 +6,6 @@ module Mml
6
6
  attribute :mathbackground, :string
7
7
  attribute :rowalign, :string
8
8
  attribute :columnalign, :string
9
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
10
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
11
- end
12
9
 
13
10
  xml do
14
11
  root "mtd", mixed: true
@@ -17,9 +14,6 @@ module Mml
17
14
  map_attribute "mathbackground", to: :mathbackground, namespace: nil
18
15
  map_attribute "rowalign", to: :rowalign, namespace: nil
19
16
  map_attribute "columnalign", to: :columnalign, namespace: nil
20
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
21
- map_element tag.to_sym, to: :"#{tag}_value"
22
- end
23
17
  end
24
18
  end
25
19
  end
data/lib/mml/mtr.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mml
4
+ autoload(:Mtd, "mml/mtd")
5
+
4
6
  class Mtr < Lutaml::Model::Serializable
5
7
  attribute :mathcolor, :string
6
8
  attribute :mathbackground, :string
data/lib/mml/munder.rb CHANGED
@@ -7,9 +7,6 @@ module Mml
7
7
  attribute :mathcolor, :string
8
8
  attribute :content, :string
9
9
  attribute :align, :string
10
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
11
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
12
- end
13
10
 
14
11
  xml do
15
12
  root "munder", mixed: true
@@ -19,9 +16,6 @@ module Mml
19
16
  map_attribute "mathcolor", to: :mathcolor, namespace: nil
20
17
  map_attribute "align", to: :align, namespace: nil
21
18
  map_content to: :content
22
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
23
- map_element tag.to_sym, to: :"#{tag}_value"
24
- end
25
19
  end
26
20
  end
27
21
  end
@@ -7,9 +7,6 @@ module Mml
7
7
  attribute :accent, :string
8
8
  attribute :accentunder, :string
9
9
  attribute :align, :string
10
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
11
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
12
- end
13
10
 
14
11
  xml do
15
12
  root "munderover", mixed: true
@@ -19,9 +16,6 @@ module Mml
19
16
  map_attribute "accent", to: :accent, namespace: nil
20
17
  map_attribute "accentunder", to: :accentunder, namespace: nil
21
18
  map_attribute "align", to: :align, namespace: nil
22
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
23
- map_element tag.to_sym, to: :"#{tag}_value"
24
- end
25
19
  end
26
20
  end
27
21
  end
@@ -0,0 +1,6 @@
1
+ <%
2
+ files = Dir["#{__dir__}/*.rb"].reject { |file| ["common_attributes", "opal_setup"].include?(File.basename(file, ".rb")) }
3
+ files.each do |file_name|
4
+ %>
5
+ require 'mml/<%= File.basename(file_name, ".rb") %>'
6
+ <% end %>
data/lib/mml/semantics.rb CHANGED
@@ -1,19 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mml
4
+ autoload(:Mi, "mml/mi")
5
+
4
6
  class Semantics < Lutaml::Model::Serializable
5
- attribute :annotation, Mml::Mi, collection: true
6
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
7
- attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
8
- end
7
+ attribute :annotation, Mi, collection: true
9
8
 
10
9
  xml do
11
10
  root "semantics", mixed: true
12
11
 
13
12
  map_element :annotation, to: :annotation
14
- Mml::Configuration::SUPPORTED_TAGS.each do |tag|
15
- map_element tag.to_sym, to: :"#{tag}_value"
16
- end
17
13
  end
18
14
  end
19
15
  end
data/lib/mml/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mml
4
- VERSION = "2.0.1"
4
+ VERSION = "2.0.3"
5
5
  end
data/lib/mml.rb CHANGED
@@ -1,7 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "zeitwerk"
4
3
  require "lutaml/model"
4
+ require "mml/configuration"
5
+ if RUBY_ENGINE == "opal"
6
+ require_relative "mml/opal_setup"
7
+ else
8
+ lib_path = File.join(__dir__, "mml", "*.rb")
9
+ Dir[lib_path].each do |file|
10
+ basename = File.basename(file, ".rb")
11
+ next if basename == "common_attributes"
12
+
13
+ require_relative "mml/#{basename}"
14
+ end
15
+ end
16
+ # Ensure that the CommonAttributes class is loaded after all
17
+ # other classes
18
+ require "mml/common_attributes"
5
19
 
6
20
  DEFAULT_ADAPTER = if RUBY_ENGINE == "opal"
7
21
  require "lutaml/model/xml_adapter/oga_adapter"
@@ -11,8 +25,7 @@ DEFAULT_ADAPTER = if RUBY_ENGINE == "opal"
11
25
  :ox
12
26
  end
13
27
 
14
- loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
15
- loader.setup
28
+ Moxml::Config.default_adapter = DEFAULT_ADAPTER
16
29
 
17
30
  module Mml
18
31
  class Error < StandardError; end
@@ -23,6 +36,12 @@ module Mml
23
36
  Configuration.config
24
37
  end
25
38
 
39
+ def update_attributes
40
+ Configuration::COMMON_ATTRIBUTES_CLASSES.each do |klass|
41
+ const_get(klass).import_model(CommonAttributes)
42
+ end
43
+ end
44
+
26
45
  def parse(input, namespace_exist: true)
27
46
  Configuration.adapter = DEFAULT_ADAPTER unless Configuration.adapter
28
47
 
@@ -34,8 +53,4 @@ module Mml
34
53
  end
35
54
  end
36
55
 
37
- begin
38
- loader.eager_load(force: true)
39
- rescue Zeitwerk::NameError => e
40
- flunk e.message
41
- end
56
+ Mml.update_attributes
data/mml.gemspec CHANGED
@@ -16,7 +16,6 @@ Gem::Specification.new do |spec|
16
16
  spec.homepage = "https://github.com/plurimath/mml"
17
17
  spec.license = "BSD-2-Clause"
18
18
 
19
- spec.test_files = `git ls-files -- {spec}/*`.split("\n")
20
19
  spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
21
20
 
22
21
  # Specify which files should be added to the gem when it is released.
@@ -30,6 +29,7 @@ Gem::Specification.new do |spec|
30
29
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
30
  spec.require_paths = ["lib"]
32
31
 
33
- spec.add_runtime_dependency "lutaml-model"
34
- spec.add_runtime_dependency "zeitwerk"
32
+ spec.add_dependency "lutaml-model"
33
+ spec.add_dependency "moxml"
34
+ spec.metadata["rubygems_mfa_required"] = "true"
35
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mml
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.3
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-22 00:00:00.000000000 Z
11
+ date: 2025-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: zeitwerk
28
+ name: moxml
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -52,6 +52,7 @@ files:
52
52
  - ".gitignore"
53
53
  - ".rspec"
54
54
  - ".rubocop.yml"
55
+ - ".rubocop_todo.yml"
55
56
  - CODE_OF_CONDUCT.md
56
57
  - Gemfile
57
58
  - README.adoc
@@ -59,6 +60,7 @@ files:
59
60
  - bin/console
60
61
  - bin/setup
61
62
  - lib/mml.rb
63
+ - lib/mml/common_attributes.rb
62
64
  - lib/mml/configuration.rb
63
65
  - lib/mml/maction.rb
64
66
  - lib/mml/maligngroup.rb
@@ -103,6 +105,7 @@ files:
103
105
  - lib/mml/munder.rb
104
106
  - lib/mml/munderover.rb
105
107
  - lib/mml/none.rb
108
+ - lib/mml/opal_setup.rb.erb
106
109
  - lib/mml/semantics.rb
107
110
  - lib/mml/version.rb
108
111
  - mml.gemspec
@@ -110,7 +113,8 @@ files:
110
113
  homepage: https://github.com/plurimath/mml
111
114
  licenses:
112
115
  - BSD-2-Clause
113
- metadata: {}
116
+ metadata:
117
+ rubygems_mfa_required: 'true'
114
118
  post_install_message:
115
119
  rdoc_options: []
116
120
  require_paths:
@@ -126,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
130
  - !ruby/object:Gem::Version
127
131
  version: '0'
128
132
  requirements: []
129
- rubygems_version: 3.3.27
133
+ rubygems_version: 3.5.22
130
134
  signing_key:
131
135
  specification_version: 4
132
136
  summary: MathML parser by Plurimath.