autoexpanding links to the isbn: psuedo-scheme

i just added a tiny little feature to my weblog software to auto-expand links created using an isbn: scheme (such as <a href="isbn:1584790830">i'm just here for the food</a>) to an affiliate link to an online retailer (b&n right now, easy enough to change in the future).

just something for those thinking about ways to play with moveable type's upcoming text formatting features. mix with the amazon web services, and you could pretty easily have a page that listed information about all of the books you've mentioned.

i do actually cheat a bit right now, and the conversion happens when stuffing the entry into the database. but they end up in a regular format, so it will be easy enough to change the old entries when i work up the initiative to make the filtering happen on the output side.

if only the music and film businesses had universal identifiers for their products that worked like isbns.

i've got something similar that turns ampersands (&) into the correct entity, even when i don't type them that way (or there are ampersands in urls that i cut&paste into place). just part of keeping my site validating as xhtml 1.0 strict.

« january 5, 2003 4:25pmjanuary 6, 2003 5:21pm »

comments

"i've got something similar that turns ampersands (&) into the correct entity, even when i don't type them that way (or there are ampersands in urls that i cut&paste into place). just part of keeping my site validating as xhtml 1.0 strict."

What's that if you don't mind my asking?

» bofe (link) » january 5, 2003 5:04pm

just this code in my posting form that turns ampersands that don't appear to be part of an entity (named or numbered) already into "&amp;":

$entry = preg_replace("/&(?!(\w+|#\d+);)/", "&amp;", $entry);
» jim (link) » january 5, 2003 5:35pm

this entry is closed to new comments.