<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://wiki.undertensai.cn/index.php?action=history&amp;feed=atom&amp;title=%E6%A8%A1%E6%9D%BF%3AIf_then_show%2Fdoc</id>
	<title>模板:If then show/doc - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.undertensai.cn/index.php?action=history&amp;feed=atom&amp;title=%E6%A8%A1%E6%9D%BF%3AIf_then_show%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://wiki.undertensai.cn/index.php?title=%E6%A8%A1%E6%9D%BF:If_then_show/doc&amp;action=history"/>
	<updated>2026-11-17T04:44:13Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://wiki.undertensai.cn/index.php?title=%E6%A8%A1%E6%9D%BF:If_then_show/doc&amp;diff=26918&amp;oldid=prev</id>
		<title>wiki&gt;Tactica：​rm {{Shared Template Warning}}.</title>
		<link rel="alternate" type="text/html" href="https://wiki.undertensai.cn/index.php?title=%E6%A8%A1%E6%9D%BF:If_then_show/doc&amp;diff=26918&amp;oldid=prev"/>
		<updated>2025-10-13T18:17:25Z</updated>

		<summary type="html">&lt;p&gt;rm {{Shared Template Warning}}.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}&lt;br /&gt;
&amp;lt;!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --&amp;gt;&lt;br /&gt;
This template tests whether the first unnamed parameter is not an empty string and returns it if it is not empty. Otherwise it returns the second unnamed parameter.&lt;br /&gt;
&lt;br /&gt;
This is useful when the first parameter is a &amp;lt;nowiki&amp;gt;{{#invoke: }}&amp;lt;/nowiki&amp;gt; of a Lua module that may return a value or nothing. Because it uses the &amp;lt;nowiki&amp;gt;{{#invoke: }}&amp;lt;/nowiki&amp;gt; just once, it simplifies the coding of infoboxes, for example.&lt;br /&gt;
&lt;br /&gt;
The optional third and fourth unnamed parameters provide a prefix and a suffix for the first parameter when returned. This enables the designer to construct more complex templates that still only use one invoke of a Lua module.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
; {{q|P26}} for {{q|Q151973}}&lt;br /&gt;
: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}|unmarried}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}|unmarried}}&lt;br /&gt;
&lt;br /&gt;
; {{q|P26}} for {{q|Q905}}&lt;br /&gt;
: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}|unmarried}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}|unmarried}}&lt;br /&gt;
&lt;br /&gt;
=== Prefix and suffix ===&lt;br /&gt;
==== Infobox field with microformat ====&lt;br /&gt;
A value in an infobox can be designed to be wrapped in a microformat if the wikidata call is not empty:&lt;br /&gt;
: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{if then show | {{#invoke:WikidataIB | getValue | rank=best |P19 |name=birth_place |qid={{{qid|}}} |suppressfields={{{suppressfields|}}} |fetchwikidata={{{fetchwikidata|}}} |noicon={{{noicon|}}} | {{{birth_place|}}} }} || &amp;lt;span class=&amp;quot;birthplace&amp;quot;&amp;gt; | &amp;lt;/span&amp;gt;}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
: If there is a local parameter supplied in the article (e.g. {{para|birth_place|London}}), the code will return &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;span class=&amp;quot;birthplace&amp;quot;&amp;gt;London&amp;lt;/span&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
: If there is no local parameter it will attempt to fetch a value for {{q|P19}} from Wikidata.&lt;br /&gt;
: If that has a value, such as &amp;quot;New York&amp;quot;, the code will return &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;span class=&amp;quot;birthplace&amp;quot;&amp;gt;New York&amp;lt;/span&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
: If there is no value returned from Wikidata, the code returns nothing.&lt;br /&gt;
&lt;br /&gt;
==== Table ====&lt;br /&gt;
A table can be designed to display a row only when a particular property of the article exists on Wikidata.&lt;br /&gt;
&lt;br /&gt;
; {{q|P26}} for {{q|Q151973}}&lt;br /&gt;
: &amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width:15em;&amp;quot; | Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width:36em;&amp;quot; | Value&lt;br /&gt;
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}||&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;{{#invoke:WikidataIB|getLabel|P26|qid=Q151973}}&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt;|&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
: →&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width:15em;&amp;quot; | Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width:36em;&amp;quot; | Value&lt;br /&gt;
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}||&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;{{#invoke:WikidataIB|getLabel|P26|qid=Q151973}}&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt;|&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
; {{q|P26}} for {{q|Q905}}&lt;br /&gt;
: &amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot;&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width:15em;&amp;quot; | Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width:36em;&amp;quot; | Value&lt;br /&gt;
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}||&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;{{#invoke:WikidataIB|getLabel|P26|qid=Q905}}&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt;|&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
: →&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width:15em;&amp;quot; | Label&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width:36em;&amp;quot; | Value&lt;br /&gt;
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}||&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;{{#invoke:WikidataIB|getLabel|P26|qid=Q905}}&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt;|&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;}}&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>wiki&gt;Tactica</name></author>
	</entry>
</feed>