Sha256: 0a392f1ac45a8e258ef4d75f0b86462c91fd8aa1c53e1bcd831d870c78e54682
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require_relative 'presentation_comment/presentation_comment_author' module OoxmlParser class PresentationComment < OOXMLDocumentObject attr_accessor :author, :position, :text def initialize(author) @author = author end def self.parse(comment_node, comment_authors) comment = PresentationComment.new(comment_authors[comment_node.attribute('authorId').value]) comment_node.xpath('*').each do |comment_node_child| case comment_node_child.name when 'pos' comment.position = OOXMLShift.parse(comment_node_child, 'x', 'y', 1) when 'text' comment.text = comment_node_child.text.to_s end end comment end def self.parse_list File.exist?(OOXMLDocumentObject.path_to_folder + 'ppt/comments/comment1.xml') ? doc = Nokogiri::XML(File.open(OOXMLDocumentObject.path_to_folder + '/ppt/comments/comment1.xml')) : (return []) comment_authors = PresentationCommentAuthor.parse comments = [] doc.xpath('p:cmLst/p:cm').each { |comment_node| comments << PresentationComment.parse(comment_node, comment_authors) } comments end end end
Version data entries
2 entries across 2 versions & 1 rubygems