<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.bharatpedia.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AIf_preview</id>
	<title>Module:If preview - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://en.bharatpedia.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AIf_preview"/>
	<link rel="alternate" type="text/html" href="https://en.bharatpedia.org/w/index.php?title=Module:If_preview&amp;action=history"/>
	<updated>2026-07-28T20:32:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://en.bharatpedia.org/w/index.php?title=Module:If_preview&amp;diff=7254&amp;oldid=prev</id>
		<title>KokoLove: Created page with &quot;local p = {}  --[[ main  This function returns the either the first argument or second argument passed to this module, depending on whether it is being previewed.  Usage: {{#i...&quot;</title>
		<link rel="alternate" type="text/html" href="https://en.bharatpedia.org/w/index.php?title=Module:If_preview&amp;diff=7254&amp;oldid=prev"/>
		<updated>2021-02-13T19:17:03Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local p = {}  --[[ main  This function returns the either the first argument or second argument passed to this module, depending on whether it is being previewed.  Usage: {{#i...&amp;quot;&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;
--[[&lt;br /&gt;
main&lt;br /&gt;
&lt;br /&gt;
This function returns the either the first argument or second argument passed to this module, depending on whether it is being previewed.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:If preview|main|value_if_preview|value_if_not_preview}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local result = &amp;#039;&amp;#039;&lt;br /&gt;
	Preview_mode = frame:preprocess(&amp;#039;{{REVISIONID}}&amp;#039;);							-- use magic word to get revision id&lt;br /&gt;
	if not (Preview_mode == nil or Preview_mode == &amp;#039;&amp;#039;) then										-- if there is a value then this is not a preiview&lt;br /&gt;
		result = frame.args[2] or &amp;#039;&amp;#039;;&lt;br /&gt;
	else&lt;br /&gt;
		result = frame.args[1] or &amp;#039;&amp;#039;;									-- no value (nil or empty string) so this is a preview&lt;br /&gt;
	end&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
pmain&lt;br /&gt;
&lt;br /&gt;
This function returns the either the first argument or second argument passed to this module&amp;#039;s parent (i.e. template using this module), depending on whether it is being previewed.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:If preview|pmain}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
function p.pmain(frame)&lt;br /&gt;
	return p.main(frame:getParent())&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
boolean&lt;br /&gt;
&lt;br /&gt;
This function returns the either true or false, depending on whether it is being previewed.&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
{{#invoke:If preview|boolean}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
function p.boolean(frame)&lt;br /&gt;
	local result = &amp;#039;&amp;#039;&lt;br /&gt;
	Preview_mode = frame:preprocess(&amp;#039;{{REVISIONID}}&amp;#039;);							-- use magic word to get revision id&lt;br /&gt;
	if not (Preview_mode == nil or Preview_mode == &amp;#039;&amp;#039;) then										-- if there is a value then this is not a preiview&lt;br /&gt;
		result = false;&lt;br /&gt;
	else&lt;br /&gt;
		result = true;									-- no value (nil or empty string) so this is a preview&lt;br /&gt;
	end&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>KokoLove</name></author>
	</entry>
</feed>