/// <summary>
/// Extracts the persondata template from the articleText, along with the persondata comment, if present on the line before
/// </summary>
/// <param name="articleText">The wiki text of the article.</param>
/// <returns></returns>
public static string RemovePersonData(ref string articleText)
{
string strPersonData = (Variables.LangCode.Equals("de")
? Parsers.GetTemplate(articleText, "[Pp]ersonendaten")
: Parsers.GetTemplate(articleText, "[Pp]ersondata"));
if (!string.IsNullOrEmpty(strPersonData))
{
articleText = articleText.Replace(strPersonData, "");
// detection of duplicate persondata template
if (Variables.LangCode.Equals("en"))
{
string PersonData2 = Parsers.GetTemplate(articleText, "[Pp]ersondata");
if (!string.IsNullOrEmpty(PersonData2))
{
articleText = articleText.Replace(PersonData2, "");
strPersonData += Tools.Newline(PersonData2);
}
}
}
// https://en.wikipedia.org/wiki/Wikipedia_talk:AutoWikiBrowser/Bugs/Archive_11#Persondata_comments
// catch the persondata comment the line before it so that the comment and template aren't separated
if (articleText.Contains(WikiRegexes.PersonDataCommentEN) && Variables.LangCode == "en")
{
articleText = articleText.Replace(WikiRegexes.PersonDataCommentEN, "");
strPersonData = WikiRegexes.PersonDataCommentEN + strPersonData;
}
return(strPersonData);
}