Template:Format ISBN
This template formats 9-digit SBN's, 10- and 13-digit ISBNs according to the rules determined by the International ISBN Agency.[1]
Usage
The template takes as argument a valid ISBN and yields the formatted version of that ISBN. Any existing hyphens in the ISBN are ignored, whether or not they are correctly placed:
{{format ISBN|97-8-1-57181655-9}}
→ 978-1-57181-655-9
{{Format ISBN}}
is intended to be substituted so that the template call in wikitext is replaced with the formatted ISBN. Substitution may be accomplished in two ways. The easiest and most reliable method is to simply write the template like you would write any other template. After your edit is published, AnomieBOT will, usually within a few hours, perform the substitution. The other method is to write an explicitly substitutable form of the template which will cause the template to be substituted when your edit is published:
{{subst:format ISBN|9781571816559}}
→ 978-1-57181-655-9
Warning: subst:
does not work inside <ref>...</ref>
tags (see phab:T4700). For use inside <ref>...</ref>
tags, use the template directly and allow AnomieBOT to do the substitution:
<ref> ... {{format ISBN|9781571816559}} ... </ref>
Note that if you write this:
<ref> ... {{subst:format ISBN|9781571816559}} ... </ref>
AnomieBOT will not substitute the template.
Parameters
This template accepts three parameters; one unnamed and two named:
|1=
(unnamed parameter) – (required) the ISBN to be formatted|separator=
– (optional) accepts one predefined keyword:space
; when|separator=space
, the rendered ISBN elements are separated using a space character; for any other value, this template renders with hyphen separators|out=
– (optional) accepts one of two predefined keywords:10
or13
; for those who desire to convert an ISBN10 to ISBN13, set|out=13
; to convert an ISBN13 to ISBN10 set|out=10
. This parameter is ignored when the input is:- an SBN (9 digits)
- an ISBN13 with a GS1 prefix of
979
Invalid ISBNs
If the unnamed parameter to this template does not consist of 9, 10, or 13 digits, or the check digit is not what was expected from the rest of the number, the input number is returned without modification. In such a case formatting is not possible, because any of the digits might be wrong, and that would affect the placement of the hyphens. The template is intended for use within an enclosing template, which will report any errors with the length, check digit, or invalid characters. In this example of the Format ISBN template, the input to {{Format ISBN}}
has an incorrect check digit so the template returns its input unmodified:
{{format ISBN|9789295055123}}
→ 9789295055123
When this template, using the same invalid ISBN, is enclosed in {{ISBN}}
or {{cite book}}
, appropriate error messages are displayed by those templates:
{{ISBN|{{format ISBN|9789295055123}}}}
{{cite book |title=ISBN Users' Manual: International Edition |edition=7th |location=London |publisher=International ISBN Agency |date=2017 |isbn={{format ISBN|9789295055123|nosubst=true}}}}
Nota bene: Substitution will occur regardless of the validity of the input ISBN; previewing your edits is suggested.
More examples
ISBN13
{{format ISBN|9781571816559}}
→ 978-1-57181-655-9 (13-digit input){{format ISBN|9783033009608}}
→ 978-3-033-00960-8 (German ISBN starting with 978-3){{format ISBN|9788876055485}}
→ 978-88-7605-548-5 (Italian ISBN starting with 978-88){{format ISBN|9791220008525}}
→ 979-12-200-0852-5 (Italian ISBN starting with 979-12[2]){{format ISBN|97-8-1-60520624-0}}
→ 978-1-60520-624-0 (13 digits with invalid hyphenation)
ISBN10
{{format ISBN|1605206245}}
→ 1-60520-624-5 (10-digit input[2]){{format ISBN|0-385-33348-X}}
→ 0-385-33348-X
SBN
{{subst:format ISBN|035789360}}
→ 03-578936-0 (9-digit (SBN) input)
Invalid input
{{format ISBN|97808108596789}}
→ 97808108596789 (ISBN with bad input length: not 10 or 13 digits){{format ISBN|03578936X}}
→ 03578936X (9-digits with invalid check digit; possibly an invalid SBN check digit or an ISBN10 with a missing digit){{format ISBN|9780816645842}}
→ 9780816645842 (ISBN with invalid check digit: should be 8){{format ISBN|Unknown}}
→ Unknown (ISBN parameter containing text that is not an ISBN){{format ISBN|9782D0GP00P37}}
→ 9782D0GP00P37{{format ISBN}}
→ (blank output from blank ISBN: no error message)
Using the optional parameters
{{format ISBN|9781571816559|separator=space}}
→ 978 1 57181 655 9 (Space character used as separator in output){{format ISBN|9781571816559|out=10}}
→ 1-57181-655-0 (Convert ISBN13 to ISBN10){{format ISBN|1571816550|out=13}}
→ 978-1-57181-655-9 (Convert ISBN10 to ISBN13){{format ISBN|1571816550|out=13|separator=space}}
→ 978 1 57181 655 9 (Convert ISBN10 to ISBN13 and with space character as separator)
References
- ^ "Structure of the ISBN" (PDF). ISBN Users' Manual: International Edition (7th ed.). London: International ISBN Agency. 2017. pp. 11–12. ISBN 978-92-95055-12-4 – via Kungliga Biblioteket.
- ^ a b Rowe, Adam (November 29, 2019). "The 10-Digit ISBN Is Getting Retired Next Year". Forbes. Archived from the original on 2019-12-02.
In order to stop misidentifications, all US systems will need to effectively retire the 10-digit signifier before they start processing new titles with the 979 prefix.
See also
- Wikipedia:ISBN
- {{ISBN}}, to list one or more ISBNs linked to Special:BookSources
- {{SBN}}, similar template for SBNs rather than ISBNs
- {{ISBNT}}, to make an ISBN link without a visible prefix
- {{Listed Invalid ISBN}}, to link an ISBN that is invalid but printed in a source publication.