C# Class WikiFunctions.Parse.MetaDataSorter

Show file Open project: reedy/AutoWikiBrowser Class Usage Examples

Public Properties

Property Type Description
PossibleInterwikis List

Public Methods

Method Description
IWMatchEval ( Match match ) : string

Interwikis ( string &articleText ) : string

Extracts all of the interwiki featured article and interwiki links from the article text Ignores interwikis in comments/nowiki tags

Interwikis ( string &articleText, bool linkFGAsInText ) : string

Extracts all of the interwiki featured article and interwiki links from the article text Ignores interwikis in comments/nowiki tags

MetaDataSorter ( ) : System
MoveExternalLinks ( string articleText ) : string

Ensures the external links section of an article is after the references section

MoveMaintenanceTags ( string articleText ) : string

Moves maintenance tags to the top of the article text. Deduplicates identical tags Does not move tags when only non-infobox templates are above the last tag For en-wiki apply this to zeroth section of article only

MoveMultipleIssues ( string articleText ) : string

Moves multiple issues template to the top of the article text. Does not move tags when only non-infobox templates are above the last tag For en-wiki apply this to zeroth section of article only

MovePortalTemplates ( string articleText ) : string

Moves any {{XX portal}} templates to the 'see also' section, if present (en only), per Template:Portal

MoveSeeAlso ( string articleText ) : string

Moves the 'see also' section to be above the 'references' section, subject to the limitation that the 'see also' section can't be the last level-2 section. Does not move section when two or more references sections in the same article

MoveSisterlinks ( string articleText ) : string

Moves sisterlinks such as {{wiktionary}} to the external links section

MoveTemplate ( string articleText, Regex templateRegex ) : string

Moves matching templates in the zeroth section to the top of the article (en only)

MoveTemplateToReferencesSection ( string articleText, Regex templateRegex ) : string

Moves the given template(s) from anywhere in the article to the references section.

MoveTemplateToReferencesSection ( string articleText, Regex TemplateRegex, bool onlyfromzerothsection ) : string

Moves given template to the references section from the zeroth section, if present (en only)

MoveTemplateToSeeAlsoSection ( string articleText, Regex TemplateToMove ) : string

Moves template calls to the top of the "see also" section of the article

RemoveCats ( string &articleText, string articleTitle ) : string

Extracts DEFAULTSORT + categories from the article text; removes duplicate categories, cleans whitespace and underscores

RemoveDisambig ( string &articleText ) : string

Removes any disambiguation templates from the article text, to be added at bottom later

RemovePersonData ( string &articleText ) : string

Extracts the persondata template from the articleText, along with the persondata comment, if present on the line before

RemoveStubs ( string &articleText ) : string

Extracts stub templates from the article text

Private Methods

Method Description
CatKeyer ( IEnumerable list, string name ) : List

Key ( string what ) : string

ListToString ( ICollection items ) : string

Remove duplicates, and return List as string, one item per line

Load ( string what ) : List

LoadInterWikiFromCache ( ) : bool

Loads interwikis from local disk cache if available

LoadInterWikiFromNetwork ( ) : void

MoveTemplateToSection ( string articleText, Regex templateRegex, int section ) : string

Moves the given template(s) to the required section.

RemExtra ( string input ) : string

RemoveInterWikis ( string &articleText ) : List

Extracts all of the interwiki links from the article text, handles comments beside interwiki links (not inline comments)

RemoveLinkFGAs ( string &articleText ) : List

Gets a list of Link FA/GA's from the article

SaveInterWikiToCache ( ) : void

Sort ( string articleText, string articleTitle ) : string

Sorts article meta data, including optional whitespace fixing

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

Sorts article meta data

TemplateExists ( List templatesFound, Regex r ) : bool

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

Method Details

IWMatchEval() public static method

public static IWMatchEval ( Match match ) : string
match System.Text.RegularExpressions.Match
return string

Interwikis() public method

Extracts all of the interwiki featured article and interwiki links from the article text Ignores interwikis in comments/nowiki tags
public Interwikis ( string &articleText ) : string
articleText string Article text with interwiki and interwiki featured article links removed
return string

