summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/datatool/datatool-base.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-01-15 23:01:04 +0000
committerKarl Berry <karl@freefriends.org>2013-01-15 23:01:04 +0000
commit6d3800d3b164704c4038f84408b27f759a4ea744 (patch)
tree6d56ebd38457cb5f2d7bcbe628157f861fecdaae /Master/texmf-dist/tex/latex/datatool/datatool-base.sty
parent607c25d782c2e57a60ab2f2ecf30c12e238b44ec (diff)
datatool (15jan13)
git-svn-id: svn://tug.org/texlive/trunk@28844 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/datatool/datatool-base.sty')
-rw-r--r--Master/texmf-dist/tex/latex/datatool/datatool-base.sty626
1 files changed, 502 insertions, 124 deletions
diff --git a/Master/texmf-dist/tex/latex/datatool/datatool-base.sty b/Master/texmf-dist/tex/latex/datatool/datatool-base.sty
index 097ed15e5f1..8f617ec0e77 100644
--- a/Master/texmf-dist/tex/latex/datatool/datatool-base.sty
+++ b/Master/texmf-dist/tex/latex/datatool/datatool-base.sty
@@ -7,7 +7,7 @@
%% datatool.dtx (with options: `datatool-base.sty,package')
%%
%% datatool.dtx
-%% Copyright 2012 Nicola Talbot
+%% Copyright 2013 Nicola Talbot
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -21,7 +21,7 @@
%%
%% The Current Maintainer of this work is Nicola Talbot.
%%
-%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
+%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
%%
%% \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
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool-base}[2012/10/06 v2.12 (NLCT)]
+\ProvidesPackage{datatool-base}[2013/01/15 v2.13 (NLCT)]
\RequirePackage{etoolbox}
\RequirePackage{amsmath}
\RequirePackage{xkeyval}
@@ -83,6 +83,31 @@
#4%
}%
}
+\newcommand{\dtlifintopenbetween}[5]{%
+ \ifnum#1>#2\relax
+ \ifnum#1<#3\relax
+ #4%
+ \else
+ #5%
+ \fi
+ \else
+ #5%
+ \fi
+}
+\newcommand{\dtlifintclosedbetween}[5]{%
+ \dtlifintopenbetween{#1}{#2}{#3}{#4}%
+ {%
+ \ifnum#1=#2\relax
+ #4%
+ \else
+ \ifnum#1=#3\relax
+ #4%
+ \else
+ #5%
+ \fi
+ \fi
+ }%
+}
\long\def\long@collect@body#1{%
\@envbody{\@xp#1\@xp{\the\@envbody}}%
\edef\process@envbody{\the\@envbody\@nx\end{\@currenvir}}%
@@ -1547,17 +1572,13 @@
#2=-1\relax
}%
{%
- \ifx#1\space\relax
+ \ifx#1\@dtl@wordbreak\relax
#2=`\ \relax
\else
- \ifx#1~\relax
- #2=`\ \relax
+ \ifcat\noexpand#1\relax
+ #2=0\relax
\else
- \ifcat\noexpand#1\relax
- #2=-1\relax
- \else
- #2=`#1\relax
- \fi
+ #2=`#1\relax
\fi
\fi
}%
@@ -1568,16 +1589,15 @@
#2=-1\relax
}%
{%
- \ifx#1\space\relax
+ \ifx#1\@dtl@wordbreak\relax
#2=`\ \relax
\else
- \ifx#1~\relax
- #2=`\ \relax
+ \ifcat\noexpand#1\relax%
+ #2=0\relax
\else
- \ifcat\noexpand#1\relax%
- #2=-1\relax
- \else
- #2=\lccode`#1\relax
+ #2=\lccode`#1\relax
+ \ifnum#2=0\relax
+ #2=`#1\relax
\fi
\fi
\fi
@@ -1602,82 +1622,413 @@
#1=1\relax
}%
{%
- \DTLsubstituteall{\@dtl@argA}{ }{\space }%
- \DTLsubstituteall{\@dtl@argB}{ }{\space }%
+ \dtl@setwordbreaksnohyphens{\@dtl@argA}{\@dtl@wordbreak}%
+ \let\@dtl@argA\dtl@string
+ \dtl@setwordbreaksnohyphens{\@dtl@argB}{\@dtl@wordbreak}%
+ \let\@dtl@argB\dtl@string
\expandafter\dtl@getfirst\@dtl@argA\end
\let\dtl@firstA=\dtl@first
\let\dtl@restA=\dtl@rest
\expandafter\dtl@getfirst\@dtl@argB\end
\let\dtl@firstB=\dtl@first
\let\dtl@restB=\dtl@rest
- \expandafter\dtl@ifsingle\expandafter{\dtl@firstA}{%
- \expandafter\dtl@ifsingle\expandafter{\dtl@firstB}{%
- \expandafter\dtl@setlccharcode\expandafter{\dtl@firstA}{\dtl@codeA}%
- \expandafter\dtl@setlccharcode\expandafter{\dtl@firstB}{\dtl@codeB}%
- \ifnum\dtl@codeA=-1\relax
- \ifnum\dtl@codeB=-1\relax
- \protected@edef\dtl@donext{%
- \noexpand\dtlicompare{\noexpand#1}{\dtl@restA}{\dtl@restB}}%
- \dtl@donext
- \else
- \protected@edef\dtl@donext{%
- \noexpand\dtlicompare
- {\noexpand#1}{\dtl@restA}{\dtl@firstB\dtl@restB}}%
- \dtl@donext
- \fi
+ \expandafter\dtl@ifsingle\expandafter{\dtl@firstA}%
+ {%
+ \expandafter\dtl@ifsingle\expandafter{\dtl@firstB}%
+ {%
+ \expandafter\dtl@setlccharcode\expandafter{\dtl@firstA}{\dtl@codeA}%
+ \expandafter\dtl@setlccharcode\expandafter{\dtl@firstB}{\dtl@codeB}%
+ \ifnum\dtl@codeA=-1\relax
+ \ifnum\dtl@codeB=-1\relax
+ \protected@edef\dtl@donext{%
+ \noexpand\dtlicompare{\noexpand#1}{\dtl@restA}{\dtl@restB}}%
+ \dtl@donext
+ \else
+ \protected@edef\dtl@donext{%
+ \noexpand\dtlicompare
+ {\noexpand#1}{\dtl@restA}{\dtl@firstB\dtl@restB}}%
+ \dtl@donext
+ \fi
+ \else
+ \ifnum\dtl@codeB=-1\relax
+ \protected@edef\dtl@donext{%
+ \noexpand\dtlicompare
+ {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@restB}}%
+ \dtl@donext
+ \else
+ \ifnum\dtl@codeA<\dtl@codeB
+ #1=-1\relax
+ \else
+ \ifnum\dtl@codeA>\dtl@codeB
+ #1=1\relax
+ \else
+ \ifdefempty{\dtl@restA}%
+ {%
+ \ifdefempty{\dtl@restB}%
+ {%
+ #1=0\relax
+ }%
+ {%
+ #1=-1\relax
+ }%
+ }%
+ {%
+ \ifdefempty{\restB}%
+ {%
+ #1=1\relax
+ }%
+ {%
+ \protected@edef\dtl@donext{%
+ \noexpand\dtlicompare
+ {\noexpand#1}{\dtl@restA}{\dtl@restB}}%
+ \dtl@donext
+ }%
+ }%
+ \fi
+ \fi
+ \fi
+ \fi
+ }%
+ {%
+ \protected@edef\dtl@donext{%
+ \noexpand\dtlicompare
+ {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@firstB\dtl@restB}}%
+ \dtl@donext
+ }%
+ }%
+ {%
+ \protected@edef\dtl@donext{%
+ \noexpand\dtlicompare
+ {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@firstB\dtl@restB}}%
+ \dtl@donext
+ }%
+ }%
+ }%
+}
+\newcommand*{\dtlwordindexcompare}[3]{%
+ \@dtldictcompare{#1}{#2}{#3}{\@dtl@wordbreak}%
+}
+\newcommand*{\dtlletterindexcompare}[3]{%
+ \@dtldictcompare{#1}{#2}{#3}{}%
+}
+\newcommand*{\@dtldictcompare}[4]{%
+ \dtl@subnobrsp{#2}{\@dtl@argA}%
+ \dtl@subnobrsp{#3}{\@dtl@argB}%
+ \ifdefempty{\@dtl@argA}%
+ {%
+ \ifdefempty{\@dtl@argB}%
+ {%
+ #1=0\relax
+ }%
+ {%
+ #1=-1\relax
+ }%
+ }%
+ {%
+ \ifdefempty{\@dtl@argB}%
+ {%
+ #1=1\relax
+ }%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argA}{\datatoolpersoncomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argA}{\datatoolplacecomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argA}{\datatoolsubjectcomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argA}{\datatoolparenstart}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \def\@dtl@A@comma{0}%
+ \let\@dtl@A@before\@dtl@argA
+ \def\@dtl@A@after{}%
+ }%
+ {%
+ \let\@dtl@A@comma\@dtl@replaced
+ \let\@dtl@A@before\@dtl@beforepart
+ \let\@dtl@A@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@A@comma\@dtl@replaced
+ \let\@dtl@A@before\@dtl@beforepart
+ \let\@dtl@A@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@A@comma\@dtl@replaced
+ \let\@dtl@A@before\@dtl@beforepart
+ \let\@dtl@A@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@A@comma\@dtl@replaced
+ \let\@dtl@A@before\@dtl@beforepart
+ \let\@dtl@A@after\@dtl@afterpart
+ }%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argB}{\datatoolpersoncomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argB}{\datatoolplacecomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argB}{\datatoolsubjectcomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argB}{\datatoolparenstart}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \def\@dtl@B@comma{0}%
+ \let\@dtl@B@before\@dtl@argB
+ \def\@dtl@B@after{}%
+ }%
+ {%
+ \let\@dtl@B@comma\@dtl@replaced
+ \let\@dtl@B@before\@dtl@beforepart
+ \let\@dtl@B@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@B@comma\@dtl@replaced
+ \let\@dtl@B@before\@dtl@beforepart
+ \let\@dtl@B@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@B@comma\@dtl@replaced
+ \let\@dtl@B@before\@dtl@beforepart
+ \let\@dtl@B@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@B@comma\@dtl@replaced
+ \let\@dtl@B@before\@dtl@beforepart
+ \let\@dtl@B@after\@dtl@afterpart
+ }%
+ \expandafter\dtl@ifcasechargroup\@dtl@A@before\dtl@end@ifcasechargroup
+ {\def\@dtl@A@chargroup{2}}%
+ {\def\@dtl@A@chargroup{1}}%
+ {\def\@dtl@A@chargroup{0}}%
+ \expandafter\dtl@ifcasechargroup\@dtl@B@before\dtl@end@ifcasechargroup
+ {\def\@dtl@B@chargroup{2}}%
+ {\def\@dtl@B@chargroup{1}}%
+ {\def\@dtl@B@chargroup{0}}%
+ \ifnum\@dtl@A@chargroup<\@dtl@B@chargroup
+ #1=-1\relax
\else
- \ifnum\dtl@codeB=-1\relax
- \protected@edef\dtl@donext{%
- \noexpand\dtlicompare
- {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@restB}}%
- \dtl@donext
+ \ifnum\@dtl@A@chargroup>\@dtl@B@chargroup
+ #1=1\relax
\else
- \ifnum\dtl@codeA<\dtl@codeB
- #1=-1\relax
- \else
- \ifnum\dtl@codeA>\dtl@codeB
- #1=1\relax
+ \ifcase\@dtl@A@chargroup
+ \protected@edef\dtl@donext{%
+ \noexpand\dtlcompare
+ {\noexpand#1}{\@dtl@A@before}{\@dtl@B@before}}%
+ \dtl@donext
+ \or
+ \ifnum\@dtl@A@before<\@dtl@B@before\relax
+ #1=-1\relax
\else
- \ifdefempty{\dtl@restA}%
- {%
- \ifdefempty{\dtl@restB}%
- {%
- #1=0\relax
- }%
- {%
- #1=-1\relax
- }%
- }%
- {%
- \ifdefempty{\restB}%
- {%
- #1=1\relax
- }%
- {%
- \protected@edef\dtl@donext{%
- \noexpand\dtlicompare
- {\noexpand#1}{\dtl@restA}{\dtl@restB}}%
- \dtl@donext
- }%
- }%
+ \ifnum\@dtl@A@before>\@dtl@B@before\relax
+ #1=1\relax
+ \else
+ #1=0\relax
+ \fi
+ \fi
+ \or
+ \@dtlwordindexcompare{#1}{\@dtl@A@before}{\@dtl@B@before}
+ {\dtlicomparewords}{#4}%
+ \ifnum#1=0\relax
+ \let\@org@dtl@person@comma\datatoolpersoncomma
+ \let\@org@dtl@place@comma\datatoolplacecomma
+ \let\@org@dtl@subject@comma\datatoolsubjectcomma
+ \let\@org@dtl@paren@start\datatoolparenstart
+ \def\datatoolpersoncomma{3}%
+ \def\datatoolplacecomma{2}%
+ \def\datatoolsubjectcomma{1}%
+ \def\datatoolparenstart{-1}%
+ \ifnum\@dtl@A@comma>\@dtl@B@comma\relax
+ #1=-1\relax
+ \else
+ \ifnum\@dtl@A@comma<\@dtl@B@comma\relax
+ #1=1\relax
+ \else
+ \@dtlwordindexcompare{#1}{\@dtl@B@before}{\@dtl@A@before}
+ {\dtlcomparewords}{#4}%
+ \ifnum#1=0\relax
+ \@dtlwordindexcompare{#1}{\@dtl@A@after}{\@dtl@B@after}
+ {\dtlicomparewords}{#4}%
+ \fi
+ \fi
+ \fi
+ \let\datatoolpersoncomma\@org@dtl@person@comma
+ \let\datatoolplacecomma\@org@dtl@place@comma
+ \let\datatoolsubjectcomma\@org@dtl@subject@comma
+ \let\datatoolparenstart\@org@dtl@paren@start
\fi
\fi
\fi
\fi
- }{%
- \protected@edef\dtl@donext{%
- \noexpand\dtlicompare
- {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@firstB\dtl@restB}}%
- \dtl@donext
- }}{%
- \protected@edef\dtl@donext{%
- \noexpand\dtlicompare
- {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@firstB\dtl@restB}}%
- \dtl@donext
+ }%
+ }%
+}%
+\newcommand*{\datatoolpersoncomma}{,\space}
+\newcommand*{\datatoolplacecomma}{,\space}
+\newcommand*{\datatoolsubjectcomma}{,\space}
+\newcommand*{\datatoolparenstart}{\space}
+\newcommand*{\@dtlwordindexcompare}[5]{%
+ \dtl@setwordbreaks{#2}{#5}%
+ \let#2\dtl@string
+ \dtl@setwordbreaks{#3}{}%
+ \let#3\dtl@string
+ \edef\@dtl@do@compare{%
+ \noexpand#4{\noexpand#1}%
+ {\expandonce#2}{\expandonce#3}%
+ }%
+ \@dtl@do@compare
+}
+\newcommand*{\@dtl@dict@compare}[4]{%
+ \ifdefempty{#2}%
+ {%
+ \ifdefempty{#3}%
+ {%
+ #1=0\relax
+ }%
+ {%
+ #1=-1\relax
+ }%
+ }%
+ {%
+ \ifdefempty{#3}%
+ {%
+ #1=1\relax
+ }%
+ {%
+ \expandafter\dtl@grabword#2\@dtl@endgrabword\dtl@A@first\dtl@A@remain
+ \expandafter\dtl@grabword#3\@dtl@endgrabword\dtl@B@first\dtl@B@remain
+ \edef\@dtl@do@compare{%
+ \noexpand#4{\noexpand#1}%
+ {\expandonce\dtl@A@first}{\expandonce\dtl@B@first}%
}%
+ \@dtl@do@compare
+ \ifnum#1=0\relax
+ \@dtl@dict@compare{#1}{\dtl@A@remain}{\dtl@B@remain}{#4}%
+ \fi
}%
}%
}
+\def\dtl@grabword#1\@dtl@wordbreak#2\@dtl@endgrabword#3#4{%
+ \def#3{#1}%
+ \def#4{#2}%
+}
+\newcommand{\dtlicomparewords}[3]{%
+ \dtlicompare{#1}{#2}{#3}%
+}
+\newcommand{\dtlcomparewords}[3]{%
+ \dtlcompare{#1}{#2}{#3}%
+}
+\newcommand*{\dtl@setwordbreaks}[2]{%
+ \expandafter\dtl@subnobrsp\expandafter{#1}{\dtl@string}%
+ \DTLsubstituteall{\dtl@string}{~}{#2}%
+ \DTLsubstituteall{\dtl@string}{\ }{#2}%
+ \DTLsubstituteall{\dtl@string}{\space}{#2}%
+ \DTLsubstituteall{\dtl@string}{-}{#2}%
+ \toks@{#2}%
+ \edef\dtl@do@setwordbreaks{%
+ \noexpand\@dtl@setwordbreaks{\the\toks@}\expandonce\dtl@string\space\noexpand\@nil}%
+ \def\dtl@string{}%
+ \dtl@do@setwordbreaks
+}
+\def\@dtl@setwordbreaks#1#2 #3{%
+ \def\dtl@tmp{#3}%
+ \ifx\@nnil\dtl@tmp
+ \let\@dtl@setwordbreaks@next\@gobbletwo
+ \appto\dtl@string{#2}%
+ \else
+ \let\@dtl@setwordbreaks@next\@dtl@setwordbreaks
+ \appto\dtl@string{#2#1}%
+ \fi
+ \@dtl@setwordbreaks@next{#1}#3%
+}
+\newcommand*{\dtl@setwordbreaksnohyphens}[2]{%
+ \expandafter\dtl@subnobrsp\expandafter{#1}{\dtl@string}%
+ \DTLsubstituteall{\dtl@string}{~}{#2}%
+ \DTLsubstituteall{\dtl@string}{\ }{#2}%
+ \DTLsubstituteall{\dtl@string}{\space}{#2}%
+ \toks@{#2}%
+ \edef\dtl@do@setwordbreaks{%
+ \noexpand\@dtl@setwordbreaks{\the\toks@}\expandonce\dtl@string\space\noexpand\@nil}%
+ \def\dtl@string{}%
+ \dtl@do@setwordbreaks
+}
+\newcommand*{\@dtl@wordbreak}{ }
+\def\dtl@ifcasechargroup#1#2\dtl@end@ifcasechargroup#3#4#5{%
+ \dtlifcasechargroup{#1}%
+ {#3}%
+ {%
+ \DTLifint{#1#2}
+ {%
+ #4%
+ }%
+ {%
+ #3%
+ }%
+ }%
+ {#5}%
+}
+\newcommand*{\dtlifcasechargroup}[4]{%
+ \count@=`#1\relax
+ \dtlifintclosedbetween{\number\count@}{48}{57}%
+ {%
+ #3%
+ }%
+ {%
+ \dtlifintclosedbetween{\number\count@}{97}{122}%
+ {%
+ #2%
+ }%
+ {%
+ \dtlifintclosedbetween{\number\count@}{65}{90}%
+ {%
+ #2%
+ }%
+ {%
+ #4%
+ }%
+ }%
+ }%
+}
+\newcommand*{\dtlparsewords}[2]{%
+ \dtl@subnobrsp{#1}{\dtl@string}%
+ \DTLsubstituteall{\dtl@string}{~}{ }%
+ \DTLsubstituteall{\dtl@string}{\ }{ }%
+ \DTLsubstituteall{\dtl@string}{\space}{ }%
+ \DTLsubstituteall{\dtl@string}{-}{ }%
+ \let\dtl@parsewordshandler#2\relax
+ \edef\dtl@donext{%
+ \noexpand\@dtl@parse@words\expandonce\dtl@string\space\noexpand\@nil}%
+ \dtl@donext
+}
+\def\@dtl@parse@words#1 #2{%
+ \def\dtl@tmp{#2}%
+ \ifx\@nnil\dtl@tmp
+ \let\parse@wordsnext=\@gobble
+ \else
+ \let\parse@wordsnext=\@dtl@parse@words
+ \fi
+ \dlt@parsewordshandler{#1}%
+ \parse@wordsnext#2%
+}
\newcommand*{\DTLifstringlt}{\@ifstar\@sDTLifstringlt\@DTLifstringlt}
\newcommand*{\@DTLifstringlt}[4]{%
\protected@edef\@dtl@tmpcmp{%
@@ -1815,9 +2166,9 @@
\fi
}
\newcommand*{\DTLifSubString}[4]{%
- \protected@edef\@dtl@tmp{\noexpand\dtl@testifsubstring
+ \protected@edef\@dtl@dotestifsubstring{\noexpand\dtl@testifsubstring
{#1}{#2}}%
- \@dtl@tmp
+ \@dtl@dotestifsubstring
\if@dtl@condition
#3%
\else
@@ -1827,6 +2178,17 @@
\newcommand*{\dtl@testifsubstring}[2]{%
\dtl@subnobrsp{#1}{\@dtl@argA}%
\dtl@subnobrsp{#2}{\@dtl@argB}%
+ \dtl@setwordbreaksnohyphens{\@dtl@argA}{\@dtl@wordbreak}%
+ \let\@dtl@argA\dtl@string
+ \dtl@setwordbreaksnohyphens{\@dtl@argB}{\@dtl@wordbreak}%
+ \let\@dtl@argB\dtl@string
+ \edef\dtl@donext{%
+ \noexpand\@dtl@testifsubstring{\expandonce\@dtl@argA}{\expandonce\@dtl@argB}}%
+ \dtl@donext
+}
+\newcommand*{\@dtl@testifsubstring}[2]{%
+ \def\@dtl@argA{#1}%
+ \def\@dtl@argB{#2}%
\ifdefempty{\@dtl@argB}%
{%
\@dtl@conditiontrue
@@ -1837,16 +2199,15 @@
\@dtl@conditionfalse
}%
{%
- \dtl@teststartswith{#1}{#2}%
+ \@dtl@teststartswith{#1}{#2}%
\if@dtl@condition
\else
- \DTLsubstituteall{\@dtl@argA}{ }{\space }%
\expandafter\dtl@getfirst\@dtl@argA\end
\expandafter\dtl@ifsingle\expandafter{\dtl@first}{%
- \expandafter\dtl@testifsubstring\expandafter{\dtl@rest}{#2}%
+ \expandafter\@dtl@testifsubstring\expandafter{\dtl@rest}{#2}%
}{%
- \protected@edef\@dtl@donext{\noexpand\dtl@testifsubstring
- {\dtl@first\dtl@rest}{\@dtl@argB}}%
+ \protected@edef\@dtl@donext{\noexpand\@dtl@testifsubstring
+ {\expandonce\dtl@first\expandonce\dtl@rest}{\expandonce\@dtl@argB}}%
\@dtl@donext
}%
\fi
@@ -1866,6 +2227,18 @@
\newcommand*{\dtl@teststartswith}[2]{%
\dtl@subnobrsp{#1}{\@dtl@argA}%
\dtl@subnobrsp{#2}{\@dtl@argB}%
+ \dtl@setwordbreaksnohyphens{\@dtl@argA}{\@dtl@wordbreak}%
+ \let\@dtl@argA\dtl@string
+ \dtl@setwordbreaksnohyphens{\@dtl@argB}{\@dtl@wordbreak}%
+ \let\@dtl@argB\dtl@string
+ \edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith{\expandonce\@dtl@argA}{\expandonce\@dtl@argB}}%
+ \dtl@donext
+}
+
+\newcommand*{\@dtl@teststartswith}[2]{%
+ \def\@dtl@argA{#1}%
+ \def\@dtl@argB{#2}%
\ifdefempty{\@dtl@argA}%
{%
\ifdefempty{\@dtl@argB}%
@@ -1882,54 +2255,59 @@
\@dtl@conditiontrue
}%
{%
- \DTLsubstituteall{\@dtl@argA}{ }{\space }%
- \DTLsubstituteall{\@dtl@argB}{ }{\space }%
\expandafter\dtl@getfirst\@dtl@argA\end
\let\dtl@firstA=\dtl@first
\let\dtl@restA=\dtl@rest
\expandafter\dtl@getfirst\@dtl@argB\end
\let\dtl@firstB=\dtl@first
\let\dtl@restB=\dtl@rest
- \expandafter\dtl@ifsingle\expandafter{\dtl@firstA}{%
- \expandafter\dtl@ifsingle\expandafter{\dtl@firstB}{%
- \expandafter\dtl@setcharcode\expandafter{\dtl@firstA}{\dtl@codeA}%
- \expandafter\dtl@setcharcode\expandafter{\dtl@firstB}{\dtl@codeB}%
- \ifnum\dtl@codeA=-1\relax
- \ifnum\dtl@codeB=-1\relax
- \protected@edef\dtl@donext{%
- \noexpand\dtl@teststartswith{\dtl@restA}{\dtl@restB}}%
- \dtl@donext
- \else
- \protected@edef\dtl@donext{%
- \noexpand\dtl@teststartswith
- {\dtl@restA}{\dtl@firstB\dtl@restB}}%
- \dtl@donext
- \fi
- \else
- \ifnum\dtl@codeB=-1\relax
- \protected@edef\dtl@donext{%
- \noexpand\dtl@teststartswith
- {\dtl@firstA\dtl@restA}{\dtl@restB}}%
- \dtl@donext
- \else
- \ifnum\dtl@codeA=\dtl@codeB
- \protected@edef\dtl@donext{%
- \noexpand\dtl@teststartswith{\dtl@restA}{\dtl@restB}}%
- \dtl@donext
+ \expandafter\dtl@ifsingle\expandafter{\dtl@firstA}%
+ {%
+ \expandafter\dtl@ifsingle\expandafter{\dtl@firstB}%
+ {%
+ \expandafter\dtl@setcharcode\expandafter{\dtl@firstA}{\dtl@codeA}%
+ \expandafter\dtl@setcharcode\expandafter{\dtl@firstB}{\dtl@codeB}%
+ \ifnum\dtl@codeA=-1\relax
+ \ifnum\dtl@codeB=-1\relax
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith{\expandonce\dtl@restA}{\expandonce\dtl@restB}}%
+ \dtl@donext
+ \else
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith
+ {\expandonce\dtl@restA}{\expandonce\dtl@firstB\expandonce\dtl@restB}}%
+ \dtl@donext
+ \fi
\else
- \@dtl@conditionfalse
+ \ifnum\dtl@codeB=-1\relax
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith
+ {\expandonce\dtl@firstA\expandonce\dtl@restA}{\expandonce\dtl@restB}}%
+ \dtl@donext
+ \else
+ \ifnum\dtl@codeA=\dtl@codeB
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith{\expandonce\dtl@restA}{\expandonce\dtl@restB}}%
+ \dtl@donext
+ \else
+ \@dtl@conditionfalse
+ \fi
+ \fi
\fi
- \fi
- \fi
- }{%
- \protected@edef\dtl@donext{%
- \noexpand\dtl@teststartswith
- {\dtl@firstA\dtl@restA}{\dtl@firstB\dtl@restB}}%
- \dtl@donext
- }}{%
- \protected@edef\dtl@donext{%
- \noexpand\dtl@teststartswith
- {\dtl@firstA\dtl@restA}{\dtl@firstB\dtl@restB}}%
+ }%
+ {%
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith
+ {\expandonce\dtl@firstA\expandonce\dtl@restA}%
+ {\expandonce\dtl@firstB\expandonce\dtl@restB}}%
+ \dtl@donext
+ }%
+ }%
+ {%
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith
+ {\expandonce\dtl@firstA\expandonce\dtl@restA}%
+ {\expandonce\dtl@firstB\expandonce\dtl@restB}}%
}%
}%
}%