<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://the.satanic.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AGalleryPreview</id>
	<title>Module:GalleryPreview - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://the.satanic.wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AGalleryPreview"/>
	<link rel="alternate" type="text/html" href="https://the.satanic.wiki/index.php?title=Module:GalleryPreview&amp;action=history"/>
	<updated>2026-04-20T03:53:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://the.satanic.wiki/index.php?title=Module:GalleryPreview&amp;diff=10910&amp;oldid=prev</id>
		<title>WikiGOD: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://the.satanic.wiki/index.php?title=Module:GalleryPreview&amp;diff=10910&amp;oldid=prev"/>
		<updated>2021-04-30T02:23:55Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 02:23, 30 April 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key zzegtzyr_mw19226-mwjf_:diff:1.41:old-10909:rev-10910 --&gt;
&lt;/table&gt;</summary>
		<author><name>WikiGOD</name></author>
	</entry>
	<entry>
		<id>https://the.satanic.wiki/index.php?title=Module:GalleryPreview&amp;diff=10909&amp;oldid=prev</id>
		<title>Mediawiki&gt;The JoTS: Option to include image captions from source gallery.</title>
		<link rel="alternate" type="text/html" href="https://the.satanic.wiki/index.php?title=Module:GalleryPreview&amp;diff=10909&amp;oldid=prev"/>
		<updated>2017-10-29T04:54:58Z</updated>

		<summary type="html">&lt;p&gt;Option to include image captions from source gallery.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--| Module:GalleryPreview (v1.2.0)&lt;br /&gt;
--- Creates a preview of images from a gallery page.&lt;br /&gt;
--by author: &amp;quot;The JoTS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-- update 10/28/2017 - Option to include image captions from source gallery.&lt;br /&gt;
&lt;br /&gt;
-- &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
--% Creates a metatable wrapper for checking arguments.&lt;br /&gt;
--@ frArgs (table) The arguments table from a frame object. (i.e. frame.args)&lt;br /&gt;
--: (table) &amp;quot;Wrapped&amp;quot; table. Arguments my be indexed with membership operator.&lt;br /&gt;
local function argChecker(frArgs)&lt;br /&gt;
    return setmetatable({}, {&lt;br /&gt;
        __index = function(t, arg)&lt;br /&gt;
            if arg:match(&amp;#039;^_&amp;#039;) then&lt;br /&gt;
                return frArgs[arg:gsub(&amp;#039;^_&amp;#039;,&amp;#039;&amp;#039;)]&lt;br /&gt;
            else&lt;br /&gt;
                return assert(frArgs[arg],&lt;br /&gt;
                    &amp;#039;Argument &amp;quot;&amp;#039; .. arg .. &amp;#039;&amp;quot; was not provided&amp;#039;)&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    })&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Gallery object template&lt;br /&gt;
local gallery_src = mw.html.create(&amp;quot;gallery&amp;quot;)&lt;br /&gt;
    :attr({navigation = &amp;#039;true&amp;#039;, hideaddbutton = &amp;#039;true&amp;#039;, position = &amp;#039;center&amp;#039;})&lt;br /&gt;
&lt;br /&gt;
-- Module source&lt;br /&gt;
return {&lt;br /&gt;
    main = function(frame)&lt;br /&gt;
        local args = argChecker(frame.args)&lt;br /&gt;
&lt;br /&gt;
        local gallerypg   = args.gallery_page     -- Link to gallery&lt;br /&gt;
        local settings    = args._settings        -- Settings to apply to &amp;lt;gallery&amp;gt;&lt;br /&gt;
        local defaultTxt  = args._default         -- Text if link is a redlink&lt;br /&gt;
        local portalImg   = args._portal_image    -- Portal image that links to page&lt;br /&gt;
        local inclCaption = args._include_caption -- Include image caption&lt;br /&gt;
        local numOfImgs  = assert(tonumber(args.number_of_images),&lt;br /&gt;
            &amp;#039;Argument &amp;quot;number_of_images&amp;quot; is not an integer&amp;#039;)&lt;br /&gt;
            - (portalImg and 1 or 0)&lt;br /&gt;
        &lt;br /&gt;
        gallerypg = mw.title.new(gallerypg)&lt;br /&gt;
        &lt;br /&gt;
        if gallerypg.exists then&lt;br /&gt;
            local contents = gallerypg:getContent()&lt;br /&gt;
            local galleries = contents:gmatch(&lt;br /&gt;
                &amp;quot;&amp;lt;%s*[Gg]allery.-&amp;gt;(.-)&amp;lt;/%s*[Gg]allery%s*&amp;gt;&amp;quot;)&lt;br /&gt;
            &lt;br /&gt;
            local images = {} -- will contain all images from all galleries&lt;br /&gt;
            local selected = mw.clone(gallery_src)&lt;br /&gt;
            &lt;br /&gt;
            -- Import all images&lt;br /&gt;
            for gallery in galleries do&lt;br /&gt;
                for img in mw.text.gsplit(gallery, &amp;#039;\n&amp;#039;) do&lt;br /&gt;
                    if img:gsub(&amp;#039;%s&amp;#039;,&amp;#039;&amp;#039;) ~= &amp;#039;&amp;#039; then&lt;br /&gt;
                        table.insert(images, img)&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        &lt;br /&gt;
            -- Set randomseed&lt;br /&gt;
            math.randomseed(os.time())&lt;br /&gt;
            &lt;br /&gt;
            -- Select images randomly&lt;br /&gt;
            for n = 1, math.min(#images, numOfImgs) do&lt;br /&gt;
                local i = math.random(#images)&lt;br /&gt;
                local img = inclCaption&lt;br /&gt;
                    and images[i]&lt;br /&gt;
                    or mw.text.split(images[i], &amp;#039;|&amp;#039;)[1] -- omit caption&lt;br /&gt;
                &lt;br /&gt;
                selected:wikitext(img .. &amp;#039;\n&amp;#039;)&lt;br /&gt;
                &lt;br /&gt;
                table.remove(images, i)&lt;br /&gt;
            end&lt;br /&gt;
            &lt;br /&gt;
            -- Include portal image&lt;br /&gt;
            if portalImg then&lt;br /&gt;
                selected:wikitext(portalImg .. &amp;quot;|link=&amp;quot; .. gallerypg.text ..&amp;#039;\n&amp;#039;)&lt;br /&gt;
            end&lt;br /&gt;
            &lt;br /&gt;
            -- Apply custom settings to gallery&lt;br /&gt;
            if settings then&lt;br /&gt;
                local settPair =&lt;br /&gt;
                    settings:gmatch([=[(%w+):%s*[&amp;quot;&amp;#039;](.-)[&amp;quot;&amp;#039;][,;]?]=])&lt;br /&gt;
                    &lt;br /&gt;
                for opt,val in settPair do&lt;br /&gt;
                    selected:attr(opt, val)&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
            &lt;br /&gt;
            return frame:preprocess(tostring(selected))&lt;br /&gt;
        else&lt;br /&gt;
            return frame:preprocess(defaultTxt or&lt;br /&gt;
                (&amp;quot;No gallery for {{PAGENAME}} exists yet! You can create it [&amp;quot;&lt;br /&gt;
                .. gallerypg:fullUrl(&amp;quot;action=edit&amp;quot;) .. &amp;quot; here].&amp;quot;))&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Mediawiki&gt;The JoTS</name></author>
	</entry>
</feed>