User:Monkbot/Task 3: CS1 deprecated coauthor parameters

Monkbot task 3 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 3 operates on CS1 citations that have |coauthor= parameters that are lists of names that roughly follow the Vancouver system.

In general, author lists in Vancouver system citations have the form: Last FM, Last FM, etc. where Last is the author's last name and where F and M are the author's first and middle initials. Task 3 supports author names with 1–3 initials which must be upper case. Author names are separated by <opt space><comma><opt space>. The last name in the |coauthor= list may be separated from the other names with <opt space><comma><opt space><'and' or '&'><opt space>. Task 3 recognizes this form and the corrupted forms: Last F M, Last F. M., Last F.M. along with other space/period/initial variants.

The last name in a multiname |coauthor= parameter may be et al.

When |coauthor= has only a single name, the Vancouver system restrictions do not apply. Uses the same rule as task 2.

Task 3 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 3 does not evaluate, modify, or remove parameter values.

revisions
revision description
initial release;
a Added ability to fix single wikilinked |coauthor= with these forms:
[[<author name>]]
[[<article name>|<author name>]]
[[<article name>{{!}}<author name>]]
b Bugfix; Protection rule failed when |lastn= or |authorn= (n>=2) value begins with a square bracket - beginning of wikilink