diff options
author | Norbert Preining <norbert@preining.info> | 2023-09-18 03:04:07 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-09-18 03:04:07 +0000 |
commit | 04fec36be1d386c1f8d5a57c3cd613d494a5c323 (patch) | |
tree | af66bedf66747f24eedac74cd1df1b54f38023c4 /macros/luatex/latex/piton/piton.dtx | |
parent | e30e1de3ed00a127608d88a118c0b3f0b59a9dca (diff) |
CTAN sync 202309180304
Diffstat (limited to 'macros/luatex/latex/piton/piton.dtx')
-rw-r--r-- | macros/luatex/latex/piton/piton.dtx | 53 |
1 files changed, 36 insertions, 17 deletions
diff --git a/macros/luatex/latex/piton/piton.dtx b/macros/luatex/latex/piton/piton.dtx index d6596263ef..1e8b212c99 100644 --- a/macros/luatex/latex/piton/piton.dtx +++ b/macros/luatex/latex/piton/piton.dtx @@ -43,12 +43,12 @@ version 2005/12/01 or later. % %<@@=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 @@ version 2005/12/01 or later. % % \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 @@ version 2005/12/01 or later. % 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 @@ version 2005/12/01 or later. % 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 @@ version 2005/12/01 or later. % 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 @@ version 2005/12/01 or later. \@@_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 @@ version 2005/12/01 or later. % % \medskip % \begin{macrocode} -\tl_new:N \l_@@_path_seq +\tl_new:N \l_@@_path_tl % \end{macrocode} % % @@ -3302,8 +3301,7 @@ version 2005/12/01 or later. 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,6 +3437,18 @@ version 2005/12/01 or later. } % \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} @@ -3857,6 +3867,7 @@ version 2005/12/01 or later. % \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,14 +3926,21 @@ version 2005/12/01 or later. \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: } % \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 @@ end % \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 , |