diff options
author | Célestin Matte <celestin.matte@ensimag.fr> | 2013-06-14 15:50:14 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-06-14 09:02:16 -0700 |
commit | 81f6a7a43d8c0b1310ffc2df6f9e8d607799249c (patch) | |
tree | 97a92d4e17a047aa90b9a7e29914b611eb02ffa0 /contrib/mw-to-git | |
parent | 0afd29e2d353e58cad5b7ad90705e829d5815d45 (diff) | |
download | git-81f6a7a43d8c0b1310ffc2df6f9e8d607799249c.tar.gz git-81f6a7a43d8c0b1310ffc2df6f9e8d607799249c.tar.xz |
git-remote-mediawiki: change syntax of map calls
Put first parameter of map inside a block, for better readability.
Follow BuiltinFunctions::RequireBlockMap
Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/mw-to-git')
-rwxr-xr-x | contrib/mw-to-git/git-remote-mediawiki.perl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl index aa526b700..3d1a324cf 100755 --- a/contrib/mw-to-git/git-remote-mediawiki.perl +++ b/contrib/mw-to-git/git-remote-mediawiki.perl @@ -371,7 +371,7 @@ sub get_all_mediafiles { sub get_linked_mediafiles { my $pages = shift; - my @titles = map $_->{title}, values(%{$pages}); + my @titles = map { $_->{title} } values(%{$pages}); # The query is split in small batches because of the MW API limit of # the number of links to be returned (500 links max). @@ -399,11 +399,13 @@ sub get_linked_mediafiles { while (my ($id, $page) = each(%{$result->{query}->{pages}})) { my @media_titles; if (defined($page->{links})) { - my @link_titles = map $_->{title}, @{$page->{links}}; + my @link_titles + = map { $_->{title} } @{$page->{links}}; push(@media_titles, @link_titles); } if (defined($page->{images})) { - my @image_titles = map $_->{title}, @{$page->{images}}; + my @image_titles + = map { $_->{title} } @{$page->{images}}; push(@media_titles, @image_titles); } if (@media_titles) { @@ -833,7 +835,7 @@ sub mw_import_ref_by_pages { my ($n, @revisions) = fetch_mw_revisions(\@pages, $fetch_from); @revisions = sort {$a->{revid} <=> $b->{revid}} @revisions; - my @revision_ids = map $_->{revid}, @revisions; + my @revision_ids = map { $_->{revid} } @revisions; return mw_import_revids($fetch_from, \@revision_ids, \%pages_hash); } @@ -1246,8 +1248,8 @@ sub get_allowed_file_extensions { siprop => 'fileextensions' }; my $result = $mediawiki->api($query); - my @file_extensions= map $_->{ext},@{$result->{query}->{fileextensions}}; - my %hashFile = map {$_ => 1}@file_extensions; + my @file_extensions = map { $_->{ext}} @{$result->{query}->{fileextensions}}; + my %hashFile = map { $_ => 1 } @file_extensions; return %hashFile; } |