Template:Doi/doc: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>Circeus
meta>Circeus
fix as only square brackets are still a problem
Line 10: Line 10:
:{{doi|10.1016/j.coi.2004.08.001}}
:{{doi|10.1016/j.coi.2004.08.001}}


===Usage 2===
===DOIs with square brackets===
If the DOI contains characters such as &lt;, &gt; and ], that cause the display to break, one may use the <var>id</var> and <var>label</var> variables. The <var>id</var> variable represents a [[Percent-encoding|URL encoded]] version of the DOI, where the <var>label</var> variable is the normal DOI:
DOIs containing the square bracket characters [] ''will break'', so one has to use the <var>id</var> and <var>label</var> variables. The <var>id</var> variable represents a [[Percent-encoding|URL encoded]] version of the DOI, where the <var>label</var> variable is the normal DOI. The <var>label</var> variable contains the string that is actually displayed on the page, where the closing bracket character must be replaced with a [[character entity]]:
 
<nowiki>{{</nowiki>doi
  | id = 10.1175/1520-0442(2002)015'''%3C'''0487:SOCASI'''%3E'''2.0.CO;2
  | label = 10.1175/1520-0442(2002)015<0487:SOCASI>2.0.CO;2
}}
produces:
 
:{{doi
  | id = 10.1175/1520-0442(2002)015%3C0487:SOCASI%3E2.0.CO;2
  | label = 10.1175/1520-0442(2002)015<0487:SOCASI>2.0.CO;2
}}
 
If square brackets appear, a further problem is created, and the closing bracket (but not the opening one) must be also replaced in the <code>label</code> parameter:


  <nowiki>{{</nowiki>doi
  <nowiki>{{</nowiki>doi
Line 36: Line 23:
   | label = 10.1890/1051-0761(1998)008[0947:FROINI&#x5d;2.0.CO;2
   | label = 10.1890/1051-0761(1998)008[0947:FROINI&#x5d;2.0.CO;2
}}
}}
The escape code for &lt; is <code>%3C</code>. For &gt;, it is <code>%3E</code>. For [ and ], use respectively <code>%5B</code> and <code>%5D</code>.


==See also==
==See also==

Revision as of 23:31, 10 June 2008

This template is intended to allow simple standardized links to digital object identifiers (DOIs).

Examples

Usage 1

The basic usage is:

{{doi|10.1016/j.coi.2004.08.001}}

which produces:

doi:10.1016/j.coi.2004.08.001

DOIs with square brackets

DOIs containing the square bracket characters [] will break, so one has to use the id and label variables. The id variable represents a URL encoded version of the DOI, where the label variable is the normal DOI. The label variable contains the string that is actually displayed on the page, where the closing bracket character must be replaced with a character entity:

{{doi
 | id = 10.1890/1051-0761(1998)008%5B0947:FROINI%5D2.0.CO;2
 | label = 10.1890/1051-0761(1998)008[0947:FROINI&#x5d;2.0.CO;2
}}

producing

Error: Bad DOI specified!

See also