summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/xpackages/xbase
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/xpackages/xbase')
-rw-r--r--Master/texmf-dist/source/latex/xpackages/xbase/template-test.tex77
-rw-r--r--Master/texmf-dist/source/latex/xpackages/xbase/template-test2.tex110
-rw-r--r--Master/texmf-dist/source/latex/xpackages/xbase/tprestrict-test.tex80
-rw-r--r--Master/texmf-dist/source/latex/xpackages/xbase/xparse-test.tex296
-rw-r--r--Master/texmf-dist/source/latex/xpackages/xbase/xparse.dtx156
-rw-r--r--Master/texmf-dist/source/latex/xpackages/xbase/xtemplate.dtx46
6 files changed, 137 insertions, 628 deletions
diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/template-test.tex b/Master/texmf-dist/source/latex/xpackages/xbase/template-test.tex
deleted file mode 100644
index 5684ce7a90f..00000000000
--- a/Master/texmf-dist/source/latex/xpackages/xbase/template-test.tex
+++ /dev/null
@@ -1,77 +0,0 @@
-% \iffalse
-%% (C) Copyright 2000-2004 LaTeX3 Project
-%%
-%% It may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License (LPPL), either version 1.3a of this
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the ``xbase bundle'' (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with the LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% $Id: template-test.tex 1628 2009-10-25 09:54:34Z mittelba $
-%%
-% \fi
-%
-\RequirePackage{template}
-
-\DeclareTemplateType{xxx}{0}
-
-\DeclareTemplate{xxx}{test}{0}
- {
- xkey=n \xkey,
- key =i {yyy} \value
- }
- {
- \DoParameterAssignments
- \show\xkey
- \show\value
- \value
- }
-
-\DeclareTemplateType{yyy}{0}
-
-\DeclareTemplate{yyy}{foo}{0}
- {
- keya =L \foo
- }
- {
- \DoParameterAssignments
- \show\foo
- }
-
-
-\DeclareInstance{xxx}{bar}{test}
- {
- xkey = \UseTemplate{yyy}{foo}{ keya = 20pt },
- key = \UseTemplate{yyy}{foo}{ keya = 10pt }
- }
-
-\ShowInstance{xxx}{bar}
-
-\UseInstance{xxx}{bar}
-
-\stop
diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/template-test2.tex b/Master/texmf-dist/source/latex/xpackages/xbase/template-test2.tex
deleted file mode 100644
index 489e9f2304a..00000000000
--- a/Master/texmf-dist/source/latex/xpackages/xbase/template-test2.tex
+++ /dev/null
@@ -1,110 +0,0 @@
-% \iffalse
-%% (C) Copyright 2000-2004 LaTeX3 Project
-%%
-%% It may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License (LPPL), either version 1.3a of this
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the ``xbase bundle'' (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with the LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% $Id: template-test2.tex 585 2006-12-12 17:31:48Z morten $
-%%
-% \fi
-%
-
-
-\RequirePackage{template}
-\RequirePackage{trace}
-
-\DeclareTemplateType{xxx}{0}
-
-\def\MultiSelection{\MultiSelectionError}
-%\def\foo{bar}
-
-%\traceon
-
-\DeclareTemplate{xxx}{test}{0}
- {
- xkey=n [\foo] \xkey,
- ykey=n [\DelayEvaluation\foo] \ykey,
- zkey=n \zkey,
- last=n [last] \lastkey,
- set =i {xxx} \xxx
- }
- {
- \DoParameterAssignments
- \typeout{abc}
- }
-\ShowTemplate{xxx}{test}
-
-
-\DeclareInstance{xxx}{bar}{test}
- {
- zkey = foo,
- xkey = baz,
- }
-
-\DeclareInstance{xxx}{baz}{test}
- {
- last = first,
- set = \UseTemplate{xxx}{test}{zkey=rrr},
- zkey = foo
- }
-
-
-\ShowInstance{xxx}{bar}
-\ShowInstance{xxx}{baz}
-
-\DeclareTemplateType{yyy}{0}
-
-\DeclareTemplate{yyy}{foo}{0}
- {
- keya =L \foo
- }
- {
- \DoParameterAssignments
- \show\foo
- }
-
-
-\DeclareInstance{xxx}{bar}{test}
- {
- xkey = \UseTemplate{yyy}{foo}{ keya = 20pt },
- key = \UseTemplate{yyy}{foo}{ keya = 10pt }
- }
-
-\ShowInstance{xxx}{bar}
-
-\UseInstance{xxx}{bar}
-
-\stop
-
-%%% Local Variables:
-%%% mode: plain-tex
-%%% TeX-master: t
-%%% End:
diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/tprestrict-test.tex b/Master/texmf-dist/source/latex/xpackages/xbase/tprestrict-test.tex
deleted file mode 100644
index d981888d450..00000000000
--- a/Master/texmf-dist/source/latex/xpackages/xbase/tprestrict-test.tex
+++ /dev/null
@@ -1,80 +0,0 @@
-% \iffalse
-%% (C) Copyright 2000-2004 LaTeX3 Project
-%%
-%% It may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License (LPPL), either version 1.3a of this
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the ``xbase bundle'' (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with the LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% $Id: tprestrict-test.tex 1628 2009-10-25 09:54:34Z mittelba $
-%%
-% \fi
-%
-
-\makeatletter
-\RequirePackage{template}
-\IgnoreWhiteSpace
-
-\newcount\ca
-\newdimen\da
-
-
-\DeclareTemplateType{type}{0}
-
-\DeclareTemplate{type}{Ta}{0}{
- one =l [2in] \da,
- two =c [5] \ca}
- {\DoParameterAssignments\typeout{\da=\the\da,\@spaces \ca=\the\ca}}
-
-\ShowTemplate{type}{Ta}
-
-\typeout{1^^J==}
-\UseTemplate{type}{Ta}{}
-
-\typeout{2^^J==}
-\UseTemplate{type}{Ta}{one=44pt, two=7}
-
-
-\DeclareRestrictedTemplate{type}{Tb}{Ta}{one=33pt}
-
-\ShowTemplate{type}{Tb}
-
-\typeout{RESTRICT^^J3^^J==}
-
-\DeclareInstance{type}{foo}{Tb}{two=9}
-
-\ShowInstance{type}{foo}
-
-\UseInstance{type}{foo}
-
-\typeout{4^^J==}
-\UseTemplate{type}{Tb}{two=7}
-
-\stop
-
diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/xparse-test.tex b/Master/texmf-dist/source/latex/xpackages/xbase/xparse-test.tex
deleted file mode 100644
index 8614c4ed06a..00000000000
--- a/Master/texmf-dist/source/latex/xpackages/xbase/xparse-test.tex
+++ /dev/null
@@ -1,296 +0,0 @@
-% \iffalse
-%% (C) Copyright 2000-2009 LaTeX3 Project
-%%
-%% It may be distributed and/or modified under the conditions of the
-%% LaTeX Project Public License (LPPL), either version 1.3a of this
-%% license or (at your option) any later version. The latest version
-%% of this license is in the file
-%%
-%% http://www.latex-project.org/lppl.txt
-%%
-%% This file is part of the ``xbase bundle'' (The Work in LPPL)
-%% and all files in that bundle must be distributed together.
-%%
-%% The released version of this bundle is available from CTAN.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% The development version of the bundle can be found at
-%%
-%% http://www.latex-project.org/svnroot/experimental/trunk/
-%%
-%% for those people who are interested.
-%%
-%%%%%%%%%%%
-%% NOTE: %%
-%%%%%%%%%%%
-%%
-%% Snapshots taken from the repository represent work in progress and may
-%% not work or may contain conflicting material! We therefore ask
-%% people _not_ to put them into distributions, archives, etc. without
-%% prior consultation with the LaTeX Project Team.
-%%
-%% -----------------------------------------------------------------------
-%%
-%% $Id: xparse-test.tex 1628 2009-10-25 09:54:34Z mittelba $
-%%
-% \fi
-%
-
-\documentclass{minimal}
-
-\usepackage{xparse,l3box}
-
-
-\typeout{Testing the complicated makebox setup}
-\typeout{*****************************}
-\typeout{* look at dvi output for this part}
-\typeout{*****************************}
-
-\ExplSyntaxOn
-\makeatletter
-% Let's just take the error messages for a ride:
-\cs_set_nopar:Npn \makebox{}
-% Here should be an error because it is defined
-\NewDocumentCommand \makebox {m}{Gobbledygook}
-\cs_gundefine:N \makebox
-% And now one for being undefined
-\RenewDocumentCommand \makebox {m}{More~gobbledygook}
-\cs_set_eq:NN \makebox \scan_stop:
-% Another one for being undefined
-\RenewDocumentCommand \makebox {m}{Even~more~gobbledygook}
-% Now it should work
-\DeclareDocumentCommand \makebox
- { >{\xparse_process_comma_split:n}d() o O{c} m}
- {\IfNoValueTF{#1}
- { \ltx@maketextbox{#2}{#3}{#4}\mbox }
- { \ltx@makepicbox #1 {#2}{#4}\@firstofone }
- }
-
-\DeclareDocumentCommand \framebox
- { >{\xparse_process_comma_split:n} d() o O{c} m}
- {
- \IfNoValueTF{#1}
- { \ltx@maketextbox{#2}{#3}{#4}\fbox }
- { \ltx@makepicbox #1 {#2}{#4}\frame }
- }
-
-\def\ltx@maketextbox#1#2#3#4{
- \IfNoValueTF{#1}
- {#4{#3}}
- {
- \leavevmode
- \@begin@tempboxa\hbox{#3}
- \setlength\@tempdima{#1}
- \if_meaning:w #4\fbox
- \setbox\@tempboxa\hb@xt@\@tempdima{
- \kern\fboxsep
- \use:c{bm@#2}
- \kern\fboxsep
- }
- \@frameb@x{\kern-\fboxrule}
- \else:
- \hb@xt@\@tempdima{\use:c{bm@#2}}
- \fi:
- \@end@tempboxa
- }
-}
-
-\def\ltx@makepicbox#1#2#3#4#5{
- #5
- {
- \vbox to#2\unitlength {
- \cs_set_eq:NN \mb@b\vss \cs_set_eq:NN \mb@l\hss
- \cs_set_eq:NN \mb@r\hss \cs_set_eq:NN \mb@t\vss
- \IfNoValueF{#3}{
- \tl_map_variable:nNn {#3}\l_tmpa_tl {
- \if:w s\l_tmpa_tl
- \cs_set_eq:NN \mb@l \scan_stop:
- \cs_set_eq:NN \mb@r \scan_stop:
- \else:
- \cs_set_eq:cN {mb@\l_tmpa_tl}\scan_stop:
- \fi:
- }
- }
- \mb@t
- \hb@xt@ #1\unitlength{\mb@l #4\mb@r}
- \mb@b
- \kern\z@
- }
- }
-}
-
-\makeatother
-\ExplSyntaxOff
-
-\begin{document}
-
-
-\thicklines
-
-\makebox{A}
-\makebox(1,2){B}
-\makebox(0,0)[lt]{C}
-\makebox[20pt]{D}
-\makebox[30pt][r]{E}
-
-\vspace{1cm}
-
-
-\framebox{A}
-\framebox(1,2){B}
-\framebox(0,0)[lt]{C}
-\framebox[20pt]{D}
-\framebox[30pt][r]{E}
-
-
-\typeout{Testing optional coordinates}
-
-\DeclareDocumentCommand \foo { mmo }
-{ \typeout{1:#1}
- \typeout{2:#2}
-}
-
-\show\foo
-
-\ExplSyntaxOn
-\DeclareDocumentCommand \foo
- { m >{\xparse_process_comma_split:n} D(){0,0} m }
-{ \typeout{1:#1}
- \typeout{2:#2}
- \typeout{3:#3}
-}
-\ExplSyntaxOff
-
-\show\foo
-
-\foo A(1,2)B
-
-\foo A B
-
-\typeout{Testing mandatory coordinates (gives error on second examples)}
-
-\ExplSyntaxOn
-\DeclareDocumentCommand \foo { m >{\xparse_process_comma_split:n} d() m }
-{ \IfNoValueTF {#2} {
- \ERROR
- }{
- \typeout{1:#1}
- \typeout{2:#2}
- \typeout{3:#3}
- }
-}
-\ExplSyntaxOff
-
-\show\foo
-
-\foo A(1,2)B
-
-\foo A B
-
-\typeout{Testing normal optional arguments}
-
-
-\DeclareDocumentCommand \foo { mmmm o mm o }
-{ \typeout{1:#1}
- \typeout{2:#2}
- \typeout{3:#3}
- \typeout{4:#4}
- \typeout{5:#5}
- \typeout{6:#6}
- \typeout{7:#7}
- \typeout{8:#8}
-}
-
-\foo 1234 [5]67[8]
-\foo 1234 [5]67 [8] % 8 should not be picked up here
-\foo 123467
-
-\show\foo
-\expandafter\show\csname\string\foo\endcsname
-
-
-\typeout{Testing optional arguments with default}
-
-\DeclareDocumentCommand \baz { O{?}mmm o mm m }
-{ \typeout{1:#1}
- \typeout{2:#2}
- \typeout{3:#3}
- \typeout{4:#4}
- \typeout{5:#5}
- \typeout{6:#6}
- \typeout{7:#7}
- \typeout{8:#8}
-}
-
-\show\baz
-\expandafter\show\csname\string\baz\endcsname
-
-\baz [1]234[5]678
-\baz 234678
-
-%\tracingall\tracingassigns=1
-\DeclareDocumentCommand \bar { mmmm mmmm m}
-{ \typeout{1:#1}
- \typeout{2:#2}
- \typeout{3:#3}
- \typeout{4:#4}
- \typeout{5:#5}
- \typeout{6:#6}
- \typeout{7:#7}
- \typeout{8:#8}
- \typeout{9:#9}
-}
-
-\show\bar
-\expandafter\show\csname\string\bar\endcsname
-
-\bar 123456789
-
-\DeclareDocumentCommand\chapter{soom}
-{\typeout{a{#1}^^Jb{#2}^^Jc{#3}^^Jd{#4}^^Je}}
-
-\show\chapter
-\expandafter\show\csname\string\chapter\endcsname
-
-\typeout{1:}
-\chapter*[xxx][yyy]{zzz}
-
-\typeout{2:}
-\chapter[xxx][yyy]{zzz}
-
-\typeout{3:}
-\chapter*[xxx]{zzz}
-
-\typeout{4:}
-\typeout{\chapter*[xxx][yyy]{zzz}}
-
-
-
-
-\DeclareDocumentCommand\chapter{soom}
-{\typeout{a{#1}^^Jb{#2}^^Jc{#3}^^Jd{#4}^^Je}}
-
-\DeclareDocumentEnvironment{hello}{ooo}
- {\typeout{B1(#1)^^JB2(#2)^^JB3(#3)^^J}}
- {\typeout{E1(#1)^^JE2(#2)^^JE3(#3)^^J}}
-
-
-\show\hello
-\expandafter\show\csname\string\hello\endcsname
-
-\show\endhello
-\expandafter\show\csname end\string\\hello\endcsname
-
-\begin{hello}[abc][aabbcc]
-\typeout{body}
-\typeout{5:}
-\chapter[xxx][yyy]{zzz}
-\end{hello}
-
-\begin{hello}[1]
-\typeout{outer body}
-\hello[2]\typeout{inner body}\endhello
-\end{hello}
-
-\stop
diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/xparse.dtx b/Master/texmf-dist/source/latex/xpackages/xbase/xparse.dtx
index 6966f9f1e5a..32514be2fe1 100644
--- a/Master/texmf-dist/source/latex/xpackages/xbase/xparse.dtx
+++ b/Master/texmf-dist/source/latex/xpackages/xbase/xparse.dtx
@@ -41,7 +41,7 @@
\RequirePackage{l3names}
%</driver|package>
%\fi
-\GetIdInfo$Id: xparse.dtx 1876 2010-03-27 07:20:51Z joseph $
+\GetIdInfo$Id: xparse.dtx 1897 2010-04-26 05:56:56Z joseph $
{Generic document command parser}
%\iffalse
%<*driver>
@@ -50,6 +50,7 @@
[\filedate\space v\fileversion\space\filedescription]
%\iffalse
\documentclass{l3doc}
+\usepackage{amstext}
\begin{document}
\DocInput{xparse.dtx}
\end{document}
@@ -393,39 +394,38 @@
% \end{verbatim}
%\end{function}
%
-%\begin{function}{\xparse_process_comma_split:n}
+%\begin{function}{ \ReverseBoolean }
% \begin{syntax}
-% "\xparse_process_comma_split:n"
-% ~~~~\Arg{grabbed argument}
+% \cs{ReverseBoolean}
% \end{syntax}
-% The \cs{xparse_process_comma_split:n} processor splits the
-% grabbed argument at the first comma, returning the two
-% parts of the result in braces. If no comma is found, the second
-% part of the returned value \cs{NoValue}. This function is intended to
-% aid the processing of co-ordinate pairs. For example, to create
-% a co-ordinate argument which raises an error if not given:
+% This processor reverses the logic of \cs{BooleanTrue} and
+% \cs{BooleanFalse}, so that the the example from earlier would become
% \begin{verbatim}
-% \DeclareDocumentCommand \foo
-% { >{\xparse_process_comma_split:n} d() } {
-% \IfNoValueTF #1 {
-% \ERROR
-% }{
-% \foo_internal:nn #1
-% }
-% }
+% \DeclareDocumentCommand \foo { > { \ReverseBoolean } s m } {
+% \IfBooleanTF #1
+% { \DoSomethingWithoutStar {#2} }
+% { \DoSomethingWithStar {#2} }
+% }
% \end{verbatim}
-% For the input |\foo(1.1,2.2)|, |#1| here would equal |{1.1}{2.2}|,
-% and so \cs{foo_internal:nn} receives exactly the correct number of
-% arguments. A similar function which takes an optional co-ordinate
-% pair, could be created as:
+%\end{function}
+%
+%\begin{function}{ \SplitArgument }
+% \begin{syntax}
+% \cs{SplitArgument} \Arg{number} \Arg{token}
+% \end{syntax}
+% This processor splits the argument given at each occurrence of the
+% \meta{token} up to a maximum of \meta{number} tokens (thus
+% dividing the input into \( \text{\meta{number}} + 1 \) parts).
+% An error is given if too many \meta{tokens} are present in the
+% input. The processed input is places inside
+% \( \text{\meta{number}} + 1 \) sets of braces for further use.
% \begin{verbatim}
% \DeclareDocumentCommand \foo
-% { >{\xparse_process_comma_split:n} D(){0,0} } {
-% \foo_internal:nn #1
-% }
+% { > { \SplitArgument { 2 } { ; } } m }
+% { \InternalFunctionOfThreeArguments #1 }
% \end{verbatim}
-% This illustrates that the processor function will be applied to the
-% default value, which therefore includes a comma.
+% Any category code \( 13 \) (active) \meta{tokens} will be replaced
+% before the split takes place.
%\end{function}
%
%\subsection{Separating interface and implementation}
@@ -2059,22 +2059,79 @@
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\xparse_process_comma_split:n}
-%\begin{macro}[aux]{\xparse_process_comma_split_aux:w}
-% Turns a co-ordinate pair into two separate values.
+%\begin{macro}{\_parse_bool_reverse:N}
+% A simple reversal.
% \begin{macrocode}
-\cs_new:Npn \xparse_process_comma_split:n #1 {
- \tl_if_in:nnTF {#1} { , } {
- \xparse_process_comma_split_aux:w #1 \q_stop
- }{
- \tl_set:Nn \ProcessedArgument { {#1} { \NoValue } }
- }
-}
-\cs_new:Npn \xparse_process_comma_split_aux:w #1 , #2 \q_stop {
- \tl_set:Nn \ProcessedArgument { {#1} {#2} }
+\cs_new_protected:Npn \_xparse_bool_reverse:N #1 {
+ \bool_if:NTF #1
+ { \tl_set:Nn \ProcessedArgument { \c_false_bool } }
+ { \tl_set:Nn \ProcessedArgument { \c_true_bool } }
}
% \end{macrocode}
%\end{macro}
+%
+%\begin{macro}{\_l_xparse_split_argument_tl}
+%\begin{macro}{\_xparse_split_argument:nnn}
+%\begin{macro}[aux]{\_xparse_split_argument_aux_i:w}
+%\begin{macro}[aux]{\_xparse_split_argument_aux_ii:w}
+%\begin{macro}[aux]{\_xparse_split_argument_aux_iii:w}
+% The idea of this function is to split the input \( n + 1 \) times using
+% a given token.
+% \begin{macrocode}
+\tl_new:N \_l_xparse_split_argument_tl
+\group_begin:
+ \char_make_active:N \@
+ \cs_gset_protected:Npn \_xparse_split_argument:nnn #1#2#3
+ {
+ \tl_set:Nn \_l_xparse_split_argument_tl {#3}
+ \group_begin:
+ \char_set_lccode:nn { `\@ } { `#2}
+ \tl_to_lowercase:n
+ {
+ \group_end:
+ \tl_replace_all_in:Nnn \_l_xparse_split_argument_tl { @ } {#2}
+ }
+ \cs_set_protected:Npn \_xparse_split_argument_aux_i:w
+ ##1 \q_nil ##2 #2 ##3 \q_stop
+ {
+ \tl_put_right:Nn \ProcessedArgument { {##2} }
+ ##1 \q_nil ##3 \q_stop
+ }
+ \cs_set_protected:Npn \_xparse_split_argument_aux_iii:w
+ ##1 #2 ##2 \q_stop
+ {
+ \IfNoValueF {##1}
+ {
+ \msg_kernel_error:nnxxx { xparse } { split-excess-tokens }
+ { \exp_not:n {#2} } {#1} { \exp_not:n {#3} }
+ }
+ }
+ \tl_set:Nx \_l_xparse_tmp_tl
+ {
+ \prg_replicate:nn { #1 + 1 }
+ { \_xparse_split_argument_aux_i:w }
+ \_xparse_split_argument_aux_ii:w
+ \exp_not:N \q_nil
+ \exp_not:V \_l_xparse_split_argument_tl
+ \prg_replicate:nn {#1} { \exp_not:n {#2} \NoValue }
+ \exp_not:n { #2 \q_stop }
+ }
+ \_l_xparse_tmp_tl
+ }
+\group_end:
+\cs_set_protected:Npn \_xparse_split_argument_aux_i:w { }
+\cs_set_protected:Npn \_xparse_split_argument_aux_ii:w
+ #1 \q_nil #2 \q_stop
+ {
+ \tl_if_empty:nF {#2}
+ { \_xparse_split_argument_aux_iii:w #2 \q_stop }
+ }
+\cs_set_protected:Npn \_xparse_split_argument_aux_iii:w { }
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
%\end{macro}
%
%\subsection{Creating expandable functions}
@@ -2473,6 +2530,13 @@
Argument~specification~'#1'~contains~a~processor~function:\\
this~is~only~supported~for~standard~robust~functions.
}
+\msg_kernel_set:nnnn { xparse } { split-excess-tokens }
+ { Too~many~'#1'~tokens~when~trying~to~split~argument. }
+ {
+ LaTeX~was~asked~to~split~the~input~'#3'\\
+ at~each~occurrence~of~the~token~'#1',~up~to~a~maximum~of~#2~tokens.\\
+ There~were~too~many~'#1'~tokens.
+ }
\msg_kernel_new:nnnn { xparse } { unknown-argument-type }
{ Unknown~argument~type~'#1'~replaced~by~'m'.~Fingers~crossed~... }
{
@@ -2684,6 +2748,20 @@
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\ReverseBoolean}
+% A processor to reverse the logic for token detection.
+% \begin{macrocode}
+\cs_new_eq:NN \ReverseBoolean \_xparse_bool_reverse:N
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\SplitArgument}
+% Another simple copy.
+% \begin{macrocode}
+\cs_new_eq:NN \SplitArgument \_xparse_split_argument:nnn
+% \end{macrocode}
+%\end{macro}
+%
% \begin{macrocode}
%</initex|package>
% \end{macrocode}
diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/xtemplate.dtx b/Master/texmf-dist/source/latex/xpackages/xbase/xtemplate.dtx
index 0287282d898..d6f317c1072 100644
--- a/Master/texmf-dist/source/latex/xpackages/xbase/xtemplate.dtx
+++ b/Master/texmf-dist/source/latex/xpackages/xbase/xtemplate.dtx
@@ -38,7 +38,7 @@
\RequirePackage{l3names}
%</driver|package>
%\fi
-\GetIdInfo$Id: xtemplate.dtx 1879 2010-03-29 17:48:38Z mittelba $
+\GetIdInfo$Id: xtemplate.dtx 1896 2010-04-14 17:40:38Z joseph $
{Prototype document functions}
%\iffalse
%<*driver>
@@ -1902,7 +1902,7 @@
\cs_new:Npn \xtemplate_split_keytype:n #1 {
\bool_set_false:N \l_xtemplate_error_bool
\tl_set:Nn \l_xtemplate_tmp_tl {#1}
- \tl_replace_all_in:Nnn \l_xtemplate_tmp_tl { ~ } { }
+ \tl_remove_all_in:Nn \l_xtemplate_tmp_tl { ~ }
\tl_replace_all_in:Nnn \l_xtemplate_tmp_tl { : } { @ }
\tl_if_in:VnTF \l_xtemplate_tmp_tl { @ } {
\exp_after:wN \xtemplate_split_keytype_aux:w \l_xtemplate_tmp_tl
@@ -2699,9 +2699,9 @@
% \begin{macrocode}
\cs_new_nopar:Npn \xtemplate_assign_code: {
\tl_put_left:Nx \l_xtemplate_assignments_tl {
- \exp_not:N \cs_set:Npn \exp_not:N \xtemplate_assign_code:n ##1 {
- \exp_not:V \l_xtemplate_var_tl
- }
+ \exp_not:N \cs_set:Npn \exp_not:N \xtemplate_assign_code:n
+ \exp_not:n {##1}
+ { \exp_not:V \l_xtemplate_var_tl }
\exp_not:N \xtemplate_assign_code:n
{ \exp_not:V \l_xtemplate_value_tl }
}
@@ -3024,7 +3024,7 @@
% The text for error messages: short and long text for all of them.
% \begin{macrocode}
\msg_kernel_new:nnnn { xtemplate } { argument-number-mismatch }
- { Object~type~'#1'~takes~'#2' ~not~'#3'~argument(s). }
+ { Object~type~'#1'~takes~'#2'~not~'#3'~argument(s). }
{
Objects~of~type~'#1'~require~'#2'~arguments.\\
You~have~tried~to~make~a~template~for~'#1'\\
@@ -3058,7 +3058,7 @@
{ The~choice~'unknown'~cannot~be~given~for~a~template~key.}
{
The~'unknown'~choice~is~automatically~checked~by~template~when \\
- a~choice~key~is~given with~an~unknown~value.~It~should~not~be \\
+ a~choice~key~is~given~with~an~unknown~value.~It~should~not~be \\
included~in~the~list~of~named~choices~for~a~key,~and~is~always \\
given~last~in~the~implementation~of~choices.
}
@@ -3085,24 +3085,23 @@
\msg_kernel_new:nnnn { xtemplate } { key-no-variable }
{ The~key~'#1'~requires~implementation~details~\msg_line_context:. }
{
- When~creating~template~code~using~
- \token_to_str:N \DeclareTemplateCode,\\
+ When~creating~template~code~using~\DeclareTemplateCode,\\
each~key~name~must~have~an~associated~implementation.\\
This~should~be~given~after~a~'='~sign:~I~did~not~find~one.
}
\msg_kernel_new:nnnn { xtemplate } { key-not-implemented }
{ Key~'#1'~has~no~implementation~\msg_line_context:. }
{
- The~definition~of key implementations~for~template~'#2'\\
+ The~definition~of~key~implementations~for~template~'#2'\\
of~object~type~'#3'~does not~include~any~details~for~key~'#1'.\\
- The~key was declared~in~the~interface definition,\\
+ The~key~was~declared~in~the~interface~definition,\\
and~so~an~implementation~is~required.
}
\msg_kernel_new:nnnn { xtemplate } { keytype-requires-argument }
{ The~keytype~'#1'~requires~an~argument~\msg_line_context:. }
{
You~should~have~put:\\
- \c_space_tl \c_space_tl <key-name>~:~#1
+ \c_space_tl \c_space_tl <key-name>~:~#1~
\token_to_str:N {~<argument>~\token_to_str:N } \\
but~I~did~not~find~an~<argument>.
}
@@ -3119,21 +3118,17 @@
or~has~no~implementation.
}
{
- You~need~to~declare~a~templat~with
- \token_to_str:N \DeclareTemplateInterface \\
- and~its~code~with
- \token_to_str:N \DeclareTemplateCode \c_space_tl
- prior~to~using~it.
+ You~need~to~declare~a~template~with~\DeclareTemplateInterface \\
+ and~its~code~with~\DeclareTemplateCode prior~to~using~it.
}
\msg_kernel_new:nnnn { xtemplate } { type-mismatch }
{ Object~types~'#1'~and~'#2'~do~not~agree. }
{
- You~are~trying~to~use~a~template~directly~with
- \token_to_str:N \UseInstance \\
+ You~are~trying~to~use~a~template~directly~with~\UseInstance \\
(or~a~similar~function),~but~the~object~types~do~not~match.
}
\msg_kernel_new:nnnn { xtemplate } { undeclared-variable }
- {The~variable~#1~has~not~been~declared. }
+ { The~variable~#1~has~not~been~declared. }
{
Before~declaring~an~instance,~all~of~the~required~variables\\
used~in~template~keys~must~be~created.
@@ -3149,13 +3144,13 @@
\msg_kernel_new:nnnn { xtemplate } { unknown-choice }
{ The~choice~'#1'~was~not~declared~for~key~'#2'~\msg_line_context:. }
{
- The~key '#2'~takes~a~fixed~number~of~choices:\\
+ The~key~'#2'~takes~a~fixed~number~of~choices:\\
\clist_map_function:NN #3 \xtemplate_unknown_choice_aux:n
and~this~list~does~not~include~'#1'.
}
\cs_new:Npn \xtemplate_unknown_choice_aux:n #1 { -~ #1 ;\\}
\msg_kernel_new:nnnn { xtemplate } { unknown-keytype }
- { The~keytype '#1'~is~unknown~\msg_line_context:. }
+ { The~keytype~'#1'~is~unknown~\msg_line_context:. }
{
Valid~keytypes~are:\\
-~boolean;\\
@@ -3170,11 +3165,10 @@
-~tokenlist.
}
\msg_kernel_new:nnnn { xtemplate } { unknown-object-type }
- { The ~object~type~'#1'~is~unknown~\msg_line_context:. }
+ { The~object~type~'#1'~is~unknown~\msg_line_context:. }
{
- An~object~type~needs~to~be~declared~with
- \token_to_str:N \DeclareObjectType \c_space_tl
- prior~to~using~it.
+ An~object~type~needs~to~be~declared~with~
+ \DeclareObjectType prior~to~using~it.
}
\msg_kernel_new:nnnn { xtemplate } { unknown-instance }
{ The~instance~'#2'~of~type~'#1'~is~unknown. }