Link/Hash – Template

From Bohemia Interactive Community
Jump to navigation Jump to search
(Add display text parameter)
(Add :Category: support, Remove underscore removal)
Line 3: Line 3:
|{{{2}}}
|{{{2}}}
|{{#ifeq:{{#pos:{{Trim|{{{1}}}}}|#}}|0
|{{#ifeq:{{#pos:{{Trim|{{{1}}}}}|#}}|0
|{{#replace:{{#replace:{{#sub:{{Trim|{{{1}}}}}|1}}|_|<nowiki/> <nowiki/>}}|#|&#35;}}
|{{#replace:{{#sub:{{Trim|{{{1}}}}}|1}}|#|&#35;}}
|{{#replace:{{#explode:{{Trim|{{{1}}}}}|#|0|0|2}} - {{#explode:{{Trim|{{{1}}}}}|#|1|2}}|_|<nowiki/> <nowiki/>}}
|{{#replace:{{#explode:{{Trim|{{{1}}}}}|#|0|0|2}}|:Category:|}} - {{#explode:{{Trim|{{{1}}}}}|#|1|2}}
}}}}]]
}}}}]]
|-no link specified-
|-no link specified-
Line 39: Line 39:
| <nowiki>{{HashLink|Arma 3#Key features|A3's Key Features}}</nowiki>
| <nowiki>{{HashLink|Arma 3#Key features|A3's Key Features}}</nowiki>
| {{HashLink|Arma 3#Key features|A3's Key Features}}
| {{HashLink|Arma 3#Key features|A3's Key Features}}
|-
! colspan="2" | Edge Cases
|-
|-
| <nowiki>.{{HashLink|Arma 3#Key features}}.</nowiki>
| <nowiki>.{{HashLink|Arma 3#Key features}}.</nowiki>
Line 51: Line 53:
| <nowiki>{{HashLink|PreProcessor Commands##if}}</nowiki>
| <nowiki>{{HashLink|PreProcessor Commands##if}}</nowiki>
| {{HashLink|PreProcessor Commands##if}}
| {{HashLink|PreProcessor Commands##if}}
|-
| <nowiki>{{HashLink|CT_LISTNBOX#BIS_fnc_initList example}}</nowiki>
| {{HashLink|CT_LISTNBOX#BIS_fnc_initList example}}
|-
| <nowiki>{{HashLink|:Category:Community Tools#Code Edition}}</nowiki>
| {{HashLink|:Category:Community Tools#Code Edition}}
|}
|}


[[Category:Templates|{{uc:{{PAGENAME}}}}]]</noinclude>
[[Category:Templates|{{uc:{{PAGENAME}}}}]]</noinclude>

Revision as of 00:22, 18 August 2021

Creates an auto-formatted hash link (e.g #value or page#anchor).

Usage

{{HashLink|hashLink|text}}

  • hashLink: wiki hash link, e.g #toc or Arma 3#Key features
  • text: display text
Examples
Code Result
{{HashLink}} -no link specified-
{{HashLink|#toc}} toc
{{HashLink|#Multipart Hashlink}} Multipart Hashlink
{{HashLink|#Multipart Hashlink|Display text}} Display text
{{HashLink|Arma_3#Key_features}} Arma_3 - Key_features
{{HashLink|Arma 3#Key features}} Arma 3 - Key features
{{HashLink|Arma 3#Key features|A3's Key Features}} A3's Key Features
Edge Cases
.{{HashLink|Arma 3#Key features}}. .Arma 3 - Key features.
{{HashLink|##if}} #if
{{HashLink|##if#then##else}} #if#then##else
{{HashLink|PreProcessor Commands##if}} PreProcessor Commands - #if
{{HashLink|CT_LISTNBOX#BIS_fnc_initList example}} CT_LISTNBOX - BIS_fnc_initList example
{{HashLink|:Category:Community Tools#Code Edition}} Community Tools - Code Edition