Link/Internal – Template

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Final fix)
m (Fix link text)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<includeonly>{{#if: {{{link|}}}
<includeonly>{{#if: {{{link|}}}
| {{#ifeq: {{#pos:{{Trim|{{{link}}}}}|#}}
| {{#ifeq: {{#pos:{{Trim|{{{link}}}}}|Category:}}<!-- with or without colon -->
|
|
| {{#ifeq: {{NAMESPACENUMBER}} | {{NAMESPACENUMBER:{{{link}}}}}
| {{#ifeq: {{#pos:{{Trim|{{{link}}}}}|#}}
| [[{{{link}}}{{#if:{{{text|}}}|{{!}}{{{text}}}|{{#ifeq: {{NAMESPACENUMBER}} | {{NAMESPACENUMBER:{{{link}}}}} | {{!}}<!-- no space here or the link's text will start with it! -->{{PAGENAME:{{{link}}}}}}}}}]]
|
| [[{{{link}}}{{#if:{{{text|}}}|{{!}}{{{text}}}}}]]
| {{#ifeq: {{NAMESPACENUMBER}} | {{NAMESPACENUMBER:{{{link}}}}}
| [[{{{link}}}{{#if:{{{text|}}}|{{!}}{{{text}}}|{{#ifeq: {{NAMESPACENUMBER}} | {{NAMESPACENUMBER:{{{link}}}}} | {{!}}<!-- no space here or the link's text will start with it! -->{{PAGENAME:{{{link}}}}}}}}}]]
| [[{{{link}}}{{#if:{{{text|}}}|{{!}}{{{text}}}}}]]
}}
| {{Link/Hash|{{{link}}}|{{{text|}}}}}
}}
}}
| {{Link/Hash|{{{link}}}|{{{text|}}}}}
| {{#ifeq: {{#pos:{{{link}}}|Category:}} | 0 | [[:{{{link}}} | {{#if:{{{text|}}}|{{{text}}}|{{PAGENAME:{{{link}}}}} Category}}]] | [[{{{link}}} | {{#if:{{{text|}}}|{{{text}}}|{{PAGENAME:{{{link}}}}} Category}}]]}}
}}
}}
| -no link provided-{{TemplateCase||[[Category:Link template usage error]]}}
| -no link provided-{{TemplateCase||[[Category:Link template usage error]]}}
Line 15: Line 19:
* if ''link''<nowiki/>'s namespace is identical to the current page, only the page name is used as text
* if ''link''<nowiki/>'s namespace is identical to the current page, only the page name is used as text
* otherwise, the full namespace:pagename is used
* otherwise, the full namespace:pagename is used
|param1= link
|param1= link
|descr1= the internal link
|descr1= the internal link
|param2= text
|param2= text
|descr2= (Optional) the text to display
|descr2= (Optional) the text to display
|example1= <nowiki>{{Link/Internal}}</nowiki>
|example1= <nowiki>{{Link/Internal}}</nowiki>
|result1= {{Link/Internal}}
|result1= {{Link/Internal}}
|example2= <nowiki>{{Link/Internal|link= setDir}}</nowiki>
|example2= <nowiki>{{Link/Internal|link= setDir}}</nowiki>
|result2= {{Link/Internal|link= setDir}}
|result2= {{Link/Internal|link= setDir}}
|example3= <nowiki>{{Link/Internal|text= setDir's page}}</nowiki>
|example3= <nowiki>{{Link/Internal|text= setDir's page}}</nowiki>
|result3= {{Link/Internal|text= setDir's page}}
|result3= {{Link/Internal|text= setDir's page}}
|example4= <nowiki>{{Link/Internal|link= setDir|text= setDir's page}}</nowiki>
|example4= <nowiki>{{Link/Internal|link= setDir|text= setDir's page}}</nowiki>
|result4= {{Link/Internal|link= setDir|text= setDir's page}}
|result4= {{Link/Internal|link= setDir|text= setDir's page}}
|example5= <nowiki>{{Link/Internal|link= setDir#Example 1}}</nowiki>
|example5= <nowiki>{{Link/Internal|link= setDir#Example 1}}</nowiki>
|result5= {{Link/Internal|link= setDir#Example 1}}
|result5= {{Link/Internal|link= setDir#Example 1}}
|example6= <nowiki>{{Link/Internal|link= Category:Scripting Commands}}</nowiki>
 
|result6= {{Feature|warning|Sets the page to said category - '''bad!''' The {{hl|:}} prefix is unfortunately required, see below (no workaround found (yet?)).}}
|example6= <nowiki/>
|example7= <nowiki>{{Link/Internal|link= :Category:Scripting Commands}}</nowiki>
<nowiki>* {{Link/Internal|link= :Category:Scripting Commands}}</nowiki><br>
|result7= {{Link/Internal|link= :Category:Scripting Commands}}
<nowiki>* {{Link/Internal|link= Category:Scripting Commands}}</nowiki><br>
|example8= <nowiki>{{Link/Internal|link= :Category:Scripting Commands|text= All Commands}}</nowiki>
<nowiki>* {{Link/Internal|link= :Category:Scripting Commands|text= All Commands}}</nowiki><br>
|result8= {{Link/Internal|link= :Category:Scripting Commands|text= All Commands}}
<nowiki>* {{Link/Internal|link= Category:Scripting Commands|text= All Commands}}</nowiki><br>
|example9= <nowiki>* {{Link/Internal|link= DayZ:Diag Menu}}</nowiki><br><nowiki>* {{Link/Internal|link= Template:Link}}</nowiki><br><nowiki>* {{Link/Internal|link= Template:Link#Usage}}</nowiki>
<nowiki>* {{Link/Internal|link= Category:Arma 3: Scripting Commands}}</nowiki><br>
|result9= <nowiki/>
<nowiki>* {{Link/Internal|link= Category:Arma 3: Scripting Commands |text=}}</nowiki><br>
<nowiki>* {{Link/Internal|link= :Category:Arma 3: Scripting Commands |text=}}</nowiki><br>
<nowiki>* {{Link/Internal|link= Category:Arma 3: Scripting Commands |text= A3's commands}}</nowiki>
|result6= <nowiki/>
* {{Link/Internal|link= :Category:Scripting Commands}}
* {{Link/Internal|link= Category:Scripting Commands}}
* {{Link/Internal|link= :Category:Scripting Commands|text= All Commands}}
* {{Link/Internal|link= Category:Scripting Commands|text= All Commands}}
* {{Link/Internal|link= Category:Arma 3: Scripting Commands}}
* {{Link/Internal|link= Category:Arma 3: Scripting Commands |text= }}
* {{Link/Internal|link= Category:Arma 3: Scripting Commands |text= A3's commands}}
* {{Link/Internal|link= :Category:Arma 3: Scripting Commands |text= A3's commands}}
 
|example7= <nowiki>* {{Link/Internal|link= DayZ:Diag Menu}}</nowiki><br><nowiki>* {{Link/Internal|link= Template:Link}}</nowiki><br><nowiki>* {{Link/Internal|link= Template:Link#Usage}}</nowiki>
|result7= <nowiki/>
* {{Link/Internal|link= DayZ:Diag Menu}}
* {{Link/Internal|link= DayZ:Diag Menu}}
* {{Link/Internal|link= Template:Link}}
* {{Link/Internal|link= Template:Link}}
* {{Link/Internal|link= Template:Link#Usage}}
* {{Link/Internal|link= Template:Link#Usage}}
}}</noinclude>
}}</noinclude>

Latest revision as of 14:44, 16 October 2024

This template creates an internal link (within the BIKI). It uses {{Link/Hash}}.
If text is not provided:

  • if link's namespace is identical to the current page, only the page name is used as text
  • otherwise, the full namespace:pagename is used

This template is used on these pages.

Usage

{{Link/Internal|link|text}}

  • link: the internal link
  • text: (Optional) the text to display
Examples
Code Result
{{Link/Internal}} -no link provided-
{{Link/Internal|link= setDir}} setDir
{{Link/Internal|text= setDir's page}} -no link provided-
{{Link/Internal|link= setDir|text= setDir's page}} setDir's page
{{Link/Internal|link= setDir#Example 1}} setDir - Example 1

* {{Link/Internal|link= :Category:Scripting Commands}}
* {{Link/Internal|link= Category:Scripting Commands}}
* {{Link/Internal|link= :Category:Scripting Commands|text= All Commands}}
* {{Link/Internal|link= Category:Scripting Commands|text= All Commands}}
* {{Link/Internal|link= Category:Arma 3: Scripting Commands}}
* {{Link/Internal|link= Category:Arma 3: Scripting Commands |text=}}
* {{Link/Internal|link= :Category:Arma 3: Scripting Commands |text=}}
* {{Link/Internal|link= Category:Arma 3: Scripting Commands |text= A3's commands}}

* {{Link/Internal|link= DayZ:Diag Menu}}
* {{Link/Internal|link= Template:Link}}
* {{Link/Internal|link= Template:Link#Usage}}