From 74abcdb3fc2356cd40aa94d002f2a19aac549b40 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 29 Jun 2020 20:35:31 +0200 Subject: 2020-06-29 19:45:00 --- tex/context/base/mkiv/core-con.mkiv | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'tex/context/base/mkiv/core-con.mkiv') diff --git a/tex/context/base/mkiv/core-con.mkiv b/tex/context/base/mkiv/core-con.mkiv index acf5cd5a3..fd45aed6c 100644 --- a/tex/context/base/mkiv/core-con.mkiv +++ b/tex/context/base/mkiv/core-con.mkiv @@ -414,8 +414,28 @@ %D \stopbuffer %D %D \typebuffer \getbuffer +%D +%D Some indirectness and abstraction: +%D +%D \starttyping +%D \definedate[crap][year] +%D \currentdate[crap] +%D \stoptyping + +\installcorenamespace{date} + +\unexpanded\def\definedate + {\dodoubleargument\syst_converters_define_date} + +\def\syst_converters_define_date[#1][#2]% + {\setvalue{\??date#1}{#2}} + +\def\syst_converters_check_date_specification#1% + {\ifcsname\??date#1\endcsname + \edef#1{\lastnamedcs}% + \fi} -\newtoks \everycurrentdate +\newtoks\everycurrentdate \unexpanded\def\currentdate {\dosingleempty\syst_converters_current_date} @@ -424,8 +444,11 @@ {\dontleavehmode \begingroup \the\everycurrentdate + \edef\forceddatespecification{#1}% + \syst_converters_check_date_specification\forceddatespecification + \syst_converters_check_date_specification\currentdatespecification \clf_currentdate - {#1}{\currentdatespecification}{\labellanguage}% + {\forceddatespecification}{\currentdatespecification}{\labellanguage}% \normalyear\normalmonth\normalday \endgroup} @@ -448,8 +471,11 @@ \fi \begingroup \the\everycurrentdate + \edef\forceddatespecification{#2}% + \syst_converters_check_date_specification\forceddatespecification + \syst_converters_check_date_specification\currentdatespecification \clf_currentdate - {#2}{\currentdatespecification}{\labellanguage}% + {\forceddatespecification}{\currentdatespecification}{\labellanguage}% \normalyear\normalmonth\normalday \endgroup} -- cgit v1.2.3