<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://bsd.neuroinf.jp/w/index.php?action=history&amp;feed=atom&amp;title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%3AAligned_table</id>
	<title>モジュール:Aligned table - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://bsd.neuroinf.jp/w/index.php?action=history&amp;feed=atom&amp;title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%3AAligned_table"/>
	<link rel="alternate" type="text/html" href="https://bsd.neuroinf.jp/w/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Aligned_table&amp;action=history"/>
	<updated>2026-04-17T17:10:44Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://bsd.neuroinf.jp/w/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Aligned_table&amp;diff=27330&amp;oldid=prev</id>
		<title>WikiSysop: 1版</title>
		<link rel="alternate" type="text/html" href="https://bsd.neuroinf.jp/w/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Aligned_table&amp;diff=27330&amp;oldid=prev"/>
		<updated>2014-06-11T14:57:12Z</updated>

		<summary type="html">&lt;p&gt;1版&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements {{aligned table}}&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function isnotempty(s)&lt;br /&gt;
	return s and s:match( &amp;#039;^%s*(.-)%s*$&amp;#039; ) ~= &amp;#039;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.table(frame)&lt;br /&gt;
	local args = (frame.args[3] ~= nil) and frame.args or frame:getParent().args&lt;br /&gt;
	local entries = {}&lt;br /&gt;
	local colclass = {}&lt;br /&gt;
	local colstyle = {}&lt;br /&gt;
	local cols = tonumber(args[&amp;#039;cols&amp;#039;]) or 2&lt;br /&gt;
&lt;br /&gt;
	-- create the root table&lt;br /&gt;
	local root = mw.html.create(&amp;#039;table&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
	-- add table style for fullwidth&lt;br /&gt;
	if isnotempty(args[&amp;#039;fullwidth&amp;#039;]) then&lt;br /&gt;
		root&lt;br /&gt;
			:css(&amp;#039;width&amp;#039;, &amp;#039;100%&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;border-collapse&amp;#039;, &amp;#039;collapse&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;border-spacing&amp;#039;, &amp;#039;0px 0px&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;border&amp;#039;, &amp;#039;none&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- add table classes&lt;br /&gt;
	if isnotempty(args[&amp;#039;class&amp;#039;]) then&lt;br /&gt;
		root:addClass(args[&amp;#039;class&amp;#039;])&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- add table style&lt;br /&gt;
	if isnotempty(args[&amp;#039;style&amp;#039;]) then&lt;br /&gt;
		root:cssText(args[&amp;#039;style&amp;#039;])&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- build arrays with the column styles and classes&lt;br /&gt;
	if isnotempty(args[&amp;#039;leftright&amp;#039;]) then&lt;br /&gt;
		colstyle[1] = &amp;#039;text-align:left;&amp;#039;&lt;br /&gt;
		colstyle[2] = &amp;#039;text-align:right;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	for i = 1,cols do&lt;br /&gt;
		colclass[ i ] = colclass[ i ] or &amp;#039;&amp;#039;&lt;br /&gt;
		colstyle[ i ] = colstyle[ i ] or &amp;#039;&amp;#039;&lt;br /&gt;
		if isnotempty(args[&amp;#039;colalign&amp;#039; .. tostring(i)]) then&lt;br /&gt;
			colstyle[ i ] = &amp;#039;text-align:&amp;#039; .. args[&amp;#039;colalign&amp;#039; .. tostring(i)] .. &amp;#039;;&amp;#039; .. colstyle[ i ]&lt;br /&gt;
		elseif isnotempty(args[&amp;#039;col&amp;#039; .. tostring(i) .. &amp;#039;align&amp;#039;]) then&lt;br /&gt;
			colstyle[ i ] = &amp;#039;text-align:&amp;#039; .. args[&amp;#039;col&amp;#039; .. tostring(i) .. &amp;#039;align&amp;#039;] .. &amp;#039;;&amp;#039; .. colstyle[ i ]&lt;br /&gt;
		elseif isnotempty(args[&amp;#039;align&amp;#039; .. tostring(i)]) then&lt;br /&gt;
			colstyle[ i ] = &amp;#039;text-align:&amp;#039; .. args[&amp;#039;align&amp;#039; .. tostring(i)] .. &amp;#039;;&amp;#039; .. colstyle[ i ]&lt;br /&gt;
		end&lt;br /&gt;
		if isnotempty(args[&amp;#039;colnowrap&amp;#039; .. tostring(i)]) then&lt;br /&gt;
			colstyle[ i ] = &amp;#039;white-space:nowrap;&amp;#039; .. colstyle[ i ]&lt;br /&gt;
		elseif isnotempty(args[&amp;#039;col&amp;#039; .. tostring(i) .. &amp;#039;nowrap&amp;#039;]) then&lt;br /&gt;
			colstyle[ i ] = &amp;#039;white-space:nowrap;&amp;#039; .. colstyle[ i ]&lt;br /&gt;
		elseif isnotempty(args[&amp;#039;nowrap&amp;#039; .. tostring(i)]) then&lt;br /&gt;
			colstyle[ i ] = &amp;#039;white-space:nowrap;&amp;#039; .. colstyle[ i ]&lt;br /&gt;
		end&lt;br /&gt;
		if isnotempty(args[&amp;#039;colwidth&amp;#039; .. tostring(i)]) then&lt;br /&gt;
			colstyle[ i ] = &amp;#039;width:&amp;#039; .. args[&amp;#039;colwidth&amp;#039; .. tostring(i)] .. &amp;#039;;&amp;#039; .. colstyle[ i ]&lt;br /&gt;
		elseif isnotempty(args[&amp;#039;col&amp;#039; .. tostring(i) .. &amp;#039;width&amp;#039;]) then&lt;br /&gt;
			colstyle[ i ] = &amp;#039;width:&amp;#039; .. args[&amp;#039;col&amp;#039; .. tostring(i) .. &amp;#039;width&amp;#039;] .. &amp;#039;;&amp;#039; .. colstyle[ i ]&lt;br /&gt;
		elseif isnotempty(args[&amp;#039;colwidth&amp;#039;]) then&lt;br /&gt;
			colstyle[ i ] = &amp;#039;width:&amp;#039; .. args[&amp;#039;colwidth&amp;#039;] .. &amp;#039;;&amp;#039; .. colstyle[ i ]&lt;br /&gt;
		end&lt;br /&gt;
		if isnotempty(args[&amp;#039;colstyle&amp;#039; .. tostring(i)]) then&lt;br /&gt;
			colstyle[ i ] = colstyle[ i ] .. args[&amp;#039;colstyle&amp;#039; .. tostring(i)]&lt;br /&gt;
		elseif isnotempty(args[&amp;#039;col&amp;#039; .. tostring(i) .. &amp;#039;style&amp;#039;]) then&lt;br /&gt;
			colstyle[ i ] = colstyle[ i ] .. args[&amp;#039;col&amp;#039; .. tostring(i) .. &amp;#039;style&amp;#039;]&lt;br /&gt;
		elseif isnotempty(args[&amp;#039;style&amp;#039; .. tostring(i)]) then&lt;br /&gt;
			colstyle[ i ] = colstyle[ i ] .. args[&amp;#039;style&amp;#039; .. tostring(i)]&lt;br /&gt;
		end&lt;br /&gt;
		if isnotempty(args[&amp;#039;colclass&amp;#039; .. tostring(i)]) then&lt;br /&gt;
			colclass[ i ] =  args[&amp;#039;colclass&amp;#039; .. tostring(i)]&lt;br /&gt;
		elseif isnotempty(args[&amp;#039;col&amp;#039; .. tostring(i) .. &amp;#039;class&amp;#039;]) then&lt;br /&gt;
			colclass[ i ] =  args[&amp;#039;col&amp;#039; .. tostring(i) .. &amp;#039;class&amp;#039;]&lt;br /&gt;
		elseif isnotempty(args[&amp;#039;class&amp;#039; .. tostring(i)]) then&lt;br /&gt;
			colclass[ i ] =  args[&amp;#039;class&amp;#039; .. tostring(i)]&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- compute the maximum cell index&lt;br /&gt;
	local cellcount = 0&lt;br /&gt;
	for k, v in pairs( args ) do&lt;br /&gt;
		if type( k ) == &amp;#039;number&amp;#039; then&lt;br /&gt;
			cellcount = math.max(cellcount, k)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- compute the number of rows&lt;br /&gt;
	local rows = math.ceil(cellcount / cols)&lt;br /&gt;
&lt;br /&gt;
	-- build the table content&lt;br /&gt;
	for j=1,rows do&lt;br /&gt;
		-- start a new row&lt;br /&gt;
		local row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		row:css(&amp;#039;vertical-align&amp;#039;, &amp;#039;top&amp;#039;)&lt;br /&gt;
		-- loop over the cells in each row&lt;br /&gt;
		for i=1,cols do&lt;br /&gt;
			local cell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			if args[&amp;#039;class&amp;#039; .. tostring(j) .. &amp;#039;.&amp;#039; .. tostring(i)] then&lt;br /&gt;
				cell:addClass(args[&amp;#039;class&amp;#039; .. tostring(j) .. &amp;#039;.&amp;#039; .. tostring(i)])&lt;br /&gt;
			elseif args[&amp;#039;rowclass&amp;#039; .. tostring(j)] then&lt;br /&gt;
				cell:addClass(args[&amp;#039;rowclass&amp;#039; .. tostring(j)])&lt;br /&gt;
			elseif args[&amp;#039;row&amp;#039; .. tostring(j) .. &amp;#039;class&amp;#039;] then&lt;br /&gt;
				cell:addClass(args[&amp;#039;row&amp;#039; .. tostring(j) .. &amp;#039;class&amp;#039;])&lt;br /&gt;
			elseif colclass[i] ~= &amp;#039;&amp;#039; then&lt;br /&gt;
				cell:addClass(colclass[i])&lt;br /&gt;
			end&lt;br /&gt;
			if args[&amp;#039;style&amp;#039; .. tostring(j) .. &amp;#039;.&amp;#039; .. tostring(i)] then&lt;br /&gt;
				cell:cssText(args[&amp;#039;style&amp;#039; .. tostring(j) .. &amp;#039;.&amp;#039; .. tostring(i)])&lt;br /&gt;
			elseif args[&amp;#039;rowstyle&amp;#039; .. tostring(j)] then&lt;br /&gt;
				cell:cssText(args[&amp;#039;rowstyle&amp;#039; .. tostring(j)])&lt;br /&gt;
			elseif args[&amp;#039;row&amp;#039; .. tostring(j) .. &amp;#039;style&amp;#039;] then&lt;br /&gt;
				cell:cssText(args[&amp;#039;row&amp;#039; .. tostring(j) .. &amp;#039;style&amp;#039;])&lt;br /&gt;
			elseif colstyle[i] ~= &amp;#039;&amp;#039; then&lt;br /&gt;
				cell:cssText(colstyle[i])&lt;br /&gt;
			end&lt;br /&gt;
			cell:wikitext(args[cols*(j - 1) + i] or &amp;#039;&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- return the root table&lt;br /&gt;
	return tostring(root)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
</feed>