Created
October 29, 2011 15:59
-
-
Save asiamoth/1324690 to your computer and use it in GitHub Desktop.
YouTube の新「埋め込みコード」を XHTML と HTML5 で Valid にする!
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; | |
use warnings; | |
use Tkx qw( clipboard ); | |
my $text = Tkx::clipboard('get'); | |
# http://d.hatena.ne.jp/unau/20100121/1264073552 | |
my $DOUBLE_QUOTED = qr{ \" ( [^ \" ]* ) \" }msx; | |
$text =~ s{ <iframe \s+ | |
width = $DOUBLE_QUOTED \s+ | |
height= $DOUBLE_QUOTED \s+ | |
src = $DOUBLE_QUOTED \s+ [^>]+ > | |
</iframe> | |
} | |
{<object width="$1" height="$2" data="$3?wmode=transparent" type="text/html"> | |
\n</object>\n}msxgo; | |
Tkx::clipboard( 'append', $text ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment