Jump to content

User:Eejit43/scripts/article-cleaner

From Wikipedia, the free encyclopedia
User script
article-cleaner
DescriptionUser script to fix stylistic and other minor issues in articles
Author(s)Eejit43
First releasedFebruary 10, 2025; 2 months ago (2025-02-10)
UpdatedMay 4, 2025; 0 days ago (2025-05-04) (see GitHub commit history)
BrowsersTested on Chromium and Firefox
Skins
SourceUser:Eejit43/scripts/article-cleaner.js
GitHub repositoryarticle-cleaner.ts

This user script adds the ability to fix stylistic and other miscellaneous issues in articles, of which a list can be found below. This script is activated using a link in the "More"/"Tools" menu, visible when in editing mode on a page.

This script can possibly make unexpected changes, please make sure you check the diff before submitting edits.

Features

  • Cleans up section headers (fixes capitalization, depth, and spacing)
  • Removes improper or unnecessary magic words
  • Cleans up DISPLAYTITLEs/DEFAULTSORTs (converts templates magic words and removes unnecessary magic words)
  • Cleans up categories (fixes category links or transclusions)
  • Cleans up links (cleans up spacing, optimizes text after links instead of piping, and more)
  • Removes improper characters (replaces smart quotes and ellipses with their standard counterparts, and replaces non-breaking spaces with their HTML tag for readability)
  • Cleans up improper date ranges
  • Removes stray markup (removes empty tags and toolbar markup filler text)
  • Cleans up spacing (removes many types of excess spacing and adds extra spacing where needed, such as before stub templates)
  • Cleans up references (fixes links in ref tags, corrects spacing, makes tags self-closing, and more)
  • Cleans up templates (aligns parameters in infoboxes and other templates, removes unnecessary templates, and more)
  • Removes unnecessary comments (comments left over from article drafts, etc.)

Installation

Simple

Install Enterprisey's "script-installer" (at Preferences → Gadgets → Advanced → Tick Install scripts without having to manually edit JavaScript files (documentation)), then come back to this page and click the "Install" button in the infobox on the right.

Manual

Add the following to your common.js (or a skin specific JavaScript page):

{{subst:install user script|User:Eejit43/scripts/article-cleaner.js}}

Comments/bug reports

Please leave comments or report bugs on my talk page, or file an issue on the GitHub repository.