X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=doc%2Fcodebeautifier.pl;fp=doc%2Fcodebeautifier.pl;h=094c523b216bd4a7222ce69b9587e38454c258c4;hb=c2b431306dc202edd5c7d59cc8ddb784fe66caeb;hp=0000000000000000000000000000000000000000;hpb=a327d407b80932c733bf617d819ce7f054b2e6bb;p=swftools.git diff --git a/doc/codebeautifier.pl b/doc/codebeautifier.pl new file mode 100644 index 0000000..094c523 --- /dev/null +++ b/doc/codebeautifier.pl @@ -0,0 +1,37 @@ +while() +{ + if(/\[CALLPERL .*left\]/ ... /\[CALLPERL end\]/) { + $code .= $_ if(!/CALLPERL/); + $name = $1 if(/.swf.*name=([^&][^ ]*)/); + $name = $1 if(/.swf.*name="([^&]*)"/); + } + elsif(/\[CALLPERL .*right\]/ ... /\[CALLPERL end\]/) { + $highlight .= $_ if(!/CALLPERL/); + } + elsif ($code ne "") { + $code =~ s/"/"/g; + open(fi, ">tmp.sc");print fi $code;close(fi); + system("swfc tmp.sc"); + ($embed = `swfdump -e $name`) =~ /WIDTH="([^"]*)"/; + $width = $1; + print ""; + print $embed; + print ""; + $code=""; + print; + unlink "tmp.sc"; + } + elsif ($highlight ne "") { + $highlight =~ s/^\n\s*//g; + $highlight =~ s/\s*\n$//g; + print "
\n";
+	# todo: apply syntax highlighting.
+	print $highlight."\n";
+	print "
\n"; + $highlight=""; + print; + } + else { + print; + } +}