Modul:LegăturăTelefon
Aspect
Documentația acestui modul poate fi creată la Modul:LegăturăTelefon/doc
local i = {}
function i.LinkPhone(frame)
local demo = frame.args["demo"] or '';
local txt = frame.args[1] or '';
local link = txt;
local catprefix = '';
local catMissingCountryCode = '';
local catFormatIssue = '';
local output;
if demo == 'true' then
catprefix = ':';
end
link = mw.ustring.gsub(txt, ' ', '');
link = mw.ustring.gsub(link, "'", "");
if mw.ustring.sub(link, 1, 1) ~= '+' then
catMissingCountryCode = '[[' .. catprefix .. 'Categorie:Intrare cu telefon fără codul de țară]]'
end
if mw.ustring.match(link,"^%+[%d-() ]+$") ~= nil then
output = '<span class="plainlinks nourlexpansion">[tel:' .. link .. ' ' .. txt ..']</span>';
else
output = txt;
if mw.ustring.match('+' .. link,"^%+[%d-() ]+$") == nil then
catFormatIssue = '[[' .. catprefix .. 'Categorie:Intrare cu probleme în formatul telefonului]]'
end
end
if mw.ustring.match(link,"%(0%)") ~= nil then
catFormatIssue = '[[' .. catprefix .. 'Categorie:Intrare cu probleme în formatul telefonului]]'
end
if catFormatIssue ~= '' then
output = txt;
end
return output .. catFormatIssue.. catMissingCountryCode;
end
return i;