<!--{* 0. For detailed usage documentation see Dev/mediawiki. The following explanation only regards the knowledge needed to edit the code below 1. regex_replace is a smarty function, see https://www.smarty.net/docs/en/language.modifier.regex.replace.tpl 2. this function is used to extract the request protocol and the apex domain by replacing the unwanted infos with empty string 3. It is also important to know that in smarty `$var` expressed the $var in a string, so you can pre process everything in `` 4. The requestProtocol only finds http or https 5. The apexDomain only finds domainName.topLevelDomain like whonix.org or abc.onion 6. After that everything is simple: $append is added and $text is added in the respective places 7. Sub step variables (not used later). Basically this is necessary get whether it's the onion or regular domain 7.1. projectDomainClearnetRegexp / projectDomainOnionRegexp: constants, regular domain and onion domain, but all dots "." replaced with backslash dot "\." to make them regexp compatible 7.3. apexDomainPre: every character before both possible apex domains removed 7.4. apexDomain: every character after both possible apex domains removed. So now there's only the apex domain left. *}--> <!--{assign var="projectDomainClearnetRegexp" value="`$projectDomainClearnet|regex_replace:"/\./":"\."`" }--> <!--{assign var="projectDomainOnionRegexp" value="`$projectDomainOnion|regex_replace:"/\./":"\."`" }--> <!--{assign var="apexDomainPre" value="`$context|regex_replace:"/.+(?=$projectDomainClearnetRegexp|$projectDomainOnionRegexp)/":""`"}--> <!--{assign var="apexDomain" value="`$apexDomainPre|regex_replace:"/(?<=$projectDomainClearnetRegexp|$projectDomainOnionRegexp)\/.*/":""`"}--> <!--{assign var="requestProtocol" value="`$context|regex_replace:"/:.+/":""`" }--> <!--{if ! $result || $result == 'link'}--><a href="<!--{$requestProtocol}-->://<!--{$sub}-->.<!--{$apexDomain}--><!--{$append}-->"><!--{$text}--></a><!--{/if}--> <!--{if $result == 'url'}--><!--{$requestProtocol}-->://<!--{$sub}-->.<!--{$apexDomain}--><!--{$append}--><!--{/if}--> <!--{if $result == 'parts'}--><!--{$requestProtocol}-->,<!--{$apexDomain}--><!--{/if}--> <noinclude> [[Category:MultiWiki]] </noinclude>