texlive[45927] trunk: crossrefware (27nov17)

commits+karl at tug.org commits+karl at tug.org
Mon Nov 27 23:40:18 CET 2017


Revision: 45927
          http://tug.org/svn/texlive?view=revision&revision=45927
Author:   karl
Date:     2017-11-27 23:40:18 +0100 (Mon, 27 Nov 2017)
Log Message:
-----------
crossrefware (27nov17)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/Makefile.am
    trunk/Build/source/texk/texlive/linked_scripts/Makefile.in
    trunk/Build/source/texk/texlive/linked_scripts/crossrefware/bbl2bib.pl
    trunk/Build/source/texk/texlive/linked_scripts/crossrefware/bibdoiadd.pl
    trunk/Build/source/texk/texlive/linked_scripts/scripts.lst
    trunk/Master/texmf-dist/doc/man/man1/bbl2bib.1
    trunk/Master/texmf-dist/doc/man/man1/bbl2bib.man1.pdf
    trunk/Master/texmf-dist/doc/man/man1/bibdoiadd.1
    trunk/Master/texmf-dist/doc/man/man1/bibdoiadd.man1.pdf
    trunk/Master/texmf-dist/doc/support/crossrefware/Makefile
    trunk/Master/texmf-dist/doc/support/crossrefware/README
    trunk/Master/texmf-dist/doc/support/crossrefware/crossrefware.pdf
    trunk/Master/texmf-dist/scripts/crossrefware/bbl2bib.pl
    trunk/Master/texmf-dist/scripts/crossrefware/bibdoiadd.pl
    trunk/Master/tlpkg/tlpsrc/crossrefware.tlpsrc

Added Paths:
-----------
    trunk/Build/source/texk/texlive/linked_scripts/crossrefware/biburl2doi.pl
    trunk/Master/bin/amd64-freebsd/biburl2doi
    trunk/Master/bin/amd64-netbsd/biburl2doi
    trunk/Master/bin/armel-linux/biburl2doi
    trunk/Master/bin/armhf-linux/biburl2doi
    trunk/Master/bin/i386-cygwin/biburl2doi
    trunk/Master/bin/i386-darwin/biburl2doi
    trunk/Master/bin/i386-freebsd/biburl2doi
    trunk/Master/bin/i386-linux/biburl2doi
    trunk/Master/bin/i386-netbsd/biburl2doi
    trunk/Master/bin/i386-solaris/biburl2doi
    trunk/Master/bin/powerpc-darwin/biburl2doi
    trunk/Master/bin/powerpc-linux/biburl2doi
    trunk/Master/bin/sparc-solaris/biburl2doi
    trunk/Master/bin/win32/biburl2doi.exe
    trunk/Master/bin/x86_64-cygwin/biburl2doi
    trunk/Master/bin/x86_64-darwin/biburl2doi
    trunk/Master/bin/x86_64-darwinlegacy/biburl2doi
    trunk/Master/bin/x86_64-linux/biburl2doi
    trunk/Master/bin/x86_64-solaris/biburl2doi
    trunk/Master/texmf-dist/doc/man/man1/biburl2doi.1
    trunk/Master/texmf-dist/doc/man/man1/biburl2doi.man1.pdf
    trunk/Master/texmf-dist/scripts/crossrefware/biburl2doi.pl

Modified: trunk/Build/source/texk/texlive/linked_scripts/Makefile.am
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/Makefile.am	2017-11-27 22:37:58 UTC (rev 45926)
+++ trunk/Build/source/texk/texlive/linked_scripts/Makefile.am	2017-11-27 22:40:18 UTC (rev 45927)
@@ -103,6 +103,7 @@
 	crossrefware/bbl2bib.pl \
 	crossrefware/bibdoiadd.pl \
 	crossrefware/bibmradd.pl \
+	crossrefware/biburl2doi.pl \
 	crossrefware/bibzbladd.pl \
 	crossrefware/ltx2crossrefxml.pl \
 	ctan-o-mat/ctan-o-mat.pl \

Modified: trunk/Build/source/texk/texlive/linked_scripts/Makefile.in
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/Makefile.in	2017-11-27 22:37:58 UTC (rev 45926)
+++ trunk/Build/source/texk/texlive/linked_scripts/Makefile.in	2017-11-27 22:40:18 UTC (rev 45927)
@@ -317,6 +317,7 @@
 	crossrefware/bbl2bib.pl \
 	crossrefware/bibdoiadd.pl \
 	crossrefware/bibmradd.pl \
+	crossrefware/biburl2doi.pl \
 	crossrefware/bibzbladd.pl \
 	crossrefware/ltx2crossrefxml.pl \
 	ctan-o-mat/ctan-o-mat.pl \

Modified: trunk/Build/source/texk/texlive/linked_scripts/crossrefware/bbl2bib.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/crossrefware/bbl2bib.pl	2017-11-27 22:37:58 UTC (rev 45926)
+++ trunk/Build/source/texk/texlive/linked_scripts/crossrefware/bbl2bib.pl	2017-11-27 22:40:18 UTC (rev 45927)
@@ -8,7 +8,7 @@
 
 =head1 SYNOPSIS
 
