Module:Citation/CS1: Difference between revisions
convert extractauthor to extractauthors, etc., less coping of parameters back and forth. Possibly better for performance.
m>Dragons flight (formatting and comments) |
m>Dragons flight (convert extractauthor to extractauthors, etc., less coping of parameters back and forth. Possibly better for performance.) |
||
Line 301: | Line 301: | ||
return LB .. "[[" .. pagename .. "#" .. anchor .. "|" .. text .. "]]" .. loc .. RB .. ps | return LB .. "[[" .. pagename .. "#" .. anchor .. "|" .. text .. "]]" .. loc .. RB .. ps | ||
end | end | ||
function | function extractauthors(args) | ||
local last = args["author" .. i .. "-last"] or args["author-last" .. i] or args["last" .. i] or args["surname" .. i] or args["Author" .. i] or args["author" .. i] | local authors = {}; | ||
local i = 1; | |||
local last; | |||
while true do | |||
last = args["author" .. i .. "-last"] or args["author-last" .. i] or args["last" .. i] or args["surname" .. i] or args["Author" .. i] or args["author" .. i] | |||
if ( last and "" < last ) then -- just in case someone passed in an empty parameter | |||
authors[i] = { | |||
last = last, | |||
first = args["author" .. i .. "-first"] or args["author-first" .. i] or args["first" .. i] or args["given" .. i], | |||
link = args["author" .. i .. "-link"] or args["author-link" .. i] or args["author" .. i .. "link"] or args["authorlink" .. i], | |||
mask = args["author" .. i .. "-mask"] or args["author-mask" .. i] or args["author" .. i .. "mask"] or args["authormask" .. i] | |||
} | |||
else | |||
break; | |||
end | |||
i = i + 1; | |||
end | end | ||
return authors; | |||
end | end | ||
function | function extracteditors(args) | ||
local last = args["editor" .. i .. "-last"] or args["editor-last" .. i] or args["EditorSurname" .. i] or args["Editor" .. i] or args["editor" .. i] | local editors; | ||
local i = 1; | |||
local last; | |||
while true do | |||
local last = args["editor" .. i .. "-last"] or args["editor-last" .. i] or args["EditorSurname" .. i] or args["Editor" .. i] or args["editor" .. i] | |||
if ( last and "" < last ) then -- just in case someone passed in an empty parameter | |||
editors[i] = { | |||
last = last, | |||
first = args["editor" .. i .. "-first"] or args["editor-first" .. i] or args["EditorGiven" .. i], | |||
link = args["editor" .. i .. "-link"] or args["editor-link" .. i] or args["editor" .. i .. "link"] or args["editorlink" .. i], | |||
mask = args["editor" .. i .. "-mask"] or args["editor-mask" .. i] or args["editor" .. i .. "mask"] or args["editormask" .. i] | |||
} | |||
else | |||
break; | |||
end | |||
i = i + 1; | |||
end | end | ||
return editors; | |||
end | end | ||
Line 359: | Line 375: | ||
local Authors = args.authors | local Authors = args.authors | ||
local i | local i | ||
local a = | local a = extractauthors( args ); | ||
local Coauthors = args.coauthors or args.coauthor | local Coauthors = args.coauthors or args.coauthor | ||
local Others = args.others | local Others = args.others | ||
Line 371: | Line 382: | ||
local EditorFormat = args["editor-format"] or args.editorformat | local EditorFormat = args["editor-format"] or args.editorformat | ||
local Editors = args.editors | local Editors = args.editors | ||
local e = | local e = extracteditors( args ); | ||
local Year = args.year | local Year = args.year | ||
local PublicationDate = args.publicationdate or args["publication-date"] | local PublicationDate = args.publicationdate or args["publication-date"] |