Link – Template

From Bohemia Interactive Community
Jump to navigation Jump to search
m (ExternalLink → Link/External)
m (HashLink → Link/Hash)
Line 4: Line 4:
| {{#ifeq:{{#pos:{{Trim|{{{link|{{{1|}}}}}}}}|#}}|
| {{#ifeq:{{#pos:{{Trim|{{{link|{{{1|}}}}}}}}|#}}|
| [[{{{link|{{{1|}}}}}}{{#if:{{{text|{{{2|}}}}}}|{{!}}{{{link|{{{2}}}}}}}}]]
| [[{{{link|{{{1|}}}}}}{{#if:{{{text|{{{2|}}}}}}|{{!}}{{{link|{{{2}}}}}}}}]]
| {{HashLink|{{{link|{{{1}}}}}}|{{{text|{{{2|}}}}}}}}
| {{Link/Hash|{{{link|{{{1}}}}}}|{{{text|{{{2|}}}}}}}}
}}
}}
}}
}}
Line 10: Line 10:
}}</includeonly><noinclude>{{Doc/Template
}}</includeonly><noinclude>{{Doc/Template


|descr= This template combines {{Template|Link/External}} and {{Template|HashLink}} under one entrypoint.
|descr= This template combines {{Template|Link/External}} and {{Template|Link/Hash}} under one entrypoint.
It also adds the page to the [[:Category:Link template usage error|Link template usage error]] category on usage error.
It also adds the page to the [[:Category:Link template usage error|Link template usage error]] category on usage error.


Line 23: Line 23:
|example3= <nowiki>{{Link|link= http://ofp.gamepark.cz/index.php?showthis=2302}}</nowiki>
|example3= <nowiki>{{Link|link= http://ofp.gamepark.cz/index.php?showthis=2302}}</nowiki>
|result3= {{Link|link= http://ofp.gamepark.cz/index.php?showthis=2302}}
|result3= {{Link|link= http://ofp.gamepark.cz/index.php?showthis=2302}}
|example4= <nowiki>{{Link|setDir}}</nowiki>
|example4= <nowiki/>
|result4= {{Link|setDir}}
<nowiki>{{Link|setDir}}</nowiki><br>
|example5= <nowiki>{{Link|setDir#notes}}</nowiki>
<nowiki>{{Link|setDir#notes}}</nowiki><br>
|result5= {{Link|setDir#notes}}
<nowiki>{{Link|setDir#notes|setDir and nothing else}}</nowiki>
|example6= <nowiki>{{Link|setDir#notes|setDir and nothing else}}</nowiki>
|result4= {{Link|setDir}}<br>{{Link|setDir#notes}}<br>{{Link|setDir#notes|setDir and nothing else}}
|result6= {{Link|setDir#notes|setDir and nothing else}}
|example5= <nowiki/>
|example7= <nowiki>{{Link|Arma Reforger:Getting Started}}</nowiki>
<nowiki>{{Link|#}}</nowiki><br>
|result7= {{Link|Arma Reforger:Getting Started}}
<nowiki>{{Link|#Usage}}</nowiki><br>
|example8= <nowiki>{{Link|Arma Reforger:Getting Started|Test}}</nowiki>
<nowiki>{{Link|#Usage|The Usage chapter}}</nowiki>
|result8= {{Link|Arma Reforger:Getting Started|Test}}
|result5= {{Link|#}}<br>{{Link|#Usage}}<br>{{Link|#Usage|The Usage chapter}}
|example9= <nowiki>{{Link|Arma Reforger:Getting Started#Play in Single Player}}</nowiki>
|example6= <nowiki/>
|result9= {{Link|Arma Reforger:Getting Started#Play in Single Player}}
<nowiki>{{Link|Arma Reforger:Getting Started}}</nowiki><br>
|example10= <nowiki>{{Link|Arma Reforger:Getting Started#Play in Single Player|Play in Single Player}}</nowiki>
<nowiki>{{Link|Arma Reforger:Getting Started|Test}}</nowiki><br>
|result10= {{Link|Arma Reforger:Getting Started#Play in Single Player|Play in Single Player}}
<nowiki>{{Link|Arma Reforger:Getting Started#Play in Single Player}}</nowiki><br>
<nowiki>{{Link|Arma Reforger:Getting Started#Play in Single Player|Play in Single Player}}</nowiki>
|result6= {{Link|Arma Reforger:Getting Started}}<br>{{Link|Arma Reforger:Getting Started|Test}}<br>{{Link|Arma Reforger:Getting Started#Play in Single Player}}<br>{{Link|Arma Reforger:Getting Started#Play in Single Player|Play in Single Player}}
}}</noinclude>
}}</noinclude>

Revision as of 16:52, 4 January 2023

This template combines {{Link/External}} and {{Link/Hash}} under one entrypoint. It also adds the page to the Link template usage error category on usage error.

This template is used on these pages.

Usage

{{Link|link|text}}

  • link: (possibly named parameter) the URL or the local link, hashed or not (Operation Flashpoint#Introduction)
  • text: (Optional, possibly named parameter) text to be displayed
Examples
Code Result
{{Link}} -no link provided-
{{Link|http://}} http://
{{Link|link= http://ofp.gamepark.cz/index.php?showthis=2302}} ofpr.info link link courtesy of
OFP-Faguss.com

{{Link|setDir}}
{{Link|setDir#notes}}
{{Link|setDir#notes|setDir and nothing else}}

setDir
setDir - notes
setDir and nothing else

{{Link|#}}
{{Link|#Usage}}
{{Link|#Usage|The Usage chapter}}

[[#|]]
Usage
The Usage chapter

{{Link|Arma Reforger:Getting Started}}
{{Link|Arma Reforger:Getting Started|Test}}
{{Link|Arma Reforger:Getting Started#Play in Single Player}}
{{Link|Arma Reforger:Getting Started#Play in Single Player|Play in Single Player}}

Arma Reforger:Getting Started
Test
Arma Reforger:Getting Started - Play in Single Player
Play in Single Player