Module:Dict: Difference between revisions

From Annwan’s Wiki
Jump to navigation Jump to search
Created page with "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 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 tran..."
 
No edit summary
Line 14: Line 14:
assert(pos)
assert(pos)
assert(ipa)
assert(ipa)
ipa = frame.expandTemplate{ title = "IPA", args = "/" .. ipa .. "/" }
ipa = frame:expandTemplate{ title = "IPA", args = "/" .. ipa .. "/" }
if (not translit) or translit == "" then
if (not translit) or translit == "" then
translit = ""
translit = ""

Revision as of 16:26, 31 March 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 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
	if sc and sc ~= "" then
		headword = frame:expandTemplate{ title = 'Scr', args = { sc, headword}}
	end
	return tostring(headword) .. tostring(translit) .. " " .. tostring(ipa) .. " ''" .. tostring(pos) .. ".''\n"
		.. "[[Category:" .. tostring(langdata[lang].display_name) .. " " .. tostring(posdata[pos]) .. "]]\n"
		.. "[[Category:" .. tostring(langdata[lang].display_name) .. " Lemmas]]"
end

return exports