git.shiar.nl
/
sheet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
be041e9
)
countries: handle (multiple) aliases properly in flag mode
author
Mischa POSLAWSKY
<perl@shiar.org>
Tue, 14 Jul 2015 00:40:35 +0000
(
02:40
+0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Mon, 21 Sep 2015 22:20:08 +0000
(
00:20
+0200)
countries.plp
patch
|
blob
|
history
diff --git
a/countries.plp
b/countries.plp
index 61a4795a688333b3b872e50153e36c929be43b70..18b986073695f91c1c530520bd3dcc4ff6c667c8 100644
(file)
--- a/
countries.plp
+++ b/
countries.plp
@@
-35,16
+35,24
@@
my $cc = do 'countries.inc.pl';
my ($name, $class, $short, $ref) = @$country;
$name .= " → $ref" if $ref;
$ref ||= $code;
my ($name, $class, $short, $ref) = @$country;
$name .= " → $ref" if $ref;
$ref ||= $code;
-
local $_ = $ref
;
+
my $cell
;
if (exists $get{show}) {
if (exists $get{show}) {
- my $img = "data/flag/$ref.png";
- $_ = sprintf '<img src="/%s" alt="%s">', $img, $ref if -e $img;
+ sub showflag {
+ my ($cc) = @_;
+ my $img = "data/flag/$cc.png";
+ return -e $img &&
+ sprintf '<img src="/%s" alt="%s">', $img, $cc;
+ }
+
+ $cell = showflag($code) // join(' ',
+ map { showflag($_) || $_ } split / /, $ref
+ );
}
else {
}
else {
- $
_
= EscapeHTML($short || $name);
+ $
cell
= EscapeHTML($short || $name);
}
printf "\n".'<td class="%s" title="%s">%s',
}
printf "\n".'<td class="%s" title="%s">%s',
- $
_ ? 'X '.$class : '', EscapeHTML("$code: $name"), $_
;
+ $
cell ? 'X '.$class : '', EscapeHTML("$code: $name"), $cell
;
}
print "\n";
}
}
print "\n";
}