LUA-URI-URN-ISBN(3)

πŸ“¦
version 0.1+20130926+git14fa255d Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing

πŸ’– LUA-URI-URN-ISBN(3) πŸ’–

okay bestie, gather round, because this is the lua-uri-urn-isbn page from the Lua uri.urn.isbn module and it is genuinely so useful. no cap. πŸŽ€


✨ Name ✨

lua-uri-urn-isbn β€” ISBN URN support for the Lua URI library. that's it, that's the whole vibe. πŸ¦‹


🌸 Description 🌸

so the class uri.urn.isbn is the one you want for URNs with the NID isbn, aka every URI that starts with urn:isbn:. and the way it does that? it inherits from the uri.urn class. iconic behavior, honestly. πŸ‘‘

now here's the tea β˜• β€” some of what this class can do depends on whether the lua-isbn(3) module is installed. you can use it without it, but the vibes differ, so let me break it down:

  • if lua-isbn(3) is installed β†’ full checksum validation of the ISBN gets performed. the real deal. πŸ”₯
  • if it's not installed β†’ the ISBN is only checked for invalid characters. that's it, bestie, that's all we got. 😭

and the normalization? also depends:

  • with lua-isbn installed β†’ the ISBN value is normalized to include hyphens in the conventional places (and lowkey, the exact hyphen positions depend on the number itself, so don't come for me about it).
  • without it β†’ all hyphens are just removed instead. poof. gone. πŸ’¨

one more lil detail: if the ISBN ends in a checksum of 'x', it gets folded to uppercase. periodt. πŸ’…


🌈 Methods 🌈

every single method defined in lua-uri(3) and lua-uri-urn(3) is supported, bestie β€” all of them, we're not leaving anyone behind. and on top of those, you also get these two absolute queens:

  • uri:isbn(...) β€” 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 that library is not installed, or if the object you supplied isn't a valid ISBN object. (and jsyk, it will currently accept a string, but you should not rely on that β€” it's giving undefined behavior energy, so don't do it. πŸ™ˆ)
  • uri:isbn_digits(...) β€” 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 you're providing a new value, it must not be nil, and it will be validated in the normal way β€” which means an exception if it's invalid. no shortcuts, no exceptions to the exception. πŸ’€


🧚 References 🧚

this implements the 'isbn' NID defined in "RFC 3187", and it's consistent with the same NID suggested in "RFC 2288". we're standards-compliant AND cute. 🌟


πŸ’œ so yeah, that's the whole page. go forth and URN responsibly.

version 1.1, dated 2012-00-00 β€” shoutout to the LUA-URI-URN-ISBN(3) manual page for the lore, mwah, bye bestie 🫢✨

πŸ“¦ where this page comes from