btw this Wiki is not meant for a wider audience yet

Module:PrefixList

From HFGCS Wiki
Jump to navigation Jump to search

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 item format
       -- Otherwise, use item format
       if linkTarget and linkTarget ~= "" then
           table.insert(items, "" .. item .. "")
       else
           table.insert(items, "" .. item .. "")
       end
   end
   
   return table.concat(items, "
")

end return p