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

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: WikiProjectWorker: * Run complete.
AnomieBOT (talk | contribs)
Updating published sources: WikiProjectWorker: * Start run for WikiProject Women scientists.
Line 36:
### 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=2324;
 
### How to find the pages?
my @cats=(
'Category:Basque16th-century women writersscientists',
'Category:Communist17th-century women writersscientists',
'Category:Women18th-century lexicographerswomen scientists',
'Category:Women19th-century musicwomen writersscientists',
'Category:NorwegianAmerican womenfemale novelistsgeologists',
'Category:WomenAmerican screenwriterswomen scientists',
'Category:BritishAmerican women screenwriterssocial scientists',
'Category:FrenchAustralian womenfemale screenwritersgeologists',
'Category:Australian women screenwritersscientists',
'Category:CanadianAustrian women screenwritersscientists',
'Category:GermanBelgian women screenwritersscientists',
'Category:NorwegianBrazilian womenfemale novelistsgeologists',
'Category:NorwegianBrazilian women poetsscientists',
'Category:WomenBritish musicfemale writersgeologists',
'Category:NamibianBritish women writersscientists',
'Category:CentralBulgarian Africanfemale Republic writersgeologists',
'Category:SwaziBurmese womenfemale writersgeologists',
'Category:GaboneseCanadian womenfemale writersgeologists',
'Category:EquatoguineanCanadian women writersscientists',
'Category:AustralianChinese womenfemale short story writersgeologists',
'Category:CanadianChinese women short story writersscientists',
'Category:FrenchDanish womenfemale short story writersgeologists',
'Category:GermanDanish women short story writersscientists',
'Category:NigerienDutch women writersscientists',
'Category:SpanishEgyptian womenfemale short story writersgeologists',
'Category:EthiopianEnglish womenfemale writersgeologists',
'Category:VanuatuanEthiopian women writersscientists',
'Category:FijianFemale womenFellows writersof the Royal Society',
'Category:NauruanFemale women writersgeologists',
'Category:Papua New GuineanFilipino women writersscientists',
'Category:CapeFrench Verdeanfemale women writersgeologists',
'Category:JordanianFrench women writersscientists',
'Category:KuwaitiGerman womenfemale writersgeologists',
'Category:GalicianGerman women writersscientists',
'Category:TogoleseHarvard women writersComputers',
'Category:KuwaitiImperial Russian women novelistsscientists',
'Category:FlemishIndian womenfemale writersgeologists',
'Category:MontenegrinIndian women writersscientists',
'Category:Iranian women scientists',
'Category:Iraqi women scientists',
'Category:Irish female geologists',
'Category:Irish women scientists',
'Category:Israeli female geologists',
'Category:Israeli women scientists',
'Category:Italian female geologists',
'Category:Italian women scientists',
'Category:Japanese female geologists',
'Category:Kazakhstani women scientists',
'Category:Lebanese women scientists',
'Category:Lists of women scientists',
'Category:L\'Oréal-UNESCO Awards for Women in Science laureates',
'Category:Malaysian women scientists',
'Category:Mexican women scientists',
'Category:New Zealand women scientists',
'Category:Nigerian female geologists',
'Category:Norwegian women scientists',
'Category:Peruvian women scientists',
'Category:Polish female geologists',
'Category:Polish women scientists',
'Category:Portuguese women scientists',
'Category:Recipients of the Garvan–Olin Medal',
'Category:Romanian female geologists',
'Category:Romanian women scientists',
'Category:Russian female geologists',
'Category:Russian women scientists',
'Category:Scottish female geologists',
'Category:Senegalese women scientists',
'Category:South African female geologists',
'Category:Swedish female geologists',
'Category:Swedish women scientists',
'Category:Tunisian women scientists',
'Category:Women agronomists',
'Category:Women anatomists',
'Category:Women anthropologists',
'Category:Women archaeologists',
'Category:Women astronomers',
'Category:Women atmospheric scientists',
'Category:Women biochemists',
'Category:Women bioengineers',
'Category:Women biologists',
'Category:Women biophysicists',
'Category:Women biotechnologists',
'Category:Women botanists',
'Category:Women bryologists',
'Category:Women chemists',
'Category:Women cognitive scientists',
'Category:Women computer scientists',
'Category:Women cyberneticists',
'Category:Women earth scientists',
'Category:Women ecologists',
'Category:Women economists',
'Category:Women entomologists',
'Category:Women ethnologists',
'Category:Women ethologists',
'Category:Women evolutionary biologists',
'Category:Women food scientists',
'Category:Women forensic scientists',
'Category:Women geneticists',
'Category:Women geographers',
'Category:Women horticulturists and gardeners',
'Category:Women linguists',
'Category:Women mammalogists',
'Category:Women marine biologists',
'Category:Women materials scientists and engineers',
'Category:Women mathematicians',
'Category:Women medical researchers',
'Category:Women meteorologists',
'Category:Women microbiologists',
'Category:Women molecular biologists',
'Category:Women mycologists',
'Category:Women naturalists',
'Category:Women neuroscientists',
'Category:Women oceanographers',
'Category:Women paleontologists',
'Category:Women parasitologists',
'Category:Women pathologists',
'Category:Women pharmacologists',
'Category:Women phycologists',
'Category:Women physicists',
'Category:Women physiologists',
'Category:Women phytopathologists',
'Category:Women planktologists',
'Category:Women political scientists',
'Category:Women primatologists',
'Category:Women psychologists',
'Category:Women rocket scientists',
'Category:Women scientists',
'Category:Women sexologists',
'Category:Women social scientists',
'Category:Women sociologists',
'Category:Women systems scientists',
'Category:Women taxonomists',
'Category:Women virologists',
'Category:Women zoologists',
);
my @iterators=(
Line 107 ⟶ 203:
 
# Banner configurations.
my $main_banner='WikiProject Women writersscientists';
my @preprocess_templates=();
my %banner_cfgs=(
'WikiProject Women writersscientists' => {
meta => 1,
canonicalize => 'WikiProject Women writersscientists',
},
);
 
my @bio_wg = (
's&a-work-group',
);
 
Line 138 ⟶ 238:
 
sub approved {
return -1;
}
 
Line 270 ⟶ 370:
my @merge=();
my @summary=();
my $no_summary = 0;
 
if(@preprocess_templates){
Line 294 ⟶ 395:
$merge[-1]='and '.$merge[-1] if @merge>1;
push @summary, "merging ".join((@merge>2)?', ':' ', @merge)." into $main_banner" if @merge;
$no_summary = 1 if @merge;
} else {
# $api->warn("$title contains ".$iter->iterval.", but not in section 0\n");
next;
}
}
 
