charset: common check of compare option
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 22 Apr 2017 09:53:14 +0000 (11:53 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 25 May 2017 20:10:24 +0000 (22:10 +0200)
charset.plp

index 1b672e93ebfc091575b912728d32d7660d5fe1ca..d2c92c5378c4227e8917ba419e7d3f2cee6c723d 100644 (file)
@@ -1,5 +1,8 @@
 <(common.inc.plp)><:
 
 <(common.inc.plp)><:
 
+my $mode = exists $get{compare};
+my @tablist = split m{/+}, $Request || 'default';
+
 Html({
        title => 'charset cheat sheet',
        version => '1.0',
 Html({
        title => 'charset cheat sheet',
        version => '1.0',
@@ -18,8 +21,6 @@ Html({
        )],
 });
 
        )],
 });
 
-my @tablist = split m{/+}, $Request || 'default';
-
 use List::Util qw( first pairmap pairfirst pairs );
 
 :>
 use List::Util qw( first pairmap pairfirst pairs );
 
 :>
@@ -404,7 +405,7 @@ for my $row (@request) {
                        my ($cell, $name, $class) = $glyph eq $NOCHAR ? () :
                                $glyphs->glyph_html($glyph);
 
                        my ($cell, $name, $class) = $glyph eq $NOCHAR ? () :
                                $glyphs->glyph_html($glyph);
 
-                       if (exists $get{compare}) {
+                       if ($mode) {
                                state $visible = {};
                                $class = (
                                        $cp == ord $glyph ? 'l4' :
                                state $visible = {};
                                $class = (
                                        $cp == ord $glyph ? 'l4' :
@@ -431,7 +432,7 @@ for my $row (@request) {
 <hr>
 
 <div class="legend">
 <hr>
 
 <div class="legend">
-       <table class="glyphs"><tr><: if (exists $get{compare}) { :>
+       <table class="glyphs"><tr><: if ($mode) { :>
        <td class="X l4">unicode
        <td class="X l3">inherited
        <td class="X l2">existing
        <td class="X l4">unicode
        <td class="X l3">inherited
        <td class="X l2">existing