Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Jump to content

User:Waldyrious/formatcitations

From Wikipedia, the free encyclopedia

This script adds two tabs to the mediawiki interface, which trigger a script that performs automatic harmonization of whitespace in citation templates ({{cite web}}, etc.).

Each tab implements one of the supported behaviors: regular (tab labeled "{{}}") and vertical (tab labeled "{{}}+"). Below is an example output for each:

  • Regular mode (adds spaces before and after equal signs, and before the pipe characters):

{{cite web |url = http://example.com |title = Example |author = John Doe |date = 1 January 2000 }}

  • Vertical mode (automatically aligns the equal signs depending on the longest parameter):
{{cite web
  | url    = http://example.com
  | title  = Example
  | author = John Doe
  | date   = 1 January 2000
  }}

Note that neither replacement produces any visible change in the rendered output of the page. The objective is solely to make the wikicode cleaner and easier to read and edit.

Installation

[edit]

Add the following code to your common.js page: {{subst:iusc|1=User:Waldyrious/formatcitations.js}}