Template:Format ISBN/doc

This template formats 9-digit SBN's, 10- and 13-digit ISBNs according to the rules determined by the International ISBN Agency.

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:

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:

Warning:  does not work inside  tags (see T4700). For use inside  tags, use the template directly and allow AnomieBOT to do the substitution:

Note that if you write this:

AnomieBOT will 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: ; when 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:  or  ; for those who desire to convert an ISBN10 to ISBN13, set 13; to convert an ISBN13 to ISBN10 set 10.  This parameter is ignored when the input is:
 * an SBN (9 digits)
 * an ISBN13 with a GS1 prefix of

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 has an incorrect check digit so the template returns its input unmodified:

When this template, using the same invalid ISBN, is enclosed in or, appropriate error messages are displayed by those templates:
 * ISBN
 * ISBN

Nota bene: Substitution will occur regardless of the validity of the input ISBN; previewing your edits is suggested.

More examples
ISBN13
 * → (13-digit input)
 * → (German ISBN starting with 978-3)
 * → (Italian ISBN starting with 978-88)
 * → (Italian ISBN starting with 979-12 )
 * → (13 digits with invalid hyphenation)

ISBN10
 * → (10-digit input )

SBN
 * → (9-digit (SBN) input)

Invalid input
 * → (ISBN with bad input length: not 10 or 13 digits)
 * → (9-digits with invalid check digit; possibly an invalid SBN check digit or an ISBN10 with a missing digit)
 * → (ISBN with invalid check digit: should be 8)
 * → (ISBN parameter containing text that is not an ISBN)
 * → (blank output from blank ISBN: no error message)
 * → (blank output from blank ISBN: no error message)

Using the optional parameters
 * → (Space character used as separator in output)
 * → (Convert ISBN13 to ISBN10)
 * → (Convert ISBN10 to ISBN13)
 * → (Convert ISBN10 to ISBN13 and with space character as separator)