diff options
author | Karl Berry <karl@freefriends.org> | 2022-05-30 20:10:02 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-05-30 20:10:02 +0000 |
commit | 1404d03626d57bc9fd3aa74a865f568cd012147d (patch) | |
tree | 9f25fddf02633086bb1abcec931158caef3de88a /Master/texmf-dist/source/latex | |
parent | da9bc017d4130a58cac734e8cc9ef615cc1a2961 (diff) |
l3 (30may22)
git-svn-id: svn://tug.org/texlive/trunk@63449 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
61 files changed, 394 insertions, 233 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index 03ed15fff05..7409587c2a4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -24,7 +24,7 @@ % %<*driver|generic|package|2ekernel> %</driver|generic|package|2ekernel> -\def\ExplFileDate{2022-05-04}% +\def\ExplFileDate{2022-05-30}% %<*driver> \documentclass[full]{l3doc} \usepackage{graphicx} @@ -51,7 +51,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 98a85864004..8f061840318 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx index 327ded99077..0119949aefb 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index 4fce9d40102..44fd741e4c8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx index 44a583297c3..ec2647278eb 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3cctab.dtx b/Master/texmf-dist/source/latex/l3kernel/l3cctab.dtx index 5ccace56c91..e2e75115945 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3cctab.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3cctab.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index 02090d75ae8..7dfea946bca 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index 0175afca38a..b2b27f3a3f7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3color.dtx b/Master/texmf-dist/source/latex/l3kernel/l3color.dtx index efafd42c6b3..b31bd71f120 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3color.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3color.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3debug.dtx b/Master/texmf-dist/source/latex/l3kernel/l3debug.dtx index 4cc21ba16d0..e8c3affaf9d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3debug.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3debug.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx index f12a893d16f..b0ffac2fd79 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index 8594547d584..ebe85ac66cf 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -85,7 +85,7 @@ and all files in that bundle must be distributed together. % require you to do updates, if the class changes.}} % % \author{\Team} -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % \maketitle % \tableofcontents % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx index 4c62ab9613f..81a9e592bad 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx index 1ae9a6b1d97..ed52ef0c7d7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index 790f2ee6549..1cc76bfe248 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx index f7394dbee19..29ec1e1fe06 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx index 7d44c73d766..43619e1d5fa 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx index b9b714b4df2..0e8d54af58e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx index 888050ee936..a6bf25bbf10 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx index 43fff051200..fe4db6c6211 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx index aad962fbd68..ad8e96156cd 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx index ca7c6482ae8..8ce504bdfa3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx index 300b3193361..d5246b8e6d5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx index d4df6a8ac6b..ce980f4de07 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx index a90a201cef2..7e042850dc8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx index 04635ccdb29..56aec6e4f33 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx index af02bf955b7..47c205a9feb 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx index cdfed0da5dd..6e112628e25 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 23c6e42feb9..1850413f0c8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -49,7 +49,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx index 8fc0951c060..a68e2bbdafd 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index 96dc4d14b86..4bfe4cf0d42 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx b/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx index 3b29c4b6efe..f3bdd99991f 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx b/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx index 3157f8abbfd..5d258e39c1a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index 5fa2ae2e428..7a863bc893d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3legacy.dtx b/Master/texmf-dist/source/latex/l3kernel/l3legacy.dtx index ae1c4f1f5e3..35d37e87454 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3legacy.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3legacy.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx index 914c389e0a9..8f8922dbb91 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % @@ -115,6 +115,24 @@ % \end{texnote} % \end{function} % +% \begin{function}[added = 2022-05-14]{\lua_load_module:n} +% \begin{syntax} +% \cs{lua_load_module:n} \Arg{Lua module name} +% \end{syntax} +% Loads a Lua module into the Lua interpreter. +% +% \cs{lua_now:n} passes its \Arg{token list} argument to the Lua interpreter +% as a single line, with characters interpreted under the current catcode +% regime. These two facts mean that \cs{lua_now:n} rarely behaves as expected +% for larger pieces of code. Therefore, package authors should \textbf{not} +% write significant amounts of Lua code in the arguments to \cs{lua_now:n}. +% Instead, it is strongly recommended that they write the majorty of their Lua +% code in a separate file, and then load it using \cs{lua_load_module:n}. +% \begin{texnote} +% This is a wrapper around the Lua call |require '|\meta{module}|'|. +% \end{texnote} +% \end{function} +% % \section{Lua interfaces} % % As well as interfaces for \TeX{}, there are a small number of Lua functions @@ -208,9 +226,7 @@ % \begin{macro}[EXP]{\lua_now:n, \lua_now:e} % \begin{macro}{\lua_shipout_e:n, \lua_shipout:n} % \begin{macro}[EXP]{\lua_escape:n, \lua_escape:e} -% Wrappers around the primitives. As with engines other than \LuaTeX{} -% these have to be macros, we give them the same status in all cases. -% When \LuaTeX{} is not in use, simply give an error message/ +% Wrappers around the primitives. % \begin{macrocode} \cs_new:Npn \lua_now:e #1 { \@@_now:n {#1} } \cs_new:Npn \lua_now:n #1 { \lua_now:e { \exp_not:n {#1} } } @@ -219,6 +235,31 @@ { \lua_shipout_e:n { \exp_not:n {#1} } } \cs_new:Npn \lua_escape:e #1 { \@@_escape:n {#1} } \cs_new:Npn \lua_escape:n #1 { \lua_escape:e { \exp_not:n {#1} } } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\lua_load_module:n} +% Wrapper around |require'|\meta{module}|'|. +% \begin{macrocode} +\str_new:N \l_@@_err_msg_str +\cs_generate_variant:Nn \msg_error:nnnn { nnnV } +\cs_new_protected:Npn \lua_load_module:n #1 + { + \bool_if:nF { \@@_load_module_p:n { #1 } } + { + \msg_error:nnnV + { luatex } { module-not-found } { #1 } { \l_@@_err_msg_str } + } + } +% \end{macrocode} +% \end{macro} +% +% As with engines other than \LuaTeX{} +% these have to be macros, we give them the same status in all cases. +% When \LuaTeX{} is not in use, simply give an error message/ +% \begin{macrocode} \sys_if_engine_luatex:F { \clist_map_inline:nn @@ -234,7 +275,7 @@ } } \clist_map_inline:nn - { \lua_shipout_e:n , \lua_shipout:n } + { \lua_shipout_e:n , \lua_shipout:n, \lua_load_module:n } { \cs_set_protected:Npn #1 ##1 { @@ -244,10 +285,6 @@ } } % \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% % \subsection{Messages} % % \begin{macrocode} @@ -257,6 +294,19 @@ The~feature~you~are~using~is~only~available~ with~the~LuaTeX~engine.~LaTeX3~ignored~'#1'. } + +\msg_new:nnnn { luatex } { module-not-found } + { Lua~module~`#1'~not~found. } + { + The~file~`#1.lua'~could~not~be~found.~Please~ensure~ + that~the~file~was~properly~installed~and~that~the~ + filename~database~is~current. \\ \\ + The~Lua~loader~provided~this~additional~information: \\ + #2 + } + +\prop_gput:Nnn \g_msg_module_name_prop { luatex } { LaTeX3 } +\prop_gput:Nnn \g_msg_module_type_prop { luatex } { } % \end{macrocode} % % \begin{macrocode} @@ -311,6 +361,9 @@ local cprint = tex.cprint local write = tex.write local write_nl = texio.write_nl local utf8_char = utf8.char +local package_loaded = package.loaded +local package_searchers = package.searchers +local table_concat = table.concat local scan_int = token.scan_int or token.scan_integer local scan_string = token.scan_string @@ -318,6 +371,7 @@ local scan_keyword = token.scan_keyword local put_next = token.put_next local token_create = token.create local token_new = token.new +local set_macro = token.set_macro % \end{macrocode} % % Since token.create only returns useful values after the tokens @@ -554,6 +608,57 @@ end % \end{macrocode} % \end{macro} % +% \begin{macro}[int]{try_require} +% Loads a Lua module. This function loads the module similarly to the standard +% Lua global function |require|, with a few differences. On success, +% |try_require| returns |true, module|. If the module cannot be found, it +% returns |false, err_msg|. If the module is found, but something goes wrong +% when loading it, the function throws an error. +% \begin{macrocode} +local function try_require(name) + if package_loaded[name] then + return true, package_loaded[name] + end + + local failure_details = {} + for _, searcher in ipairs(package_searchers) do + local loader, data = searcher(name) + if type(loader) == 'function' then + package_loaded[name] = loader(name, data) or true + return true, package_loaded[name] + elseif type(loader) == 'string' then + failure_details[#failure_details + 1] = loader + end + end + + return false, table_concat(failure_details, '\n') +end +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_module_p:n} +% Check to see if we can load a module using |require|. If we +% can load the module, then we load it immediately. Otherwise, we save the +% error message in |\l_@@_err_msg_str|. +% \begin{macrocode} +local char_given = command_id'char_given' +local c_true_bool = token_create(1, char_given) +local c_false_bool = token_create(0, char_given) +local c_str_cctab = token_create('c_str_cctab').mode + +luacmd('@@_load_module_p:n', function() + local success, result = try_require(scan_string()) + if success then + set_macro(c_str_cctab, 'l_@@_err_msg_str', '') + put_next(c_true_bool) + else + set_macro(c_str_cctab, 'l_@@_err_msg_str', result) + put_next(c_false_bool) + end +end) +% \end{macrocode} +% \end{macro} +% % \subsection{Preserving iniTeX Lua data for runs} % % \begin{macrocode} @@ -595,7 +700,7 @@ if luatexbase then end % \end{macrocode} % \end{macro} -% +% % The actual work is done in \texttt{pre_dump}. The \texttt{luadata_order} is used % to ensure that the order is consistent over multiple runs. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index 7dbe45171e6..e23de3a563b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index 948b64119c0..0f4c3f26726 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3pdf.dtx b/Master/texmf-dist/source/latex/l3kernel/l3pdf.dtx index ede34ba6f8b..8c95bdc132b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3pdf.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3pdf.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index d55f9b81d65..72da59c926c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index 5f59356660c..304ab640aa9 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx index d0d4d37b20c..b3286b9679c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx index 02f48cf6c3a..80a654c8a6f 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index dfb37ba8ecc..0fcb2cc4300 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index 498f94f231e..62d0aa1b0d9 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx index 455cbe95337..32b63918eb8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str-convert.dtx index 8e0b77cb241..96560ddeaa1 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3str-convert.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3str-convert.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx index 1070c6e7f66..1582d42043a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % @@ -1234,12 +1234,12 @@ \cs_new:Npn \@@_case:nnTF #1#2#3#4 { \@@_case:nw {#1} #2 {#1} { } \s_@@_mark {#3} \s_@@_mark {#4} \s_@@_stop } \cs_generate_variant:Nn \str_case:nn { V , o , nV , nv } +\prg_generate_conditional_variant:Nnn \str_case:nn + { V , o , nV , nv } { T , F , TF } \cs_new_eq:NN \str_case:Nn \str_case:Vn \cs_new_eq:NN \str_case:NnT \str_case:VnT \cs_new_eq:NN \str_case:NnF \str_case:VnF \cs_new_eq:NN \str_case:NnTF \str_case:VnTF -\prg_generate_conditional_variant:Nnn \str_case:nn - { V , o , nV , nv } { T , F , TF } \cs_new:Npn \@@_case:nw #1#2#3 { \str_if_eq:nnTF {#1} {#2} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx index e5084eb0fc7..c076db18476 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3text-case.dtx b/Master/texmf-dist/source/latex/l3kernel/l3text-case.dtx index f236813b896..155bcd5bd05 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3text-case.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3text-case.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % @@ -1301,7 +1301,7 @@ \cs_new:cpn { @@_change_case_upper_hy-x-yiwn:nnnN } #1#2#3#4 { \@@_change_case_char:nnnN {#1} {#2} {#3} #4 } \cs_new_eq:cc { @@_change_case_title_hy-x-yiwn:nnnN } - { @@_change_case_upper_hy-x-yiwm:nnnN } + { @@_change_case_upper_hy-x-yiwn:nnnN } } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3text-purify.dtx b/Master/texmf-dist/source/latex/l3kernel/l3text-purify.dtx index bcdf6097a31..7cb9ed598c4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3text-purify.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3text-purify.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3text.dtx b/Master/texmf-dist/source/latex/l3kernel/l3text.dtx index cea1966accc..090ed994299 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3text.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3text.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx index 4878c898da4..eca3716316d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index 80631768633..578cc9e60e0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index 2181a732fbd..d42837f0223 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx b/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx index d0e08495419..9448e591a23 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2022-05-04} +% \date{Released 2022-05-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx index 675b914f444..8ff82d96bf9 100644 --- a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx +++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx @@ -62,7 +62,7 @@ % }^^A % } % -% \date{Released 2022-01-12} +% \date{Released 2022-05-30} % % \maketitle % @@ -139,7 +139,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{l3keys2e}{2022-01-12}{} +\ProvidesExplPackage{l3keys2e}{2022-05-30}{} {LaTeX2e option processing using LaTeX3 keys} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx b/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx index 5863f1579d6..631c3976b58 100644 --- a/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2022-01-12} +% \date{Released 2022-05-30} % % \maketitle % @@ -171,7 +171,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xfp}{2022-01-12}{} +\ProvidesExplPackage{xfp}{2022-05-30}{} {L3 Floating point unit} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx index 4fb469ae595..9694a1abb46 100644 --- a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % %% File: xfrac.dtx -% +% % Copyright (C) 2004,2008-2010 Morten Hoegholm % (C) 2011,2012,2014-2022 The LaTeX Project % @@ -65,7 +65,7 @@ % }^^A % } % -% \date{Released 2022-01-12} +% \date{Released 2022-05-30} % % \maketitle % @@ -535,7 +535,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xfrac}{2022-01-12}{} +\ProvidesExplPackage{xfrac}{2022-05-30}{} {L3 Experimental split-level fractions} % \end{macrocode} % @@ -781,7 +781,6 @@ % whether the surroundings are text or math(s), and react accordingly. % \begin{macrocode} { - \AssignTemplateKeys \mode_if_math:TF { \cs_set_eq:NN \@@_text_or_math:n \text diff --git a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx index 03243ec0e25..d1a8872fd79 100644 --- a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx @@ -67,7 +67,7 @@ % }^^A % } % -% \date{Released 2022-01-12} +% \date{Released 2022-05-30} % % \maketitle % @@ -1064,7 +1064,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xparse}{2022-01-12}{} +\ProvidesExplPackage{xparse}{2022-05-30}{} {L3 Experimental document command parser} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx index 987e20b6dda..6dd4e2edfdd 100644 --- a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2022-01-12} +% \date{Released 2022-05-30} % % \maketitle % @@ -358,22 +358,12 @@ % \cs{AssignTemplateKeys} % \end{syntax} % In the final argument of \cs{DeclareTemplateCode} the assignment of -% keys defined by the template is carried out by using the function -% \cs{AssignTemplateKeys}. Thus no keys are assigned if this is missing -% from the \meta{code} used. -% \end{function} -% -% \begin{function}{\EvaluateNow} -% \begin{syntax} -% \cs{EvaluateNow} \Arg{expression} -% \end{syntax} -% The standard method when creating an instance from a template is to -% evaluate the \meta{expression} when the instance is used. However, it may -% be desirable to calculate the value when declared, which can be -% forced using \cs{EvaluateNow}. Currently, this functionality is -% regarded as experimental: the team have not found an example where it -% is actually needed, and so it may be dropped \emph{if} no good -% examples are suggested! +% keys defined by the template may be delayed by including the command +% \cs{AssignTemplateKeys}. If this is \emph{not} present, keys are assigned +% immediately before the template code. If \cs{AssignTemplateKeys} is +% present, assignment is delayed until this point. Note that the +% command must be \emph{directly} present in the code, not placed +% within a nested command/macro. % \end{function} % % \section{Multiple choices} @@ -587,6 +577,40 @@ % be changed when creating an instance. % \end{function} % +% \section{\emph{Ad hoc} adjustment of templates} +% +% \begin{function}{\SetTemplateKeys} +% \begin{syntax} +% \cs{SetTemplateKeys} \Arg{object type} \Arg{template} \Arg{keyvals} +% \end{syntax} +% At point of use it may be useful to apply changed to individual instances. +% This is supported as each template key is made available for adjustment +% using \cs{SetTemplateKeys}. +% \end{function} +% +% For example, after +% \begin{verbatim} +% \DeclareObjectType{MyObj}{0} +% \DeclareTemplateInterface{MyObj}{TemplateA}{0} +% { +% akey: tokenlist , +% bkey: function{2} +% } +% \DeclareTemplateCode{MyObj}{TemplateA}{0} +% { +% akey = SomeTokens , +% bkey = \func:nn , +% } +% \end{verbatim} +% the template keys could be adjusted in an \emph{ad hoc} fashion using +% \begin{verbatim} +% \SetTemplateKeys{MyObj}{TemplateA} +% { +% akey = OtherTokens , +% bkey = \AltFunc:nn +% } +% \end{verbatim} +% % \section{Getting information about templates and instances} % % \begin{function}{\ShowInstanceValues} @@ -682,10 +706,15 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xtemplate}{2022-01-12}{} +\ProvidesExplPackage{xtemplate}{2022-05-30}{} {L3 Experimental prototype document functions} % \end{macrocode} % +% \begin{macrocode} +\cs_generate_variant:Nn \keys_define:nn { nx } +\cs_generate_variant:Nn \tl_trim_spaces:n { e } +% \end{macrocode} +% % \subsection{Variables and constants} % % \begin{variable}{\c_@@_code_root_tl} @@ -979,8 +1008,7 @@ % \end{macro} % % \begin{macro}[TF]{\@@_if_key_value:n, \@@_if_key_value:o} -% Tests for the first token in a string being \cs{KeyValue}, where -% \cs{EvaluateNow} is not important. +% Tests for the first token in a string being \cs{KeyValue}. % \begin{macrocode} \prg_new_conditional:Npnn \@@_if_key_value:n #1 { T , F , TF } { @@ -994,18 +1022,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_if_eval_now:nTF} -% Tests for the first token in a string being \cs{EvaluateNow}. -% \begin{macrocode} -\prg_new_conditional:Npnn \@@_if_eval_now:n #1 { TF } - { - \str_if_eq:noTF { \EvaluateNow } { \tl_head:w #1 \q_nil \q_stop } - { \prg_return_true: } - { \prg_return_false: } - } -% \end{macrocode} -% \end{macro} -% % \begin{macro}[TF]{\@@_if_instance_exist:nnn} % Testing for an instance is collection dependent. % \begin{macrocode} @@ -1305,8 +1321,8 @@ % \begin{macro}{\@@_split_keytype:n} % \begin{macro}{\@@_split_keytype_aux:w} % The keytype and key name should be separated by |:|. As the -% definition might be given inside or outside of a code block, spaces -% are removed and the category code of colons is standardised. After +% definition might be given inside or outside of a code block, +% the category code of colons is standardised. After % that, the standard delimited argument method is used to separate the % two parts. % \begin{macrocode} @@ -1314,7 +1330,6 @@ { \exp_not:N \bool_set_false:N \exp_not:N \l_@@_error_bool \tl_set:Nn \exp_not:N \l_@@_tmp_tl {#1} - \tl_remove_all:Nn \exp_not:N \l_@@_tmp_tl { ~ } \tl_replace_all:Nnn \exp_not:N \l_@@_tmp_tl { : } { \token_to_str:N : } \tl_if_in:onTF \exp_not:N \l_@@_tmp_tl { \token_to_str:N : } { @@ -1336,7 +1351,10 @@ ##1 \token_to_str:N : ##2 \s_@@_stop { \tl_put_right:Nx \exp_not:N \l_@@_key_name_tl - { \exp_not:N \tl_to_str:n {##1} } + { + \exp_not:N \tl_trim_spaces:e + { \exp_not:N \tl_to_str:n {##1} } + } \tl_if_in:nnTF {##2} { \token_to_str:N : } { \tl_put_right:Nn \exp_not:N \l_@@_key_name_tl @@ -1419,30 +1437,9 @@ % value to be processed and potentially stored. % % \begin{macro}{\@@_store_value_boolean:n} -% Storing Boolean values requires a test for delayed evaluation, but -% is different to the various numerical variable types as there are -% only two possible values to store. So the code here tests the default -% switch and then records the meaning (either \texttt{true} or -% \texttt{false}). % \begin{macrocode} \cs_new_protected:Npn \@@_store_value_boolean:n #1 - { - \@@_if_eval_now:nTF {#1} - { - \bool_if:cTF { c_ #1 _bool } - { - \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl - { true } - } - { - \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl - { false } - } - } - { - \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#1} - } - } + { \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#1} } % \end{macrocode} % \end{macro} % @@ -1464,17 +1461,9 @@ % \@@_store_value_real:n, \@@_store_value_skip:n, % \@@_store_value_tokenlist:n, \@@_store_value_commalist:n} % Storing values in \cs{l_@@_values_prop} is in most cases the same. -% If evaluation is taking place now, one \texttt{x}-expands an -% evaluation function and the result is then stored. On the other -% hand, if evaluation is delayed the current data is simply stored -% \enquote{as is}. % \begin{macrocode} \cs_new_protected:Npn \@@_store_value_aux:Nn #1#2 - { - \@@_if_eval_now:nTF {#2} - { \prop_put:NVx \l_@@_values_prop \l_@@_key_name_tl { #1 {#2} } } - { \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#2} } - } + { \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#2} } \cs_new_protected:Npn \@@_store_value_integer:n { \@@_store_value_aux:Nn \int_eval:n } \cs_new_protected:Npn \@@_store_value_length:n @@ -1494,6 +1483,7 @@ % \subsection{Implementation part of template declaration} % % \begin{macro}{\@@_declare_template_code:nnnnn} +% \begin{macro}{\@@_declare_template_code:nnn} % The main function for implementing a template starts with a couple of % simple checks to make sure that there are no obvious mistakes: the % number of arguments must agree and the template keys must have been @@ -1508,15 +1498,25 @@ \@@_if_keys_exist:nnT {#1} {#2} { \@@_store_key_implementation:nnn {#1} {#2} {#4} - \cs_generate_from_arg_count:cNnn - { \c_@@_code_root_tl #1 / #2 } - \cs_gset_protected:Npn {#3} {#5} + \regex_match:nnTF { \c { AssignTemplateKeys } } {#5} + { \@@_declare_template_code:nnn { #1 / #2 } {#3} {#5} } + { + \@@_declare_template_code:nnn + { #1 / #2 } {#3} { \AssignTemplateKeys #5 } + } } } } } +\cs_new_protected:Npn \@@_declare_template_code:nnn #1#2#3 + { + \cs_generate_from_arg_count:cNnn + { \c_@@_code_root_tl #1 } + \cs_gset_protected:Npn {#2} {#3} + } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\@@_store_key_implementation:nnn} % Actually storing the implementation part of a template is quite easy @@ -1532,8 +1532,8 @@ \@@_recover_restrictions:n { #1 / #2 } \@@_recover_keytypes:n { #1 / #2 } \prop_clear:N \l_@@_vars_prop - \keyval_parse:NNn - \@@_parse_vars_elt:n \@@_parse_vars_elt:nn {#3} + \keyval_parse:nnn + { \@@_parse_vars_elt:n } { \@@_parse_vars_elt:nnn { #1 / #2 } } {#3} \@@_store_vars:n { #1 / #2 } \@@_store_restrictions:n { #1 / #2 } \prop_map_inline:Nn \l_@@_keytypes_prop @@ -1554,125 +1554,162 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_parse_vars_elt:nn} +% \begin{macro}{\@@_parse_vars_elt:nnn} % The actual storage part here is very simple: the storage bin name % is placed into the property list. At the same time, a comparison is % made with the keytypes defined earlier: if there is a mismatch then % an error is raised. % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_vars_elt:nn #1#2 +\cs_new_protected:Npn \@@_parse_vars_elt:nnn #1#2#3 { - \tl_set:Nx \l_@@_key_name_tl { \tl_to_str:n {#1} } - \tl_remove_all:Nn \l_@@_key_name_tl { ~ } + \tl_set:Nx \l_@@_key_name_tl + { \tl_trim_spaces:e { \tl_to_str:n {#2} } } \prop_get:NoNTF \l_@@_keytypes_prop \l_@@_key_name_tl \l_@@_keytype_tl { \@@_split_keytype_arg:o \l_@@_keytype_tl - \@@_parse_vars_elt_aux:n {#2} + \@@_parse_vars_elt_aux:nn {#1} {#3} \prop_remove:NV \l_@@_keytypes_prop \l_@@_key_name_tl } - { \msg_error:nnx { xtemplate } { unknown-key } {#1} } + { \msg_error:nnx { xtemplate } { unknown-key } {#2} } } % \end{macrocode} % \end{macro} -% \begin{macro}{\@@_parse_vars_elt_aux:n} -% \begin{macro}{\@@_parse_vars_elt_aux:w} -% There now needs to be some sanity checking on the variable name -% given. This does not apply for \texttt{choice} or -% \texttt{code} \enquote{variables}, but in all other cases the variable -% needs to exist. Also, the only prefix acceptable is \texttt{global}. So -% there are a few related checks to make. +% \begin{macro}{\@@_parse_vars_elt_aux:nn} +% \begin{macro}{\@@_parse_vars_elt_aux:nw} +% \begin{macro}{\@@_parse_vars_elt_aux:nnn} +% \begin{macro}{\@@_parse_vars_elt_key:nn} +% Split off any leading \texttt{global} and they look for the way to +% implement. % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_vars_elt_aux:n #1 +\cs_new_protected:Npn \@@_parse_vars_elt_aux:nn #1#2 + { + \@@_parse_vars_elt_aux:nw {#1} #2 global global \s_@@_stop + } +\cs_new_protected:Npn \@@_parse_vars_elt_aux:nw + #1#2 global #3 global #4 \s_@@_stop + { + \tl_if_blank:nTF {#4} + { \@@_parse_vars_elt_aux:nnn {#1} { } {#2} } + { + \tl_if_blank:nTF {#2} + { + \exp_args:Nnnx \@@_parse_vars_elt_aux:nnn + {#1} { global } { \tl_trim_spaces:n {#3} } + } + { \msg_error:nnn { xtemplate } { bad-variable } { #2 global #3 } } + } + } +\cs_new_protected:Npn \@@_parse_vars_elt_aux:nnn #1#2#3 { - \str_if_eq:onTF \l_@@_keytype_tl { choice } - { \@@_implement_choices:n {#1} } + \str_case:VnF \l_@@_keytype_tl { - \str_if_eq:onTF \l_@@_keytype_tl { code } + { choice } { \@@_implement_choices:nn {#1} {#3} } + { code } { + \@@_parse_vars_elt_key:nn {#1} + { + .cs_ \str_if_eq:nnT {#1} { global } { g } + set_protected:Np = \exp_not:N #3 + } \prop_put:Non \l_@@_vars_prop - \l_@@_key_name_tl {#1} + \l_@@_key_name_tl {#2#3} } + { function } { - \tl_if_single:nTF {#1} + \cs_if_exist:NF #3 + { \cs_new:Npn #3 { } } + \@@_parse_vars_elt_key:nn {#1} { - \cs_if_exist:NF #1 - { \@@_create_variable:N #1 } - \prop_put:Non \l_@@_vars_prop - \l_@@_key_name_tl {#1} + .code:n = + { + \exp_not:c + { cs_ \str_if_eq:nnT {#1} { global } { g } seq_eq:NN } + \exp_not:N #3 ####1 + } } + \prop_put:Non \l_@@_vars_prop + \l_@@_key_name_tl {#2#3} + } + { instance } + { + \@@_parse_vars_elt_key:nn {#1} { - \tl_if_in:nnTF {#1} { global } - { \@@_parse_vars_elt_aux:w #1 \s_@@_stop } + .code:n = { - \msg_error:nnx { xtemplate } { bad-variable } - { \tl_to_str:n {#1} } + \exp_not:c + { cs_ \str_if_eq:nnT {#1} { global } { g } set:Npn } + \exp_not:N #3 { \UseInstance {####1} } } } + \prop_put:Non \l_@@_vars_prop + \l_@@_key_name_tl {#2#3} } } - } -\cs_new_protected:Npn \@@_parse_vars_elt_aux:w #1 global #2 \s_@@_stop - { - \tl_if_empty:nTF {#1} { - \tl_if_single:nTF {#2} + \tl_if_single:nTF {#3} { - \cs_if_exist:NF #2 - { \@@_create_variable:N #2 } + \cs_if_exist:NF #3 + { \use:c { \@@_map_var_type: _new:N } #3 } + \@@_parse_vars_elt_key:nn {#1} + { + . \@@_map_var_type: + _ \str_if_eq:nnT {#1} { global } { g } set:N + = \exp_not:N #3 + } \prop_put:Non \l_@@_vars_prop - \l_@@_key_name_tl { #1 global #2 } - } - { - \msg_error:nnx { xtemplate } { bad-variable } - { \tl_to_str:n { #1 global #2 } } + \l_@@_key_name_tl {#2#3} } + { \msg_error:nnx { xtemplate } { bad-variable } { #2#3 } } } - { - \msg_error:nnx { xtemplate } { bad-variable } - { \tl_to_str:n { #1 global #2 } } - } + } +\cs_new_protected:Npn \@@_parse_vars_elt_key:nn #1#2 + { + \keys_define:nx { template / #1 } + { \l_@@_key_name_tl #2 } } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % -% \begin{macro}{\@@_create_variable:N} -% A shortcut to create non-declared variables. Some types need a name -% mapping, others can be used directly. +% \begin{macro}[EXP]{\@@_map_var_type:} +% Turn a \enquote{friendly} variable type into an \texttt{expl3} one. % \begin{macrocode} -\cs_new_protected:Npn \@@_create_variable:N #1 +\cs_new:Npn \@@_map_var_type: { - \str_case:onF \l_@@_keytype_tl + \str_case:on \l_@@_keytype_tl { - { boolean } { \bool_new:N #1 } - { commalist } { \clist_new:N #1 } - { function } { \cs_new:Npn #1 { } } - { instance } { \cs_new_protected:Npn #1 { } } - { integer } { \int_new:N #1 } - { length } { \dim_new:N #1 } - { real } { \fp_new:N #1 } - { tokenlist } { \tl_new:N #1 } + { boolean } { bool } + { commalist } { clist } + { integer } { int } + { length } { dim } + { muskip } { muskip } + { real } { fp } + { skip } { skip } + { tokenlist } { tl } } - { \use:c { \l_@@_keytype_tl _ new:N } #1 } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_implement_choices:n} +% \begin{macro}{\@@_implement_choices:nn} % \begin{macro}{\@@_implement_choices_default:} % Implementing choices requires a second key--value loop. So after a % little set-up, the standard parser is called. % \begin{macrocode} -\cs_new_protected:Npn \@@_implement_choices:n #1 +\cs_new_protected:Npn \@@_implement_choices:nn #1#2 { \clist_set:No \l_@@_tmp_clist { \l_@@_keytype_arg_tl } \prop_put:Non \l_@@_vars_prop \l_@@_key_name_tl { } - \keyval_parse:NNn - \@@_implement_choice_elt:n \@@_implement_choice_elt:nn - {#1} + \keys_define:nx { template / #1 } { \l_@@_key_name_tl .choice: } + \keyval_parse:nnn + { \@@_implement_choice_elt:n } + { \@@_implement_choice_elt:nnn {#1} } + {#2} \prop_get:NoNT \l_@@_values_prop \l_@@_key_name_tl \l_@@_tmp_tl { \@@_implement_choices_default: } @@ -1714,47 +1751,57 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\@@_implement_choice_elt:nnn, \@@_implement_choice_elt_aux:nnn} % \begin{macro}{\@@_implement_choice_elt:n} -% \begin{macro}{\@@_implement_choice_elt:nn} % The actual storage of the implementation of a choice is mainly about % error checking. The code here ensures that all choices have to have % been declared, apart from the special \texttt{unknown} choice, which % must come last. The code for each choice is stored along with the % key name in the variables property list. % \begin{macrocode} -\cs_new_protected:Npn \@@_implement_choice_elt:n #1 +\cs_new_protected:Npn \@@_implement_choice_elt:nnn #1#2#3 { \clist_if_empty:NTF \l_@@_tmp_clist { - \str_if_eq:nnF {#1} { unknown } + \str_if_eq:nnTF {#2} { unknown } + { \@@_implement_choice_elt_aux:nnn {#1} {#2} {#3} } { \prop_get:NoN \l_@@_keytypes_prop \l_@@_key_name_tl \l_@@_tmp_tl \@@_split_keytype_arg:o \l_@@_tmp_tl \msg_error:nnxxx { xtemplate } { unknown-choice } - { \l_@@_key_name_tl } {#1} + { \l_@@_key_name_tl } {#2} { \l_@@_keytype_arg_tl } } } { - \clist_if_in:NnTF \l_@@_tmp_clist {#1} - { \clist_remove_all:Nn \l_@@_tmp_clist {#1} } + \clist_if_in:NnTF \l_@@_tmp_clist {#2} + { + \clist_remove_all:Nn \l_@@_tmp_clist {#2} + \@@_implement_choice_elt_aux:nnn {#1} {#2} {#3} + } { \prop_get:NoN \l_@@_keytypes_prop \l_@@_key_name_tl \l_@@_tmp_tl \@@_split_keytype_arg:o \l_@@_tmp_tl \msg_error:nnxxx { xtemplate } { unknown-choice } - { \l_@@_key_name_tl } {#1} + { \l_@@_key_name_tl } {#2} { \l_@@_keytype_arg_tl } } } } -\cs_new_protected:Npn \@@_implement_choice_elt:nn #1#2 +\cs_new_protected:Npn \@@_implement_choice_elt_aux:nnn #1#2#3 { - \@@_implement_choice_elt:n {#1} + \keys_define:nx { template / #1 } + { \l_@@_key_name_tl / #2 .code:n = { \exp_not:n {#3} } } \tl_set:Nx \l_@@_tmp_tl - { \l_@@_key_name_tl \c_space_tl #1 } - \prop_put:Non \l_@@_vars_prop \l_@@_tmp_tl {#2} + { \l_@@_key_name_tl \c_space_tl #2 } + \prop_put:Non \l_@@_vars_prop \l_@@_tmp_tl {#3} + } +\cs_new_protected:Npn \@@_implement_choice_elt:n #1 + { + \msg_error:nnxxx { xtemplate } { choice-requires-code } + { \l_@@_key_name_tl } {#1} } % \end{macrocode} % \end{macro} @@ -1849,8 +1896,8 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_parse_values_elt:nn #1#2 { - \tl_set:Nx \l_@@_key_name_tl { \tl_to_str:n {#1} } - \tl_remove_all:Nn \l_@@_key_name_tl { ~ } + \tl_set:Nx \l_@@_key_name_tl + { \tl_trim_spaces:e { \tl_to_str:n {#1} } } \prop_get:NoNTF \l_@@_keytypes_prop \l_@@_key_name_tl \l_@@_tmp_tl { @@ -2351,8 +2398,7 @@ { \exp_after:wN \@@_key_to_value_auxi:w \l_@@_value_tl } \cs_new_protected:Npn \@@_key_to_value_auxi:w \KeyValue #1 { - \tl_set:Nx \l_@@_tmp_tl { \tl_to_str:n {#1} } - \tl_remove_all:Nn \l_@@_key_name_tl { ~ } + \tl_set:Nx \l_@@_tmp_tl { \tl_trim_spaces:e { \tl_to_str:n {#1} } } \prop_get:NoNTF \l_@@_vars_prop \l_@@_tmp_tl @@ -2591,6 +2637,13 @@ each~choice~name~must~have~an~associated~implementation.\\ This~should~be~given~after~a~'='~sign:~LaTeX~did~not~find~one. } +\msg_new:nnnn { xtemplate } { choice-requires-code } + { The~choice~'#2'~for~key~'#1'~requires~an~implementation. } + { + You~should~have~put:\\ + \ \ #1~:~choice~{~#2 = <code> ~} \\ + but~LaTeX~did~not~find~any~<code>. + } \msg_new:nnnn { xtemplate } { duplicate-key-interface } { Key~'#1'~appears~twice~in~interface~definition~\msg_line_context:. } { @@ -2842,16 +2895,12 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\EvaluateNow} % \begin{macro}{\KeyValue} -% These are both do nothing functions. Both simply dump their arguments -% when executed: this should not happen with \cs{KeyValue}. +% Simply dump the argument when executed: this should not happen. % \begin{macrocode} -\cs_new_protected:Npn \EvaluateNow #1 {#1} \cs_new_protected:Npn \KeyValue #1 {#1} % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}{\AssignTemplateKeys} % A short call to use a token register by proxy. @@ -2861,6 +2910,14 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\SetTemplateKeys} +% A friendly wrapper +% \begin{macrocode} +\cs_new_protected:Npn \SetTemplateKeys #1#2#3 + { \keys_set:nn { template / #1 / #2 } {#3} } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} \cs_new_eq:NN \ShowTemplateKeytypes \ShowTemplateInterface % \end{macrocode} |