WikiFunctions.Parse.MetaDataSorter.RemovePersonData C# (CSharp) Method

RemovePersonData() public static method

Extracts the persondata template from the articleText, along with the persondata comment, if present on the line before
public static RemovePersonData ( string &articleText ) : string
articleText string The wiki text of the article.
return string
        public static string RemovePersonData(ref string articleText)
        {
            string strPersonData = "", originalArticleText = articleText;

            articleText = WikiRegexes.Persondata.Replace(articleText, m=>
                                                         {
                                                             strPersonData += (strPersonData.Length == 0 ? m.Value : Tools.Newline(m.Value));
                                                             return "";
                                                         });

            // 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.Equals("en"))
            {
                articleText = articleText.Replace(WikiRegexes.PersonDataCommentEN, "");
                strPersonData = WikiRegexes.PersonDataCommentEN + strPersonData;
            }

            if (!Tools.UnformattedTextNotChanged(originalArticleText, articleText))
            {
                articleText = originalArticleText;
                strPersonData = "";
            }

            return strPersonData;
        }