Actions

Template

Difference between revisions of "Extension"

From WikiApiary, monitoring the MediaWiki universe

(chg)
(fix the "Cannot set URL automatically because multiple URLs were found" error for MediaWiki.org extensions (see also Special:Permalink/4766455))
Line 44: Line 44:
 
   }}
 
   }}
 
  | , | sort=asc, unique
 
  | , | sort=asc, unique
}}<!-- we should only get 1 URL, if not we do not set it -->{{
+
}}<!-- we should only get 1 URL -->{{
 
#ifeq: {{#arraysize: urls}} | 1 | ''[[Has URL::{{#arrayindex:urls|0}}]]''
 
#ifeq: {{#arraysize: urls}} | 1 | ''[[Has URL::{{#arrayindex:urls|0}}]]''
 
}}{{
 
}}{{
 
#ifeq: {{#arraysize: urls}} | 0 | ''This extension does not provide a URL programmatically.''
 
#ifeq: {{#arraysize: urls}} | 0 | ''This extension does not provide a URL programmatically.''
}}{{
+
}}<!-- if there are 2 URLs, check to see if they are equivalent except for HTTP(S) -->{{
#ifexpr: {{#arraysize: urls}} > 1 | ''Cannot set URL automatically because multiple URLs were found:<br/>{{#arrayprint:urls|<br/>}}''
+
#ifeq: {{#arraysize: urls}} | 2 | {{
 +
#ifeq: {{#replace: {{#arrayindex:urls|0}} | http: | https: }} | {{#replace: {{#arrayindex:urls|1}} | http: | https: }}
 +
| ''[[Has URL::{{ #replace: {{#arrayindex:urls|0}} | http: | https: }}]]''
 +
| ''Cannot set URL automatically because multiple URLs were found:<br/>{{#arrayprint:urls|<br/>}}''
 +
}}
 +
}}<!-- otherwise, don't set it and just return whatever URLs were found -->{{
 +
#ifexpr: {{#arraysize: urls}} > 2 | ''Cannot set URL automatically because multiple URLs were found:<br/>{{#arrayprint:urls|<br/>}}''
 
}}
 
}}
 
}}
 
}}

Revision as of 09:16, 8 November 2018

This is the "Extension" template. It should be called in the following format:

{{Extension
|Name=
|URL=
|Description=
|Current version=
|Tags=
|Image=
|Note=
}}

Edit the page to see the template text.