Skip to content

Instantly share code, notes, and snippets.

@arzumy
Created August 25, 2010 02:36
Show Gist options
  • Save arzumy/548735 to your computer and use it in GitHub Desktop.
Save arzumy/548735 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Textmate bundle command to change HTML attr to symbol
# I normally use this when working with html files from designer
# so line like this id="logo" class="left" converted to , :id => "logo", :class => "left"
def to_options(str)
str.gsub(/((\s|^)(\w+))(=)/i) {|v| ", :#{$3} #{$4}> "}
end
print to_options(STDIN.read)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment