[latex3-commits] [git/LaTeX3-latex3-babel] master: Definable ini values. SEA and CJK line break treated like hyphenation. (6bbc9fe)

Javier jbezos at dante.de
Mon Nov 18 17:11:14 CET 2019


Repository : https://github.com/latex3/babel
On branch  : master
Link       : https://github.com/latex3/babel/commit/6bbc9fe53f0fd9b96b0985280f279600400883d2

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

commit 6bbc9fe53f0fd9b96b0985280f279600400883d2
Author: Javier <jbezos at localhost>
Date:   Mon Nov 18 17:11:14 2019 +0100

    Definable ini values. SEA and CJK line break treated like hyphenation.
    
    Also a new sample for luahbtex.


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

6bbc9fe53f0fd9b96b0985280f279600400883d2
 README.md              |  35 +++-------
 babel.dtx              | 177 +++++++++++++++++++++++++++----------------------
 babel.ins              |   2 +-
 babel.pdf              | Bin 723535 -> 725313 bytes
 bbcompat.dtx           |   2 +-
 samples/luahb-udhr.pdf | Bin 0 -> 232967 bytes
 samples/luahb-udhr.tex |  83 +++++++++++++++++++++++
 7 files changed, 192 insertions(+), 107 deletions(-)

diff --git a/README.md b/README.md
index 1052b9b..276964a 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.36
+## Babel 3.36.1829
 
 This package manages culturally-determined typographical (and other)
 rules, and hyphenation patterns for a wide range of languages.  Many
@@ -51,10 +51,16 @@ respective authors.
 ### Latest changes
 
 ```
+3.37   Development - 2019-??-??
+       - \babelprovide now can be used to add or modify values for the
+         keys in ini files.
+       - Line break in South East Asian and CKJ are assimilated to
+         hyphenation, and it is activated even without 'import' (lua).
+
 3.36   2019-11-14
        - New - \babeladjust, with options: bidi.text, bidi.mirroring,
          bidi.mapdigits, layout.tabular, layout.lists, linebreak.sea,
-         linebreak.cjk. There are still some limitations.
+         linebreak.cjk. There are still some limitations (lua).
        - New - ini for Polytonic Greek, thanks to Claudio Beccari.
        - Fix - Language and script set for Chinese Tradicional and
          Chinese Simplified.
@@ -114,31 +120,6 @@ respective authors.
          necessary.
        - Minor improvements in babel-vi.ini.
 
-3.26   2018-10-16
-       - Fix for 3.25 - \babelprovide raised an error with xetex. 
-
-3.25   2018-10-03
-       - Fixes for 3.23 - mapfont=direction could raise an error.
-       - Language and Script were not always defined correctly.
-       - Improved tentative support for Thai, Lao and Khmer in both 
-         luatex and xetex.
-
-3.24   2018-09-26
-       - Prelimimary support for Thai interword spacing with luatex.
-
-3.23   2018-09-02
-       - After extensive tests and fixing some issues, bidi=basic is 
-         not experimental any longer.
-       - import in \babelprovide does not require a language code if
-         the language name is a recognized one.
-       - New macro: \ifbabelshorthand.
-       - TS1, T3 and TS3 have been added to the non-ascii list, to 
-         avoid problems in case no ASCII-savvy encoding is requested.
-       - Define Language and Script if fontspec does not known them (eg, 
-         the Japanese script).
-       - Set the \thepage bidi bahavior in foots/heads.
-       - Fix - Undefined \bbl at stripslash in Plain.
-
 ```
 
 Javier Bezos
diff --git a/babel.dtx b/babel.dtx
index 7c64648..bf7209a 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -31,7 +31,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2019/11/14 v3.36 The Babel package]
+\ProvidesFile{babel.dtx}[2019/11/18 v3.36.1829 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -1235,14 +1235,15 @@ for auxiliary tasks).
 \end{verbatim}
 \endgroup
   Khemer clusters are rendered wrongly.
