Module:Link Label

local p = {}

local TERMS = { ' %(Quest%)', ' %(Chapter%)', ' %(Act%)', ' %(Archon Quest%)', ' %(World Quest%)', ' %(Hangout Event%)', ' %(Event Quest%)', ' %(Event Chapter%)', ' %(Event Act%)', ' %(Commission%)', ' %(Soundtrack%)', ' %(Album%)', ' %(Event%)', ' %(NPC%)', ' %(Domain%)', ' %(Quest Domain%)', ' %(Achievement%)', }

function p.main(frame) local args = require('Module:Arguments').getArgs(frame, {		parentFirst = true,		wrapper = { 'Template:Link Label' }	}) return p._main(args) end

function p.getTerms local result = mw.html.create for _, term in ipairs(TERMS) do		local replacedTerm, _ = term:gsub('%%', '') result:newline:wikitext('* '):tag('code'):wikitext(replacedTerm):done end return result end

function p._main(args) local link = type(args) == 'table' and args[1] or args if (link == nil or type(link) == 'table') then return '' end link = tostring(link) if (link:find('%|')) then return link end -- if link contains multiple links local _, count = link:gsub('%[%[', '') if (count > 1) then return link end if (link:find('%[%[') and link:find('%]%]')) then link = link:gsub('%[%[', ):gsub('%]%]', ) end local label = link for _, term in ipairs(TERMS) do		if (link:find(term)) then label = link:gsub(term, '') end end return  .. label ..  end

return p