Skip to content

Commit

Permalink
Merge branch 'gh1262-Exists' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankMittelbach committed Apr 17, 2024
2 parents 0542b14 + d091f57 commit f248d94
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 21 deletions.
7 changes: 7 additions & 0 deletions base/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ to completeness or accuracy and it contains some references to files that are
not part of the distribution.
================================================================================

2024-04-17 Frank Mittelbach <[email protected]>

* ltproperties.dtx:
Renamed \IfLabelExistTF to \IfLabelExistsTF
Renamed \IfPropertyExistTF to \IfPropertyExistsTF
Provided T and F variants for both conditionals (gh/1262)

2024-04-17 Joseph Wright <[email protected]>
* lttemplates.dtx
Use \IfInstanceExistsTF with an 's'
Expand Down
8 changes: 8 additions & 0 deletions base/doc/ltnews39.tex
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ \section{Providing \pkg{xtemplate} in the format}
\item \cs{DeclareInstanceCopy}
\item \cs{EditInstance}
\item \cs{UseInstance}
\item \cs{IfInstanceExistsTF} and variants
\end{itemize}

To support existing package authors, we have released an updated version of
Expand Down Expand Up @@ -373,6 +374,13 @@ \subsection{New conditionals: \cs{IfClassAtleastT} and friends}
that one can only test for files that contain a \cs{ProvidesFile}
line.
%
We did the same for the conditionals \cs{IfLabelExistsTF} and
\cs{IfPropertyExistsTF} also introduced in 2023.\footnote{By mistake they
were initially introduced under the names \cs{IfLabelExistTF} and
\cs{IfPropertyExistTF}; we corrected that at the same time. This is a
breaking change, but the commands have been used so far only in
kernel code.}
%
\githubissue[s]{1222 1262}


