class OoxmlParser::Paragraph

Class for parsing ‘p` tags

Attributes

alternate_content[RW]

@return [AlternateContent] alternate content data

character_style_array[RW]
character_style_array=[RW]
characters[RW]
characters=[RW]
formulas[RW]
properties[RW]
runs[RW]
text_field[RW]

Public Class Methods

new(runs = [], formulas = [], parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/common_parser/common_data/paragraph.rb, line 13
def initialize(runs = [],
               formulas = [],
               parent: nil)
  @runs = runs
  @formulas = formulas
  @runs = []
  super(parent: parent)
end

Public Instance Methods

parse(node) click to toggle source

Parse Paragraph object @param node [Nokogiri::XML:Element] node to parse @return [Paragraph] result of parsing

# File lib/ooxml_parser/common_parser/common_data/paragraph.rb, line 30
def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'pPr'
      @properties = ParagraphProperties.new(parent: self).parse(node_child)
    when 'fld'
      @text_field = TextField.new(parent: self).parse(node_child)
    when 'r'
      @runs << ParagraphRun.new(parent: self).parse(node_child)
    when 'AlternateContent'
      @alternate_content = AlternateContent.new(parent: self).parse(node_child)
    end
  end
  self
end