Module: Mml::Base::Mtable

Included in:
V2::Mtable, V3::Mtable, V4::Mtable
Defined in:
lib/mml/base/mtable.rb

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

NOTE: class_eval resolves constants in module’s lexical scope. Use fully qualified names (e.g., Mml::Namespace).



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/mml/base/mtable.rb', line 8

def self.included(klass)
  klass.class_eval do
    attribute :mathcolor, :string
    attribute :mathbackground, :string
    attribute :align, :string
    attribute :rowalign, :string
    attribute :columnalign, :string
    attribute :alignmentscope, :string
    attribute :groupalign, :string
    attribute :displaystyle, :string
    attribute :scriptlevel, :string
    attribute :columnwidth, :string
    attribute :width, :string
    attribute :rowspacing, :string
    attribute :columnspacing, :string
    attribute :rowlines, :string
    attribute :columnlines, :string
    attribute :frame, :string
    attribute :framespacing, :string
    attribute :equalrows, :string
    attribute :equalcolumns, :string
    attribute :side, :string
    attribute :mlabeledtr_value, :mlabeledtr, collection: true
    attribute :mtr_value, :mtr, collection: true

    xml do
      namespace Mml::Namespace
      element "mtable"
      mixed_content

      map_attribute "mathcolor", to: :mathcolor
      map_attribute "mathbackground", to: :mathbackground
      map_attribute "align", to: :align
      map_attribute "rowalign", to: :rowalign
      map_attribute "columnalign", to: :columnalign
      map_attribute "alignmentscope", to: :alignmentscope
      map_attribute "groupalign", to: :groupalign
      map_attribute "displaystyle", to: :displaystyle
      map_attribute "scriptlevel", to: :scriptlevel
      map_attribute "columnwidth", to: :columnwidth
      map_attribute "width", to: :width
      map_attribute "rowspacing", to: :rowspacing
      map_attribute "columnspacing", to: :columnspacing
      map_attribute "rowlines", to: :rowlines
      map_attribute "columnlines", to: :columnlines
      map_attribute "frame", to: :frame
      map_attribute "framespacing", to: :framespacing
      map_attribute "equalrows", to: :equalrows
      map_attribute "equalcolumns", to: :equalcolumns
      map_attribute "side", to: :side
      map_element "mlabeledtr", to: :mlabeledtr_value
      map_element "mtr", to: :mtr_value
    end
  end
end