[latex3-commits] [git/LaTeX3-latex3-latex3] master, return-paths: Support for absolute key paths (see #508) (e60d7a4)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Jan 14 16:44:24 CET 2019


Repository : https://github.com/latex3/latex3
On branches: master,return-paths
Link       : https://github.com/latex3/latex3/commit/e60d7a4807598f6e6b6df721d45a806f6ff4a88b

>---------------------------------------------------------------

commit e60d7a4807598f6e6b6df721d45a806f6ff4a88b
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Jan 14 15:40:07 2019 +0000

    Support for absolute key paths (see #508)


>---------------------------------------------------------------

e60d7a4807598f6e6b6df721d45a806f6ff4a88b
 l3kernel/CHANGELOG.md |    4 ++++
 l3kernel/l3keys.dtx   |   33 +++++++++++++++++++++++++++------
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index e0388e3..b973ae8 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -7,6 +7,10 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Changed
+
+- Support for absolute key paths
+
 ## [2019-01-13]
 
 ### Added
diff --git a/l3kernel/l3keys.dtx b/l3kernel/l3keys.dtx
index 714981e..b0f2460 100644
--- a/l3kernel/l3keys.dtx
+++ b/l3kernel/l3keys.dtx
@@ -456,6 +456,19 @@
 % As illustrated in the next section, this subdivision is
 % particularly relevant to making multiple choices.
 %
+% \section{Absolute key paths}
+%
+% The use of |/| at the \emph{start} of a key name has a special meaning:
+% this makes a key path \emph{abolsute} rather than \emph{relative}. For
+% example
+% \begin{verbatim}
+%   \keys_define:nn { mymodule }
+%     { / othermodule / key .code:n = code }
+% \end{verbatim}
+% will define |othermodule/key| rather than |mymodule/othermoudle/key|. This
+% is important when for example filtering keys, as it means that keys which
+% are \emph{skipped} can later be set irrespective of the module setting.
+%
 % \section{Choice and multiple choice keys}
 % \label{sec:l3keys:choice}
 %
@@ -1341,9 +1354,13 @@
           {
             \tl_set:Nx \l_keys_path_tl
               {
-                \tl_if_empty:NF \l_@@_module_tl
-                  { \l_@@_module_tl  / }
-                #1
+                \str_if_eq:eeTF { \tl_head:n {#1} } { / }
+                  { \use_none:n #1 }
+                  {
+                    \tl_if_empty:NF \l_@@_module_tl
+                      { \l_@@_module_tl  / }
+                    #1
+                  }
               }
             \tl_set:Nn \l_@@_property_tl { . #2 }
           }
@@ -2199,9 +2216,13 @@
   {
     \tl_set:Nx \l_keys_path_tl
       {
-        \tl_if_blank:nF {#1}
-          { #1 / }
-        \@@_remove_spaces:n {#2}
+        \str_if_eq:eeTF { \tl_head:n {#2} } { / }
+          { \exp_args:No \@@_remove_spaces:n { \use_none:n #2 } }
+          {
+            \tl_if_blank:nF {#1}
+              { #1 / }
+            \@@_remove_spaces:n {#2}
+          }
       }
     \tl_clear:N \l_@@_module_tl
     \exp_after:wN \@@_find_key_module:w \l_keys_path_tl / \q_stop





More information about the latex3-commits mailing list