summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-12-30 21:26:16 +0000
committerKarl Berry <karl@freefriends.org>2023-12-30 21:26:16 +0000
commit2a0133cd95f7e0a9d6e749bcc9d7f2f31f62f48a (patch)
tree315c3b60ecb46f5fa4bb81ca3db5c2605b3daa1a
parentf2a882bd201ba1fb265e8d5097f2b8d3a5e94c09 (diff)
pgfkeysearch (30dec23)
git-svn-id: svn://tug.org/texlive/trunk@69243 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/pgfkeysearch/README.md22
-rw-r--r--Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.pdfbin158924 -> 164138 bytes
-rw-r--r--Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.tex27
-rw-r--r--Master/texmf-dist/tex/latex/pgfkeysearch/pgfkeysearch.sty142
4 files changed, 73 insertions, 118 deletions
diff --git a/Master/texmf-dist/doc/latex/pgfkeysearch/README.md b/Master/texmf-dist/doc/latex/pgfkeysearch/README.md
index 58a12659fc5..71ff4b251d7 100644
--- a/Master/texmf-dist/doc/latex/pgfkeysearch/README.md
+++ b/Master/texmf-dist/doc/latex/pgfkeysearch/README.md
@@ -34,6 +34,28 @@ This work has the LPPL maintenance status *maintained*.
The Current Maintainer of this work is Alceu Frigeri
+-------------
+## This work consist of the files
+
+* pgfkeysearch.sty
+ - the package itself
+
+* README.md (this file)
+ - quick introduction
+
+* pgfkeysearch.tex
+ - pakcage documentation
+* pgfkeysearch.pdf
+ - documentation in PDF format
+
+-------------
+
+## Changelog
+
+* Version 1.1 (this)
+ - More typos.
+ - renamed some internal variables to better follow the expl3 recommendations.
+ - exposing the Expl3 commands.
* Version 1.0
- Initial setup.
diff --git a/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.pdf b/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.pdf
index ce036e2a6e3..70d2abe1505 100644
--- a/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.pdf
+++ b/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.tex b/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.tex
index 5ebd18a0903..8e29e2a3ab5 100644
--- a/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.tex
+++ b/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.tex
@@ -12,7 +12,7 @@
%%
%% The Current Maintainer of this work is Alceu Frigeri
%%
-%% This is version {1.5} {2023/11/28}
+%% This is version {1.5} {2023/12/29}
%%
%% The list of files that compose this work can be found in the README.md file at
%% https://ctan.org/pkg/pgfkeysearch
@@ -51,7 +51,7 @@ That's exactly the aim of this, by having a way to find a key in a given path (o
\tsobj[marg]{path-list} is a comma separated list (clist) of paths (can be a single one). \tsobj[marg]{key} is the desired key and \tsobj[marg]{macro} is the macro/command that will receive (store) the key value (if one was found).
For instance, given a path /A/B/C/D it will look first at /A/B/C/D/\tsobj[marg]{key}, them /A/B/C/\tsobj[marg]{key}, and so on, until /A/\tsobj[marg]{key},
-Stopping at the first hit, returning the value found in the \tsobj[marg]{macro}.
+stopping at the first hit, returning the value found in the \tsobj[marg]{macro}.
The branch version will also execute either \tsobj[marg,sep={or}]{if-found,if-not}.
\end{codedescribe}
@@ -61,26 +61,31 @@ The branch version will also execute either \tsobj[marg,sep={or}]{if-found,if-no
\begin{codestore}[keyval.demo]
\pgfkeys{/tikz/A/.cd,
- keyA/.initial={A keyA},
- keyB/.initial={A keyB},
+ keyA/.initial={keyA at /tikz/A},
+ keyB/.initial={keyB at /tikz/A},
B/.cd,
- keyA/.initial={B keyA},
- keyC/.initial={B keyC},
+ keyA/.initial={keyA at /tikz/A/B},
+ keyC/.initial={keyC at /tikz/A/B},
C/.cd,
- keyX/.initial={C keyX} }
+ keyX/.initial={keyX at /tikz/A/B/C} }
\pgfkeysearchvalueof{/tikz/A/B/C}{keyA}{\VALkeyA}
\pgfkeysearchvalueof{/tikz/A/B/C}{keyB}{\VALkeyB}
\pgfkeysearchvalueof{/tikz/A/B/C}{keyC}{\VALkeyC}
\pgfkeysearchvalueof{/tikz/A/B/C}{keyX}{\VALkeyX}
-
I got for keyA: \textbf{\VALkeyA} \par
I got for keyB: \textbf{\VALkeyB} \par
I got for keyC: \textbf{\VALkeyC} \par
I got for keyX: \textbf{\VALkeyX} \par
-
\end{codestore}
\tsdemo[emph={pgfkeysearchvalueof}]{keyval.demo}
-
-\end{document} \ No newline at end of file
+\section{Expl3 Base Commands}
+\begin{codedescribe}{\pgfkeysearch_multipath_keysearch:nnnTF,\pgfkeysearch_keysearch:nnnTF}
+\begin{codesyntax}%
+\tsmacro{\pgfkeysearch_multipath_keysearch:nnnTF}{path-list,key,macro,if-found,if-not}
+\tsmacro{\pgfkeysearch_keysearch:nnnTF}{single-path,key,macro,if-found,if-not}
+\end{codesyntax}
+These are the \tsobj[pkg]{Expl3} version of it (for package writers). In fact, the \tsobj{\pgfkeysearchvalueof} is just a wrapper to \tsobj{\pgfkeysearch_multipath_keysearch:nnnTF}. The \tsobj{\pgfkeysearch_keysearch:nnnTF} is the single path version.
+\end{codedescribe}
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/pgfkeysearch/pgfkeysearch.sty b/Master/texmf-dist/tex/latex/pgfkeysearch/pgfkeysearch.sty
index bc1da1ae039..1b2144cfe16 100644
--- a/Master/texmf-dist/tex/latex/pgfkeysearch/pgfkeysearch.sty
+++ b/Master/texmf-dist/tex/latex/pgfkeysearch/pgfkeysearch.sty
@@ -12,7 +12,7 @@
%%
%% The Current Maintainer of this work is Alceu Frigeri
%%
-%% This is version {1.0} {2023/12/27}
+%% This is version {1.1} {2023/12/29}
%%
%% The list of files that compose this work can be found in the README.md file at
%% https://ctan.org/pkg/pgfkeysearch
@@ -23,8 +23,8 @@
\ProvidesExplPackage
{pgfkeysearch}
- {2023/12/27}
- {1.0}
+ {2023/12/29}
+ {1.1}
{pgfkeys Search Extension}
\ExplSyntaxOn
@@ -38,8 +38,8 @@
{
name .code:n = {pgfkeysearch} ,
prefix .code:n = {pgfkeysearch} ,
- date .code:n = {2023/12/27},
- version .code:n = {1.0} ,
+ date .code:n = {2023/12/29},
+ version .code:n = {1.1} ,
description .code:n = {pgfkeys Search Extension}
}
\cs_if_exist:NF \__codedesc_pkg_info:nn
@@ -60,89 +60,24 @@
%%% End of cut-n-paste
%%%%%%%
-
%%%%%%%%%%%%%%%
%%%
-%%% Expl3 machinery. _keysearch_ allows to find a key,
+%%% _keysearch allows to find a key,
%%% if it's defined from 'anywhere' in the tree. I mean, upwards until, likely, /tikz/<key>
%%% if it isn't defined, returns nothing (no error triggered)
%%%
%%%%%%%%%%%%%%%
-\seq_new:N \l__ctikzext_pathterms_seq
-\seq_new:N \l__ctikzext_pathtree_seq
-\tl_new:N \l__ctikzext_key_tl
-\tl_new:N \l__ctikzext_path_tl
-
-
-%%%%%%%%%%%%%%%%
-%%%%
-%%%% This works BUT, it isn't expandable and not a 1-to-1 replacement for pgfkeysvalueof (which is fully expandable)
-%%%% don't use this unless you know what you are doing. To avoid trouble tickets headaches, it's commeted out
-%%%%
-%%%%%%%%%%%%%%%%
-%\cs_new_protected:Npn \__ctikzext_keysearch:n #1
-% {
-% \seq_set_split:Nne \l__ctikzext_pathterms_seq {/} {#1}
-% \seq_pop_right:NN \l__ctikzext_pathterms_seq \l__ctikzext_key_tl
-% \seq_remove_all:Nn \l__ctikzext_pathterms_seq {}
-% \tl_clear:N \l__ctikzext_path_tl
-% \seq_clear:N \l__ctikzext_pathtree_seq
-% \seq_map_inline:Nn \l__ctikzext_pathterms_seq
-% {
-% \tl_put_right:Ne \l__ctikzext_path_tl {/##1}
-% \seq_put_right:Ne \l__ctikzext_pathtree_seq {\l__ctikzext_path_tl}
-% }
-% \seq_reverse:N \l__ctikzext_pathtree_seq
-% \seq_map_inline:Nn \l__ctikzext_pathtree_seq
-% {
-% \cs_if_exist:cT {pgfk@##1/\l__ctikzext_key_tl}
-% {
-% \exp_args:Ne \use:c {pgfk@##1/\l__ctikzext_key_tl}
-% \seq_map_break:
-% }
-% }
-% }
-
-
-
-%%%%%%%%%%%%%%%
-%%%
-%%% Deplecated... single path key search (just a bit faster if a single path)
-%%%
-%%%%%%%%%%%%%%%
-%\prg_new_protected_conditional:Npnn \__ctikzext_keysearch:nn #1#2 {TF,T,F}
-% {
-% \seq_set_split:Nne \l__ctikzext_pathterms_seq {/} {#1}
-% \seq_pop_right:NN \l__ctikzext_pathterms_seq \l__ctikzext_key_tl
-% \seq_remove_all:Nn \l__ctikzext_pathterms_seq {}
-% \tl_clear:N \l__ctikzext_path_tl
-% \seq_clear:N \l__ctikzext_pathtree_seq
-% \seq_map_inline:Nn \l__ctikzext_pathterms_seq
-% {
-% \tl_put_right:Ne \l__ctikzext_path_tl {/##1}
-% \seq_put_right:Ne \l__ctikzext_pathtree_seq {\l__ctikzext_path_tl}
-% }
-% \seq_reverse:N \l__ctikzext_pathtree_seq
-% \bool_set_false:N \l__ctikzext_valuefound_bool
-% \seq_map_inline:Nn \l__ctikzext_pathtree_seq
-% {
-% \cs_if_exist:cT {pgfk@##1/\l__ctikzext_key_tl}
-% {
-% \tl_set:Ne #2 {\exp_not:N \use:c{pgfk@##1/\l__ctikzext_key_tl}}
-% \bool_set_true:N \l__ctikzext_valuefound_bool
-% \seq_map_break:
-% }
-% }
-% \bool_if:nTF {\l__ctikzext_valuefound_bool}
-% { \prg_return_true: }
-% { \prg_return_false: }
-% }
-
+\seq_new:N \l__pgfkeysearch_pathterms_seq
+\seq_new:N \l__pgfkeysearch_pathtree_seq
+\tl_new:N \l__pgfkeysearch_path_tl
+\bool_new:N \l__pgfkeysearch_keyfound_bool
+\bool_new:N \l__pgfkeysearch_multipath_keyfound_bool
+\cs_generate_variant:Nn \tl_set:Nn {Ne}
%%%%%%%%%%%%%%%
%%%
-%%% Given a path /A/B/C/D it will look after
+%%% Given a single path /A/B/C/D it will look after
%%% /A/B/C/D/<key>
%%% /A/B/C/<key>
%%% /A/B/<key>
@@ -150,63 +85,56 @@
%%% stoping at the first hit
%%%
%%%%%%%%%%%%%%%
-
-\bool_new:N \l__ctikzext_valuefound_bool
-\prg_new_protected_conditional:Npnn \__ctikzext_keysearch:nnn #1#2#3 {TF,T,F}
+\prg_new_protected_conditional:Npnn \pgfkeysearch_keysearch:nnn #1#2#3 {TF,T,F}
{
- \seq_set_split:Nne \l__ctikzext_pathterms_seq {/} {#1}
- \seq_remove_all:Nn \l__ctikzext_pathterms_seq {}
- \tl_clear:N \l__ctikzext_path_tl
- \seq_clear:N \l__ctikzext_pathtree_seq
- \seq_map_inline:Nn \l__ctikzext_pathterms_seq
+ \seq_set_split:Nne \l__pgfkeysearch_pathterms_seq {/} {#1}
+ \seq_remove_all:Nn \l__pgfkeysearch_pathterms_seq {}
+ \tl_clear:N \l__pgfkeysearch_path_tl
+ \seq_clear:N \l__pgfkeysearch_pathtree_seq
+ \seq_map_inline:Nn \l__pgfkeysearch_pathterms_seq
{
- \tl_put_right:Ne \l__ctikzext_path_tl {/##1}
- \seq_put_right:Ne \l__ctikzext_pathtree_seq {\l__ctikzext_path_tl}
+ \tl_put_right:Ne \l__pgfkeysearch_path_tl {/##1}
+ \seq_put_right:Ne \l__pgfkeysearch_pathtree_seq {\l__pgfkeysearch_path_tl}
}
- \seq_reverse:N \l__ctikzext_pathtree_seq
- \bool_set_false:N \l__ctikzext_valuefound_bool
- \seq_map_inline:Nn \l__ctikzext_pathtree_seq
+ \seq_reverse:N \l__pgfkeysearch_pathtree_seq
+ \bool_set_false:N \l__pgfkeysearch_keyfound_bool
+ \seq_map_inline:Nn \l__pgfkeysearch_pathtree_seq
{
\cs_if_exist:cT {pgfk@##1/#2}
{
\tl_set:Ne #3 {\exp_not:N \use:c{pgfk@##1/#2}}
- \bool_set_true:N \l__ctikzext_valuefound_bool
+ \bool_set_true:N \l__pgfkeysearch_keyfound_bool
\seq_map_break:
}
}
- \bool_if:nTF {\l__ctikzext_valuefound_bool}
+ \bool_if:nTF {\l__pgfkeysearch_keyfound_bool}
{ \prg_return_true: }
{ \prg_return_false: }
}
-
-
-
%%%%%%%%%%%%%%%
%%%
%%% #1 shall be a comma separated list of paths (can be a single one)
-%%% it searchs for the key in every path, stoping at the first hit.
+%%% it searchs for key in every path, stoping at the first hit.
%%%
%%%%%%%%%%%%%%%
-
-\bool_new:N \l__ctikzext_multisearch_bool
-\prg_new_protected_conditional:Npnn \__ctikzext_multipath_keysearch:nnn #1#2#3 {T,F,TF}
+\prg_new_protected_conditional:Npnn \pgfkeysearch_multipath_keysearch:nnn #1#2#3 {T,F,TF}
{
- \bool_set_false:N \l__ctikzext_multisearch_bool
+ \bool_set_false:N \l__pgfkeysearch_multipath_keyfound_bool
\clist_map_inline:nn {#1}
{
- \__ctikzext_keysearch:nnnT {##1}{#2}{#3}
+ \pgfkeysearch_keysearch:nnnT {##1}{#2}{#3}
{
- \bool_set_true:N \l__ctikzext_multisearch_bool
+ \bool_set_true:N \l__pgfkeysearch_multipath_keyfound_bool
\clist_map_break:
}
}
- \bool_if:nTF {\l__ctikzext_multisearch_bool}
+ \bool_if:nTF {\l__pgfkeysearch_multipath_keyfound_bool}
{ \prg_return_true: }
{ \prg_return_false: }
}
-\cs_generate_variant:Nn \tl_set:Nn {Ne}
+
%%%%%%%%%%%%%%%
%%%
@@ -223,13 +151,13 @@
\NewDocumentCommand{\pgfkeysearchvalueof}{mmm}
{
- \__ctikzext_multipath_keysearch:nnnF {#1}{#2}{#3}
+ \pgfkeysearch_multipath_keysearch:nnnF {#1}{#2}{#3}
{ \tl_set:Nn #3 {} }
}
\NewDocumentCommand{\pgfkeysearchvalueofTF}{mmmmm}
{
- \__ctikzext_multipath_keysearch:nnnTF {#1}{#2}{#3}
+ \pgfkeysearch_multipath_keysearch:nnnTF {#1}{#2}{#3}
{ #4 }
{
\tl_set:Nn #3 {}