git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
latin: tap code function per cell like dispbar
[sheet.git]
/
writing-latn.inc.pl
diff --git
a/writing-latn.inc.pl
b/writing-latn.inc.pl
index 3aab17a9630c0930d0029b572c32ea39dd6f6af8..59218023b9cce42bc44ffc27c36bab3daef85036 100644
(file)
--- a/
writing-latn.inc.pl
+++ b/
writing-latn.inc.pl
@@
-1,21
+1,24
@@
use 5.014;
use utf8;
use 5.014;
use utf8;
-use List::Util qw( pairs sum );
+use List::Util qw( pairs
pairmap
sum );
my %C = qw(red #EC1C24 blue #3953A3 yellow #F9EC31 black #231F20);
my $U = 0; # optional unicode alternatives
sub disptap {
my %C = qw(red #EC1C24 blue #3953A3 yellow #F9EC31 black #231F20);
my $U = 0; # optional unicode alternatives
sub disptap {
- return map {
- !m/\A(-?)(\d)(\d)/ ? $_ :
- $1.join(' ',
- '·' x $2, '·' x $3,
- );
- } @_;
+ my $code = shift;
+ $code =~ m/\A(-?)(\d)(\d)/ or return $code;
+ return $1 . join(' ', '·' x $2, '·' x $3);
}
sub dispbar {
}
sub dispbar {
- my @cols = split //, shift; # bar and space widths
+ my $code = shift;
+
+ return join '', pairmap {
+ ($a =~ tr/123/❘❙❚/r) . ($b =~ tr/321/ /dr)
+ } split //, $code if $U;
+
+ my @cols = split //, $code; # bar and space widths
my $width = sum(@cols);
return sprintf(
'<svg width="%d" height="%d" viewBox="-.5 0 %d %d"><path d="%s"/></svg>',
my $width = sum(@cols);
return sprintf(
'<svg width="%d" height="%d" viewBox="-.5 0 %d %d"><path d="%s"/></svg>',
@@
-100,14
+103,14
@@
sub dispbar {
.- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. --
-. --- .--. --.- .-. ... - ..- ...- .-- -..- -.-- --..
}],
.- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. --
-. --- .--. --.- .-. ... - ..- ...- .-- -..- -.-- --..
}],
-'Tap code' => [
disptap(
qw{
+'Tap code' => [
map { disptap($_) }
qw{
11 12 13 14 15 21 22 23 > 24 25 31 32
33 34 35 41 42 43 44 45 51 52 53 54 55
11 12 13 14 15 21 22 23 > 24 25 31 32
33 34 35 41 42 43 44 45 51 52 53 54 55
-}
)
],
-'Short Tap' => [
disptap(
qw{
+}],
+'Short Tap' => [
map { disptap($_) }
qw{
11 12 13 14 21 22 23 20 > 31 -13 32 33
30 41 42 -13 43 40 10 51 52 53 50 -31 -40
11 12 13 14 21 22 23 20 > 31 -13 32 33
30 41 42 -13 43 40 10 51 52 53 50 -31 -40
-}
)
],
+}],
'Cards' => [(
map { chr(0x1F0A0 + $_), sprintf('<b>%s</b>', chr(0x1F0B0 + $_)) } # spades, hearts
1 .. 11, 13, 14 # A 2-10 J Q K
'Cards' => [(
map { chr(0x1F0A0 + $_), sprintf('<b>%s</b>', chr(0x1F0B0 + $_)) } # spades, hearts
1 .. 11, 13, 14 # A 2-10 J Q K