digraphs: prefer xorg path over parameter
[sheet.git] / digraphs.plp
index 72af1bee70461fcf10fcf873ba974fae278e65b4..e5003b684e14aff99e2d75c0d41855c11b50daf8 100644 (file)
@@ -1,9 +1,11 @@
 <(common.inc.plp)><:
 use 5.010;  # state
 
+my $mode = ($ENV{PATH_INFO} // '') eq '/xorg' || exists $get{xorg};
+
 Html({
        title => 'digraph cheat sheet',
-       version => 'v1.0',
+       version => '1.1',
        description => [
                "Complete table of digraph characters from RFC-1345.",
        ],
@@ -35,7 +37,7 @@ my $di = do 'digraphs.inc.pl'
 if (exists $get{v}) {
        # show characters for inverted mnemonics (vim alternatives)
        $di->{ substr($_, 1, 1) . substr($_, 0, 1) } ||=
-               [$di->{$_}->[0], '', 'l0 ex']
+               [ $di->{$_}->[0], '', 'l0 ex', '', $di->{$_}->[4] ]
                for grep { ref $di->{$_} } keys %{$di};
 }
 
@@ -49,7 +51,7 @@ my @chars2 = (['_'], @chars);  # trailing character (extended set)
 my @columns = !exists $get{split} ? \@chars2 :
        ([@chars2[0, 1, 3, 4, 6]], [@chars2[2, 5, 7]]);
 
-if (exists $get{xorg}) {
+if ($mode) {
        my $xorg = do 'data/digraphs-xorg.inc.pl'
                or die "Error loading Xorg data: ", $@ // $!;
        $_ = [ord $_] for values %{$xorg};
@@ -124,7 +126,7 @@ print "</table>\n";
 print '<hr>' if exists $get{split};
 }
 
-if (exists $get{xorg}) {
+if ($mode) {
 :>
 <div class="legend">
        <table class="glyphs"><tr>