Changes
Jump to navigation
Jump to search
-- This is used by templates such as {{Harvard citation}} to create the Harvard footnotefunction anchorid(frame) local P1 = frame.args[1] or "" local P2 = frame.args[2] or "" local P3 = frame.args[3] or "" local P4 = frame.args[4] or "" local P5 = frame.args[5] or "" return "CITEREF" .. P1 .. P2 .. P3 .. P4 .. P5end function name(frame) local P1 = frame.args[1] or "" if ( frame.args[5] ~= nil) then return P1 .. " et al." else local P2 = frame.args[2] or "" local P3 = frame.args[3] or "" local P4 = frame.args[4] or "" if ( frame.args[4] ~= nil ) then P4 = " & " .. P4 end if ( frame.args[3] ~= nil ) then P3 = " & " .. P3 end if ( frame.args[2] ~= nil ) then P2 = " & " .. P2 end return P1 .. P2 .. P3 .. P4 end end function crossref(frame) local LB = frame.BracketLeft or "" local RB = frame.BracketRightt or "" local anchor = frame.ref or frame.Ref or anchorid(frame) local text = name(frame) local loc = frame.loc or "" local page = frame.por frame.page or nil local pages = frame.Harvardpp or frame.pages or nil if ( page ~= nil ) then local pagesep = frame.PageSep or "" text = text .. pagesep .. page end if (pages ~= nil )then local pagessep = frame.PagesSep or "" text = text .. pagessep .. pages end local ps = frame.Postscript or "" return LB .. "PLACEHOLDER[[#".. anchor .. "|" .. text .. "]]" .. RB .. ps
local P1 = return anchorid(pframe)end -- This is used by templates such as {{Harvard citation}} to create the Harvard cross-reference text.function p.args[1] or ""Harvard(frame) local P2 pframe = frame:getParent() return crossref(pframe)end -- This is used by templates such as {{sfn}} to create the entire cross-reference.args[2] or ""function p.sfn(frame) local P3 pframe = pframe.args[3] or ""frame:getParent() local P4 content = crossref(pframe.args[4] or "") local P5 args = { name = anchorid(pframe.args[4] or "") } return mw.text.tag({name = "CITEREFref" .. P1 .. P2 .. P3 .. P4 .. P5, contents = content, params = args})
Incorporated the logic of Template:sfn into a LUA function.
local p = {}
end
-- This is used by templates such as {{SfnRef}} to create the (encoded) anchor name for a Harvard cross-reference hyperlink.
function p.SFNID(frame)
local pframe = frame:getParent()
end
return p