وحدة:Identifiers/ملعب

local p = {}local Navbox = require("Module:Navbox")local Uses_Wikidata = require("Module:Uses_Wikidata")._usestablelocal title = mw.title.getCurrentTitle()local namespace = title.namespacelocal props = {}local props2 = {}local i8 = {["tracking"] = "[[تصنيف:معرفات الأصنوفة]]",["without"] = "[[تصنيف:معرفات الأصنوفة غير موجودة]]",["g1"] = "[[d:Wikidata:WikiProject_Taxonomy|معرفات الأصنوفة]]",["g2"] = "",["name"] = "Taxonomy text"}function make_url(url, label)url = mw.ustring.gsub(url, '%[', "%%5B")url = mw.ustring.gsub(url, '%]', "%%5D")label = mw.ustring.gsub(label, '%[', "&#91;")label = mw.ustring.gsub(label, '%]', "&#93;")return '[' .. url .. ' ' .. label .. ']'endfunction make_line(label, link)if link thenif label thenreturn '* <b>' .. label .. "</b>: " .. link .. "\n"elsereturn "* " .. link .. "\n"endendendfunction doo(params)-- {property="P11", label = "", link = "", pattern = "https://www.gbif.org/species/$1" }local pa = params.labelif params.link ~= "" thenpa = "[[" .. params.link .. "|" .. pa .. "]]"endlocal po = {}local ids = params.ids or {}if #ids > 0 thenlocal url = ''local n = 0for _, id in ipairs(ids) don = n + 1-- match if id is urlif string.match(id, "^https?://") thenurl = make_url(id, n)elseif params.pattern ~= '' thenurl = make_url(mw.ustring.gsub(params.pattern, '%$1', id), id)elseurl = idendendtable.insert(po, url)--breakendlocal va = ''local po_text = mw.text.listToText(po, "، ", "، ")if po_text and po_text ~= "" thenva = make_line(pa, po_text)endreturn vaendfunction getIdsFromWikidata(qid, property)local ids = {}for _, statement in ipairs(mw.wikibase.getBestStatements(qid, property)) doif statement.mainsnak.datavalue thenlocal val = statement.mainsnak.datavalue.valueif val thentable.insert(ids, val)endendendmw.log(property .. " lenth: " .. #ids)return idsendfunction makeSections(qid, args, Table)local tval = {}-- { property = "P846", label = "المَرفَق العالمي لمعلومات التنوع الحيوي (GBIF)", link = "مرفق معلومات التنوع الحيوي العالمي", pattern = "https://www.gbif.org/species/$1" }for property, params in pairs(Table) dolocal ids = getIdsFromWikidata(qid, property)if #ids == 0 and args[property] thentable.insert(ids, args[property])endparams.ids = idsparams.property = propertytval[property] = paramsendlocal external = {}for pid, params in pairs(tval) doif #params.ids > 0 thenlocal vaa = doo(params)table.insert(external, vaa)endendlocal final = table.concat(external)if #final ~= 0 thenfinal = final .. i8.trackingendreturn finalendfunction Statement(options)local function resolveQID(qid)if qid and qid ~= "" thenqid = 'Q' .. mw.ustring.gsub(qid, '^[Qq]', '')if mw.wikibase.isValidEntityId(qid) and mw.wikibase.entityExists(qid) thenlocal sitelink = mw.wikibase.getSitelink(qid)if sitelink thenreturn mw.wikibase.getEntityIdForTitle(sitelink) or mw.wikibase.getEntity(qid).idendreturn mw.wikibase.getEntity(qid).idendendendlocal qid = options.entityId or options.id or options["صفحة"] or ''if namespace == 0 thenqid = mw.wikibase.getEntityIdForCurrentPage()endlocal qid = resolveQID(qid)if not qid thenreturn i8.withoutendmw.log('qid' .. qid)local text2 = ""local text = makeSections(qid, options, props) or ""if props2 and props2 ~= {} thentext2 = makeSections(qid, options, props2) or ""endlocal params = {name = i8.name,bodyclass = "hlist",list1style = "text-align:right;",list2style = "text-align:right;",group1 = i8.g1,group2 = i8.g2}if options.nohlist and options.nohlist ~= '' then params.bodyclass = '' endlocal fi = ''if (text and text ~= "") or (text2 and text2 ~= "") thenif text and text ~= "" thenif options.list and options.list ~= "" thentext = text .. options.listendparams.list1 = textendif text2 and text2 ~= "" thenparams.list2 = text2endfi = Navbox._navbox(params)elsefi = i8.withoutendreturn fiendfunction p.Statement_from_lua(options, _i8, _props, _props2)i8 = _i8props = _propsprops2 = _props2return Statement(options)endfunction p.make_list(props)local _tab_ = {}for k, v in pairs(props) dotable.insert(_tab_, k)end_tab_.newtrak = "s"_tab_["newtrak"] = "s"return Uses_Wikidata(_tab_)endfunction p.list(frame)return p.make_list(props)endreturn p