Module:Distinguish: Difference between revisions

From FiguraMC
mNo edit summary
PenguinEncounter (talk | contribs)
Use template arguments (instead of #invoke arguments)
Line 1: Line 1:
function hatnoteDistinguish(frame)
function hatnoteDistinguish(frame)
local args = frame.args
local args = frame:getParent().args
local final = {}
local final = {}

Revision as of 01:24, 29 September 2024

  • Not to be confused with .
  • Not to be confused with Foo.
  • Not to be confused with Foo or Bar.
  • Not to be confused with Foo, Bar, or Baz.

function hatnoteDistinguish(frame)
	local args = frame:getParent().args
	local final = {}
	
	for k, v in ipairs(args) do
		table.insert(final, "[[" .. v .. "]]")
	end
	if #final > 1 then
		final[#final] = "or " .. final[#final]
	end
	return frame:expandTemplate{title = "Hatnote", args = {"Not to be confused with " .. table.concat(final, (#final <= 2 and " ") or ", ") .. "."}}
end

return {["hatnote"] = hatnoteDistinguish}