From 401c20d6a00afd1b7454fb25a283c88feff3ebfb Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 3 Jun 2019 21:35:43 +0000
Subject: babel (3jun19)

git-svn-id: svn://tug.org/texlive/trunk@51309 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/babel/babel.dtx | 555 +++++++++++++------------
 1 file changed, 278 insertions(+), 277 deletions(-)

(limited to 'Master/texmf-dist/source/latex/babel/babel.dtx')

diff --git a/Master/texmf-dist/source/latex/babel/babel.dtx b/Master/texmf-dist/source/latex/babel/babel.dtx
index c078450624e..5cb3973a67e 100644
--- a/Master/texmf-dist/source/latex/babel/babel.dtx
+++ b/Master/texmf-dist/source/latex/babel/babel.dtx
@@ -31,7 +31,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2019/05/04 v3.31 The Babel package]
+\ProvidesFile{babel.dtx}[2019/06/03 v3.32 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -91,7 +91,7 @@
 \def\verbatim{\begin{shaded*}\bblxv\vskip-\baselineskip\vskip2.5\parsep}
 \def\endverbatim{\bblexv\vskip-2\baselineskip\end{shaded*}}
 \catcode`\_=\active
-\def_{\bgroup\let_\egroup\color{thered}}
+\def_{\bgroup\let_\egroup\leavevmode\color{thered}}
 \def\MacroFont{\fontencoding \encodingdefault \fontfamily\ttdefault
   \fontseries\mddefault \fontshape\updefault \small \catcode`\_=\active}
 \definecolor{shadecolor}{rgb}{0.96,0.96,0.93}
@@ -233,14 +233,14 @@ Javier Bezos
 
 \item  Changes and new features with relation to version 3.8 are
   highlighted with \New{X.XX}\hspace{-.5em}. The most recent features
-  could be still unstable. Please, report any issues you find on      
+  could be still unstable. Please, report any issues you find in      
   \texttt{https://github.com/latex3/babel/issues}, which is better 
   than just complaining on an e-mail list or a web forum.
 
 \item If you are interested in the \TeX{} multilingual support, please
   join the \textsf{kadingira} list on
   \texttt{http://tug.org/mailman/listinfo/kadingira}. You can follow
-  the development of \babel{} on
+  the development of \babel{} in
   \texttt{https://github.com/latex3/babel} (which provides some sample
   files, too).
 
@@ -1212,7 +1212,7 @@ for auxiliary tasks).
   patterns for the latter in \luatex{}. Some quick patterns could help,
   with something similar to:
 \begingroup
-\setmonofont[Script=Lao]{DejaVu Sans Mono}
+\setmonofont[Script=Lao,Scale=MatchLowercase]{DejaVu Sans Mono}
 \begin{verbatim}
 \babelprovide[import,hyphenrules=+]{lao}
 \babelpatterns[lao]{1ດ 1ມ 1ແ 1ອ 1ງ 1ກ 1າ} % Random
@@ -1223,10 +1223,16 @@ for auxiliary tasks).
   language names must be sorted out, so you may need to set them
   explicitly in |\babelfont|, as well as |CJKShape|. \luatex{} does
   basic line breaking, but currently \xetex{} does not (you may load
-  \textsf{zhspacing}). Anyway, CJK texts are are best set with a
+  \textsf{zhspacing}). Although for a few words and shorts texts the
+  |ini| files should be fine, CJK texts are are best set with a
   dedicated framework (\textsf{CJK}, \textsf{luatexja}, \textsf{kotex},
-  \textsf{CTeX}...), although for a few words and shorts texts \babel{}
-  should be fine.
+  \textsf{CTeX}...), . Actually, this is what the |ldf| does in
+  |japanese| with \luatex, because the following piece of code loads 
+  \textsf{luatexja}:
+\begin{verbatim}
+\documentclass{ltjbook}
+\usepackage[japanese]{babel}
+\end{verbatim}
 \end{description}
 \end{note}
 
@@ -2370,7 +2376,10 @@ font encodings are the same, like in Unicode based engines.
 
 \New{3.31} (Only \luatex.) With |\babelprovide| and |import|ed CJK
 languages, a simple generic line breaking algorithm (push-out-first) is
-applied, based on a selection of the Unicode rules.
+applied, based on a selection of the Unicode rules (\New{3.32} it is
+disabled in verbatim mode, or more precisely when the hyphenrules
+are set to |nohyphenation|). It can be activated alternatively by
+setting explicitly the |intraspace|.
 
 \New{3.27} Interword spacing for Thai, Lao and Khemer is activated
 automatically if a language with one of those scripts are loaded with
@@ -2440,11 +2449,12 @@ differ in the way `weak' numeric characters are ordered (eg, Arabic
   essentially stable, but, of course, it is not bug free and there
   could be improvements in the future, because setting bidi text has
   many subtleties (see for example <https://www.w3.org/TR/html-bidi/>).
-  A basic stable version for other engines must wait very likely until
-  (Northern) Winter. This applies to text, but \textbf{graphical}
-  elements, including the |picture| environment and PDF or PS based
-  graphics, are not yet correctly handled (far from trivial). Also,
-  indexes and the like are under study, as well as math.
+  A basic stable version for other engines must wait. This applies to
+  text; there is a basic support for \textbf{graphical} elements,
+  including the |picture| environment (with \textsf{pict2e}) and
+  \textsf{pfg/tikz}. Also, indexes and the like are under study, as
+  well as math (there are progresses in the latter, too, but for
+  example |cases| may fail).
 
   An effort is being made to avoid incompatibilities in the future
   (this one of the reason currently bidi must be explicitly requested
@@ -2456,25 +2466,31 @@ There are some package options controlling bidi writing.
 
 \Describe{bidi=}{\texttt{default} $\string|$ \texttt{basic}
   $\string|$ \texttt{basic-r} $\string|$ \texttt{bidi-l} $\string|$
-  \texttt{bidi-l}}
+  \texttt{bidi-r}}
 
 \New{3.14} Selects the bidi algorithm to be used. With |default| the
 bidi mechanism is just activated (by default it is not), but every
 change must by marked up. In \xetex{} and \pdftex{} this is the only
 option.
 
-In \luatex, |basic-r| provides a simple and fast method for R
-text, which handles numbers and unmarked L text within an R context in
-typical cases. \New{3.19} Finally, |basic| supports both L and R text
-and it is the preferred method (support for |basic-r| is now limited).
-(They are named \texttt{basic} mainly because they only consider the
-intrinsic direction of scripts and weak directionality.)
+In \luatex, |basic-r| provides a simple and fast method for R text,
+which handles numbers and unmarked L text within an R context many in
+typical cases. \New{3.19} Finally, |basic| supports both L and R text,
+and it is the preferred method (support for |basic-r| is currently
+limited). (They are named \texttt{basic} mainly because they only
+consider the intrinsic direction of scripts and weak directionality.)
 
 \New{3.29} In \xetex, |bidi-r| and |bidi-l| resort to the package
 \textsf{bidi} (by Vafa Khalighi). Integration is still somewhat
 tentative, but it mostly works. For RL documents use the former, and
 for LR ones use the latter.
 
+\New{3.32} There is some experimental support for \textsf{harftex}.
+Since it is based on \luatex, the option |basic| mostly works. You may
+need to deactivate the |rtlm| or the |rtla| font features (besides
+loading \textsf{harfload} before \babel and activating |mode=harf|;
+there is a sample in the GitHub repository).
+
 There are samples on GitHub, under \texttt{/required/babel/samples}.
 See particularly |lua-bidibasic.tex| and |lua-secenum.tex|.
 
@@ -2482,11 +2498,7 @@ See particularly |lua-bidibasic.tex| and |lua-secenum.tex|.
   The following text comes from the Arabic Wikipedia (article about
   Arabia). Copy-pasting some text from the Wikipedia is a good way to
   test this feature. Remember |basic-r| is available in \luatex{}
-  only.\footnote{At the time of this writing some Arabic fonts are not
-  rendered correctly by the default \luatex{} font loader, with
-  misplaced kerns inside some words, so double check the resulting
-  text. Have a look at the workaround available on GitHub, under
-  \texttt{/required/babel/samples}}
+  only.
   \begingroup
 % If you are looking at the code to see how it has been written, you
 % will be disappointed :-). The following example is built ad hoc to
@@ -2531,25 +2543,25 @@ _\babelprovide[import, main]{arabic}_
   \setmonofont[Scale=.87,Script=Arabic]{DejaVu Sans Mono} \catcode`@=13
   \def@#1{\ifcase#1\relax \egroup \or \bgroup\textdir TRT \else
   \bgroup\textdir TLT \pardir TLT \fi}
