From The Sims Wiki, a collaborative database for The Sims series
This is the current revision of this page, as edited by K6ka (talk | contribs) at 19:58, 30 April 2019 (K6ka moved page Module:InfoboxLink to Module:Addlink without leaving a redirect: Consistency w/ {{Delink}}). The present address (URL) is a permanent link to this version.
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This module's documentation page can be edited at Module:Addlink/doc.

This module sanitizies link input. It will add [[ ]] around text given to it, but will ignore it if it sees that square brackets are already present.



Both produce the following output:


Piped links also work.


Both produce:


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

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

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

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

return p