File: biber

package info (click to toggle)
biber 2.21-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,476 kB
  • sloc: perl: 17,643; sh: 1,069; xml: 896; makefile: 11
file content (1068 lines) | stat: -rwxr-xr-x 37,806 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
#!/usr/bin/perl -w

use v5.24;
use strict;
use warnings;
use utf8;
use FindBin;
use lib $FindBin::RealBin;

use constant {
  EXIT_OK => 0,
  EXIT_ERROR => 2
};

use Carp;
use IPC::Cmd qw( can_run run );
use Log::Log4perl qw(:no_extra_logdie_message);
use Log::Log4perl::Level;
use POSIX qw(strftime);

use Biber;
use Biber::Utils;
use Biber::CodePage qw( :DEFAULT );
use Encode;

use File::Spec;
use Pod::Usage;
use List::AllUtils qw( first );
use Unicode::Normalize qw(NFC);

use Getopt::Long qw/:config no_ignore_case/;
my %collateoptions = (); # This is a special case
my $opts = {'collate_options' => \%collateoptions};
GetOptions(
           $opts,
           'annotation_marker|annotation-marker=s',
           'bibencoding=s', # legacy alias for input_encoding
           'bblencoding=s', # legacy alias for output_encoding
           'bblsafechars',  # legacy alias for output_safechars
           'bblsafecharsset=s', # legacy alias for output_safecharsset
           'cache',
           'clrmacros',
           'collate_options|collate-options|c=s',
           'configfile|g=s',
           'convert_control|convert-control',
           'debug|D',
           'decodecharsset=s',
           'dieondatamodel',
           'dot_include|dot-include:s@',
           'fastsort|f', # does nothing now
           'fixinits',
           'glob_datasources|glob-datasources',
           'help|h|?',
           'input_directory|input-directory=s',
           'input_encoding|input-encodinge=s',
           'input_format|input-format=s',
           'isbn10',
           'isbn13',
           'isbn_normalise|isbn-normalise',
           'listsep=s',
           'logfile=s',
           'mincrossrefs|m=s',
           'named_annotation_marker|named-annotation-marker=s',
           'namesep=s',
           'no_bblxml_schema|no-bblxml-schema',
           'no_bltxml_schema|no-bltxml-schema',
           'noconf',
           'no_default_datamodel|no-default-datamodel',
           'nodieonerror',
           'nolog',
           'nostdmacros',
           'onlylog',
           'others_string|others-string=s',
           'outfile=s',           # legacy alias for output_file
           'outformat=s',         # legacy alias for output_format
           'output_align|output-align',
           'output_all_macrodefs|output-all-macrodefs',
           'output_annotation_marker|output-annotation-marker=s',
           'output_directory|output-directory=s',
           'output_encoding|output-encoding|E=s',
           'output_fieldcase|output-fieldcase=s',
           'output_field_order|output-field-order=s',
           'output_field_replace|output-field-replace=s',
           'output_file|output-file|O=s',
           'output_format|output-format=s',
           'output_indent|output-indent=s',
           'output_legacy_dates|output-legacy-dates',
           'output_listsep|output-listsep=s',
           'output_macro_fields|output-macro-fields=s',
           'output_named_annotation_marker|output-named-annotation-marker=s',
           'output_namesep|output-namesep=s',
           'output_no_macrodefs|output-no-macrodefs',
           'output_resolve|output-resolve',
           'output_resolve_xdata|output-resolve-xdata',
           'output_resolve_crossrefs|output-resolve-crossrefs',
           'output_resolve_sets|output-resolve-sets',
           'output_safechars|output-safechars',
           'output_safecharsset|output-safecharsset=s',
           'output_xdatamarker|output-xdatamarker=s',
           'output_xdatasep|output-xdatasep=s',
           'output_xname|output-xname',
           'output_xnamesep|output-xnamesep=s',
           'quiet|q+',
           'recodedata=s',
           'noremove_tmp_dir|noremove-tmp-dir',
           'noskipduplicates',
           'noxname',
           'show_tmp_dir|show-tmp-dir',
           'sortdebug',
           'sortcase=s',
           'sortlocale|l=s',
           'sortupper=s',
           'ssl-nointernalca',
           'ssl-noverify-host',
           'strip_comments|strip-comments',
           'tool',
           'tool_align|tool-align',                 # legacy alias for output_align
           'tool_config|tool-config',
           'tool_fieldcase|tool-fieldcase=s',       # legacy alias for output_fieldcase
           'tool_noremove_missing_dependants|tool-noremove-missing-dependants',
           'tool_indent|tool-indent=s',             # legacy alias for output_indent
           'tool_resolve|tool-resolve',             # legacy alias for output_resolve
           'trace|T',
           'u',                   # alias for input_encoding=UTF-8
           'U',                   # alias for output_encoding=UTF-8
           'validate_bblxml|validate-bblxml',
           'validate_bltxml|validate-bltxml',
           'validate_config|validate-config',
           'validate_control|validate-control',
           'validate_datamodel|validate-datamodel|V',
           'version|v',
           'winunicode|W',
           'wraplines|w:80',
           'xdatamarker=s',
           'xdatasep=s',
           'xnamesep=s',
           'xsvsep=s',
          ) or pod2usage(-verbose => 0,
                         -exitval => EXIT_ERROR);

