<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.inqubos.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AObject_weight</id>
	<title>Module:Object weight - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.inqubos.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AObject_weight"/>
	<link rel="alternate" type="text/html" href="https://wiki.inqubos.com/index.php?title=Module:Object_weight&amp;action=history"/>
	<updated>2026-10-24T18:43:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.inqubos.com/index.php?title=Module:Object_weight&amp;diff=3829&amp;oldid=prev</id>
		<title>imported&gt;Zackmann08: fixing indentation issue</title>
		<link rel="alternate" type="text/html" href="https://wiki.inqubos.com/index.php?title=Module:Object_weight&amp;diff=3829&amp;oldid=prev"/>
		<updated>2025-10-03T09:28:54Z</updated>

		<summary type="html">&lt;p&gt;fixing indentation issue&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module is based off of [[Module:Person weight]]&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function clean_weight(s)&lt;br /&gt;
&lt;br /&gt;
	s = mw.ustring.gsub(s, &amp;#039;grams&amp;#039;, &amp;#039;g&amp;#039;)&lt;br /&gt;
	s = mw.ustring.gsub(s, &amp;#039;gram&amp;#039;, &amp;#039;g&amp;#039;)&lt;br /&gt;
	s = mw.ustring.gsub(s, &amp;#039;gs&amp;#039;, &amp;#039;g&amp;#039;)&lt;br /&gt;
	s = mw.ustring.gsub(s, &amp;#039;g[%.,]&amp;#039;, &amp;#039;g&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
	s = mw.ustring.gsub(s, &amp;#039;ounces&amp;#039;, &amp;#039;oz&amp;#039;)&lt;br /&gt;
	s = mw.ustring.gsub(s, &amp;#039;ounce&amp;#039;, &amp;#039;oz&amp;#039;)&lt;br /&gt;
	s = mw.ustring.gsub(s, &amp;#039;oz[%.,]&amp;#039;, &amp;#039;oz&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
	return s&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function isnumber(s)&lt;br /&gt;
	if s then&lt;br /&gt;
		s = mw.ustring.gsub(s, &amp;#039;%+%s*%d+%s*/%s*%d+%s*$&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
		s = mw.ustring.gsub(s, &amp;#039;%s*[–%-]%s*&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
		return tonumber(s)&lt;br /&gt;
	end&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function get_convert_weight_args(s)&lt;br /&gt;
	local prefer_g = (prefer or &amp;#039;&amp;#039;) == &amp;#039;g&amp;#039;&lt;br /&gt;
	local force_g = (enforce or &amp;#039;&amp;#039;) == &amp;#039;g&amp;#039;&lt;br /&gt;
	local prefer_oz = (prefer or &amp;#039;&amp;#039;) == &amp;#039;oz&amp;#039;&lt;br /&gt;
	local force_oz = (enforce or &amp;#039;&amp;#039;) == &amp;#039;oz&amp;#039;&lt;br /&gt;
	&lt;br /&gt;
	unconverted = clean_weight(s or &amp;#039;&amp;#039;) -- basic unit cleaning&lt;br /&gt;
	&lt;br /&gt;
	s = mw.ustring.gsub(unconverted, &amp;#039;&amp;amp;[Nn][Bb][Ss][Pp];&amp;#039;, &amp;#039; &amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	local g = mw.ustring.find(s, &amp;#039;g&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	local oz = mw.ustring.find(s, &amp;#039;oz&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	if g == nil and oz == nil then&lt;br /&gt;
		return &amp;#039;&amp;#039;, unconverted&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if g ~= nil and oz == nil then&lt;br /&gt;
		local n = mw.ustring.sub(s, 1, g - 1)&lt;br /&gt;
		if isnumber(n) then&lt;br /&gt;
			return {n,&amp;#039;g&amp;#039;,&amp;#039;oz&amp;#039;,0,[&amp;#039;abbr&amp;#039;]=&amp;#039;on&amp;#039;}, mw.ustring.sub(s, g+1)&lt;br /&gt;
		end&lt;br /&gt;
		return &amp;#039;&amp;#039;, unconverted&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if oz ~= nil and g == nil then&lt;br /&gt;
		local n = mw.ustring.sub(s, 1, oz - 1)&lt;br /&gt;
		if isnumber(n) then&lt;br /&gt;
			return {n,&amp;#039;oz&amp;#039;,&amp;#039;g&amp;#039;,0,[&amp;#039;abbr&amp;#039;]=&amp;#039;on&amp;#039;}, mw.ustring.sub(s, oz+2)&lt;br /&gt;
		end&lt;br /&gt;
		return &amp;#039;&amp;#039;, unconverted&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return &amp;#039;&amp;#039;, unconverted&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function convert_weight(frame, args)&lt;br /&gt;
	local targs, str = get_convert_weight_args(args[1])&lt;br /&gt;
&lt;br /&gt;
	if type(targs) == &amp;#039;table&amp;#039; then&lt;br /&gt;
		return frame:expandTemplate{ title = &amp;#039;convert&amp;#039;, args = targs} .. str&lt;br /&gt;
	else&lt;br /&gt;
		return str&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.weight(frame)&lt;br /&gt;
	return convert_weight(frame, frame.args[1] and frame.args or frame:getParent().args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Zackmann08</name></author>
	</entry>
</feed>