Content deleted Content added
Line 95:
:I added {{tag|syntaxhighlight}} to make your code more readable. How does this change make {{tlx|Infobox time zone}} {{tq|work more reliably}}? If that template is 'unreliable', shouldn't fixes be applied there? Why is your proposed code so complex? Can't it be made simpler?
:—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 16:04, 8 August 2018 (UTC)
::Wouldn't this work just as well?
<syntaxhighlight lang=Lua style="margin-left:4.8em">function p.offset (frame)
local args = getArgs(frame);
if args[1] then
args[1] = args[1]:lower();
if not is_set (tz[args[1]]) then
return '<span style="font-size:100%" class="error">{{time}} – unknown timezone ([[Template:Time#Error messages|help]])</span>';
end
end
return table.concat ({'[[UTC', tz[args[1]].utc_offset:gsub ('^(%d)', '+%1'):gsub ('^-', '−'), ']]'});
end</syntaxhighlight>
::—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 16:37, 8 August 2018 (UTC)
|