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

มอดูล:tdd-headword

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

local export = {}
--local pos_functions = {}
local gsub = mw.ustring.gsub
local u = mw.ustring.char

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

local old_tones = {
	-- uses combining marks
	["ᥰ"] = u(0x0308), -- tone 2
	["ᥱ"] = u(0x030C), -- tone 3
	["ᥲ"] = u(0x0300), -- tone 4
	["ᥳ"] = u(0x0307), -- tone 5
	["ᥴ"] = u(0x0301), -- tone 1
	-- unmarked for [ptk] tone 5, else tone 6
}

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 head = args["head"] or PAGENAME
	local tr = args["tr"]
	
	local data = {lang = lang, pos_category = poscat_th, categories = {}, heads = {head}, translits = {tr}, inflections = {}}
	
	local old_ortho = {label = "อักขรวิธี 1963"}
	local old_term = gsub(head, "[ᥰ-ᥴ]", old_tones)
	old_term = gsub(old_term, u(0x200C), "")
	old_term = gsub(old_term, "‌", "")
	old_term = gsub(old_term, u(0x200D), "")
	old_term = gsub(old_term, "‍", "")
	table.insert(old_ortho, {term = old_term})
	table.insert(data.inflections, old_ortho)
 
	return require("Module:headword").full_headword(data)

end

return export