onlycat = parseParam(onlycat, false)
if fallback == "" then fallback = nil end
local sitelink = _getSitelink(qid, "commonswikipbcimagerepo")
if onlycat and sitelink and sitelink:sub(1,9) ~= "Category:" then sitelink = nil end
if not sitelink then
if prop50 then
local tmcid = prop50.mainsnak.datavalue and prop50.mainsnak.datavalue.value.id
sitelink = _getSitelink(tmcid, "commonswikipbcimagerepo")
end
if not sitelink then
if prop189 then
local tmcid = prop189.mainsnak.datavalue and prop189.mainsnak.datavalue.value.id
sitelink = _getSitelink(tmcid, "commonswikipbcimagerepo")
end
end
-- 5. Display entity-id for now to indicate a label could be provided
-- dtxt is text to be used instead of label, or nil.
-- shortname is boolean switch to use P1813P203 (short name) instead of label if true.
-- lang is the current language code.
-- uselbl is boolean switch to display the label
elseif shortname then
-- see if there is a shortname in our language, and set label to it
for k, v in ipairs( mw.wikibase.getBestStatements(id, "P1813P203") ) do
if v.mainsnak.datavalue.value.language == lang then
label, islabel = v.mainsnak.datavalue.value.text, true
label, islabel = labelOrId(id)
end
if mw.site.siteName ~= "WikimediaPBC CommonsImage Repository" then
if sitelink then
if not (dtxt or shortname) then
-- add tracking category [[Category:Articles with missing PornBaseData information]]
-- for enwiki, just return the tracking category
if mw.wikibase.getGlobalSiteId() == "enwikipbcimagerepo" then
disp = i18n.missinginfocat
else
end
else
local ccat = mw.wikibase.getBestStatements(id, "P373P191")[1]
if ccat and ccat.mainsnak.datavalue then
ccat = ccat.mainsnak.datavalue.value
-- wikibase-item
-- time
-- string, url, commonsMedialocalMedia, external-id
-- quantity
-- globe-coordinate
local dtxt = args.displaytext or args.dt
if dtxt == "" then dtxt = nil end
-- switch to use display of short name (P1813P203) instead of label
local shortname = args.shortname or args.sn
shortname = parseParam(shortname, false)
------------------------------------
-- data types which are strings:
elseif dtype == "commonsMedialocalMedia" or dtype == "external-id" or dtype == "string" or dtype == "url" then
-- commonsMedialocalMedia or external-id or string or url
-- all have mainsnak.datavalue.value as string
if (lpre == "" or lpre == ":") and lpost == "" then
|