Wikipedia:Wikipedia Signpost/2023-08-01/Tips and tricks

Tips and tricks

Citation tools for dummies!

In the last edition of The Signpost, I covered three bots highly useful to WikiProjects. In this edition of Tips and Tricks, I'm going to focus on smaller, more personal tools, that let you focus on more specialized tasks – some user scripts, some gadgets, and some external tools. In particular, I'm going to try to do a brief summary of the main scripts/gadgets/tools related to citations.

Some of the text was taken from these tools' description pages, which I highly encourage you to read if any of them interest you.

How to install user scripts

A quick note on how to install user scripts, using my own WP:UPSD (which is hosted at User:Headbomb/unreliable.js) as an example. The other scripts can be installed in exactly the same way, replacing User:Headbomb/unreliable.js with User:Example/source.js accordingly. Some scripts may have additional customization options, detailed on their documentation page.

Method 1 – Automatic
  1. Go to the 'Gadgets' tab of your preferences and select the 'Install scripts without having to manually edit JavaScript files' option at the bottom of the 'Advanced' section. Refresh this page after enabling that.
  2. Click on the 'Install' button in the infobox on the right of the documentation page (if it exists), or at the top of the source page.
Method 2 – Manual
  1. Go to Special:MyPage/common.js. (Alternatively, you can go to Special:MyPage/skin.js to make the script apply only to your current skin.)
  2. Add importScript( 'User:Headbomb/unreliable.js' ); // Backlink: [[User:Headbomb/unreliable.js]] to the page (you may need to create it), like this.
  3. Save the page and bypass your cache to make sure the changes take effect.

As a general caveat, for cybersecurity reasons, you should only install user scripts if you trust their author to not be secretly nefarious. Likewise for external sites from third parties. Gadgets can be directly enabled in your preferences, and their code has been community vetted, thus they represent a lesser security risk.

Citation Expander

The Citation Expander is a gadget that lets you invoke Citation bot. I have already written an in-depth guide a year ago, so I'll summarize the main points and you can read that article if you want to know more. If you're new to tool-assisted editing, if you only install one tool today, this is very likely the one you want.

The key idea is that you can have citations like

  • {{cite journal |jstor=20107388 }}
  • {{cite journal |doi=10.1038/351624a0 }}
  • {{cite book |isbn=978-0-9920012-2-3 }}

and have the bot automatically expand them to

  • Keen, Suzanne (2006). "A Theory of Narrative Empathy". Narrative. 14 (3): 207–236. doi:10.1353/nar.2006.0015. JSTOR 20107388. S2CID 52228354.
  • Wigley, Dale B.; Davies, Gideon J.; Dodson, Eleanor J.; Maxwell, Anthony; Dodson, Guy (1991). "Crystal structure of an N-terminal fragment of the DNA gyrase B protein". Nature. 351 (6328): 624–629. Bibcode:1991Natur.351..624W. doi:10.1038/351624a0. PMID 1646964. S2CID 4373125.
  • Robichaud, Marc; Basque, Maurice (September 2013). Histoire de l'Université de Moncton. ISBN 978-0-9920012-2-3.

