模块:WorldLine
跳到导航
跳到搜索
此模块的文档可以在模块:WorldLine/doc创建
local worldline = {}
function worldline.format(frame)
local args = str._getParameters(frame.args, {'world_line'})
local source = args.world_line or ''
local dot_pos mw.ustring.find(source, '.', 1, true)
local marker = '?'
if dot_pos ~= nil then
local major = mw.ustring.sub(source, 1, dot_pos - 1);
if major == '-0' then
marker = 'Ω'
elseif major == '0' then
marker = 'α'
elseif major == '1' then
local prefix = mw.ustring.sub(source, 1, 4)
if prefix == '1.00' or prefix == '1.01' or prefix == '1.02' or prefix == '1.03' then
marker = '?'
elseif prefix == '1.04' then
if source == '1.048596' then
marker = 'SG'
else
marker = 'X'
end
else
marker = 'β'
end
elseif major == '2' then
marker = 'γ'
elseif major == '3' then
marker = 'δ'
elseif major == '4' then
marker = 'ε'
else
marker = '?'
end
end
return source..'('..marker..')'
end
function worldline._getParameters( frame_args, arg_list )
local new_args = {}
local index = 1
local value
for _, arg in ipairs( arg_list ) do
value = frame_args[arg]
if value == nil then
value = frame_args[index]
index = index + 1
end
new_args[arg] = value
end
return new_args
end
return worldline