Module:Sandbox/K6ka/InfoboxLink: Difference between revisions

From The Sims Wiki, a collaborative database for The Sims series
Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
local getArgs = require('Module:Arguments').getArgs
local p = {}
local p = {}


function p.getTargetFromText(text)
function p.getTargetFromText(frame)
local text = frame.args[1]
return string.match(str, '^\[\[')
return string.match(frame, "^%[%[")
end
end


function p.wrapInLink(str)
function p.wrapInLink(frame)
local args = getArgs(frame)
if str:match('^\[\[') then
local text = args[1]
return str
if(string.match(text, "^%[%[") ~= nil) then
return text
end
end


return '[[' .. str .. ']]'
return '[[' .. text .. ']]'
end
end



Latest revision as of 17:22, 30 April 2019

Documentation for this module may be created at Module:Sandbox/K6ka/InfoboxLink/doc

local getArgs = require('Module:Arguments').getArgs
local p = {}

function p.getTargetFromText(frame)
    local text = frame.args[1]
    return string.match(frame, "^%[%[")
    end

function p.wrapInLink(frame)
	local args = getArgs(frame)
    local text = args[1]
  if(string.match(text, "^%[%[") ~= nil) then
    return text
  end

  return '[[' .. text .. ']]'
end

return p