diff options
Diffstat (limited to 'Master/texmf-dist/source/lualatex/piton/piton.dtx')
-rw-r--r-- | Master/texmf-dist/source/lualatex/piton/piton.dtx | 98 |
1 files changed, 76 insertions, 22 deletions
diff --git a/Master/texmf-dist/source/lualatex/piton/piton.dtx b/Master/texmf-dist/source/lualatex/piton/piton.dtx index c8f13eabb56..c40a3c86315 100644 --- a/Master/texmf-dist/source/lualatex/piton/piton.dtx +++ b/Master/texmf-dist/source/lualatex/piton/piton.dtx @@ -72,12 +72,12 @@ % \iffalse %<*STY> % \fi -\def\PitonFileVersion{2.7a} -\def\PitonFileDate{2024/03/30} +\def\PitonFileVersion{2.8} +\def\PitonFileDate{2024/04/14} % \iffalse %</STY> %<*LUA> -piton_version = "2.7a" -- 2024/03/30 +piton_version = "2.8" -- 2024/04/14 %</LUA> %\fi % @@ -211,8 +211,21 @@ piton_version = "2.7a" -- 2024/03/30 % It's possible to insert only a part of the file: cf. % part~\ref{part-of-a-file}, p.~\pageref{part-of-a-file}. % -% The key |path| of the command |\PitonOptions| specifies a path where the files -% included by |\PitonInputFile| will be searched. +% +% \colorbox{yellow!50}{\bfseries New 2.8}\par\nobreak +% +% +% The key |path| of the command |\PitonOptions| specifies a \emph{list} of +% pathes where the files included by |\PitonInputFile| will be searched. That +% list is comma separated. +% +% The extension \pkg{piton} also provides the commands +% \colorbox{gray!20}{\ttfamily \textbackslash PitonInputFileT}, +% \colorbox{gray!20}{\ttfamily \textbackslash PitonInputFileF} and +% \colorbox{gray!20}{\ttfamily \textbackslash PitonInputFileTF} with +% supplementary arguments corresponding to the letters~|T| and~|F|. Those +% arguments will be exectued if the file to include has been found (letter~|T|) +% or not found (letter~|F|). % \end{itemize} % % \subsection{The syntax of the command \textbackslash piton} @@ -1002,8 +1015,8 @@ piton_version = "2.7a" -- 2024/03/30 % \end{Piton} % % \vspace{1cm} -% \index{marker/include-line} -% The key \Definition{marker/include-line} requires the insertion of the lines +% \index{marker/include-lines} +% The key \Definition{marker/include-lines} requires the insertion of the lines % containing the markers. % % \begin{Verbatim} @@ -1046,9 +1059,6 @@ piton_version = "2.7a" -- 2024/03/30 % % \label{SetPitonIdentifier} % -% \colorbox{yellow!50}{\bfseries Modification 2.4}\par\nobreak -% -% \smallskip % The command |\SetPitonIdentifier| allows to change the formatting of some % identifiers. % @@ -2757,9 +2767,10 @@ piton_version = "2.7a" -- 2024/03/30 % % \medskip % The following parameter corresponds to the key |path| (which is the path used -% to include files by |\PitonInputFile|). +% to include files by |\PitonInputFile|). Each component of that sequence will +% be a string (type |str|). % \begin{macrocode} -\str_new:N \l_@@_path_str +\seq_new:N \l_@@_path_seq % \end{macrocode} % % \medskip @@ -3546,8 +3557,19 @@ piton_version = "2.7a" -- 2024/03/30 language .code:n = \str_set:Nx \l_piton_language_str { \str_lowercase:n { #1 } } , language .value_required:n = true , - path .str_set:N = \l_@@_path_str , + path .code:n = + \seq_clear:N \l_@@_path_seq + \clist_map_inline:nn { #1 } + { + \str_set:Nn \l_tmpa_str { ##1 } + \seq_put_right:No \l_@@_path_seq \l_tmpa_str + } , path .value_required:n = true , +% \end{macrocode} +% The initial value of the key |path| is not empty: it's |.|, that is to say a +% comma separated list with only one component which is |.|, the current directory. +% \begin{macrocode} + path .initial:n = . , path-write .str_set:N = \l_@@_path_write_str , path-write .value_required:n = true , gobble .int_set:N = \l_@@_gobble_int , @@ -3682,6 +3704,7 @@ piton_version = "2.7a" -- 2024/03/30 { \@@_error:n { Invalid~key } } } % \end{macrocode} +% % % % \bigskip @@ -3694,6 +3717,8 @@ piton_version = "2.7a" -- 2024/03/30 } % \end{macrocode} % +% +% % \bigskip % When using |\NewPitonEnvironment| a user may use |\PitonOptions| inside. % However, the set of keys available should be different that in standard @@ -4243,22 +4268,44 @@ piton_version = "2.7a" -- 2024/03/30 % the environment |{Piton}|. In fact, it's simpler because there isn't the % problem of catching the content of the environment in a verbatim mode. % \begin{macrocode} -\NewDocumentCommand { \PitonInputFile } { d < > O { } m } +\NewDocumentCommand { \PitonInputFileTF } { d < > O { } m m m } { \group_begin: - \tl_if_empty:NTF \l_@@_path_str - { \str_set:Nn \l_@@_file_name_str { #3 } } - { - \str_set_eq:NN \l_@@_file_name_str \l_@@_path_str - \str_put_right:Nn \l_@@_file_name_str { / #3 } +% \end{macrocode} +% The boolean |\l_tmap_bool| will be raised if the file is found somewhere in +% the path (specified by the key |path|). +% \begin{macrocode} + \bool_set_false:N \l_tmpa_bool + \seq_map_inline:Nn \l_@@_path_seq + { + \str_set:Nn \l_@@_file_name_str { ##1 / #3 } + \file_if_exist:nT { \l_@@_file_name_str } + { + \@@_input_file:nn { #1 } { #2 } + \bool_set_true:N \l_tmpa_bool + \seq_map_break: + } } - \file_if_exist:nTF { \l_@@_file_name_str } - { \@@_input_file:nn { #1 } { #2 } } - { \msg_error:nnn { piton } { Unknown~file } { #3 } } + \bool_if:NTF \l_tmpa_bool { #4 } { #5 } \group_end: } % \end{macrocode} % +% \medskip +% \begin{macrocode} +\cs_new_protected:Npn \@@_unknown_file:n #1 + { \msg_error:nnn { piton } { Unknown~file } { #1 } } +% \end{macrocode} +% +% \begin{macrocode} +\NewDocumentCommand { \PitonInputFile } { d < > O { } m } + { \PitonInputFileTF < #1 > [ #2 ] { #3 } { } { \@@_unknown_file:n { #3 } } } +\NewDocumentCommand { \PitonInputFileT } { d < > O { } m m } + { \PitonInputFileTF < #1 > [ #2 ] { #3 } { #4 } { \@@_unknown_file:n { #3 } } } +\NewDocumentCommand { \PitonInputFileF } { d < > O { } m m } + { \PitonInputFileTF < #1 > [ #2 ] { #3 } { } { #4 } } +% \end{macrocode} +% % The following command uses as implicit argument the name of the file in % |\l_@@_file_name_str|. % \begin{macrocode} @@ -7839,6 +7886,13 @@ end % % \verb|https://github.com/fpantigny/piton| % +% \subsection*{Changes between versions 2.7 and 2.8} +% +% The key |path| now accepts a \emph{list} of pathes where the files to include +% will be searched. +% +% New commands |\PitonInputFileT|, |\PitonInputFileF| and |\PitonInputFileTF|. +% % \subsection*{Changes between versions 2.6 and 2.7} % % New keys |split-on-empty-lines| and |split-separation| |