মডিউল:AFC submission catcheck

উইকিপিডিয়া, মুক্ত বিশ্বকোষ থেকে
মডিউল নথি[তৈরি করুন]
local p = {}

local function removeFalsePositives(str)
	if not str then
		return ''
	end
	return mw.ustring.gsub(mw.ustring.gsub(str, "<!--.--->", ""), "<nowiki>.-</nowiki>", "")
end

function p.checkforcats(frame)
    local t = mw.title.getCurrentTitle()
    tc = t:getContent()
    if tc == nil then 
        return ""
    end
    tc = removeFalsePositives(mw.ustring.gsub(tc,"%[%[বিষয়শ্রেণী:নিবন্ধ উইজার্ডের মাধ্যমে নিবন্ধ তৈরি%]%]",""))
    if mw.ustring.match(tc, "%[%[%s-বিষয়শ্রেণী:" ) == nil then
        return ""
    else
        return "[[বিষয়শ্রেণী:বিষয়শ্রেণীসহ নিবন্ধ সৃষ্টিকরণের জন্য উপস্থাপন]]"
    end
end

function p.submitted(frame)
	if mw.ustring.find(removeFalsePositives(mw.title.getCurrentTitle():getContent()), '{{AFC submission||', 1, true) then
		return frame.args[1]
	else
		return frame.args[2]
	end
end

return p