summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/datatool/datatool.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-09-06 23:13:16 +0000
committerKarl Berry <karl@freefriends.org>2013-09-06 23:13:16 +0000
commitd211c476a793546259e3fe8b6417f3f36d477a99 (patch)
tree3795aeb98284ea17ec7745a0c7371a414d55b9d7 /Master/texmf-dist/source/latex/datatool/datatool.dtx
parent5eb736f1ebfc243975bbd8d48c8fb8a47ba6f2df (diff)
datatool (6sep13)
git-svn-id: svn://tug.org/texlive/trunk@31588 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/datatool/datatool.dtx')
-rw-r--r--Master/texmf-dist/source/latex/datatool/datatool.dtx80
1 files changed, 65 insertions, 15 deletions
diff --git a/Master/texmf-dist/source/latex/datatool/datatool.dtx b/Master/texmf-dist/source/latex/datatool/datatool.dtx
index 109413ab6c6..3e6c46f074e 100644
--- a/Master/texmf-dist/source/latex/datatool/datatool.dtx
+++ b/Master/texmf-dist/source/latex/datatool/datatool.dtx
@@ -19,7 +19,7 @@
% -author "Nicola Talbot"
% -codetitle ""
% datatool
-% Created on 2013/8/29 23:06
+% Created on 2013/9/6 9:51
%\fi
%\iffalse
%<*package>
@@ -66,7 +66,7 @@ datatool.dtx
\doxitem{Counter}{counter}{counters}
\doxitem{Option}{option}{package options}
-\CheckSum{22897}
+\CheckSum{22921}
\RecordChanges
\PageIndex
@@ -79,11 +79,11 @@ datatool.dtx
%\fi
%\MakeShortVerb{"}
%
-%\title{Documented Code for datatool v2.17}
+%\title{Documented Code for datatool v2.18}
%\author{Nicola L. C. Talbot\\
%\url{http://www.dickimaw-books.com/}}
%
-%\date{2013-08-29}
+%\date{2013-09-06}
%\maketitle
%
%\pagenumbering{roman}
@@ -118,7 +118,7 @@ datatool.dtx
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool-base}[2013/08/29 v2.17 (NLCT)]
+\ProvidesPackage{datatool-base}[2013/09/06 v2.18 (NLCT)]
% \end{macrocode}
% Required packages:
% \begin{macrocode}
@@ -5709,7 +5709,7 @@ datatool.dtx
%\section{Package Declaration}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool}[2013/08/29 v2.17 (NLCT)]
+\ProvidesPackage{datatool}[2013/09/06 v2.18 (NLCT)]
% \end{macrocode}
% Load required packages:
% \begin{macrocode}
@@ -5717,6 +5717,7 @@ datatool.dtx
\RequirePackage{ifthen}
\RequirePackage{xfor}
\RequirePackage{substr}
+\RequirePackage{etoolbox}
% \end{macrocode}
%\changes{2.0}{2009 February 27}{added etex as a required package}
% \begin{macrocode}
@@ -5737,7 +5738,7 @@ datatool.dtx
%\begin{definition}
%\cs{DTLsetseparator}\marg{char}
%\end{definition}
-% The sets \cs{@dtl@separator}, and constructs the relevent macros
+% The sets \cs{@dtl@separator}, and constructs the relevant macros
% that require this character to be hardcoded into their definition.
% \begin{macrocode}
\newcommand*{\DTLsetseparator}[1]{%
@@ -5923,11 +5924,14 @@ datatool.dtx
%\begin{macro}{\DTLpar}
% Many of the commands used by this package are short commands.
% This means that you can't use \cs{par}
-% in the data. To get around this, provide a synonym for \cs{@@par}
-% that can be used instead
+% in the data. This command needs to be robust so it doesn't get
+% expanded when written to a file. We also can't just use a synonym
+% for \cs{@@par} because it may be used in a context where \cs{par}
+% has a different meaning to \cs{@@par}.
%\changes{2.14}{2013-06-28}{changed to \cs{let}}
+%\changes{2.18}{2013-09-06}{changed back to a robust command}
% \begin{macrocode}
-\let\DTLpar\@@par
+\DeclareRobustCommand{\DTLpar}{\par}
% \end{macrocode}
%\end{macro}
%
@@ -11241,19 +11245,59 @@ datatool.dtx
% \begin{macrocode}
\edef\@dtl@replacementkeys{#1}%
% \end{macrocode}
-% Store sort order in \cs{@dtl@sortorder}.
+% Store sort order in \cs{@dtl@sortorder}, but check specified keys exist.
+%\changes{2.18}{2013-09-06}{added check for existence of keys listed in sort
+%criteria}
+% \begin{macrocode}
+ \def\@dtl@sortorder{}%
+ \@for\@dtl@level:=#2\do
+ {%
+% \end{macrocode}
+% Get key (stored in \cs{@dtl@key}).
+% \begin{macrocode}
+ \expandafter\@dtl@getsortdirection\@dtl@level=\relax
+% \end{macrocode}
+% Check key exists.
+% \begin{macrocode}
+ \DTLifhaskey{#3}{\@dtl@key}%
+ {%
+% \end{macrocode}
+% Key exists, so add to \cs{@dtl@sortorder}.
% \begin{macrocode}
- \edef\@dtl@sortorder{#2}%
+ \ifdefempty\@dtl@sortorder
+ {\let\@dtl@sortorder=\@dtl@level}%
+ {\eappto\@dtl@sortorder{,\@dtl@level}}%
+ }%
+ {%
+% \end{macrocode}
+% Key doesn't exist.
+% \begin{macrocode}
+ \PackageError{datatool}%
+ {%
+ Can't sort on `\@dtl@level'.
+ No such key `\@dtl@key' in database `#3'%
+ }{}%
+ }%
+ }%
+% \end{macrocode}
+% Now check if we have any keys left to sort on.
+% \begin{macrocode}
+ \ifdefempty\@dtl@sortorder
+ {%
+ \PackageWarning{datatool}{No keys provided to sort database `#3'}%
+ }%
+ {%
% \end{macrocode}
% Set \cs{@dtl@comparecs} to the required string comparison
% function. (Using case insensitive comparison macro
% \cs{dtlicompare}.)
% \begin{macrocode}
- \let\@dtl@comparecs=#4%
+ \let\@dtl@comparecs=#4%
% \end{macrocode}
% Sort the database.
% \begin{macrocode}
- \dtl@sortdata{#3}%
+ \dtl@sortdata{#3}%
+ }%
}%
{%
\PackageError{datatool}{Database `#3' doesn't exist}{}%
@@ -27141,7 +27185,13 @@ FUNCTION {article}
new.block
crossref missing$
{
- "\DTLnewbibitem {Journal}" *
+ journal missing$
+ {
+ }
+ {
+ "\DTLnewbibitem {Journal}" *
+ }
+ if$
journal group "journal" output.check
format.vol.num.pages output
format.date "year" output.check