-bbl2bib.pl [-d] [B<-o> I<output>] I<file>
+bbl2bib.pl [-d] [-u] [B<-o> I<output>] I<file>
 
 =head1 OPTIONS
 
@@ -24,6 +24,15 @@
 output file is formed by changing the extension to C<.bib>
 
 
+=item B<-u>
+
+Do not clean URL fields.
+
+Normally C<bbl2bib> recognizes URL fields of the kind
+C<http://dx.doi.org> and their variants and converts them to DOI
+fields (see also L<biburl2doi(1)> script).  The switch B<-u>
+suppresses this cleanup.  
+
 =back
 
 =head1 DESCRIPTION
@@ -38,6 +47,7 @@
 C<thebibliography> environment.  For each bibitem it creates a plain
 text bibliography entry, and then  tries to match it in
 the database.  
+
 =head1 INPUT FILE
 
 We assume some structure of the input file:
@@ -104,9 +114,9 @@
 $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0;
 
 
-my $USAGE="USAGE: $0 [-o output] file\n";
+my $USAGE="USAGE: $0 [-d] [-u] [-o output] file\n";
 my $VERSION = <<END;
-bbl2bib v2.2
+bbl2bib v2.3
 This is free software.  You may redistribute copies of it under the
 terms of the GNU General Public License
 http://www.gnu.org/licenses/gpl.html.  There is NO WARRANTY, to the
@@ -114,7 +124,7 @@
 $USAGE
 END
 our %opts;
-getopts('do:hV',\%opts) or die $USAGE;
+getopts('do:huV',\%opts) or die $USAGE;
 
 if ($opts{h} || $opts{V}){
     print $VERSION;
@@ -140,6 +150,10 @@
     $debug=1;
 }
 
+my $cleanUrls = 1;
+if ($opts{u}) {
+    $cleanUrls = 0;
+}
 
 my $input= IO::File->new($inputfile) or 
     die "Cannot find Bbl or TeX file $inputfile\n$USAGE\n";
@@ -228,6 +242,11 @@
     }
 
     $bibitem->{bib} = SearchMref($bibitem);
+
+    if ($cleanUrls) {
+	$bibitem->{bib} = CleanUrl ($bibitem->{bib});
+    }
+    
     PrintBibitem($bibitem);
     return;
 }
@@ -258,7 +277,25 @@
     }
 }
 
+sub CleanUrl {
+    my $entry = shift;
+    if (!ref($entry)) {
+	return $entry;
+    }
 
+    if ($entry->has('doi')) {
+	return $entry;
+    }
+    if (!$entry->has('url')) {
+	return $entry;
+    }
+    if ($entry->field('url') =~ m|^http(?:s)?://(?:dx\.)?doi\.org/(.*)$|) {
+	$entry->field('doi', $1);
+	delete $entry->{'url'};
+    }
+    return $entry;
+    
+}
 
 
 sub PrintBibitem {

Modified: trunk/Build/source/texk/texlive/linked_scripts/crossrefware/bibdoiadd.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/crossrefware/bibdoiadd.pl	2017-11-27 22:37:58 UTC (rev 45926)
+++ trunk/Build/source/texk/texlive/linked_scripts/crossrefware/bibdoiadd.pl	2017-11-27 22:40:18 UTC (rev 45927)
@@ -8,7 +8,7 @@
 
 =head1 SYNOPSIS
 
-bibdoiadd [B<-c> I<config_file>] [B<-e> 1|0] [B<-f>] [B<-o> I<output>] I<bib_file>
+bibdoiadd [B<-c> I<config_file>] [B<-C> 1|0] [B<-e> 1|0] [B<-f>] [B<-o> I<output>] I<bib_file>
 
 =head1 OPTIONS
 
@@ -19,6 +19,10 @@
 Configuration file.  If this file is absent, some defaults are used.
 See below for its format.
 
+=item B<-C> 1|0
+
+Whether to canonize names in the output (1) or not (0).  By default, 1.
+
 =item B<-e>
 
 If 1 (default), add empty doi if a doi cannot be found.  This prevents
@@ -39,9 +43,9 @@
 =head1 DESCRIPTION
 
 The script reads a BibTeX file.  It checks whether the entries have
-DOIs.  If now, tries to contact http://www.crossref.org to get the
+DOIs.  If not, it tries to contact http://www.crossref.org to get the
 corresponding DOI.  The result is a BibTeX file with the fields
-C<doi=...> added.  
+C<doi=...> added.
 
 The name of the output file is either set by the B<-o> option or 
 is derived by adding the suffix C<_doi> to the output file.
@@ -107,7 +111,7 @@
 # Sometimes AMS forgets to update certificates
 $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0;
 
-my $USAGE="USAGE: $0 [-c config] [-e 1|0] [-f] [-o output] file\n";
+my $USAGE="USAGE: $0 [-c config] [-C 1|0] [-e 1|0] [-f] [-o output] file\n";
 my $VERSION = <<END;
 bibdoiadd v2.2
 This is free software.  You may redistribute copies of it under the
@@ -117,7 +121,7 @@
 $USAGE
 END
 our %opts;
-getopts('fe:c:o:hV',\%opts) or die $USAGE;
+getopts('fe:c:C:o:hV',\%opts) or die $USAGE;
 
 if ($opts{h} || $opts{V}){
     print $VERSION;
@@ -144,6 +148,11 @@
     $forceEmpty = $opts{e};
 }		
 
+my $canonizeNames = 1;
+if (exists $opts{C}) {
+    $canonizeNames = $opts{C};
+}
+
 our $mode='free';
 our $email;
 our $username;
@@ -195,7 +204,8 @@
 	next;
     }
 
