From f36538ed14c785d773f64c310d061141976da154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Novotn=C3=BD?= Date: Sun, 26 Jun 2022 13:22:14 +0200 Subject: [PATCH] Add `\markdownMode` value 4 --- markdown.dtx | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/markdown.dtx b/markdown.dtx index 99c0e02bb..47b3a482d 100644 --- a/markdown.dtx +++ b/markdown.dtx @@ -8307,10 +8307,10 @@ For more information, see the examples for the \Opt{finalizeCache} option. % \begin{markdown} % % The \mdef{markdownOptionInputTempFileName} macro sets the filename of the -% temporary input file that is created during the conversion from markdown to -% plain \TeX{} in \mref{markdownMode} other than `2`. It defaults to -% \mref{jobname}`.markdown.in`. The same limitations as in the case of the -% \mref{markdownOptionHelperScriptFileName} macro apply here. +% temporary input file that is created during the buffering of markdown text +% from a \TeX{} source. It defaults to \mref{jobname}`.markdown.in`. The same +% limitations as in the case of the \mref{markdownOptionHelperScriptFileName} +% macro apply here. % % \end{markdown} % \begin{macrocode} @@ -14397,6 +14397,7 @@ following text: % - `0` – Shell escape via the 18 output file stream % - `1` – Shell escape via the Lua \luamref{os.execute} method % - `2` – Direct Lua access +% - `3` – The \pkg{lt3luabridge} Lua package % % By defining the macro, the user can coerce the package to use a specific mode. % If the user does not define the macro prior to loading the plain \TeX{} @@ -14406,13 +14407,32 @@ following text: % % \end{markdown} % \begin{macrocode} -\ifx\markdownMode\undefined - \ifx\directlua\undefined - \def\markdownMode{0}% - \else - \def\markdownMode{2}% - \fi -\fi +\ExplSyntaxOn +\cs_if_exist:NF + \markdownMode + { + \file_if_exist:nTF + { lt3luabridge.tex } + { + \cs_new:Npn + \markdownMode + { 4 } + } + { + \cs_if_exist:NTF + \directlua + { + \cs_new:Npn + \markdownMode + { 2 } + } + { + \cs_new:Npn + \markdownMode + { 0 } + } + } + } % \end{macrocode} % \begin{markdown} % @@ -14423,14 +14443,12 @@ following text: % % \end{markdown} % \begin{macrocode} -\ExplSyntaxOn \int_new:N \g__luabridge_method_int \int_gset:Nn \g__luabridge_method_int { \markdownMode } \ExplSyntaxOff -\input l3luabridge\relax % \end{macrocode} % \par % \begin{markdown}