Bu modul uchun Modul:PetScan/doc nomli hujjat sahifasini yaratishingiz mumkin

local p = {}

function p.main(frame)
	title = mw.title.getCurrentTitle();
	mw.log(title.subjectNsText) 
	mw.log(title.text) 
	
	if not getArgs then
		getArgs = require('Module:Arguments').getArgs
	end
    local args = getArgs(frame)

    text = args['text']
    args['text']=nil

    local cats = {}
    for k, v in pairs(args) do
		if type(k) == 'number' then  
			table.insert( cats, v )
			args[k]=nil
		end
    end

    if args['noself'] == nil and title.subjectNsText == "Turkumlar" then
    	table.insert(cats,title.text) 
	end
    args['noself'] = nil 

	args['categories']=table.concat( cats, "\n" ) 
  
    query = '&' .. (args['query'] or '')
    args['query'] = nil

	url = 'https://petscan.wmflabs.org/?psid=19036477'
	url = url .. mw.uri.buildQueryString(args) .. query
	if text==nil 
	 	then return url
		else return '[' .. url .. ' ' .. text .. ']'
	end
end

return p