# verbose > 1 uses external perldoc, this doesn't work with PAR::Packer binaries
# so use "-noperldoc" to use built-in POD::Text
if (exists $opts->{'help'}) {
  pod2usage(-verbose => 2, -noperldoc => 1, -exitval => EXIT_OK);
}

if (exists $opts->{'version'}) {
  my $v = "biber version: $Biber::Config::VERSION";
  $v .= ' (beta)' if $Biber::Config::BETA_VERSION;
  say "$v";
  exit EXIT_OK;
}

# Show location of PAR::Packer cache
if (exists $opts->{'cache'}) {
  if (my $cache = $ENV{PAR_TEMP}) {
    $cache =~ s|//|/|og; # Sanitise path in case it worries people
    say $cache;
  }
  else {
    say "No cache - you are not running the PAR::Packer executable version of biber";
  }
  exit EXIT_OK;
}

# Show location of default tool mode config file and exit
if (exists $opts->{'tool_config'}) {
  (my $vol, my $dir, undef) = File::Spec->splitpath( $INC{"Biber/Config.pm"} );
  $dir =~ s/\/$//; # splitpath sometimes leaves a trailing '/'
  say File::Spec->catpath($vol, "$dir", 'biber-tool.conf');
  exit EXIT_OK;
}

# Catch this situation early
unless (@ARGV) {
  pod2usage(-verbose => 0,
            -exitval => EXIT_ERROR);
}

# Resolve some option shortcuts and legacy aliases
if (my $o = $opts->{tool_align}) {
  $opts->{output_align} = $o;
  delete $opts->{tool_align};
}
if (my $o = $opts->{tool_fieldcase}) {
  $opts->{output_fieldcase} = $o;
  delete $opts->{tool_fieldcase};
}
if (my $o = $opts->{tool_indent}) {
  $opts->{output_indent} = $o;
  delete $opts->{tool_indent};
}
if (my $o = $opts->{tool_resolve}) {
  $opts->{output_resolve} = $o;
  delete $opts->{tool_resolve};
}
if (my $o = $opts->{bibencoding}) {
  $opts->{input_encoding} = $o;
  delete $opts->{bibencoding};
}
if (my $o = $opts->{bblencoding}) {
  $opts->{output_encoding} = $o;
  delete $opts->{bblencoding};
}
if (my $o = $opts->{bblsafechars}) {
  $opts->{output_safechars} = $o;
  delete $opts->{bblsafechars};
}
if (my $o = $opts->{bblsafecharsset}) {
  $opts->{output_safecharsset} = $o;
  delete $opts->{bblsafecharsset};
}
if (my $o = $opts->{outfile}) {
  $opts->{output_file} = $o;
  delete $opts->{outfile};
}
if (my $o = $opts->{outformat}) {
  $opts->{output_format} = $o;
  delete $opts->{outformat};
}
if ($opts->{u}) {
  $opts->{input_encoding} = 'UTF-8';
  delete $opts->{u};
}
if ($opts->{U}) {
  $opts->{output_encoding} = 'UTF-8';
  delete $opts->{U};
}

# Break up resolve meta-option
if (exists($opts->{output_resolve})) {
  $opts->{output_resolve_xdata} = 1;
  $opts->{output_resolve_crossrefs} = 1;
  $opts->{output_resolve_sets} = 1;
  delete $opts->{output_resolve};
}

# Legacy warnings
if ($opts->{output_macro_fields}) {
  say STDERR "Biber: Deprecated option 'output-macro-fields' - no longer needed as macros are auto-detected on output";
}

# Check the output_format option
if (my $of = $opts->{output_format}) {
  unless ($opts->{output_format} =~ /\A(?:bbl|dot|bibtex|biblatexml|bblxml|bibjson)\z/xms) {
    say STDERR "Biber: Unknown output format '$of', must be one of 'bbl', 'dot', 'bibtex', 'biblatexml', 'bblxml', 'bibjson'";
    exit EXIT_ERROR;
  }
  if ($opts->{output_format} eq 'bblxml' or $opts->{output_format} eq 'dot') {
    say STDERR "Biber: Deprecated output format '" . $opts->{output_format} . "' - this will be removed in a future version";
  }
}

