Module:User:Theknightwho/lite-new

export = {}

function export.new(frame) local template = frame.args[1] local twoLangs = frame.args[2] and true local lang = require("Module:languages").getByCode(frame.args[3]) local entryName = frame.args[4] and lang:makeEntryName(frame.args[4]) local displayText = (frame.args[5] and lang:makeDisplayText(frame.args[5])) or (frame.args[4] and lang:makeDisplayText(frame.args[4])) local gloss = frame.args[6] local scObj = displayText and require("Module:scripts").findBestScript(displayText, lang) local sc = scObj:getCode if sc == "Latn" or sc == "None" then sc = "" end local tr = displayText and frame.args["tr"] or lang:transliterate(displayText, scObj) if tr == displayText then tr = "" end local args = {} args[1] = twoLangs and frame.args[2] or frame.args[3] or "" args[2] = twoLangs and frame.args[3] or entryName or "" args[3] = (twoLangs and entryName) or (entryName ~= displayText and displayText) or "" args[4] = (twoLangs and (entryName ~= displayText and displayText) or "") or (not twoLangs and gloss) or "" args[5] = twoLangs and gloss or "" args["sc"] = sc or "" args["tr"] = tr or "" args["ts"] = frame.args["ts"] or "" args["g"] = frame.args["g"] or "" args["g2"] = frame.args["g2"] or "" args["g3"] = frame.args["g3"] or "" args["pos"] = frame.args["pos"] or "" args["lit"] = frame.args["lit"] or "" args["id"] = frame.args["id"] or "" args["sort"] = frame.args["sort"] or "" for arg, val in pairs(args) do		if type(arg) ~= "number" and val ~= "" then val = arg .. "=" .. val end if val ~= "" or (arg == 3 and (args[4] ~= "" or args[5] ~= "")) or (arg == 4 and args[5] ~= "") then val = "|" .. val end args[arg] = val end return "" end

return export