local m =
function m.D1(frame) mw.logObject(frame.args[1], "frame.args[1]") return frame.args[1]end
m.NumberOfArticlesBetween = function(frame) local pf = frame:getParent local start = frame.args[1] or pf.args[1] if not start then return end local stop = frame.args[2] or pf.args[2] if not stop then return end local content = mw.title.getCurrentTitle:getContent if not content then return end local startPattern = "" local startPosition = string.find(content, startPattern, 1, true) if not startPosition then return end startPosition = startPosition + #startPattern local stopPattern = "" local stopPosition = string.find(content, stopPattern, startPosition, true) if not stopPosition then return end stopPosition = stopPosition - 1 if startPosition >= stopPosition then return end local text = string.sub(content, startPosition, stopPosition) local _, count = mw.ustring.gsub(text, "(%[%[[^%[%]]-%]%])", "%1") local _, files = mw.ustring.gsub(text, "(%[%[Plik:[^%[%]]-%]%])", "%1") count = count - files local threshold = tonumber(frame.args.threshold or pf.args.threshold) or 1 if count < threshold then return end local lang = mw.getContentLanguage local number = lang:formatNum(count) local articles = lang:convertPlural(count,)
local result, _ = string.gsub(frame.args[3] or pf.args[3] or "($1)", "$1", number.." "..articles) return resultend
m.countLinks = function(frame) local text = frame.args[1] if text then text = mw.text.trim(text) local _, count = mw.ustring.gsub(text, "(%[%[[^%[%]]-%]%])", "%1") if count >= 2 then local lang = mw.getContentLanguage local number = lang:formatNum(count) return text .. " ("..number.." articles)" else return text end endend
m.goodCounter = function(frame) local fullText = frame.args[1] if not fullText then return nil end function testlink(text) local b1 = string.byte(text, 1) if (b1 ~= 39) and (b1 ~= 91) then return false end local prefix = string.sub(text, 1, 7) if prefix