[Wikipedia-l] Re: ISBN links
Larry Olin Horn
hornlo at lohnet.org
Wed Aug 22 03:37:21 UTC 2001
[I've had this in my pending folder since the 16th. Forgot about it until I saw JW's post, so it doesn't sound like a direct reply.]
This is trivial compared to most of the requested features, but
I'm submitting it as a trial baloon, so to speak,
the idea being that some sample code might be more encouraging
that just saying "I want this feature" w/o giving any thought
to how it might work.
Really, I just want to know if submissions like this are acceptible,
or if you'd rather not bother with them.
One request was that the ISBN links be more explicit, so here's
the skeleton of a solution.
First, the ISBNLink function in wiki.cgi is simplifed (first
enclosure below); it just creates a link to an external script
that looks like
<a href="/cig-bin/isbn.cgi?nnnnnnnnnn">ISBN nnnnnnnnn</a>
The external isbn.cgi script (DEMO below) produces a page that
looks like:
(standard header here)
global explanation blah blah blah ....
Barnes and Noble - blah blah blah ...
Amazon - blah blah blah ...
Pricescan - blah blah blah ...
(standard footer here)
where the company names are the links to their respective ISBN
lookups and the "blah blah blah" is whatever fixed disclaimer/writeup
that Wikipedia/Bomis wants to use.
Being the lazy guy that I am, the proper coding of isbn.cgi for
security and your local standards is left for someone else (grin).
loh
[this is UseMod 0.92; I've not downloaded the Wikipedia tarball]
---------- replacement for ISBNLink() ----------
sub ISBNLink {
my ($rawnum) = @_;
my ($rawprint, $html, $num, $first, $second, $third);
$num = $rawnum;
$rawprint = $rawnum;
$rawprint =~ s/ +$//;
$num =~ s/[- ]//g;
if (length($num) != 10) {
return "ISBN $rawnum";
}
# LOH: begin modification
# replace direct ISBN links with external script
#
# $first = "<a href=\"http://shop.barnesandnoble.com/bookSearch/"
# . "isbnInquiry.asp?isbn=$num\">";
# $second = "<a href=\"http://www.amazon.com/exec/obidos/"
# . "ISBN=$num\">" . T('Amazon') . "</a>";
# $third = "<a href=\"http://www.pricescan.com/books/"
# . "BookDetail.asp?isbn=$num\">" . T('PriceScan') . "</a>";
# $html = $first . "ISBN " . $rawprint . "</a> ";
# $html .= "($second, $third)";
#
$html = "<a href=\"/cgi-bin/isbn.cgi?$num\">ISBN $rawprint</a>";
#
# LOH: end modification
$html .= " " if ($rawnum =~ / $/); # Add space if old ISBN had space.
return $html;
}
---------- cut here ----------
---------- isbn.cgi ----------
#! perl
##### WARNING: CONCEPT DEMO ONLY - THIS IS NOT GOOD CODE! #####
$query = $ENV{'QUERY_STRING'};
print "Content-type: text/html\n\n";
print "<html>";
print "<head><title>Look up ISBN $query</title></head>";
print "<body>\n";
print "<p><i>standard header here</i></p>\n";
print "global explanation blah blah blah ....</p>\n";
print "<p>";
print "<b><a href=\"http://shop.barnsandnoble.com/bookSearch/isbnInquiry.asp?isbn=$query\">Barnes and Noble</a></b> - ";
print "blah blah blah ...";
print "</lp>\n";
print "<p>";
print "<b><a href=\"http://www.amazon.com/exec/obidos/ISBN=$query\">Amazon</a></b> - ";
print "blah blah blah ...";
print "</p>\n";
print "<p>";
print "<b><a href=\"http://www.pricescan.com/books/BookDetail.asp?isbn=$query\">Pricescan</a></b> - ";
print "blah blah blah ...";
print "</p>";
print "<p><i>standard footer here</i></p>\n";
print "</body>";
print "</html>\n";
__END__
# end
---------- cut here ----------
More information about the Wikipedia-l
mailing list