Module:Sandbox/Erutuon: Difference between revisions

Content deleted Content added
Undid revision 848709251 by Erutuon (talk)
start parse_IETF
Line 354:
return table.concat(m_table.keysToList(language_codes), ', ')
end
 
function p.parse_IETF(tag)
local subtags = mw.text.split(tag, "-")
local patterns = {
{ '^%a%a%a?$', '^1%a+$', type = 'code' }, -- ll or lll; special case
{ '^%a%a%a%a$', type = 'script' }, -- Ssss
{ '^%a%a$', '^%d%d%d$', type = 'region' }, -- rr, DDD
{
'^%d%d%d%d$', -- 4 digits
'^[%a%d][%a%d][%a%d][%a%d][%a%d][%a%d]?[%a%d]?[%a%d]?$', -- 5-8 alnum characters
type = 'variant'
}
}
end