<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://www.vigyanwiki.in/index.php?action=history&amp;feed=atom&amp;title=Module%3ACurrency</id>
	<title>Module:Currency - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.vigyanwiki.in/index.php?action=history&amp;feed=atom&amp;title=Module%3ACurrency"/>
	<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Currency&amp;action=history"/>
	<updated>2026-04-28T23:37:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://www.vigyanwiki.in/index.php?title=Module:Currency&amp;diff=74547&amp;oldid=prev</id>
		<title>Indicwiki: 1 revision imported from :alpha:Module:Currency</title>
		<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Currency&amp;diff=74547&amp;oldid=prev"/>
		<updated>2023-01-31T06:08:37Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported from &lt;a href=&quot;https://alpha.indicwiki.in/index.php?title=Module:Currency&quot; class=&quot;extiw&quot; title=&quot;alpha:Module:Currency&quot;&gt;alpha:Module:Currency&lt;/a&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:38, 31 January 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Indicwiki</name></author>
	</entry>
	<entry>
		<id>https://www.vigyanwiki.in/index.php?title=Module:Currency&amp;diff=18259&amp;oldid=prev</id>
		<title>Admin: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Currency&amp;diff=18259&amp;oldid=prev"/>
		<updated>2022-10-12T08:04:02Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:34, 12 October 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://www.vigyanwiki.in/index.php?title=Module:Currency&amp;diff=74546&amp;oldid=prev</id>
		<title>alpha&gt;Indicwiki: Created page with &quot;require('Module:No globals')  local p = {} local lang = mw.language.getContentLanguage();									-- language object for this wiki local presentation ={};															-- tab...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Currency&amp;diff=74546&amp;oldid=prev"/>
		<updated>2022-08-12T06:48:19Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;require(&amp;#039;Module:No globals&amp;#039;)  local p = {} local lang = mw.language.getContentLanguage();									-- language object for this wiki local presentation ={};															-- tab...&amp;quot;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:18, 12 August 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>alpha&gt;Indicwiki</name></author>
	</entry>
	<entry>
		<id>https://www.vigyanwiki.in/index.php?title=Module:Currency&amp;diff=18258&amp;oldid=prev</id>
		<title>wikipedia&gt;MusikBot II: Changed protection settings for &quot;Module:Currency&quot;: High-risk template or module: 2505 transclusions (more info) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))</title>
		<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Currency&amp;diff=18258&amp;oldid=prev"/>
		<updated>2022-01-15T17:59:57Z</updated>

		<summary type="html">&lt;p&gt;Changed protection settings for &amp;quot;&lt;a href=&quot;/wiki/Module:Currency&quot; title=&quot;Module:Currency&quot;&gt;Module:Currency&lt;/a&gt;&amp;quot;: &lt;a href=&quot;https://en.wikipedia.org/wiki/High-risk_templates&quot; class=&quot;extiw&quot; title=&quot;wikipedia:High-risk templates&quot;&gt;High-risk template or module&lt;/a&gt;: 2505 transclusions (&lt;a href=&quot;/index.php?title=User:MusikBot_II/TemplateProtector&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User:MusikBot II/TemplateProtector (page does not exist)&quot;&gt;more info&lt;/a&gt;) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require('Module:No globals')&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
local lang = mw.language.getContentLanguage();									-- language object for this wiki&lt;br /&gt;
local presentation ={};															-- table of tables that contain currency presentation data&lt;br /&gt;
local properties;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ S E T &amp;gt;------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Whether variable is set or not.  A variable is set when it is not nil and not empty.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_set( var )&lt;br /&gt;
	return not (var == nil or var == '');&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A K E _ S H O R T _ F O R M  _ N A M E &amp;gt;-------------------------------------&lt;br /&gt;
&lt;br /&gt;
Assembles value and symbol according to the order specified in the properties table for this currency code&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_short_form_name (amount, code, linked, passthrough)&lt;br /&gt;
	local symbol;&lt;br /&gt;
	local position = properties[code].position;&lt;br /&gt;