-  \begin{verbatim}
-  \documentclass{book}
+\begin{verbatim}
+\documentclass{book}
 
-  \usepackage[english, _bidi=basic_]{babel}
+\usepackage[english, _bidi=basic_]{babel}
 
-  \babelprovide[_mapfont=direction_]{arabic}
+\babelprovide[_mapfont=direction_]{arabic}
 
-  \babelfont{rm}{Crimson}
-  \babelfont[*arabic]{rm}{FreeSerif}
+\babelfont{rm}{Crimson}
+\babelfont[*arabic]{rm}{FreeSerif}
 
-  \begin{document}
+\begin{document}
 
-  Most Arabic speakers consider the two varieties to be two registers
-  of one language, although the two registers can be referred to in
-  Arabic as @1فصحى العصر@0 \textit{fuṣḥā l-ʻaṣr} (MSA) and
-  @1فصحى التراث@0 \textit{fuṣḥā t-turāth} (CA).
+Most Arabic speakers consider the two varieties to be two registers
+of one language, although the two registers can be referred to in
+Arabic as @1فصحى العصر@0 \textit{fuṣḥā l-ʻaṣr} (MSA) and
+@1فصحى التراث@0 \textit{fuṣḥā t-turāth} (CA).
 
-  \end{document}
-  \end{verbatim}
+\end{document}
+\end{verbatim}
   \endgroup
   In this example, and thanks to |mapfont=direction|, any Arabic letter
   (because the language is |arabic|) changes its font to that set for
@@ -2565,9 +2577,9 @@ _\babelprovide[import, main]{arabic}_
   |\hbox|’es). If you need |\ref| ranges, the best option is to define
   a dedicated macro like this (to avoid explicit direction changes in the
   body; here |\texthe| must be defined to select the main language):