# Auto-detect input-format from extension if not given
if (exists($opts->{tool}) and
    not exists($opts->{input_format})) {
  if ($ARGV[0] =~ m/\.bib$/) {
    $opts->{input_format} = 'bibtex';
  }
  elsif ($ARGV[0] =~ m/\.bltxml$/) {
    $opts->{input_format} = 'biblatexml';
  }
}

# Check output-format value
if (exists($opts->{tool}) and
    exists($opts->{output_format}) and
    $opts->{output_format} !~ /\A(?:bibtex|biblatexml|bibjson)\z/xms) {
    say STDERR "Biber: Output format in tool mode must be one of 'bibtex', 'biblatexml' or 'bibjson'";
    exit EXIT_ERROR;
}

# Set default output format
if (not exists($opts->{output_format})) {
  if (exists($opts->{tool})) {
    $opts->{output_format} = 'bibtex'; # default for tool mode is different
  }
  else {
    $opts->{output_format} = 'bbl'; # default for normal use
  }
}

# Check ISBN options
if (exists($opts->{isbn10}) and exists($opts->{isbn13})) {
  say STDERR "Biber: Select only one of 'isbn10' or 'isbn13' but not both";
  exit EXIT_ERROR;
}

# Check the tool_* options
if (exists($opts->{output_indent}) and $opts->{output_indent} !~ /^\d+t?$/) {
  say STDERR "Biber: Invalid non-numeric argument for 'output_indent' option!";
  exit EXIT_ERROR;
}
if (exists($opts->{output_fieldcase}) and $opts->{output_fieldcase} !~ /^(?:upper|lower|title)$/i) {
  say STDERR "Biber: Invalid argument for 'output_fieldcase' option - must be one of 'upper', 'lower' or 'title'!";
  exit EXIT_ERROR;
}

# Check the dot_include option
if (exists($opts->{dot_include}) and (not exists($opts->{output_format})
                                      or (exists($opts->{output_format}) and
                                          $opts->{output_format} ne 'dot'))) {
  say STDERR "Biber: DOT output format specified but output format is not DOT!";
  exit EXIT_ERROR;
}


if (exists($opts->{dot_include})) {
  $opts->{dot_include} = {map {lc($_) => 1} split(/,/,join(',',@{$opts->{dot_include}}))};
  my @suboptions = ( 'section', 'field', 'crossref', 'xref', 'xdata', 'related' );
  foreach my $g (keys $opts->{dot_include}->%*) {
    unless (first {$_ eq lc($g)} @suboptions) {
      say STDERR "Biber: '$g' is an invalid output type for DOT output";
      exit EXIT_ERROR;
    }
  }
}

# Check input_format option
if (exists($opts->{input_format}) and not exists($opts->{tool}) ) {
  say STDERR "Biber: 'input_format' option is only valid in tool mode";
  exit EXIT_ERROR;
}

if (exists($opts->{input_format}) and
    $opts->{input_format} !~ /^(?:bibtex|biblatexml|)$/i) {
  say STDERR 'Biber: ' . $opts->{input_format} . ' is an invalid input format in tool mode';
  exit EXIT_ERROR;
}

# Create Biber object, passing command-line options
my $biber = Biber->new($opts->%*);

# get the logger object
my $logger  = Log::Log4perl::get_logger('main');
my $screen  = Log::Log4perl::get_logger('screen');
my $logfile = Log::Log4perl::get_logger('logfile');

my $outfile;

my $time_string = strftime "%a %b %e, %Y, %H:%M:%S", localtime;
$logfile->info("=== $time_string");

my $bcf = Biber::Config->getoption('bcf');

if (Biber::Config->getoption('output_file')) {
  $outfile = decode_CS_system( Biber::Config->getoption('output_file') );
}
else {
  if (Biber::Config->getoption('tool')) {
    if (Biber::Config->getoption('output_format') eq 'bibtex') { # tool .bib output
      $outfile = $ARGV[0] =~ s/\.[^.]+$/_bibertool.bib/r;
    }
    elsif (Biber::Config->getoption('output_format') eq 'biblatexml') { # tool .blxtxml output
      $outfile = $ARGV[0] =~ s/\.[^.]+$/_bibertool.bltxml/r;
    }
    elsif (Biber::Config->getoption('output_format') eq 'bibjson') { # bibjson output
      $outfile = $ARGV[0] =~ s/\.[^.]+$/_bibertool.json/r;
    }
  }
  else {
    if (Biber::Config->getoption('output_format') eq 'dot') { # .dot output
      $outfile = $bcf =~ s/bcf$/dot/r;
    }
    elsif (Biber::Config->getoption('output_format') eq 'bibtex') { # bibtex output
      $outfile = $bcf =~ s/\..+$/_biber.bib/r;
    }
    elsif (Biber::Config->getoption('output_format') eq 'bbl') { # bbl output
      $outfile = $bcf =~ s/bcf$/bbl/r;
    }
    elsif (Biber::Config->getoption('output_format') eq 'bblxml') { # bblxml output
      $outfile = $bcf =~ s/bcf$/bblxml/r;
    }
    else {
      say "output_format option '" . Biber::Config->getoption('output_format') . "' only makes sense in tool mode (--tool)";
      exit EXIT_ERROR;
    }
  }
}

