This is the AWB module used as the final step in the list-making for this nomination.
I have not prettified the code. This is how it was when I ran it as part of the list-making described in selection process.
I am an occasional hacker (of 40 years intermittent experience) and not a professional programmer, so the code is crude as hell and as ugly as a very ugly thing. But since it relies on a positive identification, I am confident that any flaws will lead to false negatives, rather than false positives.
It take a portal page, and then:
Template:
Template:
, skip the pagepublic string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip) { Skip = false; Summary = "test"; // string TemplateName = @"(Transclude +list +item +excerpts +as +random +slideshow|Transclude +linked +excerpts +as +random +slideshow)"; Match tsramatch = Regex.Match(ArticleText, @"\{\{(Transclude +list +item +excerpts +as +random +slideshow|Transclude +linked +excerpts +as +random +slideshow)[^\}]*\}\}", RegexOptions.Singleline); if (!tsramatch.Success) { Skip = true; return "no match"; } // | paragraphs=1-2 | files=1| Template:Bowerbirds | string tsrcall = Regex.Replace(tsramatch.Value, @"\s+", " ", RegexOptions.Singleline); string tsrstripped = Regex.Replace(tsrcall, @"{{(Transclude +list +item +excerpts +as +random +slideshow|Transclude +linked +excerpts +as +random +slideshow)([^}]*)}}", @"$2", RegexOptions.Singleline); string tsrnoparams = Regex.Replace(tsrstripped, @"\s*\|[^=\|]+=[^=\|]*\|", "|"); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|[^=\|]+=[^=\|]*\|", "|"); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|[^=\|]+=[^=\|]*\|", "|"); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|[^=\|]+=[^=\|]*\|", "|"); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|[^=\|]+=[^=\|]*\|", "|"); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|[^=\|]+=[^=\|]*\|", "|"); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|[^=\|]+=[^=\|]*\|", "|"); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|\s*$", ""); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|\s*$", ""); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|\s*$", ""); Match onetemplate = Regex.Match(tsrnoparams, @"^\s*\|\s*Template:[^\|]+$"); if (!onetemplate.Success) { Skip = true; return "BAD!!!::::\n tsrstripped = [" + tsrstripped + "]\ntsrnoparams = [" + tsrnoparams + "]\n----\n" + ArticleText; } // Success return "Success: only parameter is [" + tsrnoparams + "]"; }
This is the AWB module used as the final step in the list-making for this nomination.
I have not prettified the code. This is how it was when I ran it as part of the list-making described in selection process.
I am an occasional hacker (of 40 years intermittent experience) and not a professional programmer, so the code is crude as hell and as ugly as a very ugly thing. But since it relies on a positive identification, I am confident that any flaws will lead to false negatives, rather than false positives.
It take a portal page, and then:
Template:
Template:
, skip the pagepublic string ProcessArticle(string ArticleText, string ArticleTitle, int wikiNamespace, out string Summary, out bool Skip) { Skip = false; Summary = "test"; // string TemplateName = @"(Transclude +list +item +excerpts +as +random +slideshow|Transclude +linked +excerpts +as +random +slideshow)"; Match tsramatch = Regex.Match(ArticleText, @"\{\{(Transclude +list +item +excerpts +as +random +slideshow|Transclude +linked +excerpts +as +random +slideshow)[^\}]*\}\}", RegexOptions.Singleline); if (!tsramatch.Success) { Skip = true; return "no match"; } // | paragraphs=1-2 | files=1| Template:Bowerbirds | string tsrcall = Regex.Replace(tsramatch.Value, @"\s+", " ", RegexOptions.Singleline); string tsrstripped = Regex.Replace(tsrcall, @"{{(Transclude +list +item +excerpts +as +random +slideshow|Transclude +linked +excerpts +as +random +slideshow)([^}]*)}}", @"$2", RegexOptions.Singleline); string tsrnoparams = Regex.Replace(tsrstripped, @"\s*\|[^=\|]+=[^=\|]*\|", "|"); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|[^=\|]+=[^=\|]*\|", "|"); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|[^=\|]+=[^=\|]*\|", "|"); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|[^=\|]+=[^=\|]*\|", "|"); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|[^=\|]+=[^=\|]*\|", "|"); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|[^=\|]+=[^=\|]*\|", "|"); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|[^=\|]+=[^=\|]*\|", "|"); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|\s*$", ""); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|\s*$", ""); tsrnoparams = Regex.Replace(tsrnoparams, @"\s*\|\s*$", ""); Match onetemplate = Regex.Match(tsrnoparams, @"^\s*\|\s*Template:[^\|]+$"); if (!onetemplate.Success) { Skip = true; return "BAD!!!::::\n tsrstripped = [" + tsrstripped + "]\ntsrnoparams = [" + tsrnoparams + "]\n----\n" + ArticleText; } // Success return "Success: only parameter is [" + tsrnoparams + "]"; }