Module:Configuration list entry

local p = {} local thisLang = require("Module:Template translation").getCurrentLanguageSubpage local version = require("Module:Version").version local function versiontonumber(version) if #version == 6 then return versiontonumber(version:sub(0,4)) + tonumber(version:sub(6))/1000 end local num = tonumber(version) if #version == 3 then return 1 + (num-1)/10 else return num end end function p._main(name) local frame = mw.getCurrentFrame local translatedPage, translatedText -- reimplementing Module:Template translation's getTranslatedTemplate function here to avoid expensive parser function -- call limits if thisLang ~= nil then -- try translation translatedPage = "Manual:$" .. name .. "/" .. thisLang translatedText = mw.title.new(translatedPage):getContent end if translatedText == nil then -- try English translatedPage = "Manual:$" .. name .. "/en" translatedText = mw.title.new(translatedPage):getContent end if translatedText == nil then -- try base page in case a configuration setting is not translatable at all translatedPage = "Manual:$" .. name translatedText = mw.title.new(translatedPage):getContent end if translatedText == nil then error("Bogus configuration variable: $" .. name) end local summary = translatedText:match("\n%s*|%s*summary%s*=%s*([^\n]*)\n") local introduced = translatedText:match("\n%s*|%s*version_min%s*=%s*([^|\n]-)%.?0?\n") local removed = translatedText:match("\n%s*|%s*version_max%s*=%s*([^|\n]-)%.?0?\n") local deprecated = translatedText:match("\n%s*|%s*version_deprecated%s*=%s*([^|\n]-)%.?0?\n") if summary then summary = " – " .. summary if removed and removed ~= "" then local num = versiontonumber(removed) if num and num < 1.19 then error("$" .. name .. " was removed before 1.19, so shouldn't be listed.") end summary = frame:expandTemplate{title="removed-inline",args={removed}} .. summary elseif deprecated and deprecated ~= "" then summary = frame:expandTemplate{title="deprecated-inline",args={deprecated}} .. summary end if introduced then local num = versiontonumber(introduced) if num and num > versiontonumber(version("legacylts","branch")) then summary = frame:expandTemplate{title="introduced-inline",args={introduced}} .. " " .. summary end end else error("Could not find summary for $" .. name) end return frame:preprocess(summary) end function p.main(frame) return p._main(frame.args.name) end return p;