summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/datatool/datatool.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/datatool/datatool.sty')
-rw-r--r--Master/texmf-dist/tex/latex/datatool/datatool.sty88
1 files changed, 33 insertions, 55 deletions
diff --git a/Master/texmf-dist/tex/latex/datatool/datatool.sty b/Master/texmf-dist/tex/latex/datatool/datatool.sty
index ea7835d4dcb..6069e3ef6aa 100644
--- a/Master/texmf-dist/tex/latex/datatool/datatool.sty
+++ b/Master/texmf-dist/tex/latex/datatool/datatool.sty
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool}[2017/11/10 v2.28 (NLCT)]
+\ProvidesPackage{datatool}[2017/11/12 v2.29 (NLCT)]
\RequirePackage{xkeyval}
\RequirePackage{ifthen}
\RequirePackage{xfor}
@@ -72,9 +72,21 @@
\noexpand\long
\noexpand\def\noexpand\@dtl@lopoff#1##1##2\noexpand\to##3##4{%
\noexpand\ifx#2##1\noexpand\relax
- \noexpand\@dtl@qlopoff#1##1##2\noexpand\to##3##4\relax
+ \noexpand\ifstrempty{##1}%
+ {\noexpand\@dtl@qlopoff#1{}##2\noexpand\to##3##4\relax}%
+ {%
+ \noexpand\dtl@ifsingle{##1}%
+ {\noexpand\@dtl@qlopoff#1##1##2\noexpand\to##3##4\relax}%
+ {\noexpand\@dtl@qlopoff#1{##1}##2\noexpand\to##3##4\relax}%
+ }%
\noexpand\else
- \noexpand\@dtl@lop@ff#1##1##2\noexpand\to##3##4\relax
+ \noexpand\ifstrempty{##1}%
+ {\noexpand\@dtl@lop@ff#1{}##2\noexpand\to##3##4\relax}%
+ {%
+ \noexpand\dtl@ifsingle{##1}%
+ {\noexpand\@dtl@lop@ff#1##1##2\noexpand\to##3##4\relax}
+ {\noexpand\@dtl@lop@ff#1{##1}##2\noexpand\to##3##4\relax}
+ }%
\noexpand\fi
}%
}
@@ -3085,17 +3097,23 @@
\define@key{loaddb}{omitlines}{\dtl@omitlines=#1\relax}
\newcommand*{\dtldefaultkey}{Column}
\newcommand*{\@dtl@readline}[2]{%
- \read#1 to #2%
- \ifdefempty{#2}%
- {%
- }%
- {%
- \dtl@trim#2%
- }%
+ \begingroup
+ \catcode\endlinechar=\active%
+ \global\read#1 to #2%
+ \endgroup
+ \ifx#2\empty
+ \else
+ \expandafter\@dtl@stripeol#2%
+ \let#2\@dtl@strippedline
+ \fi
}
+\begingroup
+\catcode\endlinechar=\active%
+\gdef\@dtl@stripeol#1
+{\gdef\@dtl@strippedline{#1}}
+\endgroup
\newcommand*{\@dtl@readrawline}[2]{%
\@dtl@rawread#1 to #2%
- \dtl@trim#2%
\dtl@domappings\@dtl@line
}
\newif\ifDTLnewdbonload
@@ -3255,48 +3273,6 @@
doesn't exist)}{}%
}%
}
-\newcommand{\dtl@trim}[1]{%
- \def\@dtl@trmstr{}%
- \if#1\par
- \else
- \expandafter\@dtl@start@trim#1\@dtl@end@trim
- \fi
- \let#1=\@dtl@trmstr
-}
-\def\@dtl@start@trim#1 \@dtl@end@trim{%
- \def\@dtl@trmstr{#1}%
-}
-\long\def\@dtl@starttrim#1#2{%
-\def\tmpA{#1}\show\tmpA
-\def\tmpB{#2}\show\tmpB
- \dtl@ifsingle{#2}%
- {%
- \def\@dtl@tmpB{#2}%
- }%
- {%
- \def\@dtl@tmpB{{#2}}%
- }%
- \ifx\par#1%
- \edef\@dtl@dotrim{\noexpand\@dtl@trim{} \expandonce\@dtl@tmpB}%
- \else
- \dtl@ifsingle{#1}%
- {%
- \def\@dtl@tmpA{#1}%
- }%
- {%
- \def\@dtl@tmpA{{#1}}%
- }%
- \ifx\@dtl@tmpB\@nnil
- \def\@dtl@dotrim{}%
- \let\@dtl@trmstr\@dtl@tmpA
- \else
- \edef\@dtl@dotrim{\noexpand\@dtl@trim
- \expandonce\@dtl@tmpA\expandonce\@dtl@tmpB}%
- \fi
- \fi
- \@dtl@dotrim
-}
-\long\def\@dtl@trim#1 \@nil{\long\def\@dtl@trmstr{#1}}
\newcommand*\DTLloadrawdb{%
\let\@dtl@doreadline\@dtl@readrawline
\@dtlloaddb
@@ -3334,8 +3310,10 @@
\@dtl@activatebraces
\@dtl@doreadraw?1?2>>>
\gdef\@dtl@doreadraw?1?2<\relax
-\read?1 to \tmp
-\protected@xdef?2<\tmp>\relax
+\begingroup\catcode\endlinechar=\active\global\read?1 to \dtl@tmp\endgroup
+\expandafter\@dtl@stripeol\dtl@tmp
+\let\dtl@tmp\@dtl@strippedline
+\protected@xdef?2<\dtl@tmp>\relax
>
\endgroup
\begingroup