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

DefaultsortTitlesWithDiacritics() private static method

If title has diacritics, no defaultsort added yet, adds a defaultsort with cleaned up title as sort key If article is about a person, generates human name sortkey
private static DefaultsortTitlesWithDiacritics ( string articleText, string articleTitle, int categories, bool articleAboutAPerson ) : string
articleText string The wiki text of the article.
articleTitle string Title of the article
categories int Number of categories on page
articleAboutAPerson bool Whether the article is about a person
return string
        private static string DefaultsortTitlesWithDiacritics(string articleText, string articleTitle, int categories, bool articleAboutAPerson)
        {
            // need some categories and no defaultsort, and a sortkey not the same as the article title
            if (categories > 0 && !WikiRegexes.Defaultsort.IsMatch(articleText))
            {
                // https://en.wikipedia.org/wiki/Wikipedia_talk:AutoWikiBrowser/Bugs/Archive_11#Human_DEFAULTSORT
                // if article is about a person, attempt to add a surname, forenames sort key rather than the tidied article title
                string sortkey = articleAboutAPerson ? Tools.MakeHumanCatKey(articleTitle, articleText) : Tools.FixupDefaultSort(articleTitle);

                // sortkeys now not case sensitive
                if (!sortkey.ToLower().Equals(articleTitle.ToLower()) || Tools.RemoveDiacritics(articleTitle) != articleTitle)
                {
                    articleText += Tools.Newline("{{DEFAULTSORT:") + sortkey + "}}";

                    return (ExplicitCategorySortkeys(articleText, sortkey));
                }
            }

            return articleText;
        }
Parsers