模板:Ifsubst/doc

来自决策链云智库
< 模板:Ifsubst
Zeroclanzhang讨论 | 贡献2024年1月21日 (日) 20:10的版本 (创建页面,内容为“{{Documentation subpage}} <!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE, and INTERWIKIS IN WIKIDATA --> {{high-risk}} == Usage == Meta template that returns the first parameter if evaluated during substitution, and the second parameter if evaluated during transclusion.<br />Note that this template must be used in safesubst mode to work properly: : <code><nowiki>{{ safesubst:<noinclude/>ifsubst| yes | n…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

Usage

Meta template that returns the first parameter if evaluated during substitution, and the second parameter if evaluated during transclusion.
Note that this template must be used in safesubst mode to work properly:

{{ safesubst:<noinclude/>ifsubst| yes | no }}

The |demo= parameter can be used for testing the template. Set |demo=yes to always display the yes text, |demo=no to always display the no text, or |demo={{{demo|}}} to pass through the value from the parent template.

List of subst helper templates

  • {{require substitution}} – Prints an error unless substituted.
  • {{substituted or transcluded}} – if-then-else metatemplate that checks if a template is currently being substituted or transcluded
    • {{always substitute}} – For the doc of the above templates; prints a message asking for it be substituted.
    • {{never substitute}} – The reverse of {{always substitute}}. For the doc of templates which should not be substituted; prints a message asking for it not to be substituted.
    • {{may be substituted}} – For the doc of templates whose substitution is optional.
    • {{substitution}} – Allows free-fill description of whether the template should be substituted and under what conditions.
  • {{ifsubst}} – Forks if substituted or not.
  • {{issubst}} – Returns "yes" if substituted.
  • {{HTML comment}} – To sign substitutions with comments that contain wikitext expansions
  • Module:Unsubst – Prevents substitution.
  • Module:Unsubst-infobox – Prevents substitution for infoboxes, cleans up parameters.