Module:Citation

From Warwick Wiki
Revision as of 19:41, 6 July 2025 by AlfieG (talk | contribs) (Created page with "local p = {} local h = {} function p.citation(frame) local args = frame:getParent().args local data = {} data["authors"] = args["authors"] or "" if data["authors"] == "" then local finished = false local i = 1 while not finished do if i == 1 then local displayText = "" if args["author"] or args["author1"] then displayText = displayText .. (args["author"] or args["author1"]) elseif args["last"] or args["last1"] then displayText = disp...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Powers {{citation}}.


local p = {}
local h = {}

function p.citation(frame)
	local args = frame:getParent().args
	local data = {}
	
	data["authors"] = args["authors"] or ""
	if data["authors"] == "" then
		local finished = false
		local i = 1
		while not finished do
			if i == 1 then
				local displayText = ""
				if args["author"] or args["author1"] then
					displayText = displayText .. (args["author"] or args["author1"])
				elseif args["last"] or args["last1"] then
					displayText = displayText .. (args["last"] or args["last1"])
					if args["first"] or args["first1"] then
						displayText = displayText .. ", " .. (args["first"] or args["first1"])
					end
				end
				if args["author-link"] or args["author-link1"] then
					data["authors"] = data["authors"] .. "[[" .. (args["author-link"] or args["author-link1"]) .. "|" .. displayText .. "]]"
				else
					data["authors"] = displayText
				end
			else
				--tba, mostly same logic
			end
		end
	end
end