-  \begin{verbatim}
-  \newcommand\refrange[2]{\babelsublr{\texthe{\ref{#1}}-\texthe{\ref{#2}}}}
-  \end{verbatim}
+\begin{verbatim}
+\newcommand\refrange[2]{\babelsublr{\texthe{\ref{#1}}-\texthe{\ref{#2}}}}
+\end{verbatim}
 
   In a future a more complete method, reading recursively boxed text, may
   be added.
@@ -2579,7 +2591,8 @@ _\babelprovide[import, main]{arabic}_
                    \texttt{contents}  $\string|$
                    \texttt{footnotes}  $\string|$
                    \texttt{captions}  $\string|$
-                   \texttt{columns} $\string|$
+                   \texttt{columns} $\string|$                
+                   \texttt{graphics} $\string|$
                    \texttt{extras}}
 
 \New{3.16} \textit{To be expanded}. Selects which layout elements are
@@ -2652,6 +2665,12 @@ bidirectional (with both R and L paragraphs) documents in \luatex{}.
   it might be ignored by some packages and classes (or even raise an
   error). \New{3.18}.
 
+\item[graphics] modifies the |picture| environment so that the whole
+  figure is L but the text is R. It \textit{does not} work with the
+  standard |picture|, and \textit{pict2e} is required if you want
+  sloped lines. It attempts to do the same for \textsf{pgf/tikz}.
+  Somewhat experimental. \New{3.32}.
+
 \item[extras] is used for miscellaneous readjustments which do not fit into
   the previous groups. Currently redefines in \luatex{} |\underline| and
   |\LaTeX2e| \New{3.19}.
@@ -2768,7 +2787,7 @@ options are also used (eg, |\ProsodicMarksOn| in \textsf{latin}).
 events. Some hooks are predefined when \luatex{} and \xetex{} are
 used.
 
-\Describe\AddBabelHook{\marg{name}\marg{event}\marg{code}}
+\Describe{\AddBabelHook}{\marg{name}\marg{event}\marg{code}}
 
 The same name can be applied to several events.  Hooks may be enabled
 and disabled for all defined events with
@@ -2841,7 +2860,7 @@ ones, they only have a single hook and replace a default definition.
   file. Used by \file{luababel.def}.
 \end{description}
 
-\Describe\BabelContentsFiles{}
+\Describe{\BabelContentsFiles}{}
 \New{3.9a} This macro contains a list of ``toc'' types
 requiring a command to switch the language. Its default value is
 |toc,lof,lot|, but you may redefine it with |\renewcommand| (it's up
@@ -2910,8 +2929,9 @@ ibygreek, bgreek, serbianc, frenchle, ethiop} and \textsf{friulan}.
 
 Most of them work out of the box, but some may require extra fonts,
 encoding files, a preprocessor or even a complete framework (like
-CJK).  For example, if you have got the \textsf{velthuis/devnag} package,
-you can create a file with extension |.dn|:
+\textsf{CJK} or \textsf{luatexja}). For example, if you have got the
+\textsf{velthuis/devnag} package, you can create a file with extension
+|.dn|:
 \begin{verbatim}
 \documentclass{article}
 \usepackage[hindi]{babel}
@@ -2922,11 +2942,31 @@ you can create a file with extension |.dn|:
 Then you preprocess it with |devnag| \m{file}, which creates
 \m{file}|.tex|; you can then typeset the latter with \LaTeX.
 
-\begin{note}
-  Please, for info about the support in luatex for some complex scripts,
-  see the wiki, on \texttt{https://github.com/latex3/latex2e/wiki/%
-  Babel:-Remarks-on-the-luatex-support-for-some-scripts}.
-\end{note}
+\subsection{Unicode character properties in \luatex}
+
+\New{3.32} Part of the \babel{} job is to apply Unicode rules to some
+script-specific features based on some properties. Currently, they are
+3, namely, direction (ie, bidi class), mirroring glyphs, and line
+breaking for CJK scripts. These properties are stored in \textsf{lua}
+tables, which you can modify with the following macro.
+
+\Describe{\babelcharproperty}{\marg{char-code}\oarg{to-char-code}%
+          \marg{propertry}\marg{value}}
+
+\New{3.32} Here, \marg{char-code} is a number (with \TeX{} syntax).
+With the optional argument, you can set a range of values. There are
+three properties (with a short name, taken from Unicode): |direction|
+(|bc|), |mirror| (|bmg|), |linebreak| (|lb|). The settings are global.
+          
+For example:
+\begin{verbatim}
+\babelcharproperty{`¿}{mirror}{`?}   
+\babelcharproperty{`-}{direction}{l}  % or al, r, en, an, on, et, cs
+\babelcharproperty{`)}{linebreak}{cl} % or id, op, cl, ns, ex, in, hy
+\end{verbatim}
+
+This command is allowed only in vertical mode (the preamble or between
+paragraphs).
 
 \subsection{Tips, workarounds, know issues and notes}
 
@@ -3896,8 +3936,6 @@ help from Bernd Raichle, for which I am grateful.
 %
 % \fi
 %
-% \changes{babel~3.8e}{2005/03/24}{Many enhancements to the text by
-%    Andrew Young}
 % \changes{babel~3.9c}{2013/04/04}{Added the ``modifiers'' mechanism}
 % \changes{babel~3.9g}{2013/06/01}{bbplain merged}
 % \changes{babel~3.9k}{2014/03/23}{Code and doc reorganized, and some
@@ -3997,8 +4035,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.31>>
-%<<date=2019/05/04>>
+%<<version=3.32>>
+%<<date=2019/06/03>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -4111,7 +4149,6 @@ help from Bernd Raichle, for which I am grateful.
 %    \end{macrocode}
 % \end{macro}
 %
-%
 % \begin{macro}{\bbl@ifunset}
 %   To check if a macro is defined, we create a new macro, which does
 %   the same as |\@ifundefined|. However, in an $\epsilon$-tex engine,
@@ -4203,6 +4240,32 @@ help from Bernd Raichle, for which I am grateful.
   \expandafter\bbl@replace@aux#1#2\bbl@nil#2%
   \edef#1{\the\toks@}}
 %    \end{macrocode}
+%
+% An extensison to the previous macro. It takes into account the
+% parameters, and it is string based (ie, if you replace |elax| by
+% |ho|, then |\relax| becomes |\rho|). No checking is done at all,
+% because it is not a general purpose macro, and it is used by \babel{}
+% only when it works (an example where it does \textit{not} work is in
+% |\bbl@TG@@date|). It may change! (to add new features).
+%
+%    \begin{macrocode}
+\expandafter\def\expandafter\bbl@parsedef\detokenize{macro:}#1->#2\relax{%
+  \def\bbl@tempa{#1}%
+  \def\bbl@tempb{#2}}
+\def\bbl@sreplace#1#2#3{%
+  \begingroup
+    \expandafter\bbl@parsedef\meaning#1\relax
+    \def\bbl@tempc{#2}%
+    \edef\bbl@tempc{\expandafter\strip@prefix\meaning\bbl@tempc}%
+    \def\bbl@tempd{#3}%
+    \edef\bbl@tempd{\expandafter\strip@prefix\meaning\bbl@tempd}%
+    \bbl@exp{\\\bbl@replace\\\bbl@tempb{\bbl@tempc}{\bbl@tempd}}%
+    \bbl@exp{%
+  \endgroup
+  \\\makeatletter % "internal" macros with @ are assumed
+  \\\scantokens{\def\\#1\bbl@tempa{\bbl@tempb}}%
+  \catcode64=\the\catcode64\relax}} % Restore @
+%    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\bbl@exp}
@@ -4391,7 +4454,6 @@ help from Bernd Raichle, for which I am grateful.
 %    compatibility issues with other packages an defines a few
 %    aditional package options.
 %
-%
 %    Apart from all the language options below we also have a few options
 %    that influence the behavior of language definition files.
 %
@@ -4445,6 +4507,7 @@ help from Bernd Raichle, for which I am grateful.
 %
 % \changes{babel~3.30}{2019/04/22}{Callbacks aren't specific to
 %   bidi any more, so they are moved.}
+% \changes{babel~3.32}{2019/05/30}{Consider Harf.}
 %
 %    \begin{macrocode}
 \ifx\bbl@languages\@undefined\else
@@ -4466,6 +4529,8 @@ help from Bernd Raichle, for which I am grateful.
   \bbl@languages
 \fi
 \ifodd\bbl@engine
+  % Harftex is evolving, so the callback is not harcoded, just in case
+  \def\bbl@harfpreline{Harf pre_linebreak_filter callback}%
   \def\bbl@activate@preotf{%
     \let\bbl@activate@preotf\relax  % only once
     \directlua{
@@ -4498,13 +4563,19 @@ help from Bernd Raichle, for which I am grateful.
         Babel.pre_otfload_v,
         'Babel.pre_otfload_v',
         luatexbase.priority_in_callback('pre_linebreak_filter',
-          'luaotfload.node_processor') or nil)
+           '\bbl@harfpreline') 
+        or luatexbase.priority_in_callback('pre_linebreak_filter',
+           'luaotfload.node_processor')
+        or nil)
       %
       luatexbase.add_to_callback('hpack_filter',
         Babel.pre_otfload_h,
         'Babel.pre_otfload_h',
         luatexbase.priority_in_callback('hpack_filter',
-          'luaotfload.node_processor') or nil)
+           '\bbl@harfpreline') 
+        or luatexbase.priority_in_callback('hpack_filter',
+           'luaotfload.node_processor')
+        or nil)
     }}
   \let\bbl@tempa\relax
   \@ifpackagewith{babel}{bidi=basic}%
@@ -5162,7 +5233,6 @@ help from Bernd Raichle, for which I am grateful.
     \lowercase{\endgroup#1~}}
 %    \end{macrocode}
 %
-%
 %  \begin{macro}{\bbl@redefine}
 %    To redefine a command, we save the old meaning of the macro.
 %    Then we redefine it to call the original macro with the
@@ -5332,6 +5402,10 @@ help from Bernd Raichle, for which I am grateful.
   \def\<bbl@e@#2>{\the\toks@{\bbl@ens@fontenc}}}}
 \def\bbl@ensure#1#2#3{% 1: include 2: exclude 3: fontenc
   \def\bbl@tempb##1{% elt for (excluding) \bbl@captionslist list
+    \ifx##1\@undefined % 3.32 - Don't assume the macros exists
+      \edef##1{\noexpand\bbl@nocaption
+        {\bbl@stripslash##1}{\languagename\bbl@stripslash##1}}%
+    \fi
     \ifx##1\@empty\else
       \in@{##1}{#2}%
       \ifin@\else
@@ -5502,8 +5576,6 @@ help from Bernd Raichle, for which I am grateful.
 %    to switch to the correct language at the beginning of the
 %    document.
 %
-% \changes{babel~3.8l}{2008/07/06}{Use \cs{bbl@patterns}}
-%
 %    \begin{macrocode}
 \def\main@language#1{%
   \def\bbl@main@language{#1}%
@@ -5805,7 +5877,6 @@ help from Bernd Raichle, for which I am grateful.
 %    single character shorthand. If that doesn't exist we check for a
 %    shorthand with an argument.
 %
-% \changes{babel~3.8b}{2004/04/19}{Now use \cs{bbl@sh@select}}
 % \changes{babel~3.9a}{2012/08/18}{Instead of the ``copy-paste pattern''
 % a new macro is used}
 %
@@ -5910,7 +5981,6 @@ help from Bernd Raichle, for which I am grateful.
 %    will expand to either |\bbl@firstcs| or |\bbl@scndcs|. Hence two
 %    more arguments need to follow it.
 %
-% \changes{babel~3.8b}{2004/04/19}{Added command}
 % \changes{babel~3.9a}{2012/08/18}{Removed \cs{string}s, because the
 %   char are already string'ed}
 %
@@ -6029,9 +6099,6 @@ help from Bernd Raichle, for which I am grateful.
 %    \item the code to be executed when the shorthand is encountered.
 %    \end{enumerate}
 %
-% \changes{babel~3.8b}{2004/04/19}{We need to support shorthands with
-%    and without argument in different groups; added the name of the
-%    group to the storage macro}
 % \changes{babel~3.9a}{2012/07/03}{Check if shorthands are redefined}
 %
 %    \begin{macrocode}
@@ -6233,8 +6300,6 @@ help from Bernd Raichle, for which I am grateful.
 %
 %  \begin{macro}{\@notshorthand}
 %
-% \changes{v3.8d}{2004/11/20}{Error message added}
-%
 %    \begin{macrocode}
 \def\@notshorthand#1{%
   \bbl@error{%
@@ -7605,9 +7670,6 @@ help from Bernd Raichle, for which I am grateful.
 %  \begin{macro}{\glq}
 %  \begin{macro}{\grq}
 %
-% \changes{babel~3.8b}{2004/05/02}{Made \cs{glq} fontencoding
-%    dependent as well}
-%
 %    The `german' single quotes.
 %
 %    \begin{macrocode}
@@ -7636,9 +7698,6 @@ help from Bernd Raichle, for which I am grateful.
 %  \begin{macro}{\glqq}
 %  \begin{macro}{\grqq}
 %
-% \changes{babel~3.8b}{2004/05/02}{Made \cs{grqq} fontencoding
-%    dependent as well}
-%
 %    The `german' double quotes.
 %
 %    \begin{macrocode}
@@ -7667,9 +7726,6 @@ help from Bernd Raichle, for which I am grateful.
 %  \begin{macro}{\flq}
 %  \begin{macro}{\frq}
 %
-% \changes{babel~3.8b}{2004/05/02}{Made \cs{flq} and \cs{frq}
-%    fontencoding dependent}
-%
 %    The `french' single guillemets.
 %
 %    \begin{macrocode}
@@ -7685,9 +7741,6 @@ help from Bernd Raichle, for which I am grateful.
 %  \begin{macro}{\flqq}
 %  \begin{macro}{\frqq}
 %
-% \changes{babel~3.8b}{2004/05/02}{Made \cs{flqq} and \cs{frqq}
-%    fontencoding dependent}
-%
 %    The `french' double guillemets.
 %
 %    \begin{macrocode}
@@ -7711,9 +7764,6 @@ help from Bernd Raichle, for which I am grateful.
 %
 %  \begin{macro}{\umlauthigh}
 %
-% \changes{v3.8a}{2004/02/19}{Use \cs{leavevmode}\cs{bgroup} to
-%    prevent problems when this command occurs in vertical mode.}
-%
 %  \begin{macro}{\umlautlow}
 %    To be able to provide both positions of |\"| we provide two
 %    commands to switch the positioning, the default will be
@@ -7755,9 +7805,6 @@ help from Bernd Raichle, for which I am grateful.
 %    we'll change this font dimension and this is always done
 %    globally.
 %
-% \changes{v3.8a}{2004/02/19}{Use \cs{leavevmode}\cs{bgroup} to
-%    prevent problems when this command occurs in vertical mode.}
-%
 %    Then we compute the new x-height in such a way that the umlaut
 %    character is lowered to the base character.  The value of
 %    \texttt{.45ex} depends on the \MF\ parameters with which the
@@ -7907,6 +7954,8 @@ help from Bernd Raichle, for which I am grateful.
 % \changes{3.30}{2019/04/22}{Native digits (lua level).}
 % \changes{3.30}{2019/04/22}{New attribute in luatex for `locale'. Also
 %   \cs{localeid}}
+% \changes{3.32}{2019/05/30}{Activate CJK line breaking  with an explicit
+%   intraspace.}
 %
 %    \begin{macrocode}
 \bbl@trace{Creating languages and reading ini files}
@@ -8008,11 +8057,14 @@ help from Bernd Raichle, for which I am grateful.
     \fi
     \bbl@exp{\\\bbl@add\\\bbl@mapselect{\\\bbl@mapdir{\languagename}}}%
   \fi
-  % For Southeast Asian, if interspace in ini -- TODO: as hook
+  % For East Asian, Southeast Asian, if interspace in ini - TODO: as hook?
+  \ifx\bbl@KVP@intraspace\@nil\else % We may override the ini
+    \bbl@csarg\edef{intsp@#2}{\bbl@KVP@intraspace}%
+  \fi
   \ifcase\bbl@engine\or
     \bbl@ifunset{bbl@intsp@\languagename}{}%
       {\expandafter\ifx\csname bbl@intsp@\languagename\endcsname\@empty\else
-         \bbl@xin@{\bbl@cs{sbcp@\languagename}}{Hant,Hans,Jpan,Kore}%
+         \bbl@xin@{\bbl@cs{sbcp@\languagename}}{Hant,Hans,Jpan,Kore,Kana}%
          \ifin@
            \bbl@cjkintraspace
            \directlua{
@@ -8020,19 +8072,13 @@ help from Bernd Raichle, for which I am grateful.
                Babel.locale_props = Babel.locale_props or {}
                Babel.locale_props[\the\localeid].linebreak = 'c'
            }%
-           \ifx\bbl@KVP@intraspace\@nil
-              \bbl@exp{%
-                \\\bbl@intraspace\bbl@cs{intsp@\languagename}\\\@@}%
-           \fi
+           \bbl@exp{\\\bbl@intraspace\bbl@cs{intsp@\languagename}\\\@@}%
            \ifx\bbl@KVP@intrapenalty\@nil
              \bbl@intrapenalty0\@@
            \fi 
          \else
            \bbl@seaintraspace
-           \ifx\bbl@KVP@intraspace\@nil
-              \bbl@exp{%
-                \\\bbl@intraspace\bbl@cs{intsp@\languagename}\\\@@}%
-           \fi
+           \bbl@exp{\\\bbl@intraspace\bbl@cs{intsp@\languagename}\\\@@}%
            \directlua{
               Babel = Babel or {}
               Babel.sea_ranges = Babel.sea_ranges or {}
@@ -8044,9 +8090,6 @@ help from Bernd Raichle, for which I am grateful.
            \fi
          \fi
        \fi
-       \ifx\bbl@KVP@intraspace\@nil\else % We may override the ini
-         \expandafter\bbl@intraspace\bbl@KVP@intraspace\@@
-       \fi
        \ifx\bbl@KVP@intrapenalty\@nil\else
          \expandafter\bbl@intrapenalty\bbl@KVP@intrapenalty\@@
        \fi}%
@@ -8905,18 +8948,11 @@ help from Bernd Raichle, for which I am grateful.
 %    with the text that is put into them. To achieve this we need to
 %    adapt the definition of |\markright| and |\markboth| somewhat.
 %
-% \changes{babel~3.8c}{2004/05/26}{No need to add \emph{anything} to
-%    an empty mark; prevented this by checking the contents of the
-%    argument}
-% \changes{babel~3.8f}{2005/05/15}{Make the definition independent of
-%    the original definition; expand \cs{languagename} before passing
-%    it into the token registers}
 % \changes{babel~3.9t}{2017/04/23}{Refactored \cs{markright} and
 %    \cs{markboth}}
 % \changes{babel~3.23}{2018/09/01}{Trick to isolate the bidi in page 
 %    numbers}
 %
-%
 %    We check whether the argument is empty; if it is, we just make
 %    sure the scratch token register is empty.  Next, we store the
 %    argument to |\markright| in the scratch token register. This way
@@ -8958,15 +8994,6 @@ help from Bernd Raichle, for which I am grateful.
 %    |\@mkboth| has already been set. If so we neeed to do that again
 %    with the new definition of |\markboth|.
 %
-% \changes{babel~3.8c}{2004/05/26}{No need to add \emph{anything} to
-%    an empty mark, prevented this by checking the contents of the
-%    arguments}
-% \changes{babel~3.8f}{2005/05/15}{Make the definition independent of
-%    the original definition; expand \cs{languagename} before passing
-%    it into the token registers}
-% \changes{babel~3.8j}{2008/03/21}{Added setting of \cs{@mkboth} (PR
-%    3826)}
-%
 %    \begin{macrocode}
    \ifx\@mkboth\markboth
      \def\bbl@tempc{\let\@mkboth\markboth}
@@ -9085,10 +9112,6 @@ help from Bernd Raichle, for which I am grateful.
 %  \begin{macro}{\vrefpagenum}
 %  \begin{macro}{\Ref}
 %
-% \changes{babel~3.8g}{2005/05/21}{We also need to adapt \cs{Ref}
-%    which needs to be able to uppercase the first letter of the
-%    expansion of \cs{ref}}
-%
 %    When the package varioref is in use we need to modify its
 %    internal command |\@@vpageref| in order to prevent problems when
 %    an active character ends up in the argument of |\vref|.
@@ -9152,9 +9175,6 @@ help from Bernd Raichle, for which I am grateful.
 %    Then we check whether the expansion of |\normal@char:| is not
 %    equal to |\relax|.
 %
-% \changes{babel~3.8b}{2004/04/19}{added \cs{string} to prevent
-%    unwanted expansion of the colon}
-%
 %    \begin{macrocode}
       {\expandafter\ifx\csname normal@char\string:\endcsname\relax
        \else
@@ -9177,9 +9197,6 @@ help from Bernd Raichle, for which I am grateful.
 %
 %  \begin{macro}{\pdfstringdefDisableCommands}
 %
-% \changes{babel~3.8j}{2008/03/16}{Inform \pkg{hyperref} to use
-%    shorthands at system level (PR4006)}
-%
 %    A number of interworking problems between \pkg{babel} and
 %    \pkg{hyperref} are tackled by \pkg{hyperref} itself. The
 %    following code was introduced to prevent some annoying warnings
@@ -10016,7 +10033,6 @@ help from Bernd Raichle, for which I am grateful.
 %    update the value of |\language| and call |\originalTeX|
 %    to bring \TeX\ in a certain pre-defined state.
 %
-% \changes{babel~3.8l}{2008/07/06}{Use \cs{bbl@patterns}}
 % \changes{babel~3.9a}{2012/07/27}{Moved \cs{bbl@patterns} to the
 %    correct place, after setting the extras for the current
 %    language}
@@ -10293,7 +10309,6 @@ help from Bernd Raichle, for which I am grateful.
 %
 %  \begin{macro}{\bbl@patterns}
 %
-% \changes{babel~3.8l}{2008/07/06}{Macro added}
 % \changes{babel~3.9a}{2012/08/28}{Extended to set hyphenation
 %    exceptions as defined with \cs{babelhyphenation}}
 % \changes{babel~3.9m}{2015/07/25}{Preset \cs{bbl@pttnlist} and
@@ -10354,9 +10369,6 @@ help from Bernd Raichle, for which I am grateful.
 %    |\lccode|'s and font encodings are not set at all, so in most
 %    cases you should use |otherlanguage*|.
 %
-% \changes{babel~3.8j}{2008/03/16}{Also set the hyphenmin parameters to
-%    the correct value (PR3997)}
-% \changes{babel~3.8l}{2008/07/06}{Use \cs{bbl@patterns}}
 % \changes{3.15}{2017/10/30}{Don't set language name. Use temp macro.}
 % \changes{3.15}{2018/02/14}{Fix - didn't work with polyglossia}
 %
@@ -10675,7 +10687,6 @@ help from Bernd Raichle, for which I am grateful.
 <@Define core switching macros@>
 %    \end{macrocode}
 %
-%
 %  \begin{macro}{\process@line}
 %    Each line in the file \file{language.dat} is processed by
 %    |\process@line| after it is read. The first thing this macro does
@@ -10957,9 +10968,6 @@ help from Bernd Raichle, for which I am grateful.
 %    Check for the end of the file. We must reverse the test for
 %    |\ifeof| without |\else|. Then reactivate the default patterns.
 %
-% \changes{babel~3.8m}{2008/07/08}{Also restore the name of the
-%    language in \cs{languagename} (PR 4039)}
-%
 %    \begin{macrocode}
   \begingroup
     \def\bbl@elt#1#2#3#4{%
@@ -11290,7 +11298,6 @@ help from Bernd Raichle, for which I am grateful.
 %<</Font selection>>
 %    \end{macrocode}
 %
-%
 % \section{Hooks for XeTeX and LuaTeX}
 %
 % \subsection{XeTeX}
@@ -11450,6 +11457,9 @@ help from Bernd Raichle, for which I am grateful.
 % Consider |txtbabel| as a shorthand for \textit{tex--xet babel},
 % which is the bidi model in both \pdftex{} and \xetex{}.
 %
+% \changes{3.33}{2019/05/04}{\cs{@tabular}, \cs{list}, etc., are
+%   patched, instead of redefined.}
+%
 %    \begin{macrocode}
 %<*texxet>
 \bbl@trace{Redefinitions for bidi layout}
@@ -11478,122 +11488,39 @@ help from Bernd Raichle, for which I am grateful.
     \parfillskip\bbl@endskip}
 \fi
 \IfBabelLayout{lists}
-  {\def\list#1#2{%
-    \ifnum \@listdepth >5\relax
-      \@toodeep
-    \else
-      \global\advance\@listdepth\@ne
-    \fi
-    \rightmargin\z@
-    \listparindent\z@
-    \itemindent\z@
-    \csname @list\romannumeral\the\@listdepth\endcsname
-    \def\@itemlabel{#1}%
-    \let\makelabel\@mklab
-    \@nmbrlistfalse
-    #2\relax
-    \@trivlist
-    \parskip\parsep
-    \parindent\listparindent
-    \advance\linewidth-\rightmargin
-    \advance\linewidth-\leftmargin
-    \advance\@totalleftmargin
-      \ifcase\bbl@thepardir\leftmargin\else\rightmargin\fi
-    \parshape\@ne\@totalleftmargin\linewidth
-    \ignorespaces}%
-  \ifcase\bbl@engine
-    \def\labelenumii{)\theenumii(}%
-    \def\p@enumiii{\p@enumii)\theenumii(}%
-  \fi
-  \def\@verbatim{%
-    \trivlist \item\relax
-    \if@minipage\else\vskip\parskip\fi
-    \bbl@startskip\textwidth
-    \advance\bbl@startskip-\linewidth
-    \bbl@endskip\z@skip
-    \parindent\z@
-    \parfillskip\@flushglue
-    \parskip\z@skip
-    \@@par
-    \language\l@nohyphenation
-    \@tempswafalse
-    \def\par{%
-      \if@tempswa
-        \leavevmode\null
-        \@@par\penalty\interlinepenalty
-      \else
-        \@tempswatrue
-        \ifhmode\@@par\penalty\interlinepenalty\fi
-      \fi}%
-    \let\do\@makeother \dospecials
-    \obeylines \verbatim@font \@noligs
-    \everypar\expandafter{\the\everypar\unpenalty}}}
+  {\bbl@sreplace\list
+    {\@totalleftmargin\leftmargin}{\@totalleftmargin\bbl@listleftmargin}%
+   \def\bbl@listleftmargin{%
+     \ifcase\bbl@thepardir\leftmargin\else\rightmargin\fi}%
+   \ifcase\bbl@engine
+     \def\labelenumii{)\theenumii(}% pdftex doesn't reverse ()
+     \def\p@enumiii{\p@enumii)\theenumii(}%
+   \fi
+   \bbl@sreplace\@verbatim
+     {\leftskip\@totalleftmargin}%
+     {\bbl@startskip\textwidth
+      \advance\bbl@startskip-\linewidth}%
+   \bbl@sreplace\@verbatim 
+     {\rightskip\z@skip}%
+     {\bbl@endskip\z@skip}}%
   {}
 \IfBabelLayout{contents}
-  {\def\@dottedtocline#1#2#3#4#5{%
-     \ifnum#1>\c@tocdepth\else
-       \vskip \z@ \@plus.2\p@
-       {\bbl@startskip#2\relax
-        \bbl@endskip\@tocrmarg
-        \parfillskip-\bbl@endskip
-        \parindent#2\relax
-        \@afterindenttrue
-        \interlinepenalty\@M
-        \leavevmode
-        \@tempdima#3\relax
-        \advance\bbl@startskip\@tempdima
-        \null\nobreak\hskip-\bbl@startskip
-        {#4}\nobreak
-        \leaders\hbox{%
-          $\m@th\mkern\@dotsep mu\hbox{.}\mkern\@dotsep mu$}%
-          \hfill\nobreak
-          \hb@xt@\@pnumwidth{\hfil\normalfont\normalcolor#5}%
-          \par}%
-     \fi}}
+  {\bbl@sreplace\@dottedtocline{\leftskip}{\bbl@startskip}%
+   \bbl@sreplace\@dottedtocline{\rightskip}{\bbl@endskip}}
   {}
 \IfBabelLayout{columns}
-  {\def\@outputdblcol{%
-     \if@firstcolumn
-       \global\@firstcolumnfalse
-       \global\setbox\@leftcolumn\copy\@outputbox
-       \splitmaxdepth\maxdimen
-       \vbadness\maxdimen
-       \setbox\@outputbox\vbox{\unvbox\@outputbox\unskip}%
-       \setbox\@outputbox\vsplit\@outputbox to\maxdimen
-       \toks@\expandafter{\topmark}%
-       \xdef\@firstcoltopmark{\the\toks@}%
-       \toks@\expandafter{\splitfirstmark}%
-       \xdef\@firstcolfirstmark{\the\toks@}%
-       \ifx\@firstcolfirstmark\@empty
-         \global\let\@setmarks\relax
-       \else
-         \gdef\@setmarks{%
-           \let\firstmark\@firstcolfirstmark
-           \let\topmark\@firstcoltopmark}%
-       \fi
-     \else
-       \global\@firstcolumntrue
-       \setbox\@outputbox\vbox{%
-         \hb@xt@\textwidth{%
-           \hskip\columnwidth
-           \hfil
-           {\normalcolor\vrule \@width\columnseprule}%
-           \hfil
-           \hb@xt@\columnwidth{\box\@leftcolumn \hss}%
-           \hskip-\textwidth
-           \hb@xt@\columnwidth{\box\@outputbox \hss}%
-           \hskip\columnsep
-           \hskip\columnwidth}}%
-       \@combinedblfloats
-       \@setmarks
-       \@outputpage
-       \begingroup
-         \@dblfloatplacement
-         \@startdblcolumn
-         \@whilesw\if@fcolmade \fi{\@outputpage
-         \@startdblcolumn}%
-       \endgroup
-     \fi}}%
+  {\bbl@sreplace\@outputdblcol{\hb@xt@\textwidth}{\bbl@outputhbox}%
+   \def\bbl@outputhbox#1{%
+     \hb@xt@\textwidth{%
+       \hskip\columnwidth
+       \hfil
+       {\normalcolor\vrule \@width\columnseprule}%
+       \hfil
+       \hb@xt@\columnwidth{\box\@leftcolumn \hss}%
+       \hskip-\textwidth
+       \hb@xt@\columnwidth{\box\@outputbox \hss}%
+       \hskip\columnsep
+       \hskip\columnwidth}}}%
   {}
 <@Footnote changes@>
 \IfBabelLayout{footnotes}%
@@ -11603,7 +11530,7 @@ help from Bernd Raichle, for which I am grateful.
   {}
 %    \end{macrocode}
 %
-%      Implicitly reverses sectioning labels in |bidi=basic-r|, because
+%      Implicitly reverses sectioning labels in |bidi=basic|, because
 %      the full stop is not in contact with L numbers any more. I
 %      think there must be a better way.
 %
@@ -11989,6 +11916,7 @@ help from Bernd Raichle, for which I am grateful.
 %
 % \changes{babel~3.24}{2018/09/24}{Lua code for interword spacing
 %   in Southeast Asian scripts.}
+% \changes{babel~3.32}{2019/05/25}{Don't break with CJK if nohyphenation.}
 %
 % \textit{In progress.} Replace regular (ie, implicit) discretionaries
 % by spaceskips, based on the previous glyph (which I think makes
@@ -12080,13 +12008,15 @@ help from Bernd Raichle, for which I am grateful.
       local last_char = nil
       local quad = 655360      % 10 pt = 655360 = 10 * 65536
       local last_class = nil
+      local last_lang = nil
 
       for item in node.traverse(head) do
         if item.id == GLYPH then
+        
+          local lang = item.lang
 
           local LOCALE = node.get_attribute(item,
                 luatexbase.registernumber'bbl@attr@locale')
-
           local props = Babel.locale_props[LOCALE]
 
           class = Babel.cjk_class[item.char].c
@@ -12100,7 +12030,9 @@ help from Bernd Raichle, for which I am grateful.
             br = 0
           end
 
-          if br == 1 and props.linebreak == 'c' then
+          if br == 1 and props.linebreak == 'c' and
+              lang ~= \the\l@nohyphenation\space and
+              last_lang ~= \the\l@nohyphenation then
             local intrapenalty = props.intrapenalty
             if intrapenalty ~= 0 then
               local n = node.new(14, 0)     % penalty
@@ -12117,6 +12049,7 @@ help from Bernd Raichle, for which I am grateful.
 
           quad = font.getfont(item.font).size
           last_class = class
+          last_lang = lang
         else % if penalty, glue or anything else
           last_class = nil
         end
@@ -12146,18 +12079,18 @@ help from Bernd Raichle, for which I am grateful.
 %
 % \subsection{CJK line breaking}
 %
-% Minimal line breaking for CJK scripts, mainly intended by simple
+% Minimal line breaking for CJK scripts, mainly intended for simple
 % documents and short texts as a secundary language. Only line
 % breaking, with a little stretching for justification, without any
-% attempt to adjust the spacing. It is based (but does not strictly
-% follows) on the Unicode algorithm.
+% attempt to adjust the spacing. It is based on (but does not strictly
+% follow) the Unicode algorithm.
 %
 % We first need a little table with the corresponding line breaking
 % properties. A few characters have an additional key for the width
 % (fullwidth \textit{vs.} halfwidth), not yet used. There is a separate
 % file, defined below.
 %
-% \changes{3.31}{2019/05/04}{Simple CJK line breaking}
+% \changes{3.31}{2019/05/04}{Simple CJK line breaking.}
 % 
 % \textit{Work in progress.} 
 %
@@ -12199,6 +12132,53 @@ help from Bernd Raichle, for which I am grateful.
 \AtBeginDocument{\bbl@luafixboxdir}
 %    \end{macrocode}
 %
+% \changes{3.32}{2019/05/23}{New - \cs{babelcharproperty}.}
+%
+% The code for |\babelcharproperty| is straightforward. Just note the
+% modified lua table can be different.
+%
+%    \begin{macrocode}
+\newcommand\babelcharproperty[1]{%
+  \count@=#1\relax
+  \ifvmode
+    \expandafter\bbl@chprop
+  \else
+    \bbl@error{\string\babelcharproperty\space can be used only in\\%
+               vertical mode (preamble or between paragraphs)}%
+              {See the manual for futher info}%
+  \fi}
+\newcommand\bbl@chprop[3][\the\count@]{%
+  \@tempcnta=#1\relax
+  \bbl@ifunset{bbl@chprop@#2}%
+    {\bbl@error{No property named '#2'. Allowed values are\\%
+                direction (bc), mirror (bmg), and linebreak (lb)}%
+               {See the manual for futher info}}%
+    {}%
+  \loop
+    \@nameuse{bbl@chprop@#2}{#3}%
+  \ifnum\count@<\@tempcnta
+    \advance\count@\@ne
+  \repeat}
+\def\bbl@chprop@direction#1{%
+  \directlua{
+    Babel.characters[\the\count@] =  Babel.characters[\the\count@] or {}
+    Babel.characters[\the\count@]['d'] = '#1'
+  }}
+\let\bbl@chprop@bc\bbl@chprop@direction
+\def\bbl@chprop@mirror#1{%
+  \directlua{
+    Babel.characters[\the\count@] =  Babel.characters[\the\count@] or {}
+    Babel.characters[\the\count@]['m'] = '\number#1' 
+  }}
+\let\bbl@chprop@bmg\bbl@chprop@mirror
+\def\bbl@chprop@linebreak#1{%
+  \directlua{
+    Babel.Babel.cjk_characters[\the\count@] = Babel.Babel.cjk_characters[\the\count@] or {}
+    Babel.Babel.cjk_characters[\the\count@]['c'] = '#1'
+  }}
+\let\bbl@chprop@lb\bbl@chprop@linebreak
+%    \end{macrocode}
+%
 % \subsection{Layout}
 %
 % \textbf{Work in progress}.
@@ -12206,17 +12186,24 @@ help from Bernd Raichle, for which I am grateful.
 % Unlike \xetex{}, \luatex{} requires only minimal changes for
 % right-to-left layouts, particularly in monolingual documents (the
 % engine itself reverses boxes -- including column order or headings
-% --, margins, etc.) and with |bidi=basic-r|, without having to patch
+% --, margins, etc.) with |bidi=basic|, without having to patch
 % almost any macro where text direction is relevant.
 %
 % |\@hangfrom| is useful in many contexts and it is redefined always
 % with the |layout| option.
 %
-% There are, however, a number of issues when the text direction is
-% not the same as the box direction (as set by |\bodydir|), and when
+% There are, however, a number of issues when the text direction is not
+% the same as the box direction (as set by |\bodydir|), and when
 % |\parbox| and |\hangindent| are involved. Fortunately, latest
 % releases of \luatex{} simplify a lot the solution with |\shapemode|.
 %
+% With the issue \#15 I realized commands are best patched, instead of
+% redefined. With a few lines, a modification could be applied to
+% several classes and packages. Now, |tabular| seems to work (at least
+% in simple cases) with \textsf{array}, \textsf{tabularx},
+% \textsf{hhline}, \textsf{colortbl}, \textsf{longtable},
+% \textsf{booktabs}, etc. However, \textsf{dcolumn} still fails.
+%
 % \changes{3.18}{2018/02/14}{\cs{bbl@nextfake}, similar to the old
 %   \cs{nextfakemath} in Omega}
 % \changes{3.19}{2018/04/23}{Patch \cs{@eqnnum}, somewhat ad hoc. To be
@@ -12269,30 +12256,46 @@ help from Bernd Raichle, for which I am grateful.
      \ifx\bbl@tabular\@tabular\else
        \bbl@replace\@tabular{$}{\bbl@nextfake$}%
      \fi}}
-  {}
+   {}
 \IfBabelLayout{lists}
-  {\expandafter\def\expandafter\bbl@toreplace\expandafter{\list{##1}{##2}}%
-   \bbl@replace\bbl@toreplace{\parshape}{\bbl@listparshape}%
-   \bbl@exp{\def\\\list##1##2{\the\toks@}}% \toks@ <- implicit result
+  {\bbl@sreplace\list{\parshape}{\bbl@listparshape}%
    \def\bbl@listparshape#1#2#3{%
      \parshape #1 #2 #3 %
      \ifnum\bbl@getluadir{page}=\bbl@getluadir{par}\else
        \shapemode\tw@
      \fi}}
   {}
+\IfBabelLayout{graphics}
+  {\let\bbl@pictresetdir\relax
+   \def\bbl@pictsetdir{%
+     \ifcase\bbl@thetextdir
+       \let\bbl@pictresetdir\relax
+     \else
+       \textdir TLT\relax
+       \def\bbl@pictresetdir{\textdir TRT\relax}%
+     \fi}%
+   \bbl@sreplace\@picture{\hskip-}{\bbl@pictsetdir\hskip-}%
+   \def\put(#1,#2)#3{%  Not easy to patch. Better redefine.
+     \@killglue
+     \raise#2\unitlength
+     \hb@xt@\z@{\kern#1\unitlength{\bbl@pictresetdir#3}\hss}}%
+   \AtBeginDocument
+     {\ifx\tikz@atbegin@node\@undefined\else
+        \bbl@sreplace\pgfpicture{\pgfpicturetrue}{\bbl@pictsetdir\pgfpicturetrue}%
+        \bbl@add\pgfsys@beginpicture{\bbl@pictsetdir}%
+        \bbl@add\tikz@atbegin@node{\bbl@pictresetdir}%
+      \fi}}
+  {}
 %    \end{macrocode}
 %
 %      Implicitly reverses sectioning labels in bidi=basic-r, because
 %      the full stop is not in contact with L numbers any more. I
-%      think there must be a better way. Assumes |bidi=basic-r|, but
+%      think there must be a better way. Assumes |bidi=basic|, but
 %      there are some additional readjustments for |bidi=default|.
 %
 %    \begin{macrocode}
 \IfBabelLayout{counters}%
-  {\def\@textsuperscript#1{{% lua has separate settings for math
-     \m@th
-     \mathdir\pagedir % required with basic-r; ok with default, too
-     \ensuremath{^{\mbox {\fontsize \sf@size \z@ #1}}}}}%
+  {\bbl@sreplace\@textsuperscript{\m@th}{\m@th\mathdir\pagedir}%
    \let\bbl@latinarabic=\@arabic
    \def\@arabic#1{\babelsublr{\bbl@latinarabic#1}}%
    \@ifpackagewith{babel}{bidi=default}%
@@ -12318,10 +12321,7 @@ help from Bernd Raichle, for which I am grateful.
 %
 %    \begin{macrocode}
 \IfBabelLayout{extras}%
-  {\def\underline#1{%
-     \relax
-     \ifmmode\@@underline{#1}%
-     \else\bbl@nextfake$\@@underline{\hbox{#1}}\m@th$\relax\fi}%
+  {\bbl@sreplace\underline{$\@@underline}{\bbl@nextfake$\@@underline}%
    \DeclareRobustCommand{\LaTeXe}{\mbox{\m@th
      \if b\expandafter\@car\f@series\@nil\boldmath\fi
      \babelsublr{%
@@ -19399,12 +19399,13 @@ Babel.cjk_breaks = {
 %    command, \texttt{nil} could be an `unknown' language in which
 %    case we have to make it known.
 %
+% \changes{babel-3.32}{2019/05/21}{Don't set it to
+%   \cs{l@nohyphenation}, best reserved fo special uses.}
+%
 %    \begin{macrocode}
-\ifx\l@nohyphenation\@undefined
-   \@nopatterns{nil}
-   \adddialect\l@nil0
-\else
-   \let\l@nil\l@nohyphenation
+\ifx\l@nil\@undefined
+  \newlanguage\l@nil
+  \@namedef{bbl@hyphendata@\the\l@nil}{{}{}}% Remove warning
 \fi
 %    \end{macrocode}
 %
-- 
cgit v1.2.3

