mml 2.3.7 → 2.4.0

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: 47af8c20b7e74aa165f2c37b79c42114fefd3271cb69ede3c80dc684c6009295
4
- data.tar.gz: 146194a451aefd1f06fdddbe0d914944650eefd3f555a1a09f792b110d64ffc6
3
+ metadata.gz: 06746c57ed678055de388f7762532af6ee4b2c5384357d02bfe5e70b171bc978
4
+ data.tar.gz: cb6e5039fa287dc23cec0deb104c6f11b2916c0862d12accda17a62211adcc8c
5
5
  SHA512:
6
- metadata.gz: 6ecd1f5b414c7ee585196a3576d2a34a76962e5ec4008013b1b3b6fada27df01d3cbe68891e80cc7077a7ccfc8996aa952d8617ebaf11b49b3bed11831cdf767
7
- data.tar.gz: 2dddd5b009a917449239df9b663e31afc532e6f1b4562b37f6bb8edc9c3e4f1c6737bfafe4c0cf88344a6c5bec92038b2050442234fe2ea4573d816720164101
6
+ metadata.gz: 6f323d41ded39d4f7098684c0be92c63b40fc74fa807eda838800015503760a73e08bfa4bd9601ab4a9087301f01a57b9b96376c3c3663c37cb5cee0fdd457c1
7
+ data.tar.gz: de5b3d389ea005d3738933e0074f0400408e6be04ff86d058a17fd9bd705bd822b4f7e1cab93ef846542a6030681535c1570b9082a87b42ab1e780aefe9f04c2
data/CLAUDE.md CHANGED
@@ -4,70 +4,123 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4
4
 
5
5
  ## Project Overview
6
6
 
