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


Main objectives, as applied to reference sections or otherwise within citation templates, are as follows:

  1. make source name congruent with WP article namespace of same
  2. italicisation is applied in accordance with WP:ITALICS
  3. Wiki-link neutral, usually links will not be removed although links may be piped in certain cases where necessary
  4. Space neutral – there should be no impact on the disposition of spaces before or after parameters in edit mode
  5. clean up superfluous data, parameter miscategorisations, etc. from data trawling by Reflinks
  6. retraining of redirecting (indirect) piped links, where these impact the working of the script
  7. remove unpopulated parameters within citation templates
  8. where the contents of |work= and |publisher= is identical, the two are merged (i.e. one of them is discarded).
  9. unification: ensure uniqueness of each of |work= |publisher= and |location=; please check that the desired one is retained.
  • I aim eventually to make the data libraries for this script accessible to the public, pending technical advice on how this can be implemented.

General principles[edit]

The rationale and principles applied are as follows:

  • urls are protected; this protection extends to any linking text (e.g.: whether "", or "[ Siklos, Richard. “Made to Measure” ''Fortune Magazine'', February 20, 2008]"), so please report any changes within such strings
  • sources cited are to be retrained where a journal is traditional media (e.g. The Times) and its online version (e.g. Times Online or is cited
  • the terms 'online', 'magazine' or 'newspaper' is dropped unless its use conforms with the Wiki naming conventions of the traditional source. (e.g. Time and not Time Magazine; The Guardian and not Guardian Unlimited)
  • the traditional journal name (e.g. The New York Times) should reflect the article namespace, with attention being paid to the article in the subject name (e.g. The New York Times); similarly, consistent stylisation should also be ensured (e.g. The Globe and Mail - without the ampersand); 'AFP' will be expanded to 'Agence France-Presse'
  • italicisation will be done on an 'opt-in' basis, although an 'intuitive basis' will also be applied
  1. sites with names sounding like traditional media or that contain words like 'Daily', 'Weekly', 'Monthly', 'Magazine', 'Times', 'Observer' are italicised.
  1. new media sources will be non-italicised by default; names suffixed .com, .org, .net, etc are classed as 'publisher' and unitalicised
  2. In line with convention, television channels (e.g. BBC1, BBC News, Fox News) and networks (particularly US TV and radio stations that use 4-lettered call signs beginning with a "K" or "W") remain unitalicised, whilst only programmes (e.g. Newsnight or Today) are considered 'works'
  3. Portals (e.g., Yahoo!, Google, ESPN, etc), as well as their individual channels (e.g., Yahoo! Music, Google News, ESPNcricinfo, etc), are unitalicised
  4. news agencies (e.g., Reuters, AFP etc) will be classed as 'agencies' within citation templates even though they may also be acting as publishers in certain cases. They remain unitalicised.
  • functionally, correct italicisation will be performed by switching to an appropriate parameter (to or from |work=, |newspaper= or |journal= <–> |publisher=); '|work=' is used to achieve italicisation when switching from |publisher= as the script cannot customise to the citation template being used).
  • italicisation toggles (two pairs of single quote marks for rendering italics used within parameters) will be removed in the first instance
  • as |title= renders the title with double quote marks, extra double quote marks bounding the title will be removed.
  • |journal=, |work=, |newspaper=, |periodical=, where correctly used to denote journals or other works that ought to render as italicised (per WP:ITALIC) will not be disturbed.
  • An element of pedagogy is built in: where the "|title=" is mistakenly filled in with the name of the source, it will be retrained to "|work=", and a ""ACTUAL ARTICLE TITLE BELONGS HERE!" inserted in place of the title.
  • external links within citation template parameters, except where these are parameters designed to accommodate URLs (e.g. |url= and |archiveurl=) will be removed in accordance with WP:ELNO
  • publication locations
  1. are not given for e-sources; but they are generally not removed either
  2. are not wiki-linked or are unlinked
  • In general, linking status will be respected by the main function unless such preservation involves complex piping that cannot be easily scripted for; a separate button is provided for unlinking all sources.
  • Where sources are news reports, publisher name is unnecessary – document at {{citation}} also says this; the cited publications themselves are often more well-known than their publishers. Thus some publishers fields and publisher names are removed outright (e.g. "|publisher=The New York Times Company" is removed for |work=The New York Times, "|publisher=Time Inc." is removed for |work=Time).
  • as indicated on the doc to the {{citation}} templates, publication locations are given only where the source is not well-known (i.e. not BBC or CNN) or this isn't obvious from the journal name (San Francisco Chronicle vs The Telegraph); I tend to use country and not city locations.
  • unpopulated fields within citation templates are generally removed

Installing the script[edit]

  1. Open your common.js in edit mode (alternatively, go to your user page and append "common.js" to the end of the URL).
    • If you prefer to load this only on a specific skin, such as monobook, open your monobook.js in edit mode.
    • If you make a straight copy of this script, instead of "importing" it, you may not benefit from the enhancements and bug-fixes that are made from time to time. In the latter case, you may choose to watchlist this page so you will know when to update your copy for modifications to this script.
  2. Copy the following code onto the JavaScript page you have chosen in the previous step:
    importScript('User:Ohconfucius/script/Sources.js'); // [[User:Ohconfucius/script/Sources.js]]
  3. Save the page and (re-)load it – refresh the cache by following the instructions at the top of your JavaScript page.
  4. Bookmark the script page. This will be your cue to purge the cache on your browser for any updates to take effect.

Disclaimer: Use at your own risk and make sure you check the edit changes before you save.

Actions and test[edit]

I have found some more complex scripts consistently executes much faster in Safari than Firefox.

The script is extremely heavy, and may stall when working on large articles; press <continue> if it does – once is usually sufficient. The script may fail to load load with IE8.

Here are some examples of what the script does on its own: [1][2][3][4][5][6][7][8][9][10][11][12]

Once you are in edit mode, there are [FOUR] buttons from this script in the toolbox in the left margin:

  1. 'Fix news sources' ('New source module' in the current test version)
  2. 'Linkspam'
  3. 'Unlink source name' – removes wikilinks from within all citations bounded by ref tags
  4. 'Rem publishers' – removes certain publishers less well known than their associated journals
  5. 'Unlink source name' – Unlinks all inside the 'author', 'agency', 'publisher', 'journal', 'newspaper', 'periodical' and 'work' parameters

Known limitations or contraindications[edit]

  1. Citation templates filled in by editors who incorrectly use parameters, link within same, or include other elements such as parenthetical disambiguators or location identifiers. Occasionally, editors may try to be too clever or don't know which fields/parameters to use. These can all potentially disrupt the detection of strings with source names, or risk elimination of useful parameters. (see the citations in 1, 2 and 3, 4 for example)
  2. Journals with similar or shared names may cause false negatives: for example, where journals differ only in the definite article in the name, the script may fail to detect and correct (e.g. The Daily Star vs Daily Star).
  3. a publication (using |publisher=) which was italicised may lose italicisation due to automatic removal of the toggle if it is not included in the dictionary of journals and periodicals.


Users are expected to exercise careful judgement in the context of each article in which they run this script. Use at your own risk and make sure you check the edit changes before you save. It's not my fault if someone misuses this script.

Test page[edit]

See also[edit]