# Set the .bbl path to the output dir, if specified
if (my $outdir = Biber::Config->getoption('output_directory')) {
  my (undef, undef, $file) = File::Spec->splitpath($outfile);
  $outfile = File::Spec->catfile($outdir, $file)
}

# Set the output class. Should be a subclass of Biber::Output::base
my $package = 'Biber::Output::' . Biber::Config->getoption('output_format');
eval "require $package" or biber_error("Error loading data source package '$package': $@");
$biber->set_output_obj(eval "${package}->new()");

# Get reference to output object
my $biberoutput = $biber->get_output_obj;

# Set the output filename and get ref to output object This has to come
# before .bcf parsing so that we can detect .bcf parsing errors
# early and clean up
$biberoutput->set_output_target_file($outfile);

# Fake some necessary .bcf parts if in tool mode
if (exists($opts->{tool})) {
  $biber->tool_mode_setup;
}
else {
  # parse the .bcf control file.
  # This sets the 'tool' option for non-tool
  # mode bibtex output and so don't use Biber::Config::getoption('tool')
  # after this when we need to know if --tool was specified on the command
  # line
  $biber->parse_ctrlfile($bcf);
}

# Reset output filename now we have the output coding from the .bcf
# because set_output_target_file() sets output encoding from information in .bcf
my $outfileobj = $biberoutput->set_output_target_file($outfile, 1);

# Postprocess biber options now that they are all read from the various places
Biber::Config->postprocess_biber_opts;

# Set the output target obj
# Must come after ctrlfile/option parsing otherwise output encoding is not set
$biberoutput->set_output_target($outfileobj);

# Check to see if the .bcf set debug=1. If so, increase logging level
# We couldn't set this on logger init as the .bcf hadn't been read then
if (Biber::Config->getoption('debug')) {
  $logger->level($DEBUG);
}

if (Biber::Config->getoption('trace')) {
  $logger->trace("\n###########################################################\n",
    "############# Dump of initial config object: ##############\n",
    Data::Dump::pp($Biber::Config::CONFIG), "\n",
    "############# Dump of initial biber object: ###############\n",
    $biber->_stringdump,
    "\n###########################################################")
}

# Do all the real work
exists($opts->{tool}) ? $biber->prepare_tool : $biber->prepare;

if (Biber::Config->getoption('trace')) {
  $logger->trace("\n###########################################################\n",
    "############# Dump of final config object: ################\n",
    Data::Dump::pp($Biber::Config::CONFIG), "\n",
    "############# Dump of final biber object: #################\n",
    $biber->_stringdump,
    "\n###########################################################")
}

# Write the output to the target
$biberoutput->output;

$biber->display_end;

exit EXIT_OK;

__END__

=pod

=encoding utf8

=head1 NAME

C<biber> - A bibtex replacement for users of biblatex

=head1 SYNOPSIS

  biber [options] file[.bcf]
  biber [options] --tool <datasource>

  Creates "file.bbl" using control file "file.bcf" (".bcf" extension is
  optional). Normally use with biblatex requires no options as they are
  all set in biblatex and passed via the ".bcf" file

  In "tool" mode (see B<--tool> option), takes a datasource (defaults to
  "bibtex" datasource) and outputs a copy of the datasource with any command-line
  or config file options applied.

  Please run "biber --help" for option details

=head1 DESCRIPTION

C<biber> provides a replacement of the bibtex processor for users of biblatex.

=head1 OPTIONS

=over 4

=item B<--annotation-marker=[marker]>

Sets the suffix which can be appended to a BibTeX data source field name to
indicate that the value of the field is a data annotation. The default is C<+an>.

=item B<--cache>

If running as a PAR::Packer binary, show the cache location and exit.

=item B<--clrmacros>

Clears any BibTeX macros (@STRING) between BibLaTeX refsections. This prevents
BibTeX warnings about macro redefinitions if you are using the same datasource
several times for different refsections.

=item B<--collate-options|-c [options]>

Options to pass to the C<Unicode::Collate> object used for sorting (default is
"--collate-options level=4 --collate-options variable='non-ignorable'"). See
C<perldoc Unicode::Collate> for details.

=item B<--configfile|-g [file]>

Use F<file> as the configuration file for C<biber> instead of looking in
the default locations which are, in order:

