ข้ามไปเนื้อหา

มอดูล:aio-headword

จาก วิกิพจนานุกรม พจนานุกรมเสรี

-- The following code is same as phk, kht. Just different at language code.

local export = {}
local pos_functions = {}

local gsub = mw.ustring.gsub
local u = mw.ustring.char

local lang = require("Module:languages").getByCode("aio")
local script = require("Module:scripts").getByCode("Mymr")
local PAGENAME = mw.title.getCurrentTitle().text

function export.show(frame)

	local args = frame:getParent().args
	local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
	-- หมวดหมู่เป็นภาษาไทย
	local poscat_th = require("Module:th-utilities").th_pos(poscat)

	local headword = args["head"] or PAGENAME
	if mw.ustring.find(headword, u(0xFE00), 1, true) then
		error("Please remove the variant selector character [VS1] from headword.")
	end
	local head = dotted_form(headword) -- for displaying only
	local tr = args["tr"]

	local data = {lang = lang, sc = script, pos_category = poscat_th, categories = {}, heads = {head}, translits = {tr}, inflections = {}}

	if pos_functions[poscat_th] then
		pos_functions[poscat_th](args, data)
	end

	return require("Module:headword").full_headword(data)

end

-- https://www.unicode.org/Public/UNIDATA/StandardizedVariants.txt
function dotted_form(text)

	return gsub(text, "([ကဂငတထပမယလဝဢေၵၸၺႀꩠꩡꩢꩣꩤꩥꩦꩫꩬꩯꩺ])", "%1" .. u(0xFE00))

end

--pos_functions here

return export