| 1 | # $Id: APP.pm,v 1.2 2007-01-26 13:53:47 mike Exp $ | ||
| 2 | |||
| 3 | package Keystone::Resolver::plugins::Citation::APP; | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | |||
| 8 | |||
| 9 | sub citation { | ||
| 10 | my $class = shift(); | ||
| 11 | my($openurl) = @_; | ||
| 12 | |||
| 13 | my($genre, $aulast, $auinit, $date, $atitle, $jtitle, $volume, | ||
| 14 | $spage, $epage, $btitle, $pub, $place) | ||
| 15 | = map { $openurl->rft($_) } | ||
| 16 | qw(genre aulast auinit date atitle jtitle volume spage | ||
| 17 | epage btitle pub place); | ||
| 18 | |||
| 19 | $aulast ||= "[Unspecified author]"; | ||
| 20 | $auinit ||= $openurl->rft("aufirst"); | ||
| 21 | $date ||= "[unspecified date]"; | ||
| 22 | $atitle ||= "[unspecified article title]"; | ||
| 23 | $volume ||= "[unspecified volume]"; | ||
| 24 | |||
| 25 | my $name; | ||
| 26 | if (defined $auinit) { | ||
| 27 | $auinit =~ s/\.$//; | ||
| 28 | $name = "$aulast, $auinit"; | ||
| 29 | } else { | ||
| 30 | $name = "$aulast"; | ||
| 31 | } | ||
| 32 | |||
| 33 | if (defined $genre && $genre eq "book") { | ||
| 34 | my $text = "$name. $date. $btitle."; | ||
| 35 | $text .= " $pub." if defined $pub; | ||
| 36 | $text .= " $place." if defined $place; | ||
| 37 | return ($text, "text/html"); | ||
| 38 | } | ||
| 39 | |||
| 40 | if (!defined $jtitle) { | ||
| 41 | my $issn = $openurl->rft("issn"); | ||
| 42 | if (defined $issn) { | ||
| 43 | $jtitle = "ISSN $issn"; | ||
| 44 | } else { | ||
| 45 | $jtitle = "[unspecified journal]"; | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | my $text = "$name. $date. $atitle. <i>$jtitle</i>, $volume"; | ||
| 50 | if (defined $spage && defined $epage) { | ||
| 51 | $text .= ": $spage-$epage"; | ||
| 52 | } elsif (defined $spage) { | ||
| 53 | $text .= ": $spage ff."; | ||
| 54 | } elsif (defined $epage) { | ||
| 55 | $text .= ": to $epage"; | ||
| 56 | } | ||
| 57 | |||
| 58 | return ("$text.", "text/html"); | ||
| 59 | } | ||
| 60 | |||
| 61 | |||
| 62 | 1; |