1 |
#!/usr/local/bin/perl -w |
#!/usr/local/bin/perl -w |
2 |
|
|
3 |
use 5.006; # Is 5.8.0 needed for Unicode? |
use 5.008; |
4 |
use XML::Twig; |
use XML::Twig; |
5 |
use Getopt::Std; |
use Getopt::Std; |
6 |
use strict; |
use strict; |
7 |
|
|
8 |
my %opt; |
my %opt; |
9 |
getopt('de:i:', \%opt); |
getopts('de:i:', \%opt); |
10 |
|
|
11 |
# Debug: |
# Debug: |
12 |
my $DEBUG = 0; |
my $DEBUG = 0; |
25 |
} elsif ($opt{e} eq 'ascii') { |
} elsif ($opt{e} eq 'ascii') { |
26 |
($filter, $encoding) = ('safe_hex', 'US-ASCII'); |
($filter, $encoding) = ('safe_hex', 'US-ASCII'); |
27 |
} else { |
} else { |
28 |
warn "Unknown output encoding '$opt{e}'"; |
die "Unknown output encoding '$opt{e}'\n"; |
29 |
} |
} |
30 |
} |
} |
31 |
print STDERR "Output encoding: $encoding\n" if $DEBUG; |
print STDERR "Output encoding: $encoding\n" if $DEBUG; |
39 |
} elsif ($opt{i} eq 'latin1') { |
} elsif ($opt{i} eq 'latin1') { |
40 |
($accect8bit, $inputenc) = (1, 'latin1'); |
($accect8bit, $inputenc) = (1, 'latin1'); |
41 |
} else { |
} else { |
42 |
warn "Unknown input encoding '$opt{i}'"; |
die "Unknown input encoding '$opt{i}'\n"; |
43 |
} |
} |
44 |
} |
} |
45 |
print STDERR "Input encoding: $inputenc\n" if $DEBUG; |
print STDERR "Input encoding: $inputenc\n" if $DEBUG; |
592 |
|
|
593 |
=head1 SYNOPSIS |
=head1 SYNOPSIS |
594 |
|
|
595 |
bib2xml [-d] [-i input-encoding] [-e output-encoding] bibtex-datebase-filename |
bib2xml [-d] |
596 |
|
[-i input-encoding] |
597 |
|
[-e output-encoding] bibtex-datebase-filename |
598 |
|
|
599 |
=head1 DESCRIPTION |
=head1 DESCRIPTION |
600 |
|
|
601 |
bib2xml converts a BibTeX database (normally with the extension .bib) |
C<bib2xml> converts a BibTeX database (normally with the extension C<.bib>) |
602 |
to Bibulus XML. It does so by running BibTeX on the original database |
to Bibulus XML. It does so by running BibTeX on the original database |
603 |
with a special style file that generates XML instead of LaTeX output, |
with a special style file that generates XML instead of LaTeX output, |
604 |
cleaning it up a little afterwards. This means that you need to have |
cleaning it up a little afterwards. This means that you need to have |
605 |
a working BibTeX to run this program. |
a working BibTeX to run this program. |
606 |
|
|
607 |
The d options enables debugging information. |
The C<-d> option enables debugging information. |
608 |
|
|
609 |
Valid output encodings for the e option are utf8, latin1 and ascii. |
Valid output encodings for the C<-e> option are C<utf8>, C<latin1> and |
610 |
The default is utf8. |
C<ascii>. The default is C<utf8>. |
611 |
|
|
612 |
Valid input encodings for the i option are ascii and latin1. |
Valid input encodings for the C<-i> option are C<ascii> and C<latin1>. |
613 |
The default is ascii. |
The default is C<ascii>. |
614 |
|
|
615 |
=head1 SEE ALSO |
=head1 SEE ALSO |
616 |
|
|
617 |
The DTD is defined in doc/bibulus.dtd. |
The DTD is defined in F<doc/bibulus.dtd>. |
618 |
|
|
619 |
The homepage is |
The homepage is L<http://www.nongnu.org/bibulus/>. |
|
E<lt>http://www.nongnu.org/bibulus/E<gt>. |
|
620 |
|
|
621 |
=head1 AUTHOR |
=head1 AUTHOR |
622 |
|
|
623 |
Thomas M. Widmann, E<lt>twid@cpan.orgE<gt> |
Thomas M. Widmann, L<twid@cpan.org> |
624 |
|
|
625 |
=head1 COPYRIGHT AND LICENSE |
=head1 COPYRIGHT AND LICENSE |
626 |
|
|