User:SMcCandlish/TidyCitations
From Wikipedia, the free encyclopedia
User:SMcCandlish/TidyCitations.js is a user JavaScript for your common.js page. It adds two options to the "Tools" menu (on the left in most skins), "{{Tidy}}" and "{{Tidy}} (vertically)". These only appear in the menu when in editing mode.
TidyCitations | |
---|---|
Description | Harmonize spacing in citation templates |
Author(s) | SMcCandlish, Sam Sailor, Zyxw, Meteor sandwich yum and Waldir |
Status | Working |
Updated | 1 January 2024; 5 months ago (2024-01-01) |
Browser support | Likely all |
Skin support | Likely all |
Source | User:SMcCandlish/TidyCitations.js |
Use with caution, and be sure to examine the output carefully, and use Preview before saving to make sure citations are all working properly. It is highly advisable to follow the instructions at User:Ucucha/HarvErrors to install his script for detecting broken citations, and Help:CS1 errors § Error and maintenance messages to install the CSS to display both sorts of citation warning messages. Fix any flagged errors (you will need to edit the page and do Preview to make all the error/warning messages available) before trying to run TidyCitations or any other citation cleanup script. Garbage in, garbage out! Take out the garbage first. |
Neither function should be used without also making a more substantive change (at least fix a typo or something) in the same edit, per the human-editor rules at WP:COSMETICBOT.
- "{{Tidy}}" normalizes the spacing used in horizontal CS1 (
{{cite book}}
,{{cite journal}}
, etc.) and CS2 ({{citation}}
) templates, throughout the article (including fixing visually disruptive vertical ones to be horizontal). - "{{Tidy}} (vertically)" formats citations vertically with consistent spacing, and should only be used in a page-bottom citations section that is using vertical citations in list-defined references (LDR) style.
- In an article using LDR, the article body will contain horizontal citations, and the LDR references at the bottom may be vertical (though this is not required). In such a case of mixed citation formatting, the way to use these scripts is to copy–paste the vertical LDR references into a user sandbox, run "{{Tidy}}" on the entire article (don't save it yet), run "{{Tidy}} (vertically)" on the vertical references in the sandbox, and copy the cleaned up vertical references from the sandbox and paste them back over the undesirably horizontalized ones at the bottom of the article.
This script does not do anything with the interior contents of the <ref>
tag itself (i.e., it does not clean up <ref name = foo-bar >...</ref>
to <ref name="foo-bar">...</ref>
). The script for doing that, to run along with TidyCitations, is User:SMcCandlish/TidyRefs.