Template:Delink: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (Protected "Template:Delink" ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite)))
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Delink/phase 1 a
{{Delink/phase 1 a
   |{{#expr:1 + {{strfind short|{{{1|}}}|{{!((}}|2}} }}<!-- Number of characters before and including the opening set of brackets, or 1 if there are none -->
   |{{#expr:1 + {{strfind short|{{{1|}}}|{{!((}}|2|lenstr=50}} }}<!-- Number of characters before and including the opening set of brackets, or 1 if there are none -->
   |{{#expr:    {{strfind short|{{{1|}}}|{{))!}}|2}} - 1 }}<!-- Number of characters before the closing brackets (or -1 if there are none)-->
   |{{#expr:    {{strfind short|{{{1|}}}|{{))!}}|2|lenstr=50}} - 1 }}<!-- Number of characters before the closing brackets (or -1 if there are none)-->
   |{{{1|}}}  
   |{{{1|}}}  
}}<noinclude>
}}<noinclude>
{{wikipedia port}}
==How it works==
==How it works==


Line 19: Line 16:
* <nowiki>{{Delink|[[Paris|London]]}}</nowiki>
* <nowiki>{{Delink|[[Paris|London]]}}</nowiki>
* {{Delink|[[Paris|London]]}}
* {{Delink|[[Paris|London]]}}
* <nowiki>{{Delink|aaa [[Paris|London]] b}}</nowiki>
* <nowiki>{{Delink|foo [[Paris|London]] bar}}</nowiki>
* {{Delink|aaa [[Paris|London]] b}}
* {{Delink|foo [[Paris|London]] bar}}


</noinclude>
</noinclude>

Latest revision as of 13:23, 5 April 2025

How it works

  1. If there is [[ ]] take the bit between the first pair else the whole thing
  2. If there is a | take the bit before the | else the whole thing

Examples

  • {{Delink|Paris}}
  • Paris
  • {{Delink|[[Paris]]}}
  • Paris
  • {{Delink|[[Paris|London]]}}
  • London
  • {{Delink|foo [[Paris|London]] bar}}
  • foo London bar