// Updates parameters in Infobox cricketer. Archived for historical reasons.
private static readonly Regex Templ = Tools.NestedTemplateRegex(new List<string>("Infobox cricketer".Split(',')));
public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
Skip = false;
Summary = "Infobox parameter standardisation";
foreach(Match m in Templ.Matches(ArticleText))
{
string TemplCall = m.Value, newValue = m.Value;
newValue = Tools.RenameTemplateParameter(newValue, "playername", "name");
newValue = Tools.RenameTemplateParameter(newValue, "imagealt", "alt");
//birth
string living = Tools.GetTemplateParameterValue(TemplCall, "living");
string partialdates = Tools.GetTemplateParameterValue(TemplCall, "partialdates");
string dayofbirth = Tools.GetTemplateParameterValue(TemplCall, "dayofbirth");
string monthofbirth = Tools.GetTemplateParameterValue(TemplCall, "monthofbirth");
string yearofbirth = Tools.GetTemplateParameterValue(TemplCall, "yearofbirth");
//death
string dayofdeath = Tools.GetTemplateParameterValue(TemplCall, "dayofdeath");
string monthofdeath = Tools.GetTemplateParameterValue(TemplCall, "monthofdeath");
string yearofdeath = Tools.GetTemplateParameterValue(TemplCall, "yearofdeath");
if (living.Length == 0 && partialdates.Length == 0)
{
string birthdate = "{{Birth date|"+yearofbirth+"|"+monthofbirth+"|"+dayofbirth+"|df=yes}}";
newValue = Tools.SetTemplateParameterValue(newValue, "dayofbirth", birthdate);
newValue = Tools.RenameTemplateParameter(newValue, "dayofbirth", "birth_date");
string deathdate = "{{Death date and age|"+yearofdeath+"|"+monthofdeath+"|"+dayofdeath+"|"+yearofbirth+"|"+monthofbirth+"|"+dayofbirth+"|df=yes}}";
newValue = Tools.SetTemplateParameterValue(newValue, "dayofdeath", deathdate);
newValue = Tools.RenameTemplateParameter(newValue, "dayofdeath", "death_date");
newValue = Tools.RemoveTemplateParameter(newValue, "monthofbirth");
newValue = Tools.RemoveTemplateParameter(newValue, "yearofbirth");
newValue = Tools.RemoveTemplateParameter(newValue, "dayofdeath");
newValue = Tools.RemoveTemplateParameter(newValue, "monthofdeath");
newValue = Tools.RemoveTemplateParameter(newValue, "yearofdeath");
}
ArticleText = ArticleText.Replace(m.Value, newValue);
}
return ArticleText;
}