|
|
@ -353,6 +353,7 @@ my $site_query_results = $mw->api |
|
|
|
inprop => 'url', |
|
|
|
inprop => 'url', |
|
|
|
} ) || croak $mw->{error}->{code} . ': ' . $mw->{error}->{details}; |
|
|
|
} ) || croak $mw->{error}->{code} . ': ' . $mw->{error}->{details}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my %site_icon_pages; |
|
|
|
foreach my $site_page_ref (values %{$site_query_results->{query}{pages}}) |
|
|
|
foreach my $site_page_ref (values %{$site_query_results->{query}{pages}}) |
|
|
|
{ |
|
|
|
{ |
|
|
|
next if $site_page_ref->{title} =~ /^Category:/; |
|
|
|
next if $site_page_ref->{title} =~ /^Category:/; |
|
|
@ -372,14 +373,17 @@ foreach my $site_page_ref (values %{$site_query_results->{query}{pages}}) |
|
|
|
next; |
|
|
|
next; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
my $imageinfo_query_results = $mw->api({ action => 'query', |
|
|
|
$site_icon_pages{"File:$parsed_template->{named_params}{icon}"} = |
|
|
|
prop => 'imageinfo', |
|
|
|
$parsed_template->{named_params}{icon}; |
|
|
|
titles => "File:$parsed_template->{named_params}{icon}", |
|
|
|
|
|
|
|
iiprop => 'url' |
|
|
|
# my $imageinfo_query_results = $mw->api({ action => 'query', |
|
|
|
}) || carp $mw->{error}->{code} . ': ' . $mw->{error}->{details}; |
|
|
|
# prop => 'imageinfo', |
|
|
|
my %image_pages = %{$imageinfo_query_results->{query}{pages}}; |
|
|
|
# titles => "File:$parsed_template->{named_params}{icon}", |
|
|
|
my $image_url = (values %image_pages)[0]{imageinfo}[0]{url}; |
|
|
|
# iiprop => 'url' |
|
|
|
$grid->add_image(HexGrid::to_id($parsed_template->{named_params}{icon}), $image_url); |
|
|
|
# }) || carp $mw->{error}->{code} . ': ' . $mw->{error}->{details}; |
|
|
|
|
|
|
|
# my %image_pages = %{$imageinfo_query_results->{query}{pages}}; |
|
|
|
|
|
|
|
# my $image_url = (values %image_pages)[0]{imageinfo}[0]{url}; |
|
|
|
|
|
|
|
# $grid->add_image(HexGrid::to_id($parsed_template->{named_params}{icon}), $image_url); |
|
|
|
|
|
|
|
|
|
|
|
my $pin = HexGrid::Pin->new |
|
|
|
my $pin = HexGrid::Pin->new |
|
|
|
( |
|
|
|
( |
|
|
@ -393,6 +397,26 @@ foreach my $site_page_ref (values %{$site_query_results->{query}{pages}}) |
|
|
|
$tile->pin($pin); |
|
|
|
$tile->pin($pin); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
say STDERR "Getting Site icon image pages"; |
|
|
|
|
|
|
|
my $site_icon_query_results = $mw->api({ action => 'query', |
|
|
|
|
|
|
|
prop => 'imageinfo', |
|
|
|
|
|
|
|
titles => join('|', keys %site_icon_pages), |
|
|
|
|
|
|
|
iiprop => 'url' |
|
|
|
|
|
|
|
}) || carp $mw->{error}->{code} . ': ' . $mw->{error}->{details}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach my $page (values %{$site_icon_query_results->{query}{pages}}) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if($page->{imageinfo}) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
say STDERR "Processing image: $page->{title}"; |
|
|
|
|
|
|
|
$grid->add_image |
|
|
|
|
|
|
|
( |
|
|
|
|
|
|
|
HexGrid::to_id($site_icon_pages{$page->{title}}), |
|
|
|
|
|
|
|
$page->{imageinfo}[0]{url} |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Render and output |
|
|
|
# Render and output |
|
|
|
open (my $fh, "> $outfile") or croak "Couldn't open $outfile for writing: $!"; |
|
|
|
open (my $fh, "> $outfile") or croak "Couldn't open $outfile for writing: $!"; |
|
|
|
say $fh ($html_document ? wrap_in_html($grid) : $grid->render); |
|
|
|
say $fh ($html_document ? wrap_in_html($grid) : $grid->render); |
|
|
|