[latex3-commits] [git/LaTeX3-latex3-latex2e] gh168: enhancement for #168 (c7df916d)

Frank Mittelbach frank.mittelbach at latex-project.org
Tue Apr 7 12:11:17 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : gh168
Link       : https://github.com/latex3/latex2e/commit/c7df916d8e3c832c735a697285824cf5a4e82a4b

>---------------------------------------------------------------

commit c7df916d8e3c832c735a697285824cf5a4e82a4b
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Tue Apr 7 12:11:17 2020 +0200

    enhancement for #168


>---------------------------------------------------------------

c7df916d8e3c832c735a697285824cf5a4e82a4b
 base/changes.txt                                   |  6 +++
 base/doc/ltnews32.tex                              |  8 ++++
 base/ltclass.dtx                                   | 45 +++++++++++++++++++---
 base/testfiles/github-0168.lvt                     | 22 +++++++++++
 .../{github-0060.xetex.tlg => github-0168.tlg}     |  2 +
 base/testfiles/tlb-rollback-004.luatex.tlg         |  2 +
 base/testfiles/tlb-rollback-004.tlg                |  2 +
 base/testfiles/tlb-rollback-004.xetex.tlg          |  2 +
 8 files changed, 84 insertions(+), 5 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index 40888a2a..10fa6813 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -1,3 +1,9 @@
+2020-04-07  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* ltclass.dtx (section{Implementation}):
+	Add \@ifformatlater to test if the current format is equal or later than
+	the given date (gh/168)
+
 2020-04-06  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* ltfssini.dtx (section{Custom series settings for main document families}):
diff --git a/base/doc/ltnews32.tex b/base/doc/ltnews32.tex
index f90f6782..e4b8e226 100644
--- a/base/doc/ltnews32.tex
+++ b/base/doc/ltnews32.tex
@@ -275,6 +275,14 @@ has finally be fixed.
 %
 \gnatsissue{latex}{3357}
 
+\subsection{Added test for format date}
+
+\emph{to write}
+\cs{@ifformatlater}
+%
+\githubissue{168}
+
+
 
 
 
diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index f43e8f0c..83644c8b 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltclass.dtx}
-             [2020/03/02 v1.3j LaTeX Kernel (Class & Package Interface)]
+             [2020/04/07 v1.3k LaTeX Kernel (Class & Package Interface)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltclass.dtx}
@@ -620,15 +620,49 @@
 %
 % \begin{macro}{\@ifpackagelater}
 % \begin{macro}{\@ifclasslater}
-% |\@ifpackagelater{|\meta{name}|}{YYYY/MM/DD}|
-% Checks that the package loaded is more recent than the given date.
+% |\@ifpackagelater{|\meta{name}|}{YYYY/MM/DD}{|\meta{true
+%    code}|}{|\meta{false code}|}|
+%     Checks that the package loaded is more recent or equal to the
+%    given date.
+%    A better name for it  would therefore been
+%    |\@ifpackagelaterorequal| but it is in use for more than 30
+%    years, so \ldots
 %    \begin{macrocode}
 \def\@ifpackagelater{\@ifl at ter\@pkgextension}
 \def\@ifclasslater{\@ifl at ter\@clsextension}
 \@onlypreamble\@ifpackagelater
 \@onlypreamble\@ifclasslater
 %    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
 %
+
+%  \begin{macro}{\@ifformatlater}
+% |\@ifformatlater{YYYY/MM/DD}{|\meta{true
+%    code}|}{|\meta{false code}|}|
+%    Test if the format is later or equal to the given date.
+% \changes{v1.3k}{2020/04/07}{Macro added; also in rollback (gh/168)}
+%    \begin{macrocode}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2020/10/01}%
+%<latexrelease>                 {\@ifformatlater}{Test format date}%
+\def\@ifformatlater{\@ifl at t@r\fmtversion}
+%    \end{macrocode}
+%    For rollback pretend it was available since the beginning of dawn.
+%    \begin{macrocode}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease>                 {\@ifformatlater}{Test format date}%
+%<latexrelease>\def\@ifformatlater{\@ifl at t@r\fmtversion}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
+%    \end{macrocode}
+%  \end{macro}
+%
+% \begin{macro}{\@ifl at ter}
 %    \begin{macrocode}
 \def\@ifl at ter#1#2{%
   \expandafter\@ifl at t@r
@@ -675,6 +709,7 @@
 %    \begin{macrocode}
 \@onlypreamble\@ifl at t@r
 %    \end{macrocode}
