মডিউল:Infobox
local p = {}
local function trim( s ) if not s then return "" end return mw.text.trim( tostring( s ) ) end
function p.render( frame ) local args = frame:getParent().args
local html = mw.html.create( 'table' ) html :addClass( 'infobox' ) :css( 'width', '300px' ) :css( 'float', 'right' ) :css( 'margin', '0 0 1em 1em' ) :css( 'border', '1px solid #a2a9b1' ) :css( 'background', '#f8f9fa' ) :css( 'border-collapse', 'collapse' ) :css( 'font-size', '90%' )
-- Title if trim( args["নাম"] ) ~= "" then html:tag( 'tr' ) :tag( 'th' ) :attr( 'colspan', '2' ) :css( 'background', '#3366cc' ) :css( 'color', 'white' ) :css( 'padding', '8px' ) :wikitext( args["নাম"] ) end
-- Image if trim( args["ছবি"] ) ~= "" then html:tag( 'tr' ) :tag( 'td' ) :attr( 'colspan', '2' ) :css( 'text-align', 'center' ) :wikitext( string.format( "চিত্র:%s", args["ছবি"] ) ) end
local fields = { {"জন্ম","জন্ম"}, {"জন্মস্থান","জন্মস্থান"}, {"মৃত্যু","মৃত্যু"}, {"মৃত্যুস্থান","মৃত্যুস্থান"}, {"জাতীয়তা","জাতীয়তা"}, {"নাগরিকত্ব","নাগরিকত্ব"}, {"পেশা","পেশা"}, {"শিক্ষা","শিক্ষা"}, {"দাম্পত্য সঙ্গী","দাম্পত্য সঙ্গী"}, {"সন্তান","সন্তান"}, {"পুরস্কার","পুরস্কার"}, {"ওয়েবসাইট","ওয়েবসাইট"} }
for _, row in ipairs( fields ) do local value = trim( args[row[1]] )
if value ~= "" then local tr = html:tag( 'tr' )
tr:tag( 'th' ) :css( 'text-align', 'left' ) :css( 'padding', '5px' ) :css( 'background', '#eaecf0' ) :wikitext( row[2] )
tr:tag( 'td' ) :css( 'padding', '5px' ) :wikitext( value ) end end
return tostring( html ) end
return p