Jump to content
Wikipedia The Free Encyclopedia

User:ShepBot/AWB Module

From Wikipedia, the free encyclopedia
publicstringProcessArticle(stringArticleText,stringArticleTitle,intwikiNamespace,outstringSummary,outboolSkip)
{
Skip=false;
Summary="";
stringtemplate="TEMPLATE NAME HERE";
stringproject="";

Matchs=Regex.Match(ArticleText,@"\{\{"+template+@" \| class=",RegexOptions.IgnoreCase);
Matchy=Regex.Match(ArticleText,@"\{\{"+template+@"\|class = ",RegexOptions.IgnoreCase);
Matchu=Regex.Match(ArticleText,@"\{\{"+template+@" \| class = ",RegexOptions.IgnoreCase);
Matchm=Regex.Match(ArticleText,@"\{\{"+template,RegexOptions.IgnoreCase);
Matchz=Regex.Match(ArticleText,@"\{\{"+template+@"(.*?)\|(.*?)class( ?)=( ?)(a-z]*[^|])",RegexOptions.IgnoreCase);
Matchp=Regex.Match(ArticleText,@"\{\{"+template+@"(.*?)\|(.*?)class( ?)=( ?)[^a-z]",RegexOptions.IgnoreCase);
Matchq=Regex.Match(ArticleText,@"\{\{"+template+"\r\n",RegexOptions.IgnoreCase);
Matchn=Regex.Match(ArticleText,@"\|class( ?)\= ( ?)list",RegexOptions.IgnoreCase);
Matchc=Regex.Match(ArticleText,@"\|class( ?)\=( ?)stub",RegexOptions.IgnoreCase);
Matcht=Regex.Match(ArticleText,@"\|class( ?)\=( ?)start",RegexOptions.IgnoreCase);
Matchd=Regex.Match(ArticleText,@"\|class( ?)\=( ?)c",RegexOptions.IgnoreCase);
Matchb=Regex.Match(ArticleText,@"\|class( ?)\=( ?)b",RegexOptions.IgnoreCase);
Matcha=Regex.Match(ArticleText,@"\|class( ?)\=( ?)a",RegexOptions.IgnoreCase);
Matchf=Regex.Match(ArticleText,@"\|class( ?)\=( ?)fa",RegexOptions.IgnoreCase);
Matchl=Regex.Match(ArticleText,@"\|class( ?)\=( ?)fl",RegexOptions.IgnoreCase);
Matchg=Regex.Match(ArticleText,@"\|class( ?)\=( ?)ga",RegexOptions.IgnoreCase);

if(z.Success)returnArticleText;

if(n.Success)project="List";

if(c.Success)project="Stub";

if(t.Success)project="Start";

if(d.Success)project="C";

if(b.Success)project="B";
if(g.Success)project="GA";
if(a.Success)project="A";

if(l.Success)project="FL";

if(f.Success)project="FA";

if(project.Equals(""))returnArticleText;

if(m.Success)ArticleText=ArticleText.Replace("{{"+template,"{{"+template+"|class="+project);

if(s.Success)ArticleText=ArticleText.Replace("{{"+template+"|class="+project+" | class=","{{"+template+"|class="+project);

if(y.Success)ArticleText=ArticleText.Replace("{{"+template+"|class="+project+"|class = ","{{"+template+"|class="+project);

if(u.Success)ArticleText=ArticleText.Replace("{{"+template+"|class="+project+" | class = ","{{"+template+"|class="+project);

if(q.Success)ArticleText=ArticleText.Replace("{{"+template+"|class="+project+"\r\n"+"|class=","{{"+template+"\r\n"+"|class="+project);

if(p.Success)ArticleText=ArticleText.Replace("{{"+template+"|class="+project+"|class=","{{"+template+"|class="+project);

returnArticleText;

}

Stolen from Richard0612, which was tweaked by Reedy, which was slightly modified by me. The code is a custom module for AWB.

AltStyle によって変換されたページ (->オリジナル) /