Initial commit.
This commit is contained in:
14
finalize_export.rb
Normal file
14
finalize_export.rb
Normal file
@ -0,0 +1,14 @@
|
||||
data = STDIN.read
|
||||
|
||||
# Replace the image paths to be accessible in Wordpress.
|
||||
# The new path given here is the path for my case: A multi-site blog. The 1970/01
|
||||
# in the path was determined by setting a date during extract_media.rb.
|
||||
# Upload a file to your media gallery and look at the image url to determine
|
||||
# your correct path.
|
||||
images = data.scan(/(?:src|href)="(\/uploads\/.+?)"/).to_a.map(&:first).uniq
|
||||
|
||||
images.each do |path|
|
||||
data = data.gsub("="#{path}"", "="/wp-content/uploads/sites/5/1970/01/#{File.basename(path)}"")
|
||||
end
|
||||
|
||||
puts data.gsub(/([^>])\n/, "\\1 ")
|
Reference in New Issue
Block a user