[latex3-commits] [git/LaTeX3-latex3-latex2e] doc-ifnot: add ifnot property, use in new doc package option declarations (735334a2)

David Carlisle d.p.carlisle at gmail.com
Wed Jun 22 21:23:15 CEST 2022


Repository : https://github.com/latex3/latex2e
On branch  : doc-ifnot
Link       : https://github.com/latex3/latex2e/commit/735334a232676be64260fdf45f2ad1dbf3b419f2

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

commit 735334a232676be64260fdf45f2ad1dbf3b419f2
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Wed Jun 22 20:23:15 2022 +0100

    add ifnot property, use in new doc package option declarations


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

735334a232676be64260fdf45f2ad1dbf3b419f2
 base/changes.txt |   9 +++++
 base/doc.dtx     | 119 +++++++++----------------------------------------------
 base/ltkeys.dtx  |   8 +++-
 3 files changed, 34 insertions(+), 102 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index 061d7282..595698b5 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -10,6 +10,15 @@ are not part of the distribution.
 All changes above are only part of the development branch for the next release.
 ================================================================================
 
+2022-06-22  David Carlisle  <David.Carlisle at latex-project.org>
+
+	* ltkeys.dtx:
+	add .ifnot property (.legacy_if_set_inverse:n)
+
+	* doc.dtx
+	recast Package Option declarations using \DeclareKeys
+	
+
 #########################
 # 2022-06-01 PL2 Release
 #########################
diff --git a/base/doc.dtx b/base/doc.dtx
index d6b21744..225dd577 100644
--- a/base/doc.dtx
+++ b/base/doc.dtx
@@ -45,7 +45,7 @@
 %<+package>
 %<+package>\ProvidesPackage{doc}
 %<+shortvrb>\ProvidesPackage{shortvrb}
