Created
February 17, 2012 11:05
-
-
Save mlopes/1852698 to your computer and use it in GitHub Desktop.
Convert wordpress plugin vipers quicktags youtube tags to octopress youtube tags
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
#!/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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The resulting tags are on the format understood by this Jekyll plugin:
https://gist.github.com/1369801