Class: AsciiMath::Expression
- Inherits:
-
Object
- Object
- AsciiMath::Expression
- Defined in:
- lib/asciimath/html.rb,
lib/asciimath/latex.rb,
lib/asciimath/mathml.rb,
lib/asciimath/parser.rb
Instance Attribute Summary collapse
-
#ast ⇒ Object
Returns the value of attribute ast.
Instance Method Summary collapse
-
#initialize(asciimath, ast) ⇒ Expression
constructor
A new instance of Expression.
- #to_html(prefix = "", inline = true, attrs = {}) ⇒ Object
- #to_latex(symbol_table = nil) ⇒ Object
- #to_mathml(prefix = "", attrs = {}) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(asciimath, ast) ⇒ Expression
Returns a new instance of Expression.
760 761 762 763 |
# File 'lib/asciimath/parser.rb', line 760 def initialize(asciimath, ast) @asciimath = asciimath @ast = ast end |
Instance Attribute Details
#ast ⇒ Object
Returns the value of attribute ast.
758 759 760 |
# File 'lib/asciimath/parser.rb', line 758 def ast @ast end |
Instance Method Details
#to_html(prefix = "", inline = true, attrs = {}) ⇒ Object
245 246 247 |
# File 'lib/asciimath/html.rb', line 245 def to_html(prefix = "", inline = true, attrs = {}) HTMLBuilder.new(:prefix => prefix, :inline => inline).append_expression(ast, attrs).to_s end |
#to_latex(symbol_table = nil) ⇒ Object
396 397 398 |
# File 'lib/asciimath/latex.rb', line 396 def to_latex(symbol_table = nil) LatexBuilder.new(symbol_table).append_expression(ast).to_s end |
#to_mathml(prefix = "", attrs = {}) ⇒ Object
236 237 238 239 240 241 242 |
# File 'lib/asciimath/mathml.rb', line 236 def to_mathml(prefix = "", attrs = {}) if prefix.is_a? Hash attrs = prefix prefix = "" end MathMLBuilder.new(:prefix => prefix).append_expression(ast, attrs).to_s end |
#to_s ⇒ Object
765 766 767 |
# File 'lib/asciimath/parser.rb', line 765 def to_s @asciimath end |