[latex3-commits] [git/LaTeX3-latex3-latex2e] master: Saving raw option lists (f2b99b6)

David Carlisle d.p.carlisle at gmail.com
Mon Nov 12 01:50:53 CET 2018


Repository : https://github.com/latex3/latex2e
On branch  : master
Link       : https://github.com/latex3/latex2e/commit/f2b99b6879170534c4a4ec9a69ea6767f45d06e4

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

commit f2b99b6879170534c4a4ec9a69ea6767f45d06e4
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Mon Nov 12 00:50:53 2018 +0000

    Saving raw option lists
    
    option handler ammended to save \@raw at opt@... in addition to \opt at ...
    so that it is available for extended option handlers,
    
    eg in kvoptions.sty (hyperref) defining
    
    \def\KVO at ProcessKeyvalOptions#1{%
    \expandafter\ifx\csname @raw at opt@\@currname.\@currext\endcsname\relax
    \else
    \expandafter\let\csname opt@\@currname.\@currext\expandafter\endcsname\csname @raw at opt@\@currname.\@currext\endcsname
    \fi
    ...
    
    would allow
    
    \usepackage[ colorlinks , pdftitle=A perfect day , pdfborder=0 0 0]{hyperref}
    
    with spaces in values preserved,
    
    To avoid the extended values breaking existing option handling the
    unused option list processing is extended so that after [x=y] only
    "x" is added to the unused option list (the mechanism used to remove
    items from the unused option list does not allow {}).
    
    This change should have no effect on existing documents other than
    possible different text in an unused global option warning.
    unless an extended option handler is used that takes advantage of the
    raw data.


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

f2b99b6879170534c4a4ec9a69ea6767f45d06e4
 base/ltclass.dtx |  123 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 base/ltvers.dtx  |    2 +-
 2 files changed, 117 insertions(+), 8 deletions(-)

diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index 2f19c74..3c2d7b8 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltclass.dtx}
-             [2018/05/29 v1.2j LaTeX Kernel (Class & Package Interface)]
+             [2018/11/11 v1.3a LaTeX Kernel (Class & Package Interface)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltclass.dtx}
@@ -848,19 +848,46 @@
 % \begin{macro}{\PassOptionsToClass}
 % If the package has been loaded, we check that it was first loaded with
 % the options.  Otherwise we add the option list to that of the package.
+% \changes{v1.3a}{2018/11/11}{save raw option lists}
 %    \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2018/12/01}%
