মডিউল:URL: সংশোধিত সংস্করণের মধ্যে পার্থক্য
বিষয়বস্তু বিয়োগ হয়েছে বিষয়বস্তু যোগ হয়েছে
আফতাবুজ্জামান (আলোচনা | অবদান) সম্পাদনা সারাংশ নেই |
আফতাবুজ্জামান (আলোচনা | অবদান) সম্পাদনা সারাংশ নেই |
||
২৫ নং লাইন:
if url == '' then
if text == '' then
return mw.getCurrentFrame():expandTemplate{ title = 'tlx', args = { 'URL', "''example.com''", "''
else
return text
৬১ নং লাইন:
text = mw.ustring.lower(uri.host or '') .. port .. (uri.relativePath or '')
else -- URL is badly-formed, so just display whatever was passed in
text = url
৬৬ ⟶ ৭৩ নং লাইন:
end
▲ -- Add <wbr> before _/.-# sequences
▲ text = mw.ustring.gsub(text,"(/+)","<wbr/>%1") -- This entry MUST be the first. "<wbr/>" has a "/" in it, you know.
▲ text = mw.ustring.gsub(text,"(%.+)","<wbr/>%1")
▲ -- text = mw.ustring.gsub(text,"(%-+)","<wbr/>%1") -- DISABLED for now
▲ text = mw.ustring.gsub(text,"(%#+)","<wbr/>%1")
▲ text = mw.ustring.gsub(text,"(_+)","<wbr/>%1")
return mw.ustring.format('<span class="url">[%s %s]</span>', url, text)
end
৭৮ নং লাইন:
function p.url(frame)
local templateArgs = frame.args
local parentArgs = frame:getParent().args;
local url = templateArgs[1] or ''▼
local
if not text then
url = url or extractUrl(templateArgs) or extractUrl(parentArgs);
end
text = text or ''
return p._url(url, text)
end
function extractUrl(args)
for name, val in pairs(args) do
local url = name .. "=" .. val;
url = mw.ustring.gsub(url, '^[Hh][Tt][Tt][Pp]([Ss]?):(/?)([^/])', 'http%1://%3')
local uri = safeUri(url);
if uri and uri.host then
return url
end
end
end
return p
|