Module:Footnotes
Appearance
![]() | This module is rated as ready for general use. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
![]() | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
![]() | This Lua module is used on approximately 331,000 pages, or roughly 1% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
![]() | This module depends on the following other modules: |
Implements {{sfn}}, {{harvard citation}}, and variants of those templates.
For an explanation of generated error messages and how to alter their appearance, see here.
For end-to-end tests of the sandbox version of this module, see Template:Sfnp/test 1, Template:Sfnp/test 2 and Template:Sfnp/test 3.
Tracking categories
f = {};
function core( args )
local result;
if args.P5 ~= "" then
result = args.P1 .. ' et al. ' .. args.bracket_year_left .. args.P5;
elseif args.P4 ~= "" then
result = args.P1 .. ', ' .. args.P2 .. ' & ' .. args.P3 .. ' ' .. args.bracket_year_left .. args.P4;
elseif args.P3 ~= "" then
result = args.P1 .. ' & ' .. args.P2 .. ' ' .. args.bracket_year_left .. args.P3;
else
result = args.P1 .. ' ' .. args.bracket_year_left .. args.P2
end
if args.ref ~= 'none' then
if args.ref ~= "" then
result = "[[#" .. args.ref .. "|" .. result .. "]]";
else
result = "[[#CITEREF" .. args.P1 .. args.P2 .. args.P3 .. args.P4 .. args.P5 .. "|" .. result .. "]]";
end
end
if args.page ~= "" then
result = result .. args.page_sep .. args.page;
elseif args.pages ~= "" then
result = result .. args.pages_sep .. args.pages;
end
if args.location ~= "" then
result = result .. ", " .. args.location;
end
result = args.bracket_left .. result .. args.bracket_right .. args.postscript;
return result;
end
function f.harvard_core( frame )
local args = {};
args.bracket_left = frame.args.BracketLeft or "";
args.bracket_right = frame.args.BracketRight or "";
args.postscript = frame.args.Postscript or "";
args.page = frame.args.Page or "";
args.pages = frame.args.Pages or "";
args.location = frame.args.Location or "";
args.page_sep = frame.args.PageSep or "";
args.pages_sep = frame.args.PagesSep or "";
args.ref = frame.args.REF or "";
args.P1 = frame.args[1] or "";
args.P2 = frame.args[2] or "";
args.P3 = frame.args[3] or "";
args.P4 = frame.args[4] or "";
args.P5 = frame.args[5] or "";
return core( args );
end
function f.harvard_citation( frame )
local args = {};
pframe = frame:getParent();
args.bracket_left = "(";
args.bracket_right = ")";
args.postscript = "";
args.page = pframe.args.p or pframe.args.page or "";
args.pages = pframe.args.pp or pframe.args.pages or "";
args.location = frame.args.loc or "";
args.page_sep = ", p. ";
args.pages_sep = ", pp. ";
args.ref = pframe.args.ref or pframe.args.REF or "";
args.P1 = pframe.args[1] or "";
args.P2 = pframe.args[2] or "";
args.P3 = pframe.args[3] or "";
args.P4 = pframe.args[4] or "";
args.P5 = pframe.args[5] or "";
return core( args );
end
function f.harvard_citation_no_bracket( frame )
local args = {};
pframe = frame:getParent();
args.bracket_left = "";
args.bracket_right = "";
args.postscript = "";
args.page = pframe.args.p or pframe.args.page or "";
args.pages = pframe.args.pp or pframe.args.pages or "";
args.location = frame.args.loc or "";
args.page_sep = ", p. ";
args.pages_sep = ", pp. ";
args.ref = pframe.args.ref or pframe.args.REF or "";
args.P1 = pframe.args[1] or "";
args.P2 = pframe.args[2] or "";
args.P3 = pframe.args[3] or "";
args.P4 = pframe.args[4] or "";
args.P5 = pframe.args[5] or "";
return core( args );
end