From b93feea4a4cd9bb503465ead1b73f89b8f36d429 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sun, 23 Apr 2017 02:55:49 +0200 Subject: [PATCH] charset: move html link function to common include --- charset.plp | 10 +--------- common.inc.plp | 8 ++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/charset.plp b/charset.plp index 8e67c67..726ca7c 100644 --- a/charset.plp +++ b/charset.plp @@ -36,18 +36,10 @@ else { say "Charset comparison:"; } -sub optionlink { - my ($title, $href, $selected) = @_; - return sprintf( - $selected ? '%s' : '%s', - 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); } @{$_} } [ diff --git a/common.inc.plp b/common.inc.plp index 31c2c22..bfeb244 100644 --- a/common.inc.plp +++ b/common.inc.plp @@ -166,3 +166,11 @@ EOT }; } +sub showlink { + my ($title, $href, $selected) = @_; + return sprintf( + $selected ? '%s' : '%s', + EscapeHTML($title), EscapeHTML($href) + ); +} + -- 2.30.0