texlive[68306] Master/texmf-dist: piton (17sep23)
commits+karl at tug.org
commits+karl at tug.org
Sun Sep 17 22:16:36 CEST 2023
Revision: 68306
https://tug.org/svn/texlive?view=revision&revision=68306
Author: karl
Date: 2023-09-17 22:16:36 +0200 (Sun, 17 Sep 2023)
Log Message:
-----------
piton (17sep23)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/lualatex/piton/README.md
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/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/piton/README.md 2023-09-17 13:24:00 UTC (rev 68305)
+++ trunk/Master/texmf-dist/doc/lualatex/piton/README.md 2023-09-17 20:16:36 UTC (rev 68306)
@@ -11,7 +11,7 @@
## Presentation
-The LaTeX package `piton` provides a command `\piton` and an environment `{Piton}` to typeset Python, OCaml or C++ codes by using the Lua library LPEG. It requires the use of `lualatex`. It won't work with `xelatex` nor `pdflatex`.
+The LaTeX package `piton` provides a command `\piton` and an environment `{Piton}` to typeset Python, OCaml, SQL or C++ codes by using the Lua library LPEG. It requires the use of `lualatex`. It won't work with `xelatex` nor `pdflatex`.
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 2023-09-17 13:24:00 UTC (rev 68305)
+++ trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.tex 2023-09-17 20:16:36 UTC (rev 68306)
@@ -205,8 +205,7 @@
p.~\pageref{part-of-a-file}.
\colorbox{yellow!50}{\textbf{Nouveau 2.2}}\enskip La clé |path| de la commande |\PitonOptions| permet de spécifier
-un chemin de recherche pour le fichier à inclure. En fait, on peut spécifier plusieurs chemins, séparés par des
-virgules.
+un chemin pour le fichier à inclure.
\end{itemize}
@@ -225,7 +224,7 @@
points suivants doivent être remarqués :
\begin{itemize}
-\item plusieurs espaces successives sont remplacées par une unique espace,
+\item plusieurs espaces successives sont remplacées par une unique espace, ainsi que les retours à la ligne
{\color{cyan} mais la commande |\|␣ est fournie pour forcer l'insertion d'une espace} ;
@@ -315,8 +314,8 @@
\item La clé \Definition{language} spécifie le langage informatique considéré (la casse n'est pas prise en compte).
Quatre valeurs sont possibles : |Python|, |OCaml|, |C| et |SQL|. La valeur initiale est |Python|.
-\item La clé \Definition{path} indique un chemin où seront cherchés prioritairement les fichiers inclus par
-|\PitonInputFile|. En fait, on peut spécifier plusieurs chemins, séparés par des virgules.
+\item La clé \Definition{path} indique un chemin où seront cherchés les fichiers inclus par
+|\PitonInputFile|.
\item La clé \Definition{gobble} prend comme valeur un entier positif $n$ : les $n$ premiers caractères de chaque
ligne sont alors retirés (avant formatage du code) dans les environnements |{Piton}|. Ces $n$ caractères ne sont
@@ -353,8 +352,7 @@
\item La clé \Definition{line-numbers/resume} reprend la numérotation là où elle avait été laissée au dernier listing. En fait,
la clé \verb|line-numbers/resume| a un alias, qui est \verb|resume| tout court.
-\item La clé \Definition{line-numbers/start} impose que la numérotation commence à ce numéro. Elle n'est pas disponible dans
-\verb|\PitonOptions|.
+\item La clé \Definition{line-numbers/start} impose que la numérotation commence à ce numéro.
\item La clé \Definition{sep} est la distance horizontale entre les numéros de lignes (insérés par |line-numbers|)
et les lignes du code informatique. La valeur initiale est 0.7~em.
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 2023-09-17 13:24:00 UTC (rev 68305)
+++ trunk/Master/texmf-dist/source/lualatex/piton/piton.dtx 2023-09-17 20:16:36 UTC (rev 68306)
@@ -43,12 +43,12 @@
%
%<@@=piton>
%<*STY>
-\def\myfileversion{2.2}
-\def\myfiledate{2023/09/05}
+\def\myfileversion{2.2a}
+\def\myfiledate{2023/09/17}
%</STY>
%<*driver>
-\def\myfileversion{2.2}
-\def\myfiledate{2023/09/05}
+\def\myfileversion{2.2a}
+\def\myfiledate{2023/09/17}
\documentclass{l3doc}
\usepackage{geometry}
\geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}}
@@ -213,8 +213,7 @@
%
% \colorbox{yellow!50}{\textbf{New 2.2}}\enskip The key |path| of the command
% |\PitonOptions| specifies a path where the files included by |\PitonInputFile|
-% will be searched. In fact, it's possible to specify a comma-separated list of
-% paths.
+% will be searched.
% \end{itemize}
%
% \subsection{The syntax of the command \textbackslash piton}
@@ -230,7 +229,8 @@
% When its argument is given between curly braces, the command |\piton| does not
% take its argument in verbatim mode. In particular:
% \begin{itemize}
-% \item several consecutive spaces will be replaced by only one space,
+% \item several consecutive spaces will be replaced by only one space (and the
+% also the character of end on line),
%
% {\color{cyan} but the command |\|␣ is provided to force the insertion of a space};
%
@@ -325,9 +325,8 @@
% considered (that key is case-insensitive). Four values are allowed :
% |Python|, |OCaml|, |C| and |SQL|. The initial value is |Python|.
%
-% \item The key |path| specifies a path where the files included by
-% |\PitonInputFile| will be searched. In fact, it's possible to specify a
-% comma-separated list of paths.
+% \item The key \Definition{path} specifies a path where the files included by
+% |\PitonInputFile| will be searched.
%
% \item The key \Definition{gobble} takes in as value a
% positive integer~$n$: the first $n$ characters are discarded (before the
@@ -372,7 +371,7 @@
% part of the file (cf. part~\ref{part-of-a-file}, p.~\pageref{part-of-a-file}).
% The key |/absolute| is no-op in the environments |{Piton}|.
% \item The key \Definition{line-numbers/start} requires that the line numbering
-% begins to the value of the key. That key is not available in |\PitonOptions|.
+% begins to the value of the key.
% \item With the key \Definition{line-numbers/resume}, the counter of lines is
% not set to zero at the beginning of each environment |{Piton}| or use of
% |\PitonInputFile| as it is otherwise. That allows a numbering of the lines
@@ -2356,7 +2355,7 @@
\@@_msg_new:nn { piton.lua~not~found }
{
The~file~'piton.lua'~can't~be~found.\\
- The package~'piton'~won't be loaded.
+ The package~'piton'~won't~be~loaded.
}
% \end{macrocode}
%
@@ -2563,7 +2562,7 @@
%
% \medskip
% \begin{macrocode}
-\tl_new:N \l_@@_path_seq
+\tl_new:N \l_@@_path_tl
% \end{macrocode}
%
%
@@ -3302,8 +3301,7 @@
language .code:n =
\str_set:Nx \l_@@_language_str { \str_lowercase:n { #1 } } ,
language .value_required:n = true ,
- path .code:n =
- \seq_set_from_clist:Nn \l_@@_path_seq { #1 } ,
+ path .tl_set:N = \l_@@_path_tl ,
path .value_required:n = true ,
gobble .int_set:N = \l_@@_gobble_int ,
gobble .value_required:n = true ,
@@ -3439,7 +3437,19 @@
}
% \end{macrocode}
%
+% \bigskip
+% When using |\NewPitonEnvironment| a user may use |\PitonOptions| inside.
+% However, the set of keys available should be different that in standard
+% |\PitonOptions|. That's why we define a version of |\PitonOptions| with no
+% restrection on the set of available keys and we will link that version to
+% |\PitonOptions| in such environment.
+% \begin{macrocode}
+\NewDocumentCommand \@@_fake_PitonOptions { }
+ { \keys_set:nn { PitonOptions } }
+% \end{macrocode}
+%
%
+%
% \bigskip
% \begin{macrocode}
\hook_gput_code:nnn { begindocument } { . }
@@ -3857,6 +3867,7 @@
% \begin{macrocode}
\NewDocumentEnvironment { #1 } { #2 }
{
+ \cs_set_eq:NN \PitonOptions \@@_fake_PitonOptions
#3
\@@_pre_env:
\int_compare:nNnT \l_@@_number_lines_start_int > 0
@@ -3915,8 +3926,14 @@
\NewDocumentCommand { \PitonInputFile } { d < > O { } m }
{
\group_begin:
- \seq_set_eq:NN \l_file_search_path_seq \l_@@_path_seq
- \file_get_full_name:nNTF { #3 } \l_@@_file_name_tl
+ \tl_if_empty:NTF \l_@@_path_tl
+ { \tl_set:Nn \l_@@_file_name_tl { #3 } }
+ {
+ \tl_set_eq:NN \l_@@_file_name_tl \l_@@_path_tl
+ \tl_put_right:Nn \l_@@_file_name_tl { / }
+ \tl_put_right:Nn \l_@@_file_name_tl { #3 }
+ }
+ \exp_args:NV \file_if_exist:nTF \l_@@_file_name_tl
{ \@@_input_file:nn { #1 } { #2 } }
{ \msg_error:nnn { piton } { Unknown~file } { #3 } }
\group_end:
@@ -3923,6 +3940,7 @@
}
% \end{macrocode}
%
+% The following command uses as implicit argument the name of the file in |\l_@@_file_name_tl|.
% \begin{macrocode}
\cs_new_protected:Npn \@@_input_file:nn #1 #2
{
@@ -7027,6 +7045,7 @@
% \begin{macrocode}
function piton.CountLinesFile(name)
local count = 0
+ io.open(name) -- added
for line in io.lines(name) do count = count + 1 end
tex.sprint(
luatexbase.catcodetables.expl ,
Modified: trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua 2023-09-17 13:24:00 UTC (rev 68305)
+++ trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua 2023-09-17 20:16:36 UTC (rev 68306)
@@ -1410,6 +1410,7 @@
end
function piton.CountLinesFile(name)
local count = 0
+ io.open(name) -- added
for line in io.lines(name) do count = count + 1 end
tex.sprint(
luatexbase.catcodetables.expl ,
Modified: trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty 2023-09-17 13:24:00 UTC (rev 68305)
+++ trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty 2023-09-17 20:16:36 UTC (rev 68306)
@@ -18,8 +18,8 @@
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
-\def\myfileversion{2.2}
-\def\myfiledate{2023/09/05}
+\def\myfileversion{2.2a}
+\def\myfiledate{2023/09/17}
\NeedsTeXFormat{LaTeX2e}
@@ -49,7 +49,7 @@
\__piton_msg_new:nn { piton.lua~not~found }
{
The~file~'piton.lua'~can't~be~found.\\
- The package~'piton'~won't be loaded.
+ The package~'piton'~won't~be~loaded.
}
\file_if_exist:nF { piton.lua }
{ \msg_critical:nn { piton } { piton.lua~not~found } }
@@ -153,7 +153,7 @@
\lua_now:n { piton = piton~or { } }
\str_new:N \l__piton_language_str
\str_set:Nn \l__piton_language_str { python }
-\tl_new:N \l__piton_path_seq
+\tl_new:N \l__piton_path_tl
\bool_new:N \l__piton_in_PitonOptions_bool
\bool_new:N \l__piton_in_PitonInputFile_bool
\bool_new:N \g__piton_in_document_bool
@@ -501,8 +501,7 @@
language .code:n =
\str_set:Nx \l__piton_language_str { \str_lowercase:n { #1 } } ,
language .value_required:n = true ,
- path .code:n =
- \seq_set_from_clist:Nn \l__piton_path_seq { #1 } ,
+ path .tl_set:N = \l__piton_path_tl ,
path .value_required:n = true ,
gobble .int_set:N = \l__piton_gobble_int ,
gobble .value_required:n = true ,
@@ -626,6 +625,8 @@
\keys_set:nn { PitonOptions } { #1 }
\bool_set_false:N \l__piton_in_PitonOptions_bool
}
+\NewDocumentCommand \__piton_fake_PitonOptions { }
+ { \keys_set:nn { PitonOptions } }
\hook_gput_code:nnn { begindocument } { . }
{ \bool_gset_true:N \g__piton_in_document_bool }
\int_new:N \g__piton_visual_line_int
@@ -877,6 +878,7 @@
}
\NewDocumentEnvironment { #1 } { #2 }
{
+ \cs_set_eq:NN \PitonOptions \__piton_fake_PitonOptions
#3
\__piton_pre_env:
\int_compare:nNnT \l__piton_number_lines_start_int > 0
@@ -909,8 +911,14 @@
\NewDocumentCommand { \PitonInputFile } { d < > O { } m }
{
\group_begin:
- \seq_set_eq:NN \l_file_search_path_seq \l__piton_path_seq
- \file_get_full_name:nNTF { #3 } \l__piton_file_name_tl
+ \tl_if_empty:NTF \l__piton_path_tl
+ { \tl_set:Nn \l__piton_file_name_tl { #3 } }
+ {
+ \tl_set_eq:NN \l__piton_file_name_tl \l__piton_path_tl
+ \tl_put_right:Nn \l__piton_file_name_tl { / }
+ \tl_put_right:Nn \l__piton_file_name_tl { #3 }
+ }
+ \exp_args:NV \file_if_exist:nTF \l__piton_file_name_tl
{ \__piton_input_file:nn { #1 } { #2 } }
{ \msg_error:nnn { piton } { Unknown~file } { #3 } }
\group_end:
More information about the tex-live-commits
mailing list.