diff options
author | Karl Berry <karl@freefriends.org> | 2022-03-12 20:34:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-03-12 20:34:46 +0000 |
commit | a5952dd62e1608ef0fbc01ced6d9344ea5d69cb7 (patch) | |
tree | 7115de7390b92535d1ae2ca1577a3a82acfd7fda /Master/texmf-dist/tex/latex/projlib/projlib-datetime.sty | |
parent | 65307ba55aef6eb6541ec5ac312ac8556b24e690 (diff) |
projlib (12mar22)
git-svn-id: svn://tug.org/texlive/trunk@62661 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/projlib/projlib-datetime.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/projlib/projlib-datetime.sty | 76 |
1 files changed, 30 insertions, 46 deletions
diff --git a/Master/texmf-dist/tex/latex/projlib/projlib-datetime.sty b/Master/texmf-dist/tex/latex/projlib/projlib-datetime.sty index 07c1473171a..aa182abe7c0 100644 --- a/Master/texmf-dist/tex/latex/projlib/projlib-datetime.sty +++ b/Master/texmf-dist/tex/latex/projlib/projlib-datetime.sty @@ -1,8 +1,25 @@ +%% +%% This is file `projlib-datetime.sty', +%% generated with the docstrip utility. + +%% Copyright (C) 2021-2022 by Jinwen XU +%% +%% This is part of the ProjLib Toolkit. +%% +%% This work may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License, either version 1.3c of this license or (at +%% your option) any later version. The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% \NeedsTeXFormat{LaTeX2e}[2020-10-01] \RequirePackage{l3keys2e} \ProvidesExplPackage {projlib-datetime} - {2022/03/03} {} + {2022/03/11} {} {Convert numeric date-time string to natural language} \tl_new:N \g__projlib_datetime_input_format_tl @@ -72,7 +89,6 @@ \projlib_datetime_set_input_format:n { #1 } } - \seq_new:N \l__projlib_datetime_date_seq \cs_new_protected:Nn \projlib_datetime_text_superscript:n @@ -83,7 +99,6 @@ \group_end: } - \cs_new:Nn \__projlib_datetime_today:n { \str_case_e:nnF { \l__projlib_datetime_output_format_tl } @@ -146,10 +161,6 @@ \group_end: } -\ProvideDocumentCommand \Thedate {} { \ProjLibdate } -\ProvideDocumentCommand \TheDate {} { \ProjLibDate } - - \cs_new_protected:Nn \projlib_datetime_display_year_month_day:n { \__projlib_datetime_display_year_month_day:en { #1 } {} @@ -194,7 +205,6 @@ } \cs_generate_variant:Nn \__projlib_datetime_display_year_month_day:nn { en } - \cs_new_protected:Nn \projlib_datetime_display_month_day_year:n { \__projlib_datetime_display_month_day_year:en { #1 } {} @@ -239,7 +249,6 @@ } \cs_generate_variant:Nn \__projlib_datetime_display_month_day_year:nn { en } - \cs_new_protected:Nn \projlib_datetime_display_day_month_year:n { \__projlib_datetime_display_day_month_year:en { #1 } {} @@ -284,7 +293,6 @@ } \cs_generate_variant:Nn \__projlib_datetime_display_day_month_year:nn { en } - \cs_new_protected:Nn \__projlib_datetime_date_parse_year_month_day:n { \regex_match:nnTF { \A \d{4}-\d{1,2}(|-\d{1,2}) \Z } { #1 } @@ -382,26 +390,30 @@ } } -\NewDocumentCommand \ProjLibdate { O{} m } +\NewDocumentCommand \ProjLibdate { O{} m O{} } { \group_begin: - \keys_set:nn { projlib-datetime-command } { #1 } - \tl_set:Nn \l_tmpa_tl { #2 } + \tl_if_blank:eF { #1 } { \keys_set:nn { projlib-datetime-command } { #1 } } + \tl_if_blank:eF { #3 } { \keys_set:nn { projlib-datetime-command } { #3 } } + \tl_set:Nx \l_tmpa_tl { #2 } \regex_replace_all:nnN { \D } { - } \l_tmpa_tl - \__projlib_datetime_display_date_according_to_format:nn { \l_tmpa_tl } {} + \exp_args:Ne \__projlib_datetime_display_date_according_to_format:nn { \l_tmpa_tl } {} \group_end: } -\NewDocumentCommand \ProjLibDate { O{} m } + \NewDocumentCommand \ProjLibDate { O{} m O{} } { \group_begin: - \keys_set:nn { projlib-datetime-command } { #1 } - \tl_set:Nn \l_tmpa_tl { #2 } + \tl_if_blank:eF { #1 } { \keys_set:nn { projlib-datetime-command } { #1 } } + \tl_if_blank:eF { #3 } { \keys_set:nn { projlib-datetime-command } { #3 } } + \tl_set:Nx \l_tmpa_tl { #2 } \regex_replace_all:nnN { \D } { - } \l_tmpa_tl - \__projlib_datetime_display_date_according_to_format:nn { \l_tmpa_tl } { _uppercase } + \exp_args:Ne \__projlib_datetime_display_date_according_to_format:nn { \l_tmpa_tl } { _uppercase } \group_end: } +\ProvideDocumentCommand \Thedate {} { \ProjLibdate } +\ProvideDocumentCommand \TheDate {} { \ProjLibDate } \int_new:N \l__projlib_datetime_day_of_week_day_int \int_new:N \l__projlib_datetime_day_of_week_month_int @@ -463,7 +475,6 @@ } } - \cs_new_protected:Nn \projlib_datetime_display_week:n { \__projlib_datetime_display_week_according_to_format:en { #1 } {} @@ -481,7 +492,6 @@ } \cs_generate_variant:Nn \__projlib_datetime_display_week_according_to_format:nn { en } - \cs_new_protected:Nn \projlib_datetime_calculate_week_according_to_format:n { \cs_if_exist_use:c { __projlib_datetime_date_parse_ \__projlib_datetime_input_format_to_str: :n } { #1 } @@ -492,22 +502,6 @@ } -% For each language, there are 7 groups of functions: -% 1) \projlib_datetime_display_year_month_day_<languagename>:nnn -% \projlib_datetime_display_year_month_day_uppercase_<languagename>:nnn -% 2) \projlib_datetime_display_year_month_<languagename>:nn -% \projlib_datetime_display_year_month_uppercase_<languagename>:nn -% 3) \projlib_datetime_display_month_day_<languagename>:nn -% \projlib_datetime_display_month_day_uppercase_<languagename>:nn -% 4) \projlib_datetime_display_year_<languagename>:n -% \projlib_datetime_display_year_uppercase_<languagename>:n -% 5) \projlib_datetime_display_month_<languagename>:n -% \projlib_datetime_display_month_uppercase_<languagename>:n -% 6) \projlib_datetime_display_day_<languagename>:n -% \projlib_datetime_display_day_uppercase_<languagename>:n -% 7) \projlib_datetime_display_week_<languagename>:n -% \projlib_datetime_display_week_uppercase_<languagename>:n - \cs_new:Nn \projlib_datetime_display_year_month_day_english:nnn { \projlib_datetime_display_month_day_english:nn { #2 } { #3 } @@ -605,7 +599,6 @@ \projlib_datetime_display_week_english:n { #1 } } - \cs_new:Nn \projlib_datetime_display_year_month_day_french:nnn { \projlib_datetime_display_month_day_french:nn { #2 } { #3 } @@ -737,7 +730,6 @@ } { ??? } } - \cs_new:Nn \projlib_datetime_display_year_month_day_ngerman:nnn { \projlib_datetime_display_month_day_ngerman:nn { #2 } { #3 } @@ -847,7 +839,6 @@ \projlib_datetime_display_week_ngerman:n { #1 } } - \cs_new:Nn \projlib_datetime_display_year_month_day_italian:nnn { \projlib_datetime_display_month_day_italian:nn { #2 } { #3 } @@ -966,7 +957,6 @@ } { ??? } } - \cs_new:Nn \projlib_datetime_display_year_month_day_portuguese:nnn { \projlib_datetime_display_month_day_portuguese:nn { #2 } { #3 } @@ -1085,7 +1075,6 @@ } { ??? } } - \cs_new:Nn \projlib_datetime_display_year_month_day_brazilian:nnn { \projlib_datetime_display_month_day_brazilian:nn { #2 } { #3 } @@ -1204,7 +1193,6 @@ } { ??? } } - \cs_new:Nn \projlib_datetime_display_year_month_day_spanish:nnn { \projlib_datetime_display_month_day_spanish:nn { #2 } { #3 } @@ -1323,7 +1311,6 @@ } { ??? } } - \cs_new:Nn \projlib_datetime_display_year_month_day_schinese:nnn { #1 年 #2 月 #3 日 @@ -1386,7 +1373,6 @@ \projlib_datetime_display_week_schinese:n { #1 } } - \cs_new:Nn \projlib_datetime_display_year_month_day_tchinese:nnn { #1 年 #2 月 #3 日 @@ -1449,7 +1435,6 @@ \projlib_datetime_display_week_tchinese:n { #1 } } - \cs_new:Nn \projlib_datetime_display_year_month_day_japanese:nnn { #1 年 #2 月 #3 日 @@ -1512,7 +1497,6 @@ \projlib_datetime_display_week_japanese:n { #1 } } - \cs_new:Nn \projlib_datetime_display_year_month_day_russian:nnn { \projlib_datetime_display_month_day_russian:nn { #2 } { #3 } |