Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankMittelbach committed Feb 14, 2020
1 parent a8872b4 commit 3b29b73
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 49 deletions.
1 change: 0 additions & 1 deletion l3trial/xmarks/testfiles/xmarks-000.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Package: xparse ....-..-.. L3 Experimental document command parser
\l__xparse_current_arg_int=\count...
\g__xparse_grabber_int=\count...
\l__xparse_m_args_int=\count...
\l__xparse_mandatory_args_int=\count...
\l__xparse_v_nesting_int=\count...
)
Package: xmarks2 ....-..-.. L3 Experimental marks
Expand Down
4 changes: 2 additions & 2 deletions l3trial/xmarks/xmarks.ins
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
\iffalse meta-comment

File xmarks.ins Copyright (C) 2018 Frank Mittelbach, the LaTeX3 Project
File xmarks.ins Copyright (C) 2018-2020 Frank Mittelbach, the LaTeX3 Project

It may be distributed and/or modified under the conditions of the
LaTeX Project Public License (LPPL), either version 1.3c of this
Expand Down Expand Up @@ -32,7 +32,7 @@ license information is placed in the derived files.

\preamble

Copyright (C) 1999-2018 Frank Mittelbach, the LaTeX3 Project
Copyright (C) 1999-2020 Frank Mittelbach, the LaTeX3 Project

