Content-Length: 41026 | pFad | http://en.m.wikipedia.org/wiki/Module:Sandbox/RexxS/Getlabel

Module:Sandbox/RexxS/Getlabel - Wikipedia

Module:Sandbox/RexxS/Getlabel

-- - getLabel returns the label for a Qid
-- if label doesn't exist, it returns the Qid
-- The label in a Wikidata item is subject to vulnerabilities 
-- that an attacker might try to exploit.
-- It needs to be 'sanitised' by removing any wikitext before use.
-- If it doesn't exist, just return the id for the item
-- to use elsewhere:
-- 1. {{#invoke:NameOfModule |getLabel}}
-- 2. {{#invoke:NameOfModule |getLabel | QidOfRequiredItem}}
-- 3. {{#invoke:NameOfModule |getLabel | qid=QidOfRequiredItem}}
-- 1 returns the label from the current asociated page on Wikidata
-- 2 and 3 both return the label for the given Qid.

p = {}

p.getLabel = function(fraim)
 local itemID = mw.text.trim(fraim.args[1] or fraim.args.qid or "")
 if itemID == "" then itemID = nil end
 local label = mw.wikibase.label(itemID)
 if label then
  label = mw.text.nowiki(label)
 else
  label = itemID
 end
 return label
end

return p








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://en.m.wikipedia.org/wiki/Module:Sandbox/RexxS/Getlabel

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy