<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.cultopedia.org/index.php?action=history&amp;feed=atom&amp;title=Module%3ACollapsible_list</id>
	<title>Module:Collapsible list - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.cultopedia.org/index.php?action=history&amp;feed=atom&amp;title=Module%3ACollapsible_list"/>
	<link rel="alternate" type="text/html" href="https://www.cultopedia.org/index.php?title=Module:Collapsible_list&amp;action=history"/>
	<updated>2026-04-06T01:13:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.5</generator>
	<entry>
		<id>https://www.cultopedia.org/index.php?title=Module:Collapsible_list&amp;diff=1081&amp;oldid=prev</id>
		<title>imported&gt;Johnuniq: fix &quot;Lua error in Module:Collapsible_list at line 142: attempt to call method &#039;expandTemplate&#039; (a nil value)&quot; at Sahara</title>
		<link rel="alternate" type="text/html" href="https://www.cultopedia.org/index.php?title=Module:Collapsible_list&amp;diff=1081&amp;oldid=prev"/>
		<updated>2026-02-02T06:27:30Z</updated>

		<summary type="html">&lt;p&gt;fix &amp;quot;Lua error in &lt;a href=&quot;/index.php/Module:Collapsible_list&quot; title=&quot;Module:Collapsible list&quot;&gt;Module:Collapsible_list&lt;/a&gt; at line 142: attempt to call method &amp;#039;expandTemplate&amp;#039; (a nil value)&amp;quot; at &lt;a href=&quot;https://en.wikipedia.org/wiki/Sahara&quot; class=&quot;extiw cultopedia-missing-wikipedia&quot; title=&quot;Sahara on Wikipedia&quot; rel=&quot;nofollow&quot;&gt;Sahara&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
local function getListItem( data )&lt;br /&gt;
	if not type( data ) == &amp;#039;string&amp;#039; then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	return mw.ustring.format( &amp;#039;&amp;lt;li style=&amp;quot;line-height: inherit; margin: 0&amp;quot;&amp;gt;%s&amp;lt;/li&amp;gt;&amp;#039;, data )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Returns an array containing the keys of all positional arguments&lt;br /&gt;
