diff options
author | Karl Berry <karl@freefriends.org> | 2017-11-27 22:40:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-11-27 22:40:18 +0000 |
commit | 413f04d6aa934ae22b495949cbc2aa487737abde (patch) | |
tree | 847e895ad110ec3fd3d0ff4ba1689b8a4f75e8f6 /Master | |
parent | 68269883bdbfd89d17c6e696df91405a5f799cb5 (diff) |
crossrefware (27nov17)
git-svn-id: svn://tug.org/texlive/trunk@45927 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
32 files changed, 418 insertions, 20 deletions
diff --git a/Master/bin/amd64-freebsd/biburl2doi b/Master/bin/amd64-freebsd/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/amd64-freebsd/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/amd64-netbsd/biburl2doi b/Master/bin/amd64-netbsd/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/amd64-netbsd/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/armel-linux/biburl2doi b/Master/bin/armel-linux/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/armel-linux/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/armhf-linux/biburl2doi b/Master/bin/armhf-linux/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/armhf-linux/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/i386-cygwin/biburl2doi b/Master/bin/i386-cygwin/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/i386-cygwin/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/i386-darwin/biburl2doi b/Master/bin/i386-darwin/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/i386-darwin/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/i386-freebsd/biburl2doi b/Master/bin/i386-freebsd/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/i386-freebsd/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/i386-linux/biburl2doi b/Master/bin/i386-linux/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/i386-linux/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/i386-netbsd/biburl2doi b/Master/bin/i386-netbsd/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/i386-netbsd/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/i386-solaris/biburl2doi b/Master/bin/i386-solaris/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/i386-solaris/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/powerpc-darwin/biburl2doi b/Master/bin/powerpc-darwin/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/powerpc-darwin/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/powerpc-linux/biburl2doi b/Master/bin/powerpc-linux/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/powerpc-linux/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/sparc-solaris/biburl2doi b/Master/bin/sparc-solaris/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/sparc-solaris/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/win32/biburl2doi.exe b/Master/bin/win32/biburl2doi.exe Binary files differnew file mode 100755 index 00000000000..5777d90a17a --- /dev/null +++ b/Master/bin/win32/biburl2doi.exe diff --git a/Master/bin/x86_64-cygwin/biburl2doi b/Master/bin/x86_64-cygwin/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/x86_64-cygwin/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-darwin/biburl2doi b/Master/bin/x86_64-darwin/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/x86_64-darwin/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-darwinlegacy/biburl2doi b/Master/bin/x86_64-darwinlegacy/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/x86_64-darwinlegacy/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-linux/biburl2doi b/Master/bin/x86_64-linux/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/x86_64-linux/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-solaris/biburl2doi b/Master/bin/x86_64-solaris/biburl2doi new file mode 120000 index 00000000000..0413128bda8 --- /dev/null +++ b/Master/bin/x86_64-solaris/biburl2doi @@ -0,0 +1 @@ +../../texmf-dist/scripts/crossrefware/biburl2doi.pl
\ No newline at end of file diff --git a/Master/texmf-dist/doc/man/man1/bbl2bib.1 b/Master/texmf-dist/doc/man/man1/bbl2bib.1 index a7d7ba5e8c9..d09b405a668 100644 --- a/Master/texmf-dist/doc/man/man1/bbl2bib.1 +++ b/Master/texmf-dist/doc/man/man1/bbl2bib.1 @@ -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 @@ Send debugging output to stdout .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 @@ creating the corresponding BibTeX fields. 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 diff --git a/Master/texmf-dist/doc/man/man1/bbl2bib.man1.pdf b/Master/texmf-dist/doc/man/man1/bbl2bib.man1.pdf Binary files differindex 4993ba97652..9ee1cb5bde2 100644 --- a/Master/texmf-dist/doc/man/man1/bbl2bib.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/bbl2bib.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/bibdoiadd.1 b/Master/texmf-dist/doc/man/man1/bibdoiadd.1 index b96a28bfb3e..0c01604bd64 100644 --- a/Master/texmf-dist/doc/man/man1/bibdoiadd.1 +++ b/Master/texmf-dist/doc/man/man1/bibdoiadd.1 @@ -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,13 +142,16 @@ 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 .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 @@ output file is formed by adding \f(CW\*(C`_doi\*(C'\fR to the input file .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 diff --git a/Master/texmf-dist/doc/man/man1/bibdoiadd.man1.pdf b/Master/texmf-dist/doc/man/man1/bibdoiadd.man1.pdf Binary files differindex c289f801382..3cb5bebd318 100644 --- a/Master/texmf-dist/doc/man/man1/bibdoiadd.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/bibdoiadd.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/biburl2doi.1 b/Master/texmf-dist/doc/man/man1/biburl2doi.1 new file mode 100644 index 00000000000..5eee6a2cb38 --- /dev/null +++ b/Master/texmf-dist/doc/man/man1/biburl2doi.1 @@ -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. diff --git a/Master/texmf-dist/doc/man/man1/biburl2doi.man1.pdf b/Master/texmf-dist/doc/man/man1/biburl2doi.man1.pdf Binary files differnew file mode 100644 index 00000000000..57e5611ae98 --- /dev/null +++ b/Master/texmf-dist/doc/man/man1/biburl2doi.man1.pdf diff --git a/Master/texmf-dist/doc/support/crossrefware/Makefile b/Master/texmf-dist/doc/support/crossrefware/Makefile index 338eee52ace..8181d382e32 100644 --- a/Master/texmf-dist/doc/support/crossrefware/Makefile +++ b/Master/texmf-dist/doc/support/crossrefware/Makefile @@ -3,6 +3,7 @@ SCRIPTS = \ bibdoiadd.pl \ bibzbladd.pl \ bibmradd.pl \ + biburl2doi.pl \ bbl2bib.pl PACKAGE = crossrefware diff --git a/Master/texmf-dist/doc/support/crossrefware/README b/Master/texmf-dist/doc/support/crossrefware/README index 2c695d69563..06d9c4bc731 100644 --- a/Master/texmf-dist/doc/support/crossrefware/README +++ b/Master/texmf-dist/doc/support/crossrefware/README @@ -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 @@ bibdoiadd.pl - add DOI numbers to papers in a given bib file 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 @@ Installation: 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 diff --git a/Master/texmf-dist/doc/support/crossrefware/crossrefware.pdf b/Master/texmf-dist/doc/support/crossrefware/crossrefware.pdf Binary files differindex 4f99fbd5f4b..7acbb55e2e9 100644 --- a/Master/texmf-dist/doc/support/crossrefware/crossrefware.pdf +++ b/Master/texmf-dist/doc/support/crossrefware/crossrefware.pdf diff --git a/Master/texmf-dist/scripts/crossrefware/bbl2bib.pl b/Master/texmf-dist/scripts/crossrefware/bbl2bib.pl index 477412d140e..3f66a6f061b 100755 --- a/Master/texmf-dist/scripts/crossrefware/bbl2bib.pl +++ b/Master/texmf-dist/scripts/crossrefware/bbl2bib.pl @@ -8,7 +8,7 @@ bbl2bib.pl - convert thebibliography environment to a bib file =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. If this option is not used, the name for the 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 @@ The script reads a TeX or Bbl file and extracts from it the 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 @@ use LWP::Simple; $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 @@ extent permitted by law. $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 @@ if ($opts{d}) { $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 @@ sub ProcessBibitem { } $bibitem->{bib} = SearchMref($bibitem); + + if ($cleanUrls) { + $bibitem->{bib} = CleanUrl ($bibitem->{bib}); + } + PrintBibitem($bibitem); return; } @@ -258,7 +277,25 @@ sub SearchMref { } } +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 { diff --git a/Master/texmf-dist/scripts/crossrefware/bibdoiadd.pl b/Master/texmf-dist/scripts/crossrefware/bibdoiadd.pl index 52eba925283..219896bf404 100755 --- a/Master/texmf-dist/scripts/crossrefware/bibdoiadd.pl +++ b/Master/texmf-dist/scripts/crossrefware/bibdoiadd.pl @@ -8,7 +8,7 @@ bibdoiadd.pl - add DOI numbers to papers in a given bib file =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 @@ bibdoiadd [B<-c> I<config_file>] [B<-e> 1|0] [B<-f>] [B<-o> I<output>] I<bib_fil 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 @@ output file is formed by adding C<_doi> to the input file =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 @@ use LWP::Simple; # 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 @@ extent permitted by law. $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 @@ if (exists $opts{e}) { $forceEmpty = $opts{e}; } +my $canonizeNames = 1; +if (exists $opts{C}) { + $canonizeNames = $opts{C}; +} + our $mode='free'; our $email; our $username; @@ -195,7 +204,8 @@ while (my $entry = $parser->next) { 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,7 +220,10 @@ while (my $entry = $parser->next) { 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"; } diff --git a/Master/texmf-dist/scripts/crossrefware/biburl2doi.pl b/Master/texmf-dist/scripts/crossrefware/biburl2doi.pl new file mode 100755 index 00000000000..76d1842bf92 --- /dev/null +++ b/Master/texmf-dist/scripts/crossrefware/biburl2doi.pl @@ -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"; + } +} + + + diff --git a/Master/tlpkg/tlpsrc/crossrefware.tlpsrc b/Master/tlpkg/tlpsrc/crossrefware.tlpsrc index f71b9cef035..6de0df4ce25 100644 --- a/Master/tlpkg/tlpsrc/crossrefware.tlpsrc +++ b/Master/tlpkg/tlpsrc/crossrefware.tlpsrc @@ -7,6 +7,9 @@ docpattern +f texmf-dist/doc/man/man1/bibdoiadd.* 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.* # |