<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FRexxS%2FGetlabel</id>
	<title>Module:Sandbox/RexxS/Getlabel - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FRexxS%2FGetlabel"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/RexxS/Getlabel&amp;action=history"/>
	<updated>2026-05-24T03:22:23Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Sandbox/RexxS/Getlabel&amp;diff=146085&amp;oldid=prev</id>
		<title>imported&gt;RexxS: Getlabel for export to other Wikis</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/RexxS/Getlabel&amp;diff=146085&amp;oldid=prev"/>
		<updated>2018-02-27T12:37:49Z</updated>

		<summary type="html">&lt;p&gt;Getlabel for export to other Wikis&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- - getLabel returns the label for a Qid&lt;br /&gt;
-- if label doesn&amp;#039;t exist, it returns the Qid&lt;br /&gt;
-- The label in a Wikidata item is subject to vulnerabilities &lt;br /&gt;
-- that an attacker might try to exploit.&lt;br /&gt;
-- It needs to be &amp;#039;sanitised&amp;#039; by removing any wikitext before use.&lt;br /&gt;
-- If it doesn&amp;#039;t exist, just return the id for the item&lt;br /&gt;
-- to use elsewhere:&lt;br /&gt;
-- 1. {{#invoke:NameOfModule |getLabel}}&lt;br /&gt;
-- 2. {{#invoke:NameOfModule |getLabel | QidOfRequiredItem}}&lt;br /&gt;
-- 3. {{#invoke:NameOfModule |getLabel | qid=QidOfRequiredItem}}&lt;br /&gt;
-- 1 returns the label from the current asociated page on Wikidata&lt;br /&gt;
-- 2 and 3 both return the label for the given Qid.&lt;br /&gt;
&lt;br /&gt;
p = {}&lt;br /&gt;
&lt;br /&gt;
p.getLabel = function(frame)&lt;br /&gt;
 local itemID = mw.text.trim(frame.args[1] or frame.args.qid or &amp;quot;&amp;quot;)&lt;br /&gt;
 if itemID == &amp;quot;&amp;quot; then itemID = nil end&lt;br /&gt;
 local label = mw.wikibase.label(itemID)&lt;br /&gt;
 if label then&lt;br /&gt;
  label = mw.text.nowiki(label)&lt;br /&gt;
 else&lt;br /&gt;
  label = itemID&lt;br /&gt;
 end&lt;br /&gt;
 return label&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;RexxS</name></author>
	</entry>
</feed>