الگو:URL2
![]() | این الگو از لوآ استفاده میکند: |
This is a fork of الگو:نشانی وب for use in infoboxes.
It behaves similarly to {{URL}} with the following exceptions:
- By default it does not display anything if the parameters are blank or omitted. الگو:نشانی وب displays
{{URL|example.com|optional display text}}
by default. - It implements a parameter
|msg=
that turns on or off the message{{URL|example.com|optional display text}}
. Setting msg to false or anything beginning with n or N will suppress the message. Anything else enables the message. - It strips html tags and wiki-link markup from the supplied url parameter.
- It truncates the url parameter at the first space it finds.
- It can take its own output as input, allowing website parameters to be wrapped in in the design of an infobox, without causing problems if editors add
|website={{نشانی وب|some.url.com}}
in an article.
Usage
[ویرایش]{{URL2|url}}
{{URL2|1=url}}
Examples
[ویرایش]Different from Template:URL
[ویرایش]If there is no input, the default behavior of URL2 is to display nothing (use |msg=
to display the instructional message):
{{URL2| }}
←
{{URL2|msg=yes| }}
←{{URL|example.com|optional display text}}
{{URL2|msg=true| }}
←{{URL|example.com|optional display text}}
URL2 handles formatting commonly found in the |website=
parameter of an infobox:
{{URL2|[http://www.example.com]}}
← www.example .com
{{URL2|http://www.example.com|website}}
← website
{{URL2|{{URL|www.example.com}}}}
← www.example .com
{{URL2|{{URL2|www.example.com}}}}
← www.example .com
Same as Template:URL
[ویرایش]The template wraps the output in <span>...</span>
(see § Microformat) and adds عنصر اچتیامال before displayed periods:
{{URL2|www.example.com}}
← www.example .com [http://www.example.com www
.example .com]
The use of پروتکل انتقال ابرمتن, پروتکل امن انتقال ابرمتن, a مکانیاب منبع یکسان, or a different protocol is preserved in the URL but is not shown in the انکر تکست (متن لینک):
{{URL2|http://www.example.com}}
← www.example .com [http://www.example.com www
.example .com]
{{URL2|https://www.example.com}}
← www.example .com [https://www.example.com www
.example .com]
{{URL2|//www.example.com}}
← www.example .com [//www.example.com www
.example .com]
{{URL2|ftp://ftp.example.com}}
← ftp.example .com [ftp://ftp.example.com ftp
.example .com]
If the path is only a slash (/
) it is not displayed in the link text:
{{URL2|https://www.example.com/}}
← www.example .com [https://www.example.com/ www
.example .com]
The template also adds عنصر اچتیامال before any displayed slashes (/
) in the path:
{{URL2|https://www.example.com/path}}
← www.example .com /path [https://www.example.com/path www
.example .com /path]
For a URL containing an equal sign (=
), use |1=
:
{{URL2|1=http://www.example.com/path?section=17}}
← www.example .com /path?section=17 [http://www.example.com/path?section=17 www
.example .com /path?section=17]
Microformat
[ویرایش]The template wraps the displayed URL with class="url"
so that it is included in any parent میکروفرمت which takes a URL parameter - see Wikipedia:WikiProject Microformats.
See also
[ویرایش]- {{URL}}
- پودمان:WikidataIB (بحث · · تاریخچه · پیوندها · توضیحات · زیرصفحهها · آزمایش (نتایج))
- {{Official URL}}
- {{Official website}}