lib/rewritepclint.rb in rewritepclint-0.0.1 vs lib/rewritepclint.rb in rewritepclint-0.0.2

- old
+ new

@@ -9,10 +9,12 @@ # f.content = File.join(prefix, f.content).gsub("\\", "/") # end # return doc.to_xml() # end def self.with(prefix: prefix, content: content) - new_content = content.gsub(Regexp.new("<file>(.*?)</file>")) do |match| + match = content.match(Regexp.new(".*(<.xml.*</doc>.).*", Regexp::MULTILINE)) + new_content = match[1] + new_content = new_content.gsub(Regexp.new("<file>(.*?)</file>")) do |match| new_filename = $1.gsub("\\", "/") "<file>#{File.join(prefix, new_filename)}</file>" end end end