User:Monkbot/Task 4: CS1 deprecated coauthor parameters

Monkbot task 4 is a variant of the task 2 script. Like task 2, it is intended to pluck some of the low hanging fruit from Category:Pages containing cite templates with deprecated parameters.

This script replaces the deprecated Citation Style 1 parameters |coauthor= and |coauthors= (hereafter |coauthor=) with individual |authorn= parameters where n is a number 2–10. Task 4 operates on CS1 citations that have |coauthor= parameters that are lists of comma separated names where the names are in last-name-first order.

Generally names in the |coauthor= parameter must have this form:

Last, First Middle Middle
where First and Middle may be initials and may be followed by a period and where Middle is optional

Because the script cannot discriminate between name lists that are |coauthors=Last, First, Last, First, Last, First and |coauthors=Last, Last, Last, Last, Last, Last, it requires that the first name in the list have the form:

Last, First Middle
Last, First Middle Middle
Last, F
where:
First is a name and least one Middle is required; Middle may be a name or an initial
F is an upper case initial which may be followed by an optional period.

It is presumed that if the first name in the list is in this form, the rest of the names in the list are not just a collection of last names.

The last name in a multiname |coauthor= list may be et al. or may contain et al. when a name is Last, First et al.

When |coauthor= has only a single name, the script uses the same rule as task 2.

Task 4 will not change citations:

  • that have |ref=harv, which includes all {{citation}} templates because {{citation}} sets |ref=harv by default
  • where |coauthor= precedes |last=, |last1=, |author=, or |author1=
  • that contain |lastn= or |authorn= where n is greater than 1

Beyond the exceptions noted in §Ancillary tasks, task 4 does not evaluate, modify, or remove parameter values.