ホーム
おまかせ表示
ログイン
設定
脳科学辞典について
免責事項
脳科学辞典
検索
テンプレート:Ifnotemptyのソースを表示
←
テンプレート:Ifnotempty
あなたには「このページの編集」を行う権限がありません。理由は以下の通りです:
この操作は、次のグループに属する利用者のみが実行できます:
登録利用者
。
このページのソースの閲覧やコピーができます。
<includeonly>{{{{{|safesubst:}}}{{{{{|safesubst:}}}#if:{{{1}}}|p1|p2}}|{{{2}}}|{{{3|}}}}}</includeonly><noinclude><div class="template-documentation" style="margin-top:1em;">{{#if:defaultnotblank|<div style="padding-bottom:3px; border-bottom:1px solid #aaa; margin-bottom:1ex;"> <span style="font-size:150%">Documentation</span></div>}} {{Documentation subpage}} With this template [[mw:Help:Extension:ParserFunctions|#if]] can be used in a way such that it does not [[Help:Newlines_and_spaces#Stripping_on_expansion|strip spaces and newlines]] from the "then" and "else" part. For evaluating the condition spaces and newlines are stripped like with ParserFunctions. ==Usage== *<code><nowiki>{{ifnotempty|x| p | q }}</nowiki></code> gives "{{ifnotempty|x| p | q }}" *<code><nowiki>{{ifnotempty|| p | q }}</nowiki></code> gives "{{ifnotempty|| p | q }}" Compare: *<code><nowiki>{{#if:x| p | q }}</nowiki></code> gives "{{#if:x| p | q }}" Note that, unlike parser functions, templates require writing equals signs in values of unnamed parameters as <code><nowiki>{{=}}</nowiki></code> For full substitution, simply use {{cnw|subst:}} or {{cnw|safesubst:}}. If the condition contains a parser function, template, or variable, that should be substituted too. Optionally the "then" or "else" part can also be substituted. ==Expansion depth limit== 13 levels allowed: <code><nowiki>{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|a}}}}}}}}}}}}}}}}}}}}}}}}}}</nowiki></code> gives {{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|a}}}}}}}}}}}}}}}}}}}}}}}}}} <code><nowiki>{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|a}}}}}}}}}}}}}}}}}}}}}}}}}}}}</nowiki></code> gives {{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|{{ifnotempty|x|a}}}}}}}}}}}}}}}}}}}}}}}}}}}} ==Internal technical details== For evaluating the condition the template uses the actual parser function; however, not directly with p and q, because this strips spaces and newlines from the result, but with index values 1 and 2. The result can be 1, 2. The template with the applicable name is called ([[Template:P1]] or [[Template:P2]]), with as parameters p and q. ==Conditions== ===#if:=== Condition: string not empty. ==See also== *[[Template:If]] {{refs}} <div style="clear:both;" /></div></div>[[Category:Branching templates]]</noinclude>
テンプレート:Ifnotempty
に戻る。