[latex3-commits] [git/LaTeX3-latex3-latex3] master: Apply unknown key handling to inherited keys (fixes #481) (d73bf4e)
Joseph Wright
joseph.wright at morningstar2.co.uk
Sun Sep 23 22:00:08 CEST 2018
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/d73bf4e268edf17607feb4b980599820b81bae09
>---------------------------------------------------------------
commit d73bf4e268edf17607feb4b980599820b81bae09
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Sun Sep 23 21:00:08 2018 +0100
Apply unknown key handling to inherited keys (fixes #481)
>---------------------------------------------------------------
d73bf4e268edf17607feb4b980599820b81bae09
l3kernel/l3keys.dtx | 70 +++++++++++++++++--------------
l3kernel/testfiles/m3expl001.luatex.tlg | 1 +
l3kernel/testfiles/m3expl001.ptex.tlg | 1 +
l3kernel/testfiles/m3expl001.tlg | 1 +
l3kernel/testfiles/m3expl001.uptex.tlg | 1 +
l3kernel/testfiles/m3expl001.xetex.tlg | 1 +
l3kernel/testfiles/m3expl003.luatex.tlg | 1 +
l3kernel/testfiles/m3expl003.ptex.tlg | 1 +
l3kernel/testfiles/m3expl003.tlg | 1 +
l3kernel/testfiles/m3expl003.uptex.tlg | 1 +
l3kernel/testfiles/m3expl003.xetex.tlg | 1 +
l3kernel/testfiles/m3keys003.lvt | 4 ++
l3kernel/testfiles/m3keys003.tlg | 16 +++++++
13 files changed, 69 insertions(+), 31 deletions(-)
diff --git a/l3kernel/l3keys.dtx b/l3kernel/l3keys.dtx
index 417f3d6..378fa71 100644
--- a/l3kernel/l3keys.dtx
+++ b/l3kernel/l3keys.dtx
@@ -2298,7 +2298,7 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_execute:, \@@_execute_unknown:}
+% \begin{macro}{\@@_execute:, \@@_execute_inherit:, \@@_execute_unknown:}
% \begin{macro}[EXP]{\@@_execute:nn}
% \begin{macro}{\@@_store_unused:}
% Actually executing a key is done in two parts. First, look for the
@@ -2315,42 +2315,50 @@
\cs:w \c_@@_code_root_tl \l_keys_path_tl \exp_after:wN \cs_end:
\exp_after:wN { \l_keys_value_tl }
}
- { \@@_execute_unknown: }
- }
-\cs_new_protected:Npn \@@_execute_unknown:
- {
- \bool_if:NTF \l_@@_only_known_bool
- { \@@_store_unused: }
{
- \cs_if_exist:cTF
- { \c_@@_inherit_root_tl \@@_parent:o \l_keys_path_tl }
+ \bool_if:NTF \l_@@_only_known_bool
+ { \@@_store_unused: }
{
- \clist_map_inline:cn
+ \cs_if_exist:cTF
{ \c_@@_inherit_root_tl \@@_parent:o \l_keys_path_tl }
- {
- \cs_if_exist:cT
- { \c_@@_code_root_tl ##1 / \l_keys_key_tl }
- {
- \cs:w \c_@@_code_root_tl ##1 / \l_keys_key_tl
- \exp_after:wN \cs_end: \exp_after:wN
- { \l_keys_value_tl }
- \clist_map_break:
- }
- }
+ { \@@_execute_inherit: }
+ { \@@_execute_unknown: }
}
+ }
+ }
+% \end{macrocode}
+% To deal with the case where there is no hit, we leave
+% \cs{@@_execute_unknown:} in the input stream and clean it up using the
+% break function: that avoids needing a boolean.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_execute_inherit:
+ {
+ \clist_map_inline:cn
+ { \c_@@_inherit_root_tl \@@_parent:o \l_keys_path_tl }
+ {
+ \cs_if_exist:cT
+ { \c_@@_code_root_tl ##1 / \l_keys_key_tl }
{
- \cs_if_exist:cTF
- { \c_@@_code_root_tl \l_@@_module_tl / unknown }
- {
- \cs:w \c_@@_code_root_tl \l_@@_module_tl / unknown
- \exp_after:wN \cs_end: \exp_after:wN { \l_keys_value_tl }
- }
- {
- \__kernel_msg_error:nnxx { kernel } { key-unknown }
- { \l_keys_path_tl } { \l_@@_module_tl }
- }
+ \cs:w \c_@@_code_root_tl ##1 / \l_keys_key_tl
+ \exp_after:wN \cs_end: \exp_after:wN
+ { \l_keys_value_tl }
+ \clist_map_break:n { \use_none:n }
}
- }
+ }
+ \@@_execute_unknown:
+ }
+\cs_new_protected:Npn \@@_execute_unknown:
+ {
+ \cs_if_exist:cTF
+ { \c_@@_code_root_tl \l_@@_module_tl / unknown }
+ {
+ \cs:w \c_@@_code_root_tl \l_@@_module_tl / unknown
+ \exp_after:wN \cs_end: \exp_after:wN { \l_keys_value_tl }
+ }
+ {
+ \__kernel_msg_error:nnxx { kernel } { key-unknown }
+ { \l_keys_path_tl } { \l_@@_module_tl }
+ }
}
\cs_new:Npn \@@_execute:nn #1#2
{
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 2f4d0d9..5f23e40 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -3335,6 +3335,7 @@ Defining \__keys_set_selective: on line ...
Defining \__keys_check_groups: on line ...
Defining \__keys_value_or_default:n on line ...
Defining \__keys_execute: on line ...
+Defining \__keys_execute_inherit: on line ...
Defining \__keys_execute_unknown: on line ...
Defining \__keys_execute:nn on line ...
Defining \__keys_store_unused: on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 44ab8a4..8ff9edd 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -3628,6 +3628,7 @@ Defining \__keys_set_selective: on line ...
Defining \__keys_check_groups: on line ...
Defining \__keys_value_or_default:n on line ...
Defining \__keys_execute: on line ...
+Defining \__keys_execute_inherit: on line ...
Defining \__keys_execute_unknown: on line ...
Defining \__keys_execute:nn on line ...
Defining \__keys_store_unused: on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index a1cc935..2bffb8c 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -3628,6 +3628,7 @@ Defining \__keys_set_selective: on line ...
Defining \__keys_check_groups: on line ...
Defining \__keys_value_or_default:n on line ...
Defining \__keys_execute: on line ...
+Defining \__keys_execute_inherit: on line ...
Defining \__keys_execute_unknown: on line ...
Defining \__keys_execute:nn on line ...
Defining \__keys_store_unused: on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 2d92f40..26aff89 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -3628,6 +3628,7 @@ Defining \__keys_set_selective: on line ...
Defining \__keys_check_groups: on line ...
Defining \__keys_value_or_default:n on line ...
Defining \__keys_execute: on line ...
+Defining \__keys_execute_inherit: on line ...
Defining \__keys_execute_unknown: on line ...
Defining \__keys_execute:nn on line ...
Defining \__keys_store_unused: on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 3f2461a..f373fa4 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -3373,6 +3373,7 @@ Defining \__keys_set_selective: on line ...
Defining \__keys_check_groups: on line ...
Defining \__keys_value_or_default:n on line ...
Defining \__keys_execute: on line ...
+Defining \__keys_execute_inherit: on line ...
Defining \__keys_execute_unknown: on line ...
Defining \__keys_execute:nn on line ...
Defining \__keys_store_unused: on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 2f4d0d9..5f23e40 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -3335,6 +3335,7 @@ Defining \__keys_set_selective: on line ...
Defining \__keys_check_groups: on line ...
Defining \__keys_value_or_default:n on line ...
Defining \__keys_execute: on line ...
+Defining \__keys_execute_inherit: on line ...
Defining \__keys_execute_unknown: on line ...
Defining \__keys_execute:nn on line ...
Defining \__keys_store_unused: on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 44ab8a4..8ff9edd 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -3628,6 +3628,7 @@ Defining \__keys_set_selective: on line ...
Defining \__keys_check_groups: on line ...
Defining \__keys_value_or_default:n on line ...
Defining \__keys_execute: on line ...
+Defining \__keys_execute_inherit: on line ...
Defining \__keys_execute_unknown: on line ...
Defining \__keys_execute:nn on line ...
Defining \__keys_store_unused: on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index a1cc935..2bffb8c 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -3628,6 +3628,7 @@ Defining \__keys_set_selective: on line ...
Defining \__keys_check_groups: on line ...
Defining \__keys_value_or_default:n on line ...
Defining \__keys_execute: on line ...
+Defining \__keys_execute_inherit: on line ...
Defining \__keys_execute_unknown: on line ...
Defining \__keys_execute:nn on line ...
Defining \__keys_store_unused: on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 2d92f40..26aff89 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -3628,6 +3628,7 @@ Defining \__keys_set_selective: on line ...
Defining \__keys_check_groups: on line ...
Defining \__keys_value_or_default:n on line ...
Defining \__keys_execute: on line ...
+Defining \__keys_execute_inherit: on line ...
Defining \__keys_execute_unknown: on line ...
Defining \__keys_execute:nn on line ...
Defining \__keys_store_unused: on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 3f2461a..f373fa4 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -3373,6 +3373,7 @@ Defining \__keys_set_selective: on line ...
Defining \__keys_check_groups: on line ...
Defining \__keys_value_or_default:n on line ...
Defining \__keys_execute: on line ...
+Defining \__keys_execute_inherit: on line ...
Defining \__keys_execute_unknown: on line ...
Defining \__keys_execute:nn on line ...
Defining \__keys_store_unused: on line ...
diff --git a/l3kernel/testfiles/m3keys003.lvt b/l3kernel/testfiles/m3keys003.lvt
index de83708..761b208 100644
--- a/l3kernel/testfiles/m3keys003.lvt
+++ b/l3kernel/testfiles/m3keys003.lvt
@@ -169,6 +169,10 @@
{
key-one = a
}
+ \keys_set:nn { module-two / path }
+ {
+ key-not-defined = a
+ }
}
\END
diff --git a/l3kernel/testfiles/m3keys003.tlg b/l3kernel/testfiles/m3keys003.tlg
index 595b4a4..008eb1b 100644
--- a/l3kernel/testfiles/m3keys003.tlg
+++ b/l3kernel/testfiles/m3keys003.tlg
@@ -219,4 +219,20 @@ Defining key module/key-one on line ...
> a.
<recently read> }
l. ... }
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+! LaTeX error: "kernel/key-unknown"
+!
+! The key 'module-two/path/key-not-defined' is unknown and is being ignored.
+!
+! See the LaTeX3 documentation for further information.
+!
+! For immediate help type H <return>.
+!...............................................
+l. ... }
+|'''''''''''''''''''''''''''''''''''''''''''''''
+| The module 'module-two/path' does not have a key called
+| 'module-two/path/key-not-defined'.
+| Check that you have spelled the key name correctly.
+|...............................................
============================================================
More information about the latex3-commits
mailing list