charset: move html link function to common include
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 23 Apr 2017 00:55:49 +0000 (02:55 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 25 May 2017 20:13:05 +0000 (22:13 +0200)
charset.plp
common.inc.plp

index 8e67c670bf8ad6a8d59b0e94f844a15e3be40947..726ca7c4e7540cf279097cd27105d4040e898824 100644 (file)
@@ -36,18 +36,10 @@ else {
        say "Charset comparison:";
 }
 
-sub optionlink {
-       my ($title, $href, $selected) = @_;
-       return sprintf(
-               $selected ? '<strong>%s</strong>' : '<a href="%2$s">%s</a>',
-               EscapeHTML($title), $href
-       );
-}
-
 print join " •\n", (
        map {
                join " ·\n", pairmap {
-                       optionlink($b || ucfirst $a, '/charset'.($a && "/$a?compare"), $a eq $Request);
+                       showlink($b || ucfirst $a, '/charset'.($a && "/$a?compare"), $a eq $Request);
                } @{$_}
        }
        [
index 31c2c2270b71e209a20cf885fe0363ad623066e6..bfeb2449fc652a29d718e43595899d72e0cfc8bd 100644 (file)
@@ -166,3 +166,11 @@ EOT
        };
 }
 
+sub showlink {
+       my ($title, $href, $selected) = @_;
+       return sprintf(
+               $selected ? '<strong>%s</strong>' : '<a href="%2$s">%s</a>',
+               EscapeHTML($title), EscapeHTML($href)
+       );
+}
+