Sha256: 6cb72ea10654f4bebd536703339c73643d2549cda677452038796825eb20598d
Contents?: true
Size: 922 Bytes
Versions: 3
Compression:
Stored size: 922 Bytes
Contents
# Comment Data module OoxmlParser class Comment < OOXMLDocumentObject attr_accessor :id, :paragraphs def initialize(id = nil, paragraphs = []) @id = id @paragraphs = paragraphs end def self.parse_list(parent: nil) comments = [] comments_filename = "#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/comments.xml" return [] unless File.exist?(comments_filename) doc = Nokogiri::XML(File.open(comments_filename)) doc.search('//w:comments').each do |document| document.xpath('w:comment').each do |comment_tag| comment = Comment.new(comment_tag.attribute('id').value) comment_tag.xpath('w:p').each_with_index do |p, index| comment.paragraphs << DocxParagraph.new.parse(p, index, parent: parent) end comments << comment.dup end end comments end end end
Version data entries
3 entries across 3 versions & 1 rubygems