* C<biber.conf> or C<.biber.conf> in the current directory

* C<$HOME/.biber.conf>

* C<$ENV{XDG_CONFIG_HOME}/biber/biber.conf>

* C<$HOME/.config/biber/biber.conf>

* C<$HOME/Library/biber/biber.conf> (Mac OSX only)

* C<$ENV{APPDATA}/biber.conf> (Windows only)

* The output of C<kpsewhich biber.conf> (if available on the system).

In tool mode, (B<--tool>) the F<biber-tool.conf> installed with Biber is
always used to set default options if a user-defined config file is not
specified. Use the B<--tool-config> option to view the location of the
default tool mode config file which may be useful as a source for writing
your own.

=item B<--convert-control>

Converts the F<.bcf> control file into html using an XSLT transform. Can
be useful for debugging. File is named by appending C<.html>
to F<.bcf> file.

=item B<--decodecharsset=[recode set name]>

The set of characters included in the conversion routine when decoding
LaTeX macros into UTF-8 (which happens when B<--bblencoding|-E> is set to
UTF-8). Set to "full" to try harder with a much larger set or "base" to
use a smaller basic set. Default is "base". You may want to try "full"
if you have less common UTF-8 characters in your data source. The recode
sets are defined in the reencoding data file which can be customised.
See the B<--recodedata> option and the PDF manual. The virtual set name "null"
may be specified which effectively turns off macro decoding.

=item B<--debug|-D>

Turn on debugging for C<biber>.

=item B<--dieondatamodel>

Exit immediately with error if using C<--validate-datamodel> and a datamodel validation
error is found. Default is to warn and continue.

=item B<--dot-include=section,field,xdata,crossref,xref,related>

Specifies the element to include in GraphViz DOT output format if the output format is 'dot'.
You can also choose to display crossref, xref, xdata and/or related entry connections.
The default if not specified is C<--dot-include=section,xdata,crossref,xref>.

=item B<--fixinits>

Try to fix broken multiple initials when they have no space between them in BibTeX
data sources. That is, "A.B. Clarke" becomes "A. B. Clarke" before name parsing.
This can slightly mess up things like "{U.K. Government}" and other esoteric cases.

=item B<--help|-h>

Show this help message.

=item B<--input-directory [directory]>

F<.bcf> and data files will be looked for first in the F<directory>. See the biber
PDF documentation for the other possibilities and how this interacts with the
C<--output-directory> option.

=item B<--input-encoding|-e [encoding]>

Specify the encoding of the data source file(s). Default is "UTF-8"
Normally it's not necessary to set this as it's passed via the
.bcf file from biblatex's C<bibencoding> option.
See "perldoc Encode::Supported" for a list of supported encodings.
The legacy option B<--bibencoding> is supported as an alias.

=item B<--input-format=bibtex|biblatexml>

Biber input format. This option only means something in tool mode (see B<tool> option) since
normally the input format of a data source is specified in the F<.bcf> file and
therefore from the B<\addbibresouce> macro in BibLaTeX.
The default value when in tool mode is 'bibtex'

=item B<--isbn10>

Force all ISBNs to 10-digit versions on output. This will convert the ISBN internally to an ISBN
object which will not have hyphens on output. If you use this option and want an ISBN with hyphens
in the correct place on output, use the B<--isbn-normalise> option.

=item B<--isbn13>

Force all ISBNs to 13-digit versions on output. This will convert the ISBN internally to an ISBN
object which will not have hyphens on output. If you use this option and want an ISBN with hyphens
in the correct place on output, use the B<--isbn-normalise> option.

=item B<--isbn-normalise>

Normalise ISBNs with hyphens in the correct places on output.

=item B<--logfile [file]>

Use F<file.blg> as the name of the logfile.

=item B<--listsep=[sep]>

Use F<sep> as the separator for BibTeX data source list fields. Defaults to BibTeX's usual
'and'.

=item B<--mincrossrefs|-m [number]>

Set threshold for crossrefs.

=item B<--named-annotation-marker=[marker]>

Sets the separator between the C<--annotation-marker> and the name of a
named annotation. The default is C<:>.

=item B<--namesep=[sep]>

Use F<sep> as the separator for BibTeX data source name fields. Defaults to BibTeX's usual
'and'.

=item B<--no-bblxml-schema>

When writing bblxml output, don't generate an RNG XML schema from the data model.

=item B<--no-bltxml-schema>

When reading or writing biblatexml data sources, don't generate an RNG XML schema from the data
model.

=item B<--noconf>

Don't look for a configfile.

=item B<--no-default-datamodel>

