[latex3-commits] [git/LaTeX3-latex3-babel] main: Dedicated files for calendars. (df9c84a)

Javier email at dante.de
Fri May 27 19:01:22 CEST 2022


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

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

commit df9c84a05b645b2177680e019fa0aac5efdf5639
Author: Javier <email at localhost>
Date:   Fri May 27 19:01:22 2022 +0200

    Dedicated files for calendars.


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

df9c84a05b645b2177680e019fa0aac5efdf5639
 README.md                  |   4 +-
 babel.dtx                  | 157 +++++++++++++++++++++++++++++++++++++--------
 babel.ins                  |   3 +-
 babel.pdf                  | Bin 863134 -> 868060 bytes
 bbcompat.dtx               |   2 +-
 locale/ar/babel-ar.ini     |   2 +-
 locale/ar/babel-arabic.tex |  81 -----------------------
 7 files changed, 136 insertions(+), 113 deletions(-)

diff --git a/README.md b/README.md
index 0f42a92..fc237ab 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.75.2749
+## Babel 3.75.2750
 
 *(Development)*
 
@@ -49,7 +49,7 @@ respective authors.
 ### Summary of latest changes
 ```
 3.75   (dev)
-       * Start calendars: islamic-civil, islamic-umalqura
+       * Calendar conversion: islamic-civil, islamic-umalqura.
 
 3.75   2022-05-22
        * `\BabelEnsureInfo` is active by default, to make sure the BCP 47
diff --git a/babel.dtx b/babel.dtx
index e5c1abc..00717e4 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2022/05/26 v3.75.2749 The Babel package]
+\ProvidesFile{babel.dtx}[2022/05/27 v3.75.2750 The Babel package]
 \documentclass{ltxdoc}
 \GetFileInfo{babel.dtx}
 \usepackage{fontspec}
@@ -5143,8 +5143,8 @@ help from Bernd Raichle, for which I am grateful.
 % \section{Tools}
 %
 %    \begin{macrocode}
-%<<version=3.75.2749>>
-%<<date=2022/05/26>>
+%<<version=3.75.2750>>
+%<<date=2022/05/27>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -10018,6 +10018,17 @@ help from Bernd Raichle, for which I am grateful.
          \let\atcatcode\relax
          \global\bbl at csarg\let{rqtex@\languagename}\relax
        \fi}%
+    \bbl at ifunset{bbl at rqcal@\languagename}{}%
+      {\edef\bbl at tempa{\bbl at cs{rqcal@\languagename}}%
+         \bbl at replace\bbl at tempa{ }{,}%
+         \bbl at foreach\bbl at tempa{%
+           \bbl at ifunset{bbl at ca@##1}{%
+             \chardef\atcatcode=\catcode`\@
+             \catcode`\@=11\relax
+             \InputIfFileExists{babel-ca-##1.tex}{}{}%
+             \catcode`\@=\atcatcode
+             \let\atcatcode\relax}%
+           {}}}%
   \fi
   % == frenchspacing ==
   \ifcase\bbl at howloaded\in at true\else\in at false\fi
@@ -10460,6 +10471,7 @@ help from Bernd Raichle, for which I am grateful.
     \bbl at exportkey{dgnat}{numbers.digits.native}{}%
     \ifnum#1=\tw@           % only (re)new
       \bbl at exportkey{rqtex}{identification.require.babel}{}%
+      \bbl at exportkey{rqcal}{identification.require.calendars}{}%
       \bbl at toglobal\bbl at savetoday
       \bbl at toglobal\bbl at savedate
       \bbl at savestrings
@@ -10753,6 +10765,8 @@ help from Bernd Raichle, for which I am grateful.
 %
 %    \begin{macrocode}
 \let\bbl at calendar\@empty
