Module:semaphore

local export = {}

local flagmap = { ["High-Up"] = "", ["Low-High"] = "", ["Down-Low"] = "", ["Down-Out"] = "", ["Down-High"] = "", ["Down-Up"] = "", ["High-Down"] = "", ["Out-Down"] = "", ["Low-Down"] = "", ["AcrossLow-Out"] = "", ["AcrossLow-High"] = "", ["Out-Up"] = "", ["Up-Low"] = "", ["High-Low"] = "", ["Out-Low"] = "", ["Low-Low"] = "", ["AcrossHigh-Out"] = "", ["Up-Out"] = "", ["High-Out"] = "", ["Out-Out"] = "", ["Low-Out"] = "", ["Up-High"] = "", ["High-High"] = "", ["Low-Up"] = "", ["Out-AcrossHigh"] = "", ["Low-AcrossHigh"] = "", ["Out-High"] = "", ["Out-AcrossLow"] = "", ["Down-Down"] = "", ["Up-Up"] = "", ["HighAndLow-HighAndLow"] = "", }

function export.textToImages(text) text = mw.ustring.gsub(text, "LeftFlag", "") text = mw.ustring.gsub(text, "RightFlag", "") text = mw.ustring.gsub(text, "[^ ]*", flagmap)

return text end

local parts_of_speech = { ["letter"] = "letters", ["syllable"] = "syllables", ["number"] = "numbers", ["punctuation mark"] = "punctuation marks", ["symbol"] = "symbols", ["interjection"] = "interjections", }

function export.headword(frame)

local language_code = frame.args["1"] local current_pos = frame.args["2"]

local language_object = require("Module:languages").getByCode(language_code) local sc = require("Module:scripts").getByCode("Semap")

local m_head = require("Module:headword")

local head = frame:getParent.args["head"] if not head or head == "" then head = mw.title.getCurrentTitle.subpageText end

local display = ' ' .. export.textToImages(head) .. ' '	local data = {lang = language_object, sc = sc, categories = {}, sort_key = head, heads = {display}} if parts_of_speech[current_pos] then data.pos_category = parts_of_speech[current_pos] end

return m_head.full_headword(data) end

return export