WikiFunctions.Parse.Parsers.FixLivingThingsRelatedDates C# (CSharp) Method

FixLivingThingsRelatedDates() public static method

Replace b. and d. for born/died, or date– for born per [[WP:BORN]]
public static FixLivingThingsRelatedDates ( string articleText ) : string
articleText string The wiki text of the article.
return string
        public static string FixLivingThingsRelatedDates(string articleText)
        {
            // Three born/died regexes wrapped like this for performance
            if (Regex.IsMatch(articleText, @"'''\s*\([BbDd]"))
                articleText = BoldToBracket.Replace(articleText, m=>
                                                    {
                                                        string newvalue = m.Groups[2].Value;

                                                        newvalue = DiedDateRegex.Replace(newvalue, "died $1"); // date of death
                                                        newvalue = DOBRegex.Replace(newvalue, "born $1"); // date of birth
                                                        newvalue = BornDeathRegex.Replace(newvalue, "$1 – $3"); // birth and death
                                                        return  m.Groups[1].Value + newvalue;
                                                    });

            if (DOBRegexDashQuick.IsMatch(articleText) && !DOBRegexDash.IsMatch(WikiRegexes.InfoBox.Match(articleText).Value))
                articleText = DOBRegexDash.Replace(articleText, "$1born $2)"); // date of birth – dash

            return articleText;
        }
Parsers