&lt;br /&gt;
	if linked then&lt;br /&gt;
		symbol = string.format ('[[%s|%s]]', properties[code].page, properties[code].symbol);	-- make wikilink of page and symbol&lt;br /&gt;
	else&lt;br /&gt;
		symbol = properties[code].symbol;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not passthrough then&lt;br /&gt;
		amount = lang:formatNum (tonumber(amount));								-- add appropriate comma separators&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	amount = amount:gsub ('^%-', '−');											-- replace the hyphen with unicode minus&lt;br /&gt;
&lt;br /&gt;
	if 'b' == position then														-- choose appropriate format: unspaced before the amount&lt;br /&gt;
		return string.format ('%s%s', symbol, amount);&lt;br /&gt;
	elseif 'bs' == position then												-- spaced before the amount&lt;br /&gt;
		return string.format ('%s&amp;amp;nbsp;%s', symbol, amount);&lt;br /&gt;
	elseif 'a' == position then													-- unspaced after the amount&lt;br /&gt;
		return string.format ('%s%s', amount, symbol);&lt;br /&gt;
	elseif 'as' == position then												-- spaced after the amount&lt;br /&gt;
		return string.format ('%s&amp;amp;nbsp;%s', amount, symbol);&lt;br /&gt;
	elseif 'd' == position then													-- special case that replaces the decimal separator with symbol (Cifrão for CVE is the only extant case)&lt;br /&gt;
		if passthrough then&lt;br /&gt;
			return string.format('%s%s', symbol, amount)&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		local digits, decimals;													-- this code may not work for other currencies or on other language wikis&lt;br /&gt;
		if amount:match ('[%d,]+%.%d+') then									-- with decimal separator and decimals&lt;br /&gt;
			digits, decimals = amount:match ('([%d,]+)%.(%d+)')&lt;br /&gt;
			amount = string.format ('%s%s%s', digits, symbol, decimals);		-- insert symbol&lt;br /&gt;
		elseif amount:match ('[%d,]+%.?$') then									-- with or without decimal separator&lt;br /&gt;
			digits = amount:match ('([%d,]+)%.?$')&lt;br /&gt;
			amount = string.format ('%s%s00', digits, symbol);					-- add symbol and 00 ($00)&lt;br /&gt;
		end&lt;br /&gt;
		amount = amount:gsub (',', '%.');										-- replace grouping character with period&lt;br /&gt;
		return amount;&lt;br /&gt;
	end&lt;br /&gt;
	return amount .. ' &amp;lt;span style=&amp;quot;font-size:inherit&amp;quot; class=&amp;quot;error&amp;quot;&amp;gt;{{currency}} – definition missing position ([[Template:Currency/doc#Error_messages|help]])&amp;lt;/span&amp;gt;';	-- position not defined&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A K E _ N A M E &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Make a wikilink from the currency's article title and its plural (if provided).  If linked is false, returns only&lt;br /&gt;
the article title (unlinked)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_name (linked, page, plural)&lt;br /&gt;
	if not linked then&lt;br /&gt;
		if not is_set (plural) then&lt;br /&gt;
			return page;														-- just the page&lt;br /&gt;
		elseif 's' == plural then												-- if the simple plural form&lt;br /&gt;
			return string.format ('%ss', page);									-- append an 's'&lt;br /&gt;
		else&lt;br /&gt;
			return plural;														-- must be the complex plural form (pounds sterling v. dollars)&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		if not is_set (plural) then&lt;br /&gt;
			return string.format ('[[%s]]', page);&lt;br /&gt;
		elseif 's' == plural then												-- if the simple plural form&lt;br /&gt;
			return string.format ('[[%s]]s', page);&lt;br /&gt;
		else&lt;br /&gt;
			return string.format ('[[%s|%s]]', page, plural);					-- must be the complex plural form (pounds sterling v. dollars)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A K E _ L O N G _ F O R M  _ N A M E &amp;gt;---------------------------------------&lt;br /&gt;
