class OoxmlParser::SDTContent
Class for parsing ‘w:w:sdtContent` tags
Attributes
@return [Array <ParagraphRun, Table
, ParagraphRun>] list of all elements in SDT
Public Class Methods
Source
# File lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_content.rb, line 9 def initialize(parent: nil) @elements = [] super end
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
Public Instance Methods
Source
# File lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_content.rb, line 32 def paragraphs @elements.select { |obj| obj.is_a?(OoxmlParser::DocxParagraph) } end
@return [Array<DocxParagraphs>] list of paragraphs
Source
# File lib/ooxml_parser/docx_parser/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
Parse SDTContent
object @param node [Nokogiri::XML:Element] node to parse @return [SDTContent] result of parsing
Source
# File lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_content.rb, line 37 def runs @elements.select { |obj| obj.is_a?(OoxmlParser::ParagraphRun) } end
@return [Array<ParagraphRun>] list of runs
Source
# File lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_content.rb, line 42 def tables @elements.select { |obj| obj.is_a?(OoxmlParser::Table) } end
@return [Array<Table>] list of tables