Class: AsciiMath::HTMLBuilder

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

Instance Method Summary collapse

Methods inherited from MarkupBuilder

add_default_display_symbols, default_display_symbol_table

Constructor Details

#initialize(opts = {}) ⇒ HTMLBuilder

Returns a new instance of HTMLBuilder.



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

def initialize(opts = {})
  super(opts[:symbol_table] || ::AsciiMath::MarkupBuilder.default_display_symbol_table(fix_phi: opts.fetch(:fix_phi, true)))
  @prefix = opts[:prefifx] || ''
  @inline = opts[:inline]
  @escape_non_ascii = opts.fetch(:escape_non_ascii, true)
  @html = ''
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



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

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

Instance Method Details

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



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

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



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

def to_s
  @html
end