<?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%2FJay_D._Easy%2Ftud</id>
	<title>Module:Sandbox/Jay D. Easy/tud - 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%2FJay_D._Easy%2Ftud"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Jay_D._Easy/tud&amp;action=history"/>
	<updated>2026-04-21T00:35:13Z</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/Jay_D._Easy/tud&amp;diff=145593&amp;oldid=prev</id>
		<title>imported&gt;Jay D. Easy: Reverted to revision 930782714 by Jay D. Easy (talk) (TW)</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Jay_D._Easy/tud&amp;diff=145593&amp;oldid=prev"/>
		<updated>2019-12-14T22:38:21Z</updated>

		<summary type="html">&lt;p&gt;Reverted to revision 930782714 by &lt;a href=&quot;/research/Special:Contributions/Jay_D._Easy&quot; title=&quot;Special:Contributions/Jay D. Easy&quot;&gt;Jay D. Easy&lt;/a&gt; (&lt;a href=&quot;/index.php?title=User_talk:Jay_D._Easy&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User talk:Jay D. Easy (page does not exist)&quot;&gt;talk&lt;/a&gt;) (&lt;a href=&quot;/index.php?title=WP:TW&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:TW (page does not exist)&quot;&gt;TW&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements the {{Tracks and uses Wikidata}} template.&lt;br /&gt;
local yesno = require(&amp;#039;Module:Yesno&amp;#039;)&lt;br /&gt;
local mList = require(&amp;#039;Module:List&amp;#039;)&lt;br /&gt;
local mTableTools = require(&amp;#039;Module:TableTools&amp;#039;)&lt;br /&gt;
local mMessageBox = require(&amp;#039;Module:Message box&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local origArgs = frame:getParent().args&lt;br /&gt;
	local args = {}&lt;br /&gt;
	for k, v in pairs(origArgs) do&lt;br /&gt;
		v = v:match(&amp;#039;^%s*(.-)%s*$&amp;#039;)&lt;br /&gt;
		if v ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			args[k] = v&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return p._main(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._main(args)&lt;br /&gt;
	local tuWikidata = mTableTools.compressSparseArray(args)&lt;br /&gt;
	local box = p.renderBox(tuWikidata)&lt;br /&gt;
	local trackingCategories = p.renderTrackingCategories(args, tuWikidata)&lt;br /&gt;
	return box .. trackingCategories&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.renderBox(tuWikidata)&lt;br /&gt;
	local boxArgs = {}&lt;br /&gt;
	if #tuWikidata &amp;lt; 1 then&lt;br /&gt;
		boxArgs.text = &amp;#039;&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Error: no properties specified&amp;lt;/strong&amp;gt;&amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		local tuWikidataLinks = {}&lt;br /&gt;
		for i, ts in ipairs(tuWikidata) do&lt;br /&gt;
			local sandboxLink = nil&lt;br /&gt;
			local tsTitle = mw.title.new(ts)&lt;br /&gt;
			if tsTitle then&lt;br /&gt;
				local tsSandboxTitle = mw.title.new(string.format(&amp;#039;%s:%s/sandbox/%s&amp;#039;, tsTitle.nsText, tsTitle.baseText, tsTitle.subpageText))&lt;br /&gt;
				if tsSandboxTitle and tsSandboxTitle.exists then&lt;br /&gt;
					sandboxLink = string.format(&amp;#039; ([[:%s|sandbox]])&amp;#039;, tsSandboxTitle.prefixedText)&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			tuWikidataLinks[i] = string.format(&amp;#039;[[:d:Property:%s]]&amp;#039;, ts, sandboxLink or &amp;#039;&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
		local tuWikidataList = mList.makeList(&amp;#039;bulleted&amp;#039;, tuWikidataLinks)&lt;br /&gt;
		boxArgs.text = &amp;#039;This &amp;#039; .. &lt;br /&gt;
			(mw.title.getCurrentTitle():inNamespaces(828,829) and &amp;#039;module&amp;#039; or &amp;#039;template&amp;#039;) ..&lt;br /&gt;
			&amp;#039; tracks and uses [[:d:Wikidata:List of properties|Wikidata property]]:\n&amp;#039; .. tuWikidataList&lt;br /&gt;
	end&lt;br /&gt;
	boxArgs.type = &amp;#039;notice&amp;#039;&lt;br /&gt;
	boxArgs.small = true&lt;br /&gt;
	boxArgs.image = &amp;#039;[[File:Wikidata-logo-without-paddings.svg|30px|class=noviewer|alt=|link=]]&amp;#039;&lt;br /&gt;
	return mMessageBox.main(&amp;#039;mbox&amp;#039;, boxArgs)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.renderTrackingCategories(args, tuWikidata, titleObj)&lt;br /&gt;
	if yesno(args.nocat) then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local cats = {}&lt;br /&gt;
	&lt;br /&gt;
	-- Error category&lt;br /&gt;
	if #tuWikidata &amp;lt; 1 then&lt;br /&gt;
		cats[#cats + 1] = &amp;#039;Uses Tracks and uses Wikidata templates with errors&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Tracks and uses Wikidata category&lt;br /&gt;
	titleObj = titleObj or mw.title.getCurrentTitle()&lt;br /&gt;
	local subpageBlacklist = {&lt;br /&gt;
		doc = true,&lt;br /&gt;
		sandbox = true,&lt;br /&gt;
		sandbox2 = true,&lt;br /&gt;
		testcases = true&lt;br /&gt;
	}&lt;br /&gt;
	if (titleObj.namespace == 10 or titleObj.namespace == 828)&lt;br /&gt;
		and not subpageBlacklist[titleObj.subpageText]&lt;br /&gt;
	then&lt;br /&gt;
		local category = args.category&lt;br /&gt;
		if not category then&lt;br /&gt;
			category = category or &amp;#039;Templates using Tracks and uses Wikidata&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		cats[#cats + 1] = category&lt;br /&gt;
		if not yesno(args.noprotcat) then&lt;br /&gt;
			local currentProt = titleObj.protectionLevels[&amp;quot;edit&amp;quot;] and titleObj.protectionLevels[&amp;quot;edit&amp;quot;][1] or nil&lt;br /&gt;
			local addedLevelCat = false&lt;br /&gt;
			local addedPadlockCat = false&lt;br /&gt;
			for i, ts in ipairs(tuWikidata) do&lt;br /&gt;
				local tsTitleObj = mw.title.new(ts)&lt;br /&gt;
				local tsProt = tsTitleObj.protectionLevels[&amp;quot;edit&amp;quot;] and tsTitleObj.protectionLevels[&amp;quot;edit&amp;quot;][1] or nil&lt;br /&gt;
				if tsProt ~= currentProt and not addedLevelCat then&lt;br /&gt;
					cats[#cats + 1] = &amp;quot;Templates using Tracks and uses Wikidata with a different protection level&amp;quot;&lt;br /&gt;
				end&lt;br /&gt;
				if tsProt and not addedPadlockCat then&lt;br /&gt;
					local content = tsTitleObj:getContent()&lt;br /&gt;
					if not content:find(&amp;quot;{{pp-&amp;quot;) then&lt;br /&gt;
						cats[#cats + 1] = &amp;quot;Templates using Tracks and uses Wikidata without padlocks&amp;quot;&lt;br /&gt;
						addedPadlockCat = true&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	for i, cat in ipairs(cats) do&lt;br /&gt;
		cats[i] = string.format(&amp;#039;[[Category:%s]]&amp;#039;, cat)&lt;br /&gt;
	end&lt;br /&gt;
	return table.concat(cats)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Jay D. Easy</name></author>
	</entry>
</feed>