diff options
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/bibexport/bibexport.sh | 60 | ||||
-rwxr-xr-x | Master/bin/aarch64-linux/asy | bin | 3144776 -> 3432312 bytes | |||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/bibexport/expcites.bst | 19 | ||||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/bibexport/expkeys.bst | 2 | ||||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/bibexport/export.bst | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/bibtex/bibexport/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/bibtex/bibexport/bibexport.pdf | bin | 256374 -> 256849 bytes | |||
-rwxr-xr-x | Master/texmf-dist/scripts/bibexport/bibexport.sh | 60 | ||||
-rw-r--r-- | Master/texmf-dist/source/bibtex/bibexport/bibexport.dtx | 107 | ||||
-rw-r--r-- | Master/texmf-dist/source/bibtex/bibexport/bibexport.ins | 2 |
10 files changed, 164 insertions, 96 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/bibexport/bibexport.sh b/Build/source/texk/texlive/linked_scripts/bibexport/bibexport.sh index 78d6ee92f21..9358b423ea8 100755 --- a/Build/source/texk/texlive/linked_scripts/bibexport/bibexport.sh +++ b/Build/source/texk/texlive/linked_scripts/bibexport/bibexport.sh @@ -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 @@ Basic options: -------------- -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,25 +72,24 @@ Advanced options: -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; } 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,15 +100,17 @@ EXTRA=""; 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) 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 @@ CREF="0"; # 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 @@ while [ $# != 0 ]; do ## - 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,14 +149,14 @@ while [ $# != 0 ]; do ## - 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) ## - 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 @@ while [ $# != 0 ]; do ## - 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 @@ while [ $# != 0 ]; do 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,17 +242,17 @@ while [ $# != 0 ]; do *) ## - 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 DOLLARONE="`dirname $1`/`basename $1 ${EXT}`"; fi FILE="${FILE}${SPACE}${DOLLARONE}${EXT}"; - if [ ${ALL} -eq 1 ]; then - SPACE=","; - else + if [ -z "${ALL}" ]; then SPACE=" "; + else + SPACE=","; fi; shift;; esac @@ -280,23 +286,27 @@ EOF 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 @@ if [ ! "${BANNER}" = "false" ]; then 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 diff --git a/Master/bin/aarch64-linux/asy b/Master/bin/aarch64-linux/asy Binary files differindex 50f4a243ba5..67b99fb377d 100755 --- a/Master/bin/aarch64-linux/asy +++ b/Master/bin/aarch64-linux/asy diff --git a/Master/texmf-dist/bibtex/bst/bibexport/expcites.bst b/Master/texmf-dist/bibtex/bst/bibexport/expcites.bst index 7fde8107e34..11d2a83f0cc 100644 --- a/Master/texmf-dist/bibtex/bst/bibexport/expcites.bst +++ b/Master/texmf-dist/bibtex/bst/bibexport/expcites.bst @@ -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 @@ FUNCTION{or} } INTEGERS{left.length right.length} STRINGS{ s t } -INTEGERS{bool} +INTEGERS{bool cpt} FUNCTION{space.complete} { 'left.length := @@ -105,12 +105,13 @@ FUNCTION{init.cited.keys} { 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,14 +128,14 @@ FUNCTION{write.cited.keys.last} { 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} {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 @@ FUNCTION{write.cited.keys.last} 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{cited.keys} FUNCTION{end.cited.keys} { s write.cited.keys.last + write.nbkeys } FUNCTION{article}{cited.keys} FUNCTION{book}{cited.keys} diff --git a/Master/texmf-dist/bibtex/bst/bibexport/expkeys.bst b/Master/texmf-dist/bibtex/bst/bibexport/expkeys.bst index 9f7359cc775..52fc7f0472e 100644 --- a/Master/texmf-dist/bibtex/bst/bibexport/expkeys.bst +++ b/Master/texmf-dist/bibtex/bst/bibexport/expkeys.bst @@ -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 diff --git a/Master/texmf-dist/bibtex/bst/bibexport/export.bst b/Master/texmf-dist/bibtex/bst/bibexport/export.bst index ad9f3e49d34..5bf11481329 100644 --- a/Master/texmf-dist/bibtex/bst/bibexport/export.bst +++ b/Master/texmf-dist/bibtex/bst/bibexport/export.bst @@ -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 @@ ENTRY{ acronym annote biburl + bibsource doi eid isbn issn language + timestamp url urn }{}{} @@ -388,11 +390,13 @@ FUNCTION{entry.export.extra} "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 } diff --git a/Master/texmf-dist/doc/bibtex/bibexport/README b/Master/texmf-dist/doc/bibtex/bibexport/README index b5b68f8cb20..f2b9bf7a84a 100644 --- a/Master/texmf-dist/doc/bibtex/bibexport/README +++ b/Master/texmf-dist/doc/bibtex/bibexport/README @@ -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 @@ i.e. to develop abbreviations (except standard ones) and crossrefs. ---------------------------------------------------------------------- -(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 diff --git a/Master/texmf-dist/doc/bibtex/bibexport/bibexport.pdf b/Master/texmf-dist/doc/bibtex/bibexport/bibexport.pdf Binary files differindex 0a06c52416d..5cfe66f7d64 100644 --- a/Master/texmf-dist/doc/bibtex/bibexport/bibexport.pdf +++ b/Master/texmf-dist/doc/bibtex/bibexport/bibexport.pdf diff --git a/Master/texmf-dist/scripts/bibexport/bibexport.sh b/Master/texmf-dist/scripts/bibexport/bibexport.sh index 78d6ee92f21..9358b423ea8 100755 --- a/Master/texmf-dist/scripts/bibexport/bibexport.sh +++ b/Master/texmf-dist/scripts/bibexport/bibexport.sh @@ -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 @@ Basic options: -------------- -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,25 +72,24 @@ Advanced options: -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; } 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,15 +100,17 @@ EXTRA=""; 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) 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 @@ CREF="0"; # 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 @@ while [ $# != 0 ]; do ## - 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,14 +149,14 @@ while [ $# != 0 ]; do ## - 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) ## - 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 @@ while [ $# != 0 ]; do ## - 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 @@ while [ $# != 0 ]; do 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,17 +242,17 @@ while [ $# != 0 ]; do *) ## - 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 DOLLARONE="`dirname $1`/`basename $1 ${EXT}`"; fi FILE="${FILE}${SPACE}${DOLLARONE}${EXT}"; - if [ ${ALL} -eq 1 ]; then - SPACE=","; - else + if [ -z "${ALL}" ]; then SPACE=" "; + else + SPACE=","; fi; shift;; esac @@ -280,23 +286,27 @@ EOF 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 @@ if [ ! "${BANNER}" = "false" ]; then 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 diff --git a/Master/texmf-dist/source/bibtex/bibexport/bibexport.dtx b/Master/texmf-dist/source/bibtex/bibexport/bibexport.dtx index 8a29a06b750..8ba3261bdcf 100644 --- a/Master/texmf-dist/source/bibtex/bibexport/bibexport.dtx +++ b/Master/texmf-dist/source/bibtex/bibexport/bibexport.dtx @@ -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 @@ Basic options: -------------- -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 @@ Advanced options: -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 @@ exit 0; %<*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 @@ fi %\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 @@ fi % \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 @@ fi % \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,15 +308,17 @@ EXTRA=""; 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) 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 @@ CREF="0"; # 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 @@ ARGS=$@; %\end{macro} %\end{macro} %\end{macro} +%\end{macro} % % \subsubsection{Handling arguments} % @@ -375,7 +382,7 @@ while [ $# != 0 ]; do ## - 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 @@ while [ $# != 0 ]; do ## - 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 @@ while [ $# != 0 ]; do ## - 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 @@ while [ $# != 0 ]; do ## - 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 @@ while [ $# != 0 ]; do 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,17 +584,17 @@ while [ $# != 0 ]; do *) ## - 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 DOLLARONE="`dirname $1`/`basename $1 ${EXT}`"; fi FILE="${FILE}${SPACE}${DOLLARONE}${EXT}"; - if [ ${ALL} -eq 1 ]; then - SPACE=","; - else + if [ -z "${ALL}" ]; then SPACE=" "; + else + SPACE=","; fi; shift;; %</script> @@ -640,11 +656,11 @@ EOF 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 @@ fi %<*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 @@ if [ ! "${BANNER}" = "false" ]; then 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 @@ FUNCTION{or} %<*expcites> INTEGERS{left.length right.length} STRINGS{ s t } -INTEGERS{bool} +INTEGERS{bool cpt} FUNCTION{space.complete} { 'left.length := @@ -854,6 +874,7 @@ FUNCTION{split.string} %\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 @@ FUNCTION{init.cited.keys} { 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,14 +906,14 @@ FUNCTION{write.cited.keys.last} { 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} {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 @@ FUNCTION{write.cited.keys.last} 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{cited.keys} FUNCTION{end.cited.keys} { s write.cited.keys.last + write.nbkeys } %</expcites> % \end{macrocode} @@ -921,6 +951,7 @@ FUNCTION{end.cited.keys} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \subsubsection{Now, we export...} % @@ -1013,16 +1044,18 @@ ENTRY{ 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 @@ FUNCTION{entry.export.extra} "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 @@ FUNCTION{header} { %"** 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$ diff --git a/Master/texmf-dist/source/bibtex/bibexport/bibexport.ins b/Master/texmf-dist/source/bibtex/bibexport/bibexport.ins index a29005d0d10..507dd87c07f 100644 --- a/Master/texmf-dist/source/bibtex/bibexport/bibexport.ins +++ b/Master/texmf-dist/source/bibtex/bibexport/bibexport.ins @@ -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{##} |