From 139be648536d5f25096343c01cd7e96a2a663ae4 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 10 Mar 2016 23:22:31 +0000 Subject: bibtexperllibs (10mar16) git-svn-id: svn://tug.org/texlive/trunk@39989 c570f23f-e606-0410-a88d-b1316a301751 --- .../scripts/bibtexperllibs/BibTeX/Parser.pm | 2 +- .../scripts/bibtexperllibs/BibTeX/Parser/Author.pm | 2 +- .../scripts/bibtexperllibs/BibTeX/Parser/Entry.pm | 19 +++++++++++++++++-- .../scripts/bibtexperllibs/LaTeX/ToUnicode.pm | 10 ++++++---- .../scripts/bibtexperllibs/LaTeX/ToUnicode/Tables.pm | 10 +++++----- 5 files changed, 30 insertions(+), 13 deletions(-) (limited to 'Master/texmf-dist/scripts/bibtexperllibs') diff --git a/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser.pm b/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser.pm index c7d7a75fc35..607e661e112 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 = '0.66'; + $BibTeX::Parser::VERSION = '0.68'; } # ABSTRACT: A pure perl BibTeX parser use warnings; diff --git a/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser/Author.pm b/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser/Author.pm index d7e84577e60..fbd532211b4 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 = '0.66'; + $BibTeX::Parser::Author::VERSION = '0.68'; } use warnings; diff --git a/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser/Entry.pm b/Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser/Entry.pm index b10317c42b4..6986f0a6608 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 = '0.66'; + $BibTeX::Parser::Entry::VERSION = '0.68'; } use warnings; @@ -15,6 +15,13 @@ sub new { my ($class, $type, $key, $parse_ok, $fieldsref) = @_; my %fields = defined $fieldsref ? %$fieldsref : (); + my $i=0; + foreach my $field (keys %fields) { + if ($field !~ /^_/) { + $fields{_fieldnums}->{$field}=$i; + $i++; + } + } if (defined $type) { $fields{_type} = uc($type); } @@ -79,7 +86,12 @@ sub field { return $self->{ lc( $field ) }; } else { my ($self, $key, $value) = @_; - $self->{ lc( $key ) } = $value; #_sanitize_field($value); + my $field = lc ($key); + $self->{$field} = $value; #_sanitize_field($value); + if (!exists($self->{_fieldnums}->{$field})) { + my $num = scalar keys %{$self->{_fieldnums}}; + $self->{_fieldnums}->{$field} = $num; + } } } @@ -207,6 +219,9 @@ sub raw_bibtex { sub to_string { my $self = shift; my @fields = grep {!/^_/} keys %$self; + @fields = sort { + $self->{_fieldnums}->{$a} <=> + $self->{_fieldnums}->{$b}} @fields; my $result = '@'.$self->type."{".$self->key.",\n"; foreach my $field (@fields) { my $value = $self->field($field); diff --git a/Master/texmf-dist/scripts/bibtexperllibs/LaTeX/ToUnicode.pm b/Master/texmf-dist/scripts/bibtexperllibs/LaTeX/ToUnicode.pm index 361daf49296..b11ded80e41 100644 --- a/Master/texmf-dist/scripts/bibtexperllibs/LaTeX/ToUnicode.pm +++ b/Master/texmf-dist/scripts/bibtexperllibs/LaTeX/ToUnicode.pm @@ -2,7 +2,7 @@ use strict; use warnings; package LaTeX::ToUnicode; BEGIN { - $LaTeX::ToUnicode::VERSION = '0.03'; + $LaTeX::ToUnicode::VERSION = '0.04'; } #ABSTRACT: Convert LaTeX commands to Unicode @@ -31,6 +31,8 @@ sub _convert_accents { my $string = shift; $string =~ s/({\\(.){(\\?\w{1,2})}})/$LaTeX::ToUnicode::Tables::ACCENTS{$2}{$3} || $1/eg; # {\"{a}} $string =~ s/({\\(.)(\\?\w{1,2})})/$LaTeX::ToUnicode::Tables::ACCENTS{$2}{$3} || $1/eg; # {\"a} + $string =~ s/(\\(.)(\\?\w{1,2}))/$LaTeX::ToUnicode::Tables::ACCENTS{$2}{$3} || $1/eg; # \"a + $string =~ s/(\\(.){(\\?\w{1,2})})/$LaTeX::ToUnicode::Tables::ACCENTS{$2}{$3} || $1/eg; # \"{a} $string; } @@ -101,7 +103,7 @@ LaTeX::ToUnicode - Convert LaTeX commands to Unicode =head1 VERSION -version 0.03 +version 0.04 =head1 SYNOPSIS @@ -144,11 +146,11 @@ note the missing backslash) are also handled. =head1 AUTHOR -Gerhard Gossen +Gerhard Gossen and Boris Veytsman =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2010 by Gerhard Gossen. +This software is copyright (c) 2010-2015 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/scripts/bibtexperllibs/LaTeX/ToUnicode/Tables.pm b/Master/texmf-dist/scripts/bibtexperllibs/LaTeX/ToUnicode/Tables.pm index f4fa958b69c..9dd62879a75 100644 --- a/Master/texmf-dist/scripts/bibtexperllibs/LaTeX/ToUnicode/Tables.pm +++ b/Master/texmf-dist/scripts/bibtexperllibs/LaTeX/ToUnicode/Tables.pm @@ -1,6 +1,6 @@ package LaTeX::ToUnicode::Tables; BEGIN { - $LaTeX::ToUnicode::Tables::VERSION = '0.03'; + $LaTeX::ToUnicode::Tables::VERSION = '0.04'; } use strict; use warnings; @@ -153,7 +153,7 @@ our %ACCENTS = ( y => "\x{1e8f}", z => "\x{17c}" }, - "=" => { + '=' => { A => "\x{100}", AE => "\x{1e2}", E => "\x{112}", @@ -459,7 +459,7 @@ LaTeX::ToUnicode::Tables - Character tables for LaTeX::ToUnicode =head1 VERSION -version 0.03 +version 0.04 =head1 CONSTANTS @@ -497,11 +497,11 @@ Command names of formatting commands like C<\tt> =head1 AUTHOR -Gerhard Gossen +Gerhard Gossen and Boris Veytsman =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2010 by Gerhard Gossen. +This software is copyright (c) 2010-2015 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. -- cgit v1.2.3