Skip to content

Commit

Permalink
support date format yyyy-mm-dd
Browse files Browse the repository at this point in the history
  • Loading branch information
Sophanatprime committed Apr 26, 2024
1 parent 6fd6d47 commit c32554e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
5 changes: 3 additions & 2 deletions library/cus.library.doc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@
\def\dotfil{\leaders\hbox to.6em{\hss .\hss}\hskip\z@ plus 1fill\kern\z@}
\def\pfill{\unskip~\dotfill\penalty500\strut\nobreak\dotfil~\ignorespaces}
}
\prop_new:N \g__cus_doc_version_date_prop
\prop_new_linked:N \g__cus_doc_version_date_prop
\tl_new:N \saved@indexname
\tl_new:N \saved@macroname
\tl_const:Nn \generalname { General }
Expand Down Expand Up @@ -1021,7 +1021,8 @@
{ \cs_set_protected:Npn \__cus_doc_ltx_changes:nnn #1#2#3 { \group_end: \@esphack } }
\cs_set_protected:Npn \changes@ #1#2
{
\__cus_doc_save_version_date:nn {#1} {#2}
\exp_args:Nne \__cus_doc_save_version_date:nn
{#1} { \__cus_date_normalize:n {#2} }
\tl_if_empty:nTF {#1}
{ \__cus_doc_ltx_changes:nnn }
{ \__cus_doc_version_zfill:wnnn #1 \q_stop }
Expand Down
20 changes: 20 additions & 0 deletions module/cus.module.ltx.tex
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,26 @@
\if:w + #1 \exp_after:wN \use:nn \else: \exp_after:wN \use_ii_i:nn \fi:
{ \prg_replicate:nn { \int_max:nn { #2 - \tl_count:n {#3} } { 0 } } {#4} } {#3}
}

\cs_new:Npn \__cus_date_normalize:n #1
{ \__cus_date_normalize_auxi:w #1 / / / \s__cus_stop }
\cs_new:Npn \__cus_date_normalize_auxi:w #1/#2/#3/#4 \s__cus_stop
{
\tl_if_empty:nTF {#4}
{ \__cus_date_normalize_auxii:w #1 - - - \s__cus_stop }
{ \__cus_date_normalize_auxiii:nnn {#1} {#2} {#3} }
}
\cs_new:Npn \__cus_date_normalize_auxii:w #1-#2-#3-#4 \s__cus_stop
{ \__cus_date_normalize_auxiii:nnn {#1} {#2} {#3} }
\cs_new:Npn \__cus_date_normalize_auxiii:nnn #1#2#3
{
\elkernel_exp:w
{
\int_value:w 0#1 /
\if_int_compare:w 0#2 < \c__cus_ten_int 0 \fi: \int_value:w 0#2 /
\if_int_compare:w 0#3 < \c__cus_ten_int 0 \fi: \int_value:w 0#3
}
}
\ExplSyntaxOff


Expand Down

0 comments on commit c32554e

Please sign in to comment.