Wikipedia:RefToolbar/1.0

From Wikipedia, the free encyclopedia
Jump to: navigation, search

RefToolbar 1.0, the first version of RefToolbar, is a JavaScript tool to help add references to Wikipedia articles. It adds an extra button to the editing toolbar for commonly used citation templates: {{cite web}}, {{cite news}}, {{cite book}}, and {{cite journal}}. This editing toolbar can be installed to your preferences with the script at RefToolbarLegacy.js or by unchecking "Enable enhanced editing toolbar" at "My preferences". This version 1.0 is the legacy version, as the updated RefToolbar 2.0 is now the default version, as of 25 February 2011.

RefToolbar.png

Usage

It will add a "cite" button to the right side of the editing toolbar for citation templates, like this: Button easy cite.png. When you click on the button, you can choose which citation template to use and a form will appear with fields to fill in for available parameters in the citation template. Unfilled parameters will not be added to the page. The templates are already wrapped in <ref> tags. Cite web and cite news will have their "accessdate" parameter filled in with the current UTC date. Click the "add citation" button to add it to the page.

The "Named references" button produces a list of all the named references in the text, for easy addition of repeated references.

Installation

My preferences

You can add the stable version of this script through the Preferences → Editing → Usability features by unchecking the "Enable enhanced editing toolbar" option, then click the "Save" button.

Monobook.js

Or to use the latest version of the script (may be different from the Gadget version, possibly broken, and not tested as extensively), add

importScript('User:Mr.Z-man/refToolbar.js');

to your monobook JS page (or whatever skin you use) and bypass your cache.

You may also copy the code at: RefToolbarLegacy.js.

Customizing

The date format used in the accessdate field can be customized. Add a line like the following to the .js page for your skin and bypass the cache:

citeUserDateFormat = 'format string';

The format string should be a string that defines the date format you want to use. The following special words will be replaced with parts of the date, anything else will be left as text:

  • <date> — The day of the month (1–31)
  • <zdate> — The day of the month (01-31), zero-padded to 2 digits
  • <month> — The month number (1–12)
  • <zmonth> — The month number (01–12), zero-padded to 2 digits
  • <monthname> — The month name
  • <year> — The 4-digit year

For example, to use the ISO date format:

citeUserDateFormat = '<year>-<zmonth>-<zdate>';

The default format is DMY, '<date> <monthname> <year>'.

Features

  • Easily add commonly used citation templates.
  • Ability to add named references already used in the article.
  • Error checking, checks for common citation issues:
    • <ref> tags with no closing </ref>
    • Multiple references that contain the same content
    • References that do not use a citation template (often important for consistency)
    • References assigned the same name
    • Usage of undefined named references

Testing versions

Screenshot of the testing version

You are invited to try the development version of RefToolbar, updated as of 13 February 2010. It has new features, but may also have bugs. Features include:

  • Support for {{cite encyclopedia}} and {{cite press release}} templates.
  • A button to quickly make a reference section with <references/> or {{Reflist}}.
  • Archive url and archive date fields added to cite web.
  • DOI, PMID and quote fields added to cite journal.

Smaller changes:

  • Trims leading and trailing whitespace in all fields. Copying and pasting from a website often adds extra spaces.
  • Uses |page= instead of |pages= if there is only one page. This makes i.e. "p. 5" instead of "pp. 5".
  • Replaces hyphens with en dashes in the page field (WP:ENDASH).
  • Makes sure there is one space after each comma in the page field.
  • Uses |year= instead of |date= if only the year is specified
  • Under News, the 'Work' field has been renamed to 'Newspaper'

To try the testing version:

  1. If you have the refTools gadget enabled, uncheck it in your user Preferences, under the "Editing gadgets" section, then click the "Save" button.
  2. Open your monobook.js page (or whatever skin you use)
  3. Remove
    importScript('User:Mr.Z-man/refToolbar.js');
    
    if it is there, or add // in front to comment it out
  4. Add
    importScript('User:Apoc2400/refToolbar.js');
    
  5. Bypass your cache (press Ctrl+F5).

Report any bugs or problems on the talk page.

refToolPlus

Screenshot of refToolPlus development version

refToolPlus is an experimental version that introduces some major new features:

  • Enter an ISBN or Google Books URL for a book, press a button, and other fields are filled in automatically with information from reftag or Diberri's tool.
  • Enter a DOI, and a journal citation is automatically fetched from Crossref.org. PMID is coming.
  • Enter a New York Times URLs for a news citation, and title, author, date and page is filled in. For other URLs, only the page title is fetched.
  • Preview citations before inserting into an article.
  • The cite book section has many new fields and functions. It could still use some design fixes.

Note: This tool uses external resources, including my (Apoc2400) site at reftag.appspot.com. The owners of these sites can see you IP and browser information.

To try it, do as above but add

importScript('User:Apoc2400/refToolbarPlus.js');

instead to your monobook.js.

Userboxes

Code Result
 {{User:Powergate92/Userboxes/refToolbar}}
Button easy cite.png This user cites sources using refToolbar
Transclusions

See also