git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tools: preserve make errors, ignore empty output
[sheet.git]
/
charset.plp
diff --git
a/charset.plp
b/charset.plp
index 7f19bc183e6fb02abd1d91622041cf7f75479905..0dd153745b354e7b8c5c0d99380e70d991a04a52 100644
(file)
--- a/
charset.plp
+++ b/
charset.plp
@@
-5,7
+5,7
@@
my @tablist = split m{/+}, $Request || 'default';
Html({
title => 'charset cheat sheet',
Html({
title => 'charset cheat sheet',
- version => '1.
0
',
+ version => '1.
1
',
description => [
"Reference sheet with all glyphs in common character encoding tables,",
"and an overview of Unicode ranges and UTF-8 bytes.",
description => [
"Reference sheet with all glyphs in common character encoding tables,",
"and an overview of Unicode ranges and UTF-8 bytes.",
@@
-36,18
+36,10
@@
else {
say "Charset comparison:";
}
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 {
print join " •\n", (
map {
join " ·\n", pairmap {
-
option
link($b || ucfirst $a, '/charset'.($a && "/$a?compare"), $a eq $Request);
+
show
link($b || ucfirst $a, '/charset'.($a && "/$a?compare"), $a eq $Request);
} @{$_}
}
[
} @{$_}
}
[
@@
-147,12
+139,14
@@
sub tabinput {
eval { $charset->{setup}->(\%row) }
or Alert("Incomplete setup of $input", $@);
}
eval { $charset->{setup}->(\%row) }
or Alert("Incomplete setup of $input", $@);
}
+ $row{endpoint} ||= 0xFF;
- if ($row{set}) {}
+ if (defined $row{table} or defined $row{cell}) {
+ $row{set} //= $input;
+ }
elsif ($row{set} = Encode::resolve_alias($input)) {
$row{offset} = delete $row{startpoint};
elsif ($row{set} = Encode::resolve_alias($input)) {
$row{offset} = delete $row{startpoint};
- $row{endpoint} ||= 0xFF;
- if ($row{set} eq 'MacHebrew' or $row{set} eq 'MacThai') {
+ if ($charset->{varchar}) {
# array of possibly multiple characters per code point
$row{table} = [
map { Encode::decode($row{set}, pack 'C*', $_) } $row{offset} .. $row{endpoint}
# array of possibly multiple characters per code point
$row{table} = [
map { Encode::decode($row{set}, pack 'C*', $_) } $row{offset} .. $row{endpoint}
@@
-165,9
+159,7
@@
sub tabinput {
}
$row{endpoint} -= $row{offset};
}
$row{endpoint} -= $row{offset};
-
- $visible->{ascii} = # assume common base
- $visible->{ $row{set} } = 1;
+ $visible->{ascii}++; # assume common base
}
else {
Alert("Encoding <q>$input</q> unknown");
}
else {
Alert("Encoding <q>$input</q> unknown");
@@
-178,6
+170,12
@@
sub tabinput {
while (my ($offset, $sub) = each %{$replace}) {
$offset -= $row{offset};
while (my ($offset, $sub) = each %{$replace}) {
$offset -= $row{offset};
+ if (ref $row{table} eq 'ARRAY') {
+ $row{table}->[$offset] = $sub
+ if $offset >= 0 and $offset <= $row{endpoint};
+ next;
+ }
+
my $length = length $sub;
if ($offset < 0) {
my $length = length $sub;
if ($offset < 0) {
@@
-200,6
+198,7
@@
sub tabinput {
}
push @request, \%row;
}
push @request, \%row;
+ $visible->{ $row{set} } = 1 if $row{table};
}
tabinput($_) for @tablist;
}
tabinput($_) for @tablist;
@@
-323,7
+322,7
@@
for my $row (@request) {
my $cp = $offset + $row->{offset};
my $glyph = ref $row->{table} eq 'ARRAY' ? $row->{table}->[$offset] :
substr $row->{table}, $offset, 1;
my $cp = $offset + $row->{offset};
my $glyph = ref $row->{table} eq 'ARRAY' ? $row->{table}->[$offset] :
substr $row->{table}, $offset, 1;
- my ($cell, $name, $class) = $glyph eq $NOCHAR ? () :
+ my ($cell, $name, $class) =
!defined $glyph ||
$glyph eq $NOCHAR ? () :
$glyphs->glyph_html($glyph);
if ($mode) {
$glyphs->glyph_html($glyph);
if ($mode) {