Class: OoxmlParser::Paragraph
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Paragraph
- Defined in:
- lib/ooxml_parser/common_parser/common_data/paragraph.rb
Overview
Class for parsing ‘p` tags
Instance Attribute Summary collapse
-
#alternate_content ⇒ AlternateContent
Alternate content data.
-
#formulas ⇒ Object
Returns the value of attribute formulas.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#runs ⇒ Object
(also: #characters, #character_style_array)
Returns the value of attribute runs.
-
#text_field ⇒ Object
Returns the value of attribute text_field.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(runs = [], formulas = [], parent: nil) ⇒ Paragraph
constructor
A new instance of Paragraph.
-
#parse(node) ⇒ Paragraph
Parse Paragraph object.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(runs = [], formulas = [], parent: nil) ⇒ Paragraph
Returns a new instance of Paragraph.
13 14 15 16 17 18 19 20 |
# 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 |
Instance Attribute Details
#alternate_content ⇒ AlternateContent
Returns alternate content data.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 11 def alternate_content @alternate_content end |
#formulas ⇒ Object
Returns the value of attribute formulas.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 9 def formulas @formulas end |
#properties ⇒ Object
Returns the value of attribute properties.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 9 def properties @properties end |
#runs ⇒ Object Also known as: characters, character_style_array
Returns the value of attribute runs.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 9 def runs @runs end |
#text_field ⇒ Object
Returns the value of attribute text_field.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/paragraph.rb', line 9 def text_field @text_field end |
Instance Method Details
#parse(node) ⇒ Paragraph
Parse Paragraph object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# 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 |