7
- `mml` is a Ruby gem that provides MathML 3 and MathML 4 XML parsing and serialization. It maps MathML elements into Ruby model classes using the `lutaml-model` framework. Part of the [Plurimath](https://github.com/plurimath/mml) ecosystem.
7
+ `mml` is a Ruby gem that provides MathML 2, MathML 3, and MathML 4 XML parsing and serialization. It maps MathML elements into Ruby model classes using the `lutaml-model` framework. Part of the [Plurimath](https://github.com/plurimath/mml) ecosystem.
8
8
 
9
9
  ## Commands
10
10
 
11
11
  ```bash
12
- rake # Run specs + rubocop (default task)
13
- bundle exec rspec # Run tests
14
- bundle exec rspec spec/mml_spec.rb:42 # Run single test by line
15
- bundle exec rspec --only-failures # Run only previously failing tests
16
- bundle exec rubocop # Lint
17
- bundle exec rubocop -a # Auto-fix lint issues
18
- bin/console # IRB with gem loaded
12
+ rake # Run specs + rubocop (default task)
13
+ bundle exec rspec # Run all tests
14
+ bundle exec rspec spec/mml/v3/msub_spec.rb:14 # Run single test by line
15
+ bundle exec rspec --only-failures # Previously failing tests only
16
+ bundle exec rubocop # Lint
17
+ bundle exec rubocop -a # Auto-fix lint issues
18
+ bin/console # IRB with gem loaded
19
19
  ```
20
20
 
21
21
  ## Versioned Architecture
22
22
 
23
- **MathML 3 vs MathML 4:** The gem maintains separate class hierarchies for MathML 3 (`Mml::V3::`) and MathML 4 (`Mml::V4::`). Users must reference the versioned namespace explicitly — no backward-compat aliases.
23
+ The gem maintains **three** separate class hierarchies: `Mml::V2::` (MathML 2), `Mml::V3::` (MathML 3), and `Mml::V4::` (MathML 4). Users must reference the versioned namespace explicitly — no backward-compat aliases.
24
24
 
25
25
  ```ruby
26
- Mml.parse(input) # Default: MathML 3
27
- Mml.parse(input, version: 3) # Explicit MathML 3
28
- Mml.parse(input, version: 4) # MathML 4 with intent/arg attributes
26
+ Mml.parse(input) # Default: MathML 3
27
+ Mml.parse(input, version: 2) # MathML 2
28
+ Mml.parse(input, version: 3) # Explicit MathML 3
29
+ Mml.parse(input, version: 4) # MathML 4 with intent/arg attributes
29
30
  ```
30
31
 
31
32
  **Directory structure:**
32
- - `lib/mml/v3/` — MathML 3 element classes (original)
33
- - `lib/mml/v4/` — MathML 4 element classes (intent/arg added, deprecated attrs removed)
33
+ - `lib/mml/base/` — version-agnostic element modules, mixed into each version's class via `include Base::XYZ`. The single source of truth for the XML mapping DSL.
34
+ - `lib/mml/v2/`, `lib/mml/v3/`, `lib/mml/v4/` — per-version class declarations (each ~3 lines: declare class, mix in base module, register).
34
35
 
35
- **Key difference:** MathML 4 adds `intent`, `arg`, `displaystyle`, and `scriptlevel` attributes as universal presentation attributes for accessibility markup.
36
+ **Key difference (V3 → V4):** MathML 4 adds `intent`, `arg`, `displaystyle`, and `scriptlevel` as universal presentation attributes for accessibility markup; removes some deprecated attributes.
36
37
 
37
38
  **No hidden delegation:** The `Mml` module does not alias or delegate constants. Use `Mml::V3::Math`, `Mml::V4::Mi`, etc. directly.
38
39
 
39
40
  ## Entry Points
40
41
 
41
- - `Mml.parse(input, version: N)` — parse XML, returns `Mml::V3::Math` or `Mml::V4::Math` object graph
42
+ - `Mml.parse(input, version: N)` — parse XML, returns `Mml::V{2,3,4}::Math` object graph
42
43
  - `Mml::V3.parse(input)` / `Mml::V4.parse(input)` — version-specific parsing
43
44
  - `Mml::V4::Math.from_xml(input)` — directly parse with v4 classes
44
45
  - Call `to_xml` on any element to serialize back
45
46
 
46
- ## Pattern
47
+ ## Element Mapping Pattern
47
48
 
48
- Each MathML element is a `Mml::V3::` or `Mml::V4::` class inheriting from `Lutaml::Model::Serializable` with an `xml do...end` DSL block. Two element types:
49
- - **Leaf elements** (e.g., `Mi`, `Mn`, `Mo`): use `map_content to: :value` for text content
50
- - **Container elements** (e.g., `Math`, `Mrow`, `Mfrac`): use `mixed_content` to accept arbitrary child elements
49
+ Each MathML element is a `Lutaml::Model::Serializable` subclass with an `xml do...end` DSL block. The XML mapping lives in `lib/mml/base/<tag>.rb` as a module included into each version's class (e.g., `Mml::V3::Msub` includes `Mml::Base::Msub`).
51
50
 
52
- **CommonAttributes:** A `no_root` Lutaml model imported into container elements via `import_model`. It dynamically creates `#{tag}_value` attributes for each tag in `Configuration::SUPPORTED_TAGS`. Classes that receive it are listed in `Configuration::COMMON_ATTRIBUTES_CLASSES`.
51
+ ### Content model `mixed_content` vs `ordered` vs `map_content`
53
52
 
54
- **Autoloading:** Each version (`lib/mml/v3.rb`, `lib/mml/v4.rb`) autoloads its element classes. `CommonAttributes` is required after all classes exist, then `update_attributes` mixes it into the configured classes.
53
+ This is the most important decision when adding or editing an element. Pick based on the **schema** (see `schemas/mathml3/`, `schemas/mathml4/`, `reference-docs/mathml-source/`):
55
54
 
56
- **Namespace:** Both versions use the same URI (`http://www.w3.org/1998/Math/MathML`) — MathML 4 chose backward compatibility over a new namespace.
55
+ | Schema content model | Use | Examples |
56
+ |---------------------------------------------------|--------------------------------------|--------------------------------|
57
+ | True mixed `(#PCDATA \| mglyph \| malignmark)*` | `mixed_content` + `map_content` | `Mi`, `Mn`, `Mo`, `Ms`, `Mtext`|
58
+ | Element-only (`ImpliedMrow`, `<xs:sequence>`, etc.) | `ordered` | `Msub`, `Mfrac`, `Mrow`, `Math`, `Munder`, `Mfenced`, `Msgroup`, … |
59
+
60
+ **Why this matters:** lutaml-model's `each_mixed_content` iteration exposes all children to consumers (Plurimath's translator does positional indexing like `children[0]`, `children[1]` for `msub`/`mfrac`/etc.).
61
+ - Under `mixed_content`, whitespace between elements is yielded as a String child, shifting positional indices.
62
+ - Under `ordered`, whitespace-only text nodes are skipped — only elements and non-whitespace text are yielded.
63
+
64
+ If you mistakenly use `mixed_content` on an element-only schema element, downstream consumers see phantom whitespace children and silently misinterpret the tree (e.g., render `<msub><mi>t</mi><mn>90</mn></msub>` with whitespace between children as base=whitespace, sub=`<mi>t</mi>`, dropping `<mn>90</mn>`).
65
+
66
+ **Verification workflow for any element edit:**
67
+ ```bash
68
+ grep -A15 'name="<tag>"' schemas/mathml3/mathml3-presentation.xsd schemas/mathml3/mathml3-common.xsd
69
+ grep -A3 '<tag>\s*=\s*element' schemas/mathml4/mathml4-core.rnc schemas/mathml4/mathml4-presentation.rnc
70
+ ```
71
+
72
+ If the schema says `ImpliedMrow`, `MathExpression, MathExpression`, `MstackExpression*`, `TableRowExpression*`, etc. (any element-only sequence), use `ordered`. If it says `(#PCDATA | mglyph | malignmark)*`, use `mixed_content` + `map_content` + `map_element` for the inline children.
73
+
74
+ ### Token elements are the only true mixed content
75
+
76
+ Per MathML schema, token elements (`mi`, `mn`, `mo`, `ms`, `mtext`) accept `(#PCDATA | mglyph | malignmark)*` — text interleaved with inline elements. They use:
77
+
78
+ ```ruby
79
+ attribute :value, :string, collection: true # collection required for mixed_content
80
+ attribute :mglyph_value, :mglyph, collection: true
81
+ attribute :malignmark_value, :malignmark, collection: true
82
+
83
+ xml do
84
+ element "<tag>"
85
+ mixed_content
86
+ map_content to: :value
87
+ map_element "mglyph", to: :mglyph_value
88
+ map_element "malignmark", to: :malignmark_value
89
+ end
90
+ ```
91
+
92
+ `value` is a `String` **collection** (Array) because text can be split by intervening inline elements (e.g., `<mi>x<malignmark/>y</mi>` → `["x", "y"]`).
93
+
94
+ ### CommonAttributes
95
+
96
+ A `no_root` Lutaml model imported into container elements via `import_model`. It dynamically creates `#{tag}_value` attributes for each tag in `Configuration::SUPPORTED_TAGS`. Classes that receive it are listed in `Configuration::COMMON_ATTRIBUTES_CLASSES`.
97
+
98
+ ### Per-file registration
99
+
100
+ Each `lib/mml/v{2,3,4}/<tag>.rb` ends with `Configuration.register_model(Klass, id: :tag)` so the type is registered as soon as the file is loaded (eager via `require_relative` at the bottom of each version file).
101
+
102
+ **Namespace:** All versions use the same URI (`http://www.w3.org/1998/Math/MathML`) — MathML 4 chose backward compatibility over a new namespace.
103
+
104
+ ## Adapter
105
+
106
+ `Mml.default_adapter` returns `:oga` under Opal, otherwise delegates to `Lutaml::Model::Config.xml_adapter_type` (defaults to `:nokogiri`). Specs pin `:nokogiri` in `spec_helper.rb`. Users can override globally via `Lutaml::Model::Config`.
57
107
 
58
108
  ## Spec Structure
59
109
 
60
- - `spec/mml_spec.rb` — tests `Mml::V3` and `Mml::V4` with separate fixture directories
61
- - `spec/fixtures/with_namespace/`v3 fixtures (MathML 3)
62
- - `spec/fixtures/with_namespace_prefix/`v3 fixtures with namespace prefix
63
- - `spec/fixtures/v4/`v4 fixtures (MathML 4 with intent attributes)
110
+ - `spec/mml/v2/`, `spec/mml/v3/`, `spec/mml/v4/` per-version element specs (round-trip + attribute preservation)
111
+ - `spec/mml/v3_spec.rb`, `spec/mml/v4_spec.rb` whole-testsuite round-trip tests against `spec/fixtures/mml3-testsuite/` and `spec/fixtures/mmlcore-testsuite/`
112
+ - `spec/mml/ordered_content_spec.rb`regression specs locking in the mixed_content vs ordered distinction (whitespace handling + token element inline children)
113
+ - `spec/mml/adapter_configuration_spec.rb`adapter delegation
114
+ - `spec/context_support_spec.rb`, `spec/lutaml_default_register_spec.rb` — registry/context behavior
115
+ - `spec/fixtures/mml2-testsuite/`, `mml3-testsuite/`, `mmlcore-testsuite/` — W3C test suites (submodules)
116
+ - `spec/fixtures/v2/`, `v4/` — version-specific fixtures
64
117
 
65
- Specs use the `:nokogiri` Lutaml adapter (configured in `spec_helper.rb`). Runtime uses `:ox` adapter by default.
118
+ Specs use `canon`'s `be_xml_equivalent_to` matcher with the `:spec_friendly` profile (whitespace-tolerant). When adding a regression spec for an ordering bug, **explicitly test the inter-element-whitespace scenario** — the suite's whitespace tolerance masks positional bugs.
66
119
 
67
120
  ## Key Dependencies
68
121
 
69
- - `lutaml-model` (~ 0.8.0) — data mapper framework; all element classes inherit from `Lutaml::Model::Serializable`
70
- - `moxml` — XML parsing library (uses `:ox` adapter by default)
122
+ - `lutaml-model` (~> 0.8.0) — data mapper framework; all element classes inherit from `Lutaml::Model::Serializable`
123
+ - `moxml` — XML parsing backbone (adapter selected via `Lutaml::Model::Config`)
71
124
  - `canon` — XML comparison for specs
72
125
 
73
126
  ## Conventions
@@ -77,3 +130,10 @@ Specs use the `:nokogiri` Lutaml adapter (configured in `spec_helper.rb`). Runti
77
130
  - CI workflows are auto-generated by Cimas — do not edit manually
78
131
  - `Gemfile.lock` is gitignored; dependencies come from the gemspec
79
132
  - Type signatures exist in `sig/mml.rbs`
133
+
134
+ ## Reference Materials
135
+
136
+ - `schemas/mathml2/`, `schemas/mathml3/`, `schemas/mathml4/` — official W3C schemas (XSD for 2/3, RelaxNG for 4). **Authoritative** source for content models and attribute lists.
137
+ - `reference-docs/mathml-source/` — W3C spec source XML (presentation-markup.xml, validation-grammar.xml, etc.)
138
+
139
+ When deciding whether an element should have `mixed_content`, `ordered`, or `map_content`, **always** verify against the schema first.
@@ -15,7 +15,7 @@ module Mml
15
15
  xml do
16
16
  namespace Mml::Namespace
17
17
  element "maction"
18
- mixed_content
18
+ ordered
19
19
 
20
20
  map_attribute "mathcolor", to: :mathcolor
21
21
  map_attribute "mathbackground", to: :mathbackground
data/lib/mml/base/math.rb CHANGED
@@ -37,7 +37,7 @@ module Mml
37
37
  xml do
38
38
  namespace Mml::Namespace
39
39
  element "math"
40
- mixed_content
40
+ ordered
41
41
 
42
42
  map_attribute :display, to: :display
43
43
  map_attribute "mode", to: :mode
@@ -14,7 +14,7 @@ module Mml
14
14
  xml do
15
15
  namespace Mml::Namespace
16
16
  element "menclose"
17
- mixed_content
17
+ ordered
18
18
 
19
19
  map_attribute "mathcolor", to: :mathcolor
20
20
  map_attribute "mathbackground", to: :mathbackground
@@ -13,7 +13,7 @@ module Mml
13
13
  xml do
14
14
  namespace Mml::Namespace
15
15
  element "merror"
16
- mixed_content
16
+ ordered
17
17
 
18
18
  map_attribute "mathcolor", to: :mathcolor
19
19
  map_attribute "mathbackground", to: :mathbackground
@@ -10,16 +10,13 @@ module Mml
10
10
  attribute :mathbackground, :string
11
11
  attribute :separators, :string
12
12
  attribute :mathcolor, :string
13
- attribute :content, :string, collection: true
14
13
  attribute :close, :string
15
14
  attribute :open, :string
16
15
 
17
16
  xml do
18
17
  namespace Mml::Namespace
19
18
  element "mfenced"
20
- mixed_content
21
-
22
- map_content to: :content
19
+ ordered
23
20
 
24
21
  map_attribute "mathbackground", to: :mathbackground
25
22
  map_attribute "separators", to: :separators, render_empty: true
@@ -17,7 +17,7 @@ module Mml
17
17
  xml do
18
18
  namespace Mml::Namespace
19
19
  element "mfrac"
20
- mixed_content
20
+ ordered
21
21
 
22
22
  map_attribute "mathcolor", to: :mathcolor
23
23
  map_attribute "mathbackground", to: :mathbackground
@@ -17,7 +17,7 @@ module Mml
17
17
  xml do
18
18
  namespace Mml::Namespace
19
19
  element "mfraction"
20
- mixed_content
20
+ ordered
21
21
 
22
22
  map_attribute "mathcolor", to: :mathcolor
23
23
  map_attribute "mathbackground", to: :mathbackground
data/lib/mml/base/mi.rb CHANGED
@@ -13,6 +13,7 @@ module Mml
13
13
  attribute :mathsize, :string
14
14
  attribute :mathvariant, :string
15
15
  attribute :mglyph_value, :mglyph, collection: true
16
+ attribute :malignmark_value, :malignmark, collection: true
16
17
  attribute :lang, :string
17
18
 
18
19
  xml do
@@ -27,6 +28,7 @@ module Mml
27
28
  map_attribute "mathvariant", to: :mathvariant
28
29
  map_attribute "xml:lang", to: :lang
29
30
  map_element "mglyph", to: :mglyph_value
31
+ map_element "malignmark", to: :malignmark_value
30
32
  end
31
33
  end
32
34
  end
@@ -18,7 +18,7 @@ module Mml
18
18
  xml do
19
19
  namespace Mml::Namespace
20
20
  element "mlabeledtr"
21
- mixed_content
21
+ ordered
22
22
 
23
23
  map_attribute "mathbackground", to: :mathbackground
24
24
  map_attribute "columnalign", to: :columnalign
@@ -16,7 +16,7 @@ module Mml
16
16
  xml do
17
17
  namespace Mml::Namespace
18
18
  element "mlongdiv"
19
- mixed_content
19
+ ordered
20
20
 
21
21
  map_attribute "mathbackground", to: :mathbackground
22
22
  map_attribute "longdivstyle", to: :longdivstyle
@@ -16,7 +16,7 @@ module Mml
16
16
  xml do
17
17
  namespace Mml::Namespace
18
18
  element "mmultiscripts"
19
- mixed_content
19
+ ordered
20
20
 
21
21
  map_attribute "mathcolor", to: :mathcolor
22
22
  map_attribute "mathbackground", to: :mathbackground
data/lib/mml/base/mn.rb CHANGED
@@ -13,6 +13,7 @@ module Mml
13
13
  attribute :mathvariant, :string
14
14
  attribute :mathsize, :string
15
15
  attribute :mglyph_value, :mglyph, collection: true
16
+ attribute :malignmark_value, :malignmark, collection: true
16
17
 
17
18
  xml do
18
19
  namespace Mml::Namespace
@@ -25,6 +26,7 @@ module Mml
25
26
  map_attribute "mathvariant", to: :mathvariant
26
27
  map_attribute "mathsize", to: :mathsize
27
28
  map_element "mglyph", to: :mglyph_value
29
+ map_element "malignmark", to: :malignmark_value
28
30
  end
29
31
  end
30
32
  end
data/lib/mml/base/mo.rb CHANGED
@@ -7,7 +7,7 @@ module Mml
7
7
  # Use fully qualified names (e.g., Mml::Namespace).
8
8
  def self.included(klass)
9
9
  klass.class_eval do
10
- attribute :value, :string
10
+ attribute :value, :string, collection: true
11
11
  attribute :mathcolor, :string
12
12
  attribute :mathbackground, :string
13
13
  attribute :mathvariant, :string
@@ -34,11 +34,14 @@ module Mml
34
34
  attribute :indentshiftfirst, :string
35
35
  attribute :indentalignlast, :string
36
36
  attribute :indentshiftlast, :string
37
+ attribute :mglyph_value, :mglyph, collection: true
38
+ attribute :malignmark_value, :malignmark, collection: true
37
39
 
38
40
  # rubocop:disable Metrics/BlockLength
39
41
  xml do
40
42
  namespace Mml::Namespace
41
43
  element "mo"
44
+ mixed_content
42
45
 
43
46
  map_content to: :value
44
47
  map_attribute "form", to: :form
@@ -67,6 +70,8 @@ module Mml
67
70
  map_attribute "indentalignfirst", to: :indentalignfirst
68
71
  map_attribute "indentshiftfirst", to: :indentshiftfirst
69
72
  map_attribute "linebreakmultchar", to: :linebreakmultchar
73
+ map_element "mglyph", to: :mglyph_value
74
+ map_element "malignmark", to: :malignmark_value
70
75
  end
71
76
  # rubocop:enable Metrics/BlockLength
72
77
  end
@@ -15,7 +15,7 @@ module Mml
15
15
  xml do
16
16
  namespace Mml::Namespace
17
17
  element "mover"
18
- mixed_content
18
+ ordered
19
19
 
20
20
  map_attribute "mathbackground", to: :mathbackground
21
21
  map_attribute "mathcolor", to: :mathcolor
@@ -19,7 +19,7 @@ module Mml
19
19
  xml do
20
20
  namespace Mml::Namespace
21
21
  element "mpadded"
22
- mixed_content
22
+ ordered
23
23
 
24
24
  map_attribute "mathbackground", to: :mathbackground
25
25
  map_attribute "mathcolor", to: :mathcolor
@@ -13,7 +13,7 @@ module Mml
13
13
  xml do
14
14
  namespace Mml::Namespace
15
15
  element "mphantom"
16
- mixed_content
16
+ ordered
17
17
 
18
18
  map_attribute "mathcolor", to: :mathcolor
19
19
  map_attribute "mathbackground", to: :mathbackground
@@ -13,7 +13,7 @@ module Mml
13
13
  xml do
14
14
  namespace Mml::Namespace
15
15
  element "mroot"
16
- mixed_content
16
+ ordered
17
17
 
18
18
  map_attribute "mathcolor", to: :mathcolor
19
19
  map_attribute "mathbackground", to: :mathbackground
data/lib/mml/base/mrow.rb CHANGED
@@ -9,13 +9,11 @@ module Mml
9
9
  klass.class_eval do
10
10
  attribute :mathbackground, :string
11
11
  attribute :mathcolor, :string
12
- attribute :content, :string, collection: true
13
12
  xml do
14
13
  namespace Mml::Namespace
15
14
  element "mrow"
16
- mixed_content
15
+ ordered
17
16
 
18
- map_content to: :content
19
17
  map_attribute "mathcolor", to: :mathcolor
20
18
  map_attribute "mathbackground", to: :mathbackground
21
19
  end
data/lib/mml/base/ms.rb CHANGED
@@ -14,6 +14,8 @@ module Mml
14
14
  attribute :lquote, :string
15
15
  attribute :rquote, :string
16
16
  attribute :value, :string, collection: true
17
+ attribute :mglyph_value, :mglyph, collection: true
18
+ attribute :malignmark_value, :malignmark, collection: true
17
19
  xml do
18
20
  namespace Mml::Namespace
19
21
  element "ms"
@@ -26,6 +28,8 @@ module Mml
26
28
  map_attribute "mathvariant", to: :mathvariant
27
29
  map_attribute "lquote", to: :lquote, render_empty: true
28
30
  map_attribute "rquote", to: :rquote, render_empty: true
31
+ map_element "mglyph", to: :mglyph_value
32
+ map_element "malignmark", to: :malignmark_value
29
33
  end
30
34
  end
31
35
  end
@@ -17,7 +17,7 @@ module Mml
17
17
  xml do
18
18
  namespace Mml::Namespace
19
19
  element "mscarries"
20
- mixed_content
20
+ ordered
21
21
 
22
22
  map_attribute "scriptsizemultiplier", to: :scriptsizemultiplier
23
23
  map_attribute "mathbackground", to: :mathbackground
@@ -15,7 +15,7 @@ module Mml
15
15
  xml do
16
16
  namespace Mml::Namespace
17
17
  element "mscarry"
18
- mixed_content
18
+ ordered
19
19
 
20
20
  map_attribute "mathcolor", to: :mathcolor
21
21
  map_attribute "mathbackground", to: :mathbackground
@@ -11,13 +11,11 @@ module Mml
11
11
  attribute :mathbackground, :string
12
12
  attribute :position, :integer
13
13
  attribute :shift, :integer
14
- attribute :msgroup_text, :string, collection: true
15
14
  xml do
16
15
  namespace Mml::Namespace
17
16
  element "msgroup"
18
- mixed_content
17
+ ordered
19
18
 
20
- map_content to: :msgroup_text
21
19
  map_attribute "mathcolor", to: :mathcolor
22
20
  map_attribute "mathbackground", to: :mathbackground
23
21
  map_attribute "position", to: :position
@@ -13,7 +13,7 @@ module Mml
13
13
  xml do
14
14
  namespace Mml::Namespace
15
15
  element "msqrt"
16
- mixed_content
16
+ ordered
17
17
 
18
18
  map_attribute "mathcolor", to: :mathcolor
19
19
  map_attribute "mathbackground", to: :mathbackground
@@ -14,7 +14,7 @@ module Mml
14
14
  xml do
15
15
  namespace Mml::Namespace
16
16
  element "msrow"
17
- mixed_content
17
+ ordered
18
18
 
19
19
  map_attribute "mathcolor", to: :mathcolor
20
20
  map_attribute "mathbackground", to: :mathbackground
@@ -17,7 +17,7 @@ module Mml
17
17
  xml do
18
18
  namespace Mml::Namespace
19
19
  element "mstack"
20
- mixed_content
20
+ ordered
21
21
 
22
22
  map_attribute "mathcolor", to: :mathcolor
23
23
  map_attribute "mathbackground", to: :mathbackground
@@ -94,7 +94,7 @@ module Mml
94
94
  xml do
95
95
  namespace Mml::Namespace
96
96
  element "mstyle"
97
- mixed_content
97
+ ordered
98
98
 
99
99
  map_attribute "scriptsizemultiplier", to: :scriptsizemultiplier
100
100
  map_attribute "scriptminsize", to: :scriptminsize
data/lib/mml/base/msub.rb CHANGED
@@ -14,7 +14,7 @@ module Mml
14
14
  xml do
15
15
  namespace Mml::Namespace
16
16
  element "msub"
17
- mixed_content
17
+ ordered
18
18
 
19
19
  map_attribute "mathbackground", to: :mathbackground
20
20
  map_attribute "subscriptshift", to: :subscriptshift
@@ -15,7 +15,7 @@ module Mml
15
15
  xml do
16
16
  namespace Mml::Namespace
17
17
  element "msubsup"
18
- mixed_content
18
+ ordered
19
19
 
20
20
  map_attribute "mathcolor", to: :mathcolor
21
21
  map_attribute "mathbackground", to: :mathbackground
data/lib/mml/base/msup.rb CHANGED
@@ -14,7 +14,7 @@ module Mml
14
14
  xml do
15
15
  namespace Mml::Namespace
16
16
  element "msup"
17
- mixed_content
17
+ ordered
18
18
 
19
19
  map_attribute "mathcolor", to: :mathcolor
20
20
  map_attribute "mathbackground", to: :mathbackground
@@ -33,7 +33,7 @@ module Mml
33
33
  xml do
34
34
  namespace Mml::Namespace
35
35
  element "mtable"
36
- mixed_content
36
+ ordered
37
37
 
38
38
  map_attribute "mathcolor", to: :mathcolor
39
39
  map_attribute "mathbackground", to: :mathbackground
data/lib/mml/base/mtd.rb CHANGED
@@ -18,7 +18,7 @@ module Mml
18
18
  xml do
19
19
  namespace Mml::Namespace
20
20
  element "mtd"
21
- mixed_content
21
+ ordered
22
22
 
23
23
  map_attribute "mathcolor", to: :mathcolor
24
24
  map_attribute "mathbackground", to: :mathbackground
@@ -7,21 +7,26 @@ module Mml
7
7
  # Use fully qualified names (e.g., Mml::Namespace).
8
8
  def self.included(klass)
9
9
  klass.class_eval do
10
- attribute :value, :string
10
+ attribute :value, :string, collection: true
11
11
  attribute :mathcolor, :string
12
12
  attribute :mathbackground, :string
13
13
  attribute :mathvariant, :string
14
14
  attribute :mathsize, :string
15
+ attribute :mglyph_value, :mglyph, collection: true
16
+ attribute :malignmark_value, :malignmark, collection: true
15
17
 
16
18
  xml do
17
19
  namespace Mml::Namespace
18
20
  element "mtext"
21
+ mixed_content
19
22
 
20
23
  map_content to: :value
21
24
  map_attribute "mathcolor", to: :mathcolor
22
25
  map_attribute "mathbackground", to: :mathbackground
23
26
  map_attribute "mathvariant", to: :mathvariant
24
27
  map_attribute "mathsize", to: :mathsize
28
+ map_element "mglyph", to: :mglyph_value
29
+ map_element "malignmark", to: :malignmark_value
25
30
  end
26
31
  end
27
32
  end
data/lib/mml/base/mtr.rb CHANGED
@@ -18,7 +18,7 @@ module Mml
18
18
  xml do
19
19
  namespace Mml::Namespace
20
20
  element "mtr"
21
- mixed_content
21
+ ordered
22
22
 
23
23
  map_attribute "mathcolor", to: :mathcolor
24
24
  map_attribute "mathbackground", to: :mathbackground
@@ -10,19 +10,17 @@ module Mml
10
10
  attribute :mathbackground, :string
11
11
  attribute :accentunder, :string
12
12
  attribute :mathcolor, :string
13
- attribute :content, :string, collection: true
14
13
  attribute :align, :string
15
14
 
16
15
  xml do
17
16
  namespace Mml::Namespace
18
17
  element "munder"
19
- mixed_content
18
+ ordered
20
19
 
21
20
  map_attribute "mathbackground", to: :mathbackground
22
21
  map_attribute "accentunder", to: :accentunder
23
22
  map_attribute "mathcolor", to: :mathcolor
24
23
  map_attribute "align", to: :align
25
- map_content to: :content
26
24
  end
27
25
  end
28
26
  end
@@ -16,7 +16,7 @@ module Mml
16
16
  xml do
17
17
  namespace Mml::Namespace
18
18
  element "munderover"
19
- mixed_content
19
+ ordered
20
20
 
21
21
  map_attribute "mathcolor", to: :mathcolor
22
22
  map_attribute "mathbackground", to: :mathbackground
@@ -13,7 +13,7 @@ module Mml
13
13
  xml do
14
14
  namespace Mml::Namespace
15
15
  element "semantics"
16
- mixed_content
16
+ ordered
17
17
 
18
18
  map_attribute "definitionURL", to: :definition_url
19
19
  map_attribute "encoding", to: :semantics_encoding
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.3.7"
4
+ VERSION = "2.4.0"
5
5
  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.3.7
4
+ version: 2.4.0
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-04-22 00:00:00.000000000 Z
11
+ date: 2026-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model