Module:Sandbox/Naypta/Autolink Explained

local p =

function p.link(frame) if (frame.args[1]

nil) then error("No link provided") end if (mw.ustring.match(frame.args[1], "^%w+:%/%/") ~= nil) then return "[" .. frame.args[1] .. generateEnd(frame.args[2], true) else return "" .. frame.args[1] .. generateEnd(frame.args[2], false) endend

function generateEnd(linkName, isEL) endBit = "

" if (linkName ~= nil) then endBit = linkName .. endBit end if (isEL

true) then endBit = " " .. endBit elseif (linkName ~= nil) then endBit = "|" .. endBit .. "]" else endBit = endBit .. "]" end return endBitend

return p