From aabe08f93039c34eb07eb15099cd9185955bd62b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 4 Dec 2011 23:56:44 +0000 Subject: bibexport git-svn-id: svn://tug.org/texlive/trunk@24749 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/bibtex/bst/bibexport/expcites.bst | 2 +- Master/texmf-dist/bibtex/bst/bibexport/expkeys.bst | 2 +- Master/texmf-dist/bibtex/bst/bibexport/export.bst | 2 +- Master/texmf-dist/doc/bibtex/bibexport/README | 4 +- .../texmf-dist/doc/bibtex/bibexport/bibexport.pdf | Bin 254622 -> 282861 bytes Master/texmf-dist/scripts/bibexport/bibexport.sh | 168 ++++++++++-------- .../source/bibtex/bibexport/bibexport.dtx | 196 ++++++++++++--------- .../source/bibtex/bibexport/bibexport.ins | 5 +- 8 files changed, 209 insertions(+), 170 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/bibtex/bst/bibexport/expcites.bst b/Master/texmf-dist/bibtex/bst/bibexport/expcites.bst index d2d09a0eb2d..c471f4bd6d4 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) 2011/11/19 Nicolas Markey +%% (c) 2011/11/28 Nicolas Markey %% %% 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/expkeys.bst b/Master/texmf-dist/bibtex/bst/bibexport/expkeys.bst index 536e68d352c..e6a098d886f 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) 2011/11/19 Nicolas Markey +%% (c) 2011/11/28 Nicolas Markey %% %% 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 2034f29f382..967c87332fc 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) 2011/11/19 Nicolas Markey +%% (c) 2011/11/28 Nicolas Markey %% %% 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/README b/Master/texmf-dist/doc/bibtex/bibexport/README index 989292e874b..3769fac1dcb 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). (N. Markey -- ) - version 3.00 -- 2011/11/19 + version 3.01 -- 2011/11/28 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) 2011/11/19 Nicolas Markey +(c) 2011/11/28 Nicolas Markey 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 index e30323758d9..371c3e7cdcd 100644 Binary files a/Master/texmf-dist/doc/bibtex/bibexport/bibexport.pdf and b/Master/texmf-dist/doc/bibtex/bibexport/bibexport.pdf differ diff --git a/Master/texmf-dist/scripts/bibexport/bibexport.sh b/Master/texmf-dist/scripts/bibexport/bibexport.sh index 657e713c006..f946a68b539 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) 2011/11/19 Nicolas Markey +## (c) 2011/11/28 Nicolas Markey ## ## This work may be distributed and/or modified under the conditions of ## the LaTeX Project Public License, either version 1.3 of this license @@ -38,10 +38,22 @@ ## Grave accent \` Left brace \{ Vertical bar \| ## Right brace \} Tilde \~} ## +function checkversion() +{ + kpsewhich expcites.bst > /dev/null || + echo "----------- +--Warning-- file expcites.bst not found. +-----------" + grep -q $VDATE `kpsewhich expkeys.bst` || + echo "----------- +--Warning-- the version of the .bst files does not match with that of this +script. +-----------" +} function usage() { echo "bibexport: a tool to extract BibTeX entries out of .bib files. -usage: $0 [-h|v|n|c|a|d|s|t] [-b|e|es|ec|o|r file] file... +usage: `basename $0` [-h|v|n|c|a|d|s|t] [-b|e|es|ec|o|r file] file... Basic options: -------------- @@ -59,12 +71,12 @@ 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) - -s, --no-preamble don't write a preamble at beginning of output + -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 opttolate() +function opttoolate() { if [ ${TOOLATE} -ne 0 ]; then echo "No option is allowed after the input files"; @@ -72,9 +84,9 @@ if [ ${TOOLATE} -ne 0 ]; then fi } ## Version number -VERSION="3.00"; +VERSION="3.01"; ## Release date -VDATE="2011/11/19"; +VDATE="2011/11/28"; # ALL is a flag set to 1 when '-a' is given ALL="0"; @@ -96,7 +108,7 @@ BST="export"; # TERSE will be set to '-terse' if '-t' is given TERSE=""; # BANNER is used to turn on or off the preamble informations in the output -BANNER="true"; +BANNER="false"; # CREF is the number of citations of crossrefs from which the crossref'd entry # must be included. CREF="0"; @@ -112,17 +124,18 @@ ARGS=$@; if [ $# -eq 0 ]; then usage; fi +checkversion; while [ $# != 0 ]; do case $1 in -a|--all) - ## - export all entries in the input file(s) - ## - the input files are BibTeX files - opttolate; - EXT=""; SPACE=""; + ## - export all entries in the input file(s) + ## - the input files are BibTeX files + opttoolate; + EXT=""; SPACE=""; ALL=1; shift ;; -b|--bst) - ## - specifies the .bst file to use (default to 'export.bst') - opttolate; + ## - specifies the .bst file to use (default to 'export.bst') + opttoolate; if [ "`dirname $2`" = "." ]; then DOLLARTWO="`basename $2 .bst`"; else @@ -131,18 +144,18 @@ while [ $# != 0 ]; do BST="${DOLLARTWO}"; shift 2;; -d|--debug) - ## - debug mode: we create files but do not run bibtex - ## - instead, we print what we would have done... + ## - debug mode: we create files but do not run bibtex + ## - instead, we print what we would have done... opttoolate; - DEBUG="echo"; - shift ;; + DEBUG="echo"; + 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. - opttolate; + ## - 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. + opttoolate; if [ "`dirname $2`" = "." ]; then DOLLARTWO="`basename $2 .bib`"; else @@ -152,10 +165,10 @@ while [ $# != 0 ]; do EXTRABIB="${EXTRABIB},${DOLLARTWO}.bib"; shift 2;; -es|--extras) - ## - extra input files (containing strings) - ## - will be included *before* the main files (hence not suitable - ## for crossrefs) - opttolate; + ## - extra input files (containing strings) + ## - will be included *before* the main files (hence not suitable + ## for crossrefs) + opttoolate; if [ "`dirname $2`" = "." ]; then DOLLARTWO="`basename $2 .bib`"; else @@ -164,10 +177,10 @@ while [ $# != 0 ]; do EXTRA="${EXTRA}${DOLLARTWO},"; shift 2;; -ec|--extrac) - ## - extra input files (containing crossrefs) - ## - will be included only *after* the main files (hence not - ## suitable for @string's) - opttolate; + ## - extra input files (containing crossrefs) + ## - will be included only *after* the main files (hence not + ## suitable for @string's) + opttoolate; if [ "`dirname $2`" = "." ]; then DOLLARTWO="`basename $2 .bib`"; else @@ -176,9 +189,9 @@ while [ $# != 0 ]; do EXTRABIB="${EXTRABIB},${DOLLARTWO}.bib"; shift 2;; -o|--output-file) - ## - name of the output file - ## - we force it to end with '.bib' - opttolate; + ## - name of the output file + ## - we force it to end with '.bib' + opttoolate; if [ "`dirname $2`" = "." ]; then DOLLARTWO="`basename $2 .bib`"; else @@ -187,24 +200,24 @@ while [ $# != 0 ]; do OUTPUT="${DOLLARTWO}.bib"; shift 2 ;; -c|--crossref|--crossrefs|--with-crossref|--with-crossrefs) - ## - whether or not to preserve 'crossref' keys. - ## - by default, they are removed, but crossref'd entries are - ## included. - ## - crossrefs are *always* expanded anyway. - opttolate; + ## - whether or not to preserve 'crossref' keys. + ## - by default, they are removed, but crossref'd entries are + ## included. + ## - crossrefs are *always* expanded anyway. + opttoolate; CREF="1" ; shift ;; -n|--no-crossref|--without-crossref|--no-crossrefs|--without-crossrefs) - ## - to remove crossref'd entries (hence remove 'crossref' keys). - opttolate; + ## - to remove crossref'd entries (hence remove 'crossref' keys). + opttoolate; CREF="20000" ; shift ;; -r|--replace) - ## - to replace the file(s) given in \bibdata in the .aux file with - ## (a) new one(s). - opttolate; - REPLACEBIB="1"; - if [ "`dirname $2`" = "." ]; then + ## - to replace the file(s) given in \bibdata in the .aux file with + ## (a) new one(s). + opttoolate; + REPLACEBIB="1"; + if [ "`dirname $2`" = "." ]; then DOLLARTWO="`basename $2 .bib`"; else DOLLARTWO="`dirname $2`/`basename $2 .bib`"; @@ -213,8 +226,8 @@ while [ $# != 0 ]; do shift 2;; -v|--version) echo "This is bibexport v${VERSION} (released ${VDATE})"; exit 0;; - -s|--no-preamble|--without-preamble) - NOBANNER="false"; + -p|--preamble|--with-preamble) + BANNER="true"; shift ;; -t|--terse|--silent) TERSE=" -terse "; @@ -222,9 +235,9 @@ while [ $# != 0 ]; do -*) usage;; *) - ## - list of input files - ## - we ensure that no extra option is given later... - TOOLATE="1"; + ## - list of input files + ## - we ensure that no extra option is given later... + TOOLATE="1"; if [ "`dirname $1`" = "." ]; then DOLLARONE="`basename $1 ${EXT}`"; else @@ -233,8 +246,8 @@ while [ $# != 0 ]; do FILE="${FILE}${SPACE}${DOLLARONE}${EXT}"; if [ ${ALL} -eq 1 ]; then SPACE=","; - else -SPACE=" "; + else + SPACE=" "; fi; shift;; esac @@ -252,15 +265,16 @@ if [ -z "${EXT}" ]; then ## we export all entries \bibstyle{${BST}} EOF else ## we have extra files (e.g. for crossrefs) but want all entries from ${FILE} - ## we first extract the keys to be used: + ## we first extract the keys to be used: cat > ${TMPFILE}.aux </dev/null 2>&1; mv -f ${TMPFILE}.bbl ${TMPFILE}.aux; -## and then prepare the .aux file for exporting: + ## and then prepare the .aux file for exporting: cat >> ${TMPFILE}.aux < ${FINALFILE} else @@ -286,35 +300,35 @@ fi if [ ! "${BANNER}" = "false" ]; then ## list of cited entries if [ -z "$DEBUG" ]; then -sed -i -e "s/\\\bibstyle{.*}/\\\bibstyle{expcites}/" ${TMPFILE}.aux -mv ${TMPFILE}.aux ${TMPFILE}-cites.aux -bibtex -terse -min-crossrefs=${CREF} ${TMPFILE}-cites -echo -ne "@comment{generated using bibexport:\n" >> ${FINALFILE}; -echo -ne " creation date:\t`date +\"%c\"`\n" >> ${FINALFILE}; -echo -ne " command:\t\t$0 ${ARGS}\n" >> ${FINALFILE}; -if [ -z "${EXT}" ]; 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}; -sed -i -e "s/}/)/g" ${FINALFILE}; -echo -n -e "}\n\n\n" >> ${FINALFILE}; -rm -f ${TMPFILE}-cites.bbl ${TMPFILE}-cites.aux ${TMPFILE}-cites.blg + sed -i -e "s/\\\bibstyle{.*}/\\\bibstyle{expcites}/" ${TMPFILE}.aux + mv ${TMPFILE}.aux ${TMPFILE}-cites.aux + bibtex -terse -min-crossrefs=${CREF} ${TMPFILE}-cites + echo -ne "@comment{generated using bibexport:\n" >> ${FINALFILE}; + echo -ne " creation date:\t`date +\"%c\"`\n" >> ${FINALFILE}; + echo -ne " command:\t\t`basename $0` ${ARGS}\n" >> ${FINALFILE}; + if [ -z "${EXT}" ]; 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}; + sed -i -e "s/}/)/g" ${FINALFILE}; + echo -n -e "}\n\n\n" >> ${FINALFILE}; + rm -f ${TMPFILE}-cites.bbl ${TMPFILE}-cites.aux ${TMPFILE}-cites.blg fi fi if [ ${CREF} -ne 1 ]; then if [ -z "$DEBUG" ]; then -egrep -iv '^ *crossref *= *[^,]+,?$' \ - ${TMPFILE}.bbl >> ${FINALFILE}; + egrep -iv '^ *crossref *= *[^,]+,?$' \ + ${TMPFILE}.bbl >> ${FINALFILE}; else -echo "egrep -iv '^ *crossref *= *[^,]+,?$' ${TMPFILE}.bbl >> ${FINALFILE};" + echo "egrep -iv '^ *crossref *= *[^,]+,?$' ${TMPFILE}.bbl >> ${FINALFILE};" fi else if [ -z "$DEBUG" ]; then -cat ${TMPFILE}.bbl >> ${FINALFILE}; + cat ${TMPFILE}.bbl >> ${FINALFILE}; else -echo "cat ${TMPFILE}.bbl >> ${FINALFILE};" + echo "cat ${TMPFILE}.bbl >> ${FINALFILE};" fi fi if [ -z "$DEBUG" ]; then diff --git a/Master/texmf-dist/source/bibtex/bibexport/bibexport.dtx b/Master/texmf-dist/source/bibtex/bibexport/bibexport.dtx index 30ef645455c..a1e938b36d7 100644 --- a/Master/texmf-dist/source/bibtex/bibexport/bibexport.dtx +++ b/Master/texmf-dist/source/bibtex/bibexport/bibexport.dtx @@ -16,15 +16,16 @@ %%%\AtBeginDocument{\CodelineIndex\EnableCrossrefs} %%%\AtEndDocument{\PrintIndex} \begin{document} - \def\docdate{2011/11/19} - \def\fileversion{3.00} - \def\filedate{2011/11/19} + \def\docdate{2011/11/28} + \def\fileversion{3.01} +%%% Please also change date at the beginning of the script %%% +%%%\def\filedate{2011/11/28} \DocInput{bibexport.dtx} \end{document} % % % \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 @@ -44,7 +45,7 @@ % % \title{The \script{bibexport.sh} script} % \author{Nicolas Markey} -% \date{\filedate} +% \date{\docdate} % \maketitle % \StopEventually{} % @@ -175,6 +176,26 @@ % \subsection{The shell script} % \subsubsection{Initialization} % +%\begin{macro}{checkversion} +% We check that the \ext{bst} files have the correct version number: +% \begin{macrocode} +%<*script> +function checkversion() +{ + kpsewhich expcites.bst > /dev/null || + echo "----------- +--Warning-- file expcites.bst not found. +-----------" + grep -q $VDATE `kpsewhich expkeys.bst` || + echo "----------- +--Warning-- the version of the .bst files does not match with that of this +script. +-----------" +} +% +% \end{macrocode} +%\end{macro} +% %\begin{macro}{usage} % We first define how the script should be used: % \begin{macrocode} @@ -182,7 +203,7 @@ function usage() { echo "bibexport: a tool to extract BibTeX entries out of .bib files. -usage: $0 [-h|v|n|c|a|d|s|t] [-b|e|es|ec|o|r file] file... +usage: `basename $0` [-h|v|n|c|a|d|s|t] [-b|e|es|ec|o|r file] file... Basic options: -------------- @@ -200,7 +221,7 @@ 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) - -s, --no-preamble don't write a preamble at beginning of output + -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; @@ -209,12 +230,12 @@ exit 0; % \end{macrocode} %\end{macro} % -%\begin{macro}{toolate} +%\begin{macro}{opttoolate} % We also have a function to warn if extra options are given after % the names of input files, which is not allowed. % \begin{macrocode} %<*script> -function opttolate() +function opttoolate() { if [ ${TOOLATE} -ne 0 ]; then echo "No option is allowed after the input files"; @@ -238,7 +259,7 @@ fi %\begin{macro}{SPACE} %\begin{macro}{BST} %\begin{macro}{TERSE} -%\begin{macro}{NOBANNER} +%\begin{macro}{BANNER} %\begin{macro}{ARGS} %\begin{macro}{TOOLATE} % We define the default value of some variables: @@ -259,7 +280,7 @@ fi % \item \var{SPACE}: file name separator (can be \textvisiblespace, comma or empty); % \item \var{BST}: the \ext{bst} file to be used; % \item \var{TERSE}: run silently; -% \item \var{NOBANNER}: don't print the initial comment; +% \item \var{BANNER}: don't print the initial comment; % \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. @@ -268,9 +289,9 @@ fi % \begin{macrocode} %<*script> ## Version number -VERSION="3.00"; +VERSION="3.01"; ## Release date -VDATE="2011/11/19"; +VDATE="2011/11/28"; # ALL is a flag set to 1 when '-a' is given ALL="0"; @@ -292,7 +313,7 @@ BST="export"; # TERSE will be set to '-terse' if '-t' is given TERSE=""; # BANNER is used to turn on or off the preamble informations in the output -BANNER="true"; +BANNER="false"; # CREF is the number of citations of crossrefs from which the crossref'd entry # must be included. CREF="0"; @@ -327,13 +348,15 @@ ARGS=$@; % % \subsubsection{Handling arguments} % -% If no argument have been supplied, we call \script{usage}. +% If no argument have been supplied, we call \script{usage}. Otherwise, we +% check version number. % % \begin{macrocode} %<*script> if [ $# -eq 0 ]; then usage; fi +checkversion; % % \end{macrocode} % @@ -350,10 +373,10 @@ while [ $# != 0 ]; do % \begin{macrocode} %<*script> -a|--all) - ## - export all entries in the input file(s) - ## - the input files are BibTeX files - opttolate; - EXT=""; SPACE=""; + ## - export all entries in the input file(s) + ## - the input files are BibTeX files + opttoolate; + EXT=""; SPACE=""; ALL=1; shift ;; % % \end{macrocode} @@ -363,8 +386,8 @@ while [ $# != 0 ]; do % \begin{macrocode} %<*script> -b|--bst) - ## - specifies the .bst file to use (default to 'export.bst') - opttolate; + ## - specifies the .bst file to use (default to 'export.bst') + opttoolate; if [ "`dirname $2`" = "." ]; then DOLLARTWO="`basename $2 .bst`"; else @@ -380,11 +403,11 @@ while [ $# != 0 ]; do % \begin{macrocode} %<*script> -d|--debug) - ## - debug mode: we create files but do not run bibtex - ## - instead, we print what we would have done... + ## - debug mode: we create files but do not run bibtex + ## - instead, we print what we would have done... opttoolate; - DEBUG="echo"; - shift ;; + DEBUG="echo"; + shift ;; % % \end{macrocode} %\item \verb+-e+ or \verb+--extra+: when we want to export all the @@ -394,12 +417,12 @@ while [ $# != 0 ]; do % \begin{macrocode} %<*script> -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. - opttolate; + ## - 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. + opttoolate; if [ "`dirname $2`" = "." ]; then DOLLARTWO="`basename $2 .bib`"; else @@ -416,10 +439,10 @@ while [ $# != 0 ]; do % \begin{macrocode} %<*script> -es|--extras) - ## - extra input files (containing strings) - ## - will be included *before* the main files (hence not suitable - ## for crossrefs) - opttolate; + ## - extra input files (containing strings) + ## - will be included *before* the main files (hence not suitable + ## for crossrefs) + opttoolate; if [ "`dirname $2`" = "." ]; then DOLLARTWO="`basename $2 .bib`"; else @@ -434,10 +457,10 @@ while [ $# != 0 ]; do % \begin{macrocode} %<*script> -ec|--extrac) - ## - extra input files (containing crossrefs) - ## - will be included only *after* the main files (hence not - ## suitable for @string's) - opttolate; + ## - extra input files (containing crossrefs) + ## - will be included only *after* the main files (hence not + ## suitable for @string's) + opttoolate; if [ "`dirname $2`" = "." ]; then DOLLARTWO="`basename $2 .bib`"; else @@ -451,9 +474,9 @@ while [ $# != 0 ]; do % \begin{macrocode} %<*script> -o|--output-file) - ## - name of the output file - ## - we force it to end with '.bib' - opttolate; + ## - name of the output file + ## - we force it to end with '.bib' + opttoolate; if [ "`dirname $2`" = "." ]; then DOLLARTWO="`basename $2 .bib`"; else @@ -469,11 +492,11 @@ while [ $# != 0 ]; do % \begin{macrocode} %<*script> -c|--crossref|--crossrefs|--with-crossref|--with-crossrefs) - ## - whether or not to preserve 'crossref' keys. - ## - by default, they are removed, but crossref'd entries are - ## included. - ## - crossrefs are *always* expanded anyway. - opttolate; + ## - whether or not to preserve 'crossref' keys. + ## - by default, they are removed, but crossref'd entries are + ## included. + ## - crossrefs are *always* expanded anyway. + opttoolate; CREF="1" ; shift ;; % @@ -483,8 +506,8 @@ while [ $# != 0 ]; do % \begin{macrocode} %<*script> -n|--no-crossref|--without-crossref|--no-crossrefs|--without-crossrefs) - ## - to remove crossref'd entries (hence remove 'crossref' keys). - opttolate; + ## - to remove crossref'd entries (hence remove 'crossref' keys). + opttoolate; CREF="20000" ; shift ;; % @@ -495,11 +518,11 @@ while [ $# != 0 ]; do % \begin{macrocode} %<*script> -r|--replace) - ## - to replace the file(s) given in \bibdata in the .aux file with - ## (a) new one(s). - opttolate; - REPLACEBIB="1"; - if [ "`dirname $2`" = "." ]; then + ## - to replace the file(s) given in \bibdata in the .aux file with + ## (a) new one(s). + opttoolate; + REPLACEBIB="1"; + if [ "`dirname $2`" = "." ]; then DOLLARTWO="`basename $2 .bib`"; else DOLLARTWO="`dirname $2`/`basename $2 .bib`"; @@ -515,12 +538,12 @@ while [ $# != 0 ]; do echo "This is bibexport v${VERSION} (released ${VDATE})"; exit 0;; % % \end{macrocode} -%\item \verb+-s+ or \verb+--no-preamble+ for inserting some informations +%\item \verb+-p+ or \verb+--preamble+ for inserting some informations % at the beginning of the output file: % \begin{macrocode} %<*script> - -s|--no-preamble|--without-preamble) - NOBANNER="false"; + -p|--preamble|--with-preamble) + BANNER="true"; shift ;; % % \end{macrocode} @@ -544,9 +567,9 @@ while [ $# != 0 ]; do % \begin{macrocode} %<*script> *) - ## - list of input files - ## - we ensure that no extra option is given later... - TOOLATE="1"; + ## - list of input files + ## - we ensure that no extra option is given later... + TOOLATE="1"; if [ "`dirname $1`" = "." ]; then DOLLARONE="`basename $1 ${EXT}`"; else @@ -555,8 +578,8 @@ while [ $# != 0 ]; do FILE="${FILE}${SPACE}${DOLLARONE}${EXT}"; if [ ${ALL} -eq 1 ]; then SPACE=","; - else - SPACE=" "; + else + SPACE=" "; fi; shift;; % @@ -602,15 +625,16 @@ if [ -z "${EXT}" ]; then ## we export all entries \bibstyle{${BST}} EOF else ## we have extra files (e.g. for crossrefs) but want all entries from ${FILE} - ## we first extract the keys to be used: + ## we first extract the keys to be used: cat > ${TMPFILE}.aux </dev/null 2>&1; mv -f ${TMPFILE}.bbl ${TMPFILE}.aux; - ## and then prepare the .aux file for exporting: + ## and then prepare the .aux file for exporting: cat >> ${TMPFILE}.aux < ${FINALFILE} else @@ -644,35 +668,35 @@ fi if [ ! "${BANNER}" = "false" ]; then ## list of cited entries if [ -z "$DEBUG" ]; then - sed -i -e "s/\\\bibstyle{.*}/\\\bibstyle{expcites}/" ${TMPFILE}.aux - mv ${TMPFILE}.aux ${TMPFILE}-cites.aux - bibtex -terse -min-crossrefs=${CREF} ${TMPFILE}-cites - echo -ne "@comment{generated using bibexport:\n" >> ${FINALFILE}; - echo -ne " creation date:\t`date +\"%c\"`\n" >> ${FINALFILE}; - echo -ne " command:\t\t$0 ${ARGS}\n" >> ${FINALFILE}; - if [ -z "${EXT}" ]; 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}; - sed -i -e "s/}/)/g" ${FINALFILE}; - echo -n -e "}\n\n\n" >> ${FINALFILE}; - rm -f ${TMPFILE}-cites.bbl ${TMPFILE}-cites.aux ${TMPFILE}-cites.blg + sed -i -e "s/\\\bibstyle{.*}/\\\bibstyle{expcites}/" ${TMPFILE}.aux + mv ${TMPFILE}.aux ${TMPFILE}-cites.aux + bibtex -terse -min-crossrefs=${CREF} ${TMPFILE}-cites + echo -ne "@comment{generated using bibexport:\n" >> ${FINALFILE}; + echo -ne " creation date:\t`date +\"%c\"`\n" >> ${FINALFILE}; + echo -ne " command:\t\t`basename $0` ${ARGS}\n" >> ${FINALFILE}; + if [ -z "${EXT}" ]; 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}; + sed -i -e "s/}/)/g" ${FINALFILE}; + echo -n -e "}\n\n\n" >> ${FINALFILE}; + rm -f ${TMPFILE}-cites.bbl ${TMPFILE}-cites.aux ${TMPFILE}-cites.blg fi fi if [ ${CREF} -ne 1 ]; then if [ -z "$DEBUG" ]; then - egrep -iv '^ *crossref *= *[^,]+,?$' \ - ${TMPFILE}.bbl >> ${FINALFILE}; + egrep -iv '^ *crossref *= *[^,]+,?$' \ + ${TMPFILE}.bbl >> ${FINALFILE}; else - echo "egrep -iv '^ *crossref *= *[^,]+,?$' ${TMPFILE}.bbl >> ${FINALFILE};" + echo "egrep -iv '^ *crossref *= *[^,]+,?$' ${TMPFILE}.bbl >> ${FINALFILE};" fi else if [ -z "$DEBUG" ]; then - cat ${TMPFILE}.bbl >> ${FINALFILE}; + cat ${TMPFILE}.bbl >> ${FINALFILE}; else - echo "cat ${TMPFILE}.bbl >> ${FINALFILE};" + echo "cat ${TMPFILE}.bbl >> ${FINALFILE};" fi fi if [ -z "$DEBUG" ]; then diff --git a/Master/texmf-dist/source/bibtex/bibexport/bibexport.ins b/Master/texmf-dist/source/bibtex/bibexport/bibexport.ins index a8f8d05a917..79ab290e663 100644 --- a/Master/texmf-dist/source/bibtex/bibexport/bibexport.ins +++ b/Master/texmf-dist/source/bibtex/bibexport/bibexport.ins @@ -1,5 +1,6 @@ %\NeedsTeXFormat{LaTeX2e}[1996/12/01] \input docstrip +\def\filedate{2011/11/28} {\catcode`\#=12 \gdef\DoubleSharp{##} @@ -8,7 +9,7 @@ \let\MetaPrefix\DoubleSharp \preamble -(c) 2011/11/19 Nicolas Markey +(c) \filedate Nicolas Markey This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license @@ -41,7 +42,7 @@ The Current Maintainer of this work is Nicolas Markey. \let\MetaPrefix\DoubleperCent \preamble -(c) 2011/11/19 Nicolas Markey +(c) 2011/11/28 Nicolas Markey This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this license -- cgit v1.2.3