Модул:Uses Wikidata

Мавод аз Википедиа — донишномаи озод
Ҳуҷҷатгузорӣ
local p = {}

local function incat( name, label, dot )
  local incat = ''
  if not dot then dot = '' end
  local pincat = mw.site.stats.pagesInCategory( name, all )
  if pincat ~= 0 then incat = "[[:Гурӯҳ:" .. name .. "|" .. label .. tostring( pincat ) .. "]]" .. dot end
  return incat
end

local function trackingcats(p_num)
  local result = 
    incat("ВП:" .. p_num .. ":використовується", "'''U:'''", "•") ..
    incat("ВП:" .. p_num .. ":відсутня", "'''<s>U:'''", "</s>•") ..
    incat("Вікідані:" .. p_num .. ":відсутня", "'''<s>D:'''", "</s>•") ..
    incat("Вікідані:" .. p_num .. ":відрізняється", "'''↑↓:'''")
  if result ~= "" then return "[<span></span>" .. result .. "]"
  else return "" end
end

function p.usesProperty(frame)
  local parent = frame.getParent(frame)
  local result = ''
  local ii = 1
  while true do
    local p_num = ""
    if parent.args[ii] or frame.args[ii] then
      p_num = mw.text.trim(string.upper(parent.args[ii] or frame.args[ii])) end
    if p_num ~= "" then
      local label = mw.wikibase.label(p_num) or "БЕЗ НАЗВИ"
      result = result .. "<li><b><i>[[d:Property:" .. p_num .. "|<small>" ..
        p_num .. "</small>:" .. label .. "]]</i></b> {[[d:Property talk:" ..
        p_num .. "|обс]]•[[d:Special:WhatLinksHere/Property:" ..
        p_num .. "|исп]]}" ..
        trackingcats(p_num) .. "</li>"
      ii = ii + 1
    else break
    end
  end
  return result
end
 
return p