请输入您要查询的百科知识:

 

词条 Module:QuidAppearances
释义

local yesno = require('Module:Yesno')

local ordinal = require('Module:Ordinal')._ordinal

local p = {}

function p.style(pos, host)

local style = (host and "border:3px solid red;" or )

if pos == '1' then style = style .. "background-color:gold;"

elseif pos == '2' then style = style .. "background-color:silver;"

elseif pos == '3' then style = style .. "background-color:#CC9966;"

elseif pos == '4' then style = style .. "background-color:#9ACDFF;"

end

return (style ~= and ('style="' .. style .. '" ') or )

end

function p.sort_value(pos)

local n =

if pos == '.' then n = 999

elseif pos == 'W' then n = 998

elseif pos == 'Q' then n = 997

else n = pos

end

return 'data-sort-value="' .. n .. '" '

end

function p.content(pos)

if tonumber(pos) then return ordinal(pos)

elseif pos == '.' then return "•"

elseif pos == 'W' then return "{{Tooltip|WD|Withdrew}}"

elseif pos == 'Q' then return "{{Tooltip|Q|Qualified}}"

else return pos

end

end

function p.cell(pos)

local host = false

if pos == nil then return end

if mw.ustring.sub(pos, 1, 1) == 'H' then

host = true

pos = mw.ustring.sub(pos, 2)

end

return p.style(pos, host) .. p.sort_value(pos) .. '| ' .. p.content(pos)

end

function p.appeared(pos)

return mw.ustring.sub(pos, 1, 1) == 'H' and tonumber(mw.ustring.sub(pos, 2)) or tonumber(pos)

end

function p.main(frame)

    -- If called via #invoke, use the args passed into the invoking template.    if frame == mw.getCurrentFrame() then        args = frame:getParent().args    else        args = frame.args    end    local result = '| style="text-align:left;" | {{quid|' .. args[1] .. '}} || '

local appearances = 0

    for key, value in ipairs(args) do    	if key ~= 1 then    		result = result .. p.cell(value) .. ' || '    		if p.appeared(value) then appearances = appearances + 1 end    	end    end    result = result .. " '''" .. appearances .. "'''\|-\"

return frame:preprocess(result)

end

return p

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/12 23:39:21