User:Ucucha/HarvErrors

__NOTOC__

{{HarvErrors|Ucucha=yes}}

Harvard citation templates like {{tl|Sfn}} are prone to problems with their automatically generated links (see {{oldid2|428212559#References}} for an extreme example). User:Ucucha/HarvErrors.js (based on User:Svick/HarvErrors.js) checks these links for validity and displays an error message for incorrect links. In addition, it checks for citations that are set up to receive links, but do not have any pointing to them.

For example, the following code produces an incorrect link and a citation without anything pointing to it:

Text{{Sfn|Smith|2011|p=9}}

{{reflist}}

References

  • {{cite book|last=Smith|first=John|year=2010|title=A Book|publisher=A Publisher}}

Text{{Sfn|Smith|2011|p=9}}

{{reflist}}

References

  • {{cite book|last=Smith|first=John|year=2010|title=A Book|publisher=A Publisher}}

With the script installed, this looks as follows (if you already have the script installed, you will see duplicate messages):

Text[1]

  1. ^ Smith 2011, p. 9. Harv error: link from CITEREFSmith2011 doesn't point to any citation.

References

  • {{cite book|last=Smith|first=John|year=2010|title=A Book|publisher=A Publisher}} Harv warning: There is no link pointing to this citation. The anchor is named CITEREFSmith2010.

Installation and customization

To install the script, add:

:importScript('User:Ucucha/HarvErrors.js');

to Special:MyPage/common.js.

If installed correctly, you will see a red error message in this note{{sfn|NoAuthor|2011}}

{{reflist}}

If you don't see an error message, you may still need to bypass your cache.

Fixing problems

{{seealso|Template:Harvard citation documentation#Possible issues}}

The problems caught by this script often have one of the following causes:

  • The work cited in the Harvard citation is not in the list of references. In this case, add e.g. *{{cite book |last=Smith |first=John |year=2010 ...}} to the list.
  • The work cited is in the reference list, but has {{para|ref}} set to something other than the default harv (which is set by all {{cite xxx}} and {{tl|citation}} templates by default).
  • The author(s) or year in the Harvard citation and the citation in the reference list do not match exactly. For example, the spelling of one of the names may be incorrect, or the year in the short and full citations may not match.
  • A Harvard citation was copied from one article to another, but the matching full citation from the first article's reference list was not copied.