[latex3-commits] [latex3/babel] main: Added option 'modifiers.<lang>'. (3cc94ea)

github at latex-project.org github at latex-project.org
Sat May 6 08:08:29 CEST 2023


Repository : https://github.com/latex3/babel
On branch  : main
Link       : https://github.com/latex3/babel/commit/3cc94eaf330d2ed92a14446f455e55202aed8f9a

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

commit 3cc94eaf330d2ed92a14446f455e55202aed8f9a
Author: Javier <email at localhost>
Date:   Sat May 6 08:08:29 2023 +0200

    Added option 'modifiers.<lang>'.


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

3cc94eaf330d2ed92a14446f455e55202aed8f9a
 README.md                                 |   7 +-
 babel-code.pdf                            | Bin 592168 -> 592259 bytes
 babel.dtx                                 | 152 +++++++++++++-----------------
 babel.ins                                 |  33 ++++++-
 babel.pdf                                 | Bin 399080 -> 399447 bytes
 bbcompat.dtx                              |   2 +-
 locale/sr/babel-serbian-ijekavsk.tex      |  12 +++
 locale/sr/babel-serbian-latn-ijekavsk.tex |  12 +++
 8 files changed, 124 insertions(+), 94 deletions(-)

diff --git a/README.md b/README.md
index c9bea46..eb756cc 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.88.12172
+## Babel 3.88.12632
 
 2023-04-18
 
@@ -10,9 +10,9 @@ is a set of ini files for about 250 languages.
 
 The latest stable version is available on <https://ctan.org/pkg/babel>.
 
-Changes in version 3.88 are described in:
+Changes in version 3.89 are described in:
 
-https://latex3.github.io/babel/news/whats-new-in-babel-3.88.html
+https://latex3.github.io/babel/news/whats-new-in-babel-3.89.html
 
 Apart from the manual, you can find information on some aspects of babel at:
 
@@ -53,6 +53,7 @@ respective authors.
         option.
       * The manual has been split in two documents: 'babel.pdf' is the
         user guide and 'babel-code.pdf' is the code.
+      * Alternative way to pass 'modifiers' to babel.
 
 3.88  2023-04-18
       * 37 new locale files: Abkhazian, Afar, Atsam, Baluchi, Bhojpuri,
diff --git a/babel-code.pdf b/babel-code.pdf
index 13b1199..6494328 100644
Binary files a/babel-code.pdf and b/babel-code.pdf differ
diff --git a/babel.dtx b/babel.dtx
index 858e273..58153ba 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2023/05/01 v3.88.12172 The Babel package]
+\ProvidesFile{babel.dtx}[2023/05/06 v3.88.12632 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -635,6 +635,15 @@ needs.}
 Attributes (described below) are considered modifiers, ie, you can
 set an attribute by including it in the list of modifiers.
 
+\New{3.89} Alternatively, modifiers can be set with a separate option,
+with the keyword |modifiers| followed by a dot and the language name
+(note the language is not selected with this option). It is useful to
+activate some feature when the language is declared as a class option:
+\begin{verbatim}
+\documentclass[spanish]{report}
+\usepackage[_modifiers.spanish = notilde.lcroman_]{babel}
+\end{verbatim}
+
 \subsection{Troubleshooting}
 
 \begin{itemize}
@@ -1145,34 +1154,6 @@ perform the same functions as the default shorthand character. However,
 it’s behavior was not always the expected one (the original character
 was remembered somehow), and it’s now deprecated.
 
