-- Implements [[Template:Main]]
local p = {}
local err = require("Module:Error")
local yn = require("Module:Yesno")
local function link(l, t)
	return string.format("[[%s|%s]]", l, yn(t) and t or l)
function p.main(frame)
	local args = frame:getParent().args
	local text = "Main article: "
	local mid
	if not yn(args[1]) then return err("Main: No parameters supplied") end
	if not yn(args[2]) then return[1], yn(args["l1"]) and args["l1"] or args[1]) end
	-- Loop through the args
	local i = 1
	text = "Main articles: "
		if yn(args[i+1]) then
			mid = yn(args[i+2]) and ", " or " and "
		else mid = ""
		text =[i], (yn(args["l"..i])) and args["l"..i] or args[i]) .. mid
		i = i + 1
	until not yn(args[i])
	return text
return p
-- [[Category:Lua Modules]]
Community content is available under CC-BY-SA unless otherwise noted.