跳转到内容

模組:Infobox animanga/other2

维基百科,自由的百科全书

这是本页的一个历史版本,由Cwek留言 | 贡献2014年10月10日 (五) 08:06编辑。这可能和当前版本存在着巨大的差异。

local ia_other={}
function ia_other.main(frame)
    local args=frame:getParent().args

    local key_model=[[|-
! colspan="2" style="background: #ccf; text-align: center;" nowrap | ]]
    local val_model=[[|-
| colspan="2" style="padding: 0;"|]]
    local body=""
    local entry={}
    
    local i=1
    while true do--frame的args不是完全table实现,无法用#args查表长,只能死循环试探结束。
        t_key=args['key'..i]
        t_val=args['value'..i] or ""
        
        if (t_key~=nil) then   
            t_item={
                    ["key"]=t_key,
                    ["val"]=t_val
                    }
            table.insert(entry,t_item)
            i=i+1
        else
            break
        end 
    end    
    
    for k,v in ipairs(entry) do
        local key=v.key
        local val=v.val
        
        body =body +
              key_model + key + "\n"+
              val_model + val + "\n"
    end   
    
    local out=[[<noinclude>{{pp-protected|small=yes}}
<div class="messagebox standard-talk">使用方法請看\[\[Template:Infobox animanga\]\]。</div>
{| class="infobox bordered" style="width: 20em; font-size: smaller; text-align: left;"
</noinclude>
]]+
    body+
[[
<noinclude>
|}
]]
    return out;
end 

return ia_other