Sha256: 4a8558265abb477350b948e7f710e7b67d2039770cd189637a6ef80c2540fdda
Contents?: true
Size: 1.15 KB
Versions: 4
Compression:
Stored size: 1.15 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 = OOXMLCoordinates.parse(comment_node_child, x_attr: 'x', y_attr: 'y') 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
4 entries across 4 versions & 1 rubygems