class OoxmlParser::SDTContent
Class for parsing `w:w:sdtContent` tags
Attributes
elements[R]
@return [Array <ParagraphRun, Table
, ParagraphRun>] list of all elements in SDT
Public Class Methods
new(parent: nil)
click to toggle source
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb, line 9 def initialize(parent: nil) @elements = [] super end
Public Instance Methods
paragraphs()
click to toggle source
@return [Array<DocxParagraphs>] list of paragraphs
# File lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb, line 32 def paragraphs @elements.select { |obj| obj.is_a?(OoxmlParser::DocxParagraph) } end
parse(node)
click to toggle source
Parse SDTContent
object @param node [Nokogiri::XML:Element] node to parse @return [SDTContent] result of parsing
# File lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb, line 17 def parse(node) node.xpath('*').each do |node_child| case node_child.name when 'p' @elements << DocxParagraph.new(parent: self).parse(node_child) when 'r' @elements << ParagraphRun.new(parent: self).parse(node_child) when 'tbl' @elements << Table.new(parent: self).parse(node_child) end end self end
runs()
click to toggle source
@return [Array<ParagraphRun>] list of runs
# File lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb, line 37 def runs @elements.select { |obj| obj.is_a?(OoxmlParser::ParagraphRun) } end
tables()
click to toggle source
@return [Array<Table>] list of tables
# File lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb, line 42 def tables @elements.select { |obj| obj.is_a?(OoxmlParser::Table) } end