Module:User:Happy5214/FTBox

local p = {}

local format = string.format local insert = table.insert

local function classWithName(class, name) return format(" %s", class, name) end

function p._ftbox(args) local featuredCount = 0 local goodCount = 0 local topicName = args.title local topicImage = args.image local topicImageSize = args.imagesize local topicLeadClass = args.leadClass if topicLeadClass == 'FA' or topicLeadClass == 'FL' then featuredCount = featuredCount + 1 goodCount = goodCount + 1 elseif topicLeadClass == 'A' or topicLeadClass == 'GA' then goodCount = goodCount + 1 end local topicLeadName = args.leadName local articleArgs = {} local articleCount = 1 while true do		local articleClass = args[articleCount * 2 - 1] if not articleClass then break end if articleClass == 'FA' or articleClass == 'FL' then featuredCount = featuredCount + 1 goodCount = goodCount + 1 elseif articleClass == 'A' or articleClass == 'GA' then goodCount = goodCount + 1 end local article = {class = articleClass, name = args[articleCount * 2]} insert(articleArgs, article) articleCount = articleCount + 1 end local column2Start = args.column2start local column3Start = args.column3start

-- Start generating output -- Topic box local lines = {} insert(lines, format("")

-- Progress bars insert(lines, format("", featuredCount, articleCount)) insert(lines, format("", goodCount, articleCount))

local wikitext = table.concat(lines, '\n') return wikitext end

function p.ftbox(frame) local argModule = require('Module:Arguments') local args = argModule.getArgs(frame) return frame:preprocess(p._ftbox(args)) end

return p