Module:Lang: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(restore italic markup test to {{lang}};)
(make is_latn() accessible to Module:Lang/utilities)
Line 63: Line 63:
]]
]]


local function is_latn (text)
function p.is_latn (text)
local latn = table.concat (
local latn = table.concat (
{
{
Line 728: Line 728:


if nil == args.italic then -- nil when |italic= absent or not set or |italic=default; args.italic controls
if nil == args.italic then -- nil when |italic= absent or not set or |italic=default; args.italic controls
if ('latn' == subtags.script) or (is_latn (args.text) and 'en' ~= code) then -- script set to latn or text is wholly latn script but not rendering English
if ('latn' == subtags.script) or (p.is_latn (args.text) and 'en' ~= code) then -- script set to latn or text is wholly latn script but not rendering English
args.italic = 'italic'; -- DEFAULT for {{lang}} templates is upright; but if latn script set for font-style:italic
args.italic = 'italic'; -- DEFAULT for {{lang}} templates is upright; but if latn script set for font-style:italic
else
else
Line 925: Line 925:
table.insert (out, make_text_span (args.code, args.text, args.rtl, args.italic, args.size))
table.insert (out, make_text_span (args.code, args.text, args.rtl, args.italic, args.size))


if is_set (args.translit) and not is_latn (args.text) then -- transliteration (not supported in {{lang}}); not supported when args.text is wholly latn text (this is an imperfect test)
if is_set (args.translit) and not p.is_latn (args.text) then -- transliteration (not supported in {{lang}}); not supported when args.text is wholly latn text (this is an imperfect test)
table.insert (out, ', '); -- comma to separate text from translit
table.insert (out, ', '); -- comma to separate text from translit
if 'none' ~= args.label then
if 'none' ~= args.label then