3 |
use strict; |
use strict; |
4 |
use Bibulus::LaTeX; |
use Bibulus::LaTeX; |
5 |
|
|
6 |
my $DEBUG = 1; |
my $filename; |
7 |
print STDERR 'This is bibulustex $Id$; ', "\n" if $DEBUG; |
my $DEBUG = 0; |
|
Bibulus::LaTeX->setdebug; |
|
8 |
|
|
9 |
# If perl 5.8.0 is used, then |
my $bib = new Bibulus::LaTeX; |
10 |
|
$bib->inlinecrossref(2); |
11 |
|
|
12 |
|
# Parse command line: |
13 |
|
foreach (@ARGV) { |
14 |
|
if (/^--?min-crossrefs=(\d+)$/) { |
15 |
|
$bib->inlinecrossref($1); |
16 |
|
} elsif (/^--?terse$/) { |
17 |
|
$bib->verbose(0); |
18 |
|
} elsif (/^--?help$/) { |
19 |
|
usage(); |
20 |
|
} elsif (/^--?debug$/) { |
21 |
|
print STDERR 'This is bibulustex $Id$', "\n"; |
22 |
|
Bibulus::LaTeX->setdebug; |
23 |
|
} elsif (/^-/) { |
24 |
|
die "bibulustex: unrecognized option `$_'\nTry `bibulustex --help' for more information.\n"; |
25 |
|
} else { |
26 |
|
$filename = $_; |
27 |
|
} |
28 |
|
} |
29 |
|
|
30 |
|
# It would be possible to generate UTF-8 output by doing |
31 |
# binmode(STDOUT, ":utf8"); |
# binmode(STDOUT, ":utf8"); |
|
# will output in that character set (other modes are available, too). |
|
|
# Should this be used, or should we rather use our own mechanism? |
|
32 |
|
|
33 |
my $filename = shift @ARGV; |
$filename or die "bibulustex: Need exactly one file argument.\nTry `bibuluxtex --help' for more information.\n"; |
|
$filename or die "Usage: $0 filename\n"; |
|
34 |
|
|
|
my $bib = new Bibulus::LaTeX; |
|
35 |
$bib->procaux($filename); |
$bib->procaux($filename); |
36 |
open (BBL, ">$filename.bbl") or die "Could not write $filename.bbl.\n"; |
open (BBL, ">$filename.bbl") or die "Could not write $filename.bbl.\n"; |
37 |
print BBL $bib->getbib; |
print BBL $bib->getbib; |
38 |
close BBL; |
close BBL; |
39 |
|
|
40 |
|
sub usage { |
41 |
|
print <<"EOT;"; |
42 |
|
Usage: bibulustex [OPTION]... AUXFILE[.aux] |
43 |
|
Write bibliography for entries in AUXFILE to AUXFILE.bbl. |
44 |
|
|
45 |
|
-min-crossrefs=NUMBER include item after NUMBER cross-refs; default 2 |
46 |
|
-terse do not print progress reports |
47 |
|
-help display this help and exit |
48 |
|
-version output version information and exit |
49 |
|
-debug print debugging information while running |
50 |
|
|
51 |
|
Email bug reports to twid\@cpan.org |
52 |
|
EOT; |
53 |
|
exit 0; |
54 |
|
} |
55 |
|
|
56 |
exit 0; |
exit 0; |
57 |
|
|
58 |
__END__ |
__END__ |
63 |
|
|
64 |
=head1 SYNOPSIS |
=head1 SYNOPSIS |
65 |
|
|
66 |
bibulustex latexfile |
bibulustex [OPTION]... AUXFILE[.aux] |
67 |
|
|
68 |
=head1 DESCRIPTION |
=head1 DESCRIPTION |
69 |
|
|
70 |
Reads an aux file generated by LaTeX and one or more bibliography |
Write bibliography for entries in AUXFILE to AUXFILE.bbl. |
|
files in XML format and outputs a bbl file. |
|
71 |
|
|
72 |
=head1 BUGS |
-min-crossrefs=NUMBER include item after NUMBER cross-refs; default 2 |
73 |
|
-terse do not print progress reports |
74 |
|
-help display this help and exit |
75 |
|
-version output version information and exit |
76 |
|
-debug print debugging information while running |
77 |
|
|
78 |
BibTeX's command-line options -min-crossrefs and -terse are not |
=head1 BUGS |
|
supported yet. |
|
79 |
|
|
80 |
The output is not yet identical to what BibTeX would produce, |
The output is not yet identical to what BibTeX would produce, |
81 |
but that is really the fault of Bibulus.pm and LaTeX.pm, |
but that is really the fault of Bibulus.pm and LaTeX.pm, |
83 |
|
|
84 |
=head1 SEE ALSO |
=head1 SEE ALSO |
85 |
|
|
86 |
The homepage is |
The homepage is E<lt>http://www.nongnu.org/bibulus/E<gt>. |
|
E<lt>http://www.nongnu.org/bibulus/E<gt>. |
|
87 |
|
|
88 |
=head1 AUTHOR |
=head1 AUTHOR |
89 |
|
|