mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-25 04:02:37 +01:00
Factoids: restore select_indefinite_article to $variable expansion
This commit is contained in:
parent
fb461b6773
commit
d81482a5c5
@ -692,7 +692,13 @@ sub expand_factoid_selectors {
|
|||||||
if ($result =~ s/\b(a|an)(\s+)$//i) {
|
if ($result =~ s/\b(a|an)(\s+)$//i) {
|
||||||
my ($article, $trailing) = ($1, $2);
|
my ($article, $trailing) = ($1, $2);
|
||||||
my $fixed_article = select_indefinite_article $item;
|
my $fixed_article = select_indefinite_article $item;
|
||||||
$fixed_article = ucfirst $fixed_article if $article =~ m/^A/;
|
|
||||||
|
if ($article eq 'A' or $article eq 'AN') {
|
||||||
|
$fixed_article = uc $fixed_article;
|
||||||
|
} elsif ($article eq 'An') {
|
||||||
|
$fixed_article = ucfirst $fixed_article;
|
||||||
|
}
|
||||||
|
|
||||||
$item = $fixed_article . $trailing . $item;
|
$item = $fixed_article . $trailing . $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,9 +816,6 @@ sub expand_factoid_vars {
|
|||||||
push @replacements, scalar $self->select_item($context, join ('|', @list), \$rest, %opts);
|
push @replacements, scalar $self->select_item($context, join ('|', @list), \$rest, %opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $replacement (@replacements) {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wantarray) {
|
if (wantarray) {
|
||||||
return @replacements;
|
return @replacements;
|
||||||
}
|
}
|
||||||
@ -823,7 +826,21 @@ sub expand_factoid_vars {
|
|||||||
$result =~ s/\s+$//;
|
$result =~ s/\s+$//;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($result =~ s/\b(a|an)(\s+)$//i) {
|
||||||
|
my ($article, $trailing) = ($1, $2);
|
||||||
|
my $fixed_article = select_indefinite_article $replacement;
|
||||||
|
|
||||||
|
if ($article eq 'A' or $article eq 'AN') {
|
||||||
|
$fixed_article = uc $fixed_article;
|
||||||
|
} elsif ($article eq 'An') {
|
||||||
|
$fixed_article = ucfirst $fixed_article;
|
||||||
|
}
|
||||||
|
|
||||||
|
$replacement = $fixed_article . $trailing . $replacement;
|
||||||
|
}
|
||||||
|
|
||||||
$result .= $replacement;
|
$result .= $replacement;
|
||||||
|
|
||||||
$expansions++;
|
$expansions++;
|
||||||
} else {
|
} else {
|
||||||
$result .= $extract_method eq 'bracket' ? '${' . $var . '}' : '$' . $var;
|
$result .= $extract_method eq 'bracket' ? '${' . $var . '}' : '$' . $var;
|
||||||
|
Loading…
Reference in New Issue
Block a user