It may be distributed and/or modified under the conditions of
the LaTeX Project Public License (LPPL), either version 1.3c of
Expand Down
20 changes: 13 additions & 7 deletions l3trial/xmarks/xmarks2.dtx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
%% File: xmarks.dtx Copyright (C) 2018 Frank Mittelbach, The LaTeX3 Project
%% File: xmarks.dtx Copyright (C) 2018-2020 Frank Mittelbach, The LaTeX3 Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
Expand Down Expand Up @@ -241,6 +241,11 @@
% These functions are tied to the output routine and used in the
% interface to \LaTeXe{} and perhaps at some later time within an OR
% for \LaTeX3. Not meant for general use, so made internal here.
% Internal to this package means that \verb|@@| automatically gets
% replaced in the code (and in the documentation).
% \begin{macrocode}
%<@@=marks>
% \end{macrocode}
%
% \begin{function}{\@@_update_structure:nnn}
% \begin{syntax}
Expand Down Expand Up @@ -378,13 +383,10 @@
%<*package>
% \end{macrocode}
%
% \begin{macrocode}
%<@@=marks>
% \end{macrocode}
%
% \begin{macrocode}
%<*package>
\ProvidesExplPackage{xmarks2}{2018-12-06}{}
\ProvidesExplPackage{xmarks2}{2020-02-06}{}
{L3 Experimental marks}
%</package>
% \end{macrocode}
Expand Down Expand Up @@ -837,8 +839,12 @@
% \begin{macro}{\markright}
% In addition to generating the legacy mark we output the
% individual ones as well at the very same point.
%
% These days both macros are robust so patching needs to be done on
% the internal ones which is arkward. But then this is only
% temporary \dots
% \begin{macrocode}
\patchcmd\markboth
\expandafter\patchcmd\csname markboth\space \endcsname
{\mark}
{
\marks_put:nn{ltxleft}{#1}
Expand All @@ -851,7 +857,7 @@
% \end{macrocode}
% Same game with \cs{markright} more or less \ldots
% \begin{macrocode}
\patchcmd\markright
\expandafter\patchcmd\csname markright\space \endcsname
{\mark}
{
\marks_put:nn{ltxright}{#1}
Expand Down
123 changes: 84 additions & 39 deletions support/etoolbox.sty
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
% Copyright (c) 2007-2011 Philipp Lehman.
% (c) 2015-2018 Joseph Wright
% (c) 2015-2019 Joseph Wright
%
% Permission is granted to copy, distribute and/or modify this
% software under the terms of the LaTeX Project Public License
Expand All @@ -12,7 +12,7 @@

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{etoolbox}
[2018/08/19 v2.5f e-TeX tools for LaTeX (JAW)]
[2019/09/21 v2.5h e-TeX tools for LaTeX (JAW)]

\begingroup
\@ifundefined{eTeXversion}
Expand Down Expand Up @@ -268,8 +268,8 @@
{\@secondoftwo}
{\ifdefmacro{#1}
{\ifdefparam{#1}
{\@secondoftwo}
{\etb@ifdefempty{#1}}}
{\@secondoftwo}
{\etb@ifdefempty{#1}}}
{\@secondoftwo}}}

\def\etb@ifdefempty#1{%
Expand All @@ -295,8 +295,8 @@
{\@firstoftwo}
{\ifdefmacro{#1}
{\ifdefparam{#1}
{\@secondoftwo}
{\etb@ifdefempty{#1}}}
{\@secondoftwo}
{\etb@ifdefempty{#1}}}
{\@secondoftwo}}}

% {<csname>}{<true>}{<false>}
Expand Down Expand Up @@ -342,14 +342,14 @@
\ifdefmacro{#1}
{\ifdefmacro{#2}
{\begingroup
\edef\etb@tempa{\expandafter\strip@prefix\meaning#1}%
\edef\etb@tempb{\expandafter\strip@prefix\meaning#2}%
\ifx\etb@tempa\etb@tempb
\aftergroup\@firstoftwo
\else
\aftergroup\@secondoftwo
\fi
\endgroup}
\edef\etb@tempa{\expandafter\strip@prefix\meaning#1}%
\edef\etb@tempb{\expandafter\strip@prefix\meaning#2}%
\ifx\etb@tempa\etb@tempb
\aftergroup\@firstoftwo
\else
\aftergroup\@secondoftwo
\fi
\endgroup}
{\@secondoftwo}}
{\@secondoftwo}}

Expand All @@ -362,7 +362,7 @@
{\@secondoftwo}
{\expandafter\ifdefstrequal
\csname#1\expandafter\endcsname
\csname#2\endcsname}}}
\csname#2\endcsname}}}

% {<cstoken>}{<string>}{<true>}{<false>}

Expand Down Expand Up @@ -888,6 +888,7 @@
% {<cstoken>}

\newrobustcmd{\undef}[1]{\let#1\etb@undefined}
\newrobustcmd{\gundef}[1]{\global\let#1\etb@undefined}

% {<csname>}

Expand Down Expand Up @@ -1520,7 +1521,7 @@
{\noexpand\etb@listitem\noexpand\do{####1}%
\expandafter\noexpand
\csname etb@lst@\expandafter\@gobble\string#1\endcsname
\noexpand\@nil}}}%
\noexpand\@nil}}}%
\@tempa}

\long\def\etb@lst@@notoken@do#1{%
Expand Down Expand Up @@ -1558,7 +1559,7 @@
{\noexpand\etb@listitem{####1}{####2}%
\expandafter\noexpand
\csname etb@lst@\expandafter\@gobble\string#1\endcsname
{####1}\noexpand\@nil}}}%
{####1}\noexpand\@nil}}}%
\@tempa}

\long\def\etb@lst@@notoken@arg#1#2{%
Expand Down Expand Up @@ -1751,20 +1752,41 @@
\newrobustcmd{\AtBeginEnvironment}[1]{%
\csgappto{@begin@#1@hook}}

\patchcmd\begin
{\csname #1\endcsname}
{\csuse{@begin@#1@hook}%
\csname #1\endcsname}
{}
{\etb@warning{%
Patching '\string\begin' failed!\MessageBreak
'\string\AtBeginEnvironment' will not work\@gobble}}
\ifcsname begin \endcsname
\expandafter\patchcmd\csname begin \endcsname
{\csname #1\endcsname}
{\csuse{@begin@#1@hook}%
\csname #1\endcsname}
{}
{\etb@warning{%
Patching '\string\begin' failed!\MessageBreak
'\string\AtBeginEnvironment' will not work\@gobble}}
\else
\patchcmd\begin
{\csname #1\endcsname}
{\csuse{@begin@#1@hook}%
\csname #1\endcsname}
{}
{\etb@warning{%
Patching '\string\begin' failed!\MessageBreak
'\string\AtBeginEnvironment' will not work\@gobble}}
\fi

% {<environment>}{<code>}

\newrobustcmd{\AtEndEnvironment}[1]{%
\csgappto{@end@#1@hook}}

\ifcsname end \endcsname
\expandafter\patchcmd\csname end \endcsname
{\csname end#1\endcsname}
{\csuse{@end@#1@hook}%
\csname end#1\endcsname}
{}
{\etb@warning{%
Patching '\string\end' failed!\MessageBreak
'\string\AtEndEnvironment' will not work\@gobble}}
\else
\patchcmd\end
{\csname end#1\endcsname}
{\csuse{@end@#1@hook}%
Expand All @@ -1773,31 +1795,54 @@
{\etb@warning{%
Patching '\string\end' failed!\MessageBreak
'\string\AtEndEnvironment' will not work\@gobble}}
\fi

% {<environment>}{<code>}

\newrobustcmd{\BeforeBeginEnvironment}[1]{%
\csgappto{@beforebegin@#1@hook}}

\pretocmd\begin
{\csuse{@beforebegin@#1@hook}}
{}
{\etb@warning{%
Patching '\string\begin' failed!\MessageBreak
'\string\BeforeBeginEnvironment' will not work\@gobble}}
\ifcsname begin \endcsname
\expandafter\pretocmd\csname begin \endcsname
{\csuse{@beforebegin@#1@hook}}
{}
{\etb@warning{%
Patching '\string\begin' failed!\MessageBreak
'\string\BeforeBeginEnvironment' will not work\@gobble}}
\else
\pretocmd\begin
{\csuse{@beforebegin@#1@hook}}
{}
{\etb@warning{%
Patching '\string\begin' failed!\MessageBreak
'\string\BeforeBeginEnvironment' will not work\@gobble}}
\fi

% {<environment>}{<code>}

\newrobustcmd{\AfterEndEnvironment}[1]{%
\csgappto{@afterend@#1@hook}}

\patchcmd\end
{\if@ignore}
{\csuse{@afterend@#1@hook}%
\if@ignore}
{}
{\etb@warning{%
Patching '\string\end' failed!\MessageBreak
'\string\AfterEndEnvironment' will not work\@gobble}}
\let\if@ignore\relax
\ifcsname end \endcsname
\expandafter\patchcmd\csname end \endcsname
{\if@ignore}
{\csuse{@afterend@#1@hook}%
\if@ignore}
{}
{\etb@warning{%
Patching '\string\end' failed!\MessageBreak
'\string\AfterEndEnvironment' will not work\@gobble}}
\else
\patchcmd\end
{\if@ignore}
{\csuse{@afterend@#1@hook}%
\if@ignore}
{}
{\etb@warning{%
Patching '\string\end' failed!\MessageBreak
'\string\AfterEndEnvironment' will not work\@gobble}}
\fi
\let\if@ignore\iffalse

\endinput

0 comments on commit 3b29b73

Please sign in to comment.