texlive[69231] Master: pgfkeysearch (28dec23)

commits+karl at tug.org commits+karl at tug.org
Fri Dec 29 00:06:36 CET 2023


Revision: 69231
          https://tug.org/svn/texlive?view=revision&revision=69231
Author:   karl
Date:     2023-12-29 00:06:36 +0100 (Fri, 29 Dec 2023)
Log Message:
-----------
pgfkeysearch (28dec23)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/libexec/ctan2tds
    trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/pgfkeysearch/
    trunk/Master/texmf-dist/doc/latex/pgfkeysearch/README.md
    trunk/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.pdf
    trunk/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.tex
    trunk/Master/texmf-dist/tex/latex/pgfkeysearch/
    trunk/Master/texmf-dist/tex/latex/pgfkeysearch/pgfkeysearch.sty
    trunk/Master/tlpkg/tlpsrc/pgfkeysearch.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/pgfkeysearch/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/pgfkeysearch/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/pgfkeysearch/README.md	2023-12-28 23:06:36 UTC (rev 69231)
@@ -0,0 +1,39 @@
+pgfkeysearch
+==========
+
+This package offers a way to find keys in a given path 'recursively', unlike pgfkeysvalueof.
+
+--------------
+
+## Requirements
+* none besides a fairly recent LaTeX distribution as recent as 2022/06/01
+(with the new in kernel *\ProcessKeyOptions* and *\NewDocumentCommand*)
+and pgfkeys.
+
+
+## Contacting Author
+
+For bug reports and enhancement suggestions, the preferred way is to use
+[the project's issue page](https://github.com/alceu-frigeri/pgfkeysearch/issues).
+Please be ready to provide an example code showing the bug, if any.
+
+Please do not use the issue page for generic help on how to use the package.
+
+* git: https://github.com/alceu-frigeri/pgfkeysearch
+
+-------------
+Copyright 2023-present by Alceu Frigeri
+
+ This work may be distributed and/or modified under the
+ conditions of
+
+ * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt), version 1.3c (or later), and/or
+ * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html), version 3 (or later)
+
+This work has the LPPL maintenance status *maintained*.
+
+The Current Maintainer of this work is Alceu Frigeri
+
+
+* Version 1.0
+    - Initial setup.


Property changes on: trunk/Master/texmf-dist/doc/latex/pgfkeysearch/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.pdf	2023-12-28 23:04:07 UTC (rev 69230)
+++ trunk/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.pdf	2023-12-28 23:06:36 UTC (rev 69231)

