keys: drop ascii sign alternatives
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 4 Feb 2015 00:13:14 +0000 (01:13 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 5 Feb 2015 21:46:21 +0000 (22:46 +0100)
Get rid of code complexity for unused feature which can easily be emulated
after downloading (in fact already done by elinks for example, though not as
nicely).  Rather assume Unicode support as it should be.

Shiar_Sheet/KeySigns.pm

index a22a07aa32e73422f0990d0c397c638589f15337..f33b224d10df602e9b1583e3790974f28c50f739 100644 (file)
@@ -4,40 +4,26 @@ use utf8;
 use strict;
 use warnings;
 
-our $VERSION = 'v1.00';
+our $VERSION = 'v1.01';
 
 sub import {
        my $class = shift;
 
-       my $ascii = undef;
-       if (exists $PLP::Script::get{ascii}) {
-               # manual override
-               $ascii = !defined $PLP::Script::get{ascii} || $PLP::Script::get{ascii} !~ /^0*$/;
-       }
-       elsif (defined $ENV{HTTP_ACCEPT_CHARSET}) {
-               $ascii = 1;
-               for (split q{,}, $ENV{HTTP_ACCEPT_CHARSET}) {
-                       $ascii = undef, last if $_ eq '*' or m{utf-?8}i;
-               }
-       }
-
        my %sign = (
-               -ascii => $ascii,
-               charset=> $ascii ? 'us-ascii' : 'utf-8',
-               arg    => $ascii ? '.' : '·',  # described as 'dot'
-               args   => $ascii ? ':' : '⁚',
-               argi   => $ascii ? "'" : '′',
-               argm   => $ascii ? '|' : '↕',
-               motion => $ascii ? '|' : '↕',
-               alias  => $ascii ? 'see: ' : '»',
-               up     => $ascii ? 'up'    : '▲',
-               right  => $ascii ? 'right' : '▶',
-               down   => $ascii ? 'down'  : '▼',
-               left   => $ascii ? 'left'  : '◀',
-               sep    => $ascii ? '*'     : '•',
-               _      => defined $ascii && !$ascii ? "\x{200b}" : '<wbr>',
-                       # use the correct ZWNJ only when unicode is forced on
-                       # default to use unofficial html for best support
+               -ascii => 0,
+               charset=> 'utf-8',
+               arg    => '·',  # described as 'dot'
+               args   => '⁚',
+               argi   => '′',
+               argm   => '↕',
+               motion => '↕',
+               alias  => '»',
+               up     => '▲',
+               right  => '▶',
+               down   => '▼',
+               left   => '◀',
+               sep    => '•',
+               _      => '<wbr>' || "\x{200b}",  # unofficial html, correct ZWNJ character might appear as placeholder
        );
 
        my ($parent) = caller;
@@ -55,12 +41,7 @@ Shiar_Sheet::KeySigns - Common Unicode characters in user-preferred charset
 =head1 SYNOPSIS
 
        use Shiar_Sheet::KeySigns;
-       print "$sign{alias} some$sign{_}thing";  # see: some<wbr>thing
-
-       package PLP::Script;
-       our %get = (ascii => 0);  # user input
-       Shiar_Sheet::KeySigns->import;
-       print "$sign{alias} some$sign{_}thing";  # »some( )thing
+       print "$sign{alias} some$sign{_}thing";  # » some<wbr>thing
 
 =head1 AUTHOR