Documentation for this module may be created at ሞድዩል:URL/doc
local z = {} function z.toLink(url, text) --if true then return 'url: ' .. (url or '') .. ' text: ' .. (text or '') end if not url or url:match('^%s*$') then return elseif url:find('%[') or url:match('^{{{.*}}}$') then -- For example, a template parameter, {{{web page|}}} return url elseif z.isValid(url) then fixedUrl = url else fixedUrl = 'http://' .. url end if text then return '[' .. fixedUrl .. ' ' .. text .. ']' else fixedText = fixedUrl:match('^http://(.+)') or fixedUrl:match('^https://(.+)') or fixedUrl -- Delete the / at the end fixedText = fixedText:match('(.+)/$') or fixedText return '[' .. fixedUrl .. ' ' .. fixedText .. ']' end end function z.url(frame) if not frame or not frame.args then return end return z.toLink(frame.args[1], frame.args[2]) end --function z.plainLink -- View the Plain link template --return --end -- See the checkurl function of the Citation/CS1 module. function z.isValid(url) return url:sub(1,2) == "//" or url:match( "^[^/]*:" ) end return z