Jump to content

Module:Lang: Difference between revisions

m
1 revision imported
(thinsp after lit. per talk)
m (1 revision imported)
(2 intermediate revisions by 2 users not shown)
Line 385: Line 385:
end
end
end
end
else
else -- cheap way to determine if there are prefixes; fonipa and others don't have prefixes; # operator always returns 0
if not in_array (code, variant_table[variant]['prefixes']) then
if variant_table[variant]['prefixes'][1] and not in_array (code, variant_table[variant]['prefixes']) then
return code, script, region, nil, nil, table.concat ({'unrecognized variant: ', variant, ' for code: ', code});
return code, script, region, nil, nil, table.concat ({'unrecognized variant: ', variant, ' for code: ', code});
end
end
end
end
end
end
 
if is_set (private) then
if is_set (private) then
private = private:lower(); -- ensure that we use and return lower case version of this
private = private:lower(); -- ensure that we use and return lower case version of this
Line 510: Line 510:


table.insert (html, table.concat ({'<', tag})); -- open the <i>, <span>, or <div> html tag
table.insert (html, table.concat ({'<', tag})); -- open the <i>, <span>, or <div> html tag
code = code:gsub ('%-x%-.*', ''); -- strip private use subtag from code tag because meaningless outside of wikipedia
table.insert (html, table.concat ({' lang="', code, '\"'})); -- add language attribute
table.insert (html, table.concat ({' lang="', code, '\"'})); -- add language attribute