Permalink
Browse files

[htmlify] emit PNG images along with SVG

also change the output directory
  • Loading branch information...
1 parent db1a7dd commit b1b87b7be28462df5993c5dc6ac3b452b8a3772a @moritz moritz committed Aug 2, 2012
Showing with 6 additions and 5 deletions.
  1. +4 −3 htmlify.pl
  2. +2 −2 lib/Perl6/TypeGraph/Viz.pm
View
@@ -65,7 +65,7 @@
sub MAIN($out_dir = 'html', Bool :$debug) {
$*DEBUG = $debug;
- for ('', <type language routine svg>) {
+ for ('', <type language routine images>) {
mkdir "$out_dir/$_" unless "$out_dir/$_".IO ~~ :e;
}
@@ -233,10 +233,11 @@ ($out_dir = 'html', Bool :$debug)
}
sub write-type-graph-images(:$out_dir!) {
- say "Writing type graph images to $out_dir/svg/";
+ say "Writing type graph images to $out_dir/images/";
for $tg.sorted -> $type {
my $viz = Perl6::TypeGraph::Viz.new-for-type($type);
- $viz.to-svg-file("$out_dir/svg/type-graph-{$type}.svg");
+ $viz.to-file("$out_dir/images/type-graph-{$type}.svg", format => 'svg');
+ $viz.to-file("$out_dir/images/type-graph-{$type}.png", format => 'png');
}
}
@@ -67,8 +67,8 @@ class Perl6::TypeGraph::Viz {
spurt $file, self.as-dot;
}
- method to-svg-file ($file) {
- my $pipe = open "dot -Tsvg -o$file", :w, :p;
+ method to-file ($file, :$format = 'svg') {
+ my $pipe = open "dot -T$format -o$file", :w, :p;
$pipe.print: self.as-dot;
close $pipe;
}

0 comments on commit b1b87b7

Please sign in to comment.