본문으로 이동

모듈:zh-verb

위키낱말사전, 말과 글의 누리

이 모듈에 대한 설명문서는 모듈:zh-verb/설명문서에서 만들 수 있습니다

local export = {}

function export.show(frame)
	local args = frame:getParent().args
	local title = args.pagename or mw.title.getCurrentTitle().text
	local inflections = {}

	if args.type then
		local wordtype, div_pos = args.type:match('([a-z]+)([1-9]*)')
		
		local valid_types = {
			['sp'] = '주술 구조',
			['vo'] = '술목 구조',
			['vc'] = '술보 구조',
			['mv'] = '편정 구조',
		}

		wordtype = valid_types[wordtype] or error('Invalid value for parameter "type".')

		div_pos = tonumber(div_pos) or 1
		if mw.ustring.sub(title, div_pos+1, div_pos+1) ~= " " then
			title = mw.ustring.sub(title, 1, div_pos) .. "⫽" .. mw.ustring.sub(title, div_pos + 1)
		else
			title = mw.ustring.sub(title, 1, div_pos) .. "⫽" .. mw.ustring.sub(title, div_pos + 2)
		end
		inflections[1] = {label = wordtype}
	end
	return require('Module:headword').full_headword{
		lang = require('Module:languages').getByCode('zh'),
		sc = args.sc and require('Module:scripts').getByCode(args.sc) or nil,
		heads = {title},
		no_redundant_head_cat = true,
		inflections = inflections,
		categories = {'중국어 동사'}
	}
end

return export