Module:ks

local export = {}

local lang = require("Module:languages").getByCode("ks") local m_translit = require("Module:ks-Arab-translit") local rsplit = mw.text.split local gsub = mw.ustring.gsub local sub = mw.ustring.sub

function export.usex(frame) --from Module:ne-utilities by User:Wyang local args = frame:getParent.args local params = { [1] = {required = true}, [2] = {},		["t"] = {alias_of = 2}, ["translation"] = {alias_of = 2}, ["tr"] = {}, ["transliteration"] = {alias_of = "tr"}, ["noinline"] = {type = "boolean"}, ["subst"] = {}, }	local args, restargs = require("Module:parameters").process(frame:getParent.args, params, "return unknown") local example = args[1] local translation = args[2] local subbed_example = require("Module:links").remove_links(example) if args.subst then local substs = rsplit(args.subst, ",") for _, subpair in ipairs(substs) do			local subsplit = rsplit(subpair, subpair:find("//") and "//" or "/") subbed_example = gsub(subbed_example, subsplit[1], subsplit[2]) end end local translit = args["tr"] or m_translit.tr(subbed_example, "ks", "Arab") local formatted = gsub(example, "(.-)", "%1 ")

local template if mw.ustring.len(example) > 30 or args["noinline"] then template = "ux" else template = "uxi" end restargs[1] = "ks" restargs[2] = formatted restargs[3] = translation restargs["tr"] = translit return frame:expandTemplate{ title = template, args = restargs} end

return export