-- Used for tropical cyclone season articles.
local invocation = require('Module:Template invocation').invocationlocal getArgs = require('Module:Arguments').getArgslocal yesno = require('Module:Yesno')local dateperiod = require('Module:Date period')._mainlocal Date = require('Module:Date')._Datelocal p =
function p.main(frame) local args = getArgs(frame,)
return p._main(frame, args)end
--- Used for decoding attributes (encoded by the child template automatically)function unencode(encoded) return string.gsub(encoded, "'", "'")end
-- Guesses the table year from the article title, or from argumentsfunction guessYear(frame, args) if args["year"] or args["start-year"] then return tonumber(args["start-year"] or args["year"]), tonumber(args["end-year"]) end local pageTitle = mw.title.getCurrentTitle.prefixedText -- Note: These are different dashes (dash, ndash, mdash, respectively). rangeB = mw.ustring.match(pageTitle, "^%d+[%-–—](%d+)") rangeA = mw.ustring.match(pageTitle, "^(%d+)") if rangeB ~= nil then return tonumber(rangeA), tonumber(-- "2021" if "21", "2021" if "2021" args["end-year"] or (string.len(rangeB) > 2 and rangeB or string.sub(rangeA, 1, 2) .. rangeB) ) elseif rangeA ~= nil then return tonumber(rangeA), nil else return nil, nil endend
-- Module:Convert does not expose a module-friendly conversion system.-- For this reason, we'll need to do this messy hack that is extremely-- inefficient.function convert(frame, args) args["disp"] = "number" args["comma"] = "off" return tonumber(frame:expandTemplate)end
function p._main(frame, args) local basin = args["basin"] or args["Basin"] if not yesno(args["no-header"]) and basin
nil then return error("Could not guess starting year. Supply with the year or startYear parameter") end if startYear
nil then tableWindsUnit = entry["winds-unit"] or "kn" end if tablePressureUnit
tableWindsUnit and entry["winds"] or convert(frame, ) ) or nil convertedPressure = tonumber(entry["pressure"]) ~= nil and (entry["pressure-unit"]
nil or convertedWinds > strongestWinds ) then strongestWinds = convertedWinds end if convertedPressure ~= nil and (lowestPressure
"present" then latestPresent = true end formed = Date(entry["formed"]) dissipated = Date(entry["dissipated"]) if earliestFormed
nil or (dissipated ~= nil and latestDissipated < dissipated) then latestDissipated = dissipated end end -- Using expandTemplate for modularity. local tcHeader = frame:expandTemplate
-- Template parameters not yet standardized. Hence the usage of capitalized -- parameter names. -- Using expandTemplate for modularity. local tcFooter = frame:expandTemplate return tcHeader .. "\n" .. tableEntries .. "\n" .. tcFooterend
return p