« あー決めた | main | [reminder]1.0.0リリース »

5分スクリプト その1

iPaperの出力をbioinformatics reference形式に変換
こいつを使ってリジェクト食らっても責任持てません :)

refcvs2html

#!/usr/bin/perl

print << "EOF";
<html>
<head>
<title>ref html</title>
</head>
<body>
EOF


while(<>){
chomp;
next if($_ eq '');
my ($authors, $title, $else) = split /¥", ¥"/, $_;
$authors =‾ s/^¥"//g;
my ($journal, $year, $volume, $void, $pages) = split /, /, $else;
$journal =‾ s/¥"$//g;
my @author = split /, /, $authors;
my $ret_author = undef;
if(!exists $author[2]){
$ret_author = "$author[0],$author[1]."
}elsif(!exists $author[4]){
$ret_author = "$author[0],$author[1]. and $author[2],$author[3].";
}else{
$ret_author = "$author[0],$author[1]. <i>et al</i>.";
}
print <<"EOF";
$ret_author ($year) $title <I>$journal</I>, <B>$volume</B>, $pages<br>
EOF
}


print << "EOF";
</body>
</html>
EOF

upしてからちょっとマズい所をいくつか書き直しました。

トラックバック

このエントリーのトラックバックURL:
http://polog.org/mt-tb.cgi/198

コメント (2)

まちがいまくってたくせに.
えらそうな.

あ、ページとJounal略称か。
それはNCBI MEDLINEに文句言って下さいよう。て言うか、すいません。

コメントを投稿

Powered by
Movable Type 3.34