Do not load the default datamodel coming from either the F<.bcf> or, when
in tool mode, from the default tool mode config file. Use of this option
implies that you will provide a complete datamodel in a config file. This
option is useful when you wish to make major modifications to the datamodel
because the simple add/modify operations to the default datamodel via a user
config file are not enough. For example, to remove things from the default
datamodel, you would use this option and supply a complete, reduced
datamodel in the user config file.

=item B<--nodieonerror>

Don't exit on errors, just log and continue as far as possible.
This can be useful if the error is something from, for example, the underlying
BibTeX parsing C library which can complain about parsing errors which can be ignored.

=item B<--glob-datasources>

By default, glob (expand according to pattern) any data source filenames.
Allows data sources to be specified like B<*.bib> to load all B<.bib> files
in a directory. Can be overridden on a per-dataource basis with the B<glob>
option to B<\addbibresource> in biblatex.

=item B<--nolog>

Do not write any logfile.

=item B<--noskipduplicates>

Don't skip duplicate bibliography keys if found. The detection of duplicate keys is done across
all data sources. Sometimes you might need duplicates when using several data sources
across several refsections in which case you might need to use this option.

=item B<--nostdmacros>

Don't automatically define any standard macros like month abbreviations.
If you also define these yourself, this option can be used to suppress
macro redefinition warnings.

=item B<--noremove-tmp-dir>

Do not remove the temporary directory used for various intermediate files
and data before exit (default is false). Name of the directory can
be obtained with the B<--show-tmp-dir> option.

=item B<--noxname>

Disable extended name processing in bibtex data sources. Can be useful if
you don't use this and it causes problems due to auto-detection of extended
name format.

=item B<--onlylog>

Do not write any message to screen.

=item B<--others-string=[string]>

Use F<string> as the final name in a name field which implies "et al". Defaults to BibTeX's usual
'others'.

=item B<--output-align>

Align field values in neat columns in output. Effect depends on the output format. Default is false.
The legacy option B<--tool-align> is supported as an alias.

=item B<--output-all-macrodefs>

When outputting bibtex format, whether to output all found macro (@STRING
entries) definitions rather than just definitions for macros which are
actually used in the output entries. Default is false.

=item B<--output-annotation-marker=[marker]>

As B<--annotation-marker> but for tool mode bibtex output. The default is C<+an>.

=item B<--output-named-annotation-marker=[marker]>

As B<--named-annotation-marker> but for tool mode bibtex output. The default is C<:>.

=item B<--output-directory [directory]>

Output files (including log files) are output to F<directory> instead
of the current directory. Input files are also looked for in F<directory>
before current directory unless C<--input-directory> is also specified in which
case input files are only looked for in the directory specified by C<--input-directory>.

=item B<--output-encoding|-E [encoding]>

Specify the encoding of the output C<.bbl> file. Default is "UTF-8".
Normally it's not necessary to set this as it's passed via the
.bcf file from biblatex's C<texencoding> option.
See C<perldoc Encode::Supported> for a list of supported encodings.
The legacy option B<--bblencoding> is supported as an alias.

=item B<--output-fieldcase=upper|lower|title>

Case for field names output. Effect depends on the output format. Defaults to 'upper'.
The legacy option B<--tool-fieldcase> is supported as an alias.

=item B<--output-field-order=[field1, ... fieldn]>

When outputting bibtex format data in tool mode, this option allows the customisation
of the order of fields within entries. The value is a comma-separated string of field names
or classes of fields. Fields not mentioned in the list are output in sorted name order after
the explicitly specified fields. The classes of fields are:

'names' - All name list fields
'lists' - All non-name list fields
'dates' - All date fields

By default, its value is 'options,abstract,names,lists,dates'.

=item B<--output-field-replace=[field1:replacefield1, ... fieldn:replacefieldn]>

When outputting bibtex format output C<replacefieldn> instead of C<fieldn>.
This can be used to output legacy formats which undo the default driver
source map e.g
B<--output-field-replace=location:address,journaltitle:journal>. See
B<--output-legacy-dates> if legacy (YEAR/MONTH) date fields are required in
bibtex format output.

=item B<--output-file|-O [file]>

Output to F<file> instead of F<basename.bbl> F<file> is relative to
B<--output-directory>, if set (absolute paths in this case are stripped to
filename only). F<file> can be absolute if B<--output-directory> is not
set. F<file> can be '-' to output directly to STDOUT. The legacy option
B<--outfile> is supported as an alias.

=item B<--output-format=dot|bibtex|biblatexml|bbl|bblxml|bibjson>

