Class: AsciiMath::MathMLBuilder

Inherits:
MarkupBuilder show all
Defined in:
lib/asciimath/mathml.rb

Constant Summary

Constants inherited from MarkupBuilder

AsciiMath::MarkupBuilder::DEFAULT_DISPLAY_SYMBOL_TABLE

Instance Method Summary collapse

Methods inherited from MarkupBuilder

add_default_display_symbols

Constructor Details

#initialize(opts = {}) ⇒ MathMLBuilder

Returns a new instance of MathMLBuilder.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/asciimath/mathml.rb', line 7

def initialize(opts = {})
  super(opts[:symbol_table] || DEFAULT_DISPLAY_SYMBOL_TABLE)
  @prefix = opts[:prefix] || ''
  @mathml = ''
  if opts[:msword]
    @row_mode = :force
    @fence_mode = :fenced
  else
    @row_mode = :avoid
    @fence_mode = :row
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object (private)



173
174
175
# File 'lib/asciimath/mathml.rb', line 173

def method_missing(meth, *args, &block)
  tag(meth, *args, &block)
end

Instance Method Details

#append_expression(expression, attrs = {}) ⇒ Object



24
25
26
27
28
# File 'lib/asciimath/mathml.rb', line 24

def append_expression(expression, attrs = {})
  math('', attrs) do
    append(expression, :row => :omit)
  end
end

#to_sObject



20
21
22
# File 'lib/asciimath/mathml.rb', line 20

def to_s
  @mathml
end