Module:txg-headword

local export = {}

local m_headword = require("Module:headword") local m_param = require("Module:parameters")

local txg = require("Module:languages").getByCode("txg") local Tang_pattern = "[" .. require("Module:scripts").getByCode("Tang"):getCharacters .. "]" local pagename = mw.loadData("Module:headword/data").pagename

local function lang_txg(text) return ' ' .. text .. ' ' end

local function l_txg(text) return lang_txg("" .. text .. "") end

function export.char(frame) local params = { [1] = {list = true}, ["rad"] = {}, ["as"] = {}, ["sn"] = {}, ["ids"] = {}, }	local args = m_param.process(frame:getParent.args, params) if args[1] then for i,cat in ipairs(args[1]) do			args[1][i] = "Tangut "..cat.."s" end end local data = { lang = txg, pagename = nil, heads = {' ' .. pagename .. ' '},		pos_category = "logograms", categories = args[1], sort_key = nil, --TODO? }	if args.rad then args.rad = "" .. lang_txg(args.rad) .. "" end if args.ids then args.ids = lang_txg(mw.ustring.gsub(args.ids,Tang_pattern,l_txg("%0"))) end return m_headword.full_headword(data) .. " ("		.. (args.rad and ("radical " .. args.rad .. "+" .. args.as .. ", " .. args.sn .. " strokes") or "")		.. (args.ids and (", composition " .. args.ids) or "")		.. ")" end

return export