Modul:tdd-headword

A Wikiszótárból, a nyitott szótárból

A modult a Modul:tdd-headword/doc lapon tudod dokumentálni

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
	-- tone 6 unmarked
}

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 head = args["head"] or PAGENAME
	local tr = args["tr"]
	
	local data = {lang = lang, pos_category = poscat, categories = {}, heads = {head}, translits = {tr}, inflections = {}}
	
	local old_ortho = {label = "old orthography"}
	table.insert(old_ortho, {term = gsub(head, "[ᥰ-ᥴ]", old_tones)})
	table.insert(data.inflections, old_ortho)
 
	return require("Module:headword").full_headword(data)

end

return export