RemoveCategory() public static method

Removes a category from an article.
public static RemoveCategory ( string strOldCat, string articleText ) : string
strOldCat string The old category to remove.
articleText string The wiki text of the article.
return string
示例#1
0
        public string ProcessArticle(IAutoWikiBrowser sender, ProcessArticleEventArgs eventargs)
        {
            //If menu item is not checked, then return
            if (!PluginEnabled || Settings.Categories.Count == 0)
            {
                eventargs.Skip = false;
                return eventargs.ArticleText;
            }

            eventargs.EditSummary = "";
            string text = eventargs.ArticleText;

            Parsers parse = new Parsers();

            foreach (KeyValuePair<string, string> p in Settings.Categories)
            {
                bool noChange = true;

                if (p.Value.Length == 0)
                {
                    text = parse.RemoveCategory(p.Key, text, out noChange);
                    if(!noChange) eventargs.EditSummary += ", removed " + Variables.Namespaces[14] + p.Key;
                }
                else
                {
                    text = parse.ReCategoriser(p.Key, p.Value, text, out noChange);
                    if (!noChange) eventargs.EditSummary += ", replaced: " + Variables.Namespaces[14]
                         + p.Key + FindandReplace.Arrow + Variables.Namespaces[14] + p.Value;
                }
                if (!noChange) text = Regex.Replace(text, "<includeonly>[\\s\\r\\n]*\\</includeonly>", "");
            }

            eventargs.Skip = (text == eventargs.ArticleText) && Settings.Skip;

            return text;
        }