Module:Endangered Languages Project/sandbox

local p = {}

local elpf = "https://www.endangeredlanguages.com/elp-language/" -- or get P1630

local tidy_param = function(param)
	if param == "" then param = nil end
	return param
end

p.make_entry = function(frame)
	local out = {}
	local make_display = function(elpc, elpn)
		if elpc and elpn then
			table.insert(out, "[" .. elpf .. elpc .. " " .. elpn ..	"]")
		elseif elpc or elpn then
			table.insert(out, (elpc or "") .. (elpn or "") .. "[[Category:Language articles with missing ELP parameters]]")
		end
	end
	local elpname = tidy_param(frame.args.elpname)
	local elpcode = tidy_param(frame.args.elpcode)
	local qid = tidy_param((frame.args.qid or ""):upper()) or mw.wikibase.getEntityIdForCurrentPage()
	make_display(elpcode, elpname)
	if qid then
		local props = mw.wikibase.getBestStatements(qid, "P2192")
		if props[1] then
			for _, v in ipairs(props) do
				local elpc = v.mainsnak.datavalue and v.mainsnak.datavalue.value
				local elpn = v.qualifiers and v.qualifiers.P1810 and v.qualifiers.P1810[1].datavalue and v.qualifiers.P1810[1].datavalue.value
				make_display(elpc, elpn)
			end
		end
	end
	local ret = ""
	if #out > 1 then
		return frame:expandTemplate{title = "ubl", args = out}
	elseif #out==1 then
		return out[1]
	end
end

return p

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.