git.shiar.nl
/
sheet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e1678ab
)
word: identify thumbnail image files by id
author
Mischa POSLAWSKY
<perl@shiar.org>
Mon, 15 Jun 2020 22:51:35 +0000
(
00:51
+0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Tue, 20 Oct 2020 20:49:11 +0000
(22:49 +0200)
word.plp
patch
|
blob
|
history
writer.plp
patch
|
blob
|
history
diff --git
a/word.plp
b/word.plp
index 78e46a573afb3806fc59b39b6512438554345b28..40cc8898cdcd8960cba3cf7df0137975f62592f7 100644
(file)
--- a/
word.plp
+++ b/
word.plp
@@
-37,16
+37,15
@@
Zie ook <a href="/dieren">dieren</a>.
my $table = do $wordlist or die $@ // $!;
sub showimg {
my $table = do $wordlist or die $@ // $!;
sub showimg {
- my ($name) = @_;
- my ($imgname) = $name =~
/^([\w -]+)/
;
+ my ($
id, $
name) = @_;
+ my ($imgname) = $name =~
m{^([^/]+)}
;
$name =~ s/\w{4} [^aoeuiyc\W] [rl]?+ \K (?= [^aoeuiy\W] [rl]? [aoeuiy] \w)/­/gx;
$name =~ s{/(.*)}{ <small>($1)</small>}g;
my $hidden = $name =~ s/\?$//;
$name =~ s/\w{4} [^aoeuiyc\W] [rl]?+ \K (?= [^aoeuiy\W] [rl]? [aoeuiy] \w)/­/gx;
$name =~ s{/(.*)}{ <small>($1)</small>}g;
my $hidden = $name =~ s/\?$//;
- my $alt = $name;
$name = "<q>$name</q>" if $name =~ s/\?$//;
$name = "<figcaption>$name</figcaption>";
$name = "<q>$name</q>" if $name =~ s/\?$//;
$name = "<figcaption>$name</figcaption>";
- if ($i
mgname and -e (my $img = "data/word/en/$imgname
.jpg")) {
+ if ($i
d and -e (my $img = "data/word/en/$id
.jpg")) {
$name .= sprintf '<img src="/%s" alt="%s" />', $img, $imgname;
}
return sprintf '<figure%s>%s</figure>', $hidden && !exists $get{v} && ' hidden', $name;
$name .= sprintf '<img src="/%s" alt="%s" />', $img, $imgname;
}
return sprintf '<figure%s>%s</figure>', $hidden && !exists $get{v} && ' hidden', $name;
@@
-61,7
+60,7
@@
sub printimgs {
push @type, 'large' if $level =~ s/c$//;
push @type, 'level'.($level || 0);
printf '<li%s>', @type ? sprintf ' class="%s"', join ' ', @type : '';
push @type, 'large' if $level =~ s/c$//;
push @type, 'level'.($level || 0);
printf '<li%s>', @type ? sprintf ' class="%s"', join ' ', @type : '';
- print showimg($title) if $level <= $limit;
+ print showimg($
id, $
title) if $level <= $limit;
printimgs(@{$_}) for $table->{$id} // ();
print '</li>';
}
printimgs(@{$_}) for $table->{$id} // ();
print '</li>';
}
diff --git
a/writer.plp
b/writer.plp
index 48ffd6748245eb97cef7245ae14695444eb9b35d..7cbe9e659b78d3e3b68f95fd8c4d7bcb9aa14941 100644
(file)
--- a/
writer.plp
+++ b/
writer.plp
@@
-300,7
+300,7
@@
package Shiar_Sheet::FormRow {
sub imagepath {
my ($row, $col) = @_;
return "data/word/org/$row->{id}.jpg" if $col eq 'source';
sub imagepath {
my ($row, $col) = @_;
return "data/word/org/$row->{id}.jpg" if $col eq 'source';
- return "data/word/en/$row->{
form
}.jpg" if $col eq 'thumb';
+ return "data/word/en/$row->{
id
}.jpg" if $col eq 'thumb';
return;
}
}
return;
}
}