-- that contain data (i.e. non-whitespace values).&lt;br /&gt;
local function getArgNums( args )&lt;br /&gt;
	local nums = {}&lt;br /&gt;
	for k, v in pairs( args ) do&lt;br /&gt;
		if type( k ) == &amp;#039;number&amp;#039; and&lt;br /&gt;
			k &amp;gt;= 1 and&lt;br /&gt;
			math.floor( k ) == k and&lt;br /&gt;
			type( v ) == &amp;#039;string&amp;#039; and&lt;br /&gt;
			mw.ustring.match( v, &amp;#039;%S&amp;#039; ) then&lt;br /&gt;
			table.insert( nums, k )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	table.sort( nums )&lt;br /&gt;
	return nums&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Formats a list of classes, styles or other attributes.&lt;br /&gt;
local function formatAttributes( attrType, ... )&lt;br /&gt;
	local attributes = { ... }&lt;br /&gt;
	local nums = getArgNums( attributes )&lt;br /&gt;
	local t = {}&lt;br /&gt;
	for i, num in ipairs( nums ) do&lt;br /&gt;
		table.insert( t, attributes[ num ] )&lt;br /&gt;
	end&lt;br /&gt;
	if #t == 0 then&lt;br /&gt;
		return &amp;#039;&amp;#039; -- Return the blank string so concatenation will work.&lt;br /&gt;
	end&lt;br /&gt;
	return mw.ustring.format( &amp;#039; %s=&amp;quot;%s&amp;quot;&amp;#039;, attrType, table.concat( t, &amp;#039; &amp;#039; ) )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- TODO: use Module:List. Since the update for this comment is routine,&lt;br /&gt;
-- this is blocked without a consensus discussion by&lt;br /&gt;
-- [[MediaWiki_talk:Common.css/Archive_15#plainlist_+_hlist_indentation]]&lt;br /&gt;
-- if we decide hlist in plainlist in this template isn&amp;#039;t an issue, we can use&lt;br /&gt;
-- module:list directly&lt;br /&gt;
-- [https://en.wikipedia.org/w/index.php?title=Module:Collapsible_list/sandbox&amp;amp;oldid=1130172480]&lt;br /&gt;
-- is an implementation (that will code rot slightly I expect)&lt;br /&gt;
local function buildList( args )&lt;br /&gt;
	-- Get the list items.&lt;br /&gt;
	local listItems = {}&lt;br /&gt;
	local argNums = getArgNums( args )&lt;br /&gt;
	for i, num in ipairs( argNums ) do&lt;br /&gt;
		table.insert( listItems, getListItem( args[ num ] ) )&lt;br /&gt;
	end&lt;br /&gt;
	if #listItems == 0 then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	listItems = table.concat( listItems )&lt;br /&gt;
&lt;br /&gt;
	-- hack around mw-collapsible show/hide jumpiness by looking for text-alignment&lt;br /&gt;
	-- by setting a margin if centered&lt;br /&gt;
	local textAlignmentCentered = &amp;#039;text%-align%s*:%s*center&amp;#039;&lt;br /&gt;
	local centeredTitle = (args.title_style and args.title_style:lower():match(textAlignmentCentered)&lt;br /&gt;
		or args.titlestyle and args.titlestyle:lower():match(textAlignmentCentered))&lt;br /&gt;
	local centeredTitleSpacing&lt;br /&gt;
	if centeredTitle then&lt;br /&gt;
		centeredTitleSpacing = &amp;#039;margin: 0 4em&amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		centeredTitleSpacing = &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Get class, style and title data.&lt;br /&gt;
	local collapsibleContainerClass = formatAttributes(&lt;br /&gt;
		&amp;#039;class&amp;#039;,&lt;br /&gt;
		&amp;#039;collapsible-list&amp;#039;,&lt;br /&gt;
		&amp;#039;mw-collapsible&amp;#039;,&lt;br /&gt;
		not args.expand and &amp;#039;mw-collapsed&amp;#039;&lt;br /&gt;
	)&lt;br /&gt;
	local collapsibleContainerStyle = formatAttributes(&lt;br /&gt;
		&amp;#039;style&amp;#039;,&lt;br /&gt;
		-- mostly work around .infobox-full-data defaulting to centered&lt;br /&gt;
		&amp;#039;text-align: left;&amp;#039;,&lt;br /&gt;
		args.frame_style,&lt;br /&gt;
		args.framestyle&lt;br /&gt;
	)&lt;br /&gt;
	local collapsibleTitleStyle = formatAttributes(&lt;br /&gt;
		&amp;#039;style&amp;#039;,&lt;br /&gt;
		&amp;#039;line-height: 1.6em; font-weight: bold;&amp;#039;,&lt;br /&gt;
		args.title_style,&lt;br /&gt;
		args.titlestyle&lt;br /&gt;
	)&lt;br /&gt;
	local jumpyTitleStyle = formatAttributes(&lt;br /&gt;
		&amp;#039;style&amp;#039;,&lt;br /&gt;
		centeredTitleSpacing&lt;br /&gt;
	)&lt;br /&gt;
	local title = args.title or &amp;#039;List&amp;#039;&lt;br /&gt;
	local ulclass = formatAttributes( &amp;#039;class&amp;#039;, &amp;#039;mw-collapsible-content&amp;#039;, args.hlist and &amp;#039;hlist&amp;#039; )&lt;br /&gt;
	local ulstyle = formatAttributes(&lt;br /&gt;
		&amp;#039;style&amp;#039;,&lt;br /&gt;
		&amp;#039;margin-top: 0; margin-bottom: 0; line-height: inherit;&amp;#039;,&lt;br /&gt;
		not args.bullets and &amp;#039;list-style: none; margin-left: 0;&amp;#039;,&lt;br /&gt;
		args.list_style,&lt;br /&gt;
		args.liststyle&lt;br /&gt;
	)&lt;br /&gt;
&lt;br /&gt;
	local hlist_templatestyles = &amp;#039;&amp;#039;&lt;br /&gt;
	if args.hlist then&lt;br /&gt;
		hlist_templatestyles = mw.getCurrentFrame():extensionTag{&lt;br /&gt;
			name = &amp;#039;templatestyles&amp;#039;, args = { src = &amp;#039;Hlist/styles.css&amp;#039; }&lt;br /&gt;
		}&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Build the list.&lt;br /&gt;
	return mw.ustring.format(&lt;br /&gt;
		&amp;#039;%s&amp;lt;div%s%s&amp;gt;\n&amp;lt;div%s&amp;gt;&amp;lt;div%s&amp;gt;%s&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;\n&amp;lt;ul%s%s&amp;gt;%s&amp;lt;/ul&amp;gt;\n&amp;lt;/div&amp;gt;&amp;#039;,&lt;br /&gt;
		hlist_templatestyles, collapsibleContainerClass, collapsibleContainerStyle,&lt;br /&gt;
		collapsibleTitleStyle, jumpyTitleStyle, title, ulclass, ulstyle, listItems&lt;br /&gt;
	)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main( frame )&lt;br /&gt;
	local origArgs&lt;br /&gt;
	local current_frame = mw.getCurrentFrame()&lt;br /&gt;
	if frame == current_frame then&lt;br /&gt;
		origArgs = frame:getParent().args&lt;br /&gt;
		for k, v in pairs( frame.args ) do&lt;br /&gt;
			origArgs = frame.args&lt;br /&gt;
			break&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		origArgs = frame&lt;br /&gt;
		frame = current_frame&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local args = {}&lt;br /&gt;
	for k, v in pairs( origArgs ) do&lt;br /&gt;
		if type( k ) == &amp;#039;number&amp;#039; or v ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			args[ k ] = v&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local check = require(&amp;#039;Module:Check for unknown parameters&amp;#039;)._check&lt;br /&gt;
	local tracking = check({&lt;br /&gt;
		[&amp;#039;unknown&amp;#039;] = frame:expandTemplate{&lt;br /&gt;
			title = &amp;#039;main other&amp;#039;,&lt;br /&gt;
			args = {&amp;#039;[[Category:Pages using collapsible list with unknown parameters|_VALUE_ ]]&amp;#039;}&lt;br /&gt;
		},&lt;br /&gt;
		[&amp;#039;preview&amp;#039;] = &amp;#039;Page using [[Template:Collapsible list]] with unknown parameter &amp;quot;_VALUE_&amp;quot;&amp;#039;,&lt;br /&gt;
		[&amp;#039;ignoreblank&amp;#039;] = &amp;#039;y&amp;#039;,&lt;br /&gt;
		regexp1 = &amp;#039;%d+&amp;#039;,&lt;br /&gt;
		&amp;#039;title_style&amp;#039;, &amp;#039;titlestyle&amp;#039;, &amp;#039;expand&amp;#039;,&lt;br /&gt;
		&amp;#039;frame_style&amp;#039;, &amp;#039;framestyle&amp;#039;, &amp;#039;title&amp;#039;,&lt;br /&gt;
		&amp;#039;hlist&amp;#039;, &amp;#039;bullets&amp;#039;, &amp;#039;list_style&amp;#039;, &amp;#039;liststyle&amp;#039;,&lt;br /&gt;
	}, frame:getParent().args)&lt;br /&gt;
&lt;br /&gt;
	return buildList( args ) .. tracking&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Johnuniq</name></author>
	</entry>
</feed>