word: reduce size of parenthesised form part
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 17 Jun 2020 22:24:42 +0000 (00:24 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 20 Oct 2020 20:49:11 +0000 (22:49 +0200)
Syntax for optional elongation as in "rhino(ceros)" or "chimp(anzee)".

word.plp

index 40cc8898cdcd8960cba3cf7df0137975f62592f7..12c90b19720203f6896b4f9fa9c3fee14ccf710b 100644 (file)
--- a/word.plp
+++ b/word.plp
@@ -40,7 +40,9 @@ sub showimg {
        my ($id, $name) = @_;
        my ($imgname) = $name =~ m{^([^/]+)};
        $name =~ s/\w{4} [^aoeuiyc\W] [rl]?+ \K (?= [^aoeuiy\W] [rl]? [aoeuiy] \w)/&shy;/gx;
-       $name =~ s{/(.*)}{ <small>($1)</small>}g;
+       ($name, my @morenames) = split m{/}, $name;
+       $name =~ s{\( ([^/]+) \)}{<small>$1</small>}x;
+       $name .= " <small>($_)</small>" for @morenames;
        my $hidden = $name =~ s/\?$//;
        $name = "<q>$name</q>" if $name =~ s/\?$//;
        $name = "<figcaption>$name</figcaption>";