diff options
author | Norbert Preining <norbert@preining.info> | 2024-01-11 03:01:30 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-01-11 03:01:30 +0000 |
commit | b14090c9f3c7797e26fed9eb2b83ce144dcb16a3 (patch) | |
tree | 95ddb409d32efce7b7e9c8353ccdbe648b86ae1f /macros/latex/contrib/tcolorbox/tcbprocessing.code.tex | |
parent | cdb8117b8f1ac752d1927b82759c5be9f0ec0ab5 (diff) |
CTAN sync 202401110301
Diffstat (limited to 'macros/latex/contrib/tcolorbox/tcbprocessing.code.tex')
-rw-r--r-- | macros/latex/contrib/tcolorbox/tcbprocessing.code.tex | 104 |
1 files changed, 47 insertions, 57 deletions
diff --git a/macros/latex/contrib/tcolorbox/tcbprocessing.code.tex b/macros/latex/contrib/tcolorbox/tcbprocessing.code.tex index 83f0ec2cb5..ce0ae43075 100644 --- a/macros/latex/contrib/tcolorbox/tcbprocessing.code.tex +++ b/macros/latex/contrib/tcolorbox/tcbprocessing.code.tex @@ -1,8 +1,8 @@ -%% The LaTeX package tcolorbox - version 6.1.0 (2023/09/26) +%% The LaTeX package tcolorbox - version 6.2.0 (2024/01/10) %% tcbprocessing.code.tex: Code for conditional processing %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2006-2023 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de> +%% Copyright (c) 2006-2024 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de> %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -17,64 +17,54 @@ %% %% This work consists of all files listed in README %% -\tcb@set@library@version{6.1.0} +\tcb@set@library@version{6.2.0} -\RequirePackage{pdftexcmds} -\RequirePackage{shellesc} +\ExplSyntaxOn -\ifdefined\pdf@filemdfivesum\else% XeLaTeX presumed ... - \def\pdf@filemdfivesum#1{\mdfivesum file {#1}}% -\fi -\ifdefined\pdf@filemoddate\else% very poor XeLaTeX bypassing - \def\pdf@filemoddate#1{}% -\fi +\bool_new:N \l__tcobox_proc_hash_equal_bool -\def\tcbproc@readmdfive#1#2{% - \edef\tcbprocmdfivesum{\pdf@filemdfivesum{#1}}% - \IfFileExists{#2}{\input{#2}}{\def\tcbproclastmdfivesum{}}% -} +\cs_new_protected:Npn \__tcobox_proc_compute_hash:nn #1#2 + { + \tl_set:Ne \l__tcobox_tmpa_tl { \file_mdfive_hash:n { #1 } } + \file_get:nnN { #2 } { } \l__tcobox_tmpb_tl + \str_if_eq:eeTF { \l__tcobox_tmpa_tl } { \tl_trim_spaces:o { \l__tcobox_tmpb_tl } } + { + \bool_set_true:N \l__tcobox_proc_hash_equal_bool + } + { + \bool_set_false:N \l__tcobox_proc_hash_equal_bool + \iow_open:Nn \g__tcobox_out_iow { #2 } + \iow_now:NV \g__tcobox_out_iow \l__tcobox_tmpa_tl + \iow_close:N \g__tcobox_out_iow + } + } -\def\tcbproc@writemdfive#1{% - \tcb@allocate@tcb@out% - \immediate\openout\tcb@out=#1% - \immediate\write\tcb@out{\string\def\string\tcbproclastmdfivesum{\tcbprocmdfivesum}\@percentchar}% - \immediate\closeout\tcb@out% -} +\prg_new_protected_conditional:Npnn \__tcobox_if_file_process:nnnn #1#2#3#4 { TF } + { + \__tcobox_proc_compute_hash:nn {#2} {#3} + \int_case:nn {#1} + { + {0} { \prg_return_true: } + {1} + { + \bool_if:NTF \l__tcobox_proc_hash_equal_bool + { + \file_if_exist:nTF {#4} + { + \file_compare_timestamp:nNnTF {#4} < {#3} + { \prg_return_true: } + { \prg_return_false: } + } + { \prg_return_true: } + } + { + \prg_return_true: + } + } + {2} { \prg_return_false: } + } + } -\newrobustcmd{\iftcb@process@on}[3]{% - \tcbproc@readmdfive{#1}{#2}% - \ifdefstrequal{\tcbproclastmdfivesum}{\tcbprocmdfivesum}{}{\tcbproc@writemdfive{#2}}% - \expandafter\@firstoftwo% -} +\cs_gset_eq:NN \tcbiffileprocess \__tcobox_if_file_process:nnnnTF -\newrobustcmd{\iftcb@process@conditional}[3]{% - \tcbproc@readmdfive{#1}{#2}% - \ifdefstrequal{\tcbproclastmdfivesum}{\tcbprocmdfivesum}{% - \IfFileExists{#3}{% - \ifnum\pdf@strcmp{\pdf@filemoddate{#2}}{\pdf@filemoddate{#3}}>0\relax% - \expandafter\@firstoftwo% - \else% - \expandafter\@secondoftwo% - \fi% - }{\expandafter\@firstoftwo}% - }{% - \tcbproc@writemdfive{#2}% - \expandafter\@firstoftwo% - }% -} - -\newrobustcmd{\iftcb@process@off}[3]{% - \tcbproc@readmdfive{#1}{#2}% - \ifdefstrequal{\tcbproclastmdfivesum}{\tcbprocmdfivesum}{}{\tcbproc@writemdfive{#2}}% - \expandafter\@secondoftwo% -}% - -\newrobustcmd{\tcbiffileprocess}[1]{% - \ifcase\numexpr#1\relax% - \expandafter\iftcb@process@on% - \or% - \expandafter\iftcb@process@conditional% - \else% - \expandafter\iftcb@process@off% - \fi% -} +\ExplSyntaxOff |