Template:Book title/doc

This template uses the Google Books API to retrieve and display a book title (and subtitle if one exists) for a given ISBN (International Standard Book Number).

It is designed to work with the  produced by Special:BookSources. That page removes punctuation from the supplied ISBN before generating, so this template does not need to handle punctuated or other formatted ISBN numbers.

This template uses JavaScript, supplied by Widget:Book title, to manage the connection to the Google Books API. Book titles are retrieved asynchronously, and after the page has loaded.

Usage
Invoke with:

Parameters:
 * isbn: The ISBN for which the title is needed. Must be supplied. Should be a valid 10 character or 13 character ISBN.
 * loading: Value to show during the Google Books API retrieval. Optional. Default is Loading ....

Parameters may also be supplied by position, in the order shown above. This template may be transcluded multiple times on a single page. ISBNs are checked for basic formatting. That is: The final character is a check digit. It must be present, but is not validated. If full validation is required, callers should validate ISBNs before transcluding this template.
 * it must be 10 or 13 characters long after removing any existing hyphen or space formatting; and
 * for 13 character ISBNs, all the characters must be digits, and it must start with 978 or 979.
 * for 10 character ISBNs, all the characters except the final one must be digits, and the final character must be either a digit or X.

Limitations
Book titles are retrieved locally by the browser, and only after the page has loaded. Wikitext and the MediaWiki framework therefore have no visibility of the book title itself, only the code that retrieves it.

For example, book titles retrieved by this template cannot be used in headings, because they will not be resolved at the time the page's table of contents is constructed. This means that == Information about == will not work as expected. Similarly, will not create the expected HTML fragment identifier.

If the Google Books API receives too many requests in a given amount of time, Google throttles it ("rate limiting"). This means that the number of book titles that can be retrieved by a single page before API requests are refused will have an upper limit. Additionally, Widget:Book title times out any title requests that could not be satisfied within five seconds.

In practice, Bogleheads:Book sources (invoked by Special:BookSources) transcludes this template once only, and cannot be reloaded by the browser sufficiently quickly to trigger Google Books API throttling.