Jump to content

Template:Project other/doc: Difference between revisions

From BattleIntelligence
imported>Deadfire
Template Doc Creation
 
m Text replacement - "BattleTechWiki" to "BattleIntelligence"
 
Line 5: Line 5:
This is the {{tl|Project other}} meta-template.
This is the {{tl|Project other}} meta-template.


This template helps other templates detect if they are on a "BattleTechWiki:" page or some "other" type of page.
This template helps other templates detect if they are on a "BattleIntelligence:" page or some "other" type of page.


=== Usage ===
=== Usage ===
Line 12: Line 12:


<syntaxhighlight lang="wikitext">
<syntaxhighlight lang="wikitext">
{{Project other | BattleTechWiki page text | Other pages text }}
{{Project other | BattleIntelligence page text | Other pages text }}
</syntaxhighlight>
</syntaxhighlight>


If the template is on a "BattleTechWiki:" page, it will return this:
If the template is on a "BattleIntelligence:" page, it will return this:


:{{Project other | demospace=BattleTechWiki | BattleTechWiki page text | Other pages text }}
:{{Project other | demospace=BattleIntelligence | BattleIntelligence page text | Other pages text }}


If the template is on any other page, it will return this:
If the template is on any other page, it will return this:


:{{Project other | BattleTechWiki page text | Other pages text }}
:{{Project other | BattleIntelligence page text | Other pages text }}


A typical usage case could be to make it so that a template only adds a category when on "BattleTechWiki:" pages. Thus not adding other pages that just show the template. Like this:
A typical usage case could be to make it so that a template only adds a category when on "BattleIntelligence:" pages. Thus not adding other pages that just show the template. Like this:


<syntaxhighlight lang="wikitext">
<syntaxhighlight lang="wikitext">
{{Project other | [[Category:Some BattleTechWiki project category]] }}
{{Project other | [[Category:Some BattleIntelligence project category]] }}
</syntaxhighlight>
</syntaxhighlight>


Line 32: Line 32:


<syntaxhighlight lang="wikitext">
<syntaxhighlight lang="wikitext">
{{Project other | | This template should only be used on "BattleTechWiki:" pages. }}
{{Project other | | This template should only be used on "BattleIntelligence:" pages. }}
</syntaxhighlight>
</syntaxhighlight>


Note that in the first case above the "other" parameter was not used, and in the second example the "BattleTechWiki" parameter was left empty.
Note that in the first case above the "other" parameter was not used, and in the second example the "BattleIntelligence" parameter was left empty.


=== Demospace ===
=== Demospace ===
Line 41: Line 41:
For testing and demonstration purposes this template can take a parameter named '''demospace'''.  
For testing and demonstration purposes this template can take a parameter named '''demospace'''.  


* If it has the value '''BattleTechWiki''' it returns the BattleTechWiki page text.
* If it has the value '''BattleIntelligence''' it returns the BattleIntelligence page text.
* It if has the value '''other''' or any other value such as the name of some other namespace it returns the other pages text.
* It if has the value '''other''' or any other value such as the name of some other namespace it returns the other pages text.
* If the parameter is empty or undefined, the actual page type determines the result.
* If the parameter is empty or undefined, the actual page type determines the result.
Line 49: Line 49:
<syntaxhighlight lang="wikitext">
<syntaxhighlight lang="wikitext">
{{Project other  
{{Project other  
| BattleTechWiki page text  
| BattleIntelligence page text  
| Other pages text  
| Other pages text  
| demospace = BattleTechWiki
| demospace = BattleIntelligence
}}
}}
</syntaxhighlight>
</syntaxhighlight>
Line 58: Line 58:


:{{Project other  
:{{Project other  
| BattleTechWiki page text  
| BattleIntelligence page text  
| Other pages text  
| Other pages text  
| demospace = BattleTechWiki
| demospace = BattleIntelligence
}}
}}


Line 67: Line 67:
<syntaxhighlight lang="wikitext">
<syntaxhighlight lang="wikitext">
{{Project other  
{{Project other  
| BattleTechWiki page text  
| BattleIntelligence page text  
| Other pages text  
| Other pages text  
| demospace = {{{demospace|}}}
| demospace = {{{demospace|}}}
Line 75: Line 75:
=== Technical details ===
=== Technical details ===


This template detects "BattleTechWiki talk:" pages as type '''other'''.
This template detects "BattleIntelligence talk:" pages as type '''other'''.


This template works like {{tl|main talk other}}, for more examples and technical details see full documentation there.  
This template works like {{tl|main talk other}}, for more examples and technical details see full documentation there.  
Line 85: Line 85:
<!-- CATEGORIES BELOW THIS LINE, PLEASE: -->
<!-- CATEGORIES BELOW THIS LINE, PLEASE: -->
[[Category:Namespace manipulation templates]]
[[Category:Namespace manipulation templates]]
[[Category:BattleTechWiki namespace templates]]
[[Category:BattleIntelligence namespace templates]]


}}</includeonly>
}}</includeonly>

Latest revision as of 01:06, 1 May 2025

This is the {{Project other}} meta-template.

This template helps other templates detect if they are on a "BattleIntelligence:" page or some "other" type of page.

Usage

This template usually takes two parameters, like this:

{{Project other | BattleIntelligence page text | Other pages text }}

If the template is on a "BattleIntelligence:" page, it will return this:

Other pages text

If the template is on any other page, it will return this:

Other pages text

A typical usage case could be to make it so that a template only adds a category when on "BattleIntelligence:" pages. Thus not adding other pages that just show the template. Like this:

{{Project other | [[Category:Some BattleIntelligence project category]] }}

Or to warn that a template should not be used on other pages:

{{Project other | | This template should only be used on "BattleIntelligence:" pages. }}

Note that in the first case above the "other" parameter was not used, and in the second example the "BattleIntelligence" parameter was left empty.

Demospace

For testing and demonstration purposes this template can take a parameter named demospace.

  • If it has the value BattleIntelligence it returns the BattleIntelligence page text.
  • It if has the value other or any other value such as the name of some other namespace it returns the other pages text.
  • If the parameter is empty or undefined, the actual page type determines the result.

Like this:

{{Project other 
| BattleIntelligence page text 
| Other pages text 
| demospace = BattleIntelligence
}}

No matter on what kind of page the code above is used it will return this:

Other pages text

You can make it so your template also understands the demospace parameter. That means you can demonstrate the different appearances of your template in the documentation for your template. Then do like this:

{{Project other 
| BattleIntelligence page text 
| Other pages text 
| demospace = {{{demospace|}}}
}}

Technical details

This template detects "BattleIntelligence talk:" pages as type other.

This template works like {{main talk other}}, for more examples and technical details see full documentation there.