User:Yobot/Error 97

////<summary>Moves {{TOC right}} exactly before the first header. CHECKWIKI error 97</summary>
/// It is still buggy and it has to be used only for manual editing.
        public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
        {
            Regex TOC = Tools.NestedTemplateRegex("TOC right");
            Skip = !TOC.IsMatch(ArticleText);
            Summary = "No content between TOC and first headline per [[WP:TOC]] and [[WP:LEAD]]. This is an accessibility issue for users of screen readers.";
            string zerothSection = WikiRegexes.ZerothSection.Match(ArticleText).Value;
            string restOfArticle = ArticleText.Substring(zerothSection.Length);
            zerothSection = Regex.Replace(zerothSection,"{{TOC right}}","") + "{{TOC right}}\r\n";
            ArticleText = zerothSection + restOfArticle;
            return ArticleText;
        }