<?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%3APseudo_image</id>
	<title>Module:Pseudo image - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3APseudo_image"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Pseudo_image&amp;action=history"/>
	<updated>2026-04-11T07:54:35Z</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:Pseudo_image&amp;diff=144542&amp;oldid=prev</id>
		<title>imported&gt;Wnt: Got output, default backwards</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Pseudo_image&amp;diff=144542&amp;oldid=prev"/>
		<updated>2013-05-09T05:55:12Z</updated>

		<summary type="html">&lt;p&gt;Got output, default backwards&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--- This module is supposed to take all the normal File:/Image: parameters from the call&lt;br /&gt;
--- to a parent template (though it will might use its own args in preference for debug purposes)&lt;br /&gt;
--- and return them back one by one for use by a template.  Most important, figure which is the caption.&lt;br /&gt;
--- (This is a bit experimental - I haven&amp;#039;t really &amp;#039;&amp;#039;used&amp;#039;&amp;#039; the parent .args much, &lt;br /&gt;
--- and there&amp;#039;s a chance the whole template will just get wrapped up into one Lua script in the end)&lt;br /&gt;
--- usage: {{#invoke Pseudo-image:main|thumb}}, etc.&lt;br /&gt;
&lt;br /&gt;
local p={}&lt;br /&gt;
&lt;br /&gt;
function initialize(frame)&lt;br /&gt;
    local parent=frame:getParent() or {}&lt;br /&gt;
    local args=frame.args or {}&lt;br /&gt;
    local pargs=parent.args or {}&lt;br /&gt;
    return args,pargs&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame,query)&lt;br /&gt;
    local args,pargs=initialize(frame)&lt;br /&gt;
    local query=query or args.query or pargs.query -- this leaves the door open for specifying query as a function&lt;br /&gt;
    local showdebug=args.debug or pargs.debug -- wasn&amp;#039;t shutting off under name &amp;quot;debug&amp;quot;...&lt;br /&gt;
    local thumb,frame,px,float,border,vertical&lt;br /&gt;
    local debuglog=#pargs or &amp;quot;no#pargs&amp;quot;&lt;br /&gt;
    local debuglog=debuglog..&amp;quot;q=&amp;quot;..tostring(query)&lt;br /&gt;
    local floatoptions = {left=true,right=true,center=true,none=true}&lt;br /&gt;
    local verticaloptions = {baseline=true,middle=true,sub=true,super=true,[&amp;#039;text-top&amp;#039;]=true,[&amp;#039;text-bottom&amp;#039;]=true,top=true,bottom=true}&lt;br /&gt;
    local default = {float=&amp;#039;right&amp;#039;,vertical=&amp;#039;middle&amp;#039;}&lt;br /&gt;
    local output={}&lt;br /&gt;
    debuglog=debuglog..tostring(default[&amp;#039;float&amp;#039;])&lt;br /&gt;
    for i, parm in ipairs(pargs) do&lt;br /&gt;
            debuglog=debuglog..i..tostring(pargs[i])&lt;br /&gt;
            local parm=pargs[i] or &amp;quot;&amp;quot;&lt;br /&gt;
            parm=mw.ustring.match(parm,&amp;quot;^%s*(%S.*)$&amp;quot;) or parm -- strip leading space (not sure if there can be any)&lt;br /&gt;
            parm=mw.ustring.match(parm,&amp;quot;^(.*%S)%s*&amp;quot;) or parm -- strip lagging space (&amp;quot; &amp;quot; &amp;quot;)&lt;br /&gt;
            if parm == &amp;quot;thumb&amp;quot; or parm == &amp;quot;thumbnail&amp;quot; then&lt;br /&gt;
                output.thumb = &amp;quot;yes&amp;quot;&lt;br /&gt;
            elseif parm == &amp;quot;frame&amp;quot; then&lt;br /&gt;
                output.frame = true&lt;br /&gt;
            elseif floatoptions[parm] then&lt;br /&gt;
                output.float = parm&lt;br /&gt;
            elseif parm == &amp;quot;border&amp;quot; then&lt;br /&gt;
                output.border = true -- technically this may need fine-tuning - does thumb with border make &amp;quot;border&amp;quot; the caption?&lt;br /&gt;
            elseif verticaloptions[parm] then&lt;br /&gt;
                output.vertical = parm&lt;br /&gt;
            elseif mw.ustring.match(parm,&amp;quot;^(%d+)px$&amp;quot;) then&lt;br /&gt;
                output.px = mw.ustring.match(parm,&amp;quot;(%d+)px&amp;quot;) -- there must be a better way to do this two-liner&lt;br /&gt;
            elseif mw.ustring.match(parm,&amp;quot;^(%d*)x(%d+)px$&amp;quot;) then&lt;br /&gt;
                output.px,output.xpx = mw.ustring.match(parm,&amp;quot;^(%d*)x(%d+)px$&amp;quot;) -- &amp;quot; &amp;quot;&lt;br /&gt;
            else output.caption = output.caption or parm&lt;br /&gt;
                 if output.caption == &amp;quot;&amp;quot; then output.caption = nil end -- for now I choose to auto-rescue if the caption isn&amp;#039;t the first unidentified misc parameter&lt;br /&gt;
            end -- the mess of cases&lt;br /&gt;
    end -- for i,parms in ipairs(pargs)&lt;br /&gt;
    for k,v in pairs(pargs) do&lt;br /&gt;
        output[k]=v&lt;br /&gt;
    end&lt;br /&gt;
    for k,v in pairs(args) do --- note these allow the pseudo-parameters to be overridden in the Lua call&lt;br /&gt;
        output[k]=v&lt;br /&gt;
    end&lt;br /&gt;
    if showdebug then return debuglog..tostring(default[query])..tostring(output[query]) else return output[query] or default[query] end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Wnt</name></author>
	</entry>
</feed>