class OoxmlParser::Slide
Class for parsing ‘slide.xml`
Attributes
@return [CommonSlideData] common slide data
@return [String] name of slide
@return [Notes] note of slide
@return [Relationships] relationships of slide
Public Class Methods
Source
# File lib/ooxml_parser/pptx_parser/presentation/slide.rb, line 26 def initialize(parent: nil, xml_path: nil) @xml_path = xml_path super(parent: parent) end
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
Public Instance Methods
Source
# File lib/ooxml_parser/pptx_parser/presentation/slide.rb, line 47 def background @common_slide_data.background end
@return [Background] background of slide
Source
# File lib/ooxml_parser/pptx_parser/presentation/slide.rb, line 42 def elements @common_slide_data.shape_tree.elements end
@return <Array> List of elements on slide
Source
# File lib/ooxml_parser/pptx_parser/presentation/slide.rb, line 53 def parse root_object.add_to_xmls_stack(@xml_path) @name = File.basename(@xml_path, '.*') node = parse_xml(root_object.current_xml) node.xpath('//p:sld/*').each do |node_child| case node_child.name when 'cSld' @common_slide_data = CommonSlideData.new(parent: self).parse(node_child) when 'timing' @timing = Timing.new(parent: self).parse(node_child) when 'transition' @transition = Transition.new(parent: self).parse(node_child) when 'AlternateContent' @alternate_content = PresentationAlternateContent.new(parent: self).parse(node_child) end end root_object.xmls_stack.pop @relationships = Relationships.new(parent: self).parse_file("#{root_object.unpacked_folder}#{File.dirname(@xml_path)}/_rels/#{@name}.xml.rels") parse_note self end
Parse Slide
object @return [Slide] result of parsing
Source
# File lib/ooxml_parser/pptx_parser/presentation/slide.rb, line 32 def with_data? return true unless background.nil? elements.each do |current_element| return true if current_element.with_data? end false end
@return [True, False] is slide with data
Private Instance Methods
Source
# File lib/ooxml_parser/pptx_parser/presentation/slide.rb, line 78 def parse_note notes_target = @relationships.target_by_type('notes') return nil if notes_target.empty? @note = PresentationNotes.new(parent: self).parse("#{root_object.unpacked_folder}#{File.dirname(@xml_path)}/#{notes_target.first}") end
Parse slide notes if present