Sha256: 7d25a9c99a0ebeb3caf605dfc0ece1d0093935594caa565ceb39e7702b8a347c

Contents?: true

Size: 707 Bytes

Versions: 4

Compression:

Stored size: 707 Bytes

Contents

require_relative 'math_run/math_run_properties'
module OoxmlParser
  # Class for parsing `m:r` object
  class MathRun < OOXMLDocumentObject
    # @return [MathRunProperties] properties of run
    attr_accessor :properties
    # @return [String] text of formula
    attr_accessor :text

    # Parse MathRun
    # @param [Nokogiri::XML:Node] node with MathRun
    # @return [MathRun] result of parsing
    def parse(node)
      node.xpath('*').each do |math_run_child|
        case math_run_child.name
        when 'rPr'
          @properties = MathRunProperties.new(parent: self).parse(math_run_child)
        when 't'
          @text = math_run_child.text
        end
      end
      self
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ooxml_parser-0.4.1 lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb
ooxml_parser-0.4.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb
ooxml_parser-0.3.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb
ooxml_parser-0.2.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb