Module:TFA title explained

local p =

local data = mw.loadJsonData("Template:TFA title/data.json")

-- Get the TFA title for the specified "YYYY-MM-DD" date. May be-- a single title, an array of multiple titles, or nil, if no title is knownfunction p.title(date) return data.titles[date] or nilend

-- Today's TFA, see title for possible return valuesfunction p.today_title return p.title(today)end

-- Is the specified title the TFA today?-- Returns "yes" or "", for use with function p.is_todays_tfa(frame) return p.is_tfa_on(frame.args[1], today)end

-- Is the specified title the TFA on the specified date?-- Returns "yes" or "", for use with function p.is_tfa_on(title, date) local days_title = p.title(date) if days_title

nil then -- no clue return "" end if type(days_title)

"string" then if title

days_title then return "yes" else return "" end end -- table case, multiple titles for _, check in pairs(days_title) do if check

title then return "yes" end end return ""end

-- Internal, today's date as YYYY-MM-DDfunction today return os.date("%Y-%m-%d")end

return p