모듈:User:Ykhwong/연습장

위키백과, 우리 모두의 백과사전.
local p = {}

local function _main(args)
	local p1 = '%.[pP][nN][gG]'
	local p2 = '%.[j|J][pP][gG]'
	local p3 = '%.[jJ][pP][eE][gG]'
	local p4 = '%.[gG][iI][fF]'
	local p5 = '%.[tT][iI][fF]'
	local p6 = '%.[sS][vV][gG]'
	local p7 = '%.[bB][mM][pP]'
	local p8 = '%.[eE][xX][iI][fF]'

	--local htmlData = require('Module:Dump')._dumphtml('{{:' .. mw.title.getCurrentTitle().text .. '}}', 0)
	-- test
	local tmp = mw.getCurrentFrame():preprocess{ text = '{{:' .. mw.title.getCurrentTitle().text .. '}}' }
	local htmlData = require('Module:Dump')._dumphtml(tmp, 0)
	if not (
		htmlData:match(p1) or htmlData:match(p2) or
		htmlData:match(p3) or htmlData:match(p4) or
		htmlData:match(p5) or htmlData:match(p6) or
		htmlData:match(p7) or htmlData:match(p8)
	) then
		-- test
		return 'RET1: ' .. htmlData
		--return '[[분류:위키데이터에 그림이 존재하지만 본문에 그림이 없는 것으로 추정되는 문서]]'
	else
		return 'RET2: ' .. htmlData
	end
end

function p.main(frame)
	local args
	if type(frame.args) == 'table' then
		args = frame.args
	else
		args = frame
	end
	return _main(args)
end

return p