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

edit

This javascript can be added to monobook.js with {{subst:js|User:Gimmetrow/fixRefs.js}}. This javascript creates a link called "Fix reference marks" visible while a page is being edited.

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

Examples

edit

The tab handles the following:

[6] [13][7][8] [14] [15]

[6],[16][7][8] [17] [18] ?

  • Also "quotes," [19] , and "quotes;" [5] .
  • Single 'quotes,' [6] ; and 'closing smart-quotes,’ [7] !
  • "Quotes"[6], "quotes"[6]; "quotes"[6].
  • "Quotes."[6], "quotes."[6]; "quotes."[6].
  • "Quotes?"[6], "quotes?"[6]; "quotes?"[6].
  • "Quotes:"[6], "quotes;"[6]: "quotes:"[6]!
  • "Quotes,"[6]! "quotes;"[6]! "quotes."[6]!
  • "Quotes?"[6]! "quotes!?!"[6]? "quotes?"[6]!?!
  • Does "some 'quotes within quotes,'" [5] ;[quote needs citation].
  • Multiple punctuation is fixed after a ref [5] .;.,.
  • Allows spaces in some templates, like {{ fact }} [citation needed] .
  • Allows capitalization, like {{ Fact }} and <REF> [citation needed] [5].
  • <references/> tag remains untouched.

Known issues to look out for

edit
  • Messes up abbreviations in "quotes, eg."[5], and not eg. [6];
  • Messes up ellipsis in "quotes..."[5], and without quotes [6] ...
    • If there is no following punctuation, the ref/abbreviation/ellipsis is unchanged
  • Refs with dashes and parenthesis not addressed
  • Comments can obscure matches <ref>like so</ref><!-- comment -->.
  • Refs within comments are adjusted too <!-- <ref>like so</ref> -->
  • Removes spaces before trailing > in named refs, as in <ref name="a b c"/ >.
    • This forces <ref name="abc"/ > to be the same as <ref name="abc"/>.
    • This is only an issue for ref names ending in / outside quotes
    • Ref may parse the above differently after spaces are removed - ideally avoid this
    • Compare <ref name="abc"/ > Stuff.<ref name="cde/" >text</ref>

Obscure or unlikely to occur in real articles

edit
  • Repeated ? or ! both kept outside a quote? [5]!
  • Ref parses a nowiki'ed /ref tag as end of text: [20]</nowiki>.</ref>!

References

edit
  1. blah
  2. blah
  3. blah
  4. blah
  5. 1 2 3 4 5 6 7 8 9 10 11 12 13 blah
  6. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 blah
  7. 1 2 3 4 5 6 blah
  8. 1 2 3 4 5 blah
  9. blah that.
  10. blah that
  11. Like so: </refzzzzz>.
  12. blah
  13. blah
  14. blah
  15. blah
  16. blah
  17. blah
  18. blah
  19. blah
  20. Use the <nowiki>