Created
October 18, 2010 11:29
-
-
Save Achillefs/632065 to your computer and use it in GitHub Desktop.
Add newlines to long ass XML files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dir[File.join(%w[test fixtures files *.xml])].each do |file| | |
xml = File.read(file) | |
matches = xml.scan("\n") | |
if !matches or matches.size < 3 | |
puts "#{file}: Not enough line brakes, adding them now..." | |
File.open(file,"w") do |f| | |
f.puts(xml.gsub(/(<[^\/]*>)/,"\n\\1")) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment