User:Alex 21/script-references
User:Alex 21/script-references.js is a script that moves all references declared within the article into the declaration of {{Reflist}} at the end of the article, to tidy up the article's contents just the readable prose and declared reference names. Any unnamed references are included with this move and are provided with a newly-generated reference name.
Installation
[edit]To install the script, add:
importScript('User:Alex 21/script-functions.js'); importScript('User:Alex 21/script-references.js');
>>> User:Alex 21/script-functions.js is required to include multiple shared functions, and the custom "TV Scripts" header, many of which are used identically in a few of my other scripts - you only need to include it in Special:MyPage/common.js once. Follow the instructions at User:Alex 21/script-functions for installing scripts by Alex 21. <<<
Usage
[edit]There will be a "Sort references" link in the toolbox on the left on every article under "Tools". Upon clicking the link, the references will be sorted accordingly; make sure to use the "Show preview" or "Show changes" buttons to make sure all edits are working. Any unnamed references are included with this move, and are provided with a newly-generated reference name in the format [website name] + [date month] + [date year] (e.g. "VarietySeptember2023", then "VarietySeptember2023-2", "VarietySeptember2023-3", etc. for any further articles from Variety posted in September 2023).
All references will be sorted by date. Any checks for dates (to sort the references and to rename unnamed references) will check for any date parameters in decreasing order of importance; this order, from highest to lowest, is |date=
, |archive-date=
, |access-date=
.
If the beginning wikicode looks like this:
By May 2020, a [[Disney+]] series based on ''Percy Jackson'' was in the works, with the first season set to adapt the first book in the series, ''[[The Lightning Thief]]''.<ref><!--no name-->{{Cite web |last1=Andreeva |first1=Nellie |last2=Petski |first2=Denise |date=May 14, 2020 |title='Percy Jackson' Series In The Works At Disney+ |url=https://deadline.com/2020/05/percy-jackson-series-in-the-works-at-disney-1202934985/ |url-status=live |archive-url=https://web.archive.org/web/20200514204410/https://deadline.com/2020/05/percy-jackson-series-in-the-works-at-disney-1202934985/ |archive-date=May 14, 2020 |access-date=April 11, 2022 |website=[[Deadline Hollywood]]}}</ref> Riordan revealed in March 2021 that searches for the series' directors and cast was underway,<ref><!--no name-->{{Cite magazine |last=Holub |first=Christian |date=June 14, 2021 |title=Rick Riordan says Percy Jackson series from Disney+ 'still moving forward' |url=https://ew.com/tv/percy-jackson-disney-plus-series-rick-riordan-update/ |url-status=live |archive-url=https://web.archive.org/web/20210622182231/https://ew.com/tv/percy-jackson-disney-plus-series-rick-riordan-update/ |archive-date=June 22, 2021 |access-date=April 11, 2022 |magazine=[[Entertainment Weekly]]}}</ref> with [[James Bobin]] was announced as the pilot episode's director in October.<ref name="JamesBobin">{{Cite web |last=Oddo |first=Marco Vito |date=October 25, 2021 |title='Percy Jackson' Disney+ Series Has Found Its Pilot Director |url=https://collider.com/percy-jackson-series-director-james-bobin-disney-plus/ |url-status=live |archive-url=https://web.archive.org/web/20211026165111/https://collider.com/percy-jackson-series-director-james-bobin-disney-plus/ |archive-date=October 26, 2021 |access-date=April 11, 2022 |website=[[Collider (website)|Collider]]}}</ref> [[Jonathan E. Steinberg]] and Dan Shotz were also announced as showrunners in July.<ref name="Showrunners">{{Cite web |last=Riordan |first=Rick |author-link=Rick Riordan |date=July 13, 2021 |title=Vroom, Vroom in the Writers' Room |url=https://rickriordan.com/2021/07/vroom-vroom-in-the-writers-room/ |url-status=live |archive-url=https://web.archive.org/web/20210715012956/https://rickriordan.com/2021/07/vroom-vroom-in-the-writers-room/ |archive-date=July 15, 2021 |access-date=April 11, 2022 |publisher=[[Rick Riordan]]}}</ref>
Then the end result will look something like this:
By May 2020, a [[Disney+]] series based on ''Percy Jackson'' was in the works, with the first season set to adapt the first book in the series, ''[[The Lightning Thief]]''.<ref name="DeadlineMay2020" /> Riordan revealed in March 2021 that searches for the series' directors and cast was underway,<ref name="EwJune2021" /> with [[James Bobin]] was announced as the pilot episode's director in October.<ref name="JamesBobin" /> [[Jonathan E. Steinberg]] and Dan Shotz were also announced as showrunners in July.<ref name="Showrunners" /> ... {{Reflist |refs= <ref name="DeadlineMay2020">{{Cite web |last1=Andreeva |first1=Nellie |last2=Petski |first2=Denise |date=May 14, 2020 |title='Percy Jackson' Series In The Works At Disney+ |url=https://deadline.com/2020/05/percy-jackson-series-in-the-works-at-disney-1202934985/ |url-status=live |archive-url=https://web.archive.org/web/20200514204410/https://deadline.com/2020/05/percy-jackson-series-in-the-works-at-disney-1202934985/ |archive-date=May 14, 2020 |access-date=April 11, 2022 |website=[[Deadline Hollywood]]}}</ref> <ref name="EwJune2021">{{Cite magazine |last=Holub |first=Christian |date=June 14, 2021 |title=Rick Riordan says Percy Jackson series from Disney+ 'still moving forward' |url=https://ew.com/tv/percy-jackson-disney-plus-series-rick-riordan-update/ |url-status=live |archive-url=https://web.archive.org/web/20210622182231/https://ew.com/tv/percy-jackson-disney-plus-series-rick-riordan-update/ |archive-date=June 22, 2021 |access-date=April 11, 2022 |magazine=[[Entertainment Weekly]]}}</ref> <ref name="Showrunners">{{Cite web |last=Riordan |first=Rick |author-link=Rick Riordan |date=July 13, 2021 |title=Vroom, Vroom in the Writers' Room |url=https://rickriordan.com/2021/07/vroom-vroom-in-the-writers-room/ |url-status=live |archive-url=https://web.archive.org/web/20210715012956/https://rickriordan.com/2021/07/vroom-vroom-in-the-writers-room/ |archive-date=July 15, 2021 |access-date=April 11, 2022 |publisher=[[Rick Riordan]]}}</ref> <ref name="JamesBobin">{{Cite web |last=Oddo |first=Marco Vito |date=October 25, 2021 |title='Percy Jackson' Disney+ Series Has Found Its Pilot Director |url=https://collider.com/percy-jackson-series-director-james-bobin-disney-plus/ |url-status=live |archive-url=https://web.archive.org/web/20211026165111/https://collider.com/percy-jackson-series-director-james-bobin-disney-plus/ |archive-date=October 26, 2021 |access-date=April 11, 2022 |website=[[Collider (website)|Collider]]}}</ref> }}
Bugs
[edit]This script will not function properly if a references has a newline within it; i.e. if the references spans more than one line in the editor. Make sure all individual references are on the same line.
Please report any other bugs on the talk page of the script's creator.