&lt;br /&gt;
assembles a long-form currency name from amount and name from the properties tables; plural for all values not equal to 1&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_long_form_name (amount, code, linked, passthrough)&lt;br /&gt;
	local name, formatted;&lt;br /&gt;
	&lt;br /&gt;
	if not is_set (properties[code].page) then&lt;br /&gt;
		return '&amp;lt;span style=&amp;quot;font-size:inherit&amp;quot; class=&amp;quot;error&amp;quot;&amp;gt;{{currency}} – definition missing page ([[Template:Currency/doc#Error_messages|help]])&amp;lt;/span&amp;gt;';&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not passthrough then&lt;br /&gt;
		amount = tonumber (amount);												-- make sure it's a number&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if 1 == amount then&lt;br /&gt;
		name = make_name (linked, properties[code].page);						-- the singular form&lt;br /&gt;
	elseif is_set (properties[code].plural) then								-- plural and there is a plural form&lt;br /&gt;
		name = make_name (linked, properties[code].page, properties[code].plural);&lt;br /&gt;
	else&lt;br /&gt;
		name = make_name (linked, properties[code].page);						-- plural but no separate plural form so use the singular form&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if not passthrough then&lt;br /&gt;
		formatted = lang:formatNum (amount)&lt;br /&gt;
	else &lt;br /&gt;
		formatted = amount&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return string.format ('%s %s', formatted, name);							-- put it all together&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; R E N D E R _ C U R R E N C Y &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Renders currency amount with symbol or long-form name.&lt;br /&gt;
&lt;br /&gt;
Also, entry point for other modules.  Assumes that parameters have been vetted; amount is a number, code is upper&lt;br /&gt;
case string, long_form is boolean; all are required.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function render_currency (amount, code, long_form, linked, fmt, passthrough)&lt;br /&gt;
	local name;&lt;br /&gt;
	local result;&lt;br /&gt;
&lt;br /&gt;
	presentation = mw.loadData ('Module:Currency/Presentation');				-- get presentation data&lt;br /&gt;
&lt;br /&gt;
	if presentation.currency_properties[code] then								-- if code is an iso 4217 code&lt;br /&gt;
		properties = presentation.currency_properties;&lt;br /&gt;
	elseif presentation.code_translation[code] then								-- not iso 4217 but can be translated&lt;br /&gt;
		code = presentation.code_translation[code];								-- then translate&lt;br /&gt;
		properties = presentation.currency_properties;&lt;br /&gt;
	elseif presentation.non_standard_properties[code] then						-- last chance, is it a non-standard code?&lt;br /&gt;
		properties = presentation.non_standard_properties;&lt;br /&gt;
	else&lt;br /&gt;
		return '&amp;lt;span style=&amp;quot;font-size:inherit&amp;quot; class=&amp;quot;error&amp;quot;&amp;gt;{{currency}} – invalid code ([[Template:Currency/doc#Error_messages|help]])&amp;lt;/span&amp;gt;';&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	if long_form then&lt;br /&gt;
		result = make_long_form_name (amount, code, linked, passthrough);								-- &lt;br /&gt;
	else&lt;br /&gt;
		result = make_short_form_name (amount, code, linked, passthrough);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if 'none' == fmt then														-- no group separation&lt;br /&gt;
		result = result:gsub ('(%d%d?%d?),', '%1');								-- strip comma separators&lt;br /&gt;
	elseif 'gaps' == fmt then													-- use narrow gaps&lt;br /&gt;
		result = result:gsub ('(%d%d?%d?),', '&amp;lt;span style=&amp;quot;margin-right:.25em;&amp;quot;&amp;gt;%1&amp;lt;/span&amp;gt;');	-- replace comma seperators&lt;br /&gt;
	elseif fmt and 'commas' ~= fmt then											-- if not commas (the default) then error message&lt;br /&gt;
		return '&amp;lt;span style=&amp;quot;font-size:inherit&amp;quot; class=&amp;quot;error&amp;quot;&amp;gt;{{currency}} – invalid format ([[Template:Currency/doc#Error_messages|help]])&amp;lt;/span&amp;gt;';&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return result;																-- done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P A R S E _ F O R M A T T E D _ N U M B E R &amp;gt;----------------------------------&lt;br /&gt;
