Class: AsciiMath::HTMLBuilder

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

Constant Summary

Constants inherited from MarkupBuilder

MarkupBuilder::DEFAULT_DISPLAY_SYMBOL_TABLE

Instance Method Summary collapse

Methods inherited from MarkupBuilder

add_default_display_symbols

Constructor Details

#initialize(opts = {}) ⇒ HTMLBuilder

Returns a new instance of HTMLBuilder.



6
7
8
9
10
11
# File 'lib/asciimath/html.rb', line 6

def initialize(opts = {})
  super(opts[:symbol_table] || DEFAULT_DISPLAY_SYMBOL_TABLE)
  @prefix = opts[:prefifx] || ''
  @inline = opts[:inline]
  @html = ''
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



207
208
209
# File 'lib/asciimath/html.rb', line 207

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

Instance Method Details

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



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/asciimath/html.rb', line 17

def append_expression(expression, attrs = {})
  if @inline
    inline('', attrs) do
      append(expression, :row => :omit)
    end
  else
    block('', attrs) do
      append(expression, :row => :omit)
    end
  end
end

#to_sObject



13
14
15
# File 'lib/asciimath/html.rb', line 13

def to_s
  @html
end