+%<latexrelease>                 {\@pass at ptions}{Raw option lists}%
+%<*2ekernel|latexrelease>
 \def\@pass at ptions#1#2#3{%
   \expandafter\xdef\csname opt@#3.#1\endcsname{%
     \@ifundefined{opt@#3.#1}\@empty
       {\csname opt@#3.#1\endcsname,}%
-    \zap at space#2 \@empty}}
+    \zap at space#2 \@empty}%
+%    \end{macrocode}
+% Extend raw option list
+%    \begin{macrocode}
+    \@ifundefined{@raw at opt@#3.#1}%
+      {\expandafter\gdef\csname @raw at opt@#3.#1\endcsname{#2}}%
+      {\expandafter\g at addto@macro\csname @raw at opt@#3.#1\endcsname{,#2}}%
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease>                 {\@pass at ptions}{Raw option lists}%
+%<latexrelease>\def\@pass at ptions#1#2#3{%
+%<latexrelease>  \expandafter\xdef\csname opt@#3.#1\endcsname{%
+%<latexrelease>    \@ifundefined{opt@#3.#1}\@empty
+%<latexrelease>      {\csname opt@#3.#1\endcsname,}%
+%<latexrelease>    \zap at space#2 \@empty}}
+%<*2ekernel>
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 \@onlypreamble\@pass at ptions
 %    \end{macrocode}
 %
 %    \begin{macrocode}
 \def\PassOptionsToPackage{\@pass at ptions\@pkgextension}
 \def\PassOptionsToClass{\@pass at ptions\@clsextension}
-\@onlypreamble\PassOptionsToPackage
 \@onlypreamble\PassOptionsToClass
 %    \end{macrocode}
 % \end{macro}
@@ -895,18 +922,48 @@
 % \end{macro}
 %
 % \begin{macro}{\OptionNotUsed}
+% \changes{v1.3a}{2018/11/11}{filter out =value from unused option list}
+% \begin{macro}{\@remove at eq@value}
+% \changes{v1.3a}{2018/11/11}{macro added}
 % If we are in a class file, add |\CurrentOption| to the list of
 % unused options. Otherwise, in a package file do nothing.
 %    \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2018/12/01}%
+%<latexrelease>                 {\OptionNotUsed}{filter unused option list}%
+%<*2ekernel|latexrelease>
+\def\@remove at eq@value#1=#2\@nil{#1}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 \def\OptionNotUsed{%
   \ifx\@currext\@clsextension
     \xdef\@unusedoptionlist{%
       \ifx\@unusedoptionlist\@empty\else\@unusedoptionlist,\fi
-      \CurrentOption}%
+      \expandafter\@remove at eq@value\CurrentOption=\@nil}%
   \fi}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease>                 {\OptionNotUsed}{filter unused option list}%
+%<latexrelease>\let\@remove at eq@value\@undefined
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%<latexrelease>\def\OptionNotUsed{%
+%<latexrelease>  \ifx\@currext\@clsextension
+%<latexrelease>    \xdef\@unusedoptionlist{%
+%<latexrelease>      \ifx\@unusedoptionlist\@empty\else\@unusedoptionlist,\fi
+%<latexrelease>      \CurrentOption}%
+%<latexrelease>  \fi}
+%<*2ekernel>
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 \@onlypreamble\OptionNotUsed
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\default at ds}
 % The default default option code.
@@ -1031,11 +1088,29 @@
 %         {Name changed from \cs{@executeoption}}
 % \changes{v1.0e}{1994/05/17}
 %         {Execute option after removing from list, not before}
+% \changes{v1.3a}{2018/11/11}{filter out =value from unused option list}
 %    \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2018/12/01}%
+%<latexrelease>                 {\@use at ption}{filter unused option list}%
+%<*2ekernel|latexrelease>
 \def\@use at ption{%
-  \@expandtwoargs\@removeelement\CurrentOption
+  \@expandtwoargs\@removeelement
+     {\expandafter\@remove at eq@value\CurrentOption=\@nil}%
   \@unusedoptionlist\@unusedoptionlist
   \csname ds@\CurrentOption\endcsname}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease>                 {\@use at ption}{filter unused option list}%
+%<latexrelease>\def\@use at ption{%
+%<latexrelease>  \@expandtwoargs\@removeelement\CurrentOption
+%<latexrelease>  \@unusedoptionlist\@unusedoptionlist
+%<latexrelease>  \csname ds@\CurrentOption\endcsname}
+%<*2ekernel>
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 \@onlypreamble\@use at ption
 %    \end{macrocode}
 % \end{macro}
@@ -1317,15 +1392,23 @@
 %         {Prevent loss of brackets PR/3965}
 % \changes{v2.1b}{2016/11/09}
 %         {Improve \cs{ifx} tests PR/4497}
+% \changes{v1.3a}{2018/11/11}{save raw class option list}
 %    \begin{macrocode}
 %</2ekernel>
-%<latexrelease>\IncludeInRelease{2017/01/01}%
+%<latexrelease>\IncludeInRelease{2018/12/01}%
 %<latexrelease>        {\@fileswith at pti@ns}{ifx tests in \@fileswith at pti@ns}%
 %<*2ekernel|latexrelease>
 \def\@fileswith at pti@ns#1[#2]#3[#4]{%
   \ifx#1\@clsextension
     \ifx\@classoptionslist\relax
       \xdef\@classoptionslist{\zap at space#2 \@empty}%
+%    \end{macrocode}
+% Save raw class list.
+%    \begin{macrocode}
+      \gdef\@raw at classoptionslist{#2}%
+%    \end{macrocode}
+%
+%    \begin{macrocode}
       \def\reserved at a{%
         \@onefilewithoptions#3[{#2}][{#4}]#1%
         \@documentclasshook}%
@@ -1364,6 +1447,33 @@
   \fi
   \reserved at a}
 %</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2017/01/01}%
+%<latexrelease>        {\@fileswith at pti@ns}{ifx tests in \@fileswith at pti@ns}%
+%<latexrelease>\def\@fileswith at pti@ns#1[#2]#3[#4]{%
+%<latexrelease>  \ifx#1\@clsextension
+%<latexrelease>    \ifx\@classoptionslist\relax
+%<latexrelease>      \xdef\@classoptionslist{\zap at space#2 \@empty}%
+%<latexrelease>      \def\reserved at a{%
+%<latexrelease>        \@onefilewithoptions#3[{#2}][{#4}]#1%
+%<latexrelease>        \@documentclasshook}%
+%<latexrelease>    \else
+%<latexrelease>      \def\reserved at a{%
+%<latexrelease>        \@onefilewithoptions#3[{#2}][{#4}]#1}%
+%<latexrelease>    \fi
+%<latexrelease>  \else
+%<latexrelease>    \def\reserved at b##1,{%
+%<latexrelease>      \ifx\@nnil##1\relax\else
+%<latexrelease>        \ifx\@nnil##1\@nnil\else
+%<latexrelease>         \noexpand\@onefilewithoptions##1[{#2}][{#4}]%
+%<latexrelease>         \noexpand\@pkgextension
+%<latexrelease>        \fi
+%<latexrelease>        \expandafter\reserved at b
+%<latexrelease>      \fi}%
+%<latexrelease>      \edef\reserved at a{\zap at space#3 \@empty}%
+%<latexrelease>      \edef\reserved at a{\expandafter\reserved at b\reserved at a,\@nnil,}%
+%<latexrelease>  \fi
+%<latexrelease>  \reserved at a}
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -2449,7 +2559,6 @@
 %  \end{macro}
 %
 %
-
 %  \begin{macro}{\IfTargetDateBefore}
 %    This enables a simple form of conditional code inside a class or
 %    package file. If there is a date request and the request date is
diff --git a/base/ltvers.dtx b/base/ltvers.dtx
index d0affca..19b52f8 100644
--- a/base/ltvers.dtx
+++ b/base/ltvers.dtx
@@ -115,7 +115,7 @@
    {2018-12-01}
 %</2ekernel|latexrelease>
 %<*2ekernel>
-\def\patch at level{-6}
+\def\patch at level{-7}
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}





More information about the latex3-commits mailing list