lua-uri-urn-isbn(3) ISBN URN support for Lua URI library


The class "uri.urn.isbn" is used for URNs with the NID 'isbn', that is, URIs which begin "urn:isbn:". It inherits from the uri.urn class.

Some of the functionality of this class depends on the lua-isbn(3) module being installed, although it can be used without that. In particular, if the module is installed then full checksum validation of the ISBN is performed, whereas without it the ISBN is only checked for invalid characters. The ISBN value is normalized to include hyphens in the conventional places if the lua-isbn module is installed (the exact hyphen positions depend on the number), but without it all hyphens are removed instead. If the ISBN ends in a checksum of 'x', then it folded to uppercase.


All the methods defined in lua-uri(3) and lua-uri-urn(3) are supported, as well as the following:
Get or set the ISBN value as an object of the type provided by the "isbn" class in the lua-isbn(3) library. This method will throw an exception if this library is not installed, or if the object supplied is not a valid ISBN object (it will currently accept a string, but you shouldn't rely on this).
Get or set the ISBN value as a string containing just the numbers (and possibly an 'X' as the last digit). There will be no hyphens in this value, and it should be exactly 10 or 13 characters long.

If a new value is provided then it must not be nil, and will be validated in the normal way, causing an exception if it is invalid.


This implements the 'isbn' NID defined in ``RFC 3187'', and is consistent with the same NID suggested in ``RFC 2288''.