ws.checkers.WikilinkChecker module

class ws.checkers.WikilinkChecker.WikilinkChecker(api, db, **kwargs)

Bases: ws.checkers.CheckerBase.CheckerBase

Assumptions:

  • all titles are case-insensitive on the first letter (true on ArchWiki)

  • alternative text is intentional, no replacements there

skip_templates = ['accuracy', 'archive', 'bad translation', 'expansion', 'laptop style', 'merge', 'move', 'out of date', 'remove', 'stub', 'style', 'translateme']
check_trivial(wikilink, title)

Perform trivial simplification, replace [[Foo|foo]] with [[foo]].

Parameters
  • wikilink – instance of mwparserfromhell.nodes.wikilink.Wikilink representing the link to be checked

  • title (mw.parser_helpers.title.Title) – the parsed wikilink.title

check_relative(src_title, wikilink, title)

Use relative links whenever possible. For example, links to sections such as [[Foo#Bar]] on a page title are replaced with [[#Bar]] whenever Foo redirects to or is equivalent to title.

Parameters
check_redirect_exact(src_title, wikilink, title)

Replace [[foo|bar]] with [[bar]] if foo and bar point to the same page after resolving redirects.

Parameters
check_redirect_capitalization(wikilink, title)

Avoid redirect iff the difference is only in capitalization.

Parameters
check_displaytitle(wikilink, title)
check_anchor(src_title, wikilink, title)
Returns

True if the anchor is correct or has been corrected, False if it is definitely broken, None if it can’t be checked at all or the check was indecisive and a warning/error has been printed to the log.

collapse_whitespace_pipe(wikilink)

Strip whitespace around the pipe in wikilinks.

Parameters

wikilink – instance of mwparserfromhell.nodes.wikilink.Wikilink representing the link to be checked

collapse_whitespace(wikicode, wikilink)

Attempt to fix spacing around wiki links after the substitutions.

Parameters
  • wikicode – instance of mwparserfromhell.wikicode.Wikicode containing the wikilink

  • wikilink – instance of mwparserfromhell.nodes.wikilink.Wikilink representing the link to be checked

handle_node(src_title, wikicode, node, summary_parts)