#648205 build bibtex database

#648205#5
Date:
2011-11-09 15:40:47 UTC
From:
To:
Hi Iustin,

it's me again. :-) I'll cite a lot of rfcs in my bachelor thesis and found a
script that builds a bibtex database from the RFC index. Maybe this script
could be run during package build and the bibtex files become part of the
binary packages.

http://www.educatedguesswork.org/xml2bibtex

I'll ask the author of the script about the license stuff. If I'd know perl,
I'd hack together an own version.

Regards,

Thomas Koch

*** xml2bibtex
#!/usr/bin/perl
# Convert the RFC Editor's XML RFC index into a BibTex format

$file=$ARGV[0];
die("Input file must have a .xml extension") unless $file=~/(.*)\.xml$/;

if($#ARGV==0){
  $output_file="$1.bib";
}
elsif($#ARGV==1){
  $output_file=$ARGV[1];
}
else{
  &usage;
}

use XML::Simple qw(:strict);
my $db=XMLin($file,forcearray=>[qw(rfc-entry author)],keyattr => [] );

open(OUT,">$output_file")||die("Couldn't open output file $output_file for writing: $!");

$rfc_entry=$db->{'rfc-entry'};

foreach my $entry (@$rfc_entry){
  $rfc_id=$entry->{'doc-id'};
  die("bad format") unless $rfc_id=~/^RFC0*(\d+)$/;
  $rfc_number="RFC $1";
  $rfc_title=$entry->{'title'};
  $rfc_year=$entry->{'date'}->{'year'};
  $rfc_month=$entry->{'date'}->{'month'};
  $rfc_day=$entry->{'date'}->{'day'};

  @rfc_authors=();

  foreach my $author (@{$entry->{'author'}}) {
    push(@rfc_authors,$author->{'name'});
  }
  $rfc_authors=join(" and ",@rfc_authors);

print OUT <<FOO;
\@misc{$rfc_id,
  author = {$rfc_authors},
  title = {{$rfc_title}},
  howpublished = {$rfc_number},
  month = {$rfc_month},
  year = {$rfc_year}
}

FOO

}

exit(0);

sub usage {
  print <<FOO;
xml2bibtex: convert the RFC Editor's XML RFC index into a BibTex format

usage: xml2bibtex <input-file> [<output-file>]
FOO
}
iQIcBAEBCAAGBQJOup74AAoJEAf8SJEEK6ZaNo8P/RQycdgawPvBtdPtz5dABj71
OeLKKytZUSBakyfs/91OQb7e/FNBZ3Y8SWGd8lflX5aiguTw2i73ti0TDP23n8/t
VUPTFwfRI4l73oBU+pmQ8vdFhui80TQ8Los98d28T+UUpe4ECbgNDAn/h5uyrmVN
USifN8Xw/WV4WGsZXvFecZxh1sdvgFRL4Ia9Vzn4D6n1vB2Yg/loJ4Aqi77uyNuu
B9WuzVmXTHs+5RJV7GjCdqjlhEjyUXt+B+yvqeMs6VT1hOx9s0Wq3NnVsRYP/zJ2
tqWi1zinvOaAIMxhCme3/xjw95UUF24r4y1fDqd/qOXjiHcee4Rq326U3DoYnwY+
u9O1PSCK7m7sz8tZY851Pl2G1alZu9BGT2bU1GxvkGasiIRqEZuDG/kgkjEFkSzG
8FIgUYeKeEEKiNymmP+L/OwiRayr/mmzHIlEtWF1KAWQvWUuJITJzZEFEVKLH1uX
zdeyZkPhpMFX2EmS83/8vDZ+rBjWYQL+NRhpLl9qjJkKttGhXaQ0Qyy7oGfBzRH/
cr4VvZd40o5hRm4VWhYQDA57XDKljE3j2FX2/Trqsg/N6wIN4YDar8UliCOQ+XAV
ZebNMp7RRUWYm4XHZ3/TjocMzctuHKIpknEtpgyVl/qJ9q8nil+gKaUBwqZRtXH5
SguaBOgZBxK4U5Qap6nh
=AuzC
-----END PGP SIGNATURE-----

#648205#10
Date:
2011-11-09 15:46:58 UTC
From:
To:
Hi Mr. Rescorla,

Debian has a package containing all RFC documents. I'd like to use your
script[1] to build bibtex files for them. Could you be so kind and reply to
this mail (also to the Debian Bug[2]), explaining that you're OK with us to
use the script and under which license?

Thank you very much!

[1] http://www.educatedguesswork.org/xml2bibtex
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648205

Thomas Koch, http://www.koch.ro