diff --git a/doc/robust-externalize.pdf b/doc/robust-externalize.pdf index 404690c..39498d9 100644 Binary files a/doc/robust-externalize.pdf and b/doc/robust-externalize.pdf differ diff --git a/doc/robust-externalize.tex b/doc/robust-externalize.tex index 0df38fc..d689f93 100644 --- a/doc/robust-externalize.tex +++ b/doc/robust-externalize.tex @@ -147,7 +147,7 @@ \section{A taste of this library} Since v2.3 we also provide a way to include online pictures with |\includegraphicsWeb|: \begin{codeexample}[width=0pt,vbox] -Here is a picture of cat downloaded online: \includegraphicsWeb[width=3cm]{http://placekitten.com/400/300}. +Here is a picture of cat downloaded online: \includegraphicsWeb[width=3cm]{https://placebear.com/400/300}. \end{codeexample} You can also cache arbitrary code (e.g.\ python). Note that if you use a version before 2.7, you cannot indent the python code. You can also define arbitrary compilation commands, inclusion commands, and presets to fit you need. For instance, you can create a preset to obtain: @@ -3547,6 +3547,7 @@ \subsubsection{Forward macros}\label{sec:forward} \makeatletter% \def\extrakeytext{style, } \extractkey/robExt/if matches=\marg{string}\marg{style to apply}\@nil + \extractkey/robExt/if matches else=\marg{string}\marg{style to apply if match}\marg{style to apply if no match}\@nil \extractkey/robExt/if matches word=\marg{string}\marg{style to apply}\@nil \extractkey/robExt/if matches regex=\marg{latex3 regex}\marg{style to apply}\@nil \extractkey/robExt/register word with namespace=\marg{namespace}\marg{word}\marg{style}\@nil @@ -4138,7 +4139,7 @@ \subsubsection{Online images} \pgfmanualbody |\includegraphicsWeb| is used in place of |\includegraphics| to download online images: \begin{codeexample}[width=0pt,vbox] -Here is a cat downloaded online: \includegraphicsWeb[width=3cm]{http://placekitten.com/400/300}. +Here is a cat downloaded online: \includegraphicsWeb[width=3cm]{https://placebear.com/400/300}. \end{codeexample} By default, the engine uses |wget| in linux (since it is installed by default) and |curl| on windows (should also be installed by default on recent windows). But you can change it by modifying the |web image| preset (or using the optional robExt options that are loaded after |web image|): \begin{codeexample}[width=0pt,vbox] @@ -4148,7 +4149,7 @@ \subsubsection{Online images} }, } -Here is a cat downloaded online: \includegraphicsWeb[width=3cm]{http://placekitten.com/400/303}. +Here is a cat downloaded online: \includegraphicsWeb[width=3cm]{https://placebear.com/400/303}. \end{codeexample} By default, the |wget| and |curl| presets are defined as: \begin{verbatim} @@ -4966,6 +4967,8 @@ \section{Changelog} \item Fix bug with |no cache folder| \item Fix bug with |add to compilation command options| not working \item Added |forward counter and back| and |forward counter back| + \item Fix infinite compilation time when input does not exist (WARNING:, it will invalidate all previously cached LaTeX documents since this adds a compilation option to LaTeX by default! If you want to use the old buggy behavior to preserve your cache, define |\robExtSetPlaceholder{__ROBEXT_LATEX_COMPILATION_COMMAND_OPTIONS__}{-halt-on-error}|. Anyway, if you want truly reproducible caching, just copy the .sty file in your project) + \item Support |if matches else| \end{itemize} \item v2.9 (2024/03/15) \begin{itemize} diff --git a/robust-externalize.sty b/robust-externalize.sty index b4623de..a70fabe 100644 --- a/robust-externalize.sty +++ b/robust-externalize.sty @@ -2373,8 +2373,8 @@ if __name__ == '__main__': \regex_match:nVTF {#1} \l__robExt_placeholder___ROBEXT_MAIN_CONTENT_ORIG___str {\pgfkeysalso{#2}} {} } -\NewDocumentCommand{\robExtIfMatchesString}{mm}{ - \str_if_in:NnTF \l__robExt_placeholder___ROBEXT_MAIN_CONTENT_ORIG___str {#1} {\pgfkeysalso{#2}} {} +\NewDocumentCommand{\robExtIfMatchesString}{mmm}{ + \str_if_in:NnTF \l__robExt_placeholder___ROBEXT_MAIN_CONTENT_ORIG___str {#1} {\pgfkeysalso{#2}} {\pgfkeysalso{#3}} } % \robExtRegisterWord {namespace} {word} {style} @@ -3080,7 +3080,8 @@ if __name__ == '__main__': auto forward words/.style={auto forward words namespace={}}, %% This will if matches regex/.code 2 args={\robExtIfMatchesRegex{#1}{#2}}, - if matches/.code 2 args={\robExtIfMatchesString{#1}{#2}}, + if matches/.code 2 args={\robExtIfMatchesString{#1}{#2}{}}, + if matches else/.code n args={3}{\robExtIfMatchesString{#1}{#2}{#3}}, if matches word/.code 2 args={% \robExtRegisterWord{}{#1}{#2}% % If ran inside a preset, we want to enable it, otherwise we enable it on the latex preset @@ -3476,7 +3477,7 @@ __ROBEXT_LATEX_WRITE_DEPTH_TO_OUT_FILE__% %% Compilation commands \robExtSetPlaceholder{__ROBEXT_LATEX_COMPILATION_COMMAND__}{__ROBEXT_LATEX_ENGINE__ __ROBEXT_LATEX_COMPILATION_COMMAND_OPTIONS__ "__ROBEXT_SOURCE_FILE__"} -\robExtSetPlaceholder{__ROBEXT_LATEX_COMPILATION_COMMAND_OPTIONS__}{-halt-on-error} +\robExtSetPlaceholder{__ROBEXT_LATEX_COMPILATION_COMMAND_OPTIONS__}{-halt-on-error -interaction=nonstopmode} \robExtSetPlaceholder{__ROBEXT_LATEX_ENGINE__}{pdflatex} \robExtConfigure{