| 1 |
% Copyright 2022 by Qrrbrbirlbel |
| 2 |
% |
| 3 |
% This file may be distributed and/or modified |
| 4 |
% |
| 5 |
% 1. under the LaTeX Project Public License and/or |
| 6 |
% 2. under the GNU Free Documentation License. |
| 7 |
% |
| 8 |
|
| 9 |
\RequirePackage{pgffor} |
| 10 |
\unless\ifcsname iftikzext@pgffor@nolist\endcsname |
| 11 |
\input pgffor-ext.code.tex |
| 12 |
\fi |
| 13 |
|
| 14 |
\pgfqkeys{/pgf/foreach/ext}{ |
| 15 |
.code=\pgfqkeys{/pgf/foreach/ext}{#1}, |
| 16 |
xparser/.code 2 args={% |
| 17 |
\DeclareDocumentCommand\pgffor@scan@custom{ #1 u, }{% |
| 18 |
\def\pgffor@value{#2}% |
| 19 |
\pgffor@scanned |
| 20 |
}% |
| 21 |
\def\pgffor@scan{% |
| 22 |
\pgfutil@ifnextchar\pgffor@stop\pgffor@scanone\pgffor@scan@custom |
| 23 |
}% |
| 24 |
}, |
| 25 |
xparser Om/.default=, |
| 26 |
xparser Om/.style={/pgf/foreach/ext/xparser={ O{#1} }{{##1}/{##2}}}, |
| 27 |
} |
| 28 |
\pgfqkeys{/handlers}{ |
| 29 |
.ext_list xparse/.code n args={3}{% |
| 30 |
\def\pgf@keys@temp{}% |
| 31 |
\foreach[xparser={#1}{#2}]\pgf@keys@key in{#3}{% |
| 32 |
\expandafter\pgfutil@g@addto@macro\expandafter\pgf@keys@temp\expandafter{\expandafter{\pgf@keys@key}}}% |
| 33 |
\edef\pgf@keys@list@path{\pgfkeyscurrentpath}% |
| 34 |
\expandafter\expandafter\expandafter\pgf@keys@do@list% |
| 35 |
\expandafter\expandafter\expandafter{% |
| 36 |
\expandafter\pgf@keys@list@path\expandafter}% |
| 37 |
\pgf@keys@temp\pgf@stop}% |
| 38 |
} |
| 39 |
|
| 40 |
%%% Compatibility |
| 41 |
\tikzextset{ |
| 42 |
compat/pgffor-ext/warn/.append code={% |
| 43 |
\tikzextutil@compatwarning@key{pgffor-ext}{pre 0.6}{/pgf/foreach/xparser}{/pgf/foreach/ext/xparser}% |
| 44 |
\tikzextutil@compatwarning@key{pgffor-ext}{pre 0.6}{/pgf/foreach/xparser Om}[]{/pgf/foreach/ext/xparser Om}% |
| 45 |
\tikzextutil@compatwarning@handler{pgffor-ext}{pre 0.6}{.list xparse}{.ext list xparse}% |
| 46 |
}, |
| 47 |
compat/pgffor-ext/pre 0.6/.append code={% |
| 48 |
\pgfkeysdef{/pgf/foreach/xparser}{\pgfkeysvalueof{/pgf/foreach/ext/normal list/.@cmd}##1\pgfeov}% |
| 49 |
\pgfkeysdef{/pgf/foreach/xparser Om}{\pgfkeysvalueof{/pgf/foreach/ext/xparser Om/.@cmd}##1\pgfeov}% |
| 50 |
\pgfkeysdef{/pgf/foreach/xparser Om/.@def}{}% |
| 51 |
\pgfkeysdef{/handlers/.list xparse}{\pgfkeysvalueof{/handlers/.ext list xparse/.@cmd}##1\pgfeov}% |
| 52 |
}, |
| 53 |
compat/pgffor-ext/\pgfkeysvalueof{/tikz/ext/compat/pgffor-ext}% |
| 54 |
} |
| 55 |
\endinput |