summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-11-14 21:07:53 +0000
committerKarl Berry <karl@freefriends.org>2017-11-14 21:07:53 +0000
commit8c82df0007c957004cc2268b49ccf3ceca914f58 (patch)
treeae29044a1727ceb31a488437f43cde1a31e6e007 /Master/texmf-dist/source/latex/l3kernel/l3tl.dtx
parent4bd2a337b834181c967e774caddf57b3f747e127 (diff)
l3 (14nov17)
git-svn-id: svn://tug.org/texlive/trunk@45802 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3tl.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3tl.dtx86
1 files changed, 78 insertions, 8 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx
index 4613e18fda0..5da866311bb 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx
@@ -41,7 +41,7 @@
% }^^A
% }
%
-% \date{Released 2017/09/18}
+% \date{Released 2017/11/14}
%
% \maketitle
%
@@ -59,9 +59,9 @@
% \begin{verbatim}
% \foo:N \l_some_tl
% \end{verbatim}
-% In both cases, functions are available to test an manipulate the lists
+% In both cases, functions are available to test and manipulate the lists
% of tokens, and these have the module prefix \texttt{tl}.
-% In many cases, function which can be applied to token list variables
+% In many cases, functions which can be applied to token list variables
% are paired with similar functions for application to explicit lists
% of tokens: the two \enquote{views} of a token list are therefore collected
% together here.
@@ -433,6 +433,17 @@
% (begin-group) or $2$ (end-group), and tokens with category code $6$).
% \end{function}
%
+% \begin{function}[added = 2017-11-14, EXP,pTF]{\tl_if_novalue:n}
+% \begin{syntax}
+% \cs{tl_if_novalue_p:n} \Arg{token list}
+% \cs{tl_if_novalue:nTF} \Arg{token list} \Arg{true code} \Arg{false code}
+% \end{syntax}
+% Tests if the \meta{token list} is exactly equal to the special
+% \cs{c_novalue_tl} marker. This function is indented to allow construction
+% of flexible document interface structures in which missing optional
+% arguments are detected.
+% \end{function}
+%
% \begin{function}[updated = 2011-08-13, EXP,pTF]
% {\tl_if_single:N, \tl_if_single:c}
% \begin{syntax}
@@ -498,7 +509,7 @@
%
% \begin{function}[updated = 2012-06-29, rEXP]{\tl_map_function:nN}
% \begin{syntax}
-% \cs{tl_map_function:nN} \meta{token list} \meta{function}
+% \cs{tl_map_function:nN} \Arg{token list} \meta{function}
% \end{syntax}
% Applies \meta{function} to every \meta{item} in the \meta{token list},
% The \meta{function} receives one argument for each iteration.
@@ -520,7 +531,7 @@
%
% \begin{function}[updated = 2012-06-29]{\tl_map_inline:nn}
% \begin{syntax}
-% \cs{tl_map_inline:nn} \meta{token list} \Arg{inline function}
+% \cs{tl_map_inline:nn} \Arg{token list} \Arg{inline function}
% \end{syntax}
% Applies the \meta{inline function} to every \meta{item} stored within the
% \meta{token list}. The \meta{inline function} should consist of code which
@@ -542,7 +553,7 @@
%
% \begin{function}[updated = 2012-06-29]{\tl_map_variable:nNn}
% \begin{syntax}
-% \cs{tl_map_variable:nNn} \meta{token list} \meta{variable} \Arg{function}
+% \cs{tl_map_variable:nNn} \Arg{token list} \meta{variable} \Arg{function}
% \end{syntax}
% Applies the \meta{function} to every \meta{item} stored
% within the \meta{token list}. The \meta{function} should consist of code
@@ -1003,7 +1014,7 @@
%
% \begin{function}[updated = 2015-08-07]{\tl_show:n}
% \begin{syntax}
-% \cs{tl_show:n} \meta{token list}
+% \cs{tl_show:n} \Arg{token list}
% \end{syntax}
% Displays the \meta{token list} on the terminal.
% \begin{texnote}
@@ -1034,6 +1045,21 @@
% Constant that is always empty.
% \end{variable}
%
+% \begin{variable}[added = 2017-11-14]{\c_novalue_tl}
+% A marker for the absence of an argument. This constant |tl| can safely
+% be typeset (\emph{cf.}~|\q_nil|), with the result being |-NoValue-|.
+% It is important to note that \cs{c_novalue_tl} is constructed such that it
+% will \emph{not} match the simple text input |-NoValue-|, \emph{i.e.}
+% that
+% \begin{verbatim}
+% \tl_if_eq:VnTF \c_novalue_tl { -NoValue- }
+% \end{verbatim}
+% is logically \texttt{false}. The \cs{c_novalue_tl} marker is intended for
+% use in creating document-level interfaces, where it serves as an indicator
+% that an (optional) argument was omitted. In particular, it is distinct
+% from a simple empty |tl|.
+% \end{variable}
+%
% \begin{variable}{\c_space_tl}
% An explicit space character contained in a token list (compare this with
% \cs{c_space_token}). For use where an explicit space is required.
@@ -1227,6 +1253,22 @@
% \end{macrocode}
% \end{variable}
%
+% \begin{variable}{\c_novalue_tl}
+% A special marker: as we don't have |\char_generate:nn| yet, has to be
+% created the old-fashioned way.
+% \begin{macrocode}
+\group_begin:
+\tex_lccode:D `A = `-
+\tex_lccode:D `N = `N
+\tex_lccode:D `V = `V
+\tex_lowercase:D
+ {
+ \group_end:
+ \tl_const:Nn \c_novalue_tl { ANoValue- }
+ }
+% \end{macrocode}
+% \end{variable}
+%
% \begin{variable}{\c_space_tl}
% A space as a token list (as opposed to as a character).
% \begin{macrocode}
@@ -2035,6 +2077,33 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[TF, EXP]{\tl_if_novalue:n}
+% \begin{macro}[EXP, aux]{\@@_if_novalue:w}
+% Tests for |-NoValue-|: this is similar to \cs{tl_if_in:nn} but set
+% up to be expandable and to check the value exactly. The question
+% mark prevents the auxiliary from losing braces.
+% \begin{macrocode}
+\use:x
+ {
+ \prg_new_conditional:Npnn \exp_not:N \tl_if_novalue:n ##1
+ { T , F , TF }
+ {
+ \exp_not:N \str_if_eq:onTF
+ {
+ \exp_not:N \@@_if_novalue:w ? ##1 { }
+ \c_novalue_tl
+ }
+ { ? { } \c_novalue_tl }
+ { \exp_not:N \prg_return_true: }
+ { \exp_not:N \prg_return_false: }
+ }
+ \cs_new:Npn \exp_not:N \@@_if_novalue:w ##1 \c_novalue_tl
+ {##1}
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}[EXP,pTF]{\tl_if_single:N}
% Expand the token list and feed it to \cs{tl_if_single:n}.
% \begin{macrocode}
@@ -2328,7 +2397,7 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\tl_trim_spaces:n}
+% \begin{macro}{\tl_trim_spaces:n, \tl_trim_spaces:o}
% \begin{macro}
% {
% \tl_trim_spaces:N, \tl_trim_spaces:c,
@@ -2344,6 +2413,7 @@
% \begin{macrocode}
\cs_new:Npn \tl_trim_spaces:n #1
{ \@@_trim_spaces:nn { \q_mark #1 } \exp_not:o }
+\cs_generate_variant:Nn \tl_trim_spaces:n { o }
\cs_new_protected:Npn \tl_trim_spaces:N #1
{ \tl_set:Nx #1 { \exp_args:No \tl_trim_spaces:n {#1} } }
\cs_new_protected:Npn \tl_gtrim_spaces:N #1