Module:LinkUtil: Difference between revisions
From Tardis Wiki, the free Doctor Who reference
Bongolium500 (talk | contribs) No edit summary |
Bongolium500 (talk | contribs) No edit summary |
||
Line 11: | Line 11: | ||
local ret = str:gsub('%|.*','') | local ret = str:gsub('%|.*','') | ||
return ret | return ret | ||
end | |||
function p.addLink(page, display) | |||
local ret = '[[' .. page | |||
if display then | |||
ret = ret .. '|' .. display .. ']]' | |||
else | |||
ret = ret .. ']]' | |||
end | |||
return ret | |||
end | |||
function p.addPipedLink(page) | |||
local ret = '[[' .. page .. '|]]' | |||
return ret | |||
end | end | ||
return p | return p |
Revision as of 21:19, 16 April 2022
Documentation for this module may be created at Module:LinkUtil/doc
local p = {} --p stands for package
-- from https://lol.fandom.com/wiki/Module:EsportsUtil
function p.stripDab(str)
-- don't return second values
local ret = str:gsub('_', ' '):gsub('%s*%(.*%)','')
return ret
end
function p.stripPipe(str)
local ret = str:gsub('%|.*','')
return ret
end
function p.addLink(page, display)
local ret = '[[' .. page
if display then
ret = ret .. '|' .. display .. ']]'
else
ret = ret .. ']]'
end
return ret
end
function p.addPipedLink(page)
local ret = '[[' .. page .. '|]]'
return ret
end
return p