C# Class WikiFunctions.Parse.Parsers

Provides functions for editing wiki text, such as formatting and re-categorisation.
Show file Open project: reedy/AutoWikiBrowser Class Usage Examples

Public Properties

Property Type Description
StubMaxWordCount int

Public Methods

Method Description
AddBackMoreText ( string articleText ) : string
AddBackText ( string articleText ) : string
AddBackTextImages ( string articleText ) : string
AddCategory ( string newCategory, string articleText, string articleTitle ) : string

Adds the category to the article.

AddCategory ( string newCategory, string articleText, string articleTitle, bool &noChange ) : string

Adds the category to the article.

AddMissingReflist ( string articleText ) : string

First checks for a <references< missing '/' to correct, otherwise: if the article uses cite references but has no recognised template to display the references, add {{Reflist}} in the appropriate place

AmbigCiteTemplateDates ( string articleText ) : int>.Dictionary

Returns whether the input article text contains ambiguous cite template dates in XX-XX-YYYY or XX-XX-YY format

AmbiguousCiteTemplateDates ( string articleText ) : bool

Returns whether the input article text contains ambiguous cite template dates in XX-XX-YYYY or XX-XX-YY format

BadCiteParameters ( string articleText ) : int>.Dictionary

Searches for unknown/invalid parameters within citation templates

BoldTitle ( string articleText, string articleTitle, bool &noChange ) : string

'''Emboldens''' the first occurrence of the article title, if not already bold 1) Cleans up bolded self wikilinks 2) Cleans up self wikilinks 3) '''Emboldens''' the first occurrence of the article title

BulletExternalLinks ( string articleText ) : string

Adds bullet points to external links after "external links" header

BulletExternalLinks ( string articleText, bool &noChange ) : string

Adds bullet points to external links after "external links" header

CanonicalizeTitle ( string title ) : string

returns URL-decoded link target Handles titles from [[Category:Articles with underscores in the title]]

CanonicalizeTitleAggressively ( string title ) : string

Turns a title into its canonical form, could be slow

CanonicalizeTitleRaw ( string title ) : string

Performs URL-decoding of a page title, trimming all whitespace

CanonicalizeTitleRaw ( string title, bool trim ) : string

performs URL-decoding of a page title

CategoryMatch ( string articleText, string categoryName ) : bool

Returns whether the input string matches the name of a category in use in the input article text string, based on a case insensitive match

ChangeToDefaultSort ( string articleText, string articleTitle, bool &noChange ) : string

Changes an article to use defaultsort when all categories use the same sort field / cleans diacritics from defaultsort/categories

ChangeToDefaultSort ( string articleText, string articleTitle, bool &noChange, bool restrictDefaultsortChanges ) : string

Changes an article to use defaultsort when all categories use the same sort field / cleans diacritics from defaultsort/categories Skips pages using <noinclude>, <includeonly> etc.

CheckNoBots ( string articleText, string user ) : bool

checks if a user is allowed to edit this article using {{bots}} and {{nobots}} tags

CitationPublisherToWork ( string citation ) : string

Where the publisher field is used incorrectly instead of the work field in a {{cite web}} or {{cite news}} citation convert the parameter to be 'work' Scenarios covered: * publisher == URL domain, no work= used

CiteTemplateDates ( string articleText ) : string

