<?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%2FUnitsdemo</id>
	<title>Module:Sandbox/RexxS/Unitsdemo - 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%2FUnitsdemo"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/RexxS/Unitsdemo&amp;action=history"/>
	<updated>2026-05-24T02:32: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/Unitsdemo&amp;diff=146107&amp;oldid=prev</id>
		<title>imported&gt;RexxS: abbreviations don&#039;t need to be stored - convert can handle those</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/RexxS/Unitsdemo&amp;diff=146107&amp;oldid=prev"/>
		<updated>2016-04-29T16:52:09Z</updated>

		<summary type="html">&lt;p&gt;abbreviations don&amp;#039;t need to be stored - convert can handle those&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Demo of a module that takes a QID from a Wikidata unit entry&lt;br /&gt;
-- and returns the code for that unit which [[Template:Convert]] can accept&lt;br /&gt;
-- can also return the name of the unit, if required&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
require(&amp;#039;Module:Sandbox/RexxS/Units&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
p.sing = function(frame)&lt;br /&gt;
	local QID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	if QID and unitByQid[QID] then&lt;br /&gt;
		return unitByQid[QID].singular&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;singular not known&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.plur = function(frame)&lt;br /&gt;
	local QID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	if QID and unitByQid[QID] then&lt;br /&gt;
		if unitByQid[QID].plural then&lt;br /&gt;
			return unitByQid[QID].plural&lt;br /&gt;
		elseif unitByQid[QID].singular then&lt;br /&gt;
			-- no plural, but a singular exists, so add &amp;#039;s&amp;#039;:&lt;br /&gt;
			return unitByQid[QID].singular .. &amp;#039;s&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;plural not known&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.conv = function(frame)&lt;br /&gt;
	local QID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	if QID and unitByQid[QID] then&lt;br /&gt;
		return unitByQid[QID].convertcode&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;convert code not known&amp;quot;&lt;br /&gt;
	end&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>