Expand Down
36 changes: 22 additions & 14 deletions base/ltproperties.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%
% File: ltproperties.dtx
%
% Copyright (C) 2021-2023 The LaTeX Project
% Copyright (C) 2023-2024 The LaTeX 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 @@ -30,7 +30,7 @@
%<*driver>
% \fi
\ProvidesFile{ltproperties.dtx}
[2024/02/11 v1.0d LaTeX Kernel (Properties)]
[2024/04/17 v1.0e LaTeX Kernel (Properties)]
% \iffalse
%
\documentclass[full]{l3doc}
Expand Down Expand Up @@ -274,7 +274,7 @@
% \cs{property_if_exist_p:n} \Arg{property}
% \cs{property_if_exist:nTF} \Arg{property} \Arg{true code} \Arg{false code}
% \end{syntax}
% \LaTeXe{}-interface: \cs{IfPropertyExistTF}.\\
% \LaTeXe{}-interface: \cs{IfPropertyExistsTF}.\\
% Tests if the \meta{property} has been declared.
% \end{function}
%
Expand All @@ -283,7 +283,7 @@
% \cs{property_if_recorded_p:n} \Arg{label}
% \cs{property_if_recorded:nTF} \Arg{label} \Arg{true code} \Arg{false code}
% \end{syntax}
% \LaTeXe{}-interface: \cs{IfLabelExistTF}\\
% \LaTeXe{}-interface: \cs{IfLabelExistsTF}\\
% Tests if the \meta{label} is known. This is also true if the label has been
% set with the standard \cs{label} command.
% \end{function}
Expand Down Expand Up @@ -348,16 +348,16 @@
% If \Arg{property} has not been declared an error is issued.
% \end{function}
%
% \begin{function}{\IfPropertyExistTF}
% \begin{function}{\IfPropertyExistsTF,\IfPropertyExistsT,\IfPropertyExistsF}
% \begin{syntax}
% \cs{IfPropertyExistTF} \Arg{property} \Arg{true code} \Arg{false code}
% \cs{IfPropertyExistsTF} \Arg{property} \Arg{true code} \Arg{false code}
% \end{syntax}
% Tests if the \meta{property} has been declared.
% \end{function}
%
% \begin{function}{\IfLabelExistTF}
% \begin{function}{\IfLabelExistsTF,\IfLabelExistsT,\IfLabelExistsF}
% \begin{syntax}
% \cs{IfLabelExistTF} \Arg{label} \Arg{true code} \Arg{false code}
% \cs{IfLabelExistsTF} \Arg{label} \Arg{true code} \Arg{false code}
% \end{syntax}
% Tests if the \meta{label} has been recorded. This is also true if a label
% has been set with the standard \cs{label} command.
Expand Down Expand Up @@ -746,9 +746,13 @@
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\IfPropertyExistTF}
% \begin{macro}{\IfPropertyExistsTF,\IfPropertyExistsT,\IfPropertyExistsF}
% \changes{v1.0e}{2024-04-17}{Renamed \cs{IfPropertyExistTF} to
% \cs{IfPropertyExistsTF} (gh/1262)}
% \begin{macrocode}
\cs_new_eq:NN \IfPropertyExistTF \property_if_exist:eTF
\cs_new_eq:NN \IfPropertyExistsTF \property_if_exist:eTF
\cs_new:Npn \IfPropertyExistsT #1#2 {\property_if_exist:eTF {#1}{#2}{} }
\cs_new:Npn \IfPropertyExistsF #1 {\property_if_exist:eTF {#1}{} }
% \end{macrocode}
% \end{macro}
%
Expand All @@ -771,9 +775,13 @@
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\IfLabelExistTF}
% \begin{macro}{\IfLabelExistsTF,\IfLabelExistsT,\IfLabelExistsF}
% \changes{v1.0e}{2024-04-17}{Renamed \cs{IfLabelExistTF} to
% \cs{IfLabelExistsTF} (gh/1262)}
% \begin{macrocode}
\cs_new_eq:NN \IfLabelExistTF \property_if_recorded:eTF
\cs_new_eq:NN \IfLabelExistsTF \property_if_recorded:eTF
\cs_new:Npn \IfLabelExistsT #1#2 {\property_if_exist:eTF {#1}{#2}{} }
\cs_new:Npn \IfLabelExistsF #1 {\property_if_exist:eTF {#1}{} }
% \end{macrocode}
% \end{macro}
%
Expand Down Expand Up @@ -947,8 +955,8 @@
%<latexrelease>\let \RefProperty \@undefined
%<latexrelease>\let \RefUndefinedWarn \@undefined
%<latexrelease>
%<latexrelease>\let \IfPropertyExistTF \@undefined
%<latexrelease>\let \IfLabelExistTF \@undefined
%<latexrelease>\let \IfPropertyExistsTF \@undefined
%<latexrelease>\let \IfLabelExistsTF \@undefined
%<latexrelease>\let \IfPropertyRecordedTF \@undefined
%<latexrelease>
%<latexrelease>\let\new@label@record \@undefined
Expand Down
6 changes: 3 additions & 3 deletions base/testfiles/properties-005-test.lvt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ xxxxx
}
\ASSERT{true}
{
\IfPropertyExistTF {name}{true}{false}
\IfPropertyExistsTF {name}{true}{false}
}
}

Expand All @@ -49,7 +49,7 @@ xxxxx
}
\ASSERT{true}
{
\IfLabelExistTF {label-known}{true}{false}
\IfLabelExistsTF {label-known}{true}{false}
}
}

Expand All @@ -61,7 +61,7 @@ xxxxx
}
\ASSERT{true}
{
\IfLabelExistTF {standard-label-known}{true}{false}
\IfLabelExistsTF {standard-label-known}{true}{false}
}
}

Expand Down
12 changes: 8 additions & 4 deletions base/testfiles/properties-008-expansion.lvt
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,21 @@ xxxxx
}
\TEST{Test~property~by~command}
{
\ASSERT{true}
\ASSERT{true true false}
{
\IfPropertyExistTF {name\propsuffix}{true}{false}
\IfPropertyExistsTF {name\propsuffix}{true}{false}
\IfPropertyExistsT {name\propsuffix}{true}
\IfPropertyExistsF {name\propsuffix XXX}{false}
}
}

\TEST{Test~label~by~command}
{
\ASSERT{true}
\ASSERT{true true false}
{
\IfLabelExistTF {label\labelsuffix}{true}{false}
\IfLabelExistsTF {label\labelsuffix}{true}{false}
\IfLabelExistsT {name\propsuffix}{true}
\IfLabelExistsF {name\propsuffix XXX}{false}
}
}

Expand Down

0 comments on commit f248d94

Please sign in to comment.