Skip to content

Commit

Permalink
Add options to unused list when unknown key is active
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Jun 25, 2024
1 parent d0e2e6e commit 2d8c792
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 3 deletions.
4 changes: 4 additions & 0 deletions base/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ to completeness or accuracy and it contains some references to files that are
not part of the distribution.
================================================================================

2024-06-03 Joseph Wright <[email protected]>
* ltkeys.dtx:
Correct addition to unused option list with unknown key property (gh/1183)

2024-06-19 David Carlisle <[email protected]>

* fontdef.dtx:
Expand Down
8 changes: 5 additions & 3 deletions base/ltkeys.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltkeys.dtx}
[2024/06/20 v1.0o LaTeX Kernel (Keyval options)]
[2024/06/25 v1.0p LaTeX Kernel (Keyval options)]
% \iffalse
\documentclass{l3doc}
\GetFileInfo{ltkeys.dtx}
Expand Down Expand Up @@ -361,6 +361,8 @@
% \changes{v1.0h}{2022/06/20}{Use raw options data}
% \changes{v1.0m}{2024/01/13}{Trim spaces off key names}
% \changes{v1.0n}{2024/06/19}{Refactor function}
% \changes{v1.0p}{2024/06/25}
% {Correct unused option tracking where unknown keys are allowed}
% \begin{macro}{\@@_options_class:nnn}
% \changes{v1.0h}{2022/06/20}{New function}
% \changes{v1.0i}{2022/07/05}{Correct naming of raw class options storage}
Expand All @@ -387,7 +389,7 @@
{
\exp_args:Ne \@@_options_class:nnn
{ \tl_trim_spaces:e { \@@_remove_equals:n {##1} } }
{##1} {#1}
{##1} {#1}
}
}
}
Expand All @@ -400,7 +402,7 @@
}
{
\keys_if_exist:nnTF {#3} { unknown }
{ \@@_options_class:nn {#1} {#2} }
{ \clist_put_right:Nn \l_@@_options_clist {#2} }
{
\clist_if_in:NnF \@unusedoptionlist {#1}
{ \clist_put_right:Nn \@unusedoptionlist {#1} }
Expand Down
28 changes: 28 additions & 0 deletions base/testfiles/github-1183.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
\input{test2e}

\begin{filecontents}[overwrite]{github-1183.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{github-1183}
\LoadClassWithOptions{article}

\DeclareKeys[testwork]{%
test .code = \newcommand{\foo}{#1},
test .usage = load,
% the following three lines give an equivalent definition of your bertha
% option as defined with `\DeclareOption{bertha}{}`
bertha .code = {},
bertha .value_forbidden:n = true,
bertha .usage = load,
% if you use this unknown handler, you get "test" and "bertha" as unknown
% options, if you omit it you get "a4paper" as unknown option
unknown .code = {}
}
\ProcessKeyOptions[testwork]

\endinput
\end{filecontents}
\documentclass[a4paper,test=wtf,bertha]{github-1183}

\START
\begin{document}
\END
17 changes: 17 additions & 0 deletions base/testfiles/github-1183.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
(github-1183.aux)
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line ....
LaTeX Font Info: ... okay on input line ....
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line ....
LaTeX Font Info: ... okay on input line ....
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line ....
LaTeX Font Info: ... okay on input line ....
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line ....
LaTeX Font Info: ... okay on input line ....
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line ....
LaTeX Font Info: ... okay on input line ....
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line ....
LaTeX Font Info: ... okay on input line ....
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line ....
LaTeX Font Info: ... okay on input line ....

0 comments on commit 2d8c792

Please sign in to comment.