mirror of
https://github.com/pragma-/pbot.git
synced 2025-10-15 15:37:22 +02:00
Factoids: add quick-and-dirty early version of :join() modifier with many broken edge cases
This commit is contained in:
parent
128c3014c7
commit
20febe7ccd
@ -467,6 +467,10 @@ sub select_item {
|
|||||||
$settings{'trailing-punct'} = $1;
|
$settings{'trailing-punct'} = $1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($mod =~ /^join\((.?)\)$/) {
|
||||||
|
$settings{'join'} = $1;
|
||||||
|
}
|
||||||
|
|
||||||
if ($mod eq 'comma') {
|
if ($mod eq 'comma') {
|
||||||
$settings{'comma'} = 1;
|
$settings{'comma'} = 1;
|
||||||
next;
|
next;
|
||||||
@ -570,7 +574,10 @@ sub select_item {
|
|||||||
|
|
||||||
return @choices if wantarray;
|
return @choices if wantarray;
|
||||||
|
|
||||||
if ($settings{'enumerate'} or $settings{'comma'}) {
|
if (exists $settings{'join'}) {
|
||||||
|
my $sep = $settings{'join'};
|
||||||
|
$item = join $sep, @choices;
|
||||||
|
} elsif ($settings{'enumerate'} or $settings{'comma'}) {
|
||||||
$item = join ', ', @choices;
|
$item = join ', ', @choices;
|
||||||
$item =~ s/(.*), /$1 and / if $settings{'enumerate'};
|
$item =~ s/(.*), /$1 and / if $settings{'enumerate'};
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user