বিষয়বস্তুতে চলুন

মডিউল:WOTD

উইকিঅভিধান, মুক্ত অভিধান থেকে

এই মডিউলের জন্য মডিউল:WOTD/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে

local export = {}

local fun_xpcall_module = "Module:fun/xpcall"

local assert = assert
local ipairs = ipairs
local log = mw.log
local new_title = mw.title.new
local tostring = tostring

local function xpcall(...)
	xpcall = require(fun_xpcall_module)
	return xpcall(...)
end

local function do_format(frame)
	local args = frame.args
	local format_arg = assert(args.format, "Format parameter not supplied")
	for _, file in ipairs(args) do
		local page = new_title(file)
		if page then
			local page_file = page.file
			if page_file and page_file.exists then
				return format_arg:format(file)
			end
		else
			log(file .. " is not a valid file name")
		end
	end
end

function export.check_pages(frame)
	local success, res = xpcall(do_format, log, frame)
	if success then
		return res
	end
end

return export