<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://gmodfactions.wiki//index.php?action=history&amp;feed=atom&amp;title=Template_talk%3AIf_preview</id>
	<title>Template talk:If preview - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://gmodfactions.wiki//index.php?action=history&amp;feed=atom&amp;title=Template_talk%3AIf_preview"/>
	<link rel="alternate" type="text/html" href="https://gmodfactions.wiki//index.php?title=Template_talk:If_preview&amp;action=history"/>
	<updated>2026-06-04T05:42:25Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://gmodfactions.wiki//index.php?title=Template_talk:If_preview&amp;diff=3182&amp;oldid=prev</id>
		<title>Tech: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://gmodfactions.wiki//index.php?title=Template_talk:If_preview&amp;diff=3182&amp;oldid=prev"/>
		<updated>2025-10-09T02:59:47Z</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:59, 9 October 2025&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 gmod_wiki:diff:1.41:old-3181:rev-3182 --&gt;
&lt;/table&gt;</summary>
		<author><name>Tech</name></author>
	</entry>
	<entry>
		<id>https://gmodfactions.wiki//index.php?title=Template_talk:If_preview&amp;diff=3181&amp;oldid=prev</id>
		<title>Wikipedia&gt;Waddie96: /* Bug if transcluded? */ new section</title>
		<link rel="alternate" type="text/html" href="https://gmodfactions.wiki//index.php?title=Template_talk:If_preview&amp;diff=3181&amp;oldid=prev"/>
		<updated>2025-09-29T10:07:31Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Bug if transcluded?: &lt;/span&gt; new section&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Permanently protected}}&lt;br /&gt;