This can save you a huge amount of time and headaches, not having to format things yourself, not having to manually enter authors, etc. All you need is an identifier (URLs will often work too), and let the bot take over. Then all you have to do is review what the bot did (e.g. it missed the publisher of the book, which you could add yourself with |publisher=Institut d'Études Acadiennes).

You can also unleash the bot on existing citations so it can perform some cleanup and find other relevant bibliographic information.

OAbot

OAbot is a tool designed to find and add links to open access publications and find suitable links to free versions of paywalled articles by searching several databases, author websites, and so on. In the case of open-access DOIs, it will append |doi-access=free to the citation to flag that the publication is indeed open access.

The bot will make edits on its own, but you can ask the bot to make edits on your behalf via ToolForge. Keep in mind that some database or website, like CiteSeerX or ResearchGate, might host papers in violation of copyright, even if most are not, so you ought to review that the uploader has the permission to upload the paper in the first place. If they aren't one of the authors of the paper, they likely do not have such permission.

Citation Style Markers

Note: You'll need to use the manual install method (method 2) with the following code to use its custom options.

importScript('User:BrandonXLF/CitationStyleMarker.js'); // Backlink: [[User:BrandonXLF/CitationStyleMarker.js]]
window.CSMarkerMode = 'both';

BrandonXLF's Citation Style Markers is a very simple script that lets you know if there are clashes between Citation Style 1 (e.g. {{cite book}}), Citation Style 2 (i.e. {{citation}}), and others like {{vcite book}} or {{cite LSA}} in an article.

If you have two different citation styles, it will append a small CS1, CS2, CSVAN, or CSLSA at the end of the citation.

  • {{cite book |title=Albatrosses, Butlers, and Communists |publisher=Fake Publisher}}
  • {{citation |title=Albatrosses, Butlers, and Communists |publisher=Fake Publisher}}
  • Albatrosses, Butlers, and Communists. Fake Publisher. CS1
  • Albatrosses, Butlers, and Communists, Fake Publisher CS2

I personally choose to enable those warnings only when there's a clash. I can then search for 'CS1' and 'CS2' to see which is the dominant style and which citations are compromising consistency. It's often only a matter of changing one or two citations from a {{citation}} to a {{cite book}} or vice versa. Sometimes it's a matter of appending |mode=cs1 or |mode=cs2 to premade citations (like {{McCorduck 2004|mode=cs1}}) or specialized templates (like {{cite arXiv|...|mode=cs2}}), which will change the template style from CS1 to CS2 or vice versa.

Note that plain text citations, like <ref>Smith, J. (2010) "Random Book". Random Publisher. pp. 32–38 {{ISBN|978-0-123-45678-9}}</ref> will be completely ignored by the script, so you still have to keep an eye out for those.

You can choose if you want the markers always present, present by default, off by default, or only present when there is a clash by changing OPTION in window.CSMarkerMode = 'OPTION'; above. See the documentation for details.

HarvErrors

Trappist the monk's HarvErrors is an evolution of the now-outdated Ucucha's HarvErrors. This script deals specifically with all sorts of issues unique to Harvard citation templates like {{harv}}, {{harvnb}}, {{sfn}}, etc. These Harvard templates are prone to problems with their automatically generated links (see this old version of the industrial espionage article for an example).

HarvErrors checks these links for validity and displays an error message for incorrect links. In addition, it checks for citations that are likely set up to receive links, but do not have any pointing to them.

If you don't want to deal with warnings, and only with confirmed errors, use Svick's original HarvErrors instead.

Reference Tooltips

Placeholder alt text
Reference Tooltips – Hovering a footnote link shows what the footnote says

Reference Tooltips is a small gadget that simply shows you the citation upon hovering the reference link. You no longer need to click and go down to the reference section to see what the reference is. This is particularly helpful with articles that make use of {{rp}}.

Sadly, it will not work if the Navigation Popups gadget is enabled.

Unreliable/Predatory Source Detector

My own (i.e. Headbomb's) Unreliable/Predatory Source Detector, or UPSD for short, is a relatively famous script. The core idea is that the script looks for URLs and DOIs, and colour codes them according to reliability, summarized in the table below.

Severity Appearance Explanation
Blacklisted example.com The source is blacklisted on Wikipedia and can only be used with explicit permission.
Deprecated/predatory example.com There is community consensus to deprecate the source. The source is considered generally unreliable, and use of the source is generally prohibited.
Generally unreliable example.com The source has a poor reputation for fact-checking, fails to correct errors, is self-published, is sponsored content, presents user-generated content, violates copyrights, or is otherwise of low-quality.
Marginally reliable example.com Sources which may or may not be appropriate for Wikipedia. For instance Forbes.com is generally reliable, but its contributors generally are not.

In general, the script is kept in sync with WP:CITEWATCH, WP:DEPRECATE, WP:NPPSG, WP:RSN discussions, WP:RSPSOURCES, WP:SPSLIST (not fully synced), WP:VSAFE/PSOURCES, {{Predatory open access source list}}, and common sense "duh" cases I come across (like a parody website) with some minor differences. Obvious issues should be reported on the script's talk page, but since I do not want my opinion to be king, I maintain a general policy that everything is appealable at WP:RSN.

The documentation contains several warnings and caveats, and I would highly recommend that you at the very least read the big warning box at the top of the documentation and the full summary table before making use of this script so you understand its limitations.

The script can be customized to an extent, and can even support supplemental lists for specialized tasks, like User:GeneralNotability/unreliable-rules.js which helps find many black hat SEO efforts.

CiteUnseen

Placeholder alt text
CiteUnseen on Citizens United v. FEC:

SuperHamster's CiteUnseen analyses citations much like UPSD above, but focuses more on the origin and nature of sources. For example, it will mark citations as coming from advocacy groups, government-controlled outlets, opinion pieces, tabloids, etc. It will also add icons to reflect reliability based on WP:RSP, but you can configure which are displayed.

Like with any scripts dealing in citation analysis, it comes with heavy caveats, so you should read the documentation in detail to understand what it does.

Both CiteUnseen and UPSD will work together without issue, to provide fairly comprehensive analysis of both the reliability and nature of sources – and if one script misses a source, maybe the other will pick it up.

CiteHighlighter

Novem Linguae's CiteHighlighter is another citation analyzer script. CiteHighlighter colour-codes things in the same way they are found on WP:RSP#Legend. Sources of data include WP:RSP, WP:NPPSG (which is based on WP:RSN discussions), and the source reliability pages of various WikiProjects. It recognizes around 1,800 sources.

Placeholder alt text
CiteHighlighter colour-codes things in the same way they are found on WP:RSP

Like with any scripts dealing in citation analysis, you should read the documentation in detail to understand what it does. In particular, it makes certain assumptions like The New York Times = reliable, without consideration to the type of article being published, or a reference with a PMID = reliable, despite the PubMed database including sources of various reliability.

CiteHighlighter works with either or both of UPSD and CiteUnseen, so feel free to mix and match as your heart desires.

Copyvios

The Earwig's Copyvios invokes Earwig's Copyvio Detector. Which, as you might suspect, searches the web for potential copyright violations. Like reFill below, it runs on ToolForge.

This tool is normally more useful to reviewers than to regular editors; if you don't know that copy-pasting/closely paraphrasing things from sources is bad, the intervention you need is education on the topic, not more tools. New Page Patrollers and AFC Reviewers in particular might want to install this, but anyone that is interested in copyright cleanup will be well served by this tool.

Dispenser's Checklinks is typically used to make sure external links are working (i.e. not dead). If they are not, you can use it to search for archived versions of these links. It runs on Dispenser's personal site.

reFill/Reflinks/CiteGen

reFill is a tool that specializes in dealing with bare URLs. Like Copyvios above, it runs on ToolForge, but you can use Zhaofeng Li's Reflinks script to invoke it directly from Wikipedia, or CiteGen to run it from your web browser. You can also run it directly from a Linux or Windows PC (see reFill's FAQ for details).

It adds information (page title, work/website, author and publication date, if metadata is included) to bare URL references, and does additional fixes as well (e.g. combining duplicated references). The tool is an open-source replacement of Dispenser's Reflinks.

It is not perfect, and you will often need to cleanup its output, like |last=Welle |first=Deustche for Deutsche Welle links. But it gets you at least 90% of the way there!

Reference Organizer

Placeholder alt text
Reference Organizer lets you easily manage citations. It is particularly useful to name/manage references that are used in multiple places.

Kaniivel's Reference Organizer displays all an article's references in graphical user interface, where you can choose whether the references should be defined in the body of article or in the reference list template (see WP:LDRHOW). You can also use it to sort the references in various ways, and rename the references.

RefRenamer

Nardog's RefRenamer is similar to Reference Organizer, but focuses specifically on renaming Visual Editor reference names, like <ref name=":0"/> or <ref name=":1"/>, to something more editor-friendly, like <ref name="Smith-2006"/>. It will automatically make suggestions, but you can always choose a different name in case it picks something silly like <ref name="Rindfleischetikettierungsueberwachungsaufgabenuebertragungsgesetz"/>.

Sources

Ohconfucius's Sources is a script that deals with common newspapers, magazines, and websites to ensure that their names are accurate per the frontpage of these publications, from including/omitting the leading The, to making use of and or &, to making sure they are properly italicized per MOS:ITALICTITLE, to making sure that magazines aren't in the |publisher= field of citation templates, etc.

Closing remarks

Phew! That was a lot wasn't it? That's ok, you don't have to install all these scripts, or memorize all those details. Just pick the ones that seem useful to you.

That said, there are important caveats to using UPSD, CiteUnseen and CiteHighlighter. I know I've mentioned those before, but it bears repeating that these are not scripts to use mindlessly. They are, at least in part, based on the interpretation of discussions, many with limited participation. It's perfectly possible, and even likely, that some of these discussions did not reflect the entirety of the source, and that a closer look would change its classification from generally unreliable to marginally unreliable (or vice versa), or a source would be deemed unreliable in context X, but reliable in context Y.

Also remember that just because a source is considered generally unreliable, it doesn't mean that it cannot or shouldn't be used. Scripts cannot appreciate the full context in which a source is used. But you can. So don't be a meat popsicle, and use your brain.

Feel free to post your experiences (new or old) with any of these scripts in the comment section! Also feel free suggest other scripts that you feel might benefit your fellow Wikipedian!

Note: This article was updated on 5 August 2023 to mentioned Nardog's RefRenamer. The omission was due to a bug in WP:TOPSCRIPTS listings. The author apologizes for the oversight. Thanks to PamD for bringing this script to light in the comment section.


Tips and Tricks is a general editing advice column written by experienced editors. If you have suggestions for a topic, or want to submit your own advice, follow these links and let us know (or comment below)!