User:Yobot/NFL
Appearance
// Infobox NFL retired
// Separates birth_date from birth_place
// Created by User:Rjwilmsi
private static readonly Regex Milperson = Tools.NestedTemplateRegex(new List<string>("Infobox NFL retired".Split(',')));
public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
Skip = true;
Summary = "Infobox NFL retired";
foreach(Match m in Milperson.Matches(ArticleText))
{
string TempCall = m.Value, newValue = m.Value;
string db = Tools.GetTemplateParameterValue(TempCall, "birth_date");
if(db.Length == 0 || Tools.GetTemplateParameterValue(TempCall, "birth_place").Length > 0)
continue;
db = WikiRegexes.Br.Replace(db, "<br/>");
if(db.Contains("<br/>"))
{
string BP = db.Substring(db.IndexOf("<br/>")).Replace("<br/>", "");
db = db.Substring(0, db.IndexOf("<br/>")).Replace("<br/>", "");
//newValue = Tools.UpdateTemplateParameterValue(newValue, "birth_date", db);
newValue = Tools.UpdateTemplateParameterValue(newValue, "birth_date", db + "\r\n" + @"| birth_place =" + BP );
newValue = Tools.SetTemplateParameterValue(newValue, "birth_place", BP);
Skip = false;
ArticleText = ArticleText.Replace(m.Value, newValue);
}
}
return ArticleText;
}