texlive[65395] Master/texmf-dist: piton (29dec22)
commits+karl at tug.org
commits+karl at tug.org
Thu Dec 29 23:04:10 CET 2022
Revision: 65395
http://tug.org/svn/texlive?view=revision&revision=65395
Author: karl
Date: 2022-12-29 23:04:10 +0100 (Thu, 29 Dec 2022)
Log Message:
-----------
piton (29dec22)
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.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 2022-12-29 22:03:47 UTC (rev 65394)
+++ trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.tex 2022-12-29 22:04:10 UTC (rev 65395)
@@ -243,6 +243,7 @@
\subsection{La commande \textbackslash PitonOptions}
+
La commande |\PitonOptions| prend en argument une liste de couples \textsl{clé=valeur}. La portée des réglages
effectués par cette commande est le groupe TeX courant.\footnote{On rappelle que tout environnement LaTeX est, en particulier, un groupe.}
@@ -717,8 +718,12 @@
caractères de tabulations (U+0009) en début de ligne. Chaque caractère U+0009 est remplacé par $n$ espaces. La
valeur initiale de~$n$ est~4 mais on peut la changer avec la clé |tab-size| de |\PitonOptions|.
-\emph{Remarque} : Contrairement à ce qui se passe avec l'extension \pkg{listings}, la clé |gobble| (et ses
-variantes |auto-gobble| et |env-gobble|) agit \emph{avant} la transformation des tabulations en espaces.
+\smallskip
+\colorbox{yellow!50}{\bfseries Nouveau 1.0}\enskip Il existe aussi une clé |tabs-auto-gobble| qui détermine
+le nombre minimal de caractères U+0009 débutant chaque ligne (non vide) de l'environnement |{Piton}| et applique
+|gobble| avec cette valeur (avant le remplacement des caractères U+0009 par des espaces, bien entendu). Cette clé
+est donc similaire à la clé |auto-gobble| mais agit sur des caractères U+0009 au lieu de caractères U+0020
+(espaces).
\section{Exemples}
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 2022-12-29 22:03:47 UTC (rev 65394)
+++ trunk/Master/texmf-dist/source/lualatex/piton/piton.dtx 2022-12-29 22:04:10 UTC (rev 65395)
@@ -15,8 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{0.99}
-\def\myfiledate{2022/11/29}
+\def\myfileversion{1.0}
+\def\myfiledate{2022/12/29}
%
%
%<*batchfile>
@@ -100,7 +100,7 @@
% fast since all the parsing is done by the library LPEG, written in C.
%
% \bigskip
-% Here is an exemple of code typeset by \pkg{piton}, with the environment |{Piton}|.
+% Here is an example of code typeset by \pkg{piton}, with the environment |{Piton}|.
%
% \bigskip
%
@@ -237,7 +237,7 @@
% command.
%
% \medskip
-% Exemples :
+% Examples:
%
% \begin{tabular}{>{\color{gray}}l@{\hspace*{1cm}}l}
% \verb!\piton|MyString = '\n'|! &
@@ -766,9 +766,12 @@
% change it with the key |tab-size| of |\PitonOptions|.
%
% \smallskip
-% \emph{Remark}: Unlike with the package \pkg{listings}, the key |gobble| and
-% its variants (|auto-gobble| and |env-gobble|) are applied \emph{before} the
-% transformation of the characters of tabulation in spaces.
+% \colorbox{yellow!50}{\textbf{New 1.0}}\enskip There exists also a key
+% |tabs-auto-gobble| which computes the minimal value $n$ of the number
+% of consecutive characters U+0009 beginning each (non empty) line of the
+% environment |{Piton}| and applies |gobble| with that value of~$n$ (before
+% replacement of the tabulations by spaces, of course). Hence, that key is
+% similar to the key |auto-gobble| but acts on U+0009 instead of U+0020 (spaces).
%
% \section{Examples}
%
@@ -1574,7 +1577,7 @@
%
% \medskip
% The following booleans correspond to the keys |break-lines| and
-% |indent-broken-lines| of |\PitonOptions|.
+% |indent-broken-lines|.
% \begin{macrocode}
\bool_new:N \l_@@_break_lines_bool
\bool_new:N \l_@@_indent_broken_lines_bool
@@ -1836,6 +1839,8 @@
auto-gobble .value_forbidden:n = true ,
env-gobble .code:n = \int_set:Nn \l_@@_gobble_int { -2 } ,
env-gobble .value_forbidden:n = true ,
+ tabs-auto-gobble .code:n = \int_set:Nn \l_@@_gobble_int { -3 } ,
+ tabs-auto-gobble .value_forbidden:n = true ,
line-numbers .bool_set:N = \l_@@_line_numbers_bool ,
line-numbers .default:n = true ,
all-line-numbers .code:n =
@@ -1895,15 +1900,17 @@
continuation-symbol,~
continuation-symbol-on-indentation,~
end-of-broken-line,~
- env-gobble,~gobble,~
+ env-gobble,~
+ gobble,~
+ indent-broken-lines,~
left-margin,~
- indent-broken-lines,~
line-numbers,~
resume,~
show-spaces,~
slim,~
- splittable~
- and~tab-size.\\
+ splittable,~
+ tabs-auto-gobble,~
+ and~tab-size.
}
% \end{macrocode}
%
@@ -2667,7 +2674,7 @@
%
% \bigskip
% Some strings of length 2 are explicit because we want the corresponding
-% ligatures in the font \emph{Fira Code} to be active.
+% ligatures available in some fonts as \emph{Fira Code} to be active.
% \begin{macrocode}
local Operator =
K ( P "!=" + P "<>" + P "==" + P "<<" + P ">>" + P "<=" + P ">=" + P ":="
@@ -2777,9 +2784,11 @@
'Name.Namespace'
)
* (
- ( Space * K ( P "as" , 'Keyword' ) * Space * K ( identifier , 'Name.Namespace' ) )
+ ( Space * K ( P "as" , 'Keyword' ) * Space
+ * K ( identifier , 'Name.Namespace' ) )
+
- ( SkipSpace * K ( P "," ) * SkipSpace * K ( identifier , 'Name.Namespace' ) ) ^ 0
+ ( SkipSpace * K ( P "," ) * SkipSpace
+ * K ( identifier , 'Name.Namespace' ) ) ^ 0
)
% \end{macrocode}
% Be careful: there is no commutativity of |+| in the previous expression.
@@ -3345,7 +3354,7 @@
%
% \bigskip
% The following function |add| will be used in the following \textsc{lpeg}
-% |AutoGobbleLPEG| and |EnvGobbleLPEG|.
+% |AutoGobbleLPEG|, |TabsAutoGobbleLPEG| and |EnvGobbleLPEG|.
% \begin{macrocode}
local function add(acc,new_value)
return acc + new_value
@@ -3381,6 +3390,27 @@
% \end{macrocode}
%
% \bigskip
+% The following \textsc{lpeg} is similar but works with the indentations.
+% \begin{macrocode}
+local TabsAutoGobbleLPEG =
+ ( space ^ 0 * P "\r" ) ^ -1
+ * Cf (
+ (
+ ( P "\t" ) ^ 0 * P "\r"
+ +
+ Cf ( Cc(0) * ( P "\t" * Cc(1) ) ^ 0 , add )
+ * ( 1 - P "\t" ) * ( 1 - P "\r" ) ^ 0 * P "\r"
+ ) ^ 0
+ *
+ ( Cf ( Cc(0) * ( P "\t" * Cc(1) ) ^ 0 , add )
+ * ( 1 - P "\t" ) * ( 1 - P "\r" ) ^ 0 ) ^ -1 ,
+ math.min
+ )
+% \end{macrocode}
+%
+%
+%
+% \bigskip
% The following \textsc{lpeg} returns as capture the number of spaces at the
% last line, that is to say before the |\end{Piton}| (and usually it's also the
% number of spaces before the corresponding |\begin{Piton}| because that's the
@@ -3399,6 +3429,9 @@
then n = AutoGobbleLPEG : match(code)
else if n==-2
then n = EnvGobbleLPEG : match(code)
+ else if n==-3
+ then n = TabsAutoGobbleLPEG : match(code)
+ end
end
end
piton.Parse(gobble(n,code))
@@ -3473,26 +3506,16 @@
% \vspace{1cm}
% \section{History}
%
-%
-% \subsection*{Changes between versions 0.6 and 0.7}
-%
-% New keys |resume|, |splittable| and |background-color| in |\PitonOptions|.
+% \subsection*{Changes between versions 0.99 and 1.0}
%
-% The file |piton.lua| has been embedded in the file |piton.sty|. That means
-% that the extension \pkg{piton} is now entirely contained in the file |piton.sty|.
+% New key |tabs-auto-gobble|.
+%
%
-% \subsection*{Changes between versions 0.7 and 0.8}
-%
-% New keys |footnote| and |footnotehyper| at load-time.
+% \subsection*{Changes between versions 0.95 and 0.99}
%
-% New key |left-margin|.
+% New key |break-lines| to allow breaks of the lines of code (and other keys to
+% customize the appearance).
%
-% \subsection*{Changes between versions 0.8 and 0.9}
-%
-% New key |tab-size|.
-%
-% Integer value for the key |splittable|.
-%
% \subsection*{Changes between versions 0.9 and 0.95}
%
% New key |show-spaces|.
@@ -3505,11 +3528,29 @@
%
% New keys |first-line| and |last-line| for the command |\InputPitonFile|.
%
-% \subsection*{Changes between versions 0.95 and 0.99}
+% \subsection*{Changes between versions 0.8 and 0.9}
%
-% New key |break-lines| to allow breaks of the lines of code (and other keys to
-% customize the appearance).
+% New key |tab-size|.
%
+% Integer value for the key |splittable|.
+%
+% \subsection*{Changes between versions 0.7 and 0.8}
+%
+% New keys |footnote| and |footnotehyper| at load-time.
+%
+% New key |left-margin|.
+%
+% \subsection*{Changes between versions 0.6 and 0.7}
+%
+% New keys |resume|, |splittable| and |background-color| in |\PitonOptions|.
+%
+% The file |piton.lua| has been embedded in the file |piton.sty|. That means
+% that the extension \pkg{piton} is now entirely contained in the file |piton.sty|.
+%
+%
+%
+%
+%
% \end{document}
%
%
Modified: trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty 2022-12-29 22:03:47 UTC (rev 65394)
+++ trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty 2022-12-29 22:04:10 UTC (rev 65395)
@@ -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{0.99}
-\def\myfiledate{2022/11/29}
+\def\myfileversion{1.0}
+\def\myfiledate{2022/12/29}
@@ -275,6 +275,8 @@
auto-gobble .value_forbidden:n = true ,
env-gobble .code:n = \int_set:Nn \l__piton_gobble_int { -2 } ,
env-gobble .value_forbidden:n = true ,
+ tabs-auto-gobble .code:n = \int_set:Nn \l__piton_gobble_int { -3 } ,
+ tabs-auto-gobble .value_forbidden:n = true ,
line-numbers .bool_set:N = \l__piton_line_numbers_bool ,
line-numbers .default:n = true ,
all-line-numbers .code:n =
@@ -329,15 +331,17 @@
continuation-symbol,~
continuation-symbol-on-indentation,~
end-of-broken-line,~
- env-gobble,~gobble,~
+ env-gobble,~
+ gobble,~
+ indent-broken-lines,~
left-margin,~
- indent-broken-lines,~
line-numbers,~
resume,~
show-spaces,~
slim,~
- splittable~
- and~tab-size.\\
+ splittable,~
+ tabs-auto-gobble,~
+ and~tab-size.
}
\NewDocumentCommand \PitonOptions { } { \keys_set:nn { PitonOptions } }
\int_new:N \g__piton_visual_line_int
@@ -810,9 +814,11 @@
'Name.Namespace'
)
* (
- ( Space * K ( P "as" , 'Keyword' ) * Space * K ( identifier , 'Name.Namespace' ) )
+ ( Space * K ( P "as" , 'Keyword' ) * Space
+ * K ( identifier , 'Name.Namespace' ) )
+
- ( SkipSpace * K ( P "," ) * SkipSpace * K ( identifier , 'Name.Namespace' ) ) ^ 0
+ ( SkipSpace * K ( P "," ) * SkipSpace
+ * K ( identifier , 'Name.Namespace' ) ) ^ 0
)
local FromImport =
K ( P "from" , 'Keyword' )
@@ -1117,6 +1123,20 @@
* ( 1 - P " " ) * ( 1 - P "\r" ) ^ 0 ) ^ -1 ,
math.min
)
+local TabsAutoGobbleLPEG =
+ ( space ^ 0 * P "\r" ) ^ -1
+ * Cf (
+ (
+ ( P "\t" ) ^ 0 * P "\r"
+ +
+ Cf ( Cc(0) * ( P "\t" * Cc(1) ) ^ 0 , add )
+ * ( 1 - P "\t" ) * ( 1 - P "\r" ) ^ 0 * P "\r"
+ ) ^ 0
+ *
+ ( Cf ( Cc(0) * ( P "\t" * Cc(1) ) ^ 0 , add )
+ * ( 1 - P "\t" ) * ( 1 - P "\r" ) ^ 0 ) ^ -1 ,
+ math.min
+ )
local EnvGobbleLPEG =
( ( 1 - P "\r" ) ^ 0 * P "\r" ) ^ 0
* Cf ( Cc(0) * ( P " " * Cc(1) ) ^ 0 , add ) * -1
@@ -1125,6 +1145,9 @@
then n = AutoGobbleLPEG : match(code)
else if n==-2
then n = EnvGobbleLPEG : match(code)
+ else if n==-3
+ then n = TabsAutoGobbleLPEG : match(code)
+ end
end
end
piton.Parse(gobble(n,code))
More information about the tex-live-commits
mailing list.