User:Sam Sailor/Scripts/Tidy citations

Tidy citations will harmonize spacing in citation templates or align them vertically the way infoboxes are aligned. Tidy citations should almost never be run on…

User:Sam Sailor/Scripts/Tidy citations
User script
Tidy citations
DescriptionHarmonize spacing in citation templates
AuthorWaldir/Meteor sandwich yum/Zyxw/Sam Sailor
StatusWorking
Updated3 September 2025; 11 months ago (2025-09-03)
BrowsersLikely all
SkinsLikely all
SourceUser:Sam Sailor/Scripts/Tidy citations.js

Tidy citations will harmonize spacing in citation templates or align them vertically the way infoboxes are aligned. Tidy citations should almost never be run on its own, see WP:MEATBOT and WP:COSMETICBOT.

Installation instructions

Put the line

{{subst:js|User:Sam Sailor/Scripts/Tidy citations.js}}

in either your common JavaScript file or the JavaScript file of your current skin, save the page, and bypass your browser cache.

August 2018 note: The function importScript was deprecated in the July 2017 release of MediaWiki 1.29, and mw.loader is prefered.[1] But importScript is not obsolete and still works, in case you prefer the old method of manually installing with {{subst:iusc|User:Sam Sailor/Scripts/Tidy citations.js}} or using ScriptInstaller.

Usage

Tidy citations will add two menu items to the p-toolbar when in edit mode:

  • {{Tidy}}
  • {{Tidy}} (vertically)

Clicking them will harmonize citations:

{{Tidy}}:

Some body text here.<ref name="Jarnow 2018">{{cite web |first=Jesse |last=Jarnow |title=The Ghost of John Perry Barlow Lives in His Posthumous Memoir |website=WIRED |date=5 June 2018 |url=https://www.wired.com/story/the-ghost-of-john-perry-barlow-lives-in-his-posthumous-memoir/ |archive-url=http://web.archive.org/web/20180606011712/https://www.wired.com/story/the-ghost-of-john-perry-barlow-lives-in-his-posthumous-memoir/ |archive-date=6 June 2018 |dead-url=no |access-date=2 August 2018}}</ref>

{{Tidy}} (vertically):

Some body text here.<ref name="Jarnow 2018">{{cite web
| first        = Jesse
| last         = Jarnow
| title        = The Ghost of John Perry Barlow Lives in His Posthumous Memoir
| website      = WIRED
| date         = 5 June 2018
| url          = https://www.wired.com/story/the-ghost-of-john-perry-barlow-lives-in-his-posthumous-memoir/
| archive-url  = http://web.archive.org/web/20180606011712/https://www.wired.com/story/the-ghost-of-john-perry-barlow-lives-in-his-posthumous-memoir/
| archive-date = 6 June 2018
| dead-url     = no
| access-date  = 2 August 2018
}}</ref>

wikEd compatibility

wikEd is in general incompatible with scripts, add-ons, or extensions that rely on or change the standard text edit box, and Tidy citations is one of those scripts. The workaround is to temporarily turn off wikEd by pressing the button, making the changes with Tidy citations, and re-enabling wikEd.

Feedback

Any issues? Click here to start a new talk section.

Credits

This script is a modified version of User:Zyxw/Tidy citations.js (permalink), which in turn is a mod of User:Meteor sandwich yum/Tidy citations.js, which in turn is a modified version of User:Waldir/formatcitations.js.

References

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.