User:AnomieBOT/source/tasks/WikiProjectWorker.pm: Difference between revisions

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: WikiProjectWorker: * Done!
AnomieBOT (talk | contribs)
Updating published sources: WikiProjectWorker: * Fixing typo
Line 37:
### Increment this number every time a new run is started, so we don't have to
### mess around with deleting previous runs' database entries.
my $seq=1112;
 
### How to find the pages?
my @cats=(
'Category:Biography articles with more than one work group needing priority parameter replacement',
);
my @iterators=(
{
generator => 'categorymemberslinks',
gcmtitletitles => [@cats]'User:Anomie/Sandbox3',
gcmlimitgpllimit => '100',
},
);
Line 89 ⟶ 88:
'royalty-work-group' => 'royalty-priority',
's&a-work-group' => 's&a-priority',
'sportsports-work-group' => 'sportsports-priority',
);
my %wg2=(reverse %wg);
 
 
sub new {
Line 110 ⟶ 111:
 
sub approved {
return -1;
}
 
Line 279 ⟶ 280:
my $wikitext=shift;
my $new=shift;
return undef'' if $new;
 
my $prio=undef;
Line 285 ⟶ 286:
foreach my $p (@$params){
$prio=$1 if $p=~/^\s*priority\s*=\s*(\S.*?)\s*$/;
$prio=$1 if $p=~/^\s*(?:a&e|filmbio|musician|military|peerage|politician|royalty|s&a)-priority\s*=\s*(\S.*?)\s*$/;
$imp=$1 if $p=~/^\s*importance\s*=\s*(\S.*?)\s*$/;
}
Line 290 ⟶ 292:
return $wikitext unless defined($prio);
my @pp=();
my $ct=0;
my $any=0;
foreach my $p (@$params){
next if $p=~/^\s*(?:priority|importance)\s*=/;
Line 295 ⟶ 299:
push @pp, $1;
push @pp, $wg{$2}.'='.$prio.$3;
$ct++;
$any=1 if $1=~/sports-work-group/;
} elsif($p=~/^(\s*([^=]*?)\s*=\s*+(?!(?i)no|n|0|$|¬).*?)(\s*)$/ && exists($wg2{$2})){
# skip
} else {
push @pp, $p;
}
}
return $wikitext unless($any && $ct>=2);
$params=\@pp;