More actions
Created page with "function hatnoteDistinguish(frame) local args = frame.args local final = {} for k, v in ipairs(args) do if k == #args then table.insert(final, "or") end table.insert(final, "" .. v .. "") end -- stuff return table.concat(final, ", ") end return {["hatnote"] = hatnoteDistinguish}" |
m lua doin a little trollin |
||
(11 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
function hatnoteDistinguish(frame) | function hatnoteDistinguish(frame) | ||
local args = frame.args | local args = frame:getParent().args | ||
if not args[1] then return frame:expandTemplate { title = [[Hatnote]]; args = { [[Not to be confused. ]]; }; }; end; | |||
local final = {} | local final = {} | ||
for k, v in ipairs(args) do | for k, v in ipairs(args) do | ||
if | table.insert(final, "[[" .. v .. "]]") | ||
end | |||
local sep = " " | |||
if #final > 1 then | |||
final[#final] = "or " .. final[#final] | |||
if #final > 2 then | |||
sep = ", " | |||
else | |||
sep = " " | |||
end | end | ||
end | end | ||
return frame:expandTemplate{title = "Hatnote", args = {"Not to be confused with " .. table.concat(final, sep) .. "."}} | |||
return table.concat(final, " | |||
end | end | ||
return {["hatnote"] = hatnoteDistinguish} | return {["hatnote"] = hatnoteDistinguish} |
Latest revision as of 01:39, 29 September 2024
- Not to be confused.
- Not to be confused with Foo.
function hatnoteDistinguish(frame)
local args = frame:getParent().args
if not args[1] then return frame:expandTemplate { title = [[Hatnote]]; args = { [[Not to be confused. ]]; }; }; end;
local final = {}
for k, v in ipairs(args) do
table.insert(final, "[[" .. v .. "]]")
end
local sep = " "
if #final > 1 then
final[#final] = "or " .. final[#final]
if #final > 2 then
sep = ", "
else
sep = " "
end
end
return frame:expandTemplate{title = "Hatnote", args = {"Not to be confused with " .. table.concat(final, sep) .. "."}}
end
return {["hatnote"] = hatnoteDistinguish}