User talk:Gimmetrow/fixRefs.js

The WP:FN guideline says that refs should follow punctuation with no space, and no space between successive refs. This javascript provides a link called "Fix reference marks" that will apply that style. The link is present in the toolbox (on the left-hand side of the page) while editing a page. The intention is to help clear up the inconsistent location of punctuation and ref marks that sometimes occurs in heavily-edited articles. (Some editors prefer spaces between successive refs, but if that style is used consistently it shouldn't be changed in articles.)

The tab also adjusts fact, citation needed, cn, citequote, verification needed, and verify source, as well as ref, ref_label, cref, rf and GR to some extent.

Installation
This javascript can be added to monobook.js with. This javascript creates a link called "Fix reference marks" visible while a page is being edited.

For more information about the monobook, see Monobook and Help:Monobook. A user's monobook is located at User:(username)/monobook.js

Examples
The tab handles the following:

,   ?
 * This, this ; and this. ..
 * This, this ; and this. , ?
 * This, this : and this. ? !
 * Fact tags  ;.
 * Other tags, :  ;.
 * ref and GR   : and colons.
 * Works with tags inside refs, named or not.
 * A ref text containing the text " " !
 * Fixes floating ref marks"after blockquotes"
 * Compresses multiple refs up to 5 in a row.
 * Also removes linebreaks.
 * Handles mixed combinations
 * Also "quotes,", and "quotes;".
 * Single 'quotes,' ; and 'closing smart-quotes,’ !
 * "Quotes", "quotes" ; "quotes".
 * "Quotes.", "quotes." ; "quotes.".
 * "Quotes?", "quotes?" ; "quotes?".
 * "Quotes:", "quotes;" : "quotes:" !
 * "Quotes," ! "quotes;" ! "quotes." !
 * "Quotes?" ! "quotes!?!" ? "quotes?" !?!
 * Does "some 'quotes within quotes,'" ;.
 * Multiple punctuation is fixed after a ref .;.,.
 * Allows spaces in some templates, like.
 * Allows capitalization, like and .
 * tag remains untouched.

Known issues to look out for

 * Messes up abbreviations in "quotes, eg.", and not eg. ;
 * Messes up ellipsis in "quotes...", and without quotes ...
 * If there is no following punctuation, the ref/abbreviation/ellipsis is unchanged
 * Refs with dashes and parenthesis not addressed
 * Comments can obscure matches.
 * Refs within comments are adjusted too
 * Removes spaces before trailing > in named refs, as in

Obscure or unlikely to occur in real articles

 * Repeated ? or ! both kept outside a quote? !
 * Ref parses a nowiki'ed /ref tag as end of text: . !