Biber output format. Default if not specified is of course, F<bbl>. Use F<dot>
to output a GraphViz DOT file instead of F<.bbl>. This is a directed graph of
the bibliography data showing entries and, as requested, sections and fields.
You must process this file with C<dot>, e.g. C<dot -Tsvg test.dot -o test.svg> to
render the graph. See the B<--dot-include> option to select what is included in
the DOT output. F<bblxml> is an XML version of the F<bbl> format which you could
transform using XSLT. By default, when outputting F<bblxml>, a RelaxNG XML schema
is generated from the active data model and saved with a F<rng> extension along
with the output file name (unless the B<--no-bblxml-schema> option is specified). You
may validate the F<bblxml> using the schema with the B<--validate-bblxml> option.
The legacy option B<--outformat> is supported as an alias.

=item B<--output-indent=[num][t]>

Indentation for body of entries in output. Effect depends on the output
format. Defaults to 2. The C<num> can be followed by C<'t'> to specify tabs
instead of spaces. The legacy option B<--tool-indent> is supported as an
alias.

=item B<--output-legacy-dates>

When outputting bibtex format, output YEAR/MONTH fields instead of DATE.
This is not possible if the input is not convertible to legacy format,
meaning that any date to be output with legacy fields can only have a YEAR
part and perhaps a MONTH part. If a DAY or ENDYEAR part are found, the date
is not convertible and the legacy output format will be skipped. Default is
false.

=item B<--output-listsep=[sep]>

As B<--listsep> but for tool mode bibtex output. Defaults to BibTeX's usual
'and'.

=item B<--output-namesep=[sep]>

As B<--namesep> but for tool mode bibtex output. Defaults to BibTeX's usual
'and'.

=item B<--output-no-macrodefs>

When outputting BibTeX format, don't output macro definitions (@STRING entries).
You might not want to output macro definitions if you keep them in a
separate file.

=item B<--output-resolve>

Convenience option to set all of the B<--output-resolve-*> options to
'true'. The legacy option B<--tool-resolve> is supported as an alias.

=item B<--output-resolve-xdata>

Whether to resolve XDATA inheritance in tool mode or when
B<--output-format=bibtex> in non tool mode. Defaults to 'false'.

=item B<--output-resolve-crossrefs>

Whether to resolve CROSSREF/XREF inheritance in tool mode or when
B<--output-format=bibtex> in non tool mode. Defaults to
'false'.

=item B<--output-resolve-sets>

Whether to resolve data sets in tool mode or when
B<--output-format=bibtex> in non tool mode. Defaults to 'false'.

=item B<--output-safechars>

Try to convert UTF-8 chars into LaTeX macros when writing the output.
This can prevent unknown char errors when using PDFLaTeX and inputenc
as this doesn't understand all of UTF-8. Note, it is better to switch
to XeTeX or LuaTeX to avoid this situation. By default uses the
--output-safecharsset "base" set of characters.
The legacy option B<--bblsafechars> is supported as an alias.

=item B<--output-safecharsset=[recode set name]>

The set of characters included in the conversion routine for
B<--output-safechars>. Set to "full" to try harder with a much
larger set or "base" to use a basic set. Default is "base" which is
fine for most use cases. You may need to load more macro packages to
deal with the results of "full" (Dings, Greek characters, special
symbols etc.). The recode sets are defined in the reencoding data file which
can be customised. See the B<--recodedata> option and the PDF manual.
The legacy option B<--bblsafecharsset> is supported as an alias. The
virtual set name "null" may be specified which effectively turns off macro encoding.

=item B<--output-xdatamarker=[marker]>

As B<--xdatamarker> but for tool mode output. Default is 'xdata'.

=item B<--output-xdatasep=[sep]>

As B<--xdatasep> but for tool mode output. Default is '-'.

=item B<--output-xname>

When output is a .bib BibTeX file in tool mode, whether to output names the
eXtended BibTeX name field format.

=item B<--output-xnamesep=[sep]>

As B<--xnamesep> but for tool mode bibtex output. Default is '='.

=item B<--quiet|-q>

Log only errors. If this option is used more than once, don't even log errors.

=item B<--recodedata=[file]>

The data file to use for the reencoding between UTF-8 and LaTeX macros. It defines
the sets specified with the B<--output-safecharsset> and B<--decodecharsset> options.
It defaults to F<recode_data.xml> in the same directory as Biber's F<Recode.pm> module.
See the PDF documentation for the format of this file. If this option is
used, then F<file> should be somewhere C<kpsewhich> can find it.

=item B<--show-tmp-dir>

Prints the location of the temporary directory used for various intermediate
files and data. Only useful if B<--noremove-tmp-dir> is set to true.

=item B<--sortdebug>

Add comments to output with sorting keys. Useful for debugging.

=item B<--sortcase=true|false>

Case-sensitive sorting (default is true).

=item B<--sortlocale|-l [locale]>

Set the locale to be used for sorting. The locale is used to add CLDR
tailoring to the sort (if available for the locale).

=item B<--sortupper=true|false>

Whether to sort uppercase before lowercase when sorting (default is true).

