summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/advice/advice.edtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/generic/advice/advice.edtx')
-rw-r--r--Master/texmf-dist/source/generic/advice/advice.edtx42
1 files changed, 34 insertions, 8 deletions
diff --git a/Master/texmf-dist/source/generic/advice/advice.edtx b/Master/texmf-dist/source/generic/advice/advice.edtx
index ee9486226ec..dcbdfb297e7 100644
--- a/Master/texmf-dist/source/generic/advice/advice.edtx
+++ b/Master/texmf-dist/source/generic/advice/advice.edtx
@@ -19,7 +19,8 @@
%% This work has the LPPL maintenance status `maintained'.
%% The Current Maintainer of this work is Saso Zivanovic.
%%
-%% The files belonging to this work and covered by LPPL are listed in `FILES`.
+%% The files belonging to this work and covered by LPPL are listed in
+%% (<texmf>/doc/generic/advice/)FILES.
%
% \fi
%
@@ -28,14 +29,14 @@
% \relax
%
%<*main>
-%<latex>\ProvidesPackage{advice}[2023/10/10 v1.0.0 Extend commands and environments]
+%<latex>\ProvidesPackage{advice}[2023/10/25 v1.0.1 Extend commands and environments]
%<context>%D \module[
%<context>%D file=t-advice.tex,
-%<context>%D version=1.0.0,
+%<context>%D version=1.0.1,
%<context>%D title=Advice,
%<context>%D subtitle=Extend commands and environments,
%<context>%D author=Saso Zivanovic,
-%<context>%D date=2023-10-10,
+%<context>%D date=2023-10-25,
%<context>%D copyright=Saso Zivanovic,
%<context>%D license=LPPL,
%<context>%D ]
@@ -43,9 +44,14 @@
%<context>\unprotect
%<context>\startmodule[advice]
% \paragraph{Required packages}
+%<plain,context>\input miniltx
%<latex>\RequirePackage{collargs}
%<plain>\input collargs
%<context>\input t-collargs
+% In \hologo{LaTeX}, we also require |xparse|. Even though
+% |\NewDocumentCommand| and friends are integrated into the \hologo{LaTeX}
+% kernel, |\GetDocumentCommandArgSpec| is only available through |xparse|.
+%<latex>\RequirePackage{xparse}
%
% \subsubsection{Installation into a keypath}
%
@@ -959,10 +965,12 @@
}
% \subsubsection{Tracing}
%
+% We implement tracing by adding the tracing information to the handlers after
+% we load them. So it is the handlers themselves which, if and when they are
+% executed, will print out that this is happening.
+%
% \begin{macro}{\AdviceTracingOn,\AdviceTracingOff}
-% We implement tracing by adding the tracing information to the handlers
-% after we load them. So it is the handlers themselves which, if and when
-% they are executed, will print out that this is happening.
+% Enable and disable tracing.
\def\AdviceTracingOn{%
\let\advice@init@i\advice@trace@init@i
\let\advice@init@I\advice@trace@init@I
@@ -972,7 +980,24 @@
\let\advice@init@I\advice@setup@init@I
}
% \end{macro}
-\def\advice@trace#1{\immediate\write16{[tracing advice] #1}}
+% \begin{macro}{\advice@typeout,\advice@trace}
+% The tracing output routine; the typeout macro depends on the format. In
+% \hologo{LaTeX}, we use stream |\@unused|, which is guaranteed to be
+% unopened, so that the output will go to the terminal and the log.
+% \hologo{ConTeXt}, we don't muck about with write streams but simply use Lua
+% function |texio.write_nl|. In \hologo{plainTeX}, we use either Lua or the
+% stream, depending on the engine; we use a high stream number 128 although
+% the good old 16 would probably work just as well.
+%<plain>\ifdefined\luatexversion
+ %<!latex>\long\def\advice@typeout#1{\directlua{texio.write_nl("\luaescapestring{#1}")}}
+%<plain>\else
+ %<latex>\def\advice@typeout{\immediate\write\@unused}
+ %<plain>\def\advice@typeout{\immediate\write128}
+%<plain>\fi
+\def\advice@trace#1{\advice@typeout{[tracing advice] #1}}
+% \end{macro}
+% \begin{macro}{\advice@trace@init@i,\advice@trace@init@I}
+% Install the tracing code.
\def\advice@trace@init@i#1#2{%
\advice@trace{Advising \detokenize\expandafter{\string#2} (\detokenize{#1})}%
\advice@setup@init@i{#1}{#2}%
@@ -1033,6 +1058,7 @@
}%
\def\AdviceInnerHandler{\advice@inner@handler@trace}%
}
+% \end{macro}
%<plain>\resetatcatcode
%<context>\stopmodule
%<context>\protect