[latex3-commits] [git/LaTeX3-latex3-babel] main: Persian calendar. (0dfd679)

Javier email at dante.de
Wed Jun 1 17:34:34 CEST 2022


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

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

commit 0dfd67940f574516fb6e515e4efa47f37fbc4651
Author: Javier <email at localhost>
Date:   Wed Jun 1 17:34:34 2022 +0200

    Persian calendar.


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

0dfd67940f574516fb6e515e4efa47f37fbc4651
 README.md              |   6 +++---
 babel.dtx              |  53 ++++++++++++++++++++++++++++++++++++++++++++++---
 babel.ins              |   3 ++-
 babel.pdf              | Bin 877688 -> 880288 bytes
 bbcompat.dtx           |   2 +-
 locale/fa/babel-fa.ini |   5 +++--
 6 files changed, 59 insertions(+), 10 deletions(-)

diff --git a/README.md b/README.md
index 289403d..8dad649 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## Babel 3.75.2751
+## Babel 3.75.2755
 
 *(Development)*
 
@@ -48,9 +48,9 @@ respective authors.
 
 ### Summary of latest changes
 ```
-3.75   (dev)
+3.76   (dev)
        * Calendar conversion with a new macro \babelcalendar: hebrew,
-         islamic-civil, islamic-umalqura.
+         islamic-civil, islamic-umalqura, persian.
 
 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 823810e..004832a 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -32,7 +32,7 @@
 %
 % \iffalse
 %<*filedriver>
-\ProvidesFile{babel.dtx}[2022/05/28 v3.75.2751 The Babel package]
+\ProvidesFile{babel.dtx}[2022/06/01 v3.75.2755 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.2751>>
-%<<date=2022/05/28>>
+%<<version=3.75.2755>>
+%<<date=2022/06/01>>
 %    \end{macrocode}
 %
 % \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -23077,6 +23077,53 @@ Babel.cjk_breaks = {
 %</ca-hebrew>
 %    \end{macrocode}
 %
+% \section{Persian}
+%
+% There is an algorithm written in TeX by Jabri, Abolhassani, Pournader
+% and Esfahbod, created for the first versions of the FarsiTeX system
+% (no longer available), but the original license is GPL, so its use
+% with LPPL is problematic. The code here follows loosely that by John
+% Walker, which is free and accurate, but sadly very complex, so
+% the relevant data for the years 2013-2050 have been pre-calculated
+% and stored. Actually, all we need is the first day (either March 20 or
+% March 21).
+%
+%    \begin{macrocode}
+%<*ca-persian>
+\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) }}   
+\def\bbl at ca@firstjal at xx{2012,2016,2020,2024,2028,2029,% March 20
+  2032,2033,2036,2037,2040,2041,2044,2045,2048,2049}
+\def\bbl at ca@persian#1-#2-#3\@@#4#5#6{%
+  \edef\bbl at tempa{#1}%  20XX-03-\bbl at tempe = 1 farvardin:
+  \bbl at xin@{\bbl at tempa}{\bbl at ca@firstjal at xx}%
+  \ifin@\def\bbl at tempe{20}\else\def\bbl at tempe{21}\fi
+  \edef\bbl at tempc{\fp_eval:n{\bbl at ca@jd{\bbl at tempa}{#2}{#3}+.5}}% current
+  \edef\bbl at tempb{\fp_eval:n{\bbl at ca@jd{\bbl at tempa}{03}{\bbl at tempe}+.5}}% begin
+  \ifnum\bbl at tempc<\bbl at tempb
+    \edef\bbl at tempa{\fp_eval:n{\bbl at tempa-1}}% go back 1 year and redo
+    \bbl at xin@{\bbl at tempa}{\bbl at ca@firstjal at xx}%
+    \ifin@\def\bbl at tempe{20}\else\def\bbl at tempe{21}\fi
+    \edef\bbl at tempb{\fp_eval:n{\bbl at ca@jd{\bbl at tempa}{03}{\bbl at tempe}+.5}}%
+  \fi
+  \edef#4{\fp_eval:n{\bbl at tempa-621}}% set Jalali year
+  \edef#6{\fp_eval:n{\bbl at tempc-\bbl at tempb+1}}% days from 1 farvardin
+  \edef#5{\fp_eval:n{% set Jalali month
+    (#6 <= 186) ? ceil(#6 / 31) : ceil((#6 - 6) / 30)}}
+  \edef#6{\fp_eval:n{% set Jalali day
+    (#6 - ((#5 <= 7) ? ((#5 - 1) * 31) : (((#5 - 1) * 30) + 6)))}}}
+\ExplSyntaxOff
+%</ca-persian>
+%    \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 207aaf3..ea1dc95 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/28}
+\def\filedate{2022/06/01}
 \def\batchfile{babel.ins}
 \input docstrip.tex
 
@@ -137,6 +137,7 @@
           \file{nil.ldf}{\from{babel.dtx}{nil}}
           \file{babel-ca-hebrew.tex}{\from{babel.dtx}{ca-hebrew}}
           \file{babel-ca-islamic.tex}{\from{babel.dtx}{ca-islamic}}
+          \file{babel-ca-persian.tex}{\from{babel.dtx}{ca-persian}}
           \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 e0e9d6a..0a03c24 100644
Binary files a/babel.pdf and b/babel.pdf differ
diff --git a/bbcompat.dtx b/bbcompat.dtx
index 50abf1b..4948261 100644
--- a/bbcompat.dtx
+++ b/bbcompat.dtx
@@ -30,7 +30,7 @@
 %
 % \iffalse
 %<*dtx>
-\ProvidesFile{bbcompat.dtx}[2022/05/28 v3.75.2751]
+\ProvidesFile{bbcompat.dtx}[2022/06/01 v3.75.2755]
 %</dtx>
 %
 %% File 'bbcompat.dtx'
diff --git a/locale/fa/babel-fa.ini b/locale/fa/babel-fa.ini
index dcd28df..61c2f02 100644
--- a/locale/fa/babel-fa.ini
+++ b/locale/fa/babel-fa.ini
@@ -11,8 +11,8 @@
 
 [identification]
 charset = utf8
-version = 1.8
-date = 2021-05-16
+version = 1.9
+date = 2022-06-01
 name.local = فارسی
 name.english = Persian
 name.babel = persian
@@ -27,6 +27,7 @@ script.tag.opentype = arab
 level = 1
 encodings = 
 derivate = no
+require.calendars = persian
 
 [captions]
 preface = پیشگفتار





More information about the latex3-commits mailing list.