=item B<--ssl-nointernalca>

Don't try to use the default Mozilla CA certificates when using HTTPS to fetch remote data.
This assumes that the user will set one of the perl LWP::UserAgent module environment variables
to find the CA certs.

=item B<--ssl-noverify-host>

Turn off host verification when using HTTPS to fetch remote data sources.
You may need this if the SSL certificate is self-signed for example.

=item B<--strip-comments>

In tool mode, strip all comments from the output file.

=item B<--tool>

Run in tool mode. This mode is datasource centric rather than document centric. biber
reads a datasource (and a config file if specified), applies the command-line and config
file options to the datasource and writes a new datasource. Essentially,
this allows you to change your data sources using biber's transformation options (such as
source mapping, sorting etc.)

=item B<--tool-config>

Show the location of the default tool mode config file and exit. Useful when you need to
copy this file and customise it.

=item B<--tool-noremove-missing-dependants>

Use this option in tool mode if you don't want to remove C<XREF>,
C<CROSSREF> and C<XDATA> fields from the output which point to a missing
entry. Useful if you have split datafiles where the e.g. C<CROSSREF>s are
in another file that you are not including in the tool mode run.

=item B<--trace|-T>

Turn on tracing. Also turns on B<--debug|-D> and additionally provides a lot of low-level tracing
information in the log.

=item B<-u>

Alias for B<--input-encoding=UTF-8>

=item B<-U>

Alias for B<--output-encoding=UTF-8>

=item B<--validate-bblxml>

Schema validate bblXML output against a schema auto-generated from the BibLaTeX
datamodel. The schema will be auto-generated with the name of the F<.bbl> file with a F<.rng>
extension. The generated schema can be kept and used with standard XML editors to validate the
output during XSL development.

=item B<--validate-bltxml>

Schema validate BibLaTeXML datasources against a schema auto-generated from the BibLaTeX
datamodel. The schema will be auto-generated with the name of the F<.bcf> file with a F<.rng>
extension. The generated schema can be kept and used with standard XML editors to validate the
datasource during datasource development. The schema validation does not validate all
semantic aspects of the datamodel (i.e. the data model constraints)---for this use the
C<--validate-datamodel> option.

=item B<--validate-config>

Schema validate the biber config file.

=item B<--validate-control>

Schema validate the F<.bcf> biblatex control file.

=item B<--validate-datamodel|-V>

Validate the data against a data model. By default, the data model used is
the one in the F<.bcf> file (normal mode) or in the default config file
whose path can be shown with the C<--tool-config> option (tool mode). Use
C<--no-default-datamodel> to ignore the default data model completely if
you are using a complete data model via your own config file
(with C<--configfile>).

=item B<--version|-v>

Display version number.

=item B<--winunicode|-W>

In Windows 10 1803+, turning on the 'Use Unicode UTF8 for worldwide
language support' option makes Windows use UTF-8 instead of UTF-16 for many
system APIs. If that option is enabled, use this option to turn off biber's
UTF-16 filename support on Windows. This will result in much improved
handling of Unicode filenames.

=item B<--wraplines|-w=[column]>

Wrap lines in the F<.bbl> file (or output F<.bib> file in tool mode) at column
F<column> (default 80).

=item B<--xdatamarker=[marker]>

Use F<marker> as the string before C<--xdatasep> which introduces an XDATA
reference in BibTeX format data sources. Not used in BibLaTeXML data
sources as it has a dedicated XML attribute C<xdata>' for this. Default is
'xdata'.

=item B<--xdatasep=[sep]>

Use F<sep> as the separator between XDATA sub-entry parts
in the eXtended name format. See biber docs. Default is '-'.

=item B<--xnamesep=[sep]>

Use F<sep> as the separator between namepart names and the namepart values
in the eXtended name format. Also applies to XDATA references as the
separator between C<--xdatamarker> and the XDATA reference. See biber docs.
Default is '='.

=item B<--xsvsep=[sep]>

Use F<sep> as the separator for fields of format type "xsv" in the data model. A Perl regexp can be specified. Defaults to a single comma surround by optional whitespace (\s*,\s*).

=back

=head1 AUTHOR

Philip Kime, C<Philip at kime.org.uk>

=head1 BUGS & DOCUMENTATION

To see the full documentation, run B<texdoc biber> or get the F<biber.pdf>
manual from SourceForge.

Please report any bugs or feature requests on our Github tracker at
L<https://github.com/plk/biber/issues>.

=head1 COPYRIGHT & LICENSE

Copyright 2009-2012 François Charette and Philip Kime, all rights reserved.
Copyright 2012-2025 Philip Kime, all rights reserved.

This module is free software.  You can redistribute it and/or
modify it under the terms of the Artistic License 2.0.

This program is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.

=cut