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

TagUpdater() public static method

Sets the date (month & year) for undated cleanup tags that take a date, from https://en.wikipedia.org/wiki/Wikipedia:AWB/Dated_templates Avoids changing tags in unformatted text areas (wiki comments etc.) Note: https://phabricator.wikimedia.org/T4700 means {{subst:}} within ref tags doesn't work, AWB doesn't do anything about it
public static TagUpdater ( string articleText ) : string
articleText string The wiki text of the article.
return string
        public static string TagUpdater(string articleText)
        {
            if (WikiRegexes.DatedTemplates.Any())
            {
                List<string> t = GetAllTemplates(articleText), t2 = new List<string>();

                t2.AddRange(t.Where(s => WikiRegexes.DatedTemplates.Contains(s)));

                // only work to do if article has any of the DatedTemplates in it
                if (t2.Any())
                {
                    string originalArticleText = articleText;
                    articleText = Tools.NestedTemplateRegex(t2).Replace(articleText, TagUpdaterME);

                    // Performance: only worth aplying Hide if we made changes to raw articleText
                    if (!originalArticleText.Equals(articleText))
                    {
                        articleText = ht.Hide(originalArticleText);
                        articleText = Tools.NestedTemplateRegex(t2).Replace(articleText, TagUpdaterME);
                        articleText = FixSyntaxSubstRefTags(articleText);
                        articleText = ht.AddBack(articleText);
                    }
                }
            }

            return articleText;
        }
Parsers