Class: AsciiMath::MathMLBuilder

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

Instance Method Summary collapse

Methods inherited from MarkupBuilder

add_default_display_symbols, default_display_symbol_table

Constructor Details

#initialize(opts = {}) ⇒ MathMLBuilder

Returns a new instance of MathMLBuilder.



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

def initialize(opts = {})
  super(opts[:symbol_table] || ::AsciiMath::MarkupBuilder.default_display_symbol_table(fix_phi: opts.fetch(:fix_phi, true)))
  @prefix = opts[:prefix] || ''
  @mathml = ''
  if opts[:msword]
    @row_mode = :force
    @fence_mode = :fenced
  else
    @row_mode = :avoid
    @fence_mode = :row
  end
  @escape_non_ascii = opts.fetch(:escape_non_ascii, true)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



190
191
192
# File 'lib/asciimath/mathml.rb', line 190

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

Instance Method Details

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



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

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

#to_sObject



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

def to_s
  @mathml
end