if ( @bio_wg ) {
my %added_wg=();
(undef,$outtxt)=$api->WPBcheck($outtxt, sub {
my $banner=shift;
my $name=shift;
my $oname=shift;
my $params=shift;
my $wikitext=shift;
 
my %have = ();
foreach ($api->process_paramlist(@$params)) {
$have{$_->{'name'}} = 1;
}
my $any = 0;
foreach my $p (@bio_wg){
next if exists($have{$p});
push @$params, "$p=yes";
$added_wg{"$p=yes"}=1;
$any = 1;
}
return undef unless $any;
 
my $out="{{$oname";
$out.="|".join("|", @$params) if @$params;
$out.="}}";
return $out;
}, 'WikiProject Biography');
if(ref($outtxt) eq 'HASH'){
$api->warn("WPBIO workgroups in $title failed: ".$outtxt->{'error'}."\n");
next;
}
if(%added_wg){
my @added_wg = keys %added_wg;
$added_wg[-1]='and '.$added_wg[-1] if @added_wg>1;
push @summary, "added " . join((@added_wg>2)?', ':' ', @added_wg) . " to {{WikiProject Biography}}";
}
}
Line 333 ⟶ 473:
next unless $p=~/^(.+?)=(.*)$/;
my ($k,$v)=($1,$2);
my $re=qr/\S.*?/;
unless(grep(/^\s*\Q$k\E\s*=\s*$re\s*$/, @$params)){
next if(grep(/^\s*\Q$k\E\s*=\s*(?i:\Q$v\E)\s*$/s, @$params));
Line 367 ⟶ 507:
next;
}
push @summary, "Tagging with {{$main_banner}}" unless @summary$no_summary;
 
$outtxt=$api->replace_nowiki($outtxt, $nowiki);