Jump to content

Template:Substcheck/doc: Difference between revisions

From BattleIntelligence
imported>Deadfire
Creation (as this is needed)
 
m Text replacement - "BattleTechWiki" to "BattleIntelligence"
 
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
This template can be used in conditional processing in other templates to detect [[BattleTechWiki:Substitution|substitutions]].
This template can be used in conditional processing in other templates to detect [[BattleIntelligence:Substitution|substitutions]].


If you use [[Module:Unsubst]], you need not use this template.
If you use [[Module:Unsubst]], you need not use this template.

Latest revision as of 00:13, 1 May 2025

This template can be used in conditional processing in other templates to detect substitutions.

If you use Module:Unsubst, you need not use this template.

Usage

If you put <includeonly>{{subst:</includeonly><includeonly>substcheck}}</includeonly> into a template, it will expand into one of the following, depending how the template is being viewed.

  • SUBST if the template is being substituted
  • {{subst:substcheck}} if the template is being transcluded
  • Empty string if you are viewing the template page.

Using this template differently may yield different results; the above is the most universal way.

Lua replacement

if mw.isSubsting() then
	-- substituting: "SUBST"
elseif mw.getCurrentFrame():getParent():getTitle() == mw.title.getCurrentTitle().fullText then
	-- viewed directly: ""
else
	-- transclusion: "{{subst:substcheck}}"
end

See also