+% \end{macro}
 %
 % \changes{v1.1j}{2016/06/20}
 %         {don't declare as \cs{@onlypreamble}}
@@ -695,8 +730,8 @@
 %</2ekernel|latexreleasefirst>
 %<*2ekernel>
 %    \end{macrocode}
-% \end{macro}
-% \end{macro}
+%
+%
 %
 % \begin{macro}{\@ifpackagewith}
 % \begin{macro}{\@ifclasswith}
diff --git a/base/testfiles/github-0168.lvt b/base/testfiles/github-0168.lvt
new file mode 100644
index 00000000..92b46e8b
--- /dev/null
+++ b/base/testfiles/github-0168.lvt
@@ -0,0 +1,22 @@
+
+\input{test2e}
+
+
+\START
+
+\makeatletter
+
+\@ifformatlater{2020/10/01}{\typeout{GOOD: 2020-10 or later}}
+                           {\typeout{BAD}}
+
+% roll back somewhat ...
+
+\OMIT
+\RequirePackage[2018/12/01]{latexrelease}
+\TIMO
+ 
+\@ifformatlater{2020/10/01}{\typeout{BAD}}
+                           {\typeout{GOOD: 2018-12 (\fmtversion) now}}
+
+ 
+\END
diff --git a/base/testfiles/github-0060.xetex.tlg b/base/testfiles/github-0168.tlg
similarity index 64%
copy from base/testfiles/github-0060.xetex.tlg
copy to base/testfiles/github-0168.tlg
index 1d0c6975..7b5f22d6 100644
--- a/base/testfiles/github-0060.xetex.tlg
+++ b/base/testfiles/github-0168.tlg
@@ -1,2 +1,4 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
+GOOD: 2020-10 or later
+GOOD: 2018-12 (....-..-..) now
diff --git a/base/testfiles/tlb-rollback-004.luatex.tlg b/base/testfiles/tlb-rollback-004.luatex.tlg
index dbb35983..770787fe 100644
--- a/base/testfiles/tlb-rollback-004.luatex.tlg
+++ b/base/testfiles/tlb-rollback-004.luatex.tlg
@@ -220,6 +220,8 @@ Applying: [....-..-..] negative height floats on input line ....
 Already applied: [....-..-..] negative height floats on input line ....
 Applying: [....-..-..] 2 column marks on input line ....
 Already applied: [....-..-..] 2 column marks on input line ....
+Skipping: [....-..-..] Test format date on input line ....
+Applying: [....-..-..] Test format date on input line ....
 Applying: [....-..-..] Guard against bad input on input line ....
 Already applied: [....-..-..] Guard against bad input on input line ....
 Applying: [....-..-..] Spaces in option clash check on input line ....
diff --git a/base/testfiles/tlb-rollback-004.tlg b/base/testfiles/tlb-rollback-004.tlg
index 3a3046f7..4e1d068c 100644
--- a/base/testfiles/tlb-rollback-004.tlg
+++ b/base/testfiles/tlb-rollback-004.tlg
@@ -218,6 +218,8 @@ Applying: [....-..-..] negative height floats on input line ....
 Already applied: [....-..-..] negative height floats on input line ....
 Applying: [....-..-..] 2 column marks on input line ....
 Already applied: [....-..-..] 2 column marks on input line ....
+Skipping: [....-..-..] Test format date on input line ....
+Applying: [....-..-..] Test format date on input line ....
 Applying: [....-..-..] Guard against bad input on input line ....
 Already applied: [....-..-..] Guard against bad input on input line ....
 Applying: [....-..-..] Spaces in option clash check on input line ....
diff --git a/base/testfiles/tlb-rollback-004.xetex.tlg b/base/testfiles/tlb-rollback-004.xetex.tlg
index 997b57ea..39c7e9a5 100644
--- a/base/testfiles/tlb-rollback-004.xetex.tlg
+++ b/base/testfiles/tlb-rollback-004.xetex.tlg
@@ -218,6 +218,8 @@ Applying: [....-..-..] negative height floats on input line ....
 Already applied: [....-..-..] negative height floats on input line ....
 Applying: [....-..-..] 2 column marks on input line ....
 Already applied: [....-..-..] 2 column marks on input line ....
+Skipping: [....-..-..] Test format date on input line ....
+Applying: [....-..-..] Test format date on input line ....
 Applying: [....-..-..] Guard against bad input on input line ....
 Already applied: [....-..-..] Guard against bad input on input line ....
 Applying: [....-..-..] Spaces in option clash check on input line ....





More information about the latex3-commits mailing list.