<?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%3AConvert%2Fhelper</id>
	<title>Module:Convert/helper - 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%3AConvert%2Fhelper"/>
	<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Convert/helper&amp;action=history"/>
	<updated>2026-05-01T07:55:44Z</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:Convert/helper&amp;diff=3377&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:Convert/helper&amp;diff=3377&amp;oldid=prev"/>
		<updated>2022-07-23T12:45:17Z</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 18:15, 23 July 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:Convert/helper&amp;diff=3376&amp;oldid=prev</id>
		<title>wikipedia&gt;Izno: remove visualhide version</title>
		<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:Convert/helper&amp;diff=3376&amp;oldid=prev"/>
		<updated>2021-05-11T13:58:57Z</updated>

		<summary type="html">&lt;p&gt;remove visualhide version&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module provides some functions to prepare template parameters&lt;br /&gt;
-- for use with Template:Convert.&lt;br /&gt;
-- This module is not used by Template:Convert or Module:Convert.&lt;br /&gt;
&lt;br /&gt;
local function stripToNil(text)&lt;br /&gt;
	-- If text is a non-empty string, return its trimmed content,&lt;br /&gt;
	-- otherwise return nothing (empty string or not a string).&lt;br /&gt;
	if type(text) == 'string' then&lt;br /&gt;
		return text:match('(%S.-)%s*$')&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Remove commas and references (any strip markers) from a number.&lt;br /&gt;
-- First usage in Template:Infobox_UK_place/dist (June 2018)&lt;br /&gt;
local function cleanNumber(frame)&lt;br /&gt;
	local args = frame.args&lt;br /&gt;
	local text = stripToNil(args[1]) or ''&lt;br /&gt;
	if text == '' or tonumber(text) then&lt;br /&gt;
		return text&lt;br /&gt;
	end&lt;br /&gt;
	return mw.text.killMarkers(text):gsub(',', '')&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Format regular input with fraction (MOS-confirmant) into Convert-format &amp;quot;12+3/8&amp;quot; (&amp;quot;+&amp;quot; added).&lt;br /&gt;
-- First usage in Template:NFL_predraft (August 2017)&lt;br /&gt;
local function number(frame)&lt;br /&gt;
	--[[ Preprocess a template parameter to translate a number to be used as&lt;br /&gt;
	input for {{convert}}.&lt;br /&gt;
	{{#invoke:convert/helper|number|12 3/8}} → 12+3/8&lt;br /&gt;
		Input				Output&lt;br /&gt;
		12					12&lt;br /&gt;
		12 3/8				12+3/8&lt;br /&gt;
		{{frac|12|3|8}}		12+3/8&lt;br /&gt;
		12{{frac|3|8}}		12+3/8&lt;br /&gt;
		12⅜					12+3/8&lt;br /&gt;
	Template:Fraction redirects to Template:Frac so either may be used in the input.&lt;br /&gt;
	]]&lt;br /&gt;
	local args = frame.args&lt;br /&gt;
	local text = stripToNil(args[1]) or ''&lt;br /&gt;
	if text == '' or tonumber(text) then&lt;br /&gt;
		return text  -- examples: '', '12', '12.3', '12.3e4', or negative&lt;br /&gt;
	end&lt;br /&gt;
	text = text:gsub('&amp;amp;nbsp;', ' '):gsub('  +', ' '):gsub(' *%+ *', '+'):gsub('&amp;amp;frasl;', '/'):gsub('⁄', '/')&lt;br /&gt;
	local integer, numerator, denominator, rest&lt;br /&gt;
	-- Look for a fraction of form '12 3/8' or '12+3/8' or '3/8'.&lt;br /&gt;
	integer, numerator, denominator = text:match('^(%d+)[ +](%d+)/(%d+)$')&lt;br /&gt;
	if integer then&lt;br /&gt;
		return integer .. '+' .. numerator .. '/' .. denominator&lt;br /&gt;
	end&lt;br /&gt;
	numerator, denominator = text:match('^(%d+)/(%d+)$')&lt;br /&gt;
	if numerator then&lt;br /&gt;
		return numerator .. '/' .. denominator&lt;br /&gt;
	end&lt;br /&gt;
	-- Look for an expanded fraction such as the result of {{frac|12|3|8}} or 12{{frac|3|8}} or {{frac|3|8}}.&lt;br /&gt;
	numerator, denominator = text:match('&amp;lt;sup&amp;gt;(%d+)&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;(%d+)&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt;')&lt;br /&gt;
	if numerator then&lt;br /&gt;
		integer = text:match('(%d+)&amp;lt;span class=&amp;quot;sr-only&amp;quot;&amp;gt;') or&lt;br /&gt;
			text:match('^(%d+)%s*&amp;amp;#x200B;&amp;lt;span') or  -- Template:Frac outputs zwsp since December 2017&lt;br /&gt;
			text:match('^(%d+)%s*&amp;lt;span')&lt;br /&gt;
		return (integer and (integer .. '+') or '') .. numerator .. '/' .. denominator&lt;br /&gt;
	end&lt;br /&gt;
	-- Look for a fraction of form '12¾' or '¾'.&lt;br /&gt;
	local fractions = {&lt;br /&gt;
		['½'] = '1/2',&lt;br /&gt;
		['⅓'] = '1/3',&lt;br /&gt;
		['⅔'] = '2/3',&lt;br /&gt;
		['¼'] = '1/4',&lt;br /&gt;
		['¾'] = '3/4',&lt;br /&gt;
		['⅛'] = '1/8',&lt;br /&gt;
		['⅜'] = '3/8',&lt;br /&gt;
		['⅝'] = '5/8',&lt;br /&gt;
		['⅞'] = '7/8',&lt;br /&gt;
	}&lt;br /&gt;
	integer, rest = text:match('^(%d*)%s*(.*)')&lt;br /&gt;
	local expand = fractions[rest]&lt;br /&gt;
	if expand then&lt;br /&gt;
		return (integer == '' and integer or (integer .. '+')) .. expand&lt;br /&gt;
	end&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	number = number,&lt;br /&gt;
	cleanNumber = cleanNumber,&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>wikipedia&gt;Izno</name></author>
	</entry>
</feed>