ผลต่างระหว่างรุ่นของ "มอดูล:Sandbox/Nullzero/multicoldpl"

จาก วิกิตำรา
เนื้อหาที่ลบ เนื้อหาที่เพิ่ม
Nullzero (คุย | ส่วนร่วม)
หน้าที่ถูกสร้างด้วย 'local p = {} function p.gen(frame) local category = frame.args.category or frame.args[1] local column = tonumber(frame.args.co...'
 
Nullzero (คุย | ส่วนร่วม)
ไม่มีความย่อการแก้ไข
 
บรรทัดที่ 7: บรรทัดที่ 7:
local t = {"<table><tr>"}
local t = {"<table><tr>"}
for i = 1, column do
for i = 1, column do
table.insert(t, "<td><dynamicpagelist>\ncategory = " .. category ..
table.insert(t, "<td style='vertical-align:top;'><dynamicpagelist>\ncategory = " .. category ..
"\ncount = " .. each ..
"\ncount = " .. each ..
"\noffset = " .. tostring((i - 1) * each) ..
"\noffset = " .. tostring((i - 1) * each) ..
"\nordermethod = sortkey" ..
"\norder = ascending" ..
"</dynamicpagelist>" .. "</td>")
"</dynamicpagelist>" .. "</td>")
end
end

รุ่นแก้ไขปัจจุบันเมื่อ 21:55, 22 มีนาคม 2556

เอกสารการใช้งานสำหรับมอดูลนี้อาจสร้างขึ้นที่ มอดูล:Sandbox/Nullzero/multicoldpl/doc

local p = {}

function p.gen(frame)
    local category = frame.args.category or frame.args[1]
    local column = tonumber(frame.args.column or frame.args[2] or 3)
    local each = tostring(math.ceil(tonumber(frame:preprocess("{{PAGESINCATEGORY:" .. category .. "}}")) / column))
    local t = {"<table><tr>"}
    for i = 1, column do
        table.insert(t, "<td style='vertical-align:top;'><dynamicpagelist>\ncategory = "  .. category .. 
                                                "\ncount = " .. each .. 
                                                "\noffset = " .. tostring((i - 1) * each) ..
                                                "\nordermethod = sortkey" ..
                                                "\norder = ascending" ..
                        "</dynamicpagelist>" .. "</td>")
    end
    table.insert(t, "</tr></table>")
    return frame:preprocess(table.concat(t))
end

return p