-%<+package|shortvrb>  [2022/06/08 v3.0j
+%<+package|shortvrb>  [2022/06/22 v3.0k
 %<+package|shortvrb>   Standard LaTeX documentation package V3 (FMi)]
 %\catcode`\<=12
 %
@@ -1909,113 +1909,32 @@
 %    should be altered further.
 %    \fmi{cleanup replacement of kvoptions}
 %
-%    \begin{macrocode}
-\ExplSyntaxOn
-%    \end{macrocode}
 % Some keys are available as options for use in \cs{usepackage} some are
 % for the generated item \api's:
-% \fmi{cleanup documentation (and code once the new key interface is there)}
-%    \begin{macrocode}
-\newif \ifdoc at noprint
-\newif \ifdoc at noindex
-\newif \ifdoc at hyperref \doc at hyperreftrue
-\newif \ifdoc at multicol \doc at multicoltrue
-\newif \ifdoc at debugshow
-\newif \ifdoc at reportchangedates
-\keys_define:nn {doc}
-  {
-    noprint  .choice:,
-    noprint / true  .code:n = { \legacy_if_set_true:n  { doc at noprint } },
-    noprint / false .code:n = { \legacy_if_set_false:n { doc at noprint } },
-    noprint  .default:n = { true },
-    noindex  .choice:,
-    noindex / true  .code:n = { \legacy_if_set_true:n  { doc at noindex } },
-    noindex / false .code:n = { \legacy_if_set_false:n { doc at noindex } },
-    noindex  .default:n = { true },
-    hyperref  .choice:,
-    hyperref / true  .code:n = { \legacy_if_set_true:n  { doc at hyperref } },
-    hyperref / false .code:n = { \legacy_if_set_false:n { doc at hyperref } },
-    hyperref  .default:n = { true },
-%    \end{macrocode}
+% \changes{v3.0k}{2022/06/22}{Use \cs{DeclareKeys}}
 % \changes{v3.0h}{2022/06/01}{fix choice key name (gh/750)}
-%    \begin{macrocode}
-    nohyperref  .choice:,
-    nohyperref / true  .code:n = { \legacy_if_set_false:n  { doc at hyperref } },
-    nohyperref / false .code:n = { \legacy_if_set_true:n { doc at hyperref } },
-    nohyperref  .default:n = { true },
-    multicol  .choice:,
-    multicol / true  .code:n = { \legacy_if_set_true:n  { doc at multicol } },
-    multicol / false .code:n = { \legacy_if_set_false:n { doc at multicol } },
-    multicol  .default:n = { true },
-    nomulticol  .choice:,
-    nomulticol / true  .code:n = { \legacy_if_set_false:n  { doc at multicol } },
-    nomulticol / false .code:n = { \legacy_if_set_true:n { doc at multicol } },
-%    \end{macrocode}
 % \changes{v3.0h}{2022/06/01}{fix default key name (gh/750)}
 %    \begin{macrocode}
-    nomulticol  .default:n = { true },
-    debugshow  .choice:,
-    debugshow / true  .code:n = { \legacy_if_set_true:n  { doc at debugshow } },
-    debugshow / false .code:n = { \legacy_if_set_false:n { doc at debugshow } },
-    debugshow  .default:n = { true },
-    reportchangedates  .choice:,
-    reportchangedates / true  .code:n = { \legacy_if_set_true:n  { doc at reportchangedates } },
-    reportchangedates / false .code:n = { \legacy_if_set_false:n { doc at reportchangedates } },
-    reportchangedates  .default:n = { true },
-  }
-%    \end{macrocode}
-% This one is for \cs{usepackage} and \cs{NewDocElement}:
-%    \begin{macrocode}
-\newif \ifdoc at toplevel \doc at topleveltrue
-\keys_define:nn {doc}
-  {
-    toplevel  .choice:,
-    toplevel / true  .code:n = { \legacy_if_set_true:n  { doc at toplevel } },
-    toplevel / false .code:n = { \legacy_if_set_false:n { doc at toplevel } },
-    toplevel  .default:n = { true },
-    notoplevel  .choice:,
-    notoplevel / true  .code:n = { \legacy_if_set_false:n  { doc at toplevel } },
-    notoplevel / false .code:n = { \legacy_if_set_true:n { doc at toplevel } },
-    notoplevel  .default:n = { true }
-  }
-%    \end{macrocode}
-% These are for \cs{NewDocElement}:
-%    \begin{macrocode}
-\newif \ifdoc at macrolike
-\keys_define:nn {doc}
-  {
-    macrolike  .choice:,
-    macrolike / true  .code:n = { \legacy_if_set_true:n  { doc at macrolike } },
-    macrolike / false .code:n = { \legacy_if_set_false:n { doc at macrolike } },
-    macrolike  .default:n = { true },
-    envlike  .choice:,
-    envlike / true  .code:n = { \legacy_if_set_false:n  { doc at macrolike } },
-    envlike / false .code:n = { \legacy_if_set_true:n { doc at macrolike } },
-    envlike  .default:n = { true }
-  }
-
-\keys_define:nn { doc }
+\DeclareKeys
   {
-    idxtype  .tl_set:N = \doc at idxtype,
-    idxgroup .tl_set:N = \doc at idxgroup,
-    printtype .tl_set:N = \doc at printtype
+    noprint           .if    = {doc at noprint},
+    noindex           .if    = {doc at noindex},
+    hyperref          .if    = {doc at hyperref},
+    nohyperref        .ifnot = {doc at hyperref},
+    multicol          .if    = {doc at multicol},
+    nomulticol        .ifnot = {doc at multicol},
+    debugshow         .if    = {doc at debugshow},
+    reportchangedates .if    = {doc at reportchangedates},
+    toplevel          .if    = {doc at toplevel},
+    notoplevel        .ifnot = {doc at toplevel},
+    macrolike         .if    = {doc at macrolike},
+    envlike           .ifnot = {doc at macrolike},
+    idxtype           .store = \doc at idxtype,
+    idxgroup          .store = \doc at idxgroup,
+    printtype         .store = \doc at printtype,
+    outer             .if    = {doc at outer},
   }
 %    \end{macrocode}
-% And this one only for instances of doc elements in the document, it
-%    covers the case where you want to document a macro which is
-%    declared to be \cs{outer}. This is not a concept officially
-%    supported by \LaTeX{} but there are cases when it gets used.
-%    \begin{macrocode}
-\newif\ifdoc at outer
-\keys_define:nn {doc}
-  {
-    outer  .choice:,
-    outer / true  .code:n = { \legacy_if_set_true:n  { doc at outer } },
-    outer / false .code:n = { \legacy_if_set_false:n { doc at outer } },
-    outer  .default:n = { true },
-  }
-\ExplSyntaxOff
-%    \end{macrocode}
 %
 % \subsection{Processing the package keys}
 %
diff --git a/base/ltkeys.dtx b/base/ltkeys.dtx
index fbd5ce30..e442d2d0 100644
--- a/base/ltkeys.dtx
+++ b/base/ltkeys.dtx
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltkeys.dtx}
-             [2022/06/20 v1.0h LaTeX Kernel (Kevyal options)]
+             [2022/06/22 v1.0i LaTeX Kernel (Kevyal options)]
 % \iffalse
 \documentclass{l3doc}
 \GetFileInfo{ltkeys.dtx}
@@ -72,6 +72,7 @@
 %   \begin{itemize}
 %    \item \texttt{.code} --- execute arbitrary code
 %     \item \texttt{.if} --- sets a \TeX{} \cs{if...} switch
+%     \item \texttt{.ifnot} --- sets an inverted \TeX{} \cs{if...} switch
 %     \item \texttt{.store} --- stores a value in a macro
 %     \item \texttt{.usage} -- defines whether the option can be given only
 %       when loading (\texttt{load}), in the preamble (\texttt{preamble}) or
@@ -152,11 +153,13 @@
 %
 % \subsection{Key properties}
 %
-% \begin{macro}{.code, .if, .store, .usage}
+% \begin{macro}{.code, .if, .ifnot, .store, .usage}
 % \changes{v1.0b}{2022/02/05}
 %         {Create properties in \texttt{ltlkeys}}
 % \changes{v1.0c}{2022/02/07}
 %         {Correct \texttt.{.code} property}
+% \changes{v1.0i}{2022/06/22}
+%         {Add \texttt.{.notif} property}
 %    \begin{macrocode}
 \group_begin:
   \cs_set_protected:Npn \@@_tmp:nn #1#2
@@ -170,6 +173,7 @@
   \@@_tmp:nn
     { code:n }          { code }
     { legacy_if_set:n } { if }
+    { legacy_if_set_inverse:n } { ifnot }
     { tl_set:N }        { store }
     { usage:n }         { usage }
     { \q_recursion_tail } { }





More information about the latex3-commits mailing list.