&lt;br /&gt;
replacement for lang:parseFormattedNumber() which doesn't work; all it does is strip commas.&lt;br /&gt;
&lt;br /&gt;
This function returns a string where all comma separators have been removed from the source string.  If the source&lt;br /&gt;
is malformed: has characters other than digits, commas, and decimal points; has too many decimal points; has commas&lt;br /&gt;
in in appropriate locations; then the function returns nil.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function parse_formatted_number (amount)&lt;br /&gt;
	local count;&lt;br /&gt;
	local parts = {};&lt;br /&gt;
	local digits = {};&lt;br /&gt;
	local decimals;&lt;br /&gt;
	local sign = '';&lt;br /&gt;
	local _;&lt;br /&gt;
	&lt;br /&gt;
	if amount:find ('[^%-−%d%.,]')	then										-- anything but sign, digits, decimal points, or commas&lt;br /&gt;
		return nil;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	amount = amount:gsub ('−', '-');											-- replace unicode minus with hyphen&lt;br /&gt;
	&lt;br /&gt;
	_, count = amount:gsub('%.', '')											-- count the number of decimal point characters &lt;br /&gt;
	if 1 &amp;lt; count then&lt;br /&gt;
		return nil;																-- too many dots&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	_, count = amount:gsub(',', '')												-- count the number of grouping characters &lt;br /&gt;
	if 0 == count then&lt;br /&gt;
		return amount;															-- no comma separators so we're done&lt;br /&gt;
	end;&lt;br /&gt;
	&lt;br /&gt;
	if amount:match ('[%-][%d%.,]+') then										-- if the amount is negative&lt;br /&gt;
		sign, amount = amount:match ('([%-])([%d%.,]+)');						-- strip off and save the sign&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	parts = mw.text.split (amount, '.', true);									-- split amount into digits and decimals&lt;br /&gt;
	decimals = table.remove (parts, 2) or '';									-- if there was a decimal portion, remove from the table and save it&lt;br /&gt;
