Module:LNDB

local p = {} local nxb_dengeki = mw.loadData( 'Module:LNDB/Dengeki' ) local nxb_fantasia = mw.loadData( 'Module:LNDB/Fantasia' )

local function _dengeki(frame) styleheader = "\" stylerowodd = "\" styleroweven = "\" stylerowodd2 = "\" styleroweven2 = "\" tablestart = "\" tableend = "\" tableheader = "\"..styleheader.."Tác phẩm\"..styleheader.."Tác giả\"..styleheader.."Minh họa\\" timestamp = tostring(frame.args[1])

local rows = {} local title, author, illustrator, stylerow, stylerow2 for k, v in spairs(nxb_dengeki) do       if nxb_dengeki[k].d == timestamp then if (k % 2 == 0) then stylerow = styleroweven stylerow2 = styleroweven2 else stylerow = stylerowodd stylerow2 = stylerowodd2 end title = stylerow..nxb_dengeki[k].tr.."\" author = stylerow2..nxb_dengeki[k].ar.."\" illustrator = stylerow2..nxb_dengeki[k].ir.."\" rows[#rows+1] = "\"..title..author..illustrator.."\</tr\>" end end return tablestart..tableheader..table.concat(rows,'')..tableheader..tableend end

local function _fantasia(frame) styleheader = "\<th style='background:linear-gradient(#e13131,brown);background: -moz-linear-gradient(#e13131,brown);background: -o-linear-gradient(#e13131,brown);background: -webkit-linear-gradient(#e13131,brown);font-weight:bold;text-align:left;color:white;padding:0.75em 1.5em;'\>" stylerowodd = "\<td style='width:350px;padding:0.75em 1.5em;background:#e9e9e9;font-size:95%;font-style:italic;'\>" styleroweven = "\<td style='width:350px;padding:0.75em 1.5em;background:#f6f6f6;font-size:95%;font-style:italic;'\>" stylerowodd2 = "\<td style='width:150px;padding:0.75em 1.5em;background:#e9e9e9;font-size:95%;font-style:italic;'\>" styleroweven2 = "\<td style='width:150px;padding:0.75em 1.5em;background:#f6f6f6;font-size:95%;font-style:italic;'\>" tablestart = "\<table border='0' style='margin:0px auto;border-collapse:collapse; -webkit-font-smoothing: antialiased !important;box-shadow:0 1px 3px rgba(0,0,0,0.2);'\>" tableend = "\</table\>" tableheader = "\"..styleheader.."Tác phẩm\</th\>"..styleheader.."Tác giả\</th\>"..styleheader.."Minh họa\</th\>\</tr\>" timestamp = tostring(frame.args[1])

local rows = {} local title, author, illustrator, stylerow for k, v in spairs(nxb_fantasia) do       if nxb_fantasia[k].d == timestamp then if (k % 2 == 0) then stylerow = styleroweven stylerow2 = styleroweven2 else stylerow = stylerowodd stylerow2 = stylerowodd2 end title = stylerow..nxb_fantasia[k].tr.."\</td\>" author = stylerow2..nxb_fantasia[k].ar.."\</td\>" illustrator = stylerow2..nxb_fantasia[k].ir.."\</td\>" rows[#rows+1] = "\"..title..author..illustrator.."\</tr\>" end end return tablestart..tableheader..table.concat(rows,'')..tableend end

function spairs(t) local keys = {} for k in pairs(t) do keys[#keys+1] = k end table.sort(keys) local i = 0 return function i = i + 1 if keys[i] then return keys[i], t[keys[i]] end end end

function p.dengeki(frame) return _dengeki(frame) end

function p.fantasia(frame) return _fantasia(frame) end

return p