summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/third
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-01-03 21:18:16 +0000
committerKarl Berry <karl@freefriends.org>2024-01-03 21:18:16 +0000
commit353c0f08203d3cbe6012341e8e048755ed360bab (patch)
tree16a0610aa67af5709cf0ef581bf619e01f8dd428 /Master/texmf-dist/tex/context/third
parent4c36524528f5e6d3f25aae1756a00493d59a76c7 (diff)
advice (3jan24)
git-svn-id: svn://tug.org/texlive/trunk@69283 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/third')
-rw-r--r--Master/texmf-dist/tex/context/third/advice/t-advice.tex46
1 files changed, 36 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/context/third/advice/t-advice.tex b/Master/texmf-dist/tex/context/third/advice/t-advice.tex
index e30bed0869a..503c3b7743a 100644
--- a/Master/texmf-dist/tex/context/third/advice/t-advice.tex
+++ b/Master/texmf-dist/tex/context/third/advice/t-advice.tex
@@ -27,11 +27,11 @@
%% (<texmf>/doc/generic/advice/)FILES.
%D \module[
%D file=t-advice.tex,
-%D version=1.0.1,
+%D version=1.1.0,
%D title=Advice,
%D subtitle=Extend commands and environments,
%D author=Saso Zivanovic,
-%D date=2023-10-24,
+%D date=2024-01-02,
%D copyright=Saso Zivanovic,
%D license=LPPL,
%D ]
@@ -88,7 +88,7 @@
activation=#3,
activate deferred/.code={},
activate csname/.style={activate/.expand once={\csname##1\endcsname}},
- deactivate csname/.style={activate/.expand once={\csname##1\endcsname}},
+ deactivate csname/.style={deactivate/.expand once={\csname##1\endcsname}},
activate key/.style={activate@key={#1/activate}{##1}},
deactivate key/.style={activate@key={#1/deactivate}{##1}},
activate@key/.code n args=2{%
@@ -130,6 +130,7 @@
\def\AdviceSetup#1#2#3{%
\begingroup
\def\AdviceName{#3}%
+ \advice@def@AdviceCsname
\collargs@cs@cases{#3}{%
\def\AdviceType{command}%
\advice@setup@init@command
@@ -187,7 +188,8 @@
\noexpand\csdef{advice@I#1//\string#2}{%
\def\noexpand\AdviceOuterHandler{\expandonce\AdviceOuterHandler}%
\def\noexpand\AdviceCollector{\expandonce\AdviceCollector}%
- \def\noexpand\AdviceRawCollectorOptions{\expandonce\AdviceRawCollectorOptions}%
+ \def\noexpand\AdviceRawCollectorOptions{%
+ \expandonce\AdviceRawCollectorOptions}%
\def\noexpand\AdviceCollectorOptions{\expandonce\AdviceCollectorOptions}%
\def\noexpand\AdviceArgs{\expandonce\AdviceArgs}%
\def\noexpand\AdviceInnerHandler{\expandonce\AdviceInnerHandler}%
@@ -228,9 +230,22 @@
\def\advice@original@cs#1#2{\csname advice@o#1//\string#2\endcsname}
\def\AdviceGetOriginal#1#2{%
\ifcsname advice@o#1//\string#2\endcsname
- \csname advice@o#1//\string#2\expandafter\endcsname
+ \expandonce{\csname advice@o#1//\string#2\expandafter\endcsname\expandafter}%
\else
- \expandafter#2%
+ \expandafter\noexpand\expandafter#2%
+ \fi
+}
+\begingroup
+\catcode`\/=0
+\catcode`\\=12
+/gdef/advice@backslash@other{\}%
+/endgroup
+\def\AdviceCsnameGetOriginal#1#2{%
+ \ifcsname advice@o#1//\advice@backslash@other#2\endcsname
+ \expandonce{\csname advice@o#1//\advice@backslash@other#2\expandafter\endcsname
+ \expandafter}%
+ \else
+ \expandonce{\csname#2\expandafter\endcsname\expandafter}%
\fi
}
\def\advice@activate#1#2{%
@@ -315,11 +330,20 @@
\def\advice@handle@outer#1#2{%
\def\AdviceNamespace{#1}%
\def\AdviceName{#2}%
+ \advice@def@AdviceCsname
\let\AdviceReplaced\AdviceName
\def\AdviceOriginal{\AdviceGetOriginal{#1}{#2}}%
\advice@init@I{#1}{#2}%
\AdviceOuterHandler
}
+\def\advice@def@AdviceCsname{%
+ \begingroup
+ \escapechar=-1
+ \expandafter\expandafter\expandafter\endgroup
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter\AdviceCsname
+ \expandafter\expandafter\expandafter{\expandafter\string\AdviceName}%
+}
\newif\ifAdviceRun
\def\advice@default@outer@handler{%
\AdviceCollector
@@ -416,6 +440,8 @@
\def\advice@trace#1{\advice@typeout{[tracing advice] #1}}
\def\advice@trace@init@i#1#2{%
\advice@trace{Advising \detokenize\expandafter{\string#2} (\detokenize{#1})}%
+ \advice@trace{\space\space Original command meaning:
+ \expandafter\expandafter\expandafter\meaning\advice@original@cs{#1}{#2}}%
\advice@setup@init@i{#1}{#2}%
\edef\AdviceRunConditions{%
\expandonce\AdviceRunConditions
@@ -446,13 +472,13 @@
Executing collector:
\detokenize\expandafter{\AdviceCollector}}%
\noexpand\advice@trace{\space\space\space\space
- argument specification:
+ Argument specification:
\detokenize\expandafter{\AdviceArgs}}%
\noexpand\advice@trace{\space\space\space\space
- options:
+ Options:
\detokenize\expandafter{\AdviceCollectorOptions}}%
\noexpand\advice@trace{\space\space\space\space
- raw options:
+ Raw options:
\detokenize\expandafter{\AdviceRawCollectorOptions}}%
\expandonce\AdviceCollector
}%
@@ -464,7 +490,7 @@
Received arguments:
\noexpand\detokenize{##1}}%
\noexpand\advice@trace{\space\space\space\space
- options:
+ Options:
\detokenize\expandafter{\AdviceOptions}}%
\expandonce{\AdviceInnerHandler}{##1}%
}%