-\item[East Asia scripts] Settings for either Simplified of Tradicional
+\item[East Asia scripts] Settings for either Simplified of Traditional
 should work out of the box. \luatex{} does basic line breaking, but
 currently \xetex{} does not (you may load \textsf{zhspacing}). Although
 for a few words and shorts texts the |ini| files should be fine, CJK
 texts are best set with a dedicated framework (\textsf{CJK},
-\textsf{luatexja}, \textsf{kotex}, \textsf{CTeX}, etc.). Actually, this
-is what the |ldf| does in |japanese| with \luatex, because the
-following piece of code loads \textsf{luatexja}:
+\textsf{luatexja}, \textsf{kotex}, \textsf{CTeX}, etc.). This is what
+the class |ltjbook| does with \luatex, which can be used in conjuntion
+with the |ldf| for |japanese|, because the following piece of code
+loads \textsf{luatexja}:
 \begin{verbatim}
 \documentclass{ltjbook}
 \usepackage[japanese]{babel}
@@ -2086,9 +2087,10 @@ set to 2 and 3. In either case, caption, date and language system are
 not defined.
 
 If no |ini| file is imported with |import|, \m{language-name} is
-relevant because in such a case the hyphenation rules are based on it
-as provided in the |ini| file corresponding to that name; the same
-applies to OpenType language and script.
+relevant because in such a case the hyphenation rules (including those
+for South East Asian and CJK) are based on it as provided in the |ini|
+file corresponding to that name; the same applies to OpenType language
+and script.
 
 Conveniently, some options allow to fill the language, and \babel{}
 warns you about what to do if there is a missing string. Very likely
@@ -2219,12 +2221,12 @@ Sets the interword space for the writing system of the language, in em
 units (so, |0 .1 0| is |0em plus .1em|). Like |\spaceskip|, the em unit
 applied is that of the current text (more precisely, the previous 
 glyph). Currently used only in Southeast Asian scrips, like Thai, and
-CJK. Requires |import|.
+CJK.
 
 \Describe{intrapenalty=}{\meta{penalty}}
 Sets the interword penalty for the writing system of this language.
 Currently used only in Southeast Asian scrips, like Thai. Ignored if 0
-(which is the default value). Requires |import|.
+(which is the default value). 
 
 \begin{note}
   (1) If you need shorthands, you can define them with |\useshorthands|
