Skip to content

Instantly share code, notes, and snippets.

@perlDreamer
Created August 12, 2010 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perlDreamer/520426 to your computer and use it in GitHub Desktop.
Save perlDreamer/520426 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl -lp
##Copy and paste property block to the top of the file.
##Select the properties, and run this filter on it to
##handle bulk reformatting and changes.
##Breaks on options entry.
##Does not handle conditional properties, or builder and lazy methods.
##Only translates i18n for assetName, label, hoverHelp and subtext
BEGIN { $name = shift; }
s/^\s+(\w+)\s*=>\s*{/property $1 => (/;
s/^\s+},?/ );/;
s/\t/ /g;
s/defaultValue/default /;
if (/i18n->get/ && /(?:assetName|label|hoverHelp|subtext)\s*=>/ ) {
s/\$.+\(/[/;
s/\)/, '$name']/;
}
s/^(aspect.+?),\s*$/$1;/;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment