<?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%2FMd_gilbert%2FListItem</id>
	<title>Module:Sandbox/Md gilbert/ListItem - 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%2FMd_gilbert%2FListItem"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Md_gilbert/ListItem&amp;action=history"/>
	<updated>2026-08-10T23:56:31Z</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/Md_gilbert/ListItem&amp;diff=145819&amp;oldid=prev</id>
		<title>imported&gt;Legoktm: Replace Module:No globals with require( &quot;strict&quot; )</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Md_gilbert/ListItem&amp;diff=145819&amp;oldid=prev"/>
		<updated>2022-10-23T21:02:46Z</updated>

		<summary type="html">&lt;p&gt;Replace &lt;a href=&quot;/research/Module:No_globals&quot; title=&quot;Module:No globals&quot;&gt;Module:No globals&lt;/a&gt; with require( &amp;quot;strict&amp;quot; )&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require(&amp;#039;strict&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
This module is intended to be invoked by the ListMaster module. Depending on the style&lt;br /&gt;
passed to the parent, will parse and display the list item as a table row, subsection, etc.&lt;br /&gt;
&lt;br /&gt;
Possible values that could be used for a members table:&lt;br /&gt;
  name, role, member_since, role, status, etc&lt;br /&gt;
Possible values that could be used for a tasks table:&lt;br /&gt;
  title, notes, page, owner, created, due, completed, priority, remaining, etc&lt;br /&gt;
  &lt;br /&gt;
Values can be passed in that aren&amp;#039;t displayed, allowing for more robust storage&lt;br /&gt;
of metadata for each item (ie, any arbitrary value can be passed in that aren&amp;#039;t&lt;br /&gt;
intended to be displayed, but instead facilitate machine-trackable data).&lt;br /&gt;
--]]&lt;br /&gt;
function p.printItem(frame)&lt;br /&gt;
	local parent_frame = frame:getParent()&lt;br /&gt;
	local style = parent_frame.args.style&lt;br /&gt;
	local display = parent_frame.args.display&lt;br /&gt;
&lt;br /&gt;
	local res = &amp;quot;&amp;quot;&lt;br /&gt;
	if style == &amp;quot;table&amp;quot; then&lt;br /&gt;
		res = &amp;quot;|- \n&amp;quot;&lt;br /&gt;
		for col in string.gmatch(display, &amp;quot;[^,]+&amp;quot;) do&lt;br /&gt;
			-- Validate the current field, make sure we have the desired value,&lt;br /&gt;
			-- setting to an empty string if the arg doesn&amp;#039;t exist.&lt;br /&gt;
			if frame.args[col] == nil then&lt;br /&gt;
				frame.args[col] = &amp;quot;&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
			-- Then display, passing to our local functions if the argument&lt;br /&gt;
			-- is one for which we have a specialized display function&lt;br /&gt;
			if p[&amp;quot;display_&amp;quot; .. col] ~= nil then&lt;br /&gt;
				res = res .. &amp;quot;| &amp;quot; .. p[&amp;quot;display_&amp;quot; .. col]( frame.args[col] ) .. &amp;quot;\n&amp;quot;&lt;br /&gt;
			else&lt;br /&gt;
				res = res .. &amp;quot;| &amp;quot; .. frame.args[col] .. &amp;quot;\n&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	elseif style == &amp;quot;section&amp;quot; then&lt;br /&gt;
		local title = &amp;quot;ListItem&amp;quot;&lt;br /&gt;
		if frame.args.name ~= nil then&lt;br /&gt;
			title = frame.args.name&lt;br /&gt;
		elseif frame.args.title ~= nil then&lt;br /&gt;
			title = frame.args.title&lt;br /&gt;
		end&lt;br /&gt;
		res = &amp;quot;==&amp;quot; .. title .. &amp;quot;==\n&amp;quot;&lt;br /&gt;
		-- Then go through each of the display sections and add to res&lt;br /&gt;
		for col in string.gmatch(display, &amp;quot;[^,]+&amp;quot;) do&lt;br /&gt;
			-- Validate the current field, make sure we have the desired value,&lt;br /&gt;
			-- setting to an empty string if the arg doesn&amp;#039;t exist.&lt;br /&gt;
			if frame.args[col] == nil then&lt;br /&gt;
				frame.args[col] = &amp;quot;&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
			-- Then display each value, passing to our local functions if they exist.&lt;br /&gt;
			if p[&amp;quot;display_&amp;quot; .. col] ~= nil then&lt;br /&gt;
				res = res .. &amp;quot;&amp;#039;&amp;#039;&amp;#039;&amp;quot; .. p.firstToUpper(col) .. &amp;quot;&amp;#039;&amp;#039;&amp;#039;: &amp;quot; .. p[&amp;quot;display_&amp;quot; .. col]( frame.args[col] )&lt;br /&gt;
			else&lt;br /&gt;
				res = res .. &amp;quot;&amp;#039;&amp;#039;&amp;#039;&amp;quot; .. p.firstToUpper(col) .. &amp;quot;&amp;#039;&amp;#039;&amp;#039;: &amp;quot; .. frame.args[col]&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return res&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.display_name(name)&lt;br /&gt;
	return &amp;quot;[[User:&amp;quot; .. name .. &amp;quot;|&amp;quot; .. name .. &amp;quot;]]&amp;amp;nbsp;•&amp;amp;nbsp;[[User_talk:&amp;quot; .. name .. &amp;quot;|Talk]]&amp;amp;nbsp;•&amp;amp;nbsp;[[Special:Contributions/&amp;quot; .. name .. &amp;quot;|Contribs]]&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.firstToUpper(str)&lt;br /&gt;
    return (str:gsub(&amp;quot;^%l&amp;quot;, string.upper))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Legoktm</name></author>
	</entry>
</feed>