<?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%3AGallery</id>
	<title>モジュール:Gallery - 版の履歴</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%3AGallery"/>
	<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:Gallery&amp;action=history"/>
	<updated>2026-04-15T08:24:07Z</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:Gallery&amp;diff=37208&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:Gallery&amp;diff=37208&amp;oldid=prev"/>
		<updated>2017-01-19T02:20:43Z</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 {{gallery}}&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function trim(s)&lt;br /&gt;
	return (mw.ustring.gsub(s, &amp;quot;^%s*(.-)%s*$&amp;quot;, &amp;quot;%1&amp;quot;))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.gallery(frame)&lt;br /&gt;
	local origArgs&lt;br /&gt;
	-- If called via #invoke, use the args passed into the invoking template.&lt;br /&gt;
	-- Otherwise, for testing purposes, assume args are being passed directly in.&lt;br /&gt;
	if type(frame.getParent) == &amp;#039;function&amp;#039; then&lt;br /&gt;
		origArgs = frame:getParent().args&lt;br /&gt;
	else&lt;br /&gt;
		origArgs = frame&lt;br /&gt;
	end&lt;br /&gt;
    &lt;br /&gt;
    -- ParserFunctions considers the empty string to be false, so to preserve the previous &lt;br /&gt;
    -- behavior of {{gallery}}, change any empty arguments to nil, so Lua will consider&lt;br /&gt;
    -- them false too.&lt;br /&gt;
    local args = {}&lt;br /&gt;
    for k, v in pairs(origArgs) do&lt;br /&gt;
    	if 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 tbl = mw.html.create(&amp;#039;table&amp;#039;)&lt;br /&gt;
    &lt;br /&gt;
	if args.state then&lt;br /&gt;
		tbl&lt;br /&gt;
			:css(&amp;#039;width&amp;#039;, &amp;#039;100%&amp;#039;)&lt;br /&gt;
			:addClass(&amp;#039;collapsible&amp;#039;)&lt;br /&gt;
			:addClass(args.state)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if args.style then&lt;br /&gt;
		tbl:cssText(args.style)&lt;br /&gt;
	else&lt;br /&gt;
		tbl&lt;br /&gt;
			:css(&amp;#039;background&amp;#039;, &amp;#039;transparent&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;margin-top&amp;#039;, &amp;#039;0.5em&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if args.align then&lt;br /&gt;
		if args.align == &amp;#039;center&amp;#039; then&lt;br /&gt;
			tbl&lt;br /&gt;
				:css(&amp;#039;margin-left&amp;#039;, &amp;#039;auto&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;margin-right&amp;#039;, &amp;#039;auto&amp;#039;)&lt;br /&gt;
		else&lt;br /&gt;
			tbl:css(&amp;#039;float&amp;#039;, args.align)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if args.title then&lt;br /&gt;
		tbl&lt;br /&gt;
			:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
				:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
					:css(&amp;#039;text-align&amp;#039;, &amp;#039;center&amp;#039;)&lt;br /&gt;
					:css(&amp;#039;font-weight&amp;#039;, &amp;#039;bold&amp;#039;)&lt;br /&gt;
					:wikitext(args.title)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local mainCell = tbl:tag(&amp;#039;tr&amp;#039;):tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	local imageCount = math.ceil(#args / 2)&lt;br /&gt;
	local cellWidth = tonumber(args.cellwidth) or tonumber(args.width) or 180&lt;br /&gt;
	local imgHeight = tonumber(args.height) or 180&lt;br /&gt;
	local lines = tonumber(args.lines) or 2&lt;br /&gt;
	local captionstyle = args.captionstyle&lt;br /&gt;
	&lt;br /&gt;
    for i = 1, imageCount do&lt;br /&gt;
		local img = trim(args[i*2 - 1] or &amp;#039;&amp;#039;)&lt;br /&gt;
		local caption = trim(args[i*2] or &amp;#039;&amp;#039;)&lt;br /&gt;
		local imgWidth = tonumber(args[&amp;#039;width&amp;#039; .. i]) or tonumber(args.width) or 180&lt;br /&gt;
		local alt = args[&amp;#039;alt&amp;#039; .. i] or &amp;#039;&amp;#039;&lt;br /&gt;
		&lt;br /&gt;
		local textWidth&lt;br /&gt;
		if cellWidth &amp;lt; 30 then&lt;br /&gt;
			textWidth = imgHeight + 27&lt;br /&gt;
		else&lt;br /&gt;
			textWidth = cellWidth + 7&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if img ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			local imgTbl = mainCell:tag(&amp;#039;table&amp;#039;)&lt;br /&gt;
            &lt;br /&gt;
			imgTbl&lt;br /&gt;
				:css(&amp;#039;width&amp;#039;, (cellWidth + 20) .. &amp;#039;px&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;float&amp;#039;, &amp;#039;left&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;border-collapse&amp;#039;, &amp;#039;collapse&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;margin&amp;#039;, &amp;#039;3px&amp;#039;)&lt;br /&gt;
				:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
					:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
						:css(&amp;#039;height&amp;#039;, (imgHeight + 20) .. &amp;#039;px&amp;#039;)&lt;br /&gt;
						:css(&amp;#039;border&amp;#039;, &amp;#039;1px solid #CCCCCC&amp;#039;)&lt;br /&gt;
						:css(&amp;#039;background-color&amp;#039;, &amp;#039;#F8F8F8&amp;#039;)&lt;br /&gt;
						:css(&amp;#039;padding&amp;#039;, &amp;#039;0px&amp;#039;)&lt;br /&gt;
						:css(&amp;#039;text-align&amp;#039;, &amp;#039;center&amp;#039;)&lt;br /&gt;
						:wikitext(string.format(&amp;#039;[[%s|center|border|%dx%dpx|alt=%s|%s]]&amp;#039;, img, imgWidth, imgHeight, alt, mw.text.unstrip(caption)))&lt;br /&gt;
						:done()&lt;br /&gt;
					:done()&lt;br /&gt;
				:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
					:css(&amp;#039;vertical-align&amp;#039;, &amp;#039;top&amp;#039;)&lt;br /&gt;
					:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
						:css(&amp;#039;display&amp;#039;, &amp;#039;block&amp;#039;)&lt;br /&gt;
						:css(&amp;#039;font-size&amp;#039;, &amp;#039;1em&amp;#039;)&lt;br /&gt;
						:css(&amp;#039;padding&amp;#039;, &amp;#039;0px&amp;#039;)&lt;br /&gt;
						:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
							:addClass(&amp;#039;gallerytext&amp;#039;)&lt;br /&gt;
							:css(&amp;#039;min-height&amp;#039;, (0.1 + 1.5*lines) .. &amp;#039;em&amp;#039;)&lt;br /&gt;
							:css(&amp;#039;width&amp;#039;, textWidth .. &amp;#039;px&amp;#039;)&lt;br /&gt;
							:css(&amp;#039;line-height&amp;#039;, &amp;#039;1.3em&amp;#039;)&lt;br /&gt;
							:css(&amp;#039;padding&amp;#039;, &amp;#039;2px 6px 1px 6px&amp;#039;)&lt;br /&gt;
							:css(&amp;#039;margin&amp;#039;, &amp;#039;0px&amp;#039;)&lt;br /&gt;
							:css(&amp;#039;border&amp;#039;, &amp;#039;none&amp;#039;)&lt;br /&gt;
							:css(&amp;#039;border-width&amp;#039;, &amp;#039;0px&amp;#039;)&lt;br /&gt;
							:cssText(captionstyle)&lt;br /&gt;
							:wikitext(caption .. &amp;#039;&amp;amp;nbsp;&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
    &lt;br /&gt;
	if args.footer then&lt;br /&gt;
		tbl&lt;br /&gt;
			:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
				:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
					:css(&amp;#039;text-align&amp;#039;, &amp;#039;right&amp;#039;)&lt;br /&gt;
					:css(&amp;#039;font-size&amp;#039;, &amp;#039;80%&amp;#039;)&lt;br /&gt;
					:css(&amp;#039;line-height&amp;#039;, &amp;#039;1em&amp;#039;)&lt;br /&gt;
					:wikitext(args.footer)&lt;br /&gt;
	end&lt;br /&gt;
	if args.perrow then&lt;br /&gt;
		tbl:css(&amp;#039;width&amp;#039;, 8 + (cellWidth + 20 + 6)*tonumber(args.perrow) .. &amp;#039;px&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return tostring(tbl)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
</feed>