Module:semaphore
Appearance
- පහත දැක්වෙන උපදෙස්, Module:semaphore/documentation හි පිහිටා ඇත. Module:semaphore/documentation]]. [සංස්කරණය]
- ප්රයෝජනවත් සබැඳි: උප පිටු ලැයිස්තුව • සබැඳි • transclusions • testcases • sandbox
local export = {}
local flagmap = {
["High-Up"] = "[[File:Semaphore Numeric.svg|120px]]",
["Low-High"] = "[[File:Semaphore Cancel.svg|120px]]",
["Down-Low"] = "[[File:Semaphore Alpha.svg|120px]]",
["Down-Out"] = "[[File:Semaphore Bravo.svg|120px]]",
["Down-High"] = "[[File:Semaphore Charlie.svg|120px]]",
["Down-Up"] = "[[File:Semaphore Delta.svg|120px]]",
["High-Down"] = "[[File:Semaphore Echo.svg|120px]]",
["Out-Down"] = "[[File:Semaphore Foxtrot.svg|120px]]",
["Low-Down"] = "[[File:Semaphore Golf.svg|120px]]",
["AcrossLow-Out"] = "[[File:Semaphore Hotel.svg|120px]]",
["AcrossLow-High"] = "[[File:Semaphore India.svg|120px]]",
["Out-Up"] = "[[File:Semaphore Juliet.svg|120px]]",
["Up-Low"] = "[[File:Semaphore Kilo.svg|120px]]",
["High-Low"] = "[[File:Semaphore Lima.svg|120px]]",
["Out-Low"] = "[[File:Semaphore Mike.svg|120px]]",
["Low-Low"] = "[[File:Semaphore November.svg|120px]]",
["AcrossHigh-Out"] = "[[File:Semaphore Oscar.svg|120px]]",
["Up-Out"] = "[[File:Semaphore Papa.svg|120px]]",
["High-Out"] = "[[File:Semaphore Quebec.svg|120px]]",
["Out-Out"] = "[[File:Semaphore Romeo.svg|120px]]",
["Low-Out"] = "[[File:Semaphore Sierra.svg|120px]]",
["Up-High"] = "[[File:Semaphore Tango.svg|120px]]",
["High-High"] = "[[File:Semaphore Uniform.svg|120px]]",
["Low-Up"] = "[[File:Semaphore Victor.svg|120px]]",
["Out-AcrossHigh"] = "[[File:Semaphore Whiskey.svg|120px]]",
["Low-AcrossHigh"] = "[[File:Semaphore X-ray.svg|120px]]",
["Out-High"] = "[[File:Semaphore Yankee.svg|120px]]",
["Out-AcrossLow"] = "[[File:Semaphore Zulu.svg|120px]]",
["Down-Down"] = "[[File:Semaphore Ready.svg|120px]]",
["Up-Up"] = "[[File:Semaphore Up Up.svg|120px]]",
["HighAndLow-HighAndLow"] = "[[File:Semaphore Error.svg|120px]]",
}
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 = '<span style="display:inline-block;vertical-align:middle">' .. export.textToImages(head) .. '</span>'
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