From adac48cfc4efd9fdcdec5c8780fcd8a8fbcaa504 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 11 Dec 2017 22:25:02 +0000 Subject: bibtexperllibs (10dec17) git-svn-id: svn://tug.org/texlive/trunk@46044 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/support/bibtexperllibs/BibTeXParser.3pm | 8 +-- .../support/bibtexperllibs/BibTeXParserAuthor.3pm | 8 +-- .../support/bibtexperllibs/BibTeXParserEntry.3pm | 36 +++++++++-- .../scripts/bibtexperllibs/BibTeX/Parser.pm | 14 +++- .../scripts/bibtexperllibs/BibTeX/Parser/Author.pm | 4 +- .../scripts/bibtexperllibs/BibTeX/Parser/Entry.pm | 75 +++++++++++++++++++--- .../support/bibtexperllibs/BibTeX-Parser/Changes | 42 +++++++----- .../support/bibtexperllibs/BibTeX-Parser/MANIFEST | 3 + .../support/bibtexperllibs/BibTeX-Parser/META.yml | 2 +- .../bibtexperllibs/BibTeX-Parser/Makefile.PL | 2 +- .../support/bibtexperllibs/BibTeX-Parser/README | 4 +- .../support/bibtexperllibs/BibTeX-Parser/dist.ini | 2 +- .../BibTeX-Parser/t/03-parse_entry.t | 39 ++++++++++- .../bibtexperllibs/BibTeX-Parser/t/09-complex.t | 3 +- .../bibtexperllibs/BibTeX-Parser/t/10-funnyname.t | 1 + .../bibtexperllibs/BibTeX-Parser/t/14-extratext.t | 65 +++++++++++++++++++ .../BibTeX-Parser/t/15-capitalization.t | 72 +++++++++++++++++++++ .../BibTeX-Parser/t/bibs/14-extratext.bib | 22 +++++++ .../BibTeX-Parser/t/bibs/english.bib | 2 +- .../source/support/bibtexperllibs/Makefile | 2 +- .../source/support/bibtexperllibs/README | 4 +- 21 files changed, 352 insertions(+), 58 deletions(-) create mode 100644 Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/14-extratext.t create mode 100644 Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/15-capitalization.t create mode 100644 Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/14-extratext.bib (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/support/bibtexperllibs/BibTeXParser.3pm b/Master/texmf-dist/doc/support/bibtexperllibs/BibTeXParser.3pm index e9e99917d2b..d6fe7d17b46 100644 --- a/Master/texmf-dist/doc/support/bibtexperllibs/BibTeXParser.3pm +++ b/Master/texmf-dist/doc/support/bibtexperllibs/BibTeXParser.3pm @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) +.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== @@ -132,8 +132,8 @@ .rm #[ #] #H #V #F C .\" ======================================================================== .\" -.IX Title "BibTeX::Parser 3pm" -.TH BibTeX::Parser 3pm "2017-03-18" "perl v5.20.2" "User Contributed Perl Documentation" +.IX Title "BibTeX::Parser 3" +.TH BibTeX::Parser 3 "2017-12-09" "perl v5.18.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -200,7 +200,7 @@ BibTeX::Parser::Entry BibTeX::Parser::Author .SH "VERSION" .IX Header "VERSION" -version 1.00 +version 1.01 .SH "AUTHOR" .IX Header "AUTHOR" Gerhard Gossen and diff --git a/Master/texmf-dist/doc/support/bibtexperllibs/BibTeXParserAuthor.3pm b/Master/texmf-dist/doc/support/bibtexperllibs/BibTeXParserAuthor.3pm index 9f110b2aea5..33d0126d325 100644 --- a/Master/texmf-dist/doc/support/bibtexperllibs/BibTeXParserAuthor.3pm +++ b/Master/texmf-dist/doc/support/bibtexperllibs/BibTeXParserAuthor.3pm @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) +.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== @@ -132,8 +132,8 @@ .rm #[ #] #H #V #F C .\" ======================================================================== .\" -.IX Title "BibTeX::Parser::Author 3pm" -.TH BibTeX::Parser::Author 3pm "2017-03-18" "perl v5.20.2" "User Contributed Perl Documentation" +.IX Title "BibTeX::Parser::Author 3" +.TH BibTeX::Parser::Author 3 "2017-12-09" "perl v5.18.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -203,7 +203,7 @@ tokens are considered von parts: \f(CW\*(C`von\*(C'\fR, \f(CW\*(C`\eNOOP{von}Vo the following token is not: \f(CW\*(C`{von}\*(C'\fR .SH "VERSION" .IX Header "VERSION" -version 1.00 +version 1.01 .SH "AUTHOR" .IX Header "AUTHOR" Gerhard Gossen and diff --git a/Master/texmf-dist/doc/support/bibtexperllibs/BibTeXParserEntry.3pm b/Master/texmf-dist/doc/support/bibtexperllibs/BibTeXParserEntry.3pm index fa22741db96..c91647d5544 100644 --- a/Master/texmf-dist/doc/support/bibtexperllibs/BibTeXParserEntry.3pm +++ b/Master/texmf-dist/doc/support/bibtexperllibs/BibTeXParserEntry.3pm @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) +.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== @@ -132,8 +132,8 @@ .rm #[ #] #H #V #F C .\" ======================================================================== .\" -.IX Title "BibTeX::Parser::Entry 3pm" -.TH BibTeX::Parser::Entry 3pm "2017-03-18" "perl v5.20.2" "User Contributed Perl Documentation" +.IX Title "BibTeX::Parser::Entry 3" +.TH BibTeX::Parser::Entry 3 "2017-12-09" "perl v5.18.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -216,19 +216,41 @@ Returns a list of all the fields used in this entry. .SS "has($fieldname)" .IX Subsection "has($fieldname)" Returns a true value if this entry has a value for \f(CW$fieldname\fR. +.SS "pre ()" +.IX Subsection "pre ()" +Return the text in BibTeX file before the entry .SS "raw_bibtex ()" .IX Subsection "raw_bibtex ()" Return raw BibTeX entry (if available). .SS "to_string ([options])" .IX Subsection "to_string ([options])" -Returns a text of the BibTeX entry in BibTeX format. Options is -a hash. Currently only the option \f(CW\*(C`canonize_names\*(C'\fR -is supported. If true (the default), authors' and editors' +Returns a text of the BibTeX entry in BibTeX format. Options are +a hash. +.ie n .IP """canonize_names""" 4 +.el .IP "\f(CWcanonize_names\fR" 4 +.IX Item "canonize_names" +If true (the default), authors' and editors' names are translated into canonical bibtex form. The command \&\f(CW\*(C`$entry\->to_string(canonize_names=>0)\*(C'\fR overrides this behavior. +.ie n .IP """field_capitalization""" 4 +.el .IP "\f(CWfield_capitalization\fR" 4 +.IX Item "field_capitalization" +Capitalization of the field names. +Can take values 'Uppercase', 'Lowercase' (the default) or 'Titlecase' +.ie n .IP """print_pre""" 4 +.el .IP "\f(CWprint_pre\fR" 4 +.IX Item "print_pre" +False by default. If true, the text in the Bib file before the +entry is printed. Note that at present we assume the text +before the entry \s-1NEVER\s0 has the @ symbol inside +.ie n .IP """type_capitalization""" 4 +.el .IP "\f(CWtype_capitalization\fR" 4 +.IX Item "type_capitalization" +Capitalization of the type names. +Can take values 'Uppercase' (the default), 'Lowercase' or 'Titlecase' .SH "VERSION" .IX Header "VERSION" -version 1.00 +version 1.01 .SH "AUTHOR" .IX Header "AUTHOR" Gerhard Gossen and diff --git a/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser.pm b/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser.pm index 3439d274139..27cb9145829 100644 --- a/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser.pm +++ b/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser.pm @@ -1,6 +1,6 @@ package BibTeX::Parser; { - $BibTeX::Parser::VERSION = '1.00'; + $BibTeX::Parser::VERSION = '1.01'; } # ABSTRACT: A pure perl BibTeX parser use warnings; @@ -73,6 +73,14 @@ sub _parse_next { pos($_) = $position; } + # Remember text before the entry + my $pre = substr($_, 0, $start_pos-1); + if ($start_pos == 0) { + $pre = ''; + } + $current_entry->pre($pre); + + # Remember raw bibtex code my $raw = substr($_, $start_pos); $raw =~ s/^\s+//; @@ -141,7 +149,7 @@ sub next { return $self->_parse_next; } -# slurp everything till the next closing brace. Handels +# slurp everything till the next closing brace. Handles # nested brackets sub _slurp_close_bracket { my $bracelevel = 0; @@ -337,7 +345,7 @@ L =head1 VERSION -version 1.00 +version 1.01 =head1 AUTHOR diff --git a/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser/Author.pm b/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser/Author.pm index 181de2ed775..a0ffb455be4 100644 --- a/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser/Author.pm +++ b/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser/Author.pm @@ -1,6 +1,6 @@ package BibTeX::Parser::Author; { - $BibTeX::Parser::Author::VERSION = '1.00'; + $BibTeX::Parser::Author::VERSION = '1.01'; } use warnings; @@ -393,7 +393,7 @@ the following token is not: C<{von}> =head1 VERSION -version 1.00 +version 1.01 =head1 AUTHOR diff --git a/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser/Entry.pm b/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser/Entry.pm index af3d32f5e5a..6d3b0ec81a8 100644 --- a/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser/Entry.pm +++ b/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser/Entry.pm @@ -1,6 +1,6 @@ package BibTeX::Parser::Entry; { - $BibTeX::Parser::Entry::VERSION = '1.00'; + $BibTeX::Parser::Entry::VERSION = '1.01'; } use warnings; @@ -216,17 +216,39 @@ sub raw_bibtex { return $self->{_raw}; } +sub pre { + my $self = shift; + if (@_) { + $self->{_pre} = shift; + } + return $self->{_pre}; +} + + sub to_string { my $self = shift; my %options=@_; if (!exists($options{canonize_names})) { $options{canonize_names}=1; } - my @fields = grep {!/^_/} keys %$self; + my @fields = grep {!/^_/} keys %$self; @fields = sort { $self->{_fieldnums}->{$a} <=> $self->{_fieldnums}->{$b}} @fields; - my $result = '@'.$self->type."{".$self->key.",\n"; + my $result = ''; + if ($options{print_pre}) { + $result .= $self->pre()."\n"; + } + my $type = $self->type; + if (exists($options{type_capitalization})) { + if ($options{type_capitalization} eq 'Lowercase') { + $type = lc $type; + } + if ($options{type_capitalization} eq 'Titlecase') { + $type = ucfirst lc $type; + } + } + $result .= '@'.$type."{".$self->key.",\n"; foreach my $field (@fields) { my $value = $self->field($field); if ($field eq 'author' && $options{canonize_names}) { @@ -237,7 +259,15 @@ sub to_string { my @names = ($self->editor); $value = join(' and ', @names); } - $result .= " $field = {"."$value"."},\n"; + if (exists($options{field_capitalization})) { + if ($options{field_capitalization} eq 'Uppercase') { + $field = uc $field; + } + if ($options{field_capitalization} eq 'Titlecase') { + $field = ucfirst $field; + } + } + $result .= " $field = {"."$value"."},\n"; } $result .= "}"; return $result; @@ -343,22 +373,49 @@ Returns a list of all the fields used in this entry. Returns a true value if this entry has a value for $fieldname. +=head2 pre () + +Return the text in BibTeX file before the entry + =head2 raw_bibtex () Return raw BibTeX entry (if available). =head2 to_string ([options]) -Returns a text of the BibTeX entry in BibTeX format. Options is -a hash. Currently only the option C -is supported. If true (the default), authors' and editors' +Returns a text of the BibTeX entry in BibTeX format. Options are +a hash. + +=over 4 + +=item C + +If true (the default), authors' and editors' names are translated into canonical bibtex form. The command C<$entry-Eto_string(canonize_names=E0)> overrides this behavior. -=head1 VERSION +=item C + +Capitalization of the field names. +Can take values 'Uppercase', 'Lowercase' (the default) or 'Titlecase' + +=item C -version 1.00 +False by default. If true, the text in the Bib file before the +entry is printed. Note that at present we assume the text +before the entry NEVER has the @ symbol inside + +=item C + +Capitalization of the type names. +Can take values 'Uppercase' (the default), 'Lowercase' or 'Titlecase' + + +=back + +=head1 VERSION +version 1.01 =head1 AUTHOR diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/Changes b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/Changes index a7724c0541a..cdcb9b93984 100644 --- a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/Changes +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/Changes @@ -1,13 +1,21 @@ Revision history for BibTeX-Parser +1.01 2017-11-19 03:12:34 +0000 + New options for to_string: + - print_pre - whether to print text preceding the entry + - type_capitalization ('Uppercase', 'Lowercase', + 'Titlecase') + - field_capitalization ('Uppercase', 'Lowercase', + 'Titlecase') + 1.00 2017-03-18 21:53:15+00:00 - Typo corrected: editors -> editor + Typo corrected: editors -> editor 0.70 2016-11-23 02:28:35+00:00 Compatibility with perl 5.25 (Alexandr Ciornii) 0.69 2016-03-24 15:13:50-04:00 - Added option canonize_names to Entry::to_string + Added option canonize_names to Entry::to_string 0.68 2016-03-10 13:45:31-05:00 Now we preserve the order of entries @@ -21,13 +29,13 @@ Revision history for BibTeX-Parser No Do not remove braces from the authors' names 0.65 2013-09-03 21:04:43 - Add links in documentation. + Add links in documentation. 0.64 2012-03-10 22:23:50 Remove a warning about undefined value. 0.63 2011-03-15 23:08:18 - Parse files with errors (no keys, spaces in wrong positions). Bug #66325 + Parse files with errors (no keys, spaces in wrong positions). Bug #66325 0.62 2010-10-15 08:52:53 Declare Test::More minimum version with done_testing @@ -43,27 +51,27 @@ Revision history for BibTeX-Parser Do not attempt to clean up returned values Author names with braces are split correctly -0.4 2010-02-09 - Parsing of quoted author names (e.g. "{Foo and Bar, Inc.}") +0.4 2010-02-09 + Parsing of quoted author names (e.g. "{Foo and Bar, Inc.}") -0.3.2 2009-07-26 - Removed dependency on Text::Balanced +0.3.2 2009-07-26 + Removed dependency on Text::Balanced 0.3.1 2009-07-19 - No changes, removed huge test file from dist + No changes, removed huge test file from dist 0.3 2009-07-18 - Better parsing of author names, - new Method B::P::Entry->raw_bibtex - Removed Module::Install from package + Better parsing of author names, + new Method B::P::Entry->raw_bibtex + Removed Module::Install from package -0.21 2009-01-23 - Fixed errors in synopsis. +0.21 2009-01-23 + Fixed errors in synopsis. -0.2 2008-12-30 - First public release. +0.2 2008-12-30 + First public release. -0.1 2008-03-14 +0.1 2008-03-14 First version, internal diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/MANIFEST b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/MANIFEST index 7896b2c5165..ec2f7719ea8 100644 --- a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/MANIFEST +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/MANIFEST @@ -23,10 +23,13 @@ t/10-funnyname.t t/11-split_braced.t t/12-von_token.t t/13_output.t +t/14-extratext.t +t/15-capitalization.t t/bibs/01.bib t/bibs/06.bib t/bibs/09-complex.bib t/bibs/10-funnyname.bib +t/bibs/14-extratext.bib t/bibs/braces.bib t/bibs/endnote.txt t/bibs/engineering_village.txt diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/META.yml b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/META.yml index dafdba5d3d9..1196376ffbc 100644 --- a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/META.yml +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/META.yml @@ -20,4 +20,4 @@ requires: IO::String: 0 LaTeX::ToUnicode: 0.02 Test::More: 0 -version: 1.00 +version: 1.01 diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/Makefile.PL b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/Makefile.PL index b2007039082..41a067a8b34 100644 --- a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/Makefile.PL +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/Makefile.PL @@ -29,7 +29,7 @@ my %WriteMakefileArgs = ( "TEST_REQUIRES" => { "Test::More" => "0.88" }, - "VERSION" => "1.00", + "VERSION" => "1.01", "test" => { "TESTS" => "t/*.t" } diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/README b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/README index 3ba51951176..dd5a193c2e6 100644 --- a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/README +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/README @@ -1,5 +1,5 @@ This archive contains the distribution BibTeX-Parser, -version 1.00: +version 1.01: A pure perl BibTeX parser @@ -8,5 +8,3 @@ This software is copyright (c) 2013--2017 by Gerhard Gossen and Boris Veytsman This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. - - diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/dist.ini b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/dist.ini index 7d27817487f..5aee4c846fb 100644 --- a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/dist.ini +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/dist.ini @@ -1,5 +1,5 @@ name = BibTeX-Parser -version = 1.00 +version = 1.01 author = Gerhard Gossen and Boris Veytsman license = Perl_5 copyright_holder = Gerhard Gossen and Boris Veytsman diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/03-parse_entry.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/03-parse_entry.t index 62badfe9365..6b4e4632bcc 100644 --- a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/03-parse_entry.t +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/03-parse_entry.t @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -use Test::More tests => 2; +use Test::More tests => 3; use IO::String; use BibTeX::Parser; @@ -30,9 +30,43 @@ use BibTeX::Parser; pages => "498--516", _parse_ok => 1, _fieldnums => {'author' => 0, 'title' => 1, 'journal' => 2, 'volume' => 3, - 'year' => 4, 'pages' => 5}, + 'year' => 4, 'pages' => 5}, + _pre => '', _raw => $string}, "parse \@ARTICLE"); +} +{ + my $string1 = q|@article{lin1973, + author = "Shen Lin and Brian W. Kernighan", + title = "An Effective Heuristic Algorithm for the Travelling-Salesman Problem", + journal = "Operations Research", + volume = 21, + year = 1973, + pages = "498--516" + }|; + my $string = "some +text +$string1"; + my $fh = IO::String->new($string); + + my $parser = BibTeX::Parser->new( $fh ); + +#my @result = BibTeX::Parser->_parse($fh); + + my $entry = $parser->next; + + is_deeply($entry, {_type => 'ARTICLE', _key => 'lin1973', author => "Shen Lin and Brian W. Kernighan", + title => "An Effective Heuristic Algorithm for the Travelling-Salesman Problem", + journal => "Operations Research", + volume => 21, + year => 1973, + pages => "498--516", _parse_ok => 1, + _fieldnums => {'author' => 0, 'title' => 1, + 'journal' => 2, 'volume' => 3, + 'year' => 4, 'pages' => 5}, + _pre => "some\ntext", + _raw => $string1}, "parse \@ARTICLE"); + } { my $string = q|@InProceedings{Herper:2001:MVS, @@ -63,5 +97,6 @@ use BibTeX::Parser; editor => "Reinhard Keil-Slavik and Johannes Magenheim", year => 2001, _parse_ok => 1, + _pre => '', _raw => $string}, "parse \@ARTICLE"); } diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/09-complex.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/09-complex.t index 0dc126b974c..56ce75cceb0 100644 --- a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/09-complex.t +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/09-complex.t @@ -37,5 +37,6 @@ is_deeply($entry, {_type => 'ARTICLE', _key => 'Ahrenberg88', pages = "66--70", year = "1988", keywords = "conver", -}' +}', + _pre => '' }, "parse \@ARTICLE"); diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/10-funnyname.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/10-funnyname.t index 6d32521aacd..8ab48396e9d 100644 --- a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/10-funnyname.t +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/10-funnyname.t @@ -39,6 +39,7 @@ is_deeply( number = {1}, pages = {1}, }', + _pre => '' }, "parse \@ARTICLE" ); diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/14-extratext.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/14-extratext.t new file mode 100644 index 00000000000..0a663b043ad --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/14-extratext.t @@ -0,0 +1,65 @@ +#!/usr/bin/perl -w + + +use Test::More tests => 6; + +use BibTeX::Parser; +use IO::File; + + +my $fh = new IO::File "t/bibs/14-extratext.bib", "r" ; + +my $parser = new BibTeX::Parser $fh; + + + + +while (my $entry = $parser->next) { + + if($entry->key eq 'Partridge') { + my $result1= '@BOOK{Partridge, + author = {Partridge, Eric}, + title = {Use and Abuse: a Guide to Good {E}nglish}, + publisher = {Hamish Hamilton}, + edition = {4}, + year = {1970}, +}'; + my $result2 = "First published in 1947\n$result1"; + is($entry->to_string,$result1); + is($entry->to_string(print_pre=>1),$result2); + } + + if ($entry->key eq 'Cooper') { + my $result1 = '@BOOK{Cooper, + author = {Cooper, Bruce M.}, + title = {Writing Technical Reports}, + publisher = {Penguin}, + year = {1964}, +}'; + my $result2 = "\n\n$result1"; + is($entry->to_string,$result1); + is($entry->to_string(print_pre=>1),$result2); + } + + + if ($entry->key eq 'Fowler-ModernEnglish') { + + my $result1 = '@BOOK{Fowler-ModernEnglish, + author = {Fowler, H. W.}, + title = {[A Dictionary of] Modern {E}nglish Usage}, + publisher = {Oxford University Press}, + edition = {2}, + year = {1965}, +}'; + my $result2 = ' + + +First published in 1926 +'. $result1; + is($entry->to_string,$result1); + is($entry->to_string(print_pre=>1),$result2); + } +} + +done_testing(); + diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/15-capitalization.t b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/15-capitalization.t new file mode 100644 index 00000000000..4254f5c12f4 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/15-capitalization.t @@ -0,0 +1,72 @@ +#!/usr/bin/perl -w + +use Test::More tests=>7; + +use BibTeX::Parser; +use IO::File; + + +my $fh = new IO::File "t/bibs/01.bib", "r" ; + +my $parser = new BibTeX::Parser $fh; + + + + +while (my $entry = $parser->next) { + if($entry->key eq 'key01') { + my $result1='@ARTICLE{key01, + year = {1950}, + author = {Duck, Donald and Else, Someone}, + editor = {Itor, E. D. and Other, A. N.}, + title = {Title text}, + month = {January~1}, +}'; + my $result2='@ARTICLE{key01, + YEAR = {1950}, + AUTHOR = {Duck, Donald and Else, Someone}, + EDITOR = {Itor, E. D. and Other, A. N.}, + TITLE = {Title text}, + MONTH = {January~1}, +}'; + my $result3='@ARTICLE{key01, + Year = {1950}, + Author = {Duck, Donald and Else, Someone}, + Editor = {Itor, E. D. and Other, A. N.}, + Title = {Title text}, + Month = {January~1}, +}'; + my $result4='@article{key01, + year = {1950}, + author = {Duck, Donald and Else, Someone}, + editor = {Itor, E. D. and Other, A. N.}, + title = {Title text}, + month = {January~1}, +}'; + my $result5='@Article{key01, + year = {1950}, + author = {Duck, Donald and Else, Someone}, + editor = {Itor, E. D. and Other, A. N.}, + title = {Title text}, + month = {January~1}, +}'; + is($entry->to_string,$result1); + is($entry->to_string(field_capitalization=>'Lowercase'), + $result1); + is($entry->to_string(field_capitalization=>'Uppercase'), + $result2); + is($entry->to_string(field_capitalization=>'Titlecase'), + $result3); + + is($entry->to_string(type_capitalization=>'Lowercase'), + $result4); + is($entry->to_string(type_capitalization=>'Uppercase'), + $result1); + is($entry->to_string(type_capitalization=>'Titlecase'), + $result5); + } + +} + +done_testing(); + diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/14-extratext.bib b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/14-extratext.bib new file mode 100644 index 00000000000..56f96aa01b6 --- /dev/null +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/14-extratext.bib @@ -0,0 +1,22 @@ +First published in 1947 +@BOOK{Partridge, + AUTHOR="Eric Partridge", + TITLE="Use and Abuse: a Guide to Good {E}nglish", + PUBLISHER="Hamish Hamilton", + EDITION="4", YEAR="1970"} + + +@BOOK{Cooper, + AUTHOR="Bruce M. Cooper", + TITLE="Writing Technical Reports", + PUBLISHER="Penguin", YEAR="1964"} + + + +First published in 1926 +@BOOK{Fowler-ModernEnglish, + AUTHOR="H. W. Fowler", + TITLE="[A Dictionary of] Modern {E}nglish Usage", + PUBLISHER="Oxford University Press", + EDITION="2", YEAR="1965"} + diff --git a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/english.bib b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/english.bib index 2a5779e653a..34c3e67a794 100644 --- a/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/english.bib +++ b/Master/texmf-dist/source/support/bibtexperllibs/BibTeX-Parser/t/bibs/english.bib @@ -1,4 +1,4 @@ -$Id: english.bib,v 1.5 2017/03/19 19:14:20 boris Exp $ +$Id: english.bib,v 1.6 2017/12/10 02:43:44 boris Exp $ Please notify Adrian F Clark of any additions or corrections to this list. diff --git a/Master/texmf-dist/source/support/bibtexperllibs/Makefile b/Master/texmf-dist/source/support/bibtexperllibs/Makefile index 8590d7c549c..ba762569fea 100644 --- a/Master/texmf-dist/source/support/bibtexperllibs/Makefile +++ b/Master/texmf-dist/source/support/bibtexperllibs/Makefile @@ -19,4 +19,4 @@ install: for dir in ${DIRS}; do cd $$dir; ${MAKE} -f Makefile.TDS install; cd ..; done archive: - tar -czvf $(PACKAGE).tgz -C .. --exclude '*~' --exclude '*.tgz' --exclude CVS $(PACKAGE) + COPYFILE_DISABLE=1 tar -czvf $(PACKAGE).tgz -C .. --exclude '*~' --exclude '*.tgz' --exclude CVS $(PACKAGE) diff --git a/Master/texmf-dist/source/support/bibtexperllibs/README b/Master/texmf-dist/source/support/bibtexperllibs/README index 042c3a2455f..feb8c4cd682 100644 --- a/Master/texmf-dist/source/support/bibtexperllibs/README +++ b/Master/texmf-dist/source/support/bibtexperllibs/README @@ -1,5 +1,5 @@ BibTeX Perl Libs - Version 1.3 + Version 1.4 Gerhard Gossen and Boris Veytsman This package provides BibTeX related Perl libraries by Gerhard Gossen, @@ -12,6 +12,8 @@ scripts/bibtexperllibs inside your TeX distribution. Changes: + version 1.4 Upgraded BibTeX::Parser to 1.01 + version 1.3 Upgraded BibTeX::Parser to 1.00 version 1.2 Upgraded BibTeX::Parser to v0.70 and LaTeX::ToUnicode to 0.05 -- cgit v1.2.3