Corrects common formatting errors in dates in external reference citation templates (doesn't link/delink dates) note some incorrect date formats such as 3-2-2009 are ambiguous as could be 3-FEB-2009 or MAR-2-2009, these fixes don't address such errors

CiteTemplateDates ( string articleText, bool &noChange ) : string

Corrects common formatting errors in dates in external reference citation templates (doesn't link/delink dates)

Conversions ( string articleText ) : string

Converts/subst'd some deprecated templates

Conversions ( string articleText, bool &noChange ) : string

Converts/subst'd some deprecated templates

Dablinks ( string articleText ) : string

Performs some cleanup operations on dablinks Merges some for & about dablinks Merges multiple distinguish into one

DeadLinks ( string articleText ) : int>.Dictionary

Searches for {{dead link}}s

DeduplicateMaintenanceTags ( List tags ) : List

Deduplicates multiple maintenance tags. Uses earliest of date parameters, merges all other parameters. Does nothing if parameter values other than date parameter are conflicting

DeriveReferenceName ( string articleText, string reference ) : string

Derives a name for a reference by searching for author names and dates, or website base URL etc.

DeterminePredominantDateLocale ( string articleText ) : DateLocale

Determines the predominant date format in the article text (American/International), if available

DeterminePredominantDateLocale ( string articleText, bool considerISO ) : DateLocale

Determines the predominant date format in the article text (American/International/ISO), if available

DeterminePredominantDateLocale ( string articleText, bool considerISO, bool explicitonly ) : DateLocale

Determines the predominant date format in the article text (American/International/ISO), if available

DoublePipeLinks ( string articleText ) : int>.Dictionary

Searches for wikilinks with double pipes

DuplicateNamedReferences ( string articleText ) : string

Where an unnamed reference is a duplicate of another named reference, set the unnamed one to use the named ref Condenses repeated named reference, provided ref not declared within a template call Checks for instances of named references with same ref name having different values, does not modify article text in this case

DuplicateUnnamedReferences ( string articleText ) : string

Derives and sets a reference name per [[WP:REFNAME]] for duplicate <ref>s Then condenses repeated uses of the named reference

ExternalURLToInternalLink ( string articleText ) : string

Converts external links to Wikimedia projects into internal links

ExtractCOinS ( string text ) : string>.Dictionary

Returns a dictionary of COinS parameter and value from the input text Only first set of COinS data is processed

FixBrParagraphs ( string articleText ) : string

Remove <br />'s where not needed

FixCategories ( string articleText ) : string

Fix common spacing/capitalisation errors in categories; remove diacritics and trailing whitespace from sortkeys (not leading whitespace)

FixCitationTemplates ( string articleText ) : string

Applies various formatting fixes to citation templates

FixDateOrdinalsAndOf ( string articleText, string articleTitle ) : string

Removes ordinals, leading zeros from dates and 'of' between a month and a year, per [[WP:MOSDATE]]; on en wiki only

FixDatesA ( string articleText ) : string

Fix date and decade formatting errors: commas in American/international dates, full date ranges, month ranges

FixDatesB ( string articleText, bool CircaLink, bool Floruit ) : string

Fix date and decade formatting errors: date/year ranges to present, full year ranges, performs floruit term wikilinking

FixEmptyLinksAndTemplates ( string articleText ) : string

Removes Empty Links and Template Links Will Cater for [[]], [[Image:]], [[:Category:]], [[Category:]] and {{}}

FixHeadings ( string articleText, string articleTitle ) : string

Fix ==See also== and similar section common errors. Removes unecessary introductory headings and cleans excess whitespace (but not the optional single space at the start & end of headings).

FixHeadings ( string articleText, string articleTitle, bool &noChange ) : string

Fix ==See also== and similar section common errors.

FixImages ( string articleText ) : string

Fix common spacing/capitalisation errors in images

FixLinkWhitespace ( string articleText, string articleTitle ) : string

Fix leading, trailing and middle spaces in Wikilinks

FixLinks ( string articleText, string articleTitle, bool &noChange ) : string

Fixes link syntax, including removal of self links. Underscores not removed from link where page in [[Category:Articles with underscores in the title]]

FixLivingThingsRelatedDates ( string articleText ) : string

Replace b. and d. for born/died, or date– for born per [[WP:BORN]]

FixMainArticle ( string articleText ) : string

Fixes instances of ''Main Article: xxx'' to use {{main|xxx}}, ''see also:'' to use {{see also|xxx}}

FixNonBreakingSpaces ( string articleText ) : string

Apply non-breaking spaces for abbreviated SI units, imperial units, pp for pages. Remove incorrect space before % symbol

FixPeopleCategories ( string articleText, string articleTitle ) : string

Adds [[Category:XXXX births]], [[Category:XXXX deaths]] to articles about people where available, for en-wiki only

FixPeopleCategories ( string articleText, string articleTitle, bool parseTalkPage ) : string

Adds [[Category:XXXX births]], [[Category:XXXX deaths]] to articles about people where available, for en-wiki only When page is not mainspace, adds [[:Category rather than [[Category Removes Date of birth missing/Date of birth missing (living people) category if full DOB in {{birth date and age}}

FixPeopleCategories ( string articleText, string articleTitle, bool parseTalkPage, bool &noChange ) : string

Adds [[Category:XXXX births]], [[Category:XXXX deaths]] to articles about people where available, for en-wiki only

FixReferenceListTags ( string articleText ) : string

Replaces various old reference tag formats, with the new {{Reflist}}, or <references/> for sv-wiki

FixReferenceTags ( string articleText ) : string

Various fixes to the formatting of <ref> reference tags including case conversion and trimming excess whitespace

FixSyntax ( string articleText ) : string

Fixes and improves syntax (such as html markup)

FixSyntax ( string articleText, bool &noChange ) : string

Fixes and improves syntax (such as html markup)

FixSyntaxRedirects ( string articleText ) : string

Performs fixes to redirect pages: * removes newline between #REDIRECT and link (CHECKWIKI error 36) * removes equals sign and double dot between #REDIRECT and link (CHECKWIKI error 36) * Template to Magic word conversion; removes unnecessary brackets around redirect * Simple closing bracket fixing to {{R...}} templates

FixSyntaxSubstRefTags ( string articleText ) : string

workaround for https://phabricator.wikimedia.org/T4700 -- {{subst:}} doesn't work within ref tags

FixTemperatures ( string articleText ) : string

Fix bad Temperatures

FixUnicode ( string articleText ) : string

Performs transformations related to Unicode characters that may cause problems for different clients Removes line separator Unicode characters at start of paragraph, otherwise converts line separator, paragraph separator Unicode characters to spaces.

FormatToBDA ( string dateandage ) : string

takes input string of date and age e.g. "11 May 1990 (age 21)" and converts to {{birth date and age|1990|5|11}}

GetAllTemplateDetail ( string articleText ) : List

Extracts a distinct list of all template calls in the input text, supporting any level of template nesting.

GetAllTemplates ( string articleText ) : List

Extracts a list of all templates used in the input text, supporting any level of template nesting. Template name given in first letter upper

GetAllWikiLinks ( string articleText ) : List

Extracts a list of all wikilinks (all including cats, images etc.) used in the input text

GetCategorySort ( string articleText ) : string

Returns the sortkey used by all categories, if * all categories use the same sortkey * no {{DEFAULTSORT}} in article Otherwise returns null

GetCategorySort ( string articleText, string articleTitle, int &matches ) : string

Returns the sortkey used by all categories, if all categories use the same sortkey Where no sortkey is used for all categories, returns the articletitle

GetInfoBoxFieldValue ( string articleText, List fields ) : string

Returns the value of the given fields from the page's infobox, where available Returns a null string if the input article has no infobox, or the input field regex doesn't match on the infobox found

GetInfoBoxFieldValue ( string articleText, string field ) : string

Returns the value of the given field from the page's infobox, where available Returns a null string if the input article has no infobox, or the input field regex doesn't match on the infobox found

GetTemplate ( string articleText, string template ) : string

Finds first occurrence of a given template in article text. Handles nested templates correctly.

GetTemplates ( string articleText ) : List

Finds all templates in article text excluding commented out/nowiki'd templates. Handles nested templates and templates with embedded HTML comments correctly.

GetTemplates ( string articleText, string template ) : List

Finds every occurrence of a given template in article text, excludes commented out/nowiki'd templates Handles nested templates and templates with embedded HTML comments correctly.

HasBareReferences ( string articleText ) : bool

Returns true if the article contains bare external links in the references section (just the URL link on a line with no description/name)

HasDeadLinks ( string articleText ) : bool

Returns whether the input article text contains any {{dead link}} templates, ignoring comments

HasDoublePipeLinks ( string articleText ) : bool

Returns whether the input article text contains any wikilinks with double pipes

HasInfobox ( string articleText ) : bool

Checks if the article has an InfoBox (en wiki)

HasMorefootnotesAndManyReferences ( string articleText ) : bool

Check if the article contains a {{no footnotes}} or {{more footnotes}} template but has 5+ <ref>...</ref> references

HasNamedReferences ( string articleText ) : bool

Checks for named references in short format <ref name=foo />

HasRefAfterReflist ( string articleText ) : bool

Check if the article contains a <ref>...</ref> reference after the {{reflist}} to show them

HasSeeAlsoAfterNotesReferencesOrExternalLinks ( string articleText ) : bool

Checks position of See also section relative to Notes, references, external links sections

HasSicTag ( string articleText ) : bool

Check if the article contains a sic template or bracketed wording, indicating the presence of a deliberate typo

HasStubTemplate ( string articleText ) : bool

Checks if the article has a stub template

HasTargetLessLinks ( string articleText ) : bool

Returns whether the input article text contains any wikilinks with no target

HideMoreText ( string articleText ) : string
HideMoreText ( string articleText, bool hideOnlyTargetOfWikilink ) : string
HideText ( string articleText ) : string
HideTextImages ( string articleText ) : string
InterwikiConversions ( string articleText ) : string

Replaces legacy/deprecated language codes in interwikis with correct ones

InterwikiConversions ( string articleText, bool &noChange ) : string

Replaces legacy/deprecated language codes in interwikis with correct ones

IsArticleAboutAPerson ( string articleText, string articleTitle ) : bool

determines whether the article is about a person by looking for persondata/birth death categories, bio stub etc. for en wiki only

IsArticleAboutAPerson ( string articleText, string articleTitle, bool parseTalkPage ) : bool

determines whether the article is about a person by looking for persondata/birth death categories, bio stub etc. for en wiki only Should only return true if the article is the principle article about the individual (not early life/career/discography etc.)

IsInUse ( string articleText ) : bool

Check if article has an 'in use' or 'in creation' tag

IsMissingReferencesDisplay ( string articleText ) : bool

Check if the article uses cite references but has no recognised template to display the references; only for en-wiki

IsStub ( string articleText ) : bool

Checks if the article is classible as a 'Stub'

LivingPeople ( string articleText, string articleTitle ) : string

Adds [[Category:Living people]] to articles with a [[Category:XXXX births]] and no living people/deaths category, taking sortkey from births category if present When page is not mainspace, adds [[:Category rather than [[Category

LivingPeople ( string articleText, string articleTitle, bool &noChange ) : string

Adds [[Category:Living people]] to articles with a [[Category:XXXX births]] and no living people/deaths category, taking sortkey from births category if present

LoadDatedTemplates ( string text ) : List

Processes the text of [[WP:AWB/Dated templates]] into a list of template names Format: * {{tl|Wikify}}

LoadRenamedTemplateParameters ( string text ) : List

Loads List of templates (first letter lower), old parameter, new parameter from within {{AWB rename template parameter}}

LoadTemplateRedirects ( string text ) : string>.Dictionary

Processes the text of [[WP:AWB/Template redirects]] into a dictionary of regexes and new template names Format: {{tl|template 1}}, {{tl|template 2}} → {{tl|actual template}}

Mdashes ( string articleText, string articleTitle ) : string

Replaces hyphens and em-dashes with en-dashes, per [[WP:DASH]]

MergePortals ( string articleText ) : string

Merges multiple {{portal}} templates into a single one, removing any duplicates. En-wiki only. Restricted to {{portal}} calls with one argument Article must have existing {{portal}} and/or a 'see also' section

MergeTemplatesBySection ( string articleText ) : string

Merges multiple instances of the same template in the same section

MissingDefaultSort ( string articletext, string articletitle ) : bool

Returns whether the article is missing a defaultsort (i.e. criteria match so that defaultsort would be added)

MultipleIssues ( string articleText ) : string

Combines maintenance tags into {{multiple issues}} template, for en-wiki only Operates on a section by section basis through article text

NoIncludeIncludeOnlyProgrammingElement ( string articleText ) : bool

Returns whether the article text has a <noinclude> or <includeonly> or '{{{1}}}' etc. which should not appear on the mainspace

Parsers ( int stubWordCount, bool addHumanKey ) : System

Re-organises the Person Data, stub/disambig templates, categories and interwikis

PersonData ( string articleText, string articleTitle ) : string

* Adds the default {{persondata}} template to en-wiki mainspace pages about a person that don't already have {{persondata}} * Attempts to complete blank {{persondata}} fields based on infobox values

PredominantDates ( string articleText ) : string

Updates dates in citation templates to use the strict predominant date format in the article (en wiki only)

ReCategoriser ( string oldCategory, string newCategory, string articleText, bool &noChange ) : string

Re-categorises the article.

ReCategoriser ( string oldCategory, string newCategory, string articleText, bool &noChange, bool removeSortKey ) : string

Re-categorises the article.

RedirectTagger ( string articleText, string articleTitle ) : string

For en-wiki tags redirect pages with one or more of the templates from [[Wikipedia:Template messages/Redirect pages]] following [[WP:REDCAT]]

RefsAfterPunctuation ( string articleText ) : string

Puts <ref> and {{sfn}} references after punctuation (comma, full stop) per WP:REFPUNC Applies to en/el wiki only

RegularCategories ( List
AllCategories ) : List

Returns the categories that are not stub or proposed deletion categories from the input list

RegularCategories ( string articleText ) : List

Returns the categories that are not stub or proposed deletion categories from the input article text

RegularCategories ( string articleText, bool hideComments ) : List

Returns the categories that are not stub or proposed deletion categories from the input article text

RemoveAllWhiteSpace ( string articleText ) : string

Applies removes all excess whitespace from the article Not called by general fixes

RemoveCategory ( string strOldCat, string articleText ) : string

Removes a category from an article.

RemoveCategory ( string strOldCat, string articleText, bool &noChange ) : string

Removes a category from an article.

RemoveDuplicateWikiLinks ( string articleText ) : string

Remove some of the duplicated wikilinks from the article text

RemoveEmptyComments ( string articleText ) : string

Removes HTML comments with nothing/only whitespace between tags

RemoveImage ( string image, string articleText, bool commentOut, string comment ) : string

Removes an image from the article.

RemoveImage ( string image, string articleText, bool commentOut, string comment, bool &noChange ) : string

Removes an image in the article.

RemoveTemplateNamespace ( string articleText ) : string

Removes Template: (or equivalent translation) from start of template calls, canonicalizes template names

RemoveWhiteSpace ( string articleText ) : string

Applies/removes some excess whitespace from the article

RemoveWhiteSpace ( string articleText, bool fixOptionalWhitespace ) : string

Applies/removes some excess whitespace from the article

RenameTemplateParameters ( string articleText, List RenamedTemplateParameters ) : string

Renames parameters in template calls. Does not rename old to new if new paramter already in use with a value

ReorderReferences ( string articleText ) : string

Reorders references so that they appear in numerical order, allows for use of {{rp}}, doesn't modify grouped references [[WP:REFGROUP]]

ReplaceImage ( string oldImage, string newImage, string articleText ) : string

Replaces an image in the article.

ReplaceImage ( string oldImage, string newImage, string articleText, bool &noChange ) : string

Replaces an image in the article.

SameRefDifferentName ( string articleText ) : string

Corrects named references where the reference text is the same but the reference name is different

SimplifyLinks ( string articleText ) : string

Simplifies some links in article wiki text such as changing [[Dog|Dogs]] to [[Dog]]s Fixes CHECKWIKI error 64

SimplifyReferenceTags ( string articleText ) : string

Replaces reference tags in the form <ref name="blah"></ref> with <ref name="blah" /> Removes some of the MW errors that occur from the prior

SortMetaData ( string articleText, string articleTitle ) : string

Re-organises the Person Data, stub/disambig templates, categories and interwikis except when a mainspace article has some 'includeonly' tags etc.

SortMetaData ( string articleText, string articleTitle, bool fixOptionalWhitespace ) : string

Re-organises the Person Data, stub/disambig templates, categories and interwikis except when a mainspace article has some 'includeonly' tags etc.

StickyLinks ( string articleText ) : string

Joins nearby words with links e.g. "[[Russian literature|Russian]] literature" to "[[Russian literature]]"

SubstUserTemplates ( string talkPageText, string talkPageTitle, Regex userTalkTemplatesRegex ) : string

Substitutes some user talk templates

TagUpdater ( string articleText ) : string

Sets the date (month & year) for undated cleanup tags that take a date, from https://en.wikipedia.org/wiki/Wikipedia:AWB/Dated_templates Avoids changing tags in unformatted text areas (wiki comments etc.) Note: https://phabricator.wikimedia.org/T4700 means {{subst:}} within ref tags doesn't work, AWB doesn't do anything about it

Tagger ( string articleText, string articleTitle, bool restrictOrphanTagging, bool &noChange, string &summary ) : string

If necessary, adds/removes various cleanup tags such as wikify, stub, ibid

Tagger ( string articleText, string articleTitle, bool restrictOrphanTagging, string &summary ) : string

If necessary, adds/removes wikify or stub tag

TaggerPermitted ( string articleText, string articleTitle ) : bool

Checks whether Tagger is permitted on article. Allowed on mainspace for non-redirect pages without {{wi}} template Also allowed for ar-wiki namespace 104

TargetLessLinks ( string articleText ) : int>.Dictionary

Searches for wikilinks with no target e.g. [[|foo]]

TemplateExists ( List templatesFound, Regex r ) : bool

Returns whether the given regex matches any of the (first name upper) templates in the given list

TemplateRedirects ( string articleText, string>.Dictionary DictionaryOfTemplateRedirects ) : string

Renames templates to bypass template redirects from [[WP:AWB/Template redirects]] The first letter casing of the existing redirect is kept in the new template name, except for acronym templates where first letter uppercase is enforced Calls TemplateToMagicWord if changes made

UnbalancedBrackets ( string articleText, int &bracketLength ) : int

Checks the article text for unbalanced brackets, either square or curly

UnclosedTags ( string articleText ) : int>.Dictionary

Searches for any unclosed <math>, <source>, <ref>, <code>, <nowiki>, <small>, <pre> <center> <sup> <sub> or <gallery> tags and comments

Unicodify ( string articleText ) : string

Converts HTML entities to unicode, with some deliberate exceptions Does not change 5-character HTML hex entities

Unicodify ( string articleText, bool &noChange ) : string

Converts HTML entities to unicode, with some deliberate exceptions

UserSignature ( string articleText ) : int>.Dictionary

Searches for link to user and/or user talk namespace

Private Methods

Method Description
AddedBoldIsValid ( string articleText, string escapedTitle ) : bool

Checks that the bold just added to the article is the first bold in the article, and that it's within the first 5% of the HideMore article OR immediately after the infobox

BoldItalicME ( Match m ) : string

Replaces with three apostrophes (''') if <B> or <b> tag, else just two ('')

BoldedSelfLinks ( string articleTitle, string articleText ) : string

Delinks all bolded self links in the article

CatEnd ( string sort ) : string
CiteTemplateME ( Match m ) : string

convert invalid date formats like DD-MM-YYYY, MM-DD-YYYY, YYYY-D-M, YYYY-DD-MM, YYYY_MM_DD etc. to iso format of YYYY-MM-DD

CiteTemplateMEParameterToProcess ( List parameters ) : bool
CleanDerivedReferenceName ( string derivedName ) : string

Removes various unwanted punctuation and comment characters from a derived reference name

CompletePersonDataDate ( string personData, string articletext ) : string

Sets persondata date of birth/death fields based on unformatted info in zeroth section of article, provided dates match existing birth/death categories

DefaultsortME ( Match m ) : string

Trims whitespace around DEFAULTSORT value, ensures 'whitespace only' DEFAULTSORT left unchanged, removes trailing square brackets

DefaultsortTitlesWithDiacritics ( string articleText, string articleTitle, int categories, bool articleAboutAPerson ) : string

If title has diacritics, no defaultsort added yet, adds a defaultsort with cleaned up title as sort key If article is about a person, generates human name sortkey

DictionaryOfMatches ( string articleText, Regex r ) : int>.Dictionary

Returns a dictionary of the match index and length of all matches of the input regex in the input text

ExplicitCategorySortkeys ( string articleText, string defaultsortKey ) : string

Removes any explicit keys that are case insensitively the same as the default sort OR entirely match the start of the defaultsort (To help tidy up on pages that already have defaultsort)

ExtractReferenceNameComponents ( string reference, Regex referenceNameMask, int components ) : string

Extracts strings from an input string using the input regex to derive a name for a reference

ExtractTemplate ( string articleText, Match m ) : string

Extracts template using the given match.

FixCitationTemplatesME ( Match m ) : string

Performs fixes to a given citation template call

FixDateOrdinalsAndOfLocal ( string textPortion, bool monthsInTitle ) : string
FixDatesAInternal ( string textPortion ) : string
FixDatesBInternal ( string textPortion, bool CircaLink ) : string
FixHeadingsME ( Match m ) : string

Performs various fixes to headings

FixImagesME ( Match m ) : string
FixLinksInfoBoxSingleAlbum ( string articleText, string articleTitle ) : string

Converts self links for the 'this single/album' field of 'infobox single/album' to bold

FixLinksWikilinkBoldItalicsME ( Match m ) : string

Converts [[foo|'''foo''']] → '''[[foo|foo]]''' for bold, italics or bold and italics only simplify where link & target values are the same without bold/italics (first letter case insensitive)

FixLinksWikilinkCanonicalizeME ( Match m ) : string

Canonicalize link targets, removes underscores except if page from [[Category:Articles with underscores in the title]]

FixPageRanges ( string templateCall, string>.Dictionary Params ) : string

Converts hyphens in page ranges in citation template fields to endashes

FixPageRangesValue ( string pageRange ) : string
FixReferenceTagsME ( Match m ) : string
FixSelfInterwikis ( string articleText ) : string

Reformats self interwikis to be standard links. Only applies to self interwikis before other interwikis (i.e. those in body of article)

FixSmallTags ( string articleText ) : string

remove <small> in small, ref, sup, sub tags and images, but not within {{legend}} template CHECKWIKI errors 55, 63, 66, 77

FixSmallTagsME ( Match m ) : string
FixSmallTagsME2 ( Match m ) : string
FixSyntaxDefaultSort ( string articleText ) : string

Applies fixes to any DEFAULTSORT templates in the input text

FixSyntaxISBN ( string articleText, List ssbISBN ) : string
FixSyntaxSubstRefTagsME ( Match m ) : string
FixUnbalancedBrackets ( string articleText ) : string

Applies some fixes for unbalanced brackets, applied if there are unbalanced brackets

FixUnbalancedBracketsSection ( string articleText ) : string

Applies some fixes for unbalanced brackets, applied if there are unbalanced brackets Run at section level: allows unbalanced brackets in other sections not to affect correction of current section

FullYearRangeME ( Match m ) : string
GetAllTemplatesNew ( string articleText ) : List

Extracts a list of all templates used in the input text, supporting any level of template nesting. Template name given in first letter upper. Most performant version using HashSet.

GetCats ( string articleText ) : string

Returns a concatenated string of all categories in the article

GetNamedRefs ( string articleText ) : List

Extracts a list of all named refs, including condensed used in the input text

GetTemplates ( string articleText, Regex search ) : List

Finds all templates in article text excluding commented out/nowiki'd templates. Handles nested templates and templates with embedded HTML comments correctly.

GetUnnamedRefs ( string articleText ) : List

Extracts a list of all unnamed refs used in the input text

HumanDefaultSortCleanupRequired ( Match ds ) : bool

Returns whether human name defaultsort cleanup required: contains apostrophe or unspaced comma

LooseCategoryME ( Match m ) : string
MILaterSection ( string section, Regex Templates ) : string

Works on non-zeroth section of article Converts multiple issues with one issue -> single issue tag Puts other section maintenance tags inside existing MI, or adds MI if two or more section maintenance tags

MIZerothSection ( string zerothsection, Regex Templates ) : string

Merges multiple MI templates in zeroth section, if possible Converts multiple issues with one issue -> single issue tag Puts other maintenance tags inside existing MI, or adds MI if two or more tags

MergeMultipleMI ( string articleText ) : string

Merge multiple {{multiple issues}} templates in zeroth section into one

MergeTemplates ( string sectionText, string templateName ) : string

Merges all instances of the given template in the given section of the article, only when templates at top of section

MultipleIssuesDeDupe ( Match m ) : string

Deduplicates tags in multipleissues template calls (not section templates)

MultipleIssuesSingleTagME ( Match m ) : string

Converts new-style multiple issues template with one issue to standalone tag

MultipleIssuesZeroTag ( Match m ) : string

Removes multiple issues with zero tags, fix excess newlines

OnlyArticleBLPTemplateME ( Match m, string newTemplateName ) : string

Renames template if the only name arguments are BLP=, date= and article=, or there are no arguments

Parsers ( ) : System

PrepareTaggerEditSummary ( ) : string
ReferenceNameValid ( string articleText, string derivedReferenceName ) : bool

Checks the validity of a new reference name: Name at least 3 characters and not already used in article, not just 'http'

ReflistMatchEvaluator ( Match m ) : string
RefsBeforePunctuation ( string articleText ) : string
RefsTemplateIndex ( string articleText ) : int

Returns the index of the {{reflist}} or {{refs}} or <references> tags, or the articleText length if no tags found

RenameTemplateParametersHashSetME ( Match m, List RenamedTemplateParameters ) : string

Most performant RenameTemplateParameters MatchEvaluator using HashSets

ReorderRefs ( string articleText, Regex outofOrderRegex, int referencestagindex, int>.Dictionary NamedRefsIndexes ) : string

reorders references within the article text based on the input regular expression providing matches for references that are out of numerical order

SameMonthAmericanDateRangeME ( Match m ) : string
SameNamedRefShortText ( string articleText ) : string

refs with same name, but one is very short, so just change to <ref name=foo/> notation

SectionTemplateConversionsME ( Match m ) : string

Converts templates such as {{foo|section|...}} to {{foo section|...}}

SelfLinks ( string zerothSection, string articleTitle ) : string
SetAllTemplateRedirectsHashSet ( List RedirectsList ) : void

Sets the WikiRegexes .AllTemplateRedirects HashSet

SetPersonDataDate ( string personData, string field, string sourceValue, string articletext ) : string

Completes a persondata call with a date of birth/death.

SpacedFullYearRangeME ( Match m ) : string
SquareBracketsInExternalLinksME ( Match m ) : string

Fixes bracket problems within external links, converting internal [ or ] to [ or ] respectively

StubChecker ( Match m ) : string
TagEmptySection ( string articleText ) : string

Tags empty level-2 sections with {{Empty section}}, en-wiki mainspace only

TagOrphans ( string articleText, string articleTitle, bool restrictOrphanTagging ) : string

Tags pages with insufficient incoming page links with the orphan template (localised for ru-wiki). Removes orphan tag from pages with sufficient incoming page links. Disambig, SIA pages and soft redirects to Wictionary are never tagged as orphan.

TagRefsIbid ( string articleText ) : string

Tags references of 'ibid' with the {{ibid}} cleanup template, en-wiki mainspace only

TagUpdaterME ( Match m ) : string

Match evaluator for tag updater Tags undated tags, corrects incorrect template parameter names, removes template namespace in template name

TemplateCount ( List templatesFound, Regex r ) : int

Returns the count of matches for the given regex against the (first name upper) templates in the given list

TemplateRedirectsHashSet ( string articleText, string>.Dictionary TemplateRedirects ) : string

Most performant version of TemplateRedirects using HashSets

TemplateRedirectsME ( Match m, string newTemplateName ) : string
TotalRefsNotGrouped ( string arcticleText ) : int

Returns the number of <ref> references in the input text, excluding grouped refs

UnbalancedBrackets ( string articleText, string openingBrackets, string closingBrackets, Regex bracketsRegex ) : int

Checks the article text for unbalanced brackets of the input type

YearOfBirthDeathMissingCategory ( string articleText, string cats ) : string

Removes year of birth/death missing categories when xxx births/deaths category also present Removes Date of birth missing/Date of birth missing (living people) category if full DOB in {{birth date and age}}

YearRangeShortenedCenturyME ( Match m ) : string

Method Details

AddBackMoreText() public method

public AddBackMoreText ( string articleText ) : string
articleText string
return string

AddBackText() public method

public AddBackText ( string articleText ) : string
articleText string
return string

AddBackTextImages() public method

public AddBackTextImages ( string articleText ) : string
articleText string
return string

AddCategory() public method

Adds the category to the article.
public AddCategory ( string newCategory, string articleText, string articleTitle ) : string
newCategory string The new category.
articleText string The wiki text of the article.
articleTitle string Title of the article
return string

AddCategory() public method

Adds the category to the article.
public AddCategory ( string newCategory, string articleText, string articleTitle, bool &noChange ) : string
newCategory string The new category.
articleText string The wiki text of the article.
articleTitle string Title of the article
noChange bool
return string

AddMissingReflist() public static method

First checks for a <references< missing '/' to correct, otherwise: if the article uses cite references but has no recognised template to display the references, add {{Reflist}} in the appropriate place
public static AddMissingReflist ( string articleText ) : string
articleText string The wiki text of the article
return string

AmbigCiteTemplateDates() public static method

Returns whether the input article text contains ambiguous cite template dates in XX-XX-YYYY or XX-XX-YY format
public static AmbigCiteTemplateDates ( string articleText ) : int>.Dictionary
articleText string The article text to search
return int>.Dictionary

AmbiguousCiteTemplateDates() public static method

Returns whether the input article text contains ambiguous cite template dates in XX-XX-YYYY or XX-XX-YY format
public static AmbiguousCiteTemplateDates ( string articleText ) : bool
articleText string the article text to search
return bool

BadCiteParameters() public static method

Searches for unknown/invalid parameters within citation templates
public static BadCiteParameters ( string articleText ) : int>.Dictionary
articleText string the wiki text to search
return int>.Dictionary

BoldTitle() public method

'''Emboldens''' the first occurrence of the article title, if not already bold 1) Cleans up bolded self wikilinks 2) Cleans up self wikilinks 3) '''Emboldens''' the first occurrence of the article title
public BoldTitle ( string articleText, string articleTitle, bool &noChange ) : string
articleText string The wiki text of the article.
articleTitle string The title of the article.
noChange bool Value that indicated whether no change was made.
return string

BulletExternalLinks() public static method

Adds bullet points to external links after "external links" header
public static BulletExternalLinks ( string articleText ) : string
articleText string The wiki text of the article.
return string

BulletExternalLinks() public static method

Adds bullet points to external links after "external links" header
public static BulletExternalLinks ( string articleText, bool &noChange ) : string
articleText string The wiki text of the article.
noChange bool Value that indicated whether no change was made.
return string

CanonicalizeTitle() public static method

returns URL-decoded link target Handles titles from [[Category:Articles with underscores in the title]]
public static CanonicalizeTitle ( string title ) : string
title string
return string

CanonicalizeTitleAggressively() public static method

Turns a title into its canonical form, could be slow
public static CanonicalizeTitleAggressively ( string title ) : string
title string
return string

CanonicalizeTitleRaw() public static method

Performs URL-decoding of a page title, trimming all whitespace
public static CanonicalizeTitleRaw ( string title ) : string
title string
return string

CanonicalizeTitleRaw() public static method

performs URL-decoding of a page title
public static CanonicalizeTitleRaw ( string title, bool trim ) : string
title string title to normalise
trim bool whether whitespace should be trimmed
return string

CategoryMatch() public static method

Returns whether the input string matches the name of a category in use in the input article text string, based on a case insensitive match
public static CategoryMatch ( string articleText, string categoryName ) : bool
articleText string the article text
categoryName string name of the category
return bool

ChangeToDefaultSort() public static method

Changes an article to use defaultsort when all categories use the same sort field / cleans diacritics from defaultsort/categories
public static ChangeToDefaultSort ( string articleText, string articleTitle, bool &noChange ) : string
articleText string The wiki text of the article.
articleTitle string Title of the article
noChange bool If there is no change (True if no Change)
return string

ChangeToDefaultSort() public static method

Changes an article to use defaultsort when all categories use the same sort field / cleans diacritics from defaultsort/categories Skips pages using <noinclude>, <includeonly> etc.
public static ChangeToDefaultSort ( string articleText, string articleTitle, bool &noChange, bool restrictDefaultsortChanges ) : string
articleText string The wiki text of the article.
articleTitle string Title of the article
noChange bool If there is no change (True if no Change)
restrictDefaultsortChanges bool Prevent insertion of a new {{DEFAULTSORT}} as AWB may not always be right for articles about people
return string

CheckNoBots() public static method

checks if a user is allowed to edit this article using {{bots}} and {{nobots}} tags
public static CheckNoBots ( string articleText, string user ) : bool
articleText string The wiki text of the article.
user string Name of this user
return bool

CitationPublisherToWork() public static method

Where the publisher field is used incorrectly instead of the work field in a {{cite web}} or {{cite news}} citation convert the parameter to be 'work' Scenarios covered: * publisher == URL domain, no work= used
public static CitationPublisherToWork ( string citation ) : string
citation string the citation
return string

CiteTemplateDates() public static method

Corrects common formatting errors in dates in external reference citation templates (doesn't link/delink dates) note some incorrect date formats such as 3-2-2009 are ambiguous as could be 3-FEB-2009 or MAR-2-2009, these fixes don't address such errors
public static CiteTemplateDates ( string articleText ) : string
articleText string The wiki text of the article.
return string

CiteTemplateDates() public method

Corrects common formatting errors in dates in external reference citation templates (doesn't link/delink dates)
public CiteTemplateDates ( string articleText, bool &noChange ) : string
articleText string The wiki text of the article.
noChange bool
return string

Conversions() public static method

Converts/subst'd some deprecated templates
public static Conversions ( string articleText ) : string
articleText string The wiki text of the article.
return string

Conversions() public static method

Converts/subst'd some deprecated templates
public static Conversions ( string articleText, bool &noChange ) : string
articleText string The wiki text of the article.
noChange bool Value that indicated whether no change was made.
return string

Dablinks() public static method

Performs some cleanup operations on dablinks Merges some for & about dablinks Merges multiple distinguish into one
public static Dablinks ( string articleText ) : string
articleText string The article text
return string

DeadLinks() public static method

Searches for {{dead link}}s
public static DeadLinks ( string articleText ) : int>.Dictionary
articleText string The article text
return int>.Dictionary

DeduplicateMaintenanceTags() public static method

Deduplicates multiple maintenance tags. Uses earliest of date parameters, merges all other parameters. Does nothing if parameter values other than date parameter are conflicting
public static DeduplicateMaintenanceTags ( List tags ) : List
tags List Maintenance tags list
return List

DeriveReferenceName() public static method

Derives a name for a reference by searching for author names and dates, or website base URL etc.
public static DeriveReferenceName ( string articleText, string reference ) : string
articleText string text of article, to check the derived name is not already used for some other reference
reference string the value of the reference a name is needed for
return string

DeterminePredominantDateLocale() public static method

Determines the predominant date format in the article text (American/International), if available
public static DeterminePredominantDateLocale ( string articleText ) : DateLocale
articleText string the article text
return DateLocale

DeterminePredominantDateLocale() public static method

Determines the predominant date format in the article text (American/International/ISO), if available
public static DeterminePredominantDateLocale ( string articleText, bool considerISO ) : DateLocale
articleText string the article text
considerISO bool whether to consider ISO as a possible predominant date format
return DateLocale

DeterminePredominantDateLocale() public static method

Determines the predominant date format in the article text (American/International/ISO), if available
public static DeterminePredominantDateLocale ( string articleText, bool considerISO, bool explicitonly ) : DateLocale
articleText string the article text
considerISO bool whether to consider ISO as a possible predominant date format
explicitonly bool whether to restrict logic to look at {{use xxx dates}} template only
return DateLocale

DoublePipeLinks() public static method

Searches for wikilinks with double pipes
public static DoublePipeLinks ( string articleText ) : int>.Dictionary
articleText string The article text
return int>.Dictionary

DuplicateNamedReferences() public static method

Where an unnamed reference is a duplicate of another named reference, set the unnamed one to use the named ref Condenses repeated named reference, provided ref not declared within a template call Checks for instances of named references with same ref name having different values, does not modify article text in this case
public static DuplicateNamedReferences ( string articleText ) : string
articleText string The wiki text of the article.
return string

DuplicateUnnamedReferences() public static method

Derives and sets a reference name per [[WP:REFNAME]] for duplicate <ref>s Then condenses repeated uses of the named reference
public static DuplicateUnnamedReferences ( string articleText ) : string
articleText string the text of the article
return string

ExternalURLToInternalLink() public static method

Converts external links to Wikimedia projects into internal links
public static ExternalURLToInternalLink ( string articleText ) : string
articleText string The wiki text of the article.
return string

ExtractCOinS() public static method

Returns a dictionary of COinS parameter and value from the input text Only first set of COinS data is processed
public static ExtractCOinS ( string text ) : string>.Dictionary
text string Raw HTML containing COinS data
return string>.Dictionary

FixBrParagraphs() public method

Remove <br />'s where not needed
public FixBrParagraphs ( string articleText ) : string
articleText string
return string

FixCategories() public static method

Fix common spacing/capitalisation errors in categories; remove diacritics and trailing whitespace from sortkeys (not leading whitespace)
public static FixCategories ( string articleText ) : string
articleText string The wiki text of the article.
return string

FixCitationTemplates() public static method

Applies various formatting fixes to citation templates
public static FixCitationTemplates ( string articleText ) : string
articleText string The wiki text of the article.
return string

FixDateOrdinalsAndOf() public method

Removes ordinals, leading zeros from dates and 'of' between a month and a year, per [[WP:MOSDATE]]; on en wiki only
public FixDateOrdinalsAndOf ( string articleText, string articleTitle ) : string
articleText string The wiki text of the article
articleTitle string The article's title
return string

FixDatesA() public method

Fix date and decade formatting errors: commas in American/international dates, full date ranges, month ranges
public FixDatesA ( string articleText ) : string
articleText string
return string

FixDatesB() public method

Fix date and decade formatting errors: date/year ranges to present, full year ranges, performs floruit term wikilinking
public FixDatesB ( string articleText, bool CircaLink, bool Floruit ) : string
articleText string
CircaLink bool
Floruit bool
return string

FixEmptyLinksAndTemplates() public static method

Removes Empty Links and Template Links Will Cater for [[]], [[Image:]], [[:Category:]], [[Category:]] and {{}}
public static FixEmptyLinksAndTemplates ( string articleText ) : string
articleText string The wiki text of the article.
return string

FixHeadings() public static method

Fix ==See also== and similar section common errors. Removes unecessary introductory headings and cleans excess whitespace (but not the optional single space at the start & end of headings).
public static FixHeadings ( string articleText, string articleTitle ) : string
articleText string The wiki text of the article.
articleTitle string the title of the article
return string

FixHeadings() public static method

Fix ==See also== and similar section common errors.
public static FixHeadings ( string articleText, string articleTitle, bool &noChange ) : string
articleText string The wiki text of the article.
articleTitle string the title of the article
noChange bool Value that indicates whether no change was made.
return string

FixImages() public static method

Fix common spacing/capitalisation errors in images
public static FixImages ( string articleText ) : string
articleText string The wiki text of the article.
return string

FixLinkWhitespace() public static method

Fix leading, trailing and middle spaces in Wikilinks
public static FixLinkWhitespace ( string articleText, string articleTitle ) : string
articleText string The wiki text of the article
articleTitle string The article title.
return string

FixLinks() public static method

Fixes link syntax, including removal of self links. Underscores not removed from link where page in [[Category:Articles with underscores in the title]]
public static FixLinks ( string articleText, string articleTitle, bool &noChange ) : string
articleText string The wiki text of the article.
articleTitle string Title of the article
noChange bool Value that indicated whether no change was made.
return string

FixLivingThingsRelatedDates() public static method

Replace b. and d. for born/died, or date– for born per [[WP:BORN]]
public static FixLivingThingsRelatedDates ( string articleText ) : string
articleText string The wiki text of the article.
return string

FixMainArticle() public static method

Fixes instances of ''Main Article: xxx'' to use {{main|xxx}}, ''see also:'' to use {{see also|xxx}}
public static FixMainArticle ( string articleText ) : string
articleText string The wiki text of the article.
return string

FixNonBreakingSpaces() public method

Apply non-breaking spaces for abbreviated SI units, imperial units, pp for pages. Remove incorrect space before % symbol
public FixNonBreakingSpaces ( string articleText ) : string
articleText string The wiki text of the article.
return string

FixPeopleCategories() public static method

Adds [[Category:XXXX births]], [[Category:XXXX deaths]] to articles about people where available, for en-wiki only
public static FixPeopleCategories ( string articleText, string articleTitle ) : string
articleText string The wiki text of the article.
articleTitle string Title of the article
return string

FixPeopleCategories() public static method

Adds [[Category:XXXX births]], [[Category:XXXX deaths]] to articles about people where available, for en-wiki only When page is not mainspace, adds [[:Category rather than [[Category Removes Date of birth missing/Date of birth missing (living people) category if full DOB in {{birth date and age}}
public static FixPeopleCategories ( string articleText, string articleTitle, bool parseTalkPage ) : string
articleText string The wiki text of the article.
articleTitle string Title of the article
parseTalkPage bool
return string

FixPeopleCategories() public method

Adds [[Category:XXXX births]], [[Category:XXXX deaths]] to articles about people where available, for en-wiki only
public FixPeopleCategories ( string articleText, string articleTitle, bool parseTalkPage, bool &noChange ) : string
articleText string The wiki text of the article.
articleTitle string Title of the article
parseTalkPage bool
noChange bool
return string

FixReferenceListTags() public static method

Replaces various old reference tag formats, with the new {{Reflist}}, or <references/> for sv-wiki
public static FixReferenceListTags ( string articleText ) : string
articleText string The wiki text of the article
return string

FixReferenceTags() public static method

Various fixes to the formatting of <ref> reference tags including case conversion and trimming excess whitespace
public static FixReferenceTags ( string articleText ) : string
articleText string The wiki text of the article
return string

FixSyntax() public static method

Fixes and improves syntax (such as html markup)
public static FixSyntax ( string articleText ) : string
articleText string The wiki text of the article.
return string

FixSyntax() public static method

Fixes and improves syntax (such as html markup)
public static FixSyntax ( string articleText, bool &noChange ) : string
articleText string The wiki text of the article.
noChange bool Value that indicated whether no change was made.
return string

FixSyntaxRedirects() public static method

Performs fixes to redirect pages: * removes newline between #REDIRECT and link (CHECKWIKI error 36) * removes equals sign and double dot between #REDIRECT and link (CHECKWIKI error 36) * Template to Magic word conversion; removes unnecessary brackets around redirect * Simple closing bracket fixing to {{R...}} templates
public static FixSyntaxRedirects ( string articleText ) : string
articleText string
return string

FixSyntaxSubstRefTags() public static method

workaround for https://phabricator.wikimedia.org/T4700 -- {{subst:}} doesn't work within ref tags
public static FixSyntaxSubstRefTags ( string articleText ) : string
articleText string
return string

FixTemperatures() public static method

Fix bad Temperatures
public static FixTemperatures ( string articleText ) : string
articleText string The wiki text of the article.
return string

FixUnicode() public method

Performs transformations related to Unicode characters that may cause problems for different clients Removes line separator Unicode characters at start of paragraph, otherwise converts line separator, paragraph separator Unicode characters to spaces.
public FixUnicode ( string articleText ) : string
articleText string
return string

FormatToBDA() public static method

takes input string of date and age e.g. "11 May 1990 (age 21)" and converts to {{birth date and age|1990|5|11}}
public static FormatToBDA ( string dateandage ) : string
dateandage string
return string

GetAllTemplateDetail() public static method

Extracts a distinct list of all template calls in the input text, supporting any level of template nesting.
public static GetAllTemplateDetail ( string articleText ) : List
articleText string
return List

GetAllTemplates() public static method

Extracts a list of all templates used in the input text, supporting any level of template nesting. Template name given in first letter upper
public static GetAllTemplates ( string articleText ) : List
articleText string
return List

GetAllWikiLinks() public static method

Extracts a list of all wikilinks (all including cats, images etc.) used in the input text
public static GetAllWikiLinks ( string articleText ) : List
articleText string
return List

GetCategorySort() public static method

Returns the sortkey used by all categories, if * all categories use the same sortkey * no {{DEFAULTSORT}} in article Otherwise returns null
public static GetCategorySort ( string articleText ) : string
articleText string The wiki text of the article.
return string

GetCategorySort() public static method

Returns the sortkey used by all categories, if all categories use the same sortkey Where no sortkey is used for all categories, returns the articletitle
public static GetCategorySort ( string articleText, string articleTitle, int &matches ) : string
articleText string The wiki text of the article.
articleTitle string Title of the article
matches int Number of categories with the same or no sortkey
return string

GetInfoBoxFieldValue() public static method

Returns the value of the given fields from the page's infobox, where available Returns a null string if the input article has no infobox, or the input field regex doesn't match on the infobox found
public static GetInfoBoxFieldValue ( string articleText, List fields ) : string
articleText string The wiki text of the article.
fields List List of infobox fields to search
return string

GetInfoBoxFieldValue() public static method

Returns the value of the given field from the page's infobox, where available Returns a null string if the input article has no infobox, or the input field regex doesn't match on the infobox found
public static GetInfoBoxFieldValue ( string articleText, string field ) : string
articleText string The wiki text of the article.
field string infobox field to search
return string

GetTemplate() public static method

Finds first occurrence of a given template in article text. Handles nested templates correctly.
public static GetTemplate ( string articleText, string template ) : string
articleText string Source text
template string Name of template, can be regex without a group capture
return string

GetTemplates() public static method

Finds all templates in article text excluding commented out/nowiki'd templates. Handles nested templates and templates with embedded HTML comments correctly.
public static GetTemplates ( string articleText ) : List
articleText string Source text
return List

GetTemplates() public static method

Finds every occurrence of a given template in article text, excludes commented out/nowiki'd templates Handles nested templates and templates with embedded HTML comments correctly.
public static GetTemplates ( string articleText, string template ) : List
articleText string Source text
template string Name of template
return List

HasBareReferences() public static method

Returns true if the article contains bare external links in the references section (just the URL link on a line with no description/name)
public static HasBareReferences ( string articleText ) : bool
articleText string The wiki text of the article.
return bool

HasDeadLinks() public static method

Returns whether the input article text contains any {{dead link}} templates, ignoring comments
public static HasDeadLinks ( string articleText ) : bool
articleText string The wiki text of the article.
return bool

HasDoublePipeLinks() public static method

Returns whether the input article text contains any wikilinks with double pipes
public static HasDoublePipeLinks ( string articleText ) : bool
articleText string The wiki text of the article.
return bool

HasInfobox() public static method

Checks if the article has an InfoBox (en wiki)
public static HasInfobox ( string articleText ) : bool
articleText string
return bool

HasMorefootnotesAndManyReferences() public static method

Check if the article contains a {{no footnotes}} or {{more footnotes}} template but has 5+ <ref>...</ref> references
public static HasMorefootnotesAndManyReferences ( string articleText ) : bool
articleText string
return bool

HasNamedReferences() public static method

Checks for named references in short format <ref name=foo />
public static HasNamedReferences ( string articleText ) : bool
articleText string The article text
return bool

HasRefAfterReflist() public static method

Check if the article contains a <ref>...</ref> reference after the {{reflist}} to show them
public static HasRefAfterReflist ( string articleText ) : bool
articleText string
return bool

HasSeeAlsoAfterNotesReferencesOrExternalLinks() public static method

Checks position of See also section relative to Notes, references, external links sections
public static HasSeeAlsoAfterNotesReferencesOrExternalLinks ( string articleText ) : bool
articleText string The article text
return bool

HasSicTag() public static method

Check if the article contains a sic template or bracketed wording, indicating the presence of a deliberate typo
public static HasSicTag ( string articleText ) : bool
articleText string
return bool

HasStubTemplate() public static method

Checks if the article has a stub template
public static HasStubTemplate ( string articleText ) : bool
articleText string
return bool

HasTargetLessLinks() public static method

Returns whether the input article text contains any wikilinks with no target
public static HasTargetLessLinks ( string articleText ) : bool
articleText string The wiki text of the article.
return bool

HideMoreText() public method

public HideMoreText ( string articleText ) : string
articleText string
return string

HideMoreText() public method

public HideMoreText ( string articleText, bool hideOnlyTargetOfWikilink ) : string
articleText string
hideOnlyTargetOfWikilink bool
return string

HideText() public method

public HideText ( string articleText ) : string
articleText string
return string

HideTextImages() public method

public HideTextImages ( string articleText ) : string
articleText string
return string

InterwikiConversions() public static method

Replaces legacy/deprecated language codes in interwikis with correct ones
public static InterwikiConversions ( string articleText ) : string
articleText string
return string

InterwikiConversions() public static method

Replaces legacy/deprecated language codes in interwikis with correct ones
public static InterwikiConversions ( string articleText, bool &noChange ) : string
articleText string
noChange bool
return string

IsArticleAboutAPerson() public static method

determines whether the article is about a person by looking for persondata/birth death categories, bio stub etc. for en wiki only
public static IsArticleAboutAPerson ( string articleText, string articleTitle ) : bool
articleText string The wiki text of the article.
articleTitle string Title of the article
return bool

IsArticleAboutAPerson() public static method

determines whether the article is about a person by looking for persondata/birth death categories, bio stub etc. for en wiki only Should only return true if the article is the principle article about the individual (not early life/career/discography etc.)
public static IsArticleAboutAPerson ( string articleText, string articleTitle, bool parseTalkPage ) : bool
articleText string The wiki text of the article.
articleTitle string Title of the article
parseTalkPage bool
return bool

IsInUse() public static method

Check if article has an 'in use' or 'in creation' tag
public static IsInUse ( string articleText ) : bool
articleText string
return bool

IsMissingReferencesDisplay() public static method

Check if the article uses cite references but has no recognised template to display the references; only for en-wiki
public static IsMissingReferencesDisplay ( string articleText ) : bool
articleText string
return bool

IsStub() public static method

Checks if the article is classible as a 'Stub'
public static IsStub ( string articleText ) : bool
articleText string
return bool

LivingPeople() public static method

Adds [[Category:Living people]] to articles with a [[Category:XXXX births]] and no living people/deaths category, taking sortkey from births category if present When page is not mainspace, adds [[:Category rather than [[Category
public static LivingPeople ( string articleText, string articleTitle ) : string
articleText string The wiki text of the article.
articleTitle string The page title of the article.
return string

LivingPeople() public static method

Adds [[Category:Living people]] to articles with a [[Category:XXXX births]] and no living people/deaths category, taking sortkey from births category if present
public static LivingPeople ( string articleText, string articleTitle, bool &noChange ) : string
articleText string The wiki text of the article.
articleTitle string The page title of the article.
noChange bool
return string

LoadDatedTemplates() public static method

Processes the text of [[WP:AWB/Dated templates]] into a list of template names Format: * {{tl|Wikify}}
public static LoadDatedTemplates ( string text ) : List
text string The rule page text
return List

LoadRenamedTemplateParameters() public static method

Loads List of templates (first letter lower), old parameter, new parameter from within {{AWB rename template parameter}}
public static LoadRenamedTemplateParameters ( string text ) : List
text string Source page of {{AWB rename template parameter}} rules
return List

LoadTemplateRedirects() public static method

Processes the text of [[WP:AWB/Template redirects]] into a dictionary of regexes and new template names Format: {{tl|template 1}}, {{tl|template 2}} → {{tl|actual template}}
public static LoadTemplateRedirects ( string text ) : string>.Dictionary
text string
return string>.Dictionary

Mdashes() public method

Replaces hyphens and em-dashes with en-dashes, per [[WP:DASH]]
public Mdashes ( string articleText, string articleTitle ) : string
articleText string The wiki text of the article.
articleTitle string The article's title
return string

MergePortals() public static method

Merges multiple {{portal}} templates into a single one, removing any duplicates. En-wiki only. Restricted to {{portal}} calls with one argument Article must have existing {{portal}} and/or a 'see also' section
public static MergePortals ( string articleText ) : string
articleText string The article text
return string

MergeTemplatesBySection() public static method

Merges multiple instances of the same template in the same section
public static MergeTemplatesBySection ( string articleText ) : string
articleText string The article text
return string

MissingDefaultSort() public static method

Returns whether the article is missing a defaultsort (i.e. criteria match so that defaultsort would be added)
public static MissingDefaultSort ( string articletext, string articletitle ) : bool
articletext string
articletitle string
return bool

MultipleIssues() public method

Combines maintenance tags into {{multiple issues}} template, for en-wiki only Operates on a section by section basis through article text
public MultipleIssues ( string articleText ) : string
articleText string
return string

NoIncludeIncludeOnlyProgrammingElement() public static method

Returns whether the article text has a <noinclude> or <includeonly> or '{{{1}}}' etc. which should not appear on the mainspace
public static NoIncludeIncludeOnlyProgrammingElement ( string articleText ) : bool
articleText string The wiki text of the article.
return bool

Parsers() public method

Re-organises the Person Data, stub/disambig templates, categories and interwikis
public Parsers ( int stubWordCount, bool addHumanKey ) : System
stubWordCount int The number of maximum number of words for a stub.
addHumanKey bool
return System

PersonData() public static method

* Adds the default {{persondata}} template to en-wiki mainspace pages about a person that don't already have {{persondata}} * Attempts to complete blank {{persondata}} fields based on infobox values
public static PersonData ( string articleText, string articleTitle ) : string
articleText string The wiki text of the article.
articleTitle string Title of the article
return string

PredominantDates() public static method

Updates dates in citation templates to use the strict predominant date format in the article (en wiki only)
public static PredominantDates ( string articleText ) : string
articleText string The article text
return string

ReCategoriser() public static method

Re-categorises the article.
public static ReCategoriser ( string oldCategory, string newCategory, string articleText, bool &noChange ) : string
oldCategory string The old category to replace.
newCategory string The new category.
articleText string The wiki text of the article.
noChange bool Value that indicated whether no change was made.
return string

ReCategoriser() public static method

Re-categorises the article.
public static ReCategoriser ( string oldCategory, string newCategory, string articleText, bool &noChange, bool removeSortKey ) : string
oldCategory string The old category to replace.
newCategory string The new category.
articleText string The wiki text of the article.
noChange bool Value that indicated whether no change was made.
removeSortKey bool If set, any sort key is removed when the category is replaced
return string

RedirectTagger() public static method

For en-wiki tags redirect pages with one or more of the templates from [[Wikipedia:Template messages/Redirect pages]] following [[WP:REDCAT]]
public static RedirectTagger ( string articleText, string articleTitle ) : string
articleText string the article text
articleTitle string the article title
return string

RefsAfterPunctuation() public static method

Puts <ref> and {{sfn}} references after punctuation (comma, full stop) per WP:REFPUNC Applies to en/el wiki only
public static RefsAfterPunctuation ( string articleText ) : string
articleText string The article text
return string

RegularCategories() public static method

Returns the categories that are not stub or proposed deletion categories from the input list
public static RegularCategories ( List
AllCategories ) : List
AllCategories List
List of all categories
return List

RegularCategories() public static method

Returns the categories that are not stub or proposed deletion categories from the input article text
public static RegularCategories ( string articleText ) : List
articleText string Wiki text
return List

RegularCategories() public static method

Returns the categories that are not stub or proposed deletion categories from the input article text
public static RegularCategories ( string articleText, bool hideComments ) : List
articleText string Wiki text
hideComments bool
return List

RemoveAllWhiteSpace() public static method

Applies removes all excess whitespace from the article Not called by general fixes
public static RemoveAllWhiteSpace ( string articleText ) : string
articleText string The wiki text of the article.
return string

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

RemoveCategory() public static method

Removes a category from an article.
public static RemoveCategory ( string strOldCat, string articleText, bool &noChange ) : string
strOldCat string The old category to remove.
articleText string The wiki text of the article.
noChange bool Value that indicated whether no change was made.
return string

RemoveDuplicateWikiLinks() public static method

Remove some of the duplicated wikilinks from the article text
public static RemoveDuplicateWikiLinks ( string articleText ) : string
articleText string The wiki text of the article.
return string

RemoveEmptyComments() public static method

Removes HTML comments with nothing/only whitespace between tags
public static RemoveEmptyComments ( string articleText ) : string
articleText string The wiki text of the article.
return string

RemoveImage() public static method

Removes an image from the article.
public static RemoveImage ( string image, string articleText, bool commentOut, string comment ) : string
image string The image to remove.
articleText string The wiki text of the article.
commentOut bool
comment string
return string

RemoveImage() public static method

Removes an image in the article.
public static RemoveImage ( string image, string articleText, bool commentOut, string comment, bool &noChange ) : string
image string The image to remove.
articleText string The wiki text of the article.
commentOut bool
comment string
noChange bool Value that indicated whether no change was made.
return string

RemoveTemplateNamespace() public static method

Removes Template: (or equivalent translation) from start of template calls, canonicalizes template names
public static RemoveTemplateNamespace ( string articleText ) : string
articleText string The wiki article text
return string

RemoveWhiteSpace() public static method

Applies/removes some excess whitespace from the article
public static RemoveWhiteSpace ( string articleText ) : string
articleText string The wiki text of the article.
return string

RemoveWhiteSpace() public static method

Applies/removes some excess whitespace from the article
public static RemoveWhiteSpace ( string articleText, bool fixOptionalWhitespace ) : string
articleText string The wiki text of the article.
fixOptionalWhitespace bool Whether to remove cosmetic whitespace
return string

RenameTemplateParameters() public static method

Renames parameters in template calls. Does not rename old to new if new paramter already in use with a value
public static RenameTemplateParameters ( string articleText, List RenamedTemplateParameters ) : string
articleText string The wiki text
RenamedTemplateParameters List List of templates, old parameter, new parameter
return string

ReorderReferences() public static method

Reorders references so that they appear in numerical order, allows for use of {{rp}}, doesn't modify grouped references [[WP:REFGROUP]]
public static ReorderReferences ( string articleText ) : string
articleText string The wiki text of the article.
return string

ReplaceImage() public static method

Replaces an image in the article.
public static ReplaceImage ( string oldImage, string newImage, string articleText ) : string
oldImage string The old image to replace.
newImage string The new image.
articleText string The wiki text of the article.
return string

ReplaceImage() public static method

Replaces an image in the article.
public static ReplaceImage ( string oldImage, string newImage, string articleText, bool &noChange ) : string
oldImage string The old image to replace.
newImage string The new image.
articleText string The wiki text of the article.
noChange bool Value that indicated whether no change was made.
return string

SameRefDifferentName() public static method

Corrects named references where the reference text is the same but the reference name is different
public static SameRefDifferentName ( string articleText ) : string
articleText string the wiki text of the page
return string

SimplifyLinks() public static method

Simplifies some links in article wiki text such as changing [[Dog|Dogs]] to [[Dog]]s Fixes CHECKWIKI error 64
public static SimplifyLinks ( string articleText ) : string
articleText string The wiki text of the article.
return string

SimplifyReferenceTags() public static method

Replaces reference tags in the form <ref name="blah"></ref> with <ref name="blah" /> Removes some of the MW errors that occur from the prior
public static SimplifyReferenceTags ( string articleText ) : string
articleText string The wiki text of the article
return string

SortMetaData() public method

Re-organises the Person Data, stub/disambig templates, categories and interwikis except when a mainspace article has some 'includeonly' tags etc.
public SortMetaData ( string articleText, string articleTitle ) : string
articleText string The wiki text of the article.
articleTitle string The article title.
return string

SortMetaData() public method

Re-organises the Person Data, stub/disambig templates, categories and interwikis except when a mainspace article has some 'includeonly' tags etc.
public SortMetaData ( string articleText, string articleTitle, bool fixOptionalWhitespace ) : string
articleText string The wiki text of the article.
articleTitle string The article title.
fixOptionalWhitespace bool Whether to request optional excess whitespace to be fixed
return string

StickyLinks() public static method

Joins nearby words with links e.g. "[[Russian literature|Russian]] literature" to "[[Russian literature]]"
public static StickyLinks ( string articleText ) : string
articleText string The wiki text of the article
return string

SubstUserTemplates() public static method

Substitutes some user talk templates
public static SubstUserTemplates ( string talkPageText, string talkPageTitle, Regex userTalkTemplatesRegex ) : string
talkPageText string The wiki text of the talk page.
talkPageTitle string The wiki talk page title
userTalkTemplatesRegex Regex Dictoinary of regexes matching template calls to substitute
return string

TagUpdater() public static method

Sets the date (month & year) for undated cleanup tags that take a date, from https://en.wikipedia.org/wiki/Wikipedia:AWB/Dated_templates Avoids changing tags in unformatted text areas (wiki comments etc.) Note: https://phabricator.wikimedia.org/T4700 means {{subst:}} within ref tags doesn't work, AWB doesn't do anything about it
public static TagUpdater ( string articleText ) : string
articleText string The wiki text of the article.
return string

Tagger() public method

If necessary, adds/removes various cleanup tags such as wikify, stub, ibid
public Tagger ( string articleText, string articleTitle, bool restrictOrphanTagging, bool &noChange, string &summary ) : string
articleText string
articleTitle string
restrictOrphanTagging bool
noChange bool
summary string
return string

Tagger() public method

If necessary, adds/removes wikify or stub tag
public Tagger ( string articleText, string articleTitle, bool restrictOrphanTagging, string &summary ) : string
articleText string The wiki text of the article.
articleTitle string The article title.
restrictOrphanTagging bool
summary string
return string

TaggerPermitted() public static method

Checks whether Tagger is permitted on article. Allowed on mainspace for non-redirect pages without {{wi}} template Also allowed for ar-wiki namespace 104
public static TaggerPermitted ( string articleText, string articleTitle ) : bool
articleText string Article text
articleTitle string Article title
return bool

TargetLessLinks() public static method

Searches for wikilinks with no target e.g. [[|foo]]
public static TargetLessLinks ( string articleText ) : int>.Dictionary
articleText string The article text
return int>.Dictionary

TemplateExists() public static method

Returns whether the given regex matches any of the (first name upper) templates in the given list
public static TemplateExists ( List templatesFound, Regex r ) : bool
templatesFound List
r Regex
return bool

TemplateRedirects() public static method

Renames templates to bypass template redirects from [[WP:AWB/Template redirects]] The first letter casing of the existing redirect is kept in the new template name, except for acronym templates where first letter uppercase is enforced Calls TemplateToMagicWord if changes made
public static TemplateRedirects ( string articleText, string>.Dictionary DictionaryOfTemplateRedirects ) : string
articleText string the page text
DictionaryOfTemplateRedirects string>.Dictionary Dictionary of redirects and templates
return string

UnbalancedBrackets() public static method

Checks the article text for unbalanced brackets, either square or curly
public static UnbalancedBrackets ( string articleText, int &bracketLength ) : int
articleText string The wiki text of the article.
bracketLength int integer to hold length of unbalanced bracket found
return int

UnclosedTags() public static method

Searches for any unclosed <math>, <source>, <ref>, <code>, <nowiki>, <small>, <pre> <center> <sup> <sub> or <gallery> tags and comments
public static UnclosedTags ( string articleText ) : int>.Dictionary
articleText string The article text
return int>.Dictionary

Unicodify() public method

Converts HTML entities to unicode, with some deliberate exceptions Does not change 5-character HTML hex entities
public Unicodify ( string articleText ) : string
articleText string The wiki text of the article.
return string

Unicodify() public method

Converts HTML entities to unicode, with some deliberate exceptions
public Unicodify ( string articleText, bool &noChange ) : string
articleText string The wiki text of the article.
noChange bool Value that indicated whether no change was made.
return string

UserSignature() public static method

Searches for link to user and/or user talk namespace
public static UserSignature ( string articleText ) : int>.Dictionary
articleText string The article text
return int>.Dictionary

Property Details

StubMaxWordCount public static property

public static int StubMaxWordCount
return int