texlive[70947] Master/texmf-dist: piton (14apr24)
commits+karl at tug.org
commits+karl at tug.org
Sun Apr 14 21:46:30 CEST 2024
Revision: 70947
https://tug.org/svn/texlive?view=revision&revision=70947
Author: karl
Date: 2024-04-14 21:46:30 +0200 (Sun, 14 Apr 2024)
Log Message:
-----------
piton (14apr24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.pdf
trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.tex
trunk/Master/texmf-dist/doc/lualatex/piton/piton.pdf
trunk/Master/texmf-dist/source/lualatex/piton/piton.dtx
trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua
trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty
Modified: trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.tex 2024-04-14 19:46:16 UTC (rev 70946)
+++ trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.tex 2024-04-14 19:46:30 UTC (rev 70947)
@@ -223,7 +223,18 @@
Il est possible de n'insérer qu'une partie de ce fichier : cf. partie~\ref{part-of-a-file},
p.~\pageref{part-of-a-file}.
-La clé |path| de la commande |\PitonOptions| permet de spécifier un chemin pour le fichier à inclure.
+
+\colorbox{yellow!50}{\textbf{Nouveau 2.8}}\par\nobreak
+
+La clé |path| de la commande |\PitonOptions| permet de spécifier une \emph{liste} de chemins où sera recherché le
+fichier à inclure (dans cette liste, les chemins sont séparés par des virgules).
+
+L'extension \pkg{piton} propose aussi des commandes \colorbox{gray!20}{\ttfamily\textbackslash PitonInputFileT},
+\colorbox{gray!20}{\ttfamily \textbackslash PitonInputFileF} et
+\colorbox{gray!20}{\ttfamily \textbackslash PitonInputFileTF} avec des arguments correspondant aux lettres |T| et
+|F|, arguments qui seront executés dans le
+cas où le fichier a été trouvé (lettre |T|) ou pas (lettre |F|).
+
\end{itemize}
@@ -760,12 +771,12 @@
lignes vides séparent le plus souvent les définitions des fonctions informatiques et il est donc souvent judicieux
de pouvoir couper au niveau de ces lignes.
-Quand la clé |split-on-empty-lines| est activée, le travail effectué va en fait un plus loin : les lignes vides
+Quand la clé |split-on-empty-lines| est activée, le travail effectué va en fait un peu plus loin : les lignes vides
successives sont supprimées et remplacées par le contenu du paramètre correspondant à la clé
\Definition{split-separation}.
La valeur initiale de ce paramètre est |\vspace{\baselineskip}\vspace{-1.25pt}|, ce qui, au final, correspond à une
-ligne vide dans le PDF final (cet espace vertical est supprimé s'il tombe au niveau d'un saut de page).
+ligne vide dans le PDF produit (cet espace vertical est supprimé s'il tombe au niveau d'un saut de page).
\medskip
\item La clé |split-on-empty-lines| peut bien sûr être insuffisante et c'est pourquoi \pkg{piton} propose la clé
@@ -948,8 +959,8 @@
\end{Piton}
\vspace{1cm}
-\index{marker/include-line}
-La clé \Definition{marker/include-line} demande que les lignes contenant les marqueurs soient également insérées.
+\index{marker/include-lines}
+La clé \Definition{marker/include-lines} demande que les lignes contenant les marqueurs soient également insérées.
\begin{Verbatim}
\PitonInputFile[~emphase#marker/include-lines@,range = Exercice 1]{~textsl#nom_du_fichier@}
@@ -992,9 +1003,6 @@
\indexcommand{SetPitonIdentifier}
\label{SetPitonIdentifier}
-\colorbox{yellow!50}{\bfseries Modification 2.4}\par\nobreak
-
-\smallskip
La commande |\SetPitonIdentifier| permet de changer le formatage de certains identificateurs.
\smallskip
Modified: trunk/Master/texmf-dist/doc/lualatex/piton/piton.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/lualatex/piton/piton.dtx
===================================================================
--- trunk/Master/texmf-dist/source/lualatex/piton/piton.dtx 2024-04-14 19:46:16 UTC (rev 70946)
+++ trunk/Master/texmf-dist/source/lualatex/piton/piton.dtx 2024-04-14 19:46:30 UTC (rev 70947)
@@ -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 @@
% 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 @@
% \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 @@
%
% \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 @@
%
% \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 @@
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 @@
{ \@@_error:n { Invalid~key } }
}
% \end{macrocode}
+%
%
%
% \bigskip
@@ -3694,6 +3717,8 @@
}
% \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 @@
% 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 @@
%
% \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|
Modified: trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua 2024-04-14 19:46:16 UTC (rev 70946)
+++ trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua 2024-04-14 19:46:30 UTC (rev 70947)
@@ -20,7 +20,7 @@
-- -------------------------------------------
--
-- This file is part of the LuaLaTeX package 'piton'.
-piton_version = "2.7a" -- 2024/03/30
+piton_version = "2.8" -- 2024/04/14
if piton.comment_latex == nil then piton.comment_latex = ">" end
Modified: trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty 2024-04-14 19:46:16 UTC (rev 70946)
+++ trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty 2024-04-14 19:46:30 UTC (rev 70947)
@@ -19,8 +19,8 @@
%% LaTeX version 2005/12/01 or later.
%% -------------------------------------------
%%
-\def\PitonFileVersion{2.7a}
-\def\PitonFileDate{2024/03/30}
+\def\PitonFileVersion{2.8}
+\def\PitonFileDate{2024/04/14}
\NeedsTeXFormat{LaTeX2e}
@@ -171,7 +171,7 @@
\str_new:N \l_piton_language_str
\str_set:Nn \l_piton_language_str { python }
\tl_new:N \g_piton_last_code_tl
-\str_new:N \l__piton_path_str
+\seq_new:N \l__piton_path_seq
\str_new:N \l__piton_path_write_str
\bool_new:N \l__piton_in_PitonOptions_bool
\bool_new:N \l__piton_in_PitonInputFile_bool
@@ -537,8 +537,15 @@
language .code:n =
\str_set:Nx \l_piton_language_str { \str_lowercase:n { #1 } } ,
language .value_required:n = true ,
- path .str_set:N = \l__piton_path_str ,
+ path .code:n =
+ \seq_clear:N \l__piton_path_seq
+ \clist_map_inline:nn { #1 }
+ {
+ \str_set:Nn \l_tmpa_str { ##1 }
+ \seq_put_right:No \l__piton_path_seq \l_tmpa_str
+ } ,
path .value_required:n = true ,
+ path .initial:n = . ,
path-write .str_set:N = \l__piton_path_write_str ,
path-write .value_required:n = true ,
gobble .int_set:N = \l__piton_gobble_int ,
@@ -994,20 +1001,31 @@
{ \keys_set:nn { PitonOptions } { #1 } }
{ }
}
-\NewDocumentCommand { \PitonInputFile } { d < > O { } m }
+\NewDocumentCommand { \PitonInputFileTF } { d < > O { } m m m }
{
\group_begin:
- \tl_if_empty:NTF \l__piton_path_str
- { \str_set:Nn \l__piton_file_name_str { #3 } }
+ \bool_set_false:N \l_tmpa_bool
+ \seq_map_inline:Nn \l__piton_path_seq
{
- \str_set_eq:NN \l__piton_file_name_str \l__piton_path_str
- \str_put_right:Nn \l__piton_file_name_str { / #3 }
+ \str_set:Nn \l__piton_file_name_str { ##1 / #3 }
+ \file_if_exist:nT { \l__piton_file_name_str }
+ {
+ \__piton_input_file:nn { #1 } { #2 }
+ \bool_set_true:N \l_tmpa_bool
+ \seq_map_break:
+ }
}
- \file_if_exist:nTF { \l__piton_file_name_str }
- { \__piton_input_file:nn { #1 } { #2 } }
- { \msg_error:nnn { piton } { Unknown~file } { #3 } }
+ \bool_if:NTF \l_tmpa_bool { #4 } { #5 }
\group_end:
}
+\cs_new_protected:Npn \__piton_unknown_file:n #1
+ { \msg_error:nnn { piton } { Unknown~file } { #1 } }
+\NewDocumentCommand { \PitonInputFile } { d < > O { } m }
+ { \PitonInputFileTF < #1 > [ #2 ] { #3 } { } { \__piton_unknown_file:n { #3 } } }
+\NewDocumentCommand { \PitonInputFileT } { d < > O { } m m }
+ { \PitonInputFileTF < #1 > [ #2 ] { #3 } { #4 } { \__piton_unknown_file:n { #3 } } }
+\NewDocumentCommand { \PitonInputFileF } { d < > O { } m m }
+ { \PitonInputFileTF < #1 > [ #2 ] { #3 } { } { #4 } }
\cs_new_protected:Npn \__piton_input_file:nn #1 #2
{
\tl_if_novalue:nF { #1 }
More information about the tex-live-commits
mailing list.