Sha256: c96b36ec95de22eb8402ca81f580408e320e459514b66c393e641a51d5457730

Contents?: true

Size: 974 Bytes

Versions: 28

Compression:

Stored size: 974 Bytes

Contents

# frozen_string_literal: true

require_relative 'presentation_comments/presentation_comment'
module OoxmlParser
  # Class for parsing `comment1.xml` file
  class PresentationComments < OOXMLDocumentObject
    # @return [Array<PresentationComment>] list of comments
    attr_reader :list

    def initialize(parent: nil)
      @list = []
      super
    end

    # Parse PresentationComments object
    # @param file [Nokogiri::XML:Element] node to parse
    # @return [PresentationComments] result of parsing
    def parse(file = "#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/comments/comment1.xml")
      return nil unless File.exist?(file)

      document = parse_xml(File.open(file))
      node = document.xpath('*').first

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'cm'
          @list << PresentationComment.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ooxml_parser-0.29.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments.rb
ooxml_parser-0.28.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments.rb
ooxml_parser-0.27.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments.rb
ooxml_parser-0.26.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments.rb
ooxml_parser-0.25.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments.rb
ooxml_parser-0.24.0 lib/ooxml_parser/pptx_parser/presentation/presentation_comments.rb
ooxml_parser-0.23.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.22.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.21.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.20.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.19.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.18.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.18.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.17.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.16.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.15.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.14.2 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.14.1-mingw32 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.14.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb
ooxml_parser-0.14.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb