User:Yobot/MIA
Appearance
// Infobox musical artist
// Separates birth_date from birth_place
private static readonly Regex Milperson = Tools.NestedTemplateRegex(new List<string>("Infobox musical artist".Split(',')));
public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
Skip = true;
Summary = "Infobox musical artist";
foreach(Match m in Milperson.Matches(ArticleText))
{
string TempCall = m.Value, newValue = m.Value;
string db = Tools.GetTemplateParameterValue(TempCall, "Born");
if (db.Length == 0)
newValue = Tools.RemoveTemplateParameter(newValue, "Born");
if (dd.Length == 0)
newValue = Tools.RemoveTemplateParameter(newValue, "Died");
if(db.Length == 0 || Tools.GetTemplateParameterValue(TempCall, "birth_place").Length > 0)
continue;
db = WikiRegexes.Br.Replace(db, "<br/>");
BP = BP.Replace("<small>", "");
BP = BP.Replace("</small>", "");
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, "Born", db);
newValue = Tools.UpdateTemplateParameterValue(newValue, "Born", db + "\r\n" + @"|birth_place =" + BP );
//newValue = Tools.SetTemplateParameterValue(newValue, "birth_place", BP);
newValue = Tools.RenameTemplateParameter(newValue, "Born", "birth_date");
Skip = false;
ArticleText = ArticleText.Replace(m.Value, newValue);
}
}
return ArticleText;