Open main menu

Changes

Module:Citation

554 bytes added, 17:50, 30 August 2012
Added switch from talk page.
end
function listpeoplereducetoinitials(config, peoplefirst) local text initials = {} for word in string.gmatch(first, "%S+") do table.insert(initials, string.sub(word,1,1) .. ".") local sep = configend return table.AuthorSep or concat(initials, "&#59;")end function listpeople(sep, format, mask, people) local text = {}
for i,person in ipairs(people) do
if (person.last ~= nil) then
local one = person.last
local first = person.first if (person.first ~= nil) then if ( "vanc" == format ) then first = reducetoinitials(first) end one = one .. ", " .. person.first end
if (person.link ~= nil) then one = "[[" .. person.link .. "|" .. one .. "]]" end
text = text .. one
if ( people[i + 1] ~= nil ) then text = text .. sep .. " " end
end
end
return table.concat(text, sep .. " ")
end
local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
local AuthorSep = config.AuthorSep or "&#59;"  -- Pick out the relevant fields from the arguments. Different citation templates define different field names for the same underlying things. local AuthorMask = args.authormask or args["author-mask"] local AuthorFormat = args["author-format"] or args.authormaskauthorformat
local Authors = args.authors
local i
local Coauthors = args.coauthors or args.coauthor
local Others = args.others
local EditorMask = args.editormask or args["editor-mask"]
local EditorFormat = args["editor-format"] or args.editorformat
local Editors = args.editors
local e = {}
-- Now perform various field substitutions.
-- We also add leading spaces and surrounding markup and punctuation to the various parts of the citation, but only when they are non-nil.
if ( Authors == nil ) then Authors = listpeople(configAuthorSep, AuthorFormat, AuthorMask, a) end if ( Editors == nil ) then Editors = listpeople(configAuthorSep, EditorFormat, EditorMask, e) end
if ( Date == nil ) then
Date = Year
Anonymous user