+\newcommand\babelcalendar[2][\the\year-\the\month-\the\day]{%
+  \@nameuse{bbl at ca@#2}#1\@@}
 \newcommand\BabelDateSpace{\nobreakspace}
 \newcommand\BabelDateDot{.\@}  % TODO. \let instead of repeating
 \newcommand\BabelDated[1]{{\number#1}}
@@ -10795,30 +10809,6 @@ help from Bernd Raichle, for which I am grateful.
 \def\bbl at xdatecntr[#1|#2]{\localenumeral{#2}{#1}}
 %    \end{macrocode}
 %
-% \textbf{Calendars.} The code for specific calendars are placed in the
-% locales requiring it. Here we just define a few general macros,
-% particularly a funcion to get the julian day. It’s based on the
-% little library |calendar.js|, by John Walker, in the public domain.
-%
-%    \begin{macrocode}
-\ifx\ExplSyntaxOn\@undefined\else
-  \ExplSyntaxOn
-  \def\bbl at fpmod#1#2{(#1-#2*floor(#1/#2))}
-  \def\bbl at cs@gregleap#1{%
-    (\bbl at fpmod{#1}{4} == 0) &&
-      (!((\bbl at fpmod{#1}{100} == 0) && (\bbl at fpmod{#1}{400} != 0)))}
-  \def\bbl at ca@jd#1#2#3{% year, month, day
-    \fp_eval:n{ 1721424.5   + (365 * (#1 - 1)) +
-      floor((#1 - 1) / 4)   + (-floor((#1 - 1) / 100)) +
-      floor((#1 - 1) / 400) + floor((((367 * #2) - 362) / 12) +
-      ((#2 <= 2) ? 0 : (\bbl at cs@gregleap{#1} ? -1 : -2)) + #3) }}
-  \newcommand\babelcalendar[2][\the\year-\the\month-\the\day]{%
-    \@nameuse{bbl at ca@#2}#1\@@}
-  \ExplSyntaxOff
-\fi
-%    \end{macrocode}
-%
-%
 % \textbf{Transforms.}
 %
 %    \begin{macrocode}
@@ -22709,6 +22699,119 @@ Babel.cjk_breaks = {
 %</nil>
 %    \end{macrocode}
 %
+% \section{Calendars}
+%
+% The code for specific calendars are placed in the
+% specific files, loaded when requested by an |ini| file in the
+% |identification| section with |require.calendars|. 
+%
+% \subsection{Islamic}
+% 
+% Start with function to compute the Julian day. It’s based on the
+% little library |calendar.js|, by John Walker, in the public domain.
+% The code for the Civil calendar is based on it, too.
+%
+%    \begin{macrocode}
+%<*ca-islamic>
+\ExplSyntaxOn
+\def\bbl at fpmod#1#2{(#1-#2*floor(#1/#2))}
+\def\bbl at cs@gregleap#1{%
+  (\bbl at fpmod{#1}{4} == 0) &&
+    (!((\bbl at fpmod{#1}{100} == 0) && (\bbl at fpmod{#1}{400} != 0)))}
+\def\bbl at ca@jd#1#2#3{% year, month, day
+  \fp_eval:n{ 1721424.5   + (365 * (#1 - 1)) +
+    floor((#1 - 1) / 4)   + (-floor((#1 - 1) / 100)) +
+    floor((#1 - 1) / 400) + floor((((367 * #2) - 362) / 12) +
+    ((#2 <= 2) ? 0 : (\bbl at cs@gregleap{#1} ? -1 : -2)) + #3) }} 
+% == islamic (default)
+% Not yet implemented
+\def\bbl at ca@islamic#1-#2-#3\@@#4#5#6{}
+%    \end{macrocode}
+%
+% The Civil calendar. 
+%
+%    \begin{macrocode}
+\def\bbl at cs@isltojd#1#2#3{ % year, month, day
+  ((#3 + ceil(29.5 * (#2 - 1)) +
+  (#1 - 1) * 354 + floor((3 + (11 * #1)) / 30) +
+  1948439.5) - 1) }
+\@namedef{bbl at ca@islamic-civil++}{\bbl at ca@islamicvl at x{+2}}
+\@namedef{bbl at ca@islamic-civil+}{\bbl at ca@islamicvl at x{+1}}
+\@namedef{bbl at ca@islamic-civil}{\bbl at ca@islamicvl at x{}}
+\@namedef{bbl at ca@islamic-civil-}{\bbl at ca@islamicvl at x{-1}}
+\@namedef{bbl at ca@islamic-civil--}{\bbl at ca@islamicvl at x{-2}}
+\def\bbl at ca@islamicvl at x#1#2-#3-#4\@@#5#6#7{%
+  \edef\bbl at tempa{%
+    \fp_eval:n{ floor(\bbl at ca@jd{#2}{#3}{#4})+0.5 #1}}%
+  \edef#5{%
+    \fp_eval:n{ floor(((30*(\bbl at tempa-1948439.5)) + 10646)/10631) }}%
+  \edef#6{\fp_eval:n{
+    min(12,ceil((\bbl at tempa-(29+\bbl at cs@isltojd{#5}{1}{1}))/29.5)+1) }}%
+  \edef#7{\fp_eval:n{ \bbl at tempa - \bbl at cs@isltojd{#5}{#6}{1} + 1} }}
+%    \end{macrocode}
+%
+% The Umm al-Qura calendar, used mainly in Saudi Arabia. Based on
+% \texttt{islamdate\_today.js} on |https://webspace.science.uu.nl/|.
+% Copyright 1999-2002 by Ray Stott. Free to use if credited.
+%
+% Since the main aim is to provide a suitable |\today|, and maybe some
+% close dates, data just covers Hijri $\sim$1435/$\sim$1460 (Gregorian
+% $\sim$2014/$\sim$2038).
+%
+%    \begin{macrocode}
+\def\bbl at ca@umalqura at data{56660, 56690,56719,56749,56778,56808,%
+  56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,%
+  57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,%
+  57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,%
+  57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,%
+  58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,%
+  58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,%
+  58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,%
+  58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,%
+  59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,%
+  59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,%
+  59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,%
+  60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,%
+  60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,%
+  60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,%
+  60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,%
+  61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,%
+  61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,%
+  61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,%
+  62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,%
+  62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,%
+  62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,%
+  63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,%
+  63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,%
+  63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,%
+  63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,%
+  64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,%
+  64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,%
+  64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,%
+  65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,%
+  65401,65431,65460,65490,65520}
+\@namedef{bbl at ca@islamic-umalqura+}{\bbl at ca@islamcuqr at x{+1}}
+\@namedef{bbl at ca@islamic-umalqura}{\bbl at ca@islamcuqr at x{}}
+\@namedef{bbl at ca@islamic-umalqura-}{\bbl at ca@islamcuqr at x{-1}}
+\def\bbl at ca@islamcuqr at x#1#2-#3-#4\@@#5#6#7{%
+  \edef\bbl at tempd{\fp_eval:n{ % (Julian) day
+    \bbl at ca@jd{#2}{#3}{#4} + 0.5 - 2400000 #1}}%
+  \count@\@ne
+  \bbl at foreach\bbl at ca@umalqura at data{%
+    \advance\count@\@ne
+    \ifnum##1>\bbl at tempd\else
+      \edef\bbl at tempe{\the\count@}%
+      \edef\bbl at tempb{##1}%
+    \fi}%
+  \edef\bbl at templ{\fp_eval:n{ \bbl at tempe + 16260 + 949 }}% month~lunar
+  \edef\bbl at tempa{\fp_eval:n{ floor((\bbl at templ - 1 ) / 12) }}% annus
+  \edef#5{\fp_eval:n{ \bbl at tempa + 1  }}%
+  \edef#6{\fp_eval:n{ \bbl at templ - (12 * \bbl at tempa) }}%
+  \edef#7{\fp_eval:n{ \bbl at tempd - \bbl at tempb + 1 }}}
+\ExplSyntaxOff
+%</ca-islamic>
+%    \end{macrocode}
+%
 % \section{Support for Plain \TeX\ (\texttt{plain.def})}
 %
 % \subsection{Not renaming \file{hyphen.tex}}
diff --git a/babel.ins b/babel.ins
index d83b6b1..fe0bd14 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{2022/05/26}
+\def\filedate{2022/05/27}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
@@ -135,6 +135,7 @@
           \file{switch.def}{\from{babel.dtx}{kernel}}
           \file{hyphen.cfg}{\from{babel.dtx}{patterns}}
           \file{nil.ldf}{\from{babel.dtx}{nil}}
+          \file{babel-ca-islamic.tex}{\from{babel.dtx}{ca-islamic}}
           \file{xebabel.def}{\from{babel.dtx}{xetex}}
           \file{luababel.def}{\from{babel.dtx}{luatex}}
           \file{txtbabel.def}{\from{babel.dtx}{texxet}}
diff --git a/babel.pdf b/babel.pdf
index 1ef3abb..b57fe4c 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index 02fab1b..96288a7 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2022/05/26 v3.75.2749]
+\ProvidesFile{bbcompat.dtx}[2022/05/27 v3.75.2750]
 %</dtx>
 %
 %% File 'bbcompat.dtx'
diff --git a/locale/ar/babel-ar.ini b/locale/ar/babel-ar.ini
index 1e6a107..a99b849 100644
--- a/locale/ar/babel-ar.ini
+++ b/locale/ar/babel-ar.ini
@@ -26,7 +26,7 @@ script.tag.opentype = arab
 level = 1
 encodings = LAE
 derivate = no
-require.babel = arabic
+require.calendars = islamic
 
 [captions]
 preface = مدخل
diff --git a/locale/ar/babel-arabic.tex b/locale/ar/babel-arabic.tex
index c543637..5207dfd 100644
--- a/locale/ar/babel-arabic.tex
+++ b/locale/ar/babel-arabic.tex
@@ -10,85 +10,4 @@
 \BabelBeforeIni{ar}{%
 }
 
-\ExplSyntaxOn
-
-% == islamic-civil ==
-
-\def\bbl at cs@isltojd#1#2#3{ % year, month, day
-  ((#3 + ceil(29.5 * (#2 - 1)) +
-  (#1 - 1) * 354 + floor((3 + (11 * #1)) / 30) +
-  1948439.5) - 1) }
-  
-\@namedef{bbl at ca@islamic-civil++}{\bbl at ca@islamicvl at x{+2}}
-\@namedef{bbl at ca@islamic-civil+}{\bbl at ca@islamicvl at x{+1}}
-\@namedef{bbl at ca@islamic-civil}{\bbl at ca@islamicvl at x{}}
-\@namedef{bbl at ca@islamic-civil-}{\bbl at ca@islamicvl at x{-1}}
-\@namedef{bbl at ca@islamic-civil--}{\bbl at ca@islamicvl at x{-2}}
-
-\def\bbl at ca@islamicvl at x#1#2-#3-#4\@@#5#6#7{%
-  \edef\bbl at tempa{%
-    \fp_eval:n{ floor(\bbl at ca@jd{#2}{#3}{#4})+0.5 #1}}%
-  \edef#5{%
-    \fp_eval:n{ floor(((30*(\bbl at tempa-1948439.5)) + 10646)/10631) }}%
-  \edef#6{\fp_eval:n{
-    min(12,ceil((\bbl at tempa-(29+\bbl at cs@isltojd{#5}{1}{1}))/29.5)+1) }}%
-  \edef#7{\fp_eval:n{ \bbl at tempa - \bbl at cs@isltojd{#5}{#6}{1} + 1} }}
-  
-% == islamic-umalqura ==
-
-% Data covers Hijri ~1435/~1460 (Gregorian ~2014/~2038)
-\def\bbl at ca@umalqura at data{56660, 56690,56719,56749,56778,56808,%
-  56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,%
-  57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,%
-  57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,%
-  57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,%
-  58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,%
-  58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,%
-  58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,%
-  58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,%
-  59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,%
-  59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,%
-  59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,%
-  60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,%
-  60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,%
-  60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,%
-  60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,%
-  61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,%
-  61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,%
-  61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,%
-  62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,%
-  62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,%
-  62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,%
-  63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,%
-  63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,%
-  63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,%
-  63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,%
-  64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,%
-  64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,%
-  64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,%
-  65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,%
-  65401,65431,65460,65490,65520}
-
-\@namedef{bbl at ca@islamic-umalqura+}{\bbl at ca@islamcuqr at x{+1}}
-\@namedef{bbl at ca@islamic-umalqura}{\bbl at ca@islamcuqr at x{}}
-\@namedef{bbl at ca@islamic-umalqura-}{\bbl at ca@islamcuqr at x{-1}}
-
-\def\bbl at ca@islamcuqr at x#1#2-#3-#4\@@#5#6#7{%
-  \edef\bbl at tempd{\fp_eval:n{ % (Julian) day
-    \bbl at ca@jd{#2}{#3}{#4} + 0.5 - 2400000 #1}}%
-  \count@\@ne
-  \bbl at foreach\bbl at ca@umalqura at data{%
-    \advance\count@\@ne
-    \ifnum##1>\bbl at tempd\else
-      \edef\bbl at tempe{\the\count@}%
-      \edef\bbl at tempb{##1}%
-    \fi}%
-  \edef\bbl at templ{\fp_eval:n{ \bbl at tempe + 16260 + 949 }}% month~lunar
-  \edef\bbl at tempa{\fp_eval:n{ floor((\bbl at templ - 1 ) / 12) }}% annus
-  \edef#5{\fp_eval:n{ \bbl at tempa + 1  }}%
-  \edef#6{\fp_eval:n{ \bbl at templ - (12 * \bbl at tempa) }}%
-  \edef#7{\fp_eval:n{ \bbl at tempd - \bbl at tempb + 1 }}}
-  
-\ExplSyntaxOff
-
 \endinput





More information about the latex3-commits mailing list.