-    if (!($entry->type() eq 'ARTICLE')) {
+    if (!($entry->type() eq 'ARTICLE') && !($entry->type() eq 'BOOK')
+	&& !($entry->type() eq 'INCOLLECTION')) {
 	print $output $entry->raw_bibtex(), "\n\n";
 	next;
     }
@@ -210,9 +220,12 @@
      if (length($doi) || $forceEmpty) {
  	$entry->field('doi',$doi);
      }
-    print $output $entry->to_string(), "\n\n";
 
+    print $output 
+	 $entry->to_string(canonize_names=>$canonizeNames), 
+	 "\n\n";
 
+
 }
 
 $input->close();

Added: trunk/Build/source/texk/texlive/linked_scripts/crossrefware/biburl2doi.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/crossrefware/biburl2doi.pl	                        (rev 0)
+++ trunk/Build/source/texk/texlive/linked_scripts/crossrefware/biburl2doi.pl	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1,136 @@
+#!/usr/bin/env perl
+
+=pod
+
+=head1 NAME
+
+biburl2doi.pl - convert URLs pointing to doi.org to DOIs
+
+=head1 SYNOPSIS
+
+biburl2doi  [B<-D>] [B<-o> I<output>] I<bib_file>
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-D> 
+
+Do not delete URLs converted to DOIs
+
+
+=item B<-o> I<output>
+
+Output file.  If this option is not used, the name for the 
+output file is formed by adding C<_cleaned> to the input file
+
+=back
+
+=head1 DESCRIPTION
+
+The script recognizes URL fields of the kind
+C<http://dx.doi.org> and their variants and converts them to DOI
+fields.  
+
+
+=head1 AUTHOR
+
+Boris Veytsman
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2017  Boris Veytsman
+
+This is free software.  You may redistribute copies of it under the
+terms of the GNU General Public License
+L<http://www.gnu.org/licenses/gpl.html>.  There is NO WARRANTY, to the
+extent permitted by law.
+
+=cut
+
+use strict;
+BEGIN {
+    # find files relative to our installed location within TeX Live
+    chomp(my $TLMaster = `kpsewhich -var-value=SELFAUTOPARENT`); # TL root
+    if (length($TLMaster)) {
+	unshift @INC, "$TLMaster/texmf-dist/scripts/bibtexperllibs";
+    }
+}
+use IO::File;
+use BibTeX::Parser;
+use LaTeX::ToUnicode qw (convert);
+use Getopt::Std;
+
+my $USAGE="USAGE: $0 [-D] [-o output] file\n";
+my $VERSION = <<END;
+biburl2doi 1.0
+This is free software.  You may redistribute copies of it under the
+terms of the GNU General Public License
+http://www.gnu.org/licenses/gpl.html.  There is NO WARRANTY, to the
+extent permitted by law.
+$USAGE
+END
+our %opts;
+getopts('Do:hV',\%opts) or die $USAGE;
+
+if ($opts{h} || $opts{V}){
+    print $VERSION;
+    exit 0;
+}
+
+################################################################
+# Defaults and parameters
+################################################################
+
+my $inputfile = shift;
+
+my $outputfile = $inputfile;
+
+$outputfile =~ s/\.([^\.]*)$/_cleaned.$1/;
+
+if (exists $opts{o}) {
+    $outputfile = $opts{o};
+}
+
+my $deleteUrl = 1;
+if (exists $opts{D}) {
+    $deleteUrl = 0;
+}		
+
+
+my $input= IO::File->new($inputfile) or 
+    die "Cannot find BibTeX file $inputfile\n$USAGE\n";
+my $output = IO::File->new("> $outputfile") or 
+    die "Cannot write to $outputfile\n$USAGE\n";
+
+my $parser=new BibTeX::Parser($input);
+
+
+
+# Processing the input
+while (my $entry = $parser->next) {
+    if (!$entry->parse_ok()) {
+	print STDERR "Cannot understand entry: ";
+	$entry->print(*STDERR);
+	print STDERR "Skipping this entry\n";
+	next;
+    }
+
+    if ($entry->has('doi') || !$entry->has('url')) {
+	print $output $entry->raw_bibtex(), "\n\n";
+	next;
+    }
+
+    if ($entry->field('url') =~ m|^http(?:s)?://(?:dx\.)?doi\.org/(.*)$|) {
+	$entry->field('doi', $1);
+	if ($deleteUrl) {
+	    delete $entry->{'url'};
+	}
+	print $output $entry->to_string(), "\n\n";
+    } else {
+	print $output $entry->raw_bibtex(), "\n\n";
+    }
+}
+	
+    
+					  


