Refactor modality

main
parent 670eec71b2
commit 881bf72342
  1. 43
      wiki-tile.pl

@ -277,36 +277,19 @@ foreach my $site_page_ref (values %{$site_query_results->{query}{pages}})
if($html_document)
open (my $fh, "> $outfile") or croak "Couldn't open $outfile for writing: $!";
say $fh ($html_document ? wrap_in_html($grid) : $grid->render);
close $fh;
if($regiondir)
{
open (my $fh, "> $outfile") or croak "Couldn't open $outfile for writing: $!";
say $fh wrap_in_html($grid);
close $fh;
if($regiondir)
{
chdir $regiondir || croak "Couldn't chdir to $regiondir: $!";
while(my ($region, $region_grid) = each %region_grids)
{
open (my $region_fh, "> $region.html") or croak "Couldn't open $region.html for writing: $!";
say $region_fh wrap_in_html($region_grid);
close $region_fh;
}
}
}
else
{
open (my $fh, "> $outfile") or croak "Couldn't open $outfile for writing: $!";
say $fh $grid->render;
close $fh;
if($regiondir)
chdir $regiondir || croak "Couldn't chdir to $regiondir: $!";
my $extension = $html_document ? 'html' : 'svg';
while(my ($region, $region_grid) = each %region_grids)
{
chdir $regiondir || croak "Couldn't chdir to $regiondir: $!";
while(my ($region, $region_grid) = each %region_grids)
{
open (my $region_fh, "> $region.svg") or croak "Couldn't open $region.svg for writing: $!";
say $region_fh $region_grid->render;
close $region_fh;
}
open (my $region_fh, "> $region.$extension")
or croak "Couldn't open $region.extension for writing: $!";
say $region_fh ($html_document ? wrap_in_html($region_grid) : $region_grid->render);
close $region_fh;
}
}
@ -323,10 +306,6 @@ sub wrap_in_html($grid)
</script>
EOS
$html_builder .= "\n" . $grid->render;
# if ($regiondir)
# {
# $html_builder .= "\n" . $_->render for values %region_grids;
# }
$html_builder .= "\n</body>\n</html>";
return $html_builder;
}

Loading…
Cancel
Save