User:ShepBot/AWB Module
Appearance
public string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip)
{
Skip = false;
Summary = "";
string Tag = "";
string template = "WPOHIO";
Match m = Regex.Match(ArticleText, @"\{\{" + template + "(.*?)\\|(.*?)class=", RegexOptions.Singleline | RegexOptions.IgnoreCase);
Match c = Regex.Match(ArticleText, @"\|class(\s|)=(\s|)stub", RegexOptions.IgnoreCase);
Match f = Regex.Match(ArticleText, @"\|class(\s|)=(\s|)fa", RegexOptions.IgnoreCase);
Match l = Regex.Match(ArticleText, @"\|class(\s|)=(\s|)fl", RegexOptions.IgnoreCase);
Match g = Regex.Match(ArticleText, @"\|class(\s|)=(\s|)ga", RegexOptions.IgnoreCase);
Match s = Regex.Match(ArticleText, @"\|class(\s|)=(\s|)start", RegexOptions.IgnoreCase);
Match b = Regex.Match(ArticleText, @"\|class(\s|)=(\s|)b", RegexOptions.IgnoreCase);
Match r = Regex.Match(ArticleText, @"\|class(\s|)=(\s|)list", RegexOptions.IgnoreCase);
Match d = Regex.Match(ArticleText, @"\|class(\s|)=d(ab|isambig)", RegexOptions.IgnoreCase);
string pageClass = "";
if (c.Success) pageClass = "Stub";
if (f.Success) pageClass = "FA";
if (l.Success) pageClass = "FL";
if (g.Success) pageClass = "GA";
if (s.Success) pageClass = "Start";
if (b.Success) pageClass = "B";
if (r.Success) pageClass = "List";
if (d.Success) pageClass = "Dab";
Tag = "{{" + template + "|class=" + pageClass + "}}";
if (m.Success) ArticleText = ArticleText.Insert(m.Index + m.Length, pageClass);
else ArticleText = Tag + "\r\n" + ArticleText;
return ArticleText;
}
Stolen from Richard0612, which was tweaked by Reedy, which was slightly modified by me. The code is a custom module for AWB.