Created
April 27, 2010 19:37
-
-
Save netshade/381195 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env ruby | |
file_path = ARGV[0] || 'go4_global_sub_navigation.html' | |
raise "#{file_path} does not exist, please specify which file you want to alter the navgo4_t_* on" unless File.exists?(file_path) | |
contents = File.read(file_path) | |
contents.gsub!(/<a(.+?)href\s*=\s*(['"].+?\?)navgo4_t_(.+?)(['"][^>]*)>(.+?)<\/a>/i) { |match| "<a href=#{$1}navgo4_t_#{$4.downcase.split(" ").join("_")}#{$3}>#{$4}</a>" } | |
wr = File.new(file_path, "w+") | |
wr.write(contents) | |
wr.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment