added fontconfig support.
[swftools.git] / doc / codebeautifier.pl
blob8ecfc29f325beea1fd09fceca12afa0905e42718
1 while(<stdin>)
3 if(/\[CALLPERL .*left\]/ ... /\[CALLPERL end\]/) {
4 $code .= $_ if(!/CALLPERL/);
5 $name = $1 if(/.flash.*name=([^&][^ ]*)/);
6 $name = $1 if(/.flash.*name=&quot;([^&]*)&quot;/);
7 chomp $name;
8 }
9 elsif(/\[CALLPERL .*right\]/ ... /\[CALLPERL end\]/) {
10 $highlight .= $_ if(!/CALLPERL/);
12 elsif ($code ne "") {
13 $code =~ s/&quot;/"/g;
15 # print stderr "Warning: ttf->swf\n" if($code =~ s/Arial.ttf/Arial.swf/g);
17 open(fi, ">tmp.sc");print fi $code;close(fi);
18 print stderr "swfc tmp.sc ($name)\n";
19 system("../src/swfc tmp.sc >&2");
20 ($embed = `swfdump -e $name`) =~ /WIDTH="([^"]*)"/;
21 system("cp $name data");
22 $width = $1;
23 print "<td bgcolor=\"#ffffff\" width=\"$width\">";
24 print $embed;
25 print "</td>";
26 $code="";
27 print;
28 unlink "tmp.sc";
30 elsif ($highlight ne "") {
31 $highlight =~ s/^\n\s*//g;
32 $highlight =~ s/\s*\n$//g;
33 print "<pre>\n";
34 # todo: apply syntax highlighting.
35 print $highlight."\n";
36 print "</pre>\n";
37 $highlight="";
38 print;
40 else {
41 print;