Interwikis() public method

Extracts all of the interwiki featured article and interwiki links from the article text Ignores interwikis in comments/nowiki tags
public Interwikis ( string &articleText, bool linkFGAsInText ) : string
articleText string Article text with interwiki and interwiki featured article links removed
linkFGAsInText bool
return string

MetaDataSorter() public method

public MetaDataSorter ( ) : System
return System

MoveExternalLinks() public static method

Ensures the external links section of an article is after the references section
public static MoveExternalLinks ( string articleText ) : string
articleText string The wiki text of the article.
return string

MoveMaintenanceTags() public static method

Moves maintenance tags to the top of the article text. Deduplicates identical tags Does not move tags when only non-infobox templates are above the last tag For en-wiki apply this to zeroth section of article only
public static MoveMaintenanceTags ( string articleText ) : string
articleText string the article text
return string

MoveMultipleIssues() public static method

Moves multiple issues template to the top of the article text. Does not move tags when only non-infobox templates are above the last tag For en-wiki apply this to zeroth section of article only
public static MoveMultipleIssues ( string articleText ) : string
articleText string the article text
return string

MovePortalTemplates() public static method

Moves any {{XX portal}} templates to the 'see also' section, if present (en only), per Template:Portal
public static MovePortalTemplates ( string articleText ) : string
articleText string The wiki text of the article.
return string

MoveSeeAlso() public static method

Moves the 'see also' section to be above the 'references' section, subject to the limitation that the 'see also' section can't be the last level-2 section. Does not move section when two or more references sections in the same article
public static MoveSeeAlso ( string articleText ) : string
articleText string The wiki text of the article.
return string

MoveSisterlinks() public static method

Moves sisterlinks such as {{wiktionary}} to the external links section
public static MoveSisterlinks ( string articleText ) : string
articleText string The article text
return string

MoveTemplate() public static method

Moves matching templates in the zeroth section to the top of the article (en only)
public static MoveTemplate ( string articleText, Regex templateRegex ) : string
articleText string The wiki text of the article.
templateRegex System.Text.RegularExpressions.Regex Regex matching the templates to be moved
return string

MoveTemplateToReferencesSection() public static method

Moves the given template(s) from anywhere in the article to the references section.
public static MoveTemplateToReferencesSection ( string articleText, Regex templateRegex ) : string
articleText string /// Article text. ///
templateRegex System.Text.RegularExpressions.Regex /// Regex to match the template(s) to be moved ///
return string

MoveTemplateToReferencesSection() public static method

Moves given template to the references section from the zeroth section, if present (en only)
public static MoveTemplateToReferencesSection ( string articleText, Regex TemplateRegex, bool onlyfromzerothsection ) : string
articleText string The wiki text of the article.
TemplateRegex System.Text.RegularExpressions.Regex A Regex to match the template to move
onlyfromzerothsection bool Whether to check only the zeroth section of the article for the template
return string

MoveTemplateToSeeAlsoSection() public static method

Moves template calls to the top of the "see also" section of the article
public static MoveTemplateToSeeAlsoSection ( string articleText, Regex TemplateToMove ) : string
articleText string The article text
TemplateToMove System.Text.RegularExpressions.Regex The template calls to move
return string

RemoveCats() public method

Extracts DEFAULTSORT + categories from the article text; removes duplicate categories, cleans whitespace and underscores
public RemoveCats ( string &articleText, string articleTitle ) : string
articleText string The wiki text of the article.
articleTitle string Title of the article
return string

RemoveDisambig() public static method

Removes any disambiguation templates from the article text, to be added at bottom later
public static RemoveDisambig ( string &articleText ) : string
articleText string The wiki text of the article.
return string

RemovePersonData() public static method

Extracts the persondata template from the articleText, along with the persondata comment, if present on the line before
public static RemovePersonData ( string &articleText ) : string
articleText string The wiki text of the article.
return string

RemoveStubs() public static method

Extracts stub templates from the article text
public static RemoveStubs ( string &articleText ) : string
articleText string The wiki text of the article.
return string

Property Details

PossibleInterwikis public property

public List PossibleInterwikis
return List