Skip to content

Instantly share code, notes, and snippets.

@mlopes
Created February 17, 2012 11:05
Show Gist options
  • Save mlopes/1852698 to your computer and use it in GitHub Desktop.
Save mlopes/1852698 to your computer and use it in GitHub Desktop.
Convert wordpress plugin vipers quicktags youtube tags to octopress youtube tags
#!/usr/bin/perl
use strict;
my $script_name = $ARGV[0];
my $file_contents = "";
while(<>) {
if($_ =~ /\[youtube\](.*)\[\/youtube\]/) {
if($1 =~ /[\?&]v=([^&]+).*/) {
$file_contents .= '{% youtube ' . $1 . ' %}' . "\n";
}
} else {
$file_contents .= $_;
}
}
open FILE, ">" . $script_name;
print FILE $file_contents;
close FILE;
@mlopes
Copy link
Author

mlopes commented Feb 17, 2012

The resulting tags are on the format understood by this Jekyll plugin:

https://gist.github.com/1369801

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment