Module:PrefixList
This Module is used by {{Template:YYMMDD Infobox}} for the p# fields (p1,p2,p3,p4...)
local p = {}
function p.makeLinks(frame)
local input = frame.args[1]
local linkTarget = frame.args[2] -- Optional second parameter for link target
if not input or input == "" then
return "n/a"
end
local items = {}
for item in string.gmatch(input, "[^,]+") do
item = item:match("^%s*(.-)%s*$") -- trim whitespace
-- If linkTarget is provided, use [[linkTarget|item]] format
-- Otherwise, use [[item]] format
if linkTarget and linkTarget ~= "" then
table.insert(items, "[[" .. linkTarget .. "|" .. item .. "]]")
else
table.insert(items, "[[" .. item .. "]]")
end
end
return table.concat(items, "→")
end
return p