User:Sam Sailor/Scripts/Tidy citations

User script
Tidy citations
DescriptionHarmonize spacing in citation templates
Author(s)Waldir/Meteor sandwich yum/Zyxw/Sam Sailor
StatusWorking
Updated2 August 2018; 6 years ago (2018-08-02)
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

edit

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

edit

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

  • {{Tidy}}
  • {{Crammed}}
  • {{Roomy}}
  • {{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>
{{Crammed}}
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>
{{Roomy}}
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

edit

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

edit

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

Credits

edit

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

edit