texlive[50677] trunk: bibexport (31mar19)
commits+karl at tug.org
commits+karl at tug.org
Sun Mar 31 23:42:08 CEST 2019
Revision: 50677
http://tug.org/svn/texlive?view=revision&revision=50677
Author: karl
Date: 2019-03-31 23:42:07 +0200 (Sun, 31 Mar 2019)
Log Message:
-----------
bibexport (31mar19)
Modified Paths:
--------------
trunk/Build/source/texk/texlive/linked_scripts/bibexport/bibexport.sh
trunk/Master/bin/aarch64-linux/asy
trunk/Master/texmf-dist/bibtex/bst/bibexport/expcites.bst
trunk/Master/texmf-dist/bibtex/bst/bibexport/expkeys.bst
trunk/Master/texmf-dist/bibtex/bst/bibexport/export.bst
trunk/Master/texmf-dist/doc/bibtex/bibexport/README
trunk/Master/texmf-dist/doc/bibtex/bibexport/bibexport.pdf
trunk/Master/texmf-dist/scripts/bibexport/bibexport.sh
trunk/Master/texmf-dist/source/bibtex/bibexport/bibexport.dtx
trunk/Master/texmf-dist/source/bibtex/bibexport/bibexport.ins
Modified: trunk/Build/source/texk/texlive/linked_scripts/bibexport/bibexport.sh
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/bibexport/bibexport.sh 2019-03-31 21:29:54 UTC (rev 50676)
+++ trunk/Build/source/texk/texlive/linked_scripts/bibexport/bibexport.sh 2019-03-31 21:42:07 UTC (rev 50677)
@@ -7,7 +7,7 @@
##
## bibexport.dtx (with options: `script')
##
-## (c) 2016/03/02 Nicolas Markey <bibexport at markey dot fr>
+## (c) 2019/03/30 Nicolas Markey <bibexport at markey dot fr>
##
## This work may be distributed and/or modified under the conditions of
## the LaTeX Project Public License, either version 1.3 of this license
@@ -58,6 +58,8 @@
--------------
-a, --all export the entire .bib files
-o bib, --output-file bib write output to file [default: bibexport.bib]
+ -ns, --nosave overwrite output file without keeping a copy
+ -p, --preamble write a preamble at beginning of output
-t, --terse operate silently
-h, --help print this message and exit
-v, --version print version number and exit
@@ -70,7 +72,6 @@
-e bib, --extra bib extra .bib file to be used (crossrefs and strings)
-es bib, --extras bib extra .bib file to be used (for strings)
-ec bib, --extrac bib extra .bib file to be used (for crossrefs)
- -p, --preamble write a preamble at beginning of output
-r bib, --replace bib replace .bib file(s) in the .aux file
-d, --debug create intermediate files but don't run BibTeX";
exit 0;
@@ -77,18 +78,18 @@
}
function opttoolate()
{
-if [ ${TOOLATE} -ne 0 ]; then
- echo "No option is allowed after the input files";
+if [ ! -z "${TOOLATE}" ]; then
+ echo "No options are allowed after the input files";
exit 0;
fi
}
## Version number
-VERSION="3.02";
+VERSION="3.03";
## Release date
-VDATE="2016/03/02";
+VDATE="2019/03/30";
# ALL is a flag set to 1 when '-a' is given
-ALL="0";
+ALL="";
# FILE will be the main input file(s) (.aux or .bib, depending on '-a')
FILE="";
# EXT is the extension of the input file(s) (.aux, or .bib if '-a')
@@ -99,7 +100,7 @@
EXTRABIB="";
# REPLACEBIB ('-r') is set to 1 when the \bibdata of the .aux input file
# must be ignores (then '-e' must be used)
-REPLACEBIB="0";
+REPLACEBIB="";
# NEWBIB will contain the argument given to -r
NEWBIB="";
# BST is the .bst file to be used (default to export.bst)
@@ -106,8 +107,10 @@
BST="export";
# TERSE will be set to '-terse' if '-t' is given
TERSE="";
+# NOSAVE if no need to save file before overwriting it
+NOSAVE=""
# BANNER is used to turn on or off the preamble informations in the output
-BANNER="false";
+BANNER="";
# CREF is the number of citations of crossrefs from which the crossref'd entry
# must be included.
CREF="0";
@@ -115,7 +118,7 @@
# SPACE will be either ' ' or ','
SPACE="";
# TOOLATE is used to prevent extra options after the main file
-TOOLATE="0";
+TOOLATE="";
# DEBUG is used to create files but not run BibTeX.
DEBUG="";
@@ -130,7 +133,7 @@
## - export all entries in the input file(s)
## - the input files are BibTeX files
opttoolate;
- EXT=""; SPACE=""; ALL=1;
+ EXT=""; SPACE=""; ALL="a";
shift ;;
-b|--bst)
## - specifies the .bst file to use (default to 'export.bst')
@@ -146,7 +149,7 @@
## - debug mode: we create files but do not run bibtex
## - instead, we print what we would have done...
opttoolate;
- DEBUG="echo";
+ DEBUG="a";
shift ;;
-e|--extra)
## - extra input files (containing crossrefs or strings)
@@ -153,7 +156,7 @@
## - they will be included twice: once before the main file(s)
## (for @string's), once after (for crossrefs). We fool BibTeX
## by naming the first one 'file.bib' and the second one
- ## 'file.bib.bib', to avoid complains.
+ ## 'file.bib.bib', to avoid complaints.
opttoolate;
if [ "`dirname $2`" = "." ]; then
DOLLARTWO="`basename $2 .bib`";
@@ -215,7 +218,7 @@
## - to replace the file(s) given in \bibdata in the .aux file with
## (a) new one(s).
opttoolate;
- REPLACEBIB="1";
+ REPLACEBIB="a";
if [ "`dirname $2`" = "." ]; then
DOLLARTWO="`basename $2 .bib`";
else
@@ -225,8 +228,11 @@
shift 2;;
-v|--version)
echo "This is bibexport v${VERSION} (released ${VDATE})"; exit 0;;
+ -ns|--nosave|--no-save)
+ NOSAVE="a";
+ shift ;;
-p|--preamble|--with-preamble)
- BANNER="true";
+ BANNER="a";
shift ;;
-t|--terse|--silent)
TERSE=" -terse ";
@@ -236,7 +242,7 @@
*)
## - list of input files
## - we ensure that no extra option is given later...
- TOOLATE="1";
+ TOOLATE="a";
if [ "`dirname $1`" = "." ]; then
DOLLARONE="`basename $1 ${EXT}`";
else
@@ -243,10 +249,10 @@
DOLLARONE="`dirname $1`/`basename $1 ${EXT}`";
fi
FILE="${FILE}${SPACE}${DOLLARONE}${EXT}";
- if [ ${ALL} -eq 1 ]; then
+ if [ -z "${ALL}" ]; then
+ SPACE=" ";
+ else
SPACE=",";
- else
- SPACE=" ";
fi;
shift;;
esac
@@ -280,23 +286,27 @@
EOF
fi
else ## we only export entries listed in the given .aux file:
- if [ ! "x${REPLACEBIB}" = "x1" ]; then
+ if [ -z "${REPLACEBIB}" ]; then
cat ${FILE} | sed -e "s/bibstyle{.*}/bibstyle{${BST}}/" > ${TMPFILE}.aux;
else
cat ${FILE} | sed -e "s/bibstyle{.*}/bibstyle{${BST}}/" \
- -e "s/bibdata{.*}/bibdata{${EXTRA}${NEWBIB%,}${EXTRABIB}}/" > ${TMPFILE}.aux;
+ -e "s|bibdata{.*}|bibdata{${EXTRA}${NEWBIB%,}${EXTRABIB}}|" > ${TMPFILE}.aux;
fi
fi
if [ -z "$DEBUG" ]; then
bibtex -min-crossrefs=${CREF} ${TERSE} ${TMPFILE};
- if [ -e ${FINALFILE} ]; then
+ if [ -e ${FINALFILE} ] && [ -z "${NOSAVE}" ]; then
mv ${FINALFILE} ${FINALFILE}-save-`date "+%Y.%m.%d:%H.%M.%S"`
fi
echo "" > ${FINALFILE}
else
echo "bibtex -min-crossrefs=${CREF} ${TERSE} ${TMPFILE};"
+ if [ -e ${FINALFILE} ] && [ -z "${NOSAVE}" ]; then
+ echo "mv ${FINALFILE} ${FINALFILE}-save-`date \"+%Y.%m.%d:%H.%M.%S\"`"
+ fi
+ echo "echo \"\" > ${FINALFILE}"
fi
-if [ ! "${BANNER}" = "false" ]; then
+if [ ! -z "${BANNER}" ]; then
## list of cited entries
if [ -z "$DEBUG" ]; then
sed -i -e "s/\\\bibstyle{.*}/\\\bibstyle{expcites}/" ${TMPFILE}.aux
@@ -309,8 +319,8 @@
echo -ne " source files:\t\t${FILETAB}\t\t\t${EXTRABIBTAB}\n" >> ${FINALFILE}; \
fi
cat ${TMPFILE}-cites.bbl >> ${FINALFILE};
- echo -ne " bibexport-version:\tv${VERSION} (${VDATE})\n" >> ${FINALFILE};
- echo -ne " bibexport-maintainer:\tmarkey(at)lsv.ens-cachan.fr\n" >> ${FINALFILE};
+ #echo -ne " bibexport-version:\tv${VERSION} (${VDATE})\n" >> ${FINALFILE};
+ #echo -ne " bibexport-maintainer:\tNicolas Markey <bibexport(at)markey.fr>\n" >> ${FINALFILE};
sed -i -e "s/}/)/g" ${FINALFILE};
echo -n -e "}\n\n\n" >> ${FINALFILE};
rm -f ${TMPFILE}-cites.bbl ${TMPFILE}-cites.aux ${TMPFILE}-cites.blg
Modified: trunk/Master/bin/aarch64-linux/asy
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/bibtex/bst/bibexport/expcites.bst
===================================================================
--- trunk/Master/texmf-dist/bibtex/bst/bibexport/expcites.bst 2019-03-31 21:29:54 UTC (rev 50676)
+++ trunk/Master/texmf-dist/bibtex/bst/bibexport/expcites.bst 2019-03-31 21:42:07 UTC (rev 50677)
@@ -6,7 +6,7 @@
%%
%% bibexport.dtx (with options: `expcites')
%%
-%% (c) 2016/03/02 Nicolas Markey <bibexport at markey dot fr>
+%% (c) 2019/03/30 Nicolas Markey <bibexport at markey dot fr>
%%
%% This work may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3 of this license
@@ -65,7 +65,7 @@
}
INTEGERS{left.length right.length}
STRINGS{ s t }
-INTEGERS{bool}
+INTEGERS{bool cpt}
FUNCTION{space.complete}
{
'left.length :=
@@ -105,12 +105,13 @@
{
left.delim 's :=
#0 'bool :=
+ #0 'cpt :=
}
FUNCTION{write.cited.keys}
{
bool
{"" left.width space.complete swap$}
- {" cited keys: " left.width space.complete swap$
+ {" list of keys: " left.width space.complete swap$
#1 'bool :=}
if$
{duplicate$ text.length$ right.width >}
@@ -127,7 +128,7 @@
{
bool
{"" left.width space.complete swap$}
- {" cited keys: " left.width space.complete swap$
+ {" list of keys: " left.width space.complete swap$
#1 'bool :=}
if$
{duplicate$ duplicate$ text.length$ #1 substring$ "," = not}
@@ -134,7 +135,7 @@
{duplicate$ text.length$ #1 - #1 swap$ substring$}
while$
duplicate$ text.length$ #1 - #1 swap$ substring$
- right.delim *
+ right.delim * "," *
{duplicate$ "" = not}
{
right.width split.string 't :=
@@ -145,8 +146,15 @@
while$
pop$ pop$
}
+FUNCTION{write.nbkeys}
+{
+ " number of entries: " left.width space.complete
+ " " *
+ cpt int.to.str$ * "," * write$ newline$
+}
FUNCTION{cited.keys}
{
+ cpt #1 + 'cpt :=
s cite$ ", " * * 's :=
s text.length$ #4000 >
{s write.cited.keys 's :=}
@@ -156,6 +164,7 @@
FUNCTION{end.cited.keys}
{
s write.cited.keys.last
+ write.nbkeys
}
FUNCTION{article}{cited.keys}
FUNCTION{book}{cited.keys}
Modified: trunk/Master/texmf-dist/bibtex/bst/bibexport/expkeys.bst
===================================================================
--- trunk/Master/texmf-dist/bibtex/bst/bibexport/expkeys.bst 2019-03-31 21:29:54 UTC (rev 50676)
+++ trunk/Master/texmf-dist/bibtex/bst/bibexport/expkeys.bst 2019-03-31 21:42:07 UTC (rev 50677)
@@ -6,7 +6,7 @@
%%
%% bibexport.dtx (with options: `expkeys')
%%
-%% (c) 2016/03/02 Nicolas Markey <bibexport at markey dot fr>
+%% (c) 2019/03/30 Nicolas Markey <bibexport at markey dot fr>
%%
%% This work may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3 of this license
Modified: trunk/Master/texmf-dist/bibtex/bst/bibexport/export.bst
===================================================================
--- trunk/Master/texmf-dist/bibtex/bst/bibexport/export.bst 2019-03-31 21:29:54 UTC (rev 50676)
+++ trunk/Master/texmf-dist/bibtex/bst/bibexport/export.bst 2019-03-31 21:42:07 UTC (rev 50677)
@@ -6,7 +6,7 @@
%%
%% bibexport.dtx (with options: `export')
%%
-%% (c) 2016/03/02 Nicolas Markey <bibexport at markey dot fr>
+%% (c) 2019/03/30 Nicolas Markey <bibexport at markey dot fr>
%%
%% This work may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3 of this license
@@ -71,11 +71,13 @@
acronym
annote
biburl
+ bibsource
doi
eid
isbn
issn
language
+ timestamp
url
urn
}{}{}
@@ -388,11 +390,13 @@
"acronym" acronym field.export
"annote" annote field.export
"biburl" biburl url.export
+ "bibsource" bibsource field.export
"doi" doi field.export
"eid" eid field.export
"isbn" isbn field.export
"issn" issn field.export
"language" language field.export
+ "timestamp" timestamp field.export
"url" url url.export
"urn" urn url.export
}
Modified: trunk/Master/texmf-dist/doc/bibtex/bibexport/README
===================================================================
--- trunk/Master/texmf-dist/doc/bibtex/bibexport/README 2019-03-31 21:29:54 UTC (rev 50676)
+++ trunk/Master/texmf-dist/doc/bibtex/bibexport/README 2019-03-31 21:42:07 UTC (rev 50677)
@@ -1,6 +1,6 @@
bibexport.sh -- extract BibTeX entries out of .bib file(s).
(Nicolas Markey -- <bibexport(at)markey.fr>)
- version 3.02 -- 2016/03/02
+ version 3.03 -- 2019/03/30
This is a shell script using BibTeX to extract .bib entries that are
\cite'd in a document. It also permits to expand a BibTeX file,
@@ -9,7 +9,7 @@
----------------------------------------------------------------------
-(c) 2016/03/02 Nicolas Markey <bibexport at markey dot fr>
+(c) 2019/03/30 Nicolas Markey <bibexport at markey dot fr>
This work may be distributed and/or modified under the conditions of
the LaTeX Project Public License, either version 1.3 of this license
Modified: trunk/Master/texmf-dist/doc/bibtex/bibexport/bibexport.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/scripts/bibexport/bibexport.sh
===================================================================
--- trunk/Master/texmf-dist/scripts/bibexport/bibexport.sh 2019-03-31 21:29:54 UTC (rev 50676)
+++ trunk/Master/texmf-dist/scripts/bibexport/bibexport.sh 2019-03-31 21:42:07 UTC (rev 50677)
@@ -7,7 +7,7 @@
##
## bibexport.dtx (with options: `script')
##
-## (c) 2016/03/02 Nicolas Markey <bibexport at markey dot fr>
+## (c) 2019/03/30 Nicolas Markey <bibexport at markey dot fr>
##
## This work may be distributed and/or modified under the conditions of
## the LaTeX Project Public License, either version 1.3 of this license
@@ -58,6 +58,8 @@
--------------
-a, --all export the entire .bib files
-o bib, --output-file bib write output to file [default: bibexport.bib]
+ -ns, --nosave overwrite output file without keeping a copy
+ -p, --preamble write a preamble at beginning of output
-t, --terse operate silently
-h, --help print this message and exit
-v, --version print version number and exit
@@ -70,7 +72,6 @@
-e bib, --extra bib extra .bib file to be used (crossrefs and strings)
-es bib, --extras bib extra .bib file to be used (for strings)
-ec bib, --extrac bib extra .bib file to be used (for crossrefs)
- -p, --preamble write a preamble at beginning of output
-r bib, --replace bib replace .bib file(s) in the .aux file
-d, --debug create intermediate files but don't run BibTeX";
exit 0;
@@ -77,18 +78,18 @@
}
function opttoolate()
{
-if [ ${TOOLATE} -ne 0 ]; then
- echo "No option is allowed after the input files";
+if [ ! -z "${TOOLATE}" ]; then
+ echo "No options are allowed after the input files";
exit 0;
fi
}
## Version number
-VERSION="3.02";
+VERSION="3.03";
## Release date
-VDATE="2016/03/02";
+VDATE="2019/03/30";
# ALL is a flag set to 1 when '-a' is given
-ALL="0";
+ALL="";
# FILE will be the main input file(s) (.aux or .bib, depending on '-a')
FILE="";
# EXT is the extension of the input file(s) (.aux, or .bib if '-a')
@@ -99,7 +100,7 @@
EXTRABIB="";
# REPLACEBIB ('-r') is set to 1 when the \bibdata of the .aux input file
# must be ignores (then '-e' must be used)
-REPLACEBIB="0";
+REPLACEBIB="";
# NEWBIB will contain the argument given to -r
NEWBIB="";
# BST is the .bst file to be used (default to export.bst)
@@ -106,8 +107,10 @@
BST="export";
# TERSE will be set to '-terse' if '-t' is given
TERSE="";
+# NOSAVE if no need to save file before overwriting it
+NOSAVE=""
# BANNER is used to turn on or off the preamble informations in the output
-BANNER="false";
+BANNER="";
# CREF is the number of citations of crossrefs from which the crossref'd entry
# must be included.
CREF="0";
@@ -115,7 +118,7 @@
# SPACE will be either ' ' or ','
SPACE="";
# TOOLATE is used to prevent extra options after the main file
-TOOLATE="0";
+TOOLATE="";
# DEBUG is used to create files but not run BibTeX.
DEBUG="";
@@ -130,7 +133,7 @@
## - export all entries in the input file(s)
## - the input files are BibTeX files
opttoolate;
- EXT=""; SPACE=""; ALL=1;
+ EXT=""; SPACE=""; ALL="a";
shift ;;
-b|--bst)
## - specifies the .bst file to use (default to 'export.bst')
@@ -146,7 +149,7 @@
## - debug mode: we create files but do not run bibtex
## - instead, we print what we would have done...
opttoolate;
- DEBUG="echo";
+ DEBUG="a";
shift ;;
-e|--extra)
## - extra input files (containing crossrefs or strings)
@@ -153,7 +156,7 @@
## - they will be included twice: once before the main file(s)
## (for @string's), once after (for crossrefs). We fool BibTeX
## by naming the first one 'file.bib' and the second one
- ## 'file.bib.bib', to avoid complains.
+ ## 'file.bib.bib', to avoid complaints.
opttoolate;
if [ "`dirname $2`" = "." ]; then
DOLLARTWO="`basename $2 .bib`";
@@ -215,7 +218,7 @@
## - to replace the file(s) given in \bibdata in the .aux file with
## (a) new one(s).
opttoolate;
- REPLACEBIB="1";
+ REPLACEBIB="a";
if [ "`dirname $2`" = "." ]; then
DOLLARTWO="`basename $2 .bib`";
else
@@ -225,8 +228,11 @@
shift 2;;
-v|--version)
echo "This is bibexport v${VERSION} (released ${VDATE})"; exit 0;;
+ -ns|--nosave|--no-save)
+ NOSAVE="a";
+ shift ;;
-p|--preamble|--with-preamble)
- BANNER="true";
+ BANNER="a";
shift ;;
-t|--terse|--silent)
TERSE=" -terse ";
@@ -236,7 +242,7 @@
*)
## - list of input files
## - we ensure that no extra option is given later...
- TOOLATE="1";
+ TOOLATE="a";
if [ "`dirname $1`" = "." ]; then
DOLLARONE="`basename $1 ${EXT}`";
else
@@ -243,10 +249,10 @@
DOLLARONE="`dirname $1`/`basename $1 ${EXT}`";
fi
FILE="${FILE}${SPACE}${DOLLARONE}${EXT}";
- if [ ${ALL} -eq 1 ]; then
+ if [ -z "${ALL}" ]; then
+ SPACE=" ";
+ else
SPACE=",";
- else
- SPACE=" ";
fi;
shift;;
esac
@@ -280,23 +286,27 @@
EOF
fi
else ## we only export entries listed in the given .aux file:
- if [ ! "x${REPLACEBIB}" = "x1" ]; then
+ if [ -z "${REPLACEBIB}" ]; then
cat ${FILE} | sed -e "s/bibstyle{.*}/bibstyle{${BST}}/" > ${TMPFILE}.aux;
else
cat ${FILE} | sed -e "s/bibstyle{.*}/bibstyle{${BST}}/" \
- -e "s/bibdata{.*}/bibdata{${EXTRA}${NEWBIB%,}${EXTRABIB}}/" > ${TMPFILE}.aux;
+ -e "s|bibdata{.*}|bibdata{${EXTRA}${NEWBIB%,}${EXTRABIB}}|" > ${TMPFILE}.aux;
fi
fi
if [ -z "$DEBUG" ]; then
bibtex -min-crossrefs=${CREF} ${TERSE} ${TMPFILE};
- if [ -e ${FINALFILE} ]; then
+ if [ -e ${FINALFILE} ] && [ -z "${NOSAVE}" ]; then
mv ${FINALFILE} ${FINALFILE}-save-`date "+%Y.%m.%d:%H.%M.%S"`
fi
echo "" > ${FINALFILE}
else
echo "bibtex -min-crossrefs=${CREF} ${TERSE} ${TMPFILE};"
+ if [ -e ${FINALFILE} ] && [ -z "${NOSAVE}" ]; then
+ echo "mv ${FINALFILE} ${FINALFILE}-save-`date \"+%Y.%m.%d:%H.%M.%S\"`"
+ fi
+ echo "echo \"\" > ${FINALFILE}"
fi
-if [ ! "${BANNER}" = "false" ]; then
+if [ ! -z "${BANNER}" ]; then
## list of cited entries
if [ -z "$DEBUG" ]; then
sed -i -e "s/\\\bibstyle{.*}/\\\bibstyle{expcites}/" ${TMPFILE}.aux
@@ -309,8 +319,8 @@
echo -ne " source files:\t\t${FILETAB}\t\t\t${EXTRABIBTAB}\n" >> ${FINALFILE}; \
fi
cat ${TMPFILE}-cites.bbl >> ${FINALFILE};
- echo -ne " bibexport-version:\tv${VERSION} (${VDATE})\n" >> ${FINALFILE};
- echo -ne " bibexport-maintainer:\tmarkey(at)lsv.ens-cachan.fr\n" >> ${FINALFILE};
+ #echo -ne " bibexport-version:\tv${VERSION} (${VDATE})\n" >> ${FINALFILE};
+ #echo -ne " bibexport-maintainer:\tNicolas Markey <bibexport(at)markey.fr>\n" >> ${FINALFILE};
sed -i -e "s/}/)/g" ${FINALFILE};
echo -n -e "}\n\n\n" >> ${FINALFILE};
rm -f ${TMPFILE}-cites.bbl ${TMPFILE}-cites.aux ${TMPFILE}-cites.blg
Modified: trunk/Master/texmf-dist/source/bibtex/bibexport/bibexport.dtx
===================================================================
--- trunk/Master/texmf-dist/source/bibtex/bibexport/bibexport.dtx 2019-03-31 21:29:54 UTC (rev 50676)
+++ trunk/Master/texmf-dist/source/bibtex/bibexport/bibexport.dtx 2019-03-31 21:42:07 UTC (rev 50677)
@@ -16,8 +16,8 @@
%%%\AtBeginDocument{\CodelineIndex\EnableCrossrefs}
%%%\AtEndDocument{\PrintIndex}
\begin{document}
- \def\docdate{2016/03/02}
- \def\fileversion{3.02}
+ \def\docdate{2019/03/30}
+ \def\fileversion{3.03}
%%% Please also change date at the beginning of the script %%%
%%% (VERSION and VDATE below) %%%
\DocInput{bibexport.dtx}
@@ -25,7 +25,7 @@
%</driver>
%
% \fi
-% \CheckSum{41}
+% \CheckSum{45}
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -149,7 +149,7 @@
%
% \subsection{Exporting extra fields}
%
-% By~default, \script{bibexport.sh} exports only "standard" fields
+% By~default, \script{bibexport} exports only "standard" fields
% (those defined and used in \bst{plain}), as~well as a few
% others. It~is very easy to modify it in order to export other fields:
% it~suffices to modify \bst{export} as follows:
@@ -169,8 +169,9 @@
% \end{itemize}
%
% \subsection*{Acknowledgements}
-% I thank \'Eric Colin de Verdi\`ere, Richard Mathar, Harald Hanche-Olsen
-% and Damien Pollet for suggesting several improvements or corrections.
+% I thank \'Eric Colin de Verdi\`ere, Richard Mathar, Harald Hanche-Olsen,
+% Damien Pollet, and Caner Kazanci for suggesting several improvements
+% or corrections.
%
% \section{The code}
% \subsection{The shell script}
@@ -208,6 +209,8 @@
--------------
-a, --all export the entire .bib files
-o bib, --output-file bib write output to file [default: bibexport.bib]
+ -ns, --nosave overwrite output file without keeping a copy
+ -p, --preamble write a preamble at beginning of output
-t, --terse operate silently
-h, --help print this message and exit
-v, --version print version number and exit
@@ -220,7 +223,6 @@
-e bib, --extra bib extra .bib file to be used (crossrefs and strings)
-es bib, --extras bib extra .bib file to be used (for strings)
-ec bib, --extrac bib extra .bib file to be used (for crossrefs)
- -p, --preamble write a preamble at beginning of output
-r bib, --replace bib replace .bib file(s) in the .aux file
-d, --debug create intermediate files but don't run BibTeX";
exit 0;
@@ -236,8 +238,8 @@
%<*script>
function opttoolate()
{
-if [ ${TOOLATE} -ne 0 ]; then
- echo "No option is allowed after the input files";
+if [ ! -z "${TOOLATE}" ]; then
+ echo "No options are allowed after the input files";
exit 0;
fi
}
@@ -259,6 +261,7 @@
%\begin{macro}{BST}
%\begin{macro}{TERSE}
%\begin{macro}{BANNER}
+%\begin{macro}{NOSAVE}
%\begin{macro}{ARGS}
%\begin{macro}{TOOLATE}
% We define the default value of some variables:
@@ -280,6 +283,7 @@
% \item \var{BST}: the \ext{bst} file to be used;
% \item \var{TERSE}: run silently;
% \item \var{BANNER}: don't print the initial comment;
+% \item \var{NOSAVE}: don't keep a copy if overwriting output file;
% \item \var{ARGS}: the list of aruments passed to \texttt{bibexport.sh};
% \item \var{TOOLATE}: options are not allowed once we have encountered the
% first non-option argument.
@@ -288,12 +292,12 @@
% \begin{macrocode}
%<*script>
## Version number
-VERSION="3.02";
+VERSION="3.03";
## Release date
-VDATE="2016/03/02";
+VDATE="2019/03/30";
# ALL is a flag set to 1 when '-a' is given
-ALL="0";
+ALL="";
# FILE will be the main input file(s) (.aux or .bib, depending on '-a')
FILE="";
# EXT is the extension of the input file(s) (.aux, or .bib if '-a')
@@ -304,7 +308,7 @@
EXTRABIB="";
# REPLACEBIB ('-r') is set to 1 when the \bibdata of the .aux input file
# must be ignores (then '-e' must be used)
-REPLACEBIB="0";
+REPLACEBIB="";
# NEWBIB will contain the argument given to -r
NEWBIB="";
# BST is the .bst file to be used (default to export.bst)
@@ -311,8 +315,10 @@
BST="export";
# TERSE will be set to '-terse' if '-t' is given
TERSE="";
+# NOSAVE if no need to save file before overwriting it
+NOSAVE=""
# BANNER is used to turn on or off the preamble informations in the output
-BANNER="false";
+BANNER="";
# CREF is the number of citations of crossrefs from which the crossref'd entry
# must be included.
CREF="0";
@@ -320,7 +326,7 @@
# SPACE will be either ' ' or ','
SPACE="";
# TOOLATE is used to prevent extra options after the main file
-TOOLATE="0";
+TOOLATE="";
# DEBUG is used to create files but not run BibTeX.
DEBUG="";
@@ -344,6 +350,7 @@
%\end{macro}
%\end{macro}
%\end{macro}
+%\end{macro}
%
% \subsubsection{Handling arguments}
%
@@ -375,7 +382,7 @@
## - export all entries in the input file(s)
## - the input files are BibTeX files
opttoolate;
- EXT=""; SPACE=""; ALL=1;
+ EXT=""; SPACE=""; ALL="a";
shift ;;
%</script>
% \end{macrocode}
@@ -405,7 +412,7 @@
## - debug mode: we create files but do not run bibtex
## - instead, we print what we would have done...
opttoolate;
- DEBUG="echo";
+ DEBUG="a";
shift ;;
%</script>
% \end{macrocode}
@@ -420,7 +427,7 @@
## - they will be included twice: once before the main file(s)
## (for @string's), once after (for crossrefs). We fool BibTeX
## by naming the first one 'file.bib' and the second one
- ## 'file.bib.bib', to avoid complains.
+ ## 'file.bib.bib', to avoid complaints.
opttoolate;
if [ "`dirname $2`" = "." ]; then
DOLLARTWO="`basename $2 .bib`";
@@ -520,7 +527,7 @@
## - to replace the file(s) given in \bibdata in the .aux file with
## (a) new one(s).
opttoolate;
- REPLACEBIB="1";
+ REPLACEBIB="a";
if [ "`dirname $2`" = "." ]; then
DOLLARTWO="`basename $2 .bib`";
else
@@ -537,12 +544,21 @@
echo "This is bibexport v${VERSION} (released ${VDATE})"; exit 0;;
%</script>
% \end{macrocode}
+%\item \verb+-ns+ or \verb+--nosave+ for not keeping a copy
+% of the output file if we overwrite it:
+% \begin{macrocode}
+%<*script>
+ -ns|--nosave|--no-save)
+ NOSAVE="a";
+ shift ;;
+%</script>
+% \end{macrocode}
%\item \verb+-p+ or \verb+--preamble+ for inserting some informations
% at the beginning of the output file:
% \begin{macrocode}
%<*script>
-p|--preamble|--with-preamble)
- BANNER="true";
+ BANNER="a";
shift ;;
%</script>
% \end{macrocode}
@@ -568,7 +584,7 @@
*)
## - list of input files
## - we ensure that no extra option is given later...
- TOOLATE="1";
+ TOOLATE="a";
if [ "`dirname $1`" = "." ]; then
DOLLARONE="`basename $1 ${EXT}`";
else
@@ -575,10 +591,10 @@
DOLLARONE="`dirname $1`/`basename $1 ${EXT}`";
fi
FILE="${FILE}${SPACE}${DOLLARONE}${EXT}";
- if [ ${ALL} -eq 1 ]; then
+ if [ -z "${ALL}" ]; then
+ SPACE=" ";
+ else
SPACE=",";
- else
- SPACE=" ";
fi;
shift;;
%</script>
@@ -640,11 +656,11 @@
EOF
fi
else ## we only export entries listed in the given .aux file:
- if [ ! "x${REPLACEBIB}" = "x1" ]; then
+ if [ -z "${REPLACEBIB}" ]; then
cat ${FILE} | sed -e "s/bibstyle{.*}/bibstyle{${BST}}/" > ${TMPFILE}.aux;
else
cat ${FILE} | sed -e "s/bibstyle{.*}/bibstyle{${BST}}/" \
- -e "s/bibdata{.*}/bibdata{${EXTRA}${NEWBIB%,}${EXTRABIB}}/" > ${TMPFILE}.aux;
+ -e "s|bibdata{.*}|bibdata{${EXTRA}${NEWBIB%,}${EXTRABIB}}|" > ${TMPFILE}.aux;
fi
fi
%</script>
@@ -657,14 +673,18 @@
%<*script>
if [ -z "$DEBUG" ]; then
bibtex -min-crossrefs=${CREF} ${TERSE} ${TMPFILE};
- if [ -e ${FINALFILE} ]; then
+ if [ -e ${FINALFILE} ] && [ -z "${NOSAVE}" ]; then
mv ${FINALFILE} ${FINALFILE}-save-`date "+%Y.%m.%d:%H.%M.%S"`
fi
echo "" > ${FINALFILE}
else
echo "bibtex -min-crossrefs=${CREF} ${TERSE} ${TMPFILE};"
+ if [ -e ${FINALFILE} ] && [ -z "${NOSAVE}" ]; then
+ echo "mv ${FINALFILE} ${FINALFILE}-save-`date \"+%Y.%m.%d:%H.%M.%S\"`"
+ fi
+ echo "echo \"\" > ${FINALFILE}"
fi
-if [ ! "${BANNER}" = "false" ]; then
+if [ ! -z "${BANNER}" ]; then
## list of cited entries
if [ -z "$DEBUG" ]; then
sed -i -e "s/\\\bibstyle{.*}/\\\bibstyle{expcites}/" ${TMPFILE}.aux
@@ -677,8 +697,8 @@
echo -ne " source files:\t\t${FILETAB}\t\t\t${EXTRABIBTAB}\n" >> ${FINALFILE}; \
fi
cat ${TMPFILE}-cites.bbl >> ${FINALFILE};
- echo -ne " bibexport-version:\tv${VERSION} (${VDATE})\n" >> ${FINALFILE};
- echo -ne " bibexport-maintainer:\tmarkey(at)lsv.ens-cachan.fr\n" >> ${FINALFILE};
+ #echo -ne " bibexport-version:\tv${VERSION} (${VDATE})\n" >> ${FINALFILE};
+ #echo -ne " bibexport-maintainer:\tNicolas Markey <bibexport(at)markey.fr>\n" >> ${FINALFILE};
sed -i -e "s/}/)/g" ${FINALFILE};
echo -n -e "}\n\n\n" >> ${FINALFILE};
rm -f ${TMPFILE}-cites.bbl ${TMPFILE}-cites.aux ${TMPFILE}-cites.blg
@@ -807,7 +827,7 @@
%<*expcites>
INTEGERS{left.length right.length}
STRINGS{ s t }
-INTEGERS{bool}
+INTEGERS{bool cpt}
FUNCTION{space.complete}
{
'left.length :=
@@ -854,6 +874,7 @@
%\begin{macro}{init.cited.keys}
%\begin{macro}{write.cited.keys}
%\begin{macro}{write.cited.keys.last}
+%\begin{macro}{write.nbkeys}
%\begin{macro}{cited.keys}
%\begin{macro}{end.cited.keys}
% \begin{macrocode}
@@ -862,12 +883,13 @@
{
left.delim 's :=
#0 'bool :=
+ #0 'cpt :=
}
FUNCTION{write.cited.keys}
{
bool
{"" left.width space.complete swap$}
- {" cited keys: " left.width space.complete swap$
+ {" list of keys: " left.width space.complete swap$
#1 'bool :=}
if$
{duplicate$ text.length$ right.width >}
@@ -884,7 +906,7 @@
{
bool
{"" left.width space.complete swap$}
- {" cited keys: " left.width space.complete swap$
+ {" list of keys: " left.width space.complete swap$
#1 'bool :=}
if$
{duplicate$ duplicate$ text.length$ #1 substring$ "," = not}
@@ -891,7 +913,7 @@
{duplicate$ text.length$ #1 - #1 swap$ substring$}
while$
duplicate$ text.length$ #1 - #1 swap$ substring$
- right.delim *
+ right.delim * "," *
{duplicate$ "" = not}
{
right.width split.string 't :=
@@ -902,8 +924,15 @@
while$
pop$ pop$
}
+FUNCTION{write.nbkeys}
+{
+ " number of entries: " left.width space.complete
+ " " *
+ cpt int.to.str$ * "," * write$ newline$
+}
FUNCTION{cited.keys}
{
+ cpt #1 + 'cpt :=
s cite$ ", " * * 's :=
s text.length$ #4000 >
{s write.cited.keys 's :=}
@@ -913,6 +942,7 @@
FUNCTION{end.cited.keys}
{
s write.cited.keys.last
+ write.nbkeys
}
%</expcites>
% \end{macrocode}
@@ -921,6 +951,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \subsubsection{Now, we export...}
%
@@ -1013,16 +1044,18 @@
type
volume
year
-% Special (but still somewhat standard) fields (natbib, germbib, ...):
+% Special (but still somewhat standard) fields (natbib, germbib, DBLP, ...):
abstract
acronym
annote
biburl
+ bibsource
doi
eid
isbn
issn
language
+ timestamp
url
urn
}{}{}
@@ -1414,11 +1447,13 @@
"acronym" acronym field.export
"annote" annote field.export
"biburl" biburl url.export
+ "bibsource" bibsource field.export
"doi" doi field.export
"eid" eid field.export
"isbn" isbn field.export
"issn" issn field.export
"language" language field.export
+ "timestamp" timestamp field.export
"url" url url.export
"urn" urn url.export
}
@@ -1477,7 +1512,7 @@
{
%"** This file has been automatically generated by bibexport **"
%write$ newline$
-%"** See http://www.lsv.ens-cachan.fr/~markey/bibla.php **"
+%"** See http://people.irisa.fr/Nicolas.Markey/latex.php **"
%write$ newline$
%"** for more informations about bibexport. **"
%write$ newline$
Modified: trunk/Master/texmf-dist/source/bibtex/bibexport/bibexport.ins
===================================================================
--- trunk/Master/texmf-dist/source/bibtex/bibexport/bibexport.ins 2019-03-31 21:29:54 UTC (rev 50676)
+++ trunk/Master/texmf-dist/source/bibtex/bibexport/bibexport.ins 2019-03-31 21:42:07 UTC (rev 50677)
@@ -1,6 +1,6 @@
%\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\input docstrip
-\def\filedate{2016/03/02}
+\def\filedate{2019/03/30}
{\catcode`\#=12
\gdef\DoubleSharp{##}
More information about the tex-live-commits
mailing list