Jump to content

User:Wikitiki89/testmod.lua

From Wikipedia

local z = {}

function z.languageifyLinks(frame)

   local pframe = frame:getParent()
   local args = pframe.args -- the arguments passed TO the template, in the wikitext that instantiates the template
   local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
   
   local text = args[1] or ""
   local langname = args[2] or "English"
   
   -- handle unpiped wikilinks:
   text = text:gsub("%[%[([^%[%]|{}#]+)%]%]", "%1")
   -- handled piped wikilinks:
   text = text:gsub("%[%[([^%[%]|{}#]+)|([^%[%]|{}]+)%]%]", "%2")
   
   return text

end

return z