Property changes on: trunk/Build/source/texk/texlive/linked_scripts/crossrefware/biburl2doi.pl
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Modified: trunk/Build/source/texk/texlive/linked_scripts/scripts.lst
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/scripts.lst	2017-11-27 22:37:58 UTC (rev 45926)
+++ trunk/Build/source/texk/texlive/linked_scripts/scripts.lst	2017-11-27 22:40:18 UTC (rev 45927)
@@ -47,6 +47,7 @@
 crossrefware/bbl2bib.pl
 crossrefware/bibdoiadd.pl
 crossrefware/bibmradd.pl
+crossrefware/biburl2doi.pl
 crossrefware/bibzbladd.pl
 crossrefware/ltx2crossrefxml.pl
 ctan-o-mat/ctan-o-mat.pl

Added: trunk/Master/bin/amd64-freebsd/biburl2doi
===================================================================
--- trunk/Master/bin/amd64-freebsd/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/amd64-freebsd/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/amd64-freebsd/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/amd64-netbsd/biburl2doi
===================================================================
--- trunk/Master/bin/amd64-netbsd/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/amd64-netbsd/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/amd64-netbsd/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/armel-linux/biburl2doi
===================================================================
--- trunk/Master/bin/armel-linux/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/armel-linux/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/armel-linux/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/armhf-linux/biburl2doi
===================================================================
--- trunk/Master/bin/armhf-linux/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/armhf-linux/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/armhf-linux/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-cygwin/biburl2doi
===================================================================
--- trunk/Master/bin/i386-cygwin/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/i386-cygwin/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/i386-cygwin/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-darwin/biburl2doi
===================================================================
--- trunk/Master/bin/i386-darwin/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/i386-darwin/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/i386-darwin/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-freebsd/biburl2doi
===================================================================
--- trunk/Master/bin/i386-freebsd/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/i386-freebsd/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/i386-freebsd/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-linux/biburl2doi
===================================================================
--- trunk/Master/bin/i386-linux/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/i386-linux/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/i386-linux/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-netbsd/biburl2doi
===================================================================
--- trunk/Master/bin/i386-netbsd/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/i386-netbsd/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/i386-netbsd/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-solaris/biburl2doi
===================================================================
--- trunk/Master/bin/i386-solaris/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/i386-solaris/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/i386-solaris/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/powerpc-darwin/biburl2doi
===================================================================
--- trunk/Master/bin/powerpc-darwin/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/powerpc-darwin/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/powerpc-darwin/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/powerpc-linux/biburl2doi
===================================================================
--- trunk/Master/bin/powerpc-linux/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/powerpc-linux/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/powerpc-linux/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/sparc-solaris/biburl2doi
===================================================================
--- trunk/Master/bin/sparc-solaris/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/sparc-solaris/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/sparc-solaris/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/win32/biburl2doi.exe
===================================================================
(Binary files differ)

Index: trunk/Master/bin/win32/biburl2doi.exe
===================================================================
--- trunk/Master/bin/win32/biburl2doi.exe	2017-11-27 22:37:58 UTC (rev 45926)
+++ trunk/Master/bin/win32/biburl2doi.exe	2017-11-27 22:40:18 UTC (rev 45927)

Property changes on: trunk/Master/bin/win32/biburl2doi.exe
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/bin/x86_64-cygwin/biburl2doi
===================================================================
--- trunk/Master/bin/x86_64-cygwin/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/x86_64-cygwin/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-cygwin/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-darwin/biburl2doi
===================================================================
--- trunk/Master/bin/x86_64-darwin/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/x86_64-darwin/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-darwin/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-darwinlegacy/biburl2doi
===================================================================
--- trunk/Master/bin/x86_64-darwinlegacy/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/x86_64-darwinlegacy/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-darwinlegacy/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-linux/biburl2doi
===================================================================
--- trunk/Master/bin/x86_64-linux/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/x86_64-linux/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-linux/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-solaris/biburl2doi
===================================================================
--- trunk/Master/bin/x86_64-solaris/biburl2doi	                        (rev 0)
+++ trunk/Master/bin/x86_64-solaris/biburl2doi	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-solaris/biburl2doi
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/man/man1/bbl2bib.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/bbl2bib.1	2017-11-27 22:37:58 UTC (rev 45926)
+++ trunk/Master/texmf-dist/doc/man/man1/bbl2bib.1	2017-11-27 22:40:18 UTC (rev 45927)
@@ -133,7 +133,7 @@
 .\" ========================================================================
 .\"
 .IX Title "bbl2bib 1"
-.TH bbl2bib 1 "2017-11-18" "" "CROSSREF LIBRARY"
+.TH bbl2bib 1 "2017-11-26" "" "CROSSREF LIBRARY"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -142,7 +142,7 @@
 bbl2bib.pl \- convert thebibliography environment to a bib file
 .SH "SYNOPSIS"
 .IX Header "SYNOPSIS"
-bbl2bib.pl [\-d] [\fB\-o\fR \fIoutput\fR] \fIfile\fR
+bbl2bib.pl [\-d] [\-u] [\fB\-o\fR \fIoutput\fR] \fIfile\fR
 .SH "OPTIONS"
 .IX Header "OPTIONS"
 .IP "[\-d]" 4
