Template:External: Difference between revisions

From railML 2 Wiki
Jump to navigation Jump to search
[checked revision][checked revision]
No edit summary
(railML→{{rml}})
 
(28 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#switch:{{#sub:{{{1}}}|0|17}}
<includeonly><noinclude>
|http://www.w3.org
var:link soll dem Archivlink entsprechen so vorhanden, und sonst {{{1}}}; Verlinkt wird der Archivlink, gezeigt aber {{{1}}}
|https://www.w3.or=[{{{1}}}  
</noinclude>{{#vardefine:link|{{#if:{{{archive|}}}|{{{archive}}}|{{{1}}}}}}}<noinclude>
 
Mode: silent or not?
{{#if:{{{text|}}}|''(''|{{{1}}}|{{#if:{{{date|}}}|''(''|{{#if:{{{type|}}}|''(''|{{#if:{{{lang|}}}|''(''|{{#if:{{{visited|}}}|''(''|{{#if:{{{comment|}}}|''(''}}}}}}}}}}}}
</noinclude>{{#switch:{{{mode}}}
 
|silent=[{{#var:link}} {{#if:{{{2|}}}|{{{2}}}|{{#if:{{{text|}}}|{{{text}}}|{{{1}}}}}}}]
{{#if:{{{2|}}}|{{{2}}}|{{#if:{{{text|}}}|{{{text}}}|{{{1}}}}}}}]{{#if:{{{date|}}}|,&nbsp;''{{{date}}}''}}{{#if:{{{type|}}}|,&nbsp;''{{{type}}}''}}{{#if:{{{lang|}}}|,&nbsp;''{{{lang}}}''}}{{#if:{{{visited|}}}|,&nbsp;''visited on {{{visited}}}''}}{{#if:{{{comment|}}}|<nowiki>;</nowiki>&nbsp;''{{{comment}}}''}}
|#default={{#switch:{{#sub:{{{1}}}|0|17}}
|#default=[{{{1}}} {{#if:{{{2|}}}|{{{2}}}|{{#if:{{{text|}}}|{{{text}}}|{{{1}}}}}}}] ''({{#if:{{{inlang|}}}|{{#switch:{{{inlang}}}|de=externer Link|fr=lien externe|#default=external link}}|external link}}{{#if:{{{date|}}}|,&nbsp;{{{date}}}}}{{#if:{{{type|}}}|,&nbsp;{{{type}}}}}{{#if:{{{lang|}}}|,&nbsp;{{{lang}}}}}{{#if:{{{visited|}}}|,&nbsp;visited on {{{visited}}}}}{{#if:{{{comment|}}}|<nowiki>;</nowiki>&nbsp;{{{comment}}}}})''}}[[category:External Link]]</includeonly><noinclude>
|h<!-- -->ttps://www.w3.org
|h<!-- -->ttps://www.w3.or=[{{#var:link}} {{#if:{{{2|}}}|{{{2}}}|{{#if:{{{text|}}}|{{{text}}}|{{{1}}}}}}}]{{#if:{{{date|}}}|&nbsp;''(|{{#if:{{{type|}}}|&nbsp;''(|{{#if:{{{lang|}}}|&nbsp;''(|{{#if:{{{visited|}}}|&nbsp;''(|{{#if:{{{comment|}}}|&nbsp;''(}}}}}}}}}}{{#sub:{{#if:{{{date|}}}|,&nbsp;{{{date}}}}}{{#if:{{{type|}}}|,&nbsp;{{{type}}}}}{{#if:{{{lang|}}}|,&nbsp;{{lang|{{{lang}}}}}}}{{#if:{{{size|}}}|,&nbsp;size: {{{size}}}}}{{#if:{{{visited|}}}|,&nbsp;visited on {{{visited}}}}}{{#if:{{{comment|}}}|,&nbsp;{{{comment}}}}}|7}}{{#if:{{{date|}}}|)''|{{#if:{{{type|}}}|)''|{{#if:{{{lang|}}}|)''|{{#if:{{{visited|}}}|)''|{{#if:{{{comment|}}}|)''}}}}}}}}}}
|#default=[{{#var:link}} {{#if:{{{2|}}}|{{{2}}}|{{#if:{{{text|}}}|{{{text}}}|{{{1}}}}}}}] ''({{#if:{{{inlang|}}}|{{#switch:{{{inlang}}}|de=externer {{#if:{{{archive|}}}|Archiv-}}Link|fr=lien externe|#default=external&#32;{{#if:{{{archive|}}}|archive&#32;}}link}}|external&#32;{{#if:{{{archive|}}}|archive&#32;}}link}}{{#if:{{{date|}}}|,&nbsp;{{{date}}}}}{{#if:{{{type|}}}|,&nbsp;{{{type}}}}}{{#if:{{{lang|}}}|,&nbsp;{{lang|{{{lang}}}}}}}{{#if:{{{size|}}}|,&nbsp;size: {{{size}}}}}{{#if:{{{visited|}}}|,&nbsp;visited on {{{visited}}}}}{{#if:{{{comment|}}}|<nowiki>;</nowiki>&nbsp;{{{comment}}}}})''}}}}[[category:External Link]]</includeonly><noinclude>
==Usage==
==Usage==
The template can be used to mark external links.
The template can be used to mark external links.
Line 12: Line 14:
This template grants that external links will be collected in [[:category:External Link]]. So we keep an overview of external links and control their actuality routinely.
This template grants that external links will be collected in [[:category:External Link]]. So we keep an overview of external links and control their actuality routinely.


For Links to pages on the {{rml}}-site ([http://railml.org http://railml.org]), please use [[Template:Site]].
For Links to pages on the {{rml}}-site ({{site|https://railml.org|mode=silent|inline=1}}), please use [[Template:Site]].


Please, consider, that the template contains an exception for links to the World Wide Web Consortium (W3C), as there are too many links to W3C data types — we want to avoid the reading flow being disturbed.
Please, consider, that the template contains an exception for links to the World Wide Web Consortium (W3C), as there are too many links to W3C data types — we want to avoid the reading flow being disturbed.
{{note|An outline on Citations and References within the {{rml}} wikis can be found '''[[Dev:Wiki_Documentation_Guidelines#Citations_and_References|here]]'''.}}
===Dependencies===
{{note|The template requires the extension ''StringFunctions'', comp. {{external|https://www.mediawiki.org/wiki/Extension:StringFunctions}}.}}
===Arguments===
===Arguments===
The template has an obligatory and five optional argument:
The template has an obligatory and five optional argument:
*Obligatory; unnamed
*Obligatory; unnamed
**'''1''': the link target, e.g. http://uic.org<br>'''Notice:''' the mediawiki software will misinterpret URLs containing the equality sign (=). Replace equality signs in URLs with the HTML-entity &amp;#61;.<br>''Example:'' replace <nowiki>{{external|http://www.railml.org/forum/index.php?t=msg&th=469&start=0&}}</nowiki> with <nowiki>{{external|http://www.railml.org/forum/index.php?t&amp;#61;msg&th&amp;#61;469&start&amp;#61;0&}}</nowiki> as to display [http://www.railml.org/forum/index.php?t&#61;msg&th&#61;469&start&#61;0& http://www.railml.org/forum/index.php?t&#61;msg&th&#61;469&start&#61;0&] ''(external link)''
**'''1''': the link target, e.g. {{external|https://uic.org|mode=silent}}. '''Please, recognize [[#note|the note below]].'''
{{note|{{anchor|note}}If the content of the unnamed arguments contains equality signs this can easily result in errors.
;example
<nowiki>{{site|https://www.railml.org/forum/index.php?t=msg&goto=71&|Heidrun Jost BaliseGroup and its attributes {{rml}} forum post}}<nowiki />}}</nowiki><br>results in:<br>{{site|https://www.railml.org/forum/index.php?t=msg&goto=71&|Heidrun Jost BaliseGroup and its attributes {{rml}} forum post}}<nowiki />
 
There are two remedies:
*Either make the argument number explicit:<br><nowiki>{{site|1=https://www.railml.org/forum/index.php?t=msg&goto=71&|2=Heidrun Jost BaliseGroup and its attributes {{rml}} forum post}}</nowiki>
*Or escape all equality signs via {{wikipedia|url encoding}} in the first argument and with {{wikipedia|HTML entities}} in the second argument:<br><nowiki>{{site|https://www.railml.org/forum/index.php?t%3Dmsg&goto%3D71&|Heidrun Jost BaliseGroup and its attributes {{rml}} forum post}}</nowiki>|reminder}}
*Optional
*Optional
**'''2''' or ''text'': the link text. If it is empty, the link target will be used as link text. This argument can be used both named or unnamed.
**'''2''' or ''text'': the link text. If it is empty, the link target will be used as link text. This argument can be used both named or unnamed. '''Please, recognize [[#note|the note above]].'''
**''archive'': Provide an archive link in case the source is no longer available. On default, the original URL (argument '''1''') be displayed and the archive URL will be linked.
**''date'': the publication date of the file
**''date'': the publication date of the file
**''type'': the file type, e.g. PDF
**''type'': the file type, e.g. PDF
**''lang'': the language of the link target file, e.g. EN
**''lang'': the language of the link target file, e.g. EN. For EN, FR, DE, NL, NO, CZ and ES a flag will be displayed. In all other cases the input string will be returned.
**''size'': the file size — use only for very big files beyond 25 M!
**''visited'': the date when the file was visited
**''visited'': the date when the file was visited
**''inlang'': en (=default), de or fr for a notice in the language of the context
**''inlang'': en (=default), de or fr for a notice in the language of the context
**''comment'': anything that does not fit into the other parameters; a string to be displayed directly
**''comment'': anything that does not fit into the other parameters; a string to be displayed directly
**''mode'': if mode=silent, the link will not be commented.
**''inline'': dummyargument. Set inline=1 whenever you employ the template outside <<nowiki />ref> tags to show that this is on purpose not in a footnote.


If the second argument is unnamed (example: <nowiki>{{external|http://example.ex|some example text}}</nowiki>), it will be interpreted as link text. If the second argument is named (example:<nowiki>{{external|http://example.ex|type=some file format}}</nowiki>), it will be interpreted according to the argument name.
If the second argument is unnamed (example: <nowiki>{{external|https://example.ex|some example text}}</nowiki>), it will be interpreted as link text. If the second argument is named (example:<nowiki>{{external|https://example.ex|type=some file format}}</nowiki>), it will be interpreted according to the argument name.


==Examples==
==Examples==
Line 35: Line 51:
|'''Output'''
|'''Output'''
|-
|-
|<nowiki>{{external|http://www.uic.org}}</nowiki>
|<nowiki>{{external|https://www.uic.org}}</nowiki>
|{{external|http://www.uic.org}}
|{{external|https://www.uic.org}}
|-
|-
|<nowiki>{{external|http://www.uic.org|International Union of Railways}}</nowiki>
|<nowiki>{{external|https://www.uic.org|International Union of Railways}}</nowiki>
|{{external|http://www.uic.org|International Union of Railways}}
|{{external|https://www.uic.org|International Union of Railways}}
|-
|-
|<nowiki>{{external|http://www.uic.org|type=HTML}}</nowiki>
|<nowiki>{{external|https://www.uic.org|type=HTML}}</nowiki>
|{{external|http://www.uic.org|type=HTML}}
|{{external|https://www.uic.org|type=HTML}}
|-
|-
|<nowiki>{{external|http://www.uic.org|lang=EN|text=UIC}}</nowiki>
|<nowiki>{{external|https://www.uic.org|lang=EN|text=UIC}}</nowiki>
|{{external|http://www.uic.org|lang=EN|text=UIC}}
|{{external|https://www.uic.org|lang=EN|text=UIC}}
|-
|-
|<nowiki>{{external|http://www.uic.org|UIC|type=HTML|lang=EN}}</nowiki>
|<nowiki>{{external|https://www.uic.org|UIC|type=HTML|lang=EN}}</nowiki>
|{{external|http://www.uic.org|UIC|type=HTML|lang=EN}}
|{{external|https://www.uic.org|UIC|type=HTML|lang=EN}}
|-
|-
|<nowiki>{{external|https://www.w3.org/TR/xmlschema-2/#language}}</nowiki>
|<nowiki>{{external|https://www.w3.org/TR/xmlschema-2/#language}}</nowiki>
|{{external|https://www.w3.org/TR/xmlschema-2/#language}}
|{{external|https://www.w3.org/TR/xmlschema-2/#language}}
|-
|<nowiki>{{external|https://railml.org|mode=silent}}</nowiki>
|{{external|https://railml.org|mode=silent}}
|-
|<nowiki>{{external|https://railml.org|{{rml}} site|mode=silent}}</nowiki>
|{{external|https://railml.org|{{rml}} site|mode=silent}}
|-
|<nowiki>{{external|http://www.railml.org/en/index-en.shtml|archive=https://web.archive.org/web/20030527011905/http://www.railml.org/en/index-en.shtml}}</nowiki>
|{{external|http://www.railml.org/en/index-en.shtml|archive=https://web.archive.org/web/20030527011905/http://www.railml.org/en/index-en.shtml}}
|}
|}


[[category:ContentTemplate]]
[[category:LinkTemplate]]
 
{{interwiki}}
</noinclude>
</noinclude>

Latest revision as of 20:34, 22 January 2024

Usage

The template can be used to mark external links.

This template grants that external links will be collected in category:External Link. So we keep an overview of external links and control their actuality routinely.

For Links to pages on the railML®-site (https://railml.org), please use Template:Site.

Please, consider, that the template contains an exception for links to the World Wide Web Consortium (W3C), as there are too many links to W3C data types — we want to avoid the reading flow being disturbed.

🗒️ An outline on Citations and References within the railML® wikis can be found here.

Dependencies

🗒️ The template requires the extension StringFunctions, comp. https://www.mediawiki.org/wiki/Extension:StringFunctions (external link).

Arguments

The template has an obligatory and five optional argument:

💡 If the content of the unnamed arguments contains equality signs this can easily result in errors.
example

{{site|https://www.railml.org/forum/index.php?t=msg&goto=71&|Heidrun Jost BaliseGroup and its attributes {{rml}} forum post}}<nowiki />}}
results in:
[Heidrun Jost BaliseGroup and its attributes railML® forum post Heidrun Jost BaliseGroup and its attributes railML® forum post] (link to the railML® website)

There are two remedies:

  • Either make the argument number explicit:
    {{site|1=https://www.railml.org/forum/index.php?t=msg&goto=71&|2=Heidrun Jost BaliseGroup and its attributes {{rml}} forum post}}
  • Or escape all equality signs via url encoding (Wiki banner.png) in the first argument and with HTML entities (Wiki banner.png) in the second argument:
    {{site|https://www.railml.org/forum/index.php?t%3Dmsg&goto%3D71&|Heidrun Jost BaliseGroup and its attributes {{rml}} forum post}}
  • Optional
    • 2 or text: the link text. If it is empty, the link target will be used as link text. This argument can be used both named or unnamed. Please, recognize the note above.
    • archive: Provide an archive link in case the source is no longer available. On default, the original URL (argument 1) be displayed and the archive URL will be linked.
    • date: the publication date of the file
    • type: the file type, e.g. PDF
    • lang: the language of the link target file, e.g. EN. For EN, FR, DE, NL, NO, CZ and ES a flag will be displayed. In all other cases the input string will be returned.
    • size: the file size — use only for very big files beyond 25 M!
    • visited: the date when the file was visited
    • inlang: en (=default), de or fr for a notice in the language of the context
    • comment: anything that does not fit into the other parameters; a string to be displayed directly
    • mode: if mode=silent, the link will not be commented.
    • inline: dummyargument. Set inline=1 whenever you employ the template outside <ref> tags to show that this is on purpose not in a footnote.

If the second argument is unnamed (example: {{external|https://example.ex|some example text}}), it will be interpreted as link text. If the second argument is named (example:{{external|https://example.ex|type=some file format}}), it will be interpreted according to the argument name.

Examples

Code Output
{{external|https://www.uic.org}} https://www.uic.org (external link)
{{external|https://www.uic.org|International Union of Railways}} International Union of Railways (external link)
{{external|https://www.uic.org|type=HTML}} https://www.uic.org (external link, HTML)
{{external|https://www.uic.org|lang=EN|text=UIC}} UIC (external link, 🇬🇧)
{{external|https://www.uic.org|UIC|type=HTML|lang=EN}} UIC (external link, HTML, 🇬🇧)
{{external|https://www.w3.org/TR/xmlschema-2/#language}} https://www.w3.org/TR/xmlschema-2/#language
{{external|https://railml.org|mode=silent}} https://railml.org
{{external|https://railml.org|{{rml}} site|mode=silent}} railML® site
{{external|http://www.railml.org/en/index-en.shtml|archive=https://web.archive.org/web/20030527011905/http://www.railml.org/en/index-en.shtml}} http://www.railml.org/en/index-en.shtml (external archive link)