mml 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Gemfile +2 -0
- data/lib/mml/configuration.rb +70 -0
- data/lib/mml/maction.rb +21 -0
- data/lib/mml/maligngroup.rb +19 -0
- data/lib/mml/malignmark.rb +19 -0
- data/lib/mml/math_with_namespace.rb +20 -0
- data/lib/mml/math_with_nil_namespace.rb +19 -0
- data/lib/mml/menclose.rb +25 -0
- data/lib/mml/merror.rb +23 -0
- data/lib/mml/mfenced.rb +33 -0
- data/lib/mml/mfrac.rb +31 -0
- data/lib/mml/mfraction.rb +31 -0
- data/lib/mml/mglyph.rb +45 -0
- data/lib/mml/mi.rb +37 -0
- data/lib/mml/mlabeledtr.rb +27 -0
- data/lib/mml/mlongdiv.rb +29 -0
- data/lib/mml/mml.rb +21 -0
- data/lib/mml/mmultiscripts.rb +29 -0
- data/lib/mml/mn.rb +37 -0
- data/lib/mml/mo.rb +85 -0
- data/lib/mml/mover.rb +27 -0
- data/lib/mml/mpadded.rb +33 -0
- data/lib/mml/mphantom.rb +23 -0
- data/lib/mml/mprescripts.rb +17 -0
- data/lib/mml/mroot.rb +23 -0
- data/lib/mml/mrow.rb +31 -0
- data/lib/mml/ms.rb +47 -0
- data/lib/mml/mscarries.rb +31 -0
- data/lib/mml/mscarry.rb +27 -0
- data/lib/mml/msgroup.rb +32 -0
- data/lib/mml/msline.rb +27 -0
- data/lib/mml/mspace.rb +57 -0
- data/lib/mml/msqrt.rb +24 -0
- data/lib/mml/msrow.rb +26 -0
- data/lib/mml/mstack.rb +31 -0
- data/lib/mml/mstyle.rb +215 -0
- data/lib/mml/msub.rb +25 -0
- data/lib/mml/msubsup.rb +27 -0
- data/lib/mml/msup.rb +25 -0
- data/lib/mml/mtable.rb +57 -0
- data/lib/mml/mtd.rb +27 -0
- data/lib/mml/mtext.rb +37 -0
- data/lib/mml/mtr.rb +25 -0
- data/lib/mml/munder.rb +29 -0
- data/lib/mml/munderover.rb +29 -0
- data/lib/mml/none.rb +17 -0
- data/lib/mml/semantics.rb +21 -0
- data/lib/mml/version.rb +1 -1
- data/lib/mml.rb +6 -5
- data/mml.gemspec +2 -1
- metadata +66 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 565c1e39fe3e4ac67501f0064c9685dae36c40339c12ed1d7d489a73fbdb8a73
|
4
|
+
data.tar.gz: 1f7fb702767b86261862c161384b6f1f44899b31923285e3af00de766daae784
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a06d4db0336c75b7c888c03c3c88fecba8bc0f4dd1622354b41d829a60ae0a5548b162bf9334320bac88984f7a77f043e909e0ff13c069d0debcff4f973ade23
|
7
|
+
data.tar.gz: 0b3a278522ec51b683a0be41198909fe9f3a882148d053f4d444771dfb2cfe4ab6f16ed73cb11c30b89acbeb51fe56c935216e4527c7c9a71cd2436df3d3ce81
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
module Configuration
|
5
|
+
SUPPORTED_TAGS = %w[
|
6
|
+
mmultiscripts
|
7
|
+
maligngroup
|
8
|
+
malignmark
|
9
|
+
munderover
|
10
|
+
semantics
|
11
|
+
mscarries
|
12
|
+
mfraction
|
13
|
+
mphantom
|
14
|
+
menclose
|
15
|
+
mlongdiv
|
16
|
+
mpadded
|
17
|
+
msubsup
|
18
|
+
mscarry
|
19
|
+
mfenced
|
20
|
+
msgroup
|
21
|
+
mglyph
|
22
|
+
mstack
|
23
|
+
munder
|
24
|
+
mtable
|
25
|
+
mstyle
|
26
|
+
mspace
|
27
|
+
msline
|
28
|
+
merror
|
29
|
+
msrow
|
30
|
+
mfrac
|
31
|
+
mover
|
32
|
+
mroot
|
33
|
+
mtext
|
34
|
+
msqrt
|
35
|
+
none
|
36
|
+
mrow
|
37
|
+
msub
|
38
|
+
msup
|
39
|
+
mi
|
40
|
+
mo
|
41
|
+
mn
|
42
|
+
ms
|
43
|
+
].freeze
|
44
|
+
|
45
|
+
module_function
|
46
|
+
|
47
|
+
def config
|
48
|
+
@config ||= {}
|
49
|
+
end
|
50
|
+
|
51
|
+
def config=(config)
|
52
|
+
self.config.merge!(config)
|
53
|
+
end
|
54
|
+
|
55
|
+
def adapter
|
56
|
+
Lutaml::Model::Config.xml_adapter
|
57
|
+
end
|
58
|
+
|
59
|
+
def adapter=(adapter)
|
60
|
+
Lutaml::Model::Config.configure do |config|
|
61
|
+
require "lutaml/model/xml_adapter/#{adapter.downcase}_adapter"
|
62
|
+
config.xml_adapter = Lutaml::Model::XmlAdapter.const_get("#{adapter.to_s.capitalize}Adapter")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def class_for(class_name)
|
67
|
+
config[class_name]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/mml/maction.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Maction < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:maction)
|
6
|
+
|
7
|
+
attribute :mathcolor, :string
|
8
|
+
attribute :mathbackground, :string
|
9
|
+
attribute :actiontype, :string
|
10
|
+
attribute :selection, :string
|
11
|
+
|
12
|
+
xml do
|
13
|
+
root "maction"
|
14
|
+
|
15
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
16
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
17
|
+
map_attribute "actiontype", to: :actiontype, namespace: nil
|
18
|
+
map_attribute "selection", to: :selection, namespace: nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Maligngroup < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:maligngroup)
|
6
|
+
|
7
|
+
attribute :mathcolor, :string
|
8
|
+
attribute :mathbackground, :string
|
9
|
+
attribute :groupalign, :string
|
10
|
+
|
11
|
+
xml do
|
12
|
+
root "maligngroup"
|
13
|
+
|
14
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
15
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
16
|
+
map_attribute "groupalign", to: :groupalign, namespace: nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Malignmark < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:malignmark)
|
6
|
+
|
7
|
+
attribute :mathcolor, :string
|
8
|
+
attribute :mathbackground, :string
|
9
|
+
attribute :edge, :string
|
10
|
+
|
11
|
+
xml do
|
12
|
+
root "malignmark"
|
13
|
+
|
14
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
15
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
16
|
+
map_attribute "edge", to: :edge, namespace: nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class MathWithNamespace < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:math)
|
6
|
+
|
7
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
8
|
+
attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
|
9
|
+
end
|
10
|
+
|
11
|
+
xml do
|
12
|
+
root "math", mixed: true
|
13
|
+
namespace "http://www.w3.org/1998/Math/MathML", nil
|
14
|
+
|
15
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
16
|
+
map_element tag.to_sym, to: :"#{tag}_value"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class MathWithNilNamespace < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:math)
|
6
|
+
|
7
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
8
|
+
attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
|
9
|
+
end
|
10
|
+
|
11
|
+
xml do
|
12
|
+
root "math", mixed: true
|
13
|
+
|
14
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
15
|
+
map_element tag.to_sym, to: :"#{tag}_value"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/mml/menclose.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Menclose < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:menclose)
|
6
|
+
|
7
|
+
attribute :mathcolor, :string
|
8
|
+
attribute :mathbackground, :string
|
9
|
+
attribute :notation, :string
|
10
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
11
|
+
attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
|
12
|
+
end
|
13
|
+
|
14
|
+
xml do
|
15
|
+
root "menclose", mixed: true
|
16
|
+
|
17
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
18
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
19
|
+
map_attribute "notation", to: :notation, namespace: nil
|
20
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
21
|
+
map_element tag.to_sym, to: :"#{tag}_value"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/mml/merror.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Merror < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:merror)
|
6
|
+
|
7
|
+
attribute :mathbackground, :string
|
8
|
+
attribute :mathcolor, :string
|
9
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
10
|
+
attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
|
11
|
+
end
|
12
|
+
|
13
|
+
xml do
|
14
|
+
root "merror", mixed: true
|
15
|
+
|
16
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
17
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
18
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
19
|
+
map_element tag.to_sym, to: :"#{tag}_value"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/mml/mfenced.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Mfenced < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:mfenced)
|
6
|
+
|
7
|
+
attribute :mathbackground, :string
|
8
|
+
attribute :separators, :string
|
9
|
+
attribute :mathcolor, :string
|
10
|
+
attribute :content, :string
|
11
|
+
attribute :close, :string
|
12
|
+
attribute :open, :string
|
13
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
14
|
+
attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
|
15
|
+
end
|
16
|
+
|
17
|
+
xml do
|
18
|
+
root "mfenced", mixed: true
|
19
|
+
|
20
|
+
map_content to: :content
|
21
|
+
|
22
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
23
|
+
map_attribute "separators", to: :separators, namespace: nil
|
24
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
25
|
+
map_attribute "close", to: :close, namespace: nil
|
26
|
+
map_attribute "open", to: :open, namespace: nil
|
27
|
+
|
28
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
29
|
+
map_element tag.to_sym, to: :"#{tag}_value"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/mml/mfrac.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Mfrac < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:mfrac)
|
6
|
+
|
7
|
+
attribute :mathcolor, :string
|
8
|
+
attribute :mathbackground, :string
|
9
|
+
attribute :linethickness, :string
|
10
|
+
attribute :numalign, :string
|
11
|
+
attribute :denomalign, :string
|
12
|
+
attribute :bevelled, :string
|
13
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
14
|
+
attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
|
15
|
+
end
|
16
|
+
|
17
|
+
xml do
|
18
|
+
root "mfrac", mixed: true
|
19
|
+
|
20
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
21
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
22
|
+
map_attribute "linethickness", to: :linethickness, namespace: nil
|
23
|
+
map_attribute "numalign", to: :numalign, namespace: nil
|
24
|
+
map_attribute "denomalign", to: :denomalign, namespace: nil
|
25
|
+
map_attribute "bevelled", to: :bevelled, namespace: nil
|
26
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
27
|
+
map_element tag.to_sym, to: :"#{tag}_value"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Mfraction < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:mfraction)
|
6
|
+
|
7
|
+
attribute :mathcolor, :string
|
8
|
+
attribute :mathbackground, :string
|
9
|
+
attribute :linethickness, :string
|
10
|
+
attribute :numalign, :string
|
11
|
+
attribute :denomalign, :string
|
12
|
+
attribute :bevelled, :string
|
13
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
14
|
+
attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
|
15
|
+
end
|
16
|
+
|
17
|
+
xml do
|
18
|
+
root "mfraction", mixed: true
|
19
|
+
|
20
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
21
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
22
|
+
map_attribute "linethickness", to: :linethickness, namespace: nil
|
23
|
+
map_attribute "numalign", to: :numalign, namespace: nil
|
24
|
+
map_attribute "denomalign", to: :denomalign, namespace: nil
|
25
|
+
map_attribute "bevelled", to: :bevelled, namespace: nil
|
26
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
27
|
+
map_element tag.to_sym, to: :"#{tag}_value"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/mml/mglyph.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Mglyph < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:mglyph)
|
6
|
+
|
7
|
+
attribute :alt, :string
|
8
|
+
attribute :src, :string
|
9
|
+
attribute :width, :string
|
10
|
+
attribute :color, :string
|
11
|
+
attribute :index, :integer
|
12
|
+
attribute :height, :string
|
13
|
+
attribute :valign, :string
|
14
|
+
attribute :mathsize, :string
|
15
|
+
attribute :fontsize, :string
|
16
|
+
attribute :fontstyle, :string
|
17
|
+
attribute :mathcolor, :string
|
18
|
+
attribute :fontfamily, :string
|
19
|
+
attribute :fontweight, :string
|
20
|
+
attribute :background, :string
|
21
|
+
attribute :mathvariant, :string
|
22
|
+
attribute :mathbackground, :string
|
23
|
+
|
24
|
+
xml do
|
25
|
+
root "mglyph"
|
26
|
+
|
27
|
+
map_attribute "src", to: :src, namespace: nil
|
28
|
+
map_attribute "alt", to: :alt, namespace: nil
|
29
|
+
map_attribute "color", to: :color, namespace: nil
|
30
|
+
map_attribute "index", to: :index, namespace: nil
|
31
|
+
map_attribute "width", to: :width, namespace: nil
|
32
|
+
map_attribute "height", to: :height, namespace: nil
|
33
|
+
map_attribute "valign", to: :valign, namespace: nil
|
34
|
+
map_attribute "mathsize", to: :mathsize, namespace: nil
|
35
|
+
map_attribute "fontsize", to: :fontsize, namespace: nil
|
36
|
+
map_attribute "fontstyle", to: :fontstyle, namespace: nil
|
37
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
38
|
+
map_attribute "background", to: :background, namespace: nil
|
39
|
+
map_attribute "fontfamily", to: :fontfamily, namespace: nil
|
40
|
+
map_attribute "fontweight", to: :fontweight, namespace: nil
|
41
|
+
map_attribute "mathvariant", to: :mathvariant, namespace: nil
|
42
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/mml/mi.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Mi < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:mi)
|
6
|
+
|
7
|
+
attribute :dir, :string
|
8
|
+
attribute :value, :string
|
9
|
+
attribute :color, :string
|
10
|
+
attribute :mathsize, :string
|
11
|
+
attribute :fontsize, :string
|
12
|
+
attribute :fontstyle, :string
|
13
|
+
attribute :mathcolor, :string
|
14
|
+
attribute :background, :string
|
15
|
+
attribute :fontfamily, :string
|
16
|
+
attribute :fontweight, :string
|
17
|
+
attribute :mathvariant, :string
|
18
|
+
attribute :mathbackground, :string
|
19
|
+
|
20
|
+
xml do
|
21
|
+
root "mi"
|
22
|
+
|
23
|
+
map_content to: :value
|
24
|
+
map_attribute "dir", to: :dir, namespace: nil
|
25
|
+
map_attribute "color", to: :color, namespace: nil
|
26
|
+
map_attribute "mathsize", to: :mathsize, namespace: nil
|
27
|
+
map_attribute "fontsize", to: :fontsize, namespace: nil
|
28
|
+
map_attribute "fontstyle", to: :fontstyle, namespace: nil
|
29
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
30
|
+
map_attribute "fontfamily", to: :fontfamily, namespace: nil
|
31
|
+
map_attribute "fontweight", to: :fontweight, namespace: nil
|
32
|
+
map_attribute "background", to: :background, namespace: nil
|
33
|
+
map_attribute "mathvariant", to: :mathvariant, namespace: nil
|
34
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Mlabeledtr < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:mlabeledtr)
|
6
|
+
|
7
|
+
attribute :mathbackground, :string
|
8
|
+
attribute :columnalign, :string
|
9
|
+
attribute :groupalign, :string
|
10
|
+
attribute :mathcolor, :string
|
11
|
+
attribute :rowalign, :string
|
12
|
+
attribute :id, :string
|
13
|
+
attribute :mtd_value, Mtd, collection: true
|
14
|
+
|
15
|
+
xml do
|
16
|
+
root "mlabeledtr", mixed: true
|
17
|
+
|
18
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
19
|
+
map_attribute "columnalign", to: :columnalign, namespace: nil
|
20
|
+
map_attribute "groupalign", to: :groupalign, namespace: nil
|
21
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
22
|
+
map_attribute "rowalign", to: :rowalign, namespace: nil
|
23
|
+
map_attribute "id", to: :id, namespace: nil
|
24
|
+
map_element "mtd", to: :mtd_value
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/mml/mlongdiv.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Mlongdiv < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:mlongdiv)
|
6
|
+
|
7
|
+
attribute :mathbackground, :string
|
8
|
+
attribute :longdivstyle, :string
|
9
|
+
attribute :mathcolor, :string
|
10
|
+
attribute :position, :integer
|
11
|
+
attribute :shift, :integer
|
12
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
13
|
+
attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
|
14
|
+
end
|
15
|
+
|
16
|
+
xml do
|
17
|
+
root "mlongdiv", mixed: true
|
18
|
+
|
19
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
20
|
+
map_attribute "longdivstyle", to: :longdivstyle, namespace: nil
|
21
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
22
|
+
map_attribute "position", to: :position, namespace: nil
|
23
|
+
map_attribute "shift", to: :shift, namespace: nil
|
24
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
25
|
+
map_element tag.to_sym, to: :"#{tag}_value"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/mml/mml.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Error < StandardError; end
|
5
|
+
|
6
|
+
module_function
|
7
|
+
|
8
|
+
def config
|
9
|
+
Configuration.config
|
10
|
+
end
|
11
|
+
|
12
|
+
def parse(input, namespace_exist: true)
|
13
|
+
Configuration.adapter = :ox unless Configuration.adapter
|
14
|
+
|
15
|
+
if namespace_exist
|
16
|
+
Mml::MathWithNamespace.from_xml(input)
|
17
|
+
else
|
18
|
+
Mml::MathWithNilNamespace.from_xml(input)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Mmultiscripts < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:mmultiscripts)
|
6
|
+
|
7
|
+
attribute :mathcolor, :string
|
8
|
+
attribute :mathbackground, :string
|
9
|
+
attribute :subscriptshift, :string
|
10
|
+
attribute :superscriptshift, :string
|
11
|
+
attribute :mprescripts_value, Mprescripts
|
12
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
13
|
+
attribute :"#{tag}_value", Mml.const_get(tag.capitalize), collection: true
|
14
|
+
end
|
15
|
+
|
16
|
+
xml do
|
17
|
+
root "mmultiscripts", mixed: true
|
18
|
+
|
19
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
20
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
21
|
+
map_attribute "subscriptshift", to: :subscriptshift, namespace: nil
|
22
|
+
map_attribute "superscriptshift", to: :superscriptshift, namespace: nil
|
23
|
+
map_element "mprescripts", to: :mprescripts_value
|
24
|
+
Mml::Configuration::SUPPORTED_TAGS.each do |tag|
|
25
|
+
map_element tag.to_sym, to: :"#{tag}_value"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/mml/mn.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Mn < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:mn)
|
6
|
+
|
7
|
+
attribute :value, :integer
|
8
|
+
attribute :mathcolor, :string
|
9
|
+
attribute :mathbackground, :string
|
10
|
+
attribute :mathvariant, :string
|
11
|
+
attribute :mathsize, :string
|
12
|
+
attribute :dir, :string
|
13
|
+
attribute :fontfamily, :string
|
14
|
+
attribute :fontweight, :string
|
15
|
+
attribute :fontstyle, :string
|
16
|
+
attribute :fontsize, :string
|
17
|
+
attribute :color, :string
|
18
|
+
attribute :background, :string
|
19
|
+
|
20
|
+
xml do
|
21
|
+
root "mn"
|
22
|
+
|
23
|
+
map_content to: :value
|
24
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
25
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
26
|
+
map_attribute "mathvariant", to: :mathvariant, namespace: nil
|
27
|
+
map_attribute "mathsize", to: :mathsize, namespace: nil
|
28
|
+
map_attribute "dir", to: :dir, namespace: nil
|
29
|
+
map_attribute "fontfamily", to: :fontfamily, namespace: nil
|
30
|
+
map_attribute "fontweight", to: :fontweight, namespace: nil
|
31
|
+
map_attribute "fontstyle", to: :fontstyle, namespace: nil
|
32
|
+
map_attribute "fontsize", to: :fontsize, namespace: nil
|
33
|
+
map_attribute "color", to: :color, namespace: nil
|
34
|
+
map_attribute "background", to: :background, namespace: nil
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/mml/mo.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mml
|
4
|
+
class Mo < Lutaml::Model::Serializable
|
5
|
+
model Mml::Configuration.class_for(:mo)
|
6
|
+
|
7
|
+
attribute :value, :string
|
8
|
+
attribute :mathcolor, :string
|
9
|
+
attribute :mathbackground, :string
|
10
|
+
attribute :mathvariant, :string
|
11
|
+
attribute :mathsize, :string
|
12
|
+
attribute :dir, :string
|
13
|
+
attribute :fontfamily, :string
|
14
|
+
attribute :fontweight, :string
|
15
|
+
attribute :fontstyle, :string
|
16
|
+
attribute :fontsize, :string
|
17
|
+
attribute :color, :string
|
18
|
+
attribute :background, :string
|
19
|
+
attribute :form, :string
|
20
|
+
attribute :fence, :string
|
21
|
+
attribute :separator, :string
|
22
|
+
attribute :lspace, :string
|
23
|
+
attribute :rspace, :string
|
24
|
+
attribute :stretchy, :string
|
25
|
+
attribute :symmetric, :string
|
26
|
+
attribute :maxsize, :string
|
27
|
+
attribute :minsize, :string
|
28
|
+
attribute :largeop, :string
|
29
|
+
attribute :movablelimits, :string
|
30
|
+
attribute :accent, :string
|
31
|
+
attribute :linebreak, :string
|
32
|
+
attribute :lineleading, :string
|
33
|
+
attribute :linebreakstyle, :string
|
34
|
+
attribute :linebreakmultchar, :string
|
35
|
+
attribute :indentalign, :string
|
36
|
+
attribute :indentshift, :string
|
37
|
+
attribute :indenttarget, :string
|
38
|
+
attribute :indentalignfirst, :string
|
39
|
+
attribute :indentshiftfirst, :string
|
40
|
+
attribute :indentalignlast, :string
|
41
|
+
attribute :indentshiftlast, :string
|
42
|
+
|
43
|
+
# rubocop:disable Metrics/BlockLength
|
44
|
+
xml do
|
45
|
+
root "mo"
|
46
|
+
|
47
|
+
map_content to: :value
|
48
|
+
map_attribute "dir", to: :dir, namespace: nil
|
49
|
+
map_attribute "form", to: :form, namespace: nil
|
50
|
+
map_attribute "fence", to: :fence, namespace: nil
|
51
|
+
map_attribute "color", to: :color, namespace: nil
|
52
|
+
map_attribute "accent", to: :accent, namespace: nil
|
53
|
+
map_attribute "lspace", to: :lspace, namespace: nil
|
54
|
+
map_attribute "rspace", to: :rspace, namespace: nil
|
55
|
+
map_attribute "maxsize", to: :maxsize, namespace: nil
|
56
|
+
map_attribute "minsize", to: :minsize, namespace: nil
|
57
|
+
map_attribute "largeop", to: :largeop, namespace: nil
|
58
|
+
map_attribute "stretchy", to: :stretchy, namespace: nil
|
59
|
+
map_attribute "mathsize", to: :mathsize, namespace: nil
|
60
|
+
map_attribute "fontsize", to: :fontsize, namespace: nil
|
61
|
+
map_attribute "linebreak", to: :linebreak, namespace: nil
|
62
|
+
map_attribute "fontstyle", to: :fontstyle, namespace: nil
|
63
|
+
map_attribute "separator", to: :separator, namespace: nil
|
64
|
+
map_attribute "symmetric", to: :symmetric, namespace: nil
|
65
|
+
map_attribute "mathcolor", to: :mathcolor, namespace: nil
|
66
|
+
map_attribute "fontfamily", to: :fontfamily, namespace: nil
|
67
|
+
map_attribute "fontweight", to: :fontweight, namespace: nil
|
68
|
+
map_attribute "background", to: :background, namespace: nil
|
69
|
+
map_attribute "mathvariant", to: :mathvariant, namespace: nil
|
70
|
+
map_attribute "lineleading", to: :lineleading, namespace: nil
|
71
|
+
map_attribute "indentalign", to: :indentalign, namespace: nil
|
72
|
+
map_attribute "indentshift", to: :indentshift, namespace: nil
|
73
|
+
map_attribute "indenttarget", to: :indenttarget, namespace: nil
|
74
|
+
map_attribute "movablelimits", to: :movablelimits, namespace: nil
|
75
|
+
map_attribute "linebreakstyle", to: :linebreakstyle, namespace: nil
|
76
|
+
map_attribute "mathbackground", to: :mathbackground, namespace: nil
|
77
|
+
map_attribute "indentalignlast", to: :indentalignlast, namespace: nil
|
78
|
+
map_attribute "indentshiftlast", to: :indentshiftlast, namespace: nil
|
79
|
+
map_attribute "indentalignfirst", to: :indentalignfirst, namespace: nil
|
80
|
+
map_attribute "indentshiftfirst", to: :indentshiftfirst, namespace: nil
|
81
|
+
map_attribute "linebreakmultchar", to: :linebreakmultchar, namespace: nil
|
82
|
+
end
|
83
|
+
# rubocop:enable Metrics/BlockLength
|
84
|
+
end
|
85
|
+
end
|