&lt;br /&gt;
	digits = mw.text.split (parts[1], ',')										-- split amount into groups &lt;br /&gt;
	for i, v in ipairs (digits) do												-- loop through the groups&lt;br /&gt;
		if 1 == i then															-- left-most digit group&lt;br /&gt;
			if (3 &amp;lt; v:len() or not is_set (v)) then								-- first digit group: 1, 2, 3 digits; can't be empty string (first char was a comma)&lt;br /&gt;
				return nil;&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			if v and 3 ~= v:len() then											-- all other groups must be three digits long&lt;br /&gt;
				return nil;	&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return sign .. table.concat (digits) .. '.' .. decimals;					-- reassemble without commas and return&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C O N V E R T _ S T R I N G _ T O _  N U M E R I C &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Converts quantified number/string combinations to a number e.g. 1 thousand to 1000.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function convert_string_to_numeric (amount)&lt;br /&gt;
	local quantifiers = {['thousand'] = 1000, ['million'] = 1000000, ['m'] = 1000000, ['billion'] = 1000000000, ['b'] = 1000000000, ['trillion'] = 1000000000000};&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
	local n, q = amount:match ('([%-−]?[%d%.,]+)%s*(%a+)$');					-- see if there is a quantifier following a number; zero or more space characters&lt;br /&gt;
	if nil == n then&lt;br /&gt;
		n, q = amount:match ('([%-−]?[%d%.,]+)&amp;amp;nbsp;(%a+)$')					-- see if there is a quantifier following a number; nbsp html entity ({{format price}} output&lt;br /&gt;
	end&lt;br /&gt;
	if nil == n then return amount end;											-- if not &amp;lt;number&amp;gt;&amp;lt;space&amp;gt;&amp;lt;quantifier&amp;gt; return amount unmolested&lt;br /&gt;
	&lt;br /&gt;
	n = n:gsub (',', '');														-- strip comma separators if present&lt;br /&gt;
	q = q:lower();																-- set the quantifier to lower case&lt;br /&gt;
&lt;br /&gt;
	if nil == quantifiers[q] then return amount end;							-- if not a recognized quantifier&lt;br /&gt;
	&lt;br /&gt;
	return tostring (n * quantifiers[q]);										-- return a string, not a number&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C U R R E N C Y &amp;gt;--------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Template:Currency entry point.  The template takes three parameters:&lt;br /&gt;
	positional (1st), |amount=, |Amount=	: digits and decimal points only&lt;br /&gt;
	positional (2nd), |type=, |Type=		: code that identifies the currency&lt;br /&gt;
	|first=									: uses currency name instead of symbol&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function currency (frame)&lt;br /&gt;
	local args = require('Module:Arguments').getArgs (frame);&lt;br /&gt;
&lt;br /&gt;
	local amount, code;&lt;br /&gt;
	local long_form = false;&lt;br /&gt;
	local linked = true;&lt;br /&gt;
	local passthrough = false;&lt;br /&gt;
&lt;br /&gt;
	if not is_set (args[1]) then&lt;br /&gt;
		return '&amp;lt;span style=&amp;quot;font-size:inherit&amp;quot; class=&amp;quot;error&amp;quot;&amp;gt;{{currency}} – invalid amount ([[Template:Currency/doc#Error_messages|help]])&amp;lt;/span&amp;gt;';&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
--	amount = lang:parseFormattedNumber(args[1]);								-- if args[1] can't be converted to a number then error (this just strips grouping characters)&lt;br /&gt;
--	if args[1]:find ('[^%d%.]') or not amount then								-- non-digit characters or more than one decimal point (because lag:parse... is broken)&lt;br /&gt;
--		return '&amp;lt;span style=&amp;quot;font-size:inherit&amp;quot; class=&amp;quot;error&amp;quot;&amp;gt;{{currency}} – invalid amount ([[Template:Currency/doc#Error_messages|help]])&amp;lt;/span&amp;gt;';&lt;br /&gt;
--	end&lt;br /&gt;
&lt;br /&gt;
	-- This allows us to use {{currency}} while actually following [[MOS:CURRENCY]] as regards &amp;quot;billion&amp;quot;, &amp;quot;million&amp;quot;, &amp;quot;M&amp;quot;, &amp;quot;bn&amp;quot;, etc.&lt;br /&gt;
	if not (args['passthrough'] == 'yes') then -- just pass whatever string is given through.&lt;br /&gt;
		amount = convert_string_to_numeric (args[1]);&lt;br /&gt;
		amount = parse_formatted_number(amount);								-- if args[1] can't be converted to a number then error&lt;br /&gt;
		if not amount then&lt;br /&gt;
			return '&amp;lt;span style=&amp;quot;font-size:inherit&amp;quot; class=&amp;quot;error&amp;quot;&amp;gt;{{currency}} – invalid amount ([[Template:Currency/doc#Error_messages|help]])&amp;lt;/span&amp;gt;';&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		amount = args[1]&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if not is_set(args[2]) then													-- if not provided&lt;br /&gt;
		code = 'USD';															-- default to USD&lt;br /&gt;
	else&lt;br /&gt;
		code = args[2]:upper();													-- always upper case; used as index into data tables which all use upper case&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if args[3] then																-- this is the |first= parameter  TODO: make this value meaningful? y, yes, true?&lt;br /&gt;
		long_form = true;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if 'no' == args[4] then														-- this is the |linked= parameter; defaults to 'yes'; any value but 'no' means yes&lt;br /&gt;
		linked = false;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return render_currency (amount, code, long_form, linked, args['fmt'], (args['passthrough'] == 'yes'))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	currency = currency,														-- template entry point&lt;br /&gt;
	_render_currency = render_currency,											-- other modules entry point&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>wikipedia&gt;MusikBot II</name></author>
	</entry>
</feed>