Property changes on: trunk/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.tex	2023-12-28 23:06:36 UTC (rev 69231)
@@ -0,0 +1,86 @@
+%%%==============================================================================
+%% Copyright 2023 by Alceu Frigeri
+%%
+%% This work may be distributed and/or modified under the conditions of
+%%
+%% * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt),
+%%   version 1.3c (or later), and/or
+%% * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html),
+%%   version 3 (or later)
+%%
+%% This work has the LPPL maintenance status *maintained*.
+%%
+%% The Current Maintainer of this work is Alceu Frigeri
+%%
+%% This is version {1.5} {2023/11/28}
+%%
+%% The list of files that compose this work can be found in the README.md file at
+%% https://ctan.org/pkg/pgfkeysearch
+%%
+%%%==============================================================================
+\documentclass[10pt]{article}
+\RequirePackage[verbose,a4paper,marginparwidth=27.5mm,top=2.5cm,bottom=1.5cm,hmargin={40mm,20mm},marginparsep=2.5mm,columnsep=10mm,asymmetric]{geometry}
+\usepackage{codedescribe}
+\usepackage{pgfkeysearch}
+\RequirePackage[inline]{enumitem}
+\SetEnumitemKey{miditemsep}{parsep=0ex,itemsep=0.4ex}
+
+\RequirePackage{pgfkeys}
+
+\RequirePackage[hidelinks,hypertexnames=false]{hyperref}
+\begin{document}
+\tstitle{
+  author={Alceu Frigeri\footnote{\tsverb{https://github.com/alceu-frigeri/pgfkeysearch}}},
+  date={\tsdate},
+  title={A Search Extension for pgfkeys\break Version \PkgInfo{pgfkeysearch}{version}}
+  }
+  
+\begin{typesetabstract}
+
+The command \tsobj{\pgfkeysvalueof}, unlike other \tsobj{\pgfkeys} commands, doesn't have a \tsobj[keys]{.unknown} handler, or offers the option to search for a key.
+That's exactly the aim of this, by having a way to find a key in a given path (or collection of paths).
+\end{typesetabstract}
+
+
+\section{Searching for a key}
+\begin{codedescribe}{\pgfkeysearchvalueof,\pgfkeysearchvalueofTF}
+\begin{codesyntax}%
+\tsmacro{\pgfkeysearchvalueof}{path-list,key,macro}
+\tsmacro{\pgfkeysearchvalueofTF}{path-list,key,macro,if-found,if-not}
+\end{codesyntax}
+\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}.
+The branch version will also execute either \tsobj[marg,sep={or}]{if-found,if-not}.
+  
+\end{codedescribe}
+\begin{tsremark}
+  Those commands aren't expandable, that's the reason to have them storing the key value in a macro and not just 'placing the value in the input stream'.
+\end{tsremark}
+
+\begin{codestore}[keyval.demo]
+ \pgfkeys{/tikz/A/.cd,
+  keyA/.initial={A keyA}, 
+  keyB/.initial={A keyB},
+  B/.cd,
+  keyA/.initial={B keyA},
+  keyC/.initial={B keyC},
+  C/.cd,
+  keyX/.initial={C keyX} }
+ \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


Property changes on: trunk/Master/texmf-dist/doc/latex/pgfkeysearch/pgfkeysearch.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/pgfkeysearch/pgfkeysearch.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/pgfkeysearch/pgfkeysearch.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/pgfkeysearch/pgfkeysearch.sty	2023-12-28 23:06:36 UTC (rev 69231)
@@ -0,0 +1,238 @@
+%%%==============================================================================
+%% Copyright 2023-present by Alceu Frigeri
+%%
+%% This work may be distributed and/or modified under the conditions of
+%%
+%% * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt),
+%%   version 1.3c (or later), and/or
+%% * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html),
+%%   version 3 (or later)
+%%
+%% This work has the LPPL maintenance status *maintained*.
+%%
+%% The Current Maintainer of this work is Alceu Frigeri
+%%
+%% This is version {1.0} {2023/12/27}
+%%
+%% The list of files that compose this work can be found in the README.md file at
+%% https://ctan.org/pkg/pgfkeysearch
+%%
+%%%==============================================================================
+\NeedsTeXFormat{LaTeX2e}[2022/06/01]
+
+
+\ProvidesExplPackage
+    {pgfkeysearch}
+    {2023/12/27}
+    {1.0}
+    {pgfkeys Search Extension}
+
+\ExplSyntaxOn
+%%%%%%%
+%%%
+%%% Just an attempt of having my packages info in a regular way
+%%% Idea being: { <pck-name> / pkg info } for each and all.
+%%%
+%%%%%%%
+\keys_define:nn { pgfkeysearch / pkg info}
+  {
+     name        .code:n = {pgfkeysearch} ,
+     prefix      .code:n = {pgfkeysearch} ,
+     date        .code:n = {2023/12/27},
+     version     .code:n = {1.0} ,
+     description .code:n = {pgfkeys Search Extension}
+  }
+\cs_if_exist:NF \__codedesc_pkg_info:nn 
+  {
+    \cs_new_protected:Npn \__codedesc_pkg_info:nn #1#2
+      { \keys_set:nn {#1 / pkg info}{#2} }
+  }
+\cs_if_exist:NF \PkgInfo
+  { \NewDocumentCommand \PkgInfo {mm} { \keys_set:nn {#1 / pkg info}{#2} } }
+\cs_if_exist:NF \PkgDescription
+  { 
+    \NewDocumentCommand \PkgDescription {m} 
+      { 
+        \noindent Package~ \textbf{\PkgInfo{#1}{name}}~Version:~\PkgInfo{#1}{version}~ -~ \PkgInfo{#1}{date}\par \emph{\PkgInfo{#1}{description}}~\par 
+      } 
+  }  
+%%%%%%%
+%%% End of cut-n-paste
+%%%%%%%
+
+
+%%%%%%%%%%%%%%%
+%%%
+%%% Expl3 machinery. _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: }
+%  }
+
+
+
+%%%%%%%%%%%%%%%
+%%%
+%%% Given a path /A/B/C/D it will look after
+%%%  /A/B/C/D/<key> 
+%%%  /A/B/C/<key>
+%%%  /A/B/<key>
+%%%  /A/<key>
+%%%    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}
+  {
+    \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
+      {
+        \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/#2}
+          {
+            \tl_set:Ne #3 {\exp_not:N \use:c{pgfk@##1/#2}}
+            \bool_set_true:N \l__ctikzext_valuefound_bool
+            \seq_map_break:
+          }
+      }
+    \bool_if:nTF {\l__ctikzext_valuefound_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.
+%%%
+%%%%%%%%%%%%%%%
+
+\bool_new:N \l__ctikzext_multisearch_bool
+\prg_new_protected_conditional:Npnn \__ctikzext_multipath_keysearch:nnn #1#2#3 {T,F,TF}
+  {
+    \bool_set_false:N \l__ctikzext_multisearch_bool
+    \clist_map_inline:nn {#1}
+      {
+        \__ctikzext_keysearch:nnnT {##1}{#2}{#3}
+          { 
+            \bool_set_true:N \l__ctikzext_multisearch_bool
+            \clist_map_break: 
+          }
+      }
+    \bool_if:nTF {\l__ctikzext_multisearch_bool}
+      { \prg_return_true: }
+      { \prg_return_false: }      
+  }
+
+\cs_generate_variant:Nn \tl_set:Nn {Ne}
+
+%%%%%%%%%%%%%%%
+%%%
+%%% The caveats: this ins't expandable.
+%%%
+%%%%%%%%%%%%%%%
+%%%
+%%% This is the more generic one. 
+%%% #1 is the path (or list of paths)
+%%% #2 is the <key>
+%%% #3 is the macro that will receive the key value (if any)
+%%%
+%%%%%%%%%%%%%%%
+
+\NewDocumentCommand{\pgfkeysearchvalueof}{mmm}
+  {
+    \__ctikzext_multipath_keysearch:nnnF {#1}{#2}{#3}
+      { \tl_set:Nn #3 {} }
+  }
+
+\NewDocumentCommand{\pgfkeysearchvalueofTF}{mmmmm}
+  {
+    \__ctikzext_multipath_keysearch:nnnTF {#1}{#2}{#3}
+      { #4 }
+      { 
+        \tl_set:Nn #3 {} 
+        #5
+      }
+  }


Property changes on: trunk/Master/texmf-dist/tex/latex/pgfkeysearch/pgfkeysearch.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2023-12-28 23:04:07 UTC (rev 69230)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2023-12-28 23:06:36 UTC (rev 69231)
@@ -648,7 +648,7 @@
     petiteannonce petri-nets pfarrei pfdicons
     pgf pgf-blur pgf-interference pgf-periodictable pgf-pie
     pgf-soroban pgf-spectra pgf-umlcd pgf-umlsd
-    pgfgantt pgfkeyx pgfmath-xfp pgfmolbio pgfmorepages
+    pgfgantt pgfkeysearch pgfkeyx pgfmath-xfp pgfmolbio pgfmorepages
     pgfopts pgfornament pgfornament-han pgfplots
     phaistos phfcc phfextendedabstract phffullpagefigure
     phfnote phfparen phfqit phfquotetext

Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds	2023-12-28 23:04:07 UTC (rev 69230)
+++ trunk/Master/tlpkg/libexec/ctan2tds	2023-12-28 23:06:36 UTC (rev 69231)
@@ -1814,6 +1814,7 @@
  'pbibtex-base'		=> '&POSTpbibtex_base',
  'pdfextra'		=> '&POSTpdfextra',
  'pedigree-perl'	=> '&POSTpedigreeperl',
+ 'pgfkeysearch'		=> '&POST_onelevel',
  'pgfornament'		=> '&POSTpgfornament',
  'pgfplots'		=> '&POSTpgfplots',
  'physics2'		=> '&POST_onelevel',

Modified: trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc	2023-12-28 23:04:07 UTC (rev 69230)
+++ trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc	2023-12-28 23:06:36 UTC (rev 69231)
@@ -119,6 +119,7 @@
 depend pgf-umlcd
 depend pgf-umlsd
 depend pgfgantt
+depend pgfkeysearch
 depend pgfkeyx
 depend pgfmolbio
 depend pgfmorepages

Added: trunk/Master/tlpkg/tlpsrc/pgfkeysearch.tlpsrc
===================================================================


More information about the tex-live-commits mailing list.