Class: Plurimath::Html::Parser
- Inherits:
 - 
      Object
      
        
- Object
 - Plurimath::Html::Parser
 
 
- Defined in:
 - lib/plurimath/html/parser.rb
 
Instance Attribute Summary collapse
- 
  
    
      #text  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute text.
 
Instance Method Summary collapse
- 
  
    
      #initialize(text)  ⇒ Parser 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Parser.
 - #parse ⇒ Object
 
Constructor Details
#initialize(text) ⇒ Parser
Returns a new instance of Parser.
      12 13 14  | 
    
      # File 'lib/plurimath/html/parser.rb', line 12 def initialize(text) @text = CGI.unescapeHTML(text) end  | 
  
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
      10 11 12  | 
    
      # File 'lib/plurimath/html/parser.rb', line 10 def text @text end  | 
  
Instance Method Details
#parse ⇒ Object
      16 17 18 19 20 21 22 23  | 
    
      # File 'lib/plurimath/html/parser.rb', line 16 def parse nodes = Parse.new.parse(text) nodes = JSON.parse(nodes.to_json, symbolize_names: true) transformed_tree = Transform.new.apply(nodes) return transformed_tree if transformed_tree.is_a?(Math::Formula) Math::Formula.new(transformed_tree) end  |