Sha256: 05cde1b0797a32248d379bcdcc183a958b7bb6d8b141e4067d01cc8a02a18ef1
Contents?: true
Size: 758 Bytes
Versions: 1
Compression:
Stored size: 758 Bytes
Contents
require 'rewritepclint/version' #require 'nokogiri' module Rewritepclint # def self.with(prefix: prefix, content: content) # doc = Nokogiri::XML(content) # files = doc.xpath("//file") # files.each do |f| # f.content = File.join(prefix, f.content).gsub("\\", "/") # end # return doc.to_xml() # end def self.with(prefix: prefix, content: content) content = content.gsub('err:menubuilder:init_xdg error looking up the desktop directory', '') match = content.match(Regexp.new(".*(<.xml.*</doc>.).*", Regexp::MULTILINE)) content = match[1] content = content.gsub(Regexp.new("<file>(.*?)</file>")) do |match| new_filename = $1.gsub("\\", "/") "<file>#{File.join(prefix, new_filename)}</file>" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rewritepclint-0.0.3 | lib/rewritepclint.rb |