"ഘടകം:GradeLinks" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം
(ചെ.)No edit summary |
No edit summary റ്റാഗ്: Reverted |
||
വരി 6: | വരി 6: | ||
local itemName = args.ItemName or "" | local itemName = args.ItemName or "" | ||
local grades = { | local grades = { | ||
{ suffix = "A ഗ്രേഡ്", file = "MedelA.svg", label = "A ഗ്രേഡ്" }, | { suffix = "A ഗ്രേഡ്", file = "MedelA.svg", label = "A ഗ്രേഡ്", flag = "G1" }, | ||
{ suffix = "B ഗ്രേഡ്", file = "MedelB.svg", label = "B ഗ്രേഡ്" }, | { suffix = "B ഗ്രേഡ്", file = "MedelB.svg", label = "B ഗ്രേഡ്", flag = "G2" }, | ||
{ suffix = "C ഗ്രേഡ്", file = "MedelC.svg", label = "C ഗ്രേഡ്" }, | { suffix = "C ഗ്രേഡ്", file = "MedelC.svg", label = "C ഗ്രേഡ്", flag = "G3" }, | ||
{ suffix = "മറ്റുള്ളവ", file = "MedelO.svg", label = "മറ്റുള്ളവ" }, | { suffix = "മറ്റുള്ളവ", file = "MedelO.svg", label = "മറ്റുള്ളവ", flag = "G4" }, | ||
} | } | ||
local output = {} | local output = {} | ||
for _, grade in ipairs(grades) do | for _, grade in ipairs(grades) do | ||
local pageTitle = mainUrl .. "/" .. itemName .. "/" .. grade.suffix | local pageTitle = mainUrl .. "/" .. itemName .. "/" .. grade.suffix | ||
local titleObj = mw.title.new(pageTitle) | local titleObj = nil | ||
if args[grade.flag] then | |||
titleObj = mw.title.new(pageTitle) | |||
if titleObj and titleObj.exists then | |||
table.insert(output, string.format( | table.insert(output, string.format( | ||
'<div style="text-align: center; padding: 0.75em; font-weight: normal; line-height: 1.15; font-size: 1.05em; margin-bottom: 0.2em; min-width: 120px; max-width: 250px; flex: 1 1 0px; margin-right: 1px;">' .. | '<div style="text-align: center; padding: 0.75em; font-weight: normal; line-height: 1.15; font-size: 1.05em; margin-bottom: 0.2em; min-width: 120px; max-width: 250px; flex: 1 1 0px; margin-right: 1px;">' .. |
22:37, 5 ജനുവരി 2025-നു നിലവിലുണ്ടായിരുന്ന രൂപം
ഈ ഘടകത്തിന്റെ വിവരണം ഘടകം:GradeLinks/വിവരണം എന്ന താളിൽ നിർമ്മിക്കാവുന്നതാണ്
local p = {} function p.render(frame) local args = frame:getParent().args local mainUrl = args.MainUrl or "" local itemName = args.ItemName or "" local grades = { { suffix = "A ഗ്രേഡ്", file = "MedelA.svg", label = "A ഗ്രേഡ്", flag = "G1" }, { suffix = "B ഗ്രേഡ്", file = "MedelB.svg", label = "B ഗ്രേഡ്", flag = "G2" }, { suffix = "C ഗ്രേഡ്", file = "MedelC.svg", label = "C ഗ്രേഡ്", flag = "G3" }, { suffix = "മറ്റുള്ളവ", file = "MedelO.svg", label = "മറ്റുള്ളവ", flag = "G4" }, } local output = {} for _, grade in ipairs(grades) do local pageTitle = mainUrl .. "/" .. itemName .. "/" .. grade.suffix local titleObj = nil if args[grade.flag] then titleObj = mw.title.new(pageTitle) if titleObj and titleObj.exists then table.insert(output, string.format( '<div style="text-align: center; padding: 0.75em; font-weight: normal; line-height: 1.15; font-size: 1.05em; margin-bottom: 0.2em; min-width: 120px; max-width: 250px; flex: 1 1 0px; margin-right: 1px;">' .. '<span aria-hidden="true" role="presentation">[[File:%s|45px|link=%s|frameless|center]]</span>' .. '[[%s|<b>%s</b>]]</div>', grade.file, pageTitle, pageTitle, grade.label )) end end end if #output > 0 then return string.format( '<div style="margin:8px 0px;background:#F1FFB5;padding-bottom:10px;border-radius:0px 0px 25px 25px;">' .. '<div style="color:#fff;padding:14px 10px !important;margin:0px;border-bottom:1px solid #ccc;background:#27AE60;border-radius:25px 25px 0px 0px;">' .. '<p style="padding:0px 10px;margin:0px; font-weight:bold;font-size:1.2em;">%s</p>' .. '</div>' .. '<div style="display: flex; flex-flow: row wrap; justify-content: space-evenly; width: 95%%;" role="navigation">%s</div>' .. '</div>', args.MainTitle or "", table.concat(output) ) end return "" end return p