@@ -4103,8 +4105,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.36>>
-%<<date=2019/11/14>>
+%<<version=3.36.1829>>
+%<<date=2019/11/18>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -8159,8 +8161,8 @@ help from Bernd Raichle, for which I am grateful.
          \bbl at read@ini{##1}{basic data}%
          \bbl at exportkey{chrng}{characters.ranges}{}%
          \bbl at exportkey{dgnat}{numbers.digits.native}{}%
-         % \bbl at exportkey{hyphr}{typography.hyphenrules}{}%
-         % \bbl at exportkey{intsp}{typography.intraspace}{}%
+         \bbl at exportkey{hyphr}{typography.hyphenrules}{}%
+         \bbl at exportkey{intsp}{typography.intraspace}{}%
        \endgroup}%           boxed, to avoid extra spaces:
      {\setbox\z@\hbox{\InputIfFileExists{babel-#2.tex}{}{}}}}%
     {}%
@@ -8204,65 +8206,7 @@ help from Bernd Raichle, for which I am grateful.
   \ifx\bbl at KVP@intraspace\@nil\else % We can override the ini or set
     \bbl at csarg\edef{intsp@#2}{\bbl at KVP@intraspace}%
   \fi
-  \ifcase\bbl at engine\or   % lua
-    \bbl at ifunset{bbl at intsp@\languagename}{}%
-      {\expandafter\ifx\csname bbl at intsp@\languagename\endcsname\@empty\else
-         \bbl at xin@{\bbl at cs{sbcp@\languagename}}{Hant,Hans,Jpan,Kore,Kana}%
-         \ifin@           % cjk
-           \bbl at cjkintraspace
-           \directlua{
-               Babel = Babel or {}
-               Babel.locale_props = Babel.locale_props or {}
-               Babel.locale_props[\the\localeid].linebreak = 'c'
-           }%
-           \bbl at exp{\\\bbl at intraspace\bbl at cs{intsp@\languagename}\\\@@}%
-           \ifx\bbl at KVP@intrapenalty\@nil
-             \bbl at intrapenalty0\@@
-           \fi 
-         \else            % sea
-           \bbl at seaintraspace
-           \bbl at exp{\\\bbl at intraspace\bbl at cs{intsp@\languagename}\\\@@}%
-           \directlua{
-              Babel = Babel or {}
-              Babel.sea_ranges = Babel.sea_ranges or {}
-              Babel.set_chranges('\bbl at cs{sbcp@\languagename}', 
-                                 '\bbl at cs{chrng@\languagename}')
-           }%
-           \ifx\bbl at KVP@intrapenalty\@nil
-             \bbl at intrapenalty0\@@
-           \fi
-         \fi
-       \fi
-       \ifx\bbl at KVP@intrapenalty\@nil\else
-         \expandafter\bbl at intrapenalty\bbl at KVP@intrapenalty\@@
-       \fi}%
-  \or                     % xe
-    \bbl at xin@{\bbl at cs{sbcp@\languagename}}{Thai,Laoo,Khmr}%
-    \ifin@                % sea (currently ckj not handled)
-      \bbl at ifunset{bbl at intsp@\languagename}{}%
-        {\expandafter\ifx\csname bbl at intsp@\languagename\endcsname\@empty\else
-          \ifx\bbl at KVP@intraspace\@nil
-             \bbl at exp{%
-               \\\bbl at intraspace\bbl at cs{intsp@\languagename}\\\@@}%
-          \fi
-          \ifx\bbl at KVP@intrapenalty\@nil
-            \bbl at intrapenalty0\@@
-          \fi
-        \fi
-        \ifx\bbl at KVP@intraspace\@nil\else % We may override the ini
-          \expandafter\bbl at intraspace\bbl at KVP@intraspace\@@
-        \fi
-        \ifx\bbl at KVP@intrapenalty\@nil\else
-          \expandafter\bbl at intrapenalty\bbl at KVP@intrapenalty\@@
-        \fi
-        \ifx\bbl at ispacesize\@undefined
-          \AtBeginDocument{%
-            \expandafter\bbl at add
-            \csname selectfont \endcsname{\bbl at ispacesize}}%
-          \def\bbl at ispacesize{\bbl at cs{xeisp@\bbl at cs{sbcp@\languagename}}}%
-        \fi}%
-    \fi
-  \fi
+  \bbl at provide@intraspace
   % == maparabic ==
   % Native digits, if provided in ini (TeX level, xe and lua)
   \ifcase\bbl at engine\else
@@ -8511,6 +8455,14 @@ help from Bernd Raichle, for which I am grateful.
         \expandafter\bbl at iniline\bbl at line\bbl at iniline
       \fi
     \repeat
+    \bbl at foreach\bbl at renewlist{%
+      \bbl at ifunset{bbl at renew@##1}{}{\bbl at inisec[##1]\@@}}%
+    \global\let\bbl at renewlist\@empty
+    % Ends last section. See \bbl at inisec
+    \def\bbl at elt##1##2{\bbl at inireader##1=##2\@@}%
+    \@nameuse{bbl at renew@\bbl at section}%
+    \global\bbl at csarg\let{renew@\bbl at section}\relax
+    \@nameuse{bbl at secpost@\bbl at section}%  
   \fi}
 \def\bbl at iniline#1\bbl at iniline{%
   \@ifnextchar[\bbl at inisec{\@ifnextchar;\bbl at iniskip\bbl at inipreread}#1\@@}% ]
@@ -8519,7 +8471,10 @@ help from Bernd Raichle, for which I am grateful.
 % The special cases for comment lines and sections are handled by the
 % two following commands. In sections, we provide the posibility to
 % take extra actions at the end or at the start (TODO - but note the last
-% section is not ended). By default, key=val pairs are ignored.
+% section is not ended). By default, key=val pairs are ignored. The
+% |secpost| ``hook'' is used only by `identification', while |secpre|
+% only by |date.gregorian.licr|.
+% 
 %
 %    \begin{macrocode}
 \def\bbl at iniskip#1\@@{}%      if starts with ;
@@ -8528,15 +8483,19 @@ help from Bernd Raichle, for which I am grateful.
   \@nameuse{bbl at renew@\bbl at section}%
   \global\bbl at csarg\let{renew@\bbl at section}\relax
   \@nameuse{bbl at secpost@\bbl at section}%  ends previous section
-  \def\bbl at section{#1}%
+  \def\bbl at section{#1}%                 starts current section
   \def\bbl at elt##1##2{%
     \@namedef{bbl at KVP@#1..##1}{}}%
   \@nameuse{bbl at renew@#1}%
-  \@nameuse{bbl at secpre@#1}%   starts current section
+  \@nameuse{bbl at secpre@#1}%  pre-section `hook'
   \bbl at ifunset{bbl at inikv@#1}%
     {\let\bbl at inireader\bbl at iniskip}%
     {\bbl at exp{\let\\\bbl at inireader\<bbl at inikv@#1>}}}
+\let\bbl at renewlist\@empty
 \def\bbl at renewinikey#1..#2\@@#3{%
+  \bbl at ifunset{bbl at renew@#1}%
+    {\bbl at add@list\bbl at renewlist{#1}}%
+    {}%
   \bbl at csarg\bbl at add{renew@#1}{\bbl at elt{#2}{#3}}}
 %    \end{macrocode}
 %
@@ -8565,8 +8524,10 @@ help from Bernd Raichle, for which I am grateful.
 %    \end{macrocode}
 %
 % Key-value pairs are treated differently depending on the section in
-% the |ini| file.  The following macros are the readers for
-% |identification| and |typography|.
+% the |ini| file. The following macros are the readers for
+% |identification| and |typography|. Note |\bbl at secpost@identification|
+% is called always (via |\bbl at inisec|), while |\bbl at after@ini| must be
+% called explicitly after |\bbl at read@ini| if necessary.
 %
 % \changes{babel~3.36}{2019/10/30}{New fields for CJK, because OpenType
 %  and the CLDR follow different models.}
@@ -11736,6 +11697,33 @@ help from Bernd Raichle, for which I am grateful.
 \def\bbl at intrapenalty#1\@@{%
   \bbl at csarg\gdef{xeipn@\bbl at cs{sbcp@\languagename}}%
     {\XeTeXlinebreakpenalty #1\relax}}
+        \bbl at xin@{\bbl at cs{sbcp@\languagename}}{Thai,Laoo,Khmr}%
+\def\bbl at provide@intraspace{%
+   \bbl at xin@{\bbl at cs{sbcp@\languagename}}{Thai,Laoo,Khmr}%
+   \ifin@                % sea (currently ckj not handled)
+     \bbl at ifunset{bbl at intsp@\languagename}{}%
+       {\expandafter\ifx\csname bbl at intsp@\languagename\endcsname\@empty\else
+         \ifx\bbl at KVP@intraspace\@nil
+            \bbl at exp{%
+              \\\bbl at intraspace\bbl at cs{intsp@\languagename}\\\@@}%
+         \fi
+         \ifx\bbl at KVP@intrapenalty\@nil
+           \bbl at intrapenalty0\@@
+         \fi
+       \fi
+       \ifx\bbl at KVP@intraspace\@nil\else % We may override the ini
+         \expandafter\bbl at intraspace\bbl at KVP@intraspace\@@
+       \fi
+       \ifx\bbl at KVP@intrapenalty\@nil\else
+         \expandafter\bbl at intrapenalty\bbl at KVP@intrapenalty\@@
+       \fi
+       \ifx\bbl at ispacesize\@undefined
+         \AtBeginDocument{%
+           \expandafter\bbl at add
+           \csname selectfont \endcsname{\bbl at ispacesize}}%
+         \def\bbl at ispacesize{\bbl at cs{xeisp@\bbl at cs{sbcp@\languagename}}}%
+       \fi}%
+   \fi}
 \AddBabelHook{xetex}{loadkernel}{%
 <@Restore Unicode catcodes before loading patterns@>}
 \ifx\DisableBabelHook\@undefined\endinput\fi
@@ -11771,6 +11759,7 @@ help from Bernd Raichle, for which I am grateful.
 %
 %    \begin{macrocode}
 %<*texxet>
+\providecommand\bbl at provide@intraspace{}
 \bbl at trace{Redefinitions for bidi layout}
 \def\bbl at sspre@caption{%
   \bbl at exp{\everyhbox{\\\bbl at textdir\bbl at cs{wdir@\bbl at main@language}}}}
@@ -12384,6 +12373,38 @@ help from Bernd Raichle, for which I am grateful.
   }
 }
 \endgroup
+\def\bbl at provide@intraspace{%
+  \bbl at ifunset{bbl at intsp@\languagename}{}%
+    {\expandafter\ifx\csname bbl at intsp@\languagename\endcsname\@empty\else
+       \bbl at xin@{\bbl at cs{sbcp@\languagename}}{Hant,Hans,Jpan,Kore,Kana}%
+       \ifin@           % cjk
+         \bbl at cjkintraspace
+         \directlua{
+             Babel = Babel or {}
+             Babel.locale_props = Babel.locale_props or {}
+             Babel.locale_props[\the\localeid].linebreak = 'c'
+         }%
+         \bbl at exp{\\\bbl at intraspace\bbl at cs{intsp@\languagename}\\\@@}%
+         \ifx\bbl at KVP@intrapenalty\@nil
+           \bbl at intrapenalty0\@@
+         \fi 
+       \else            % sea
+         \bbl at seaintraspace
+         \bbl at exp{\\\bbl at intraspace\bbl at cs{intsp@\languagename}\\\@@}%
+         \directlua{
+            Babel = Babel or {}
+            Babel.sea_ranges = Babel.sea_ranges or {}
+            Babel.set_chranges('\bbl at cs{sbcp@\languagename}', 
+                               '\bbl at cs{chrng@\languagename}')
+         }%
+         \ifx\bbl at KVP@intrapenalty\@nil
+           \bbl at intrapenalty0\@@
+         \fi
+       \fi
+     \fi
+     \ifx\bbl at KVP@intrapenalty\@nil\else
+       \expandafter\bbl at intrapenalty\bbl at KVP@intrapenalty\@@
+     \fi}}
 %    \end{macrocode}
 %
 % \subsection{CJK line breaking}
diff --git a/babel.ins b/babel.ins
index e12e3c0..98107a7 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{2019/11/14}
+\def\filedate{2019/11/18}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
diff --git a/babel.pdf b/babel.pdf
index f1eafff..7ac9155 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index ea75355..7ba2ce3 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2019/11/14 v3.36]
+\ProvidesFile{bbcompat.dtx}[2019/11/18 v3.36.1829]
 %</dtx>
 %
 %% File 'bbcompat.dtx'
diff --git a/samples/luahb-udhr.pdf b/samples/luahb-udhr.pdf
new file mode 100644
index 0000000..2ecbf0c
Binary files /dev/null and b/samples/luahb-udhr.pdf differ
diff --git a/samples/luahb-udhr.tex b/samples/luahb-udhr.tex
new file mode 100644
index 0000000..535a041
--- /dev/null
+++ b/samples/luahb-udhr.tex
@@ -0,0 +1,83 @@
+\documentclass{article}
+
+% For the purposes of this sample, the default bidi method is enough,
+% and it works in all Unicode engines:
+
+\usepackage[bidi=default]{babel}
+
+% Also, the generic \babelprovide is enough, even if usually it's not
+% the recommended way to load languages:
+
+\babelprovide{arabic}
+\babelprovide{armenian}
+\babelprovide{bengali}
+\babelprovide{greek}
+\babelprovide{hebrew}
+\babelprovide{japanese}
+\babelprovide{korean}
+\babelprovide{romanian}
+\babelprovide{serbian}
+\babelprovide{vietnamese}
+
+% With luahbtex we must add Renderer=Harfbuzz, which is just ignored by
+% other engines. FreeSerif does not contain CJK, so we use a couple of
+% alternative fonts, also in TeXLive.
+
+\babelfont{rm}[Renderer=Harfbuzz]{FreeSerif}
+\babelfont[japanese]{rm}[Renderer=Harfbuzz]{IPAexMincho}
+\babelfont[korean]{rm}[Renderer=Harfbuzz]{Baekmuk Gulim}
+
+\setlength{\parindent}{0pt}
+
+\newcommand{\startlocale}[1]{%
+  \selectlanguage{#1}%
+  \section{\foreignlanguage{nil}{#1}}}
+
+\begin{document}
+
+Requires \textsf{luaotfload} 3.11 and the development version of
+\textsf{babel} 3.37.
+
+\startlocale{arabic}
+
+يولد جميع الناس أحرارًا متساوين في الكرامة والحقوق. وقد وهبوا عقلاً وضميرًا وعليهم أن يعامل بعضهم بعضًا بروح الإخاء.
+
+\startlocale{armenian}
+
+Բոլոր մարդիկ ծնվում են ազատ ու հավասար՝ իրենց արժանապատվությամբ և իրավունքներով: Նրանք օժտված են բանականությամբ ու խղճով և պարտավոր են միմյանց վերաբերվել եղբայրության ոգով:
+
+\startlocale{bengali}
+
+Works only with \textsf{xetex} or \textsf{luahbtex}.
+
+সমস্ত মানুষ স্বাধীনভাবে সমান মর্যাদা এবং অধিকার নিয়ে জন্মগ্রহণ করে। তাঁদের বিবেক এবং বুদ্ধি আছে; সুতরাং সকলেরই একে অপরের প্রতি ভ্রাতৃত্বসুলভ মনোভাব নিয়ে আচরণ করা উচিৎ।
+
+\startlocale{greek}
+
+Όλοι οι άνθρωποι γεννιούνται ελεύθεροι και ίσοι στην αξιοπρέπεια και τα δικαιώματα. Είναι προικισμένοι με λογική και συνείδηση, και οφείλουν να συμπεριφέρονται μεταξύ τους με πνεύμα αδελφοσύνης.
+
+\startlocale{hebrew}
+
+כל בני האדם נולדו בני חורין ושווים בערכם ובזכויותיהם. כולם חוננו בתבונה ובמצפון, לפיכך חובה עליהם לנהוג איש ברעהו ברוח של אחווה.
+
+\startlocale{japanese}
+
+すべての人間は、生れながらにして自由であり、かつ、尊厳と権利とについて平等である。人間は、理性と良心とを授けられており、互いに同胞の精神をもって行動しなければならない。
+
+\startlocale{korean}
+
+모든 인간은 태어날 때부터 자유로우며 그 존엄과 권리에 있어 동등하다. 인간은 천부적으로 이성과 양심을 부여받았으며 서로 형제애의 정신으로 행동하여야 한다.
+
+\startlocale{romanian}
+
+Toate ființele umane se nasc libere și egale în demnitate și în drepturi. Ele sunt înzestrate cu rațiune și conștiință și trebuie să se comporte unele față de altele în spiritul fraternității.
+
+\startlocale{serbian}
+
+Сва људска бића рађају се слободна и једнака у достојанству и правима. Она су обдарена разумом и свешћу и треба једни према другима да поступају у духу братства.
+
+\startlocale{vietnamese}
+
+Mọi con người sinh ra đều tự do và bình đẳng về nhân phẩm và quyền lợi. Họ được tạo hóa ban cho lý trí và lương tâm và phải đối xử với nhau với tinh thần huynh đệ.
+
+\end{document}





More information about the latex3-commits mailing list