-my $diinfo = do 'digraphs.inc.pl';
-my %di = map { $diinfo->{$_}->[0] => $_ } grep { ref $diinfo->{$_} }
- keys %$diinfo;
-
-sub quote {
- local $_ = shift;
- s/"/"/g;
- s/</</g;
- s/>/>/g;
- return $_;
-}
-
-sub table {
- my ($width, $digraphs, $rowheads, $colheads) = @_;
-
- my @rows;
-
- my $colspan = 1;
- for my $cell (@$digraphs) {
- my $class;
- if ($cell eq '.') {
- push @rows, '';
- $rows[-1] .= '<th>'.(shift @$rowheads || ' ') if $rowheads;
- next;
- }
- elsif ($cell eq '>') {
- $colspan++;
- next;
- }
-
- my $code = join '', map { $di{ord $_} || '' } split //, $cell;
- my $name = $diinfo->{$code}->[1];
-
- if ($cell =~ s/^-//) {
-# $class = 'Empty';
- }
- elsif ($cell eq '=') {
- $class = 'Reserved';
- $cell = '';
- }
- elsif ($cell =~ /[ -~]/) {
- $class = 'Ascii';
- }
- elsif (not $code) {
- $class = 'DiNone';
- }
- elsif ($diinfo->{$code}->[2] =~ /\bXz\b/) {
- $class = 'DiProp';
- }
- else {
- $class = 'Di';
- }
-
- $rows[-1] .= sprintf('<td%s%s%s>%s%s',
- defined $name ? qq{ title="$name"} : '',
- defined $class ? qq{ class="$class"} : '',
- $colspan > 1 && qq{ colspan="$colspan"},
- $cell eq '' ? ' ' : quote($cell),
- $code ne '' ? sprintf(' <small class="digraph">%s</small>', quote($code))
- : length($cell) == 1 && $cell !~ /[a-z]/
- ? sprintf(' <small class="%s">%04X</small>', 'value', ord $cell)
- : '',
- );
-
- $colspan = 1;
- }
-
- if ($colheads) {
- unshift @rows, sprintf '<thead><tr><td>%s<tbody>', join '',
- map { sprintf '<th title="%2$s">%s', split(/:/, $_, 2), '', '' }
- @$colheads
- }
-
- return sprintf "<table>\n%s</table>\n", join '', map {"<tr>$_\n"} @rows;
-}
-
-print "<h2>Common</h2>\n\n";
-print table(@$_) for (
- [ 3 => [qw{. « » . ‹ › . ‘ ’ . “ ” . „ ‚}]],
- [ 3 => [qw{. † ‡ • . § ¶ # . © ® ™ . − × ÷ . ± ² √}]],
- [ 3 => [qw{. å ä ö ü ß . Å æ ø ű ſ}]],
- [ 3 => [qw{. ¿ ç ñ é ê è}]],
-);
-
-print "<h2>Arrows</h2>\n\n";
-print table(@$_) for (
- [ 4 => [qw{. ↖ ↑ ↗ ↔ . ← - → ↕ . ↙ ↓ ↘ -}]],
- [ 4 => [qw{. ⇖ ⇑ ⇗ ⇔ . ⇐ - ⇒ ⇕ . ⇙ ⇓ ⇘ -}]],
- [ 3 => [qw{. ◤ ▲ ◥ . ◀ ◆ ▶ . ◣ ▼ ◢}]],
- [ 3 => [qw{. ◸ △ ◹ . ◁ ◇ ▷ . ◺ ▽ ◿}]],
-);
-
-print "<h2>Line drawing</h2>\n\n";
-print table(@$_) for (
- [ 4 => [qw{. ┌ ┬ ┐ . ├ ┼ ┤ . └ ┴ ┘}]],
- [ 4 => [qw{. ┏ ┳ ┓ . ┣ ╋ ┫ . ┗ ┻ ┛}]],
- [ 3 => [qw{. ┍ ┯ ┑ . ┝ ┿ ┥ . ┕ ┷ ┙}]],
- [ 3 => [qw{. ┎ ┰ ┒ . ┠ ╂ ┨ . ┖ ┸ ┚}]],
- [ 4 => [qw{
+use Shiar_Sheet::FormatChar;
+my $glyphs = Shiar_Sheet::FormatChar->new;
+
+if (exists $get{di}) {
+ $glyphs->{digraph} = defined $get{di} ? ! !$get{di} : 1;
+ $glyphs->{unicode} = 1;
+}
+if (exists $get{q}) {
+ $glyphs->{unicode} = -1;
+ $glyphs->{digraph}--;
+}
+
+our $verbose = exists $get{v};
+
+$glyphs->print(
+ 'Popular',
+ [qw{. « » . ‹ › . ‘ ’ . “ ” . „ ‚ . ‟ ‛}],
+ [qw{. † ‡ • . § ¶ # . © ® ™ . ° ′ ″ . − × ÷ . ± ² √}],
+ [qw{. ⚋ ⚊ . ⚐ ⚑ . ☺ ☹ . ✓ ✗ . ✔ ✘ }, $verbose ? () : qw{. ◄ ►}],
+ [qw{. å ä ö ü ß . ā æ ø ű ſ}],
+ [qw{
+ . á è õ û ç . ą ı ơ ů þ
+ }],
+ $verbose ? [qw{
+ .>Englisc æ ð ē ȝ œ þ ƿ
+ .>Sámi á č đ ŋ š ŧ ž
+ .>Slavic ą ě ł ů ź ż ž
+ .>Türkçe ç ğ ı İ ö ş ü
+ .>Esperanto ĉ ĝ ĥ ĵ ŝ ŭ
+ }] : (),
+ [qw{. α β}],
+ [qw{. ¿ … 〃 ‐ – . ‽ · ※ ‒ — }],
+
+ 'Symbols',
+ [qw{. ¤ ¢ ₥ € £ ₨ $ ¥ . ฿ ₫ ₭ ₦ ₱ ₮ ₩ ₪}],
+ [qw{. ♠ ♡ ♢ ♣ . ♤ ♥ ♦ ♧}],
+ [qw{. ☮ ☯ ☻ ♪ ♲ ♿ }],
+ [qw{. ✂ ✉ ℻ ☎ ☏}, $verbose ? qw{. 🔞 🔾 🔰 🔮 🕀 } : ()], # communication
+ [qw{. ✊ ✋ ✌ }, $verbose ? qw{. 🖹 🐜 👼 } : ()], # 3-way (RockPaperScissors, TerranProtossZerg)
+ [qw{. ⚠ ☡ ☠}],
+ 'Signs',
+ [qw{. ☉ ☿ ♀ ♁ ♂ ♃ ♄ ♅ ♆ ♇}], # solar
+ [qw{
+ . ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓
+ }, !$verbose ? () : qw{
+ . 寅 卯 辰 巳 午 未 申 酉 戌 亥 子 丑
+ . 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬 鼠 牛
+ . 🐅 🐇 🐉 🐍 🐎 🐐 🐒 🐓 🐕 🐖 🐀 🐂
+ }], # zodiac
+
+ 'Key commands',
+ [qw{. ⇥ ⇤ . ␣ ⌫ }], # common spacing
+ [qw{. ⎀ ⇱ ⇞ . ⌦ ⇲ ⇟ }], # edit block
+ [qw{. ⇪ ⇯ ⇭ . ⇧ ⇮ № }], # modifier
+ [qw{. ⎈ ⌥ ⌘ ⎄ }], [qw{. ↵ ⎋ ⎉ ⎊ }], # command
+$verbose ? (
+ [qw{. ► ⏩ ⏭ ◼ ⚫ . ◄ ⏪ ⏮ ⏏ -❚❚ }], # player ui
+) : (),
+
+ 'Arrows',
+ [qw{. ↖ ↑ ↗ ↔ . ← - → ↕ . ↙ ↓ ↘ -}],
+ [qw{. ⇖ ⇑ ⇗ ⇔ . ⇐ - ⇒ ⇕ . ⇙ ⇓ ⇘ -}],
+ [qw{. ⬁ ⇧ ⬀ ⬄ . ⇦ - ⇨ ⇳ . ⬃ ⇩ ⬂ -}],
+ [qw{. ⬉ ⬆ ⬈ ⬌ . ⬅ - ➡ ⬍ . ⬋ ⬇ ⬊ -}],
+ [qw{. ◩ ⬒ ⬔ . ◧ □ ◨ . ⬕ ⬓ ◪ }],
+ [qw{. ◤ ▲ ◥ . ◀ ◆ ▶ . ◣ ▼ ◢ }],
+ [qw{. ◸ △ ◹ . ◁ ◇ ▷ . ◺ ▽ ◿ }],
+$verbose ? (
+ [qw{. . - . }],
+ [qw{. . - . }],
+) : (),
+
+ 'Line drawing',
+ [qw{. ╔ ╦ ╗ ═ . ╠ ╬ ╣ ║ . ╚ ╩ ╝ - }],
+ [qw{. ╒ ╤ ╕ . ╞ ╪ ╡ . ╘ ╧ ╛ }],
+ [qw{. ╓ ╥ ╖ . ╟ ╫ ╢ . ╙ ╨ ╜ }],
+ [qw{. ┌ ┬ ┐ . ├ ┼ ┤ . └ ┴ ┘}],
+ [qw{. ┏ ┳ ┓ . ┣ ╋ ┫ . ┗ ┻ ┛}],
+ [qw{. ┍ ┯ ┑ . ┝ ┿ ┥ . ┕ ┷ ┙}],
+ [qw{. ┎ ┰ ┒ . ┠ ╂ ┨ . ┖ ┸ ┚}],
+ [qw{