Pywikipediabot/cosmetic changes.py

From Meta, a Wikimedia project coordination wiki

Jump to: navigation, search
Bug blank.svg
Subversion repository of Wikimedia has this file:

cosmetic_changes.py makes little changes in one or several wiki pages that make the source code look cleaner. These changes are not supposed to change the look of the rendered wiki pages.

This script performs the following operations:[1]

  • fix self interwiki: interwiki links to the site itself are displayed like local links, removing their language code prefix.
  • standardize interwiki: makes sure that interwiki links are put to the correct position and into the right order.
  • standardize categories: makes sure that categories are put to the correct position, but does not sort them.
  • clean up links: improves how links are presented by doing the following:
    • replaces underlines by spaces, also multiple underlines.
    • removes unnecessary leading spaces from a title.
    • removes unnecessary trailing spaces from a title.
    • converts URL-encoded characters to unicode.
    • removes unnecessary initial and final spaces from a label.
    • tries to capitalize the first letter of the title.
  • clean up section headers: for better readability of section header source code, puts a space between the equal signs and the title; for example: "==Section title==" becomes "== Section title ==" .
  • put spaces in lists: for better readability of bullet list and enumeration wiki source code, puts a space between the * or # and the text.
  • translate and capitalize namespaces: makes sure that localized namespace names are used.
  • resolve html entities
  • valid xhtml: tries to make a valid XHTML document, for example, replacing "<br>" by "<br/>"
  • remove useless spaces
  • remove non breaking space before percent: newer MediaWiki versions automatically place a non-breaking space in front of a percent sign, so it is no longer required to place it manually.
  • hyphenate isbn numbers: tries to hyphenate an ISBN

[edit] References

  1. source code, function "change"

[edit] See also