summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/bibtexperllibs/BibTeX
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/bibtexperllibs/BibTeX')
-rw-r--r--Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser.pm2
-rw-r--r--Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser/Author.pm2
-rw-r--r--Master/texmf-dist/scripts/bibtexperllibs/BibTeX/Parser/Entry.pm19
3 files changed, 19 insertions, 4 deletions
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);