[latex3-commits] [git/LaTeX3-latex3-babel] master: [Unstable] BCP 47 lookup. Fix name of \guillemetleft/right. (fb95f1d)
Javier
email at dante.de
Sat Apr 18 09:55:28 CEST 2020
Repository : https://github.com/latex3/babel
On branch : master
Link : https://github.com/latex3/babel/commit/fb95f1d0b367face8c50da3ee1c9d8aa2a164a28
>---------------------------------------------------------------
commit fb95f1d0b367face8c50da3ee1c9d8aa2a164a28
Author: Javier <email at localhost>
Date: Sat Apr 18 09:55:28 2020 +0200
[Unstable] BCP 47 lookup. Fix name of \guillemetleft/right.
>---------------------------------------------------------------
fb95f1d0b367face8c50da3ee1c9d8aa2a164a28
README.md | 3 +-
babel.dtx | 164 ++++++++++++++++++++++++++++++++++++++++++++++-------------
babel.ins | 2 +-
babel.pdf | Bin 769430 -> 773241 bytes
bbcompat.dtx | 2 +-
5 files changed, 134 insertions(+), 37 deletions(-)
diff --git a/README.md b/README.md
index 4c0d513..a91688f 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.42.1977
+## Babel 3.42.1981
This package manages culturally-determined typographical (and other)
rules, and hyphenation patterns for a wide range of languages. Many
@@ -45,6 +45,7 @@ respective authors.
```
3.43 2020-04-??
+ - Autoloading based on the BCP47 codes, with basic lookup.
- Only a few essential commands are loaded with the format.
- Improvements in Assamese and Finnish.
- Fix - Babel reset the \sfcode of » to 1000. It should be 0.
diff --git a/babel.dtx b/babel.dtx
index d63fca4..edc628e 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -31,7 +31,7 @@
%
% \iffalse
%<*filedriver>
-\ProvidesFile{babel.dtx}[2020/04/14 v3.42.1977 The Babel package]
+\ProvidesFile{babel.dtx}[2020/04/18 v3.42.1981 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
@@ -4465,8 +4465,8 @@ help from Bernd Raichle, for which I am grateful.
% \section{Tools}
%
% \begin{macrocode}
-%<<version=3.42.1977>>
-%<<date=2020/04/14>>
+%<<version=3.42.1981>>
+%<<date=2020/04/18>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -4878,6 +4878,30 @@ help from Bernd Raichle, for which I am grateful.
{\providecommand\bbl at trace[1]{}%
\let\bbl at debug\@gobble}
<@Basic macros@>
+ % Temporarily repeat here the code for errors
+ \def\bbl at error#1#2{%
+ \begingroup
+ \def\\{\MessageBreak}%
+ \PackageError{babel}{#1}{#2}%
+ \endgroup}
+ \def\bbl at warning#1{%
+ \begingroup
+ \def\\{\MessageBreak}%
+ \PackageWarning{babel}{#1}%
+ \endgroup}
+ \def\bbl at infowarn#1{%
+ \begingroup
+ \def\\{\MessageBreak}%
+ \GenericWarning
+ {(babel) \@spaces\@spaces\@spaces}%
+ {Package babel Info: #1}%
+ \endgroup}
+ \def\bbl at info#1{%
+ \begingroup
+ \def\\{\MessageBreak}%
+ \PackageInfo{babel}{#1}%
+ \endgroup}
+ % End of errors
\def\AfterBabelLanguage#1{%
\global\expandafter\bbl at add\csname#1.ldf-h@@k\endcsname}%
% \end{macrocode}
@@ -6564,32 +6588,74 @@ help from Bernd Raichle, for which I am grateful.
% language. If even the fixed name is not defined, will load it on the
% fly, either based on its name, or if activated, its BCP47 code.
%
+% We first need a couple of macros for a simple BCP 47 look up. It also
+% makes sure, with |\bbl at bcpcase|, casing is the correct one, so that
+% sr-latn-ba becomes fr-Latn-BA. Note |#4| may contain some
+% |\@empty|'s, but they are eventually removed. |\bbl at bcplookup| either
+% returns the found |ini| or it is |\relax|.
+%
% \begin{macrocode}
+\def\bbl at bcpcase#1#2#3#4\@@#5{%
+ \ifx\@empty#3%
+ \uppercase{\def#5{#1#2}}%
+ \else
+ \uppercase{\def#5{#1}}%
+ \lowercase{\edef#5{#5#2#3#4}}%
+ \fi}
+\def\bbl at bcplookup#1-#2-#3-#4\@@{%
+ \let\bbl at bcp\relax
+ \lowercase{\def\bbl at tempa{#1}}
+ \ifx\@empty#2%
+ \IfFileExists{babel-\bbl at tempa.ini}{\let\bbl at bcp\bbl at tempa}{}%
+ \else\ifx\@empty#3%
+ \bbl at bcpcase#2\@empty\@empty\@@\bbl at tempb
+ \IfFileExists{babel-\bbl at tempa-\bbl at tempb.ini}%
+ {\edef\bbl at bcp{\bbl at tempa-\bbl at tempb}}%
+ {}%
+ \ifx\bbl at bcp\relax
+ \IfFileExists{babel-\bbl at tempa.ini}{\let\bbl at bcp\bbl at tempa}{}%
+ \fi
+ \else
+ \bbl at bcpcase#2\@empty\@empty\@@\bbl at tempb
+ \bbl at bcpcase#3\@empty\@empty\@@\bbl at tempc
+ \IfFileExists{babel-\bbl at tempa-\bbl at tempb-\bbl at tempc.ini}%
+ {\edef\bbl at bcp{\bbl at tempa-\bbl at tempb-\bbl at tempc}}%
+ {}%
+ \ifx\bbl at bcp\relax
+ \IfFileExists{babel-\bbl at tempa-\bbl at tempc.ini}%
+ {\edef\bbl at bcp{\bbl at tempa-\bbl at tempc}}%
+ {}%
+ \fi
+ \ifx\bbl at bcp\relax
+ \IfFileExists{babel-\bbl at tempa-\bbl at tempc.ini}%
+ {\edef\bbl at bcp{\bbl at tempa-\bbl at tempc}}%
+ {}%
+ \fi
+ \ifx\bbl at bcp\relax
+ \IfFileExists{babel-\bbl at tempa.ini}{\let\bbl at bcp\bbl at tempa}{}%
+ \fi
+ \fi\fi}
\let\bbl at autoload@options\@empty
\def\bbl at provide@locale{%
- % Unfinished. To add: search if loaded with \LocaleForEach. Fallbacks
- % like fr-FR -> fr.
+ % Unfinished. To add: search if loaded with \LocaleForEach?
\let\bbl at auxname\languagename
- \ifbbl at bcpallowed
- \let\bbl at tempa\languagename
- \edef\languagename{bcp47-\languagename}%
- \bbl at fixname\languagename
- \expandafter\ifx\csname date\languagename\endcsname\relax
- \let\languagename\bbl at tempa
- \fi
- \fi
+ \bbl at ifunset{bbl at bcp@map@\languagename}{}%
+ {\edef\languagename{\@nameuse{bbl at bcp@map@\languagename}}}%
\expandafter\ifx\csname date\languagename\endcsname\relax
\IfFileExists{babel-\languagename.tex}%
- {\bbl at exp{\\\babelprovide[\bbl at autoload@options]{\languagename}}}%
- {\ifbbl at bcpallowed
- \IfFileExists{babel-\languagename.ini}%
- {\let\bbl at tempa\languagename
- \bbl at exp{\lowercase{%
- \edef\\\languagename{bcp47-\languagename}%
- \edef\\\localename{bcp47-\localename}}}%
- \bbl at exp{\\\babelprovide[import=\bbl at tempa]{\languagename}}}%
- {}%
- \fi}%
+ {\bbl at exp{\\\babelprovide[\bbl at autoload@options]{\languagename}}}%
+ {\ifbbl at bcpallowed
+ \expandafter
+ \bbl at bcplookup\languagename-\@empty-\@empty-\@empty\@@
+ \ifx\bbl at bcp\relax\else % Returned by \bbl at bcplookup
+ \edef\languagename{\bbl at bcp@prefix\bbl at bcp}%
+ \edef\localename{\bbl at bcp@prefix\bbl at bcp}%
+ \expandafter\ifx\csname date\languagename\endcsname\relax
+ \bbl at exp{\\\babelprovide[import=\bbl at tempa]{\languagename}}%
+ \fi
+ \bbl at csarg\xdef{bcp at map@\bbl at bcp}{\localename}%
+ \fi
+ \fi}%
\fi}
% \end{macrocode}
%
@@ -6823,12 +6889,18 @@ help from Bernd Raichle, for which I am grateful.
\edef\languagename{#1}%
\let\localename\languagename
\else
- \bbl at warning{Using '\string\language' instead of 'language' is\\%
- deprecated. If what you want is to use a macro\\%
- containing the actual locale, make sure it does\\%
- not match any language. '\string\localename' is\\%
- left empty. Reported on }%
- \def\localename{}%
+ \bbl at info{Using '\string\language' instead of 'language' is\\%
+ not recommended. If what you want is to use\\%
+ a macro containing the actual locale, make\\%
+ sure it does not not match any language. I'll\\%
+ try to fix '\string\localename', but I cannot promise\\%
+ anything. Reported on }%
+ \ifx\scantokens\@undefined
+ \def\localename{??}%
+ \else
+ \scantokens\expandafter{\expandafter
+ \def\expandafter\localename\expandafter{\languagename}}%
+ \fi
\fi
\else
\def\localename{#1}% This one has the correct catcodes
@@ -9597,12 +9669,27 @@ help from Bernd Raichle, for which I am grateful.
%
% \end{macro}
%
-% \begin{macro}{\guillemotleft}
-% \begin{macro}{\guillemotright}
+% \begin{macro}{\guillemetleft}
+% \begin{macro}{\guillemetright}
% The guillemet characters are not available in \texttt{OT1}
-% encoding. They are faked.
+% encoding. They are faked. (Wrong names with o preserved for
+% compatibility.)
%
% \begin{macrocode}
+\ProvideTextCommand{\guillemetleft}{OT1}{%
+ \ifmmode
+ \ll
+ \else
+ \save at sf@q{\nobreak
+ \raise.2ex\hbox{$\scriptscriptstyle\ll$}\bbl at allowhyphens}%
+ \fi}
+\ProvideTextCommand{\guillemetright}{OT1}{%
+ \ifmmode
+ \gg
+ \else
+ \save at sf@q{\nobreak
+ \raise.2ex\hbox{$\scriptscriptstyle\gg$}\bbl at allowhyphens}%
+ \fi}
\ProvideTextCommand{\guillemotleft}{OT1}{%
\ifmmode
\ll
@@ -9623,6 +9710,10 @@ help from Bernd Raichle, for which I am grateful.
% \texttt{T1} is used these glyphs can still be typeset.
%
% \begin{macrocode}
+\ProvideTextCommandDefault{\guillemetleft}{%
+ \UseTextSymbol{OT1}{\guillemetleft}}
+\ProvideTextCommandDefault{\guillemetright}{%
+ \UseTextSymbol{OT1}{\guillemetright}}
\ProvideTextCommandDefault{\guillemotleft}{%
\UseTextSymbol{OT1}{\guillemotleft}}
\ProvideTextCommandDefault{\guillemotright}{%
@@ -9840,9 +9931,9 @@ help from Bernd Raichle, for which I am grateful.
%
% \begin{macrocode}
\ProvideTextCommandDefault{\flqq}{%
- \textormath{\guillemotleft}{\mbox{\guillemotleft}}}
+ \textormath{\guillemetleft}{\mbox{\guillemetleft}}}
\ProvideTextCommandDefault{\frqq}{%
- \textormath{\guillemotright}{\mbox{\guillemotright}}}
+ \textormath{\guillemetright}{\mbox{\guillemetright}}}
% \end{macrocode}
%
% \end{macro}
@@ -10976,12 +11067,17 @@ help from Bernd Raichle, for which I am grateful.
\@namedef{bbl at ADJ@hyphenation.extra at on}{%
\bbl at activateposthyphen}
%
+%
\@namedef{bbl at ADJ@autoload.bcp47 at on}{%
\bbl at bcpallowedtrue}
\@namedef{bbl at ADJ@autoload.bcp47 at off}{%
\bbl at bcpallowedfalse}
+\@namedef{bbl at ADJ@autoload.bcp47.prefix}#1{%
+ \def\bbl at bcp@prefix{#1}}
+\def\bbl at bcp@prefix{bcp47-}
\@namedef{bbl at ADJ@autoload.options}#1{%
\def\bbl at autoload@options{#1}}
+% TODO: use babel name, override
%
% As the final task, load the code for lua.
%
diff --git a/babel.ins b/babel.ins
index 50dabf1..a68930d 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{2020/04/14}
+\def\filedate{2020/04/18}
\def\batchfile{babel.ins}
\input docstrip.tex
diff --git a/babel.pdf b/babel.pdf
index 503cc30..0c3defb 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index 5d3526f..9d6db45 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
%
% \iffalse
%<*dtx>
-\ProvidesFile{bbcompat.dtx}[2020/04/14 v3.42.1977]
+\ProvidesFile{bbcompat.dtx}[2020/04/18 v3.42.1981]
%</dtx>
%
%% File 'bbcompat.dtx'
More information about the latex3-commits
mailing list.