[latex3-commits] [git/LaTeX3-latex3-babel] main: [Unstable] Handling of class options rewritten. (9bdbc02)
Javier
email at dante.de
Fri Jul 30 18:48:24 CEST 2021
Repository : https://github.com/latex3/babel
On branch : main
Link : https://github.com/latex3/babel/commit/9bdbc0239e0bf3dfc8665570cf385a79209bab06
>---------------------------------------------------------------
commit 9bdbc0239e0bf3dfc8665570cf385a79209bab06
Author: Javier <email at localhost>
Date: Fri Jul 30 18:48:24 2021 +0200
[Unstable] Handling of class options rewritten.
>---------------------------------------------------------------
9bdbc0239e0bf3dfc8665570cf385a79209bab06
README.md | 2 +-
babel.dtx | 218 +++++++++++++++++++++++++++--------------------------------
babel.ins | 2 +-
babel.pdf | Bin 849686 -> 848856 bytes
bbcompat.dtx | 2 +-
5 files changed, 104 insertions(+), 120 deletions(-)
diff --git a/README.md b/README.md
index aba2761..8bb975a 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.63.2444
+## Babel 3.63.2449
This package manages culturally-determined typographical (and other)
rules, and hyphenation patterns for a wide range of languages. Many
diff --git a/babel.dtx b/babel.dtx
index f98f82d..8d80add 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -32,7 +32,7 @@
%
% \iffalse
%<*filedriver>
-\ProvidesFile{babel.dtx}[2021/07/25 v3.63.2444 The Babel package]
+\ProvidesFile{babel.dtx}[2021/07/30 v3.63.2449 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
@@ -5024,8 +5024,8 @@ help from Bernd Raichle, for which I am grateful.
% \section{Tools}
%
% \begin{macrocode}
-%<<version=3.63.2444>>
-%<<date=2021/07/25>>
+%<<version=3.63.2449>>
+%<<date=2021/07/30>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -5715,7 +5715,11 @@ help from Bernd Raichle, for which I am grateful.
\ifin@
\expandafter\bbl at tempa\CurrentOption\bbl at tempa
\else
- \bbl at add@list\bbl at language@opts{\CurrentOption}%
+ \bbl at xin@{,\CurrentOption,}{,\bbl at language@opts,}%
+ \ifin@
+ \bbl at exp{\\\bbl at replace\\\bbl at language@opts{,\CurrentOption,}{}}%
+ \fi
+ \edef\bbl at language@opts{\bbl at language@opts,\CurrentOption,}
\fi}
% \end{macrocode}
%
@@ -5726,8 +5730,16 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}
%
% \begin{macrocode}
-\ifx\bbl at opt@provide\@nnil\else % Tests. Ignore.
+\ifx\bbl at opt@provide\@nnil
+ \let\bbl at opt@provide\@empty % %%% MOVE above
+\else
\chardef\bbl at iniflag\@ne
+ \bbl at exp{\\\bbl at forkv{\@nameuse{@raw at opt@babel.sty}}}{%
+ \in@{,provide,}{,#1,}%
+ \ifin@
+ \def\bbl at opt@provide{#2}%
+ \bbl at replace\bbl at opt@provide{;}{,}%
+ \fi
\fi
%
% \end{macrocode}
@@ -5813,10 +5825,13 @@ help from Bernd Raichle, for which I am grateful.
\ifx\bbl at opt@safe\@undefined
\def\bbl at opt@safe{BR}
\fi
+% \end{macrocode}
+%
+% Make sure the language set with `main` is the last one.
+%
+% \begin{macrocode}
\ifx\bbl at opt@main\@nnil\else
- \edef\bbl at language@opts{%
- \ifx\bbl at language@opts\@empty\else\bbl at language@opts,\fi
- \bbl at opt@main}
+ \edef\bbl at language@opts{\bbl at language@opts,\bbl at opt@main,}
\fi
% \end{macrocode}
%
@@ -6824,6 +6839,7 @@ help from Bernd Raichle, for which I am grateful.
\IfFileExists{\CurrentOption.ldf}%
{\bbl at load@language{\CurrentOption}}%
{#1\bbl at load@language{#2}#3}}
+%
\DeclareOption{hebrew}{%
\input{rlbabel.def}%
\bbl at load@language{hebrew}}
@@ -6865,47 +6881,67 @@ help from Bernd Raichle, for which I am grateful.
% \end{macrocode}
%
% Recognizing global options in packages not having a closed set of
-% them is not trivial, as for them to be processed they must be
-% defined explicitly. So, package options not yet taken into
-% account and stored in |bbl at language@opts| are assumed to be
-% languages (note this list also contains the language given with
-% |main|). If not declared above, the names of the option and the
-% file are the same.
+% them is not trivial, as for them to be processed they must be defined
+% explicitly. So, package options not yet taken into account and stored
+% in |bbl at language@opts| are assumed to be existing languages (note
+% this list also contains the language given with |main| as the last
+% element). If not declared above, the names of the option and the file
+% are the same. There are two steps -- first process option names and
+% collect the result, which then do the actual declarations.
+%
+% To allow multiple overlapping replacements, commas in
+% |\bbl at language@opts| are doubled.
%
% \begin{macrocode}
-\let\bbl at tempc\relax
-\bbl at foreach\bbl at language@opts{%
- \ifcase\bbl at iniflag % Default
- \bbl at ifunset{ds@#1}%
- {\DeclareOption{#1}{\bbl at load@language{#1}}}%
- {}%
- \or % provide=*
- \@gobble % case 2 same as 1
- \or % provide+=*
- \bbl at ifunset{ds@#1}%
- {\IfFileExists{#1.ldf}{}%
- {\IfFileExists{babel-#1.tex}{}{\@namedef{ds@#1}{}}}}%
- {}%
- \bbl at ifunset{ds@#1}%
- {\def\bbl at tempc{#1}%
- \DeclareOption{#1}{%
- \ifnum\bbl at iniflag>\@ne
- \bbl at ldfinit
- \babelprovide[import]{#1}%
- \bbl at afterldf{}%
- \else
- \bbl at load@language{#1}%
- \fi}}%
- {}%
- \or % provide*=*
- \def\bbl at tempc{#1}%
- \bbl at ifunset{ds@#1}%
- {\DeclareOption{#1}{%
- \bbl at ldfinit
- \babelprovide[import]{#1}%
- \bbl at afterldf{}}}%
- {}%
+\let\bbl at elt\relax
+\let\bbl at tempe\@empty
+\bbl at foreach\@classoptionslist{%
+ \bbl at xin@{,#1,$}{\bbl at language@opts$}% Match last
+ \ifin@\else
+ \bbl at xin@{,#1,}{\bbl at language@opts}% Match non-last
+ \ifin@
+ \bbl at replace\bbl at language@opts{,#1,}{,,}%
+ \edef\bbl at tempe{\bbl at tempe\bbl at elt{0}{#1}}%
+ \else
+ \IfFileExists{#1.ldf}%
+ {\edef\bbl at tempe{\bbl at tempe\bbl at elt{1}{#1}}}%
+ {\ifnum\bbl at iniflag>\z@ % Optimization
+ \IfFileExists{babel-#1.tex}%
+ {\edef\bbl at tempe{\bbl at tempe\bbl at elt{2}{#1}}}%
+ {}%
+ \fi}%
+ \fi
\fi}
+%
+\let\bbl at savemain\@empty
+\bbl at foreach\bbl at language@opts{%
+ \edef\bbl at tempe{\bbl at tempe\bbl at elt{0}{#1}}}
+\def\bbl at elt#1#2#3{%
+ \ifx#3\relax % if last
+ \bbl at ifunset{ds@#2}{}%
+ {\toks@\expandafter\expandafter\expandafter
+ {\csname ds@#2\endcsname}%
+ \bbl at exp{\def\\\bbl at savemain{\\\DeclareOption{#2}{\the\toks@}}}}%
+ \bbl at add\bbl at savemain{\bbl at elt{#1}{#2}}% Save main
+ \DeclareOption{#2}{}%
+ \else
+ \ifnum\bbl at iniflag<\tw@ % other as ldf
+ \ifnum#1<\tw@ % Class: if ldf exists 1. Package: always 0
+ \bbl at ifunset{ds@#2}%
+ {\DeclareOption{#2}{\bbl at load@language{#2}}}%
+ {}%
+ \fi
+ \else % other as ini
+ \ifodd#1\relax\else % Class: if ini exists 2. Package: always 0
+ \DeclareOption{#2}{%
+ \bbl at ldfinit
+ \babelprovide[import]{#2}%
+ \bbl at afterldf{}}% <- 'main' implicit here
+ \fi
+ \fi
+ \fi
+ #3}
+\bbl at tempe\relax % \relax catches last
% \end{macrocode}
%
% Now, we make sure an option is explicitly declared for any language
@@ -6914,53 +6950,7 @@ help from Bernd Raichle, for which I am grateful.
% accessing the file system just to see if the option could be a
% language.
%
-% \begin{macrocode}
-\let\bbl at tempb\@nnil
-\bbl at foreach\@classoptionslist{%
- \bbl at ifunset{ds@#1}%
- {\IfFileExists{#1.ldf}%
- {\def\bbl at tempb{#1}%
- \DeclareOption{#1}{%
- \ifnum\bbl at iniflag>\@ne
- \bbl at ldfinit
- \babelprovide[import]{#1}%
- \bbl at afterldf{}%
- \else
- \bbl at load@language{#1}%
- \fi}}%
- {\IfFileExists{babel-#1.tex}%
- {\def\bbl at tempb{#1}%
- \ifnum\bbl at iniflag>\z@
- \DeclareOption{#1}{%
- \ifnum\bbl at iniflag>\@ne
- \bbl at ldfinit
- \babelprovide[import]{#1}%
- \bbl at afterldf{}%
- \fi}%
- \fi}%
- {}}}%
- {}}
-% \end{macrocode}
-%
% If a main language has been set, store it for the third pass.
-%
-% \begin{macrocode}
-\ifnum\bbl at iniflag=\z@\else
- \ifx\bbl at opt@main\@nnil
- \ifx\bbl at tempc\relax
- \let\bbl at opt@main\bbl at tempb
- \else
- \let\bbl at opt@main\bbl at tempc
- \fi
- \fi
-\fi
-\ifx\bbl at opt@main\@nnil\else
- \expandafter
- \let\expandafter\bbl at loadmain\csname ds@\bbl at opt@main\endcsname
- \expandafter\let\csname ds@\bbl at opt@main\endcsname\@empty
-\fi
-% \end{macrocode}
-%
% And we are done, because all options for this pass has been
% declared. Those already processed in the first pass are just
% ignored.
@@ -6986,7 +6976,7 @@ help from Bernd Raichle, for which I am grateful.
%
% \begin{macrocode}
\bbl at trace{Option 'main'}
-\ifx\bbl at opt@main\@nnil
+\ifx\bbl at opt@main\@nnil %% TODO. Revise
\edef\bbl at tempa{\@classoptionslist,\bbl at language@opts}
\let\bbl at tempc\@empty
\bbl at for\bbl at tempb\bbl at tempa{%
@@ -7002,31 +6992,25 @@ help from Bernd Raichle, for which I am grateful.
and a package option. Use 'main=\bbl at tempc' as\\%
option. Reported}%
\fi
-\else
- \ifodd\bbl at iniflag % case 1,3
- \bbl at ldfinit
- \let\CurrentOption\bbl at opt@main
- \ifx\bbl at opt@provide\@nnil
- \bbl at exp{\\\babelprovide[import,main]{\bbl at opt@main}}%
- \else
- \bbl at exp{\\\bbl at forkv{\@nameuse{@raw at opt@babel.sty}}}{%
- \bbl at xin@{,provide,}{,#1,}%
- \ifin@
- \def\bbl at opt@provide{#2}%
- \bbl at replace\bbl at opt@provide{;}{,}%
- \fi}%
- \bbl at exp{%
- \\\babelprovide[\bbl at opt@provide,import,main]{\bbl at opt@main}}%
- \fi
- \bbl at afterldf{}%
- \else % case 0,2
- \chardef\bbl at iniflag\z@ % Force ldf
- \expandafter\let\csname ds@\bbl at opt@main\endcsname\bbl at loadmain
- \ExecuteOptions{\bbl at opt@main}
- \DeclareOption*{}%
- \ProcessOptions*
- \fi
\fi
+\def\bbl at elt#1#2{% main
+ \ifodd\bbl at iniflag % as ini = 1,3
+ \ifodd#1\relax\else % Class: if ini exists 2. Package: always 0
+ \DeclareOption{#2}{%
+ \bbl at ldfinit
+ \babelprovide[\bbl at opt@provide,import]{#2}%
+ \bbl at afterldf{}}%
+ \fi
+ \else % as ldf = 0,2
+ \ifnum#1<\tw@ % Class: if ldf exists 1. Package: always 0
+ \bbl at ifunset{ds@#2}%
+ {\DeclareOption{#2}{\bbl at load@language{#2}}}%
+ {}%
+ \fi
+ \fi}
+\bbl at savemain
+\DeclareOption*{}
+\ProcessOptions*
\def\AfterBabelLanguage{%
\bbl at error
{Too late for \string\AfterBabelLanguage}%
diff --git a/babel.ins b/babel.ins
index 5973d22..b2598b6 100644
--- a/babel.ins
+++ b/babel.ins
@@ -26,7 +26,7 @@
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%%
-\def\filedate{2021/07/25}
+\def\filedate{2021/07/30}
\def\batchfile{babel.ins}
\input docstrip.tex
diff --git a/babel.pdf b/babel.pdf
index 0acf2e5..e943fa5 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index 8863cb2..90bf21f 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
%
% \iffalse
%<*dtx>
-\ProvidesFile{bbcompat.dtx}[2021/07/25 v3.63.2444]
+\ProvidesFile{bbcompat.dtx}[2021/07/30 v3.63.2449]
%</dtx>
%
%% File 'bbcompat.dtx'
More information about the latex3-commits
mailing list.