-% If one
-% prefers for example to use the character |/| over |"| in typing Polish
-% texts, this can be achieved by entering |\aliasshorthand{"}{/}|. For
-% the reasons in the warning below, usage of this macro is not
-% recommended.
-% 
-% \begin{note}
-%   The substitute character must \textit{not} have been declared before
-%   as shorthand (in such a case, |\aliashorthands| is ignored).
-% \end{note}
-% 
-% \begin{example}
-%   The following example shows how to replace a shorthand by another
-% \begin{verbatim}
-% \aliasshorthand{~}{^}
-% \AtBeginDocument{\shorthandoff*{~}}
-% \end{verbatim}
-% \end{example}
-% 
-% \begin{warning}
-%   Shorthands remember somehow the original character, and the fallback
-%   value is that of the latter. So, in this example, if no shorthand is
-%   found, |^| expands to a non-breaking space, because this is the
-%   value of |~| (internally, |^| still calls |\active at char~| or
-%   |\normal at char~|). Furthermore, if you change the |system| value of
-%   |^| with |\defineshorthand| nothing happens.
-% \end{warning}
-
 \subsection{Package options}
 
 \New{3.9a}
@@ -2571,9 +2552,10 @@ language the first valid hyphenation rules in the list. For example:
 \begin{verbatim}
 \babelprovide[_hyphenrules=chavacano spanish italian_]{chavacano}
 \end{verbatim}
-If none of the listed hyphenrules exist, the default behavior
-applies. Note in this example we set |chavacano| as first option --
-without it, it would select |spanish| even if |chavacano| exists.
+If none of the listed hyphenrules exist, the default behavior applies.
+Note in this example we set |chavacano| as first option, which can seem
+redundant, but without it, it would select |spanish| even if
+|chavacano| exists.
 
 A special value is |+|, which allocates a new language (in the \TeX{}
 sense). It only makes sense as the last value (or the only one; the
@@ -4246,33 +4228,45 @@ empty, removes them. The last argument is the locale name:
 \Describe{\babeladjust}{\marg{key-value-list}}
 
 \New{3.36} Sometimes you might need to disable some \babel{} features.
-Currently this macro understands the following keys [to be documented],
-with values |on| or |off|:
+Currently this macro understands the following keys, with values |on|
+or |off|:
 \begin{multicols}{3}
 \ttfamily
+autoload.bcp47\\
+bcp47.toname\\
 bidi.mirroring\\
 bidi.text\\
-bidi.math\\%*
+bidi.math\\%
 % bidi.mapdigits\\
 linebreak.sea\\%*
 linebreak.cjk\\%*
 justify.arabic\\%*
 layout.tabular\\%*
-layout.lists\\%*
-autoload.bcp47\\
-bcp47.toname
+layout.lists
 \end{multicols}
-
-Other keys [to be documented] are:
+The first four are documented elsewhere. The following by default are
+|on|, but with |off| can disable some features: |bidi.math| (only
+preamble) the changes for math or \textsf{amsmath}, |linebreak.sea|,
+|linebreak.sea| and |justify.arabic| the corresponding algorithms,
+|layout.tabular| and |layout.lists| the changes for tabular and lists.
+Some of the are reverted only to some extent.
+
+Other keys are:
 \begin{multicols}{3}
 \ttfamily
-autoload.options\\%*
+autoload.options\\
 autoload.bcp47.prefix\\
 autoload.bcp47.options\\
 prehyphenation.disable\\%*
 select.write\\
 select.encoding\\%*
 \end{multicols}
+Most of them are documented elsewhere. With |select.encoding=off|, the
+encoding is not set when loading a language on the fly with \pdftex
+(only |off|).
+|prehyphenation.disable| is by default |nohyphenation|, which means
+prehyphenation transforms are not applied if the current hyphenation
+rules are |nohyphenation|; with |off| they are never disabled.
 
 For example, you can set |\babeladjust{bidi.text=off}| if you are using
 an alternative algorithm or with large sections not requiring it. Use
@@ -4722,13 +4716,6 @@ classes. The user will be informed that this
 configuration file has been loaded. This macro is called by
 |\ldf at finish|.
 
-\DescribeMacro{\substitutefontfamily}
-(Deprecated.) This command takes three arguments, a font encoding and
-two font family names. It creates a font description file for the
-first font in the given encoding. This \file{.fd} file will instruct
-\LaTeX\ to use a font from the second family when a font from the
-first family in the given encoding seems to be needed.
-
 \subsection{Skeleton}
 
 Here is the basic structure of an |ldf| file, with a language, a
@@ -5246,8 +5233,6 @@ wouldn’t exist.
 %   compatibility.
 % \item[hyphen.cfg] is the file to be used when generating the
 %   formats to load hyphenation patterns.
-% \item[hyphen.cfg] is the file to be used when generating the
-%   formats to load hyphenation patterns.
 % \end{description}
 % There some additional |tex|, |def| and |lua| files
 %
@@ -5258,9 +5243,11 @@ wouldn’t exist.
 % $\langle\langle$\textit{name}=\textit{value}$\rangle\rangle$, or with
 % a series of lines between
 % $\langle\langle$|*|\textit{name}$\rangle\rangle$ and
-% $\langle\langle$|/|\textit{name}$\rangle\rangle$. They are first
-% extracted to |dummy.log| in a preliminary pass. That brings a little
-% bit of literate programming.
+% $\langle\langle$|/|\textit{name}$\rangle\rangle$. The latter is
+% cumulative (eg, with \textit{More package options}). That brings a
+% little bit of literate programming. The guards |<-name>| and
+% |<+name>| have been redefined, too. See |babel.ins| for further
+% details.
 %
 % \section{\texttt{locale} directory}
 %
@@ -5281,8 +5268,8 @@ wouldn’t exist.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.88.12172>>
-%<<date=2023/05/01>>
+%<<version=3.88.12632>>
+%<<date=2023/05/06>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -5847,6 +5834,8 @@ wouldn’t exist.
 \bbl at csarg\let{tempa\expandafter}\csname opt at babel.sty\endcsname
 \def\bbl at tempb#1.#2{%  Remove trailing dot
    #1\ifx\@empty#2\else,\bbl at afterfi\bbl at tempb#2\fi}%
+\def\bbl at tempe#1=#2\@@{%
+  \bbl at csarg\edef{mod@#1}{\bbl at tempb#2}}
 \def\bbl at tempd#1.#2\@nnil{%  TODO. Refactor lists?
   \ifx\@empty#2%
     \edef\bbl at tempc{\ifx\bbl at tempc\@empty\else\bbl at tempc,\fi#1}%
@@ -5856,12 +5845,17 @@ wouldn’t exist.
       \edef\bbl at tempc{%
         \ifx\bbl at tempc\@empty\else\bbl at tempc,\fi#1.\bbl at tempb#2}%
     \else
-      \in@{=}{#1}%
+      \in@{$modifiers$}{$#1$}% TODO. Allow spaces.
       \ifin@
-        \edef\bbl at tempc{\ifx\bbl at tempc\@empty\else\bbl at tempc,\fi#1.#2}%
+        \bbl at tempe#2\@@
       \else   
-        \edef\bbl at tempc{\ifx\bbl at tempc\@empty\else\bbl at tempc,\fi#1}%
-        \bbl at csarg\edef{mod@#1}{\bbl at tempb#2}%
+        \in@{=}{#1}%
+        \ifin@
+          \edef\bbl at tempc{\ifx\bbl at tempc\@empty\else\bbl at tempc,\fi#1.#2}%
+        \else
+          \edef\bbl at tempc{\ifx\bbl at tempc\@empty\else\bbl at tempc,\fi#1}%
+          \bbl at csarg\edef{mod@#1}{\bbl at tempb#2}%
+        \fi
       \fi
     \fi
   \fi}
@@ -6098,6 +6092,7 @@ wouldn’t exist.
 \ifx\AtBeginDocument\@undefined  % TODO. change test.
   <@Emulate LaTeX@>
 \fi
+<@Basic macros@>
 %    \end{macrocode}
 %
 % That is all for the moment. Now follows some common stuff, for both
@@ -6233,6 +6228,7 @@ wouldn’t exist.
     \fi
   \fi\fi}
 \let\bbl at initoload\relax
+%<-core>
 \def\bbl at provide@locale{%
   \ifx\babelprovide\@undefined
     \bbl at error{For a language to be defined on the fly 'base'\\%
@@ -6265,6 +6261,7 @@ wouldn’t exist.
       {\bbl at exp{\\\babelprovide[\bbl at autoload@options]{\languagename}}}%
       {}%
   \fi}
+%<+core>
 %    \end{macrocode}
 %
 %  \begin{macro}{\iflanguage}
@@ -7075,7 +7072,6 @@ wouldn’t exist.
     \input luababel.def
   \fi
 \fi
-<@Basic macros@>
 \bbl at trace{Compatibility with language.def}
 \ifx\bbl at languages\@undefined
   \ifx\directlua\@undefined
@@ -7212,7 +7208,7 @@ wouldn’t exist.
 \newcommand\EnableBabelHook[1]{\bbl at csarg\let{hk@#1}\@firstofone}
 \newcommand\DisableBabelHook[1]{\bbl at csarg\let{hk@#1}\@gobble}
 \def\bbl at usehooks{\bbl at usehooks@lang\languagename}
-\def\bbl at usehooks@lang#1#2#3{%
+\def\bbl at usehooks@lang#1#2#3{% Test for Plain
   \ifx\UseHook\@undefined\else\UseHook{babel/*/#2}\fi
   \def\bbl at elth##1{%
     \bbl at cs{hk@##1}{\bbl at cs{ev@##1@#2@}#3}}%
@@ -7238,7 +7234,7 @@ wouldn’t exist.
   beforeextras=0,afterextras=0,stopcommands=0,stringprocess=0,%
   hyphenation=2,initiateactive=3,afterreset=0,foreign=0,foreign*=0,%
   beforestart=0,languagename=2,begindocument=1}
-\ifx\NewHook\@undefined\else
+\ifx\NewHook\@undefined\else % Test for Plain (?)
   \def\bbl at tempa#1=#2\@@{\NewHook{babel/#1}}
   \bbl at foreach\bbl at evargs{\bbl at tempa#1\@@}
 \fi
@@ -9729,6 +9725,7 @@ wouldn’t exist.
 %    \begin{macrocode}
 \bbl at trace{Bidi layout}
 \providecommand\IfBabelLayout[3]{#3}%
+%<-core>
 \newcommand\BabelPatchSection[1]{%
   \@ifundefined{#1}{}{%
     \bbl at exp{\let\<bbl at ss@#1>\<#1>}%
@@ -9762,6 +9759,7 @@ wouldn’t exist.
      \select at language@x{\bbl at main@language}}}{}
 \IfBabelLayout{captions}%
   {\BabelPatchSection{caption}}{}
+%<+core>
 %    \end{macrocode}
 %
 % \subsection{Load engine specific macros}
@@ -9795,6 +9793,8 @@ wouldn’t exist.
 %
 % \subsection{Creating and modifying languages}
 %
+% Continue with \LaTeX{} only.
+%
 % |\babelprovide| is a general purpose tool for creating and modifying
 % languages. It creates the language infrastructure, and loads, if
 % requested, an |ini| file. It may be used in conjunction to previouly
@@ -11277,7 +11277,6 @@ wouldn’t exist.
 %<<*More package options>>
 \DeclareOption{ensureinfo=off}{}
 %<</More package options>>
-%
 \let\bbl at ensureinfo\@gobble
 \newcommand\BabelEnsureInfo{%
   \ifx\InputIfFileExists\@undefined\else
@@ -11453,29 +11452,6 @@ wouldn’t exist.
   \let\bbl at encoding@select at off\@empty}
 %    \end{macrocode}
 %
-% As the final task, load the code for lua. TODO: use babel name, override 
-%
-%    \begin{macrocode}
-%</package>
-%<*package|core>
-\ifx\directlua\@undefined\else
-  \ifx\bbl at luapatterns\@undefined
-    \input luababel.def
-  \fi
-\fi
-%</package|core>
-%<*core>
-\let\bbl at ensureinfo\relax
-\let\bbl at provide@locale\relax
-%</core>
-%<*package>
-%    \end{macrocode}
-%
-% Continue with \LaTeX{}.
-%
-%    \begin{macrocode}
-%    \end{macrocode}
-%
 % \subsection{Cross referencing macros}
 %
 % The \LaTeX\ book states:
@@ -11964,7 +11940,7 @@ wouldn’t exist.
 %
 % \begin{macro}{\substitutefontfamily}
 %
-% Deprecated. Use the tools provides by \LaTeX. The command
+% \textit{Deprecated.} Use the tools provides by \LaTeX. The command
 % |\substitutefontfamily| creates an \file{.fd} file on the fly. The
 % first argument is an encoding mnemonic, the second and third
 % arguments are font family names.
@@ -24279,6 +24255,8 @@ Babel.cjk_breaks = {
 \let\bbl at opt@shorthands\@nnil
 \def\bbl at ifshorthand#1#2#3{#2}%
 \let\bbl at language@opts\@empty
+\let\bbl at ensureinfo\@gobble
+\let\bbl at provide@locale\relax
 \ifx\babeloptionstrings\@undefined
   \let\bbl at opt@strings\@nnil
 \else
diff --git a/babel.ins b/babel.ins
index dadfc2f..c6e761b 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{2023/05/01}
+\def\filedate{2023/05/06}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
@@ -105,6 +105,32 @@
     \expandafter\gdef\csname #1Var\endcsname{#2}%
   \fi}
 
+% The following is somewhat hackish, but it does the job for babel, and
+% must be used in the following way: <-name> starts a block to be
+% ignored if 'name' is active, and <+name> ends the block (in this
+% order). Used to exclude some parts from babel.def. With the original
+% definitions, some code goes 'visually' in comments/documentation, but
+% with this change they are in the real code. However, it must be
+% considered temporal, because the solution must be to reorganize the
+% code.
+
+\let\bblMinus\minusOption
+\def\minusOption-#1>#2\endLine{%
+  \global\let\bblactivefiles\activefiles
+  \def\tempa{}%
+  \def\do##1##2##3{%
+    \def\tempb{#1}\def\tempc{##2}%
+    \ifx\tempb\tempc\else
+      \expandafter\def\expandafter\tempa\expandafter{%
+        \tempa\do##1{##2}##3}%
+    \fi}%
+  \activefiles
+  \let\activefiles\tempa}
+
+\let\bblPlus\plusOption
+\def\plusOption+#1>#2\endLine{%
+  \let\activefiles\bblactivefiles}
+
 % Preambles
 
 \declarepreamble\mainpreamble
@@ -153,6 +179,9 @@
          }
 
 % compatibility files
+
+\let\minusOption\bblMinus
+\let\plusOption\bblPlus
 \def\compatfile#1{\file{#1.sty}{\from{bbcompat.dtx}{styfile,#1}}}
 
 \generate{%
@@ -252,5 +281,3 @@
 \Msg{* Happy TeXing}
 \Msg{*}
 \Msg{***********************************************************}
-
-
diff --git a/babel.pdf b/babel.pdf
index 4942aff..3ca2e34 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index d67643b..bc1a2f9 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2023/05/01 v3.88.12172]
+\ProvidesFile{bbcompat.dtx}[2023/05/06 v3.88.12632]
 %</dtx>
 %
 %% File 'bbcompat.dtx'
diff --git a/locale/sr/babel-serbian-ijekavsk.tex b/locale/sr/babel-serbian-ijekavsk.tex
new file mode 100644
index 0000000..ceaed77
--- /dev/null
+++ b/locale/sr/babel-serbian-ijekavsk.tex
@@ -0,0 +1,12 @@
+% This file is part of babel. For further details see:
+% https://www.ctan.org/pkg/babel
+\ifx\BabelBeforeIni\undefined
+  \PackageError{babel}%
+    {This file is a component of babel and cannot\MessageBreak
+     be loaded directly. I'll stop immediately}%
+    {Just use babel as documented.}%
+  \stop
+\fi
+\BabelBeforeIni{sr-ijekavsk}{%
+}
+\endinput
\ No newline at end of file
diff --git a/locale/sr/babel-serbian-latn-ijekavsk.tex b/locale/sr/babel-serbian-latn-ijekavsk.tex
new file mode 100644
index 0000000..632c1b6
--- /dev/null
+++ b/locale/sr/babel-serbian-latn-ijekavsk.tex
@@ -0,0 +1,12 @@
+% This file is part of babel. For further details see:
+% https://www.ctan.org/pkg/babel
+\ifx\BabelBeforeIni\undefined
+  \PackageError{babel}%
+    {This file is a component of babel and cannot\MessageBreak
+     be loaded directly. I'll stop immediately}%
+    {Just use babel as documented.}%
+  \stop
+\fi
+\BabelBeforeIni{sr-Latn-ijekavsk}{%
+}
+\endinput
\ No newline at end of file





More information about the latex3-commits mailing list.