@@ -152,6 +152,14 @@
 .IX Item "-o output"
 Output file.  If this option is not used, the name for the 
 output file is formed by changing the extension to \f(CW\*(C`.bib\*(C'\fR
+.IP "\fB\-u\fR" 4
+.IX Item "-u"
+Do not clean \s-1URL\s0 fields.
+.Sp
+Normally \f(CW\*(C`bbl2bib\*(C'\fR recognizes \s-1URL\s0 fields of the kind
+\&\f(CW\*(C`http://dx.doi.org\*(C'\fR and their variants and converts them to \s-1DOI\s0
+fields (see also \fIbiburl2doi\fR\|(1) script).  The switch \fB\-u\fR
+suppresses this cleanup.
 .SH "DESCRIPTION"
 .IX Header "DESCRIPTION"
 The script tries to reconstruct a \f(CW\*(C`bib\*(C'\fR file from the corresponding
@@ -163,9 +171,9 @@
 The script reads a TeX or Bbl file and extracts from it the
 \&\f(CW\*(C`thebibliography\*(C'\fR environment.  For each bibitem it creates a plain
 text bibliography entry, and then  tries to match it in
-the database.  
-=head1 \s-1INPUT FILE\s0
-.PP
+the database.
+.SH "INPUT FILE"
+.IX Header "INPUT FILE"
 We assume some structure of the input file:
 .IP "1." 4
 The bibliography is contained between the lines

Modified: trunk/Master/texmf-dist/doc/man/man1/bbl2bib.man1.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/man/man1/bibdoiadd.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/bibdoiadd.1	2017-11-27 22:37:58 UTC (rev 45926)
+++ trunk/Master/texmf-dist/doc/man/man1/bibdoiadd.1	2017-11-27 22:40:18 UTC (rev 45927)
@@ -133,7 +133,7 @@
 .\" ========================================================================
 .\"
 .IX Title "bibdoiadd 1"
-.TH bibdoiadd 1 "2017-11-18" "" "CROSSREF LIBRARY"
+.TH bibdoiadd 1 "2017-11-26" "" "CROSSREF LIBRARY"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -142,7 +142,7 @@
 bibdoiadd.pl \- add DOI numbers to papers in a given bib file
 .SH "SYNOPSIS"
 .IX Header "SYNOPSIS"
-bibdoiadd [\fB\-c\fR \fIconfig_file\fR] [\fB\-e\fR 1|0] [\fB\-f\fR] [\fB\-o\fR \fIoutput\fR] \fIbib_file\fR
+bibdoiadd [\fB\-c\fR \fIconfig_file\fR] [\fB\-C\fR 1|0] [\fB\-e\fR 1|0] [\fB\-f\fR] [\fB\-o\fR \fIoutput\fR] \fIbib_file\fR
 .SH "OPTIONS"
 .IX Header "OPTIONS"
 .IP "\fB\-c\fR \fIconfig_file\fR" 4
@@ -149,6 +149,9 @@
 .IX Item "-c config_file"
 Configuration file.  If this file is absent, some defaults are used.
 See below for its format.
+.IP "\fB\-C\fR 1|0" 4
+.IX Item "-C 1|0"
+Whether to canonize names in the output (1) or not (0).  By default, 1.
 .IP "\fB\-e\fR" 4
 .IX Item "-e"
 If 1 (default), add empty doi if a doi cannot be found.  This prevents
@@ -164,7 +167,7 @@
 .SH "DESCRIPTION"
 .IX Header "DESCRIPTION"
 The script reads a BibTeX file.  It checks whether the entries have
-DOIs.  If now, tries to contact http://www.crossref.org to get the
+DOIs.  If not, it tries to contact http://www.crossref.org to get the
 corresponding \s-1DOI. \s0 The result is a BibTeX file with the fields
 \&\f(CW\*(C`doi=...\*(C'\fR added.
 .PP

Modified: trunk/Master/texmf-dist/doc/man/man1/bibdoiadd.man1.pdf
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/doc/man/man1/biburl2doi.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/biburl2doi.1	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/man/man1/biburl2doi.1	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1,170 @@
+.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+.    ds C`
+.    ds C'
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el       .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.\"
+.\" Avoid warning from groff about undefined register 'F'.
+.de IX
+..
+.nr rF 0
+.if \n(.g .if rF .nr rF 1
+.if (\n(rF:(\n(.g==0)) \{
+.    if \nF \{
+.        de IX
+.        tm Index:\\$1\t\\n%\t"\\$2"
+..
+.        if !\nF==2 \{
+.            nr % 0
+.            nr F 2
+.        \}
+.    \}
+.\}
+.rr rF
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "biburl2doi 1"
+.TH biburl2doi 1 "2017-11-26" "" "CROSSREF LIBRARY"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+biburl2doi.pl \- convert URLs pointing to doi.org to DOIs
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+biburl2doi  [\fB\-D\fR] [\fB\-o\fR \fIoutput\fR] \fIbib_file\fR
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+.IP "\fB\-D\fR" 4
+.IX Item "-D"
+Do not delete URLs converted to DOIs
+.IP "\fB\-o\fR \fIoutput\fR" 4
+.IX Item "-o output"
+Output file.  If this option is not used, the name for the 
+output file is formed by adding \f(CW\*(C`_cleaned\*(C'\fR to the input file
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The script recognizes \s-1URL\s0 fields of the kind
+\&\f(CW\*(C`http://dx.doi.org\*(C'\fR and their variants and converts them to \s-1DOI\s0
+fields.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Boris Veytsman
+.SH "COPYRIGHT AND LICENSE"
+.IX Header "COPYRIGHT AND LICENSE"
+Copyright (C) 2017  Boris Veytsman
+.PP
+This is free software.  You may redistribute copies of it under the
+terms of the \s-1GNU\s0 General Public License
+<http://www.gnu.org/licenses/gpl.html>.  There is \s-1NO WARRANTY,\s0 to the
+extent permitted by law.


Property changes on: trunk/Master/texmf-dist/doc/man/man1/biburl2doi.1
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/man/man1/biburl2doi.man1.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/man/man1/biburl2doi.man1.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/biburl2doi.man1.pdf	2017-11-27 22:37:58 UTC (rev 45926)
+++ trunk/Master/texmf-dist/doc/man/man1/biburl2doi.man1.pdf	2017-11-27 22:40:18 UTC (rev 45927)

Property changes on: trunk/Master/texmf-dist/doc/man/man1/biburl2doi.man1.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/support/crossrefware/Makefile
===================================================================
--- trunk/Master/texmf-dist/doc/support/crossrefware/Makefile	2017-11-27 22:37:58 UTC (rev 45926)
+++ trunk/Master/texmf-dist/doc/support/crossrefware/Makefile	2017-11-27 22:40:18 UTC (rev 45927)
@@ -3,6 +3,7 @@
 	bibdoiadd.pl \
 	bibzbladd.pl \
 	bibmradd.pl \
+	biburl2doi.pl \
 	bbl2bib.pl
 
 PACKAGE = crossrefware

Modified: trunk/Master/texmf-dist/doc/support/crossrefware/README
===================================================================
--- trunk/Master/texmf-dist/doc/support/crossrefware/README	2017-11-27 22:37:58 UTC (rev 45926)
+++ trunk/Master/texmf-dist/doc/support/crossrefware/README	2017-11-27 22:40:18 UTC (rev 45927)
@@ -1,5 +1,5 @@
 			 Crossrefware Bundle
-			     version 2.2
+			  version 2017/11/26
 
 
 Scripts useful for working with Crossref, MathSciNet and Zentralblatt MATH.
@@ -11,6 +11,7 @@
 bibzbladd.pl       - add Zbl numbers to papers in a given bib file
 bibmradd.pl        - add MR  numbers to papers in a given bib file
 bbl2bib.pl         - convert `thebibliography' environment to a bib file
+biburl2doi.pl      - convert urls pointing to doi.org to dois
 ltx2crossrefxml.pl - a tool for creation of XML files for submitting to crossref.org
 
 The scripts use bibtexperllibs libraries from CTAN
@@ -26,6 +27,14 @@
 
 Changes:
 
+	2017/11/26:   - Switched to date-based versioning for the
+		        bundle. 
+                      - bbl2bib now converts urls starting with
+	                http(s)://(dx.)doi.org to dois.  This functionality
+		        is also provided by a separate script biburl2doi
+		      - bibadddoi now has the option to (not) canonize
+		        names
+
 	Version 2.2:  We now treat absent CA permissively.
 		      New debug options for bbl2bib
 

Modified: trunk/Master/texmf-dist/doc/support/crossrefware/crossrefware.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/scripts/crossrefware/bbl2bib.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/crossrefware/bbl2bib.pl	2017-11-27 22:37:58 UTC (rev 45926)
+++ trunk/Master/texmf-dist/scripts/crossrefware/bbl2bib.pl	2017-11-27 22:40:18 UTC (rev 45927)
@@ -8,7 +8,7 @@
 
 =head1 SYNOPSIS
 
-bbl2bib.pl [-d] [B<-o> I<output>] I<file>
+bbl2bib.pl [-d] [-u] [B<-o> I<output>] I<file>
 
 =head1 OPTIONS
 
@@ -24,6 +24,15 @@
 output file is formed by changing the extension to C<.bib>
 
 
+=item B<-u>
+
+Do not clean URL fields.
+
+Normally C<bbl2bib> recognizes URL fields of the kind
+C<http://dx.doi.org> and their variants and converts them to DOI
+fields (see also L<biburl2doi(1)> script).  The switch B<-u>
+suppresses this cleanup.  
+
 =back
 
 =head1 DESCRIPTION
@@ -38,6 +47,7 @@
 C<thebibliography> environment.  For each bibitem it creates a plain
 text bibliography entry, and then  tries to match it in
 the database.  
+
 =head1 INPUT FILE
 
 We assume some structure of the input file:
@@ -104,9 +114,9 @@
 $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0;
 
 
-my $USAGE="USAGE: $0 [-o output] file\n";
+my $USAGE="USAGE: $0 [-d] [-u] [-o output] file\n";
 my $VERSION = <<END;
-bbl2bib v2.2
+bbl2bib v2.3
 This is free software.  You may redistribute copies of it under the
 terms of the GNU General Public License
 http://www.gnu.org/licenses/gpl.html.  There is NO WARRANTY, to the
@@ -114,7 +124,7 @@
 $USAGE
 END
 our %opts;
-getopts('do:hV',\%opts) or die $USAGE;
+getopts('do:huV',\%opts) or die $USAGE;
 
 if ($opts{h} || $opts{V}){
     print $VERSION;
@@ -140,6 +150,10 @@
     $debug=1;
 }
 
+my $cleanUrls = 1;
+if ($opts{u}) {
+    $cleanUrls = 0;
+}
 
 my $input= IO::File->new($inputfile) or 
     die "Cannot find Bbl or TeX file $inputfile\n$USAGE\n";
@@ -228,6 +242,11 @@
     }
 
     $bibitem->{bib} = SearchMref($bibitem);
+
+    if ($cleanUrls) {
+	$bibitem->{bib} = CleanUrl ($bibitem->{bib});
+    }
+    
     PrintBibitem($bibitem);
     return;
 }
@@ -258,7 +277,25 @@
     }
 }
 
+sub CleanUrl {
+    my $entry = shift;
+    if (!ref($entry)) {
+	return $entry;
+    }
 
+    if ($entry->has('doi')) {
+	return $entry;
+    }
+    if (!$entry->has('url')) {
+	return $entry;
+    }
+    if ($entry->field('url') =~ m|^http(?:s)?://(?:dx\.)?doi\.org/(.*)$|) {
+	$entry->field('doi', $1);
+	delete $entry->{'url'};
+    }
+    return $entry;
+    
+}
 
 
 sub PrintBibitem {

Modified: trunk/Master/texmf-dist/scripts/crossrefware/bibdoiadd.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/crossrefware/bibdoiadd.pl	2017-11-27 22:37:58 UTC (rev 45926)
+++ trunk/Master/texmf-dist/scripts/crossrefware/bibdoiadd.pl	2017-11-27 22:40:18 UTC (rev 45927)
@@ -8,7 +8,7 @@
 
 =head1 SYNOPSIS
 
-bibdoiadd [B<-c> I<config_file>] [B<-e> 1|0] [B<-f>] [B<-o> I<output>] I<bib_file>
+bibdoiadd [B<-c> I<config_file>] [B<-C> 1|0] [B<-e> 1|0] [B<-f>] [B<-o> I<output>] I<bib_file>
 
 =head1 OPTIONS
 
@@ -19,6 +19,10 @@
 Configuration file.  If this file is absent, some defaults are used.
 See below for its format.
 
+=item B<-C> 1|0
+
+Whether to canonize names in the output (1) or not (0).  By default, 1.
+
 =item B<-e>
 
 If 1 (default), add empty doi if a doi cannot be found.  This prevents
@@ -39,9 +43,9 @@
 =head1 DESCRIPTION
 
 The script reads a BibTeX file.  It checks whether the entries have
-DOIs.  If now, tries to contact http://www.crossref.org to get the
+DOIs.  If not, it tries to contact http://www.crossref.org to get the
 corresponding DOI.  The result is a BibTeX file with the fields
-C<doi=...> added.  
+C<doi=...> added.
 
 The name of the output file is either set by the B<-o> option or 
 is derived by adding the suffix C<_doi> to the output file.
@@ -107,7 +111,7 @@
 # Sometimes AMS forgets to update certificates
 $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0;
 
-my $USAGE="USAGE: $0 [-c config] [-e 1|0] [-f] [-o output] file\n";
+my $USAGE="USAGE: $0 [-c config] [-C 1|0] [-e 1|0] [-f] [-o output] file\n";
 my $VERSION = <<END;
 bibdoiadd v2.2
 This is free software.  You may redistribute copies of it under the
@@ -117,7 +121,7 @@
 $USAGE
 END
 our %opts;
-getopts('fe:c:o:hV',\%opts) or die $USAGE;
+getopts('fe:c:C:o:hV',\%opts) or die $USAGE;
 
 if ($opts{h} || $opts{V}){
     print $VERSION;
@@ -144,6 +148,11 @@
     $forceEmpty = $opts{e};
 }		
 
+my $canonizeNames = 1;
+if (exists $opts{C}) {
+    $canonizeNames = $opts{C};
+}
+
 our $mode='free';
 our $email;
 our $username;
@@ -195,7 +204,8 @@
 	next;
     }
 
-    if (!($entry->type() eq 'ARTICLE')) {
+    if (!($entry->type() eq 'ARTICLE') && !($entry->type() eq 'BOOK')
+	&& !($entry->type() eq 'INCOLLECTION')) {
 	print $output $entry->raw_bibtex(), "\n\n";
 	next;
     }
@@ -210,9 +220,12 @@
      if (length($doi) || $forceEmpty) {
  	$entry->field('doi',$doi);
      }
-    print $output $entry->to_string(), "\n\n";
 
+    print $output 
+	 $entry->to_string(canonize_names=>$canonizeNames), 
+	 "\n\n";
 
+
 }
 
 $input->close();

Added: trunk/Master/texmf-dist/scripts/crossrefware/biburl2doi.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/crossrefware/biburl2doi.pl	                        (rev 0)
+++ trunk/Master/texmf-dist/scripts/crossrefware/biburl2doi.pl	2017-11-27 22:40:18 UTC (rev 45927)
@@ -0,0 +1,136 @@
+#!/usr/bin/env perl
+
+=pod
+
+=head1 NAME
+
+biburl2doi.pl - convert URLs pointing to doi.org to DOIs
+
+=head1 SYNOPSIS
+
+biburl2doi  [B<-D>] [B<-o> I<output>] I<bib_file>
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-D> 
+
+Do not delete URLs converted to DOIs
+
+
+=item B<-o> I<output>
+
+Output file.  If this option is not used, the name for the 
+output file is formed by adding C<_cleaned> to the input file
+
+=back
+
+=head1 DESCRIPTION
+
+The script recognizes URL fields of the kind
+C<http://dx.doi.org> and their variants and converts them to DOI
+fields.  
+
+
+=head1 AUTHOR
+
+Boris Veytsman
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2017  Boris Veytsman
+
+This is free software.  You may redistribute copies of it under the
+terms of the GNU General Public License
+L<http://www.gnu.org/licenses/gpl.html>.  There is NO WARRANTY, to the
+extent permitted by law.
+
+=cut
+
+use strict;
+BEGIN {
+    # find files relative to our installed location within TeX Live
+    chomp(my $TLMaster = `kpsewhich -var-value=SELFAUTOPARENT`); # TL root
+    if (length($TLMaster)) {
+	unshift @INC, "$TLMaster/texmf-dist/scripts/bibtexperllibs";
+    }
+}
+use IO::File;
+use BibTeX::Parser;
+use LaTeX::ToUnicode qw (convert);
+use Getopt::Std;
+
+my $USAGE="USAGE: $0 [-D] [-o output] file\n";
+my $VERSION = <<END;
+biburl2doi 1.0
+This is free software.  You may redistribute copies of it under the
+terms of the GNU General Public License
+http://www.gnu.org/licenses/gpl.html.  There is NO WARRANTY, to the
+extent permitted by law.
+$USAGE
+END
+our %opts;
+getopts('Do:hV',\%opts) or die $USAGE;
+
+if ($opts{h} || $opts{V}){
+    print $VERSION;
+    exit 0;
+}
+
+################################################################
+# Defaults and parameters
+################################################################
+
+my $inputfile = shift;
+
+my $outputfile = $inputfile;
+
+$outputfile =~ s/\.([^\.]*)$/_cleaned.$1/;
+
+if (exists $opts{o}) {
+    $outputfile = $opts{o};
+}
+
+my $deleteUrl = 1;
+if (exists $opts{D}) {
+    $deleteUrl = 0;
+}		
+
+
+my $input= IO::File->new($inputfile) or 
+    die "Cannot find BibTeX file $inputfile\n$USAGE\n";
+my $output = IO::File->new("> $outputfile") or 
+    die "Cannot write to $outputfile\n$USAGE\n";
+
+my $parser=new BibTeX::Parser($input);
+
+
+
+# Processing the input
+while (my $entry = $parser->next) {
+    if (!$entry->parse_ok()) {
+	print STDERR "Cannot understand entry: ";
+	$entry->print(*STDERR);
+	print STDERR "Skipping this entry\n";
+	next;
+    }
+
+    if ($entry->has('doi') || !$entry->has('url')) {
+	print $output $entry->raw_bibtex(), "\n\n";
+	next;
+    }
+
+    if ($entry->field('url') =~ m|^http(?:s)?://(?:dx\.)?doi\.org/(.*)$|) {
+	$entry->field('doi', $1);
+	if ($deleteUrl) {
+	    delete $entry->{'url'};
+	}
+	print $output $entry->to_string(), "\n\n";
+    } else {
+	print $output $entry->raw_bibtex(), "\n\n";
+    }
+}
+	
+    
+					  


Property changes on: trunk/Master/texmf-dist/scripts/crossrefware/biburl2doi.pl
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Modified: trunk/Master/tlpkg/tlpsrc/crossrefware.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/crossrefware.tlpsrc	2017-11-27 22:37:58 UTC (rev 45926)
+++ trunk/Master/tlpkg/tlpsrc/crossrefware.tlpsrc	2017-11-27 22:40:18 UTC (rev 45927)
@@ -7,6 +7,9 @@
 binpattern f bin/${ARCH}/bibmradd
 docpattern +f texmf-dist/doc/man/man1/bibmradd.*
 #
+binpattern f bin/${ARCH}/biburl2doi
+docpattern +f texmf-dist/doc/man/man1/biburl2doi.*
+#
 binpattern f bin/${ARCH}/bibzbladd
 docpattern +f texmf-dist/doc/man/man1/bibzbladd.*
 #



More information about the tex-live-commits mailing list