local exports = {}
local def = require("Module:Utils").def
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"]
ipa = frame:expandTemplate{ title = "IPA", args = {"/" .. ipa .. "/" }}
if def(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._getDictfloat(sc), addclass="dict" }}
translit = scriptdata._getDictfloat(sc) == "" and " (" .. headword .. ")" or headword
else
head = "'''" .. headword .. "'''"
end
return head .. translit .. " " .. ipa .. " ''" .. pos .. ".''\n"
.. "[[Category:" .. langdata._getDisplayName(lang) .. " " .. tostring(posdata._get(pos)) .. "]]\n"
.. "[[Category:" .. tostring(langdata._getDisplayName(lang)) .. " Lemmas]]"
end
exports.ex = function(frame)
local lang = def(frame.args.lang, "")
local sc = def(frame.args.sc, langdata._getScript(lang))
local s = frame.args.s
local ss = def(frame.args.ss, s)
local t = frame.args.t
local dictfloat = scriptdata._getDictfloat(sc)
local body
if dictfloat ~= "" then
body = frame:expandTemplate{title = 'Scr', args = { sc, ss, float = dictfloat, addclass="dict" }}
.. [[<table>]]
elseif sc ~= "" then
body = [[<table><tr><td>]] .. frame:expandTemplate{title = 'Scr', args = { sc, ss, float = "", addclass="dict" }} .. [[</td></tr>]]
else
body = [[<table>]]
end
body = body .. [[<tr><td>]] .. s .. [[</tr></td>]]
.. [[<tr><td>]] .. t .. [[</tr></td>]]
.. [[</table>]]
return frame:extensionTag("spoiler", body, {show="Example ▼", hide="Example ▲"})
end
return exports