&lt;br /&gt;
== Merge with Ifpreview ==&lt;br /&gt;
{{ping|Evad37}} Should [[Template:Ifpreview]] be merged into this? They do the exact same thing, although {{tl|Ifpreview}} allows named arguments. That said, it&amp;#039;s essentially unused, so maybe backwards compatibility doesn&amp;#039;t matter. [[User:Daask|Daask]] ([[User talk:Daask|talk]]) 07:28, 28 March 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Preview warning and hatnotes moving to templatestyles ==&lt;br /&gt;
&lt;br /&gt;
Page watchers may be interested in {{slink|MediaWiki talk:Common.css|Preview warning and hatnotes moving to TemplateStyles}} [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 23:57, 28 April 2021 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Fix documentation please ==&lt;br /&gt;
{{resolved}}&lt;br /&gt;
*/doc now says: &amp;quot;use the &amp;lt;code&amp;gt;main()&amp;lt;/code&amp;gt;&amp;quot;. Which is incorrect (should be: &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt;).&lt;br /&gt;
: And: &amp;quot;use the &amp;lt;code&amp;gt;_warning()&amp;lt;/code&amp;gt;&amp;quot;. Which is incorrect (should be: &amp;lt;code&amp;gt;_warning&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;s&amp;gt;Also, there is no overview of parameters to be used. (how do I enter the _warning_text?)&amp;lt;/s&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:-[[User:DePiep|DePiep]] ([[User talk:DePiep|talk]]) 18:57, 20 June 2021 (UTC)&lt;br /&gt;
::resolved: this pertains to the Module documentation, not this template. -[[User:DePiep|DePiep]] ([[User talk:DePiep|talk]]) 07:53, 22 June 2021 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Use in module ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Re: [[Module:If preview]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I tried to use _warning() in [[Module:Authority control/sandbox]] but the warning is displayed in-situ and not at the top of the page where it should be. Am I doing something wrong? &amp;amp;mdash;&amp;amp;nbsp;Martin &amp;lt;small&amp;gt;([[User:MSGJ|MSGJ]]&amp;amp;nbsp;·&amp;amp;nbsp;[[User talk:MSGJ|talk]])&amp;lt;/small&amp;gt; 16:34, 30 December 2022 (UTC)&lt;br /&gt;
&lt;br /&gt;
:@[[User:Izno|Izno]] can you advise on this please - did it used to work or am just misremembering something? &amp;amp;mdash;&amp;amp;nbsp;Martin &amp;lt;small&amp;gt;([[User:MSGJ|MSGJ]]&amp;amp;nbsp;·&amp;amp;nbsp;[[User talk:MSGJ|talk]])&amp;lt;/small&amp;gt; 10:59, 19 July 2023 (UTC)&lt;br /&gt;
::_warning has always been placed at the location where the warning would normally be emitted. If you want it to appear at the top of the article only, [[mw:Extension:Scribunto/Lua_reference_manual#mw.addWarning|mw.addWarning]] is the only function that does that. You may otherwise be confused here because outputs of _warning are most common due to infoboxes, which are always at the top of the page. [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 16:14, 19 July 2023 (UTC)&lt;br /&gt;
:::Quite possible that I am misremembering! Did you consider using mw.addWarning rather than the REVISIONID hack?  &amp;amp;mdash;&amp;amp;nbsp;Martin &amp;lt;small&amp;gt;([[User:MSGJ|MSGJ]]&amp;amp;nbsp;·&amp;amp;nbsp;[[User talk:MSGJ|talk]])&amp;lt;/small&amp;gt; 16:57, 19 July 2023 (UTC)&lt;br /&gt;
::::REVISIONID is the supported way to check for preview and is how both this system&amp;#039;s warning and ifpreview worked before I touched it.&lt;br /&gt;
::::Besides that, because mw.addWarning appears in a different place than in situ, and I know that people have been sensitive on the point before, that would be a consensus-needed to change.&lt;br /&gt;
::::Identical messages are also de-duplicated somewhere in addWarning&amp;#039;s call stack. I don&amp;#039;t know how relevant that is generally. See [[Help_talk:Citation_Style_1/Archive_77#summary_messaging_in_the_preview_warning_header|some previous discussion for CS1]]. [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 17:16, 19 July 2023 (UTC)&lt;br /&gt;
:::::Useful, thanks. It seems that addWarning does not work with the live preview, which is a serious limitation &amp;amp;mdash;&amp;amp;nbsp;Martin &amp;lt;small&amp;gt;([[User:MSGJ|MSGJ]]&amp;amp;nbsp;·&amp;amp;nbsp;[[User talk:MSGJ|talk]])&amp;lt;/small&amp;gt; 17:43, 19 July 2023 (UTC)&lt;br /&gt;
::::::Yes, I suppose that&amp;#039;s true. It might be worth a task to see if it&amp;#039;s even feasible to act on that. [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 18:42, 19 July 2023 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Template-protected edit request on 28 March 2024 ==&lt;br /&gt;
&lt;br /&gt;
{{edit template-protected|Module:If preview|answered=yes}}&lt;br /&gt;
In the function &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;p._warning&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; please add before the return call:&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;mw.addWarning(warning)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. This will put the preview warning at the top of the preview in addition to inline in the wikitext. [[User:Awesome Aasim|Awesome]] [[User_talk:Awesome Aasim|Aasim]] 23:29, 28 March 2024 (UTC)&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;s&amp;gt;&amp;lt;nowiki&amp;gt;{{Done}}&amp;lt;/nowiki&amp;gt;&amp;lt;/s&amp;gt;. [[User:SilverLocust|&amp;lt;small style=&amp;quot;color:#667;background:#fff;border:2px solid;border-radius:.4em;padding:0 .3em&amp;quot;&amp;gt;SilverLocust&amp;lt;/small&amp;gt;]] [[User talk:SilverLocust|💬]] 19:54, 31 March 2024 (UTC)&lt;br /&gt;
&lt;br /&gt;
::{{Reply|Awesome Aasim}} The [[Special:Diff/1216624147|edit has been reverted]] because it resulted in [[Module:Parameter validation/default config]] emitting erroneous preview warnings. Templates like [[Template:Marriage]] and any others with &amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; inline&amp;gt;{{#invoke:Parameter validation|validateparams|module_options = Module:Parameter validation/default config}}&amp;lt;/syntaxhighlight&amp;gt; would always give the incorrect preview warnings:&lt;br /&gt;
::{{tqb|Script warning: [[templatename]] used with unknown parameter(s): paramname. &amp;lt;br&amp;gt;Script warning: [[templatename]] used with deprecated parameter(s): paramname. &amp;lt;br&amp;gt;Script warning: [[templatename]] used with duplicate parameter(s): paramandvalue.}}&lt;br /&gt;
::(You can see the erroneous preview warnings with the example in the below quote box. Preview an edit of this section to see the warnings.) &lt;br /&gt;
{{quotebox|{{marriage/sandbox|Example|2020}}}}&lt;br /&gt;
::Apparently the [[Module:Parameter_validation/default_config#L-11|options in the (default) config]] are evaluated when the &amp;lt;code&amp;gt;options&amp;lt;/code&amp;gt; table is intially loaded in as a variable (i.e., before those options are actually needed, and even if they will not be needed), since those function calls aren&amp;#039;t stored unevaluated in the table (e.g., as a string or sub-table). And evaluating those first three options involves calling &amp;lt;code&amp;gt;_warning&amp;lt;/code&amp;gt; and thus (until the edit was reverted) calling &amp;lt;code&amp;gt;mw.addWarning&amp;lt;/code&amp;gt;. &lt;br /&gt;
::That being said, I am not presently sure how this should be fixed. [[User:SilverLocust|&amp;lt;small style=&amp;quot;color:#667;background:#fff;border:2px solid;border-radius:.4em;padding:0 .3em&amp;quot;&amp;gt;SilverLocust&amp;lt;/small&amp;gt;]] [[User talk:SilverLocust|💬]] 06:00, 1 April 2024 (UTC) (and subsequently edited)&lt;br /&gt;
:::Additionally, in looking now at the section above this, there is a [[#c-MSGJ-20230719165700-Izno-20230719161400|comment]] that &amp;lt;code&amp;gt;mw.addWarning&amp;lt;/code&amp;gt; should not be added here without consensus due to some previous sensitivity. (Part of why I thought this wouldn&amp;#039;t be controversial was because [[Template:Preview warning/doc]] already said — erroneously — that the warning always appears at the top, and because it seemed self-evident that a &amp;quot;preview warning&amp;quot; should use MediaWiki&amp;#039;s built-in preview warning function, &amp;lt;code&amp;gt;mw.addWarning&amp;lt;/code&amp;gt;.) [[User:SilverLocust|&amp;lt;small style=&amp;quot;color:#667;background:#fff;border:2px solid;border-radius:.4em;padding:0 .3em&amp;quot;&amp;gt;SilverLocust&amp;lt;/small&amp;gt;]] [[User talk:SilverLocust|💬]] 08:32, 1 April 2024 (UTC) (and subsequently edited)&lt;br /&gt;
::::That sounds like bad code to me. The only other thing I can think of is maybe a module that when preprocessed emits the preview warning. A warning should not be emitted if there is a code problem, so calling the function beforehand creates a ton of headaches. If the config needs to fetch the default text for preview warnings it should be calling a getter to get the message not a function that builds the warning. [[User:Awesome Aasim|Awesome]] [[User_talk:Awesome Aasim|Aasim]] 08:41, 1 April 2024 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Template-protected edit request on 29 August 2024 ==&lt;br /&gt;
&lt;br /&gt;
{{edit template-protected|Module:If preview|answered=yes}}&lt;br /&gt;
Please implement my changes in the [[Module:If preview/sandbox|sandbox]].&lt;br /&gt;
&lt;br /&gt;
I addressed some of the concerns above, and added a new function &amp;lt;code&amp;gt;warn&amp;lt;/code&amp;gt; that calls both mw.addWarning and adds the warning to the preview, as well as &amp;lt;code&amp;gt;consoleWarning&amp;lt;/code&amp;gt;. I also added [[Module:Arguments]] for better argument processing, and added a parameter &amp;quot;consolewarning&amp;quot; that would emit a warning in the &amp;quot;script warning&amp;quot; section of the edit window where it is desired. This should ensure backwards compatibility. [[User:Awesome Aasim|Awesome]] [[User_talk:Awesome Aasim|Aasim]] 18:17, 29 August 2024 (UTC)&lt;br /&gt;
&lt;br /&gt;
:Yes please! If using mw.addWarning() is for some reason controversial, the obvious solution is to do that via a separate function (or, I guess, an argument to an existing one). Flipping the default (making mw.addPreview() opt-out would make more sense, but seems more effort than it&amp;#039;s worth. on enWP; on enWS where I import it I&amp;#039;d swap it in a heartbeat if I could without creating merge issues for myself). [[User:Xover|Xover]] ([[User talk:Xover|talk]]) 10:49, 1 September 2024 (UTC)&lt;br /&gt;
:{{done}}&amp;lt;!-- Template:ETp --&amp;gt; &amp;amp;mdash;&amp;amp;nbsp;Martin &amp;lt;small&amp;gt;([[User:MSGJ|MSGJ]]&amp;amp;nbsp;·&amp;amp;nbsp;[[User talk:MSGJ|talk]])&amp;lt;/small&amp;gt; 19:58, 9 September 2024 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Edit request 15 July 2025 ==&lt;br /&gt;
&lt;br /&gt;
{{Edit template-protected|Module:If preview/styles.css|answered=yes}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Description of suggested change:&amp;#039;&amp;#039;&amp;#039; Add support for dark mode.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Diff:&amp;#039;&amp;#039;&amp;#039; (in [[Module:If preview/styles.css#L-7]]&lt;br /&gt;
{{TextDiff|1=	color: red;|2=	color: var(--color-error, red);}} [[User:Dabao qian|Dabao qian]] ([[User talk:Dabao qian|talk]]) 06:31, 15 July 2025 (UTC)&lt;br /&gt;
: {{Done}} [[User:Pppery|* Pppery *]] [[User talk:Pppery|&amp;lt;sub style=&amp;quot;color:#800000&amp;quot;&amp;gt;it has begun...&amp;lt;/sub&amp;gt;]] 22:29, 16 July 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Bug if transcluded? ==&lt;br /&gt;
&lt;br /&gt;
Anyone else experience a bug where this module thinks a page is being previewed when the page is actually being transcluded. &amp;lt;span class=&amp;quot;fn nickname&amp;quot; style=&amp;quot;color:#CD0000&amp;quot;&amp;gt;[[User:Waddie96|waddie96]] ★ ([[User talk:Waddie96|talk]])&amp;lt;/span&amp;gt; 10:07, 29 September 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Wikipedia&gt;Waddie96</name></author>
	</entry>
</feed>