Module:Dict: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 3: | Line 3: | ||
local langdata = require('Module:Data/Langs') | local langdata = require('Module:Data/Langs') | ||
local posdata = require('Module:Data/POS') | local posdata = require('Module:Data/POS') | ||
local scriptdata = require("Module:Data/Scripts") | |||
exports.head = function(frame) | exports.head = function(frame) | ||
Line 24: | Line 25: | ||
if sc and sc ~= "" then | if sc and sc ~= "" then | ||
head = ss ~= "" and ss or headword | head = ss ~= "" and ss or headword | ||
head = frame:expandTemplate{ title = 'Scr', args = { sc, head }} | head = frame:expandTemplate{ title = 'Scr', args = { sc, head, float = scriptdata[sc].dictfloat }} | ||
translit = " (" .. headword .. ")" | translit = scriptdata[sc].dictfloat == "" and " (" .. headword .. ")" or headword | ||
else | else | ||
head = "'''" .. headword .. "'''" | head = "'''" .. headword .. "'''" |
Revision as of 13:00, 14 April 2025
local exports = {}
local langdata = require('Module:Data/Langs')
local posdata = require('Module:Data/POS')
local scriptdata = require("Module:Data/Scripts")
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, float = scriptdata[sc].dictfloat }}
translit = scriptdata[sc].dictfloat == "" and " (" .. headword .. ")" or headword
else
head = "'''" .. headword .. "'''"
end
return head .. translit .. " " .. ipa .. " ''" .. pos .. ".''\n"
.. "[[Category:" .. tostring(langdata[lang].display_name) .. " " .. tostring(posdata[pos]) .. "]]\n"
.. "[[Category:" .. tostring(langdata[lang].display_name) .. " Lemmas]]"
end
return exports