Module:Dict: Difference between revisions

From Annwan’s Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 9: Line 9:
local pos = frame.args["pos"]
local pos = frame.args["pos"]
local translit = frame.args["translit"]
local translit = frame.args["translit"]
local ss = frame.args["ss"]
local sc = frame.args["sc"]
local sc = frame.args["sc"]
local ipa = frame.args["ipa"]
local ipa = frame.args["ipa"]
Line 20: Line 21:
translit = " (" .. translit .. ")"
translit = " (" .. translit .. ")"
end
end
local head
if sc and sc ~= "" then
if sc and sc ~= "" then
headword = frame:expandTemplate{ title = 'Scr', args = { sc, headword}}
head = ss ~= "" and ss or headword
head = frame:expandTemplate{ title = 'Scr', args = { sc, head}}
else
else
headword = "'''" .. headword .. "'''"
head = "'''" .. headword .. "'''"
end
end
return headword .. translit .. " " .. ipa .. " ''" .. pos .. ".''\n"
return headword .. translit .. " " .. ipa .. " ''" .. pos .. ".''\n"

Revision as of 09:35, 14 April 2025


local exports = {}

local langdata = require('Module:Data/Langs')
local posdata = require('Module:Data/POS')

exports.head = function(frame)
	local headword = frame.args[1]
	local lang = frame.args["lang"]
	local pos = frame.args["pos"]
	local translit = frame.args["translit"]
	local ss = frame.args["ss"]
	local sc = frame.args["sc"]
	local ipa = frame.args["ipa"]
	assert(lang)
	assert(pos)
	assert(ipa)
	ipa = frame:expandTemplate{ title = "IPA", args = {"/" .. ipa .. "/" }}
	if (not translit) or translit == "" then
		translit = ""
	else
		translit = " (" .. translit .. ")"
	end
	local head
	if sc and sc ~= "" then
		head = ss ~= "" and ss or headword
		head = frame:expandTemplate{ title = 'Scr', args = { sc, head}}
	else
		head = "'''" .. headword .. "'''"
	end
	return headword .. translit .. " " .. ipa .. " ''" .. pos .. ".''\n"
		.. "[[Category:" .. tostring(langdata[lang].display_name) .. " " .. tostring(posdata[pos]) .. "]]\n"
		.. "[[Category:" .. tostring(langdata[lang].display_name) .. " Lemmas]]"
end

return exports