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

LivingPeople() public static method

Adds [[Category:Living people]] to articles with a [[Category:XXXX births]] and no living people/deaths category, taking sortkey from births category if present When page is not mainspace, adds [[:Category rather than [[Category
public static LivingPeople ( string articleText, string articleTitle ) : string
articleText string The wiki text of the article.
articleTitle string The page title of the article.
return string
        public static string LivingPeople(string articleText, string articleTitle)
        {
            if (Variables.LangCode.Equals("sco") || Variables.IsWikimediaMonolingualProject)
                return articleText;

            Match m = WikiRegexes.BirthsCategory.Match(GetCats(articleText));

            // do not add living people category unless 'XXXX births' category is present
            if (!m.Success)
                return articleText;

            // do not add living people category if already dead, or thought to be dead
            if (WikiRegexes.DeathsOrLivingCategory.IsMatch(articleText) || WikiRegexes.LivingPeopleRegex2.IsMatch(articleText) ||
                Regex.IsMatch(articleText, BornDeathRegex.ToString().Replace("^", @"('''(?:[^']+|.*?[^'])'''\s*\()"))
                || Regex.IsMatch(articleText, DiedDateRegex.ToString().Replace("^", @"('''(?:[^']+|.*?[^'])'''\s*\()")))
                return articleText;

            string birthCat = m.Value;
            int birthYear = 0;

            string byear = m.Groups[1].Value;

            if (ThreeOrMoreDigits.IsMatch(byear))
                birthYear = int.Parse(byear);

            // per [[:Category:Living people]] and [[WP:BDP]], do not apply if born > 115 years ago
            if (birthYear < (DateTime.Now.Year - 115))
                return articleText;

            // use any sortkey from 'XXXX births' category
            string catKey = birthCat.Contains("|") ? BirthsSortKey.Match(birthCat).Value : "]]";

            return articleText + "[[" + (Namespace.IsMainSpace(articleTitle) ? "" : ":") + "Category:Living people" + catKey;
        }

Same methods

Parsers::LivingPeople ( string articleText, string articleTitle, bool &noChange ) : string
Parsers