texlive[61316] trunk: latexindent (15dec21)
commits+karl at tug.org
commits+karl at tug.org
Wed Dec 15 22:32:28 CET 2021
Revision: 61316
http://tug.org/svn/texlive?view=revision&revision=61316
Author: karl
Date: 2021-12-15 22:32:28 +0100 (Wed, 15 Dec 2021)
Log Message:
-----------
latexindent (15dec21)
Modified Paths:
--------------
trunk/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl
trunk/Master/bin/win32/latexindent.exe
trunk/Master/texmf-dist/doc/support/latexindent/README
trunk/Master/texmf-dist/doc/support/latexindent/latexindent.pdf
trunk/Master/texmf-dist/doc/support/latexindent/latexindent.tex
trunk/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex
trunk/Master/texmf-dist/doc/support/latexindent/sec-fine-tuning.tex
trunk/Master/texmf-dist/doc/support/latexindent/title.tex
trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm
trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Environment.pm
trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm
trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/MandatoryArgument.pm
trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/OptionalArgument.pm
trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm
trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
trunk/Master/texmf-dist/scripts/latexindent/latexindent.pl
Modified: trunk/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl
===================================================================
(Binary files differ)
Modified: trunk/Master/bin/win32/latexindent.exe
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/support/latexindent/README
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/README 2021-12-15 21:32:01 UTC (rev 61315)
+++ trunk/Master/texmf-dist/doc/support/latexindent/README 2021-12-15 21:32:28 UTC (rev 61316)
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- latexindent.pl, version 3.13.2, 2021-11-15
+ latexindent.pl, version 3.13.3, 2021-12-13
PERL script to indent code within environments, and align delimited
environments in .tex files.
Modified: trunk/Master/texmf-dist/doc/support/latexindent/latexindent.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/support/latexindent/latexindent.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/latexindent.tex 2021-12-15 21:32:01 UTC (rev 61315)
+++ trunk/Master/texmf-dist/doc/support/latexindent/latexindent.tex 2021-12-15 21:32:28 UTC (rev 61316)
@@ -522,7 +522,7 @@
\lstdefinestyle{fineTuning}{
style=yaml-LST,
- firstnumber=629,linerange={629-652},
+ firstnumber=629,linerange={629-654},
numbers=left,
}
Modified: trunk/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex 2021-12-15 21:32:01 UTC (rev 61315)
+++ trunk/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex 2021-12-15 21:32:28 UTC (rev 61316)
@@ -138,7 +138,7 @@
\texttt{latexindent.pl} will \emph{always} prioritize \texttt{verbatimEnvironments}.
You can, optionally, specify
- \announce*{2021-10-30}{verbatim name feature} the
+ \announce{2021-10-30}{verbatim name feature} the
\texttt{verbatim} field using the \texttt{name} field which takes a regular expression as
its argument; thank you to \cite{XuehaiPan} for contributing this feature.
@@ -147,8 +147,8 @@
then the listings given in \cref{lst:nameAsRegex1,lst:nameAsRegex2} are equivalent.
\begin{cmhtcbraster}[raster column skip=.1\linewidth]
- \cmhlistingsfromfile*{demonstrations/nameAsRegex1.yaml}[yaml-TCB]{\texttt{nameAsRegex1.yaml}}{lst:nameAsRegex1}
- \cmhlistingsfromfile*{demonstrations/nameAsRegex2.yaml}[yaml-TCB]{\texttt{nameAsRegex2.yaml}}{lst:nameAsRegex2}
+ \cmhlistingsfromfile{demonstrations/nameAsRegex1.yaml}[yaml-TCB]{\texttt{nameAsRegex1.yaml}}{lst:nameAsRegex1}
+ \cmhlistingsfromfile{demonstrations/nameAsRegex2.yaml}[yaml-TCB]{\texttt{nameAsRegex2.yaml}}{lst:nameAsRegex2}
\end{cmhtcbraster}
With reference to \cref{lst:nameAsRegex2}:
@@ -174,7 +174,7 @@
example, \lstinline|\verb!x+3!| is treated as a \texttt{verbatimCommands}.
You can, optionally, specify
- \announce*{2021-10-30}{verbatimCommands name feature} the
+ \announce{2021-10-30}{verbatimCommands name feature} the
\texttt{verbatimCommands} field using the \texttt{name} field which takes a regular
expression as its argument; thank you to \cite{XuehaiPan} for contributing this feature.
@@ -183,8 +183,8 @@
\cref{lst:nameAsRegex3,lst:nameAsRegex4} are equivalent.
\begin{cmhtcbraster}[raster column skip=.1\linewidth]
- \cmhlistingsfromfile*{demonstrations/nameAsRegex3.yaml}[yaml-TCB]{\texttt{nameAsRegex3.yaml}}{lst:nameAsRegex3}
- \cmhlistingsfromfile*{demonstrations/nameAsRegex4.yaml}[yaml-TCB]{\texttt{nameAsRegex4.yaml}}{lst:nameAsRegex4}
+ \cmhlistingsfromfile{demonstrations/nameAsRegex3.yaml}[yaml-TCB]{\texttt{nameAsRegex3.yaml}}{lst:nameAsRegex3}
+ \cmhlistingsfromfile{demonstrations/nameAsRegex4.yaml}[yaml-TCB]{\texttt{nameAsRegex4.yaml}}{lst:nameAsRegex4}
\end{cmhtcbraster}
With reference to \cref{lst:nameAsRegex4}:
@@ -263,7 +263,7 @@
We will demonstrate this feature later in the documentation in \cref{lst:href3}.
You can, optionally, specify
- \announce*{2021-10-30}{noIndentBlock name feature} the
+ \announce{2021-10-30}{noIndentBlock name feature} the
\texttt{noIndentBlock} field using the \texttt{name} field which takes a regular
expression as its argument; thank you to \cite{XuehaiPan} for contributing this feature.
@@ -273,8 +273,8 @@
\begin{widepage}
\begin{cmhtcbraster}[raster column skip=.1\linewidth]
- \cmhlistingsfromfile*{demonstrations/nameAsRegex5.yaml}[yaml-TCB]{\texttt{nameAsRegex5.yaml}}{lst:nameAsRegex5}
- \cmhlistingsfromfile*{demonstrations/nameAsRegex6.yaml}[yaml-TCB]{\texttt{nameAsRegex6.yaml}}{lst:nameAsRegex6}
+ \cmhlistingsfromfile{demonstrations/nameAsRegex5.yaml}[yaml-TCB]{\texttt{nameAsRegex5.yaml}}{lst:nameAsRegex5}
+ \cmhlistingsfromfile{demonstrations/nameAsRegex6.yaml}[yaml-TCB]{\texttt{nameAsRegex6.yaml}}{lst:nameAsRegex6}
\end{cmhtcbraster}
\end{widepage}
@@ -452,7 +452,11 @@
\item \announce{2020-03-21}{delimiter justification}{delimiterJustification} optionally
specifies the justification for the alignment delimeters (default: left); note that this
feature is only useful if you have delimiters of different lengths in the same column,
- discussed in \cref{sec:delimiter-reg-ex}.
+ discussed in \cref{sec:delimiter-reg-ex};
+ \item \announce*{2021-12-13}{lookForChildCodeBlocks feature} optionally instructs
+ \texttt{latexindent.pl}
+ to search for child code blocks or not (default: 1), discussed in
+ \cref{sec:lookForChildCodeBlocks}.
\end{itemize}
We will explore most of these features using the file \texttt{tabular2.tex} in
@@ -939,6 +943,36 @@
Note that in \cref{lst:tabbing1-mod5} the second set of delimiters have been \emph{right
aligned} -- it is quite subtle!
+\subsection{The lookForChildCodeBlocks feature}\label{sec:lookForChildCodeBlocks}
+ There
+ \announce*{2021-12-13}{lookForChildCodeBlocks demonstration} may be scenarios in
+ which you would prefer to instruct \texttt{latexindent.pl} \emph{not} to search for child
+ blocks; in which case setting \texttt{lookForChildCodeBlocks} to 0 may be a good way to
+ proceed.
+
+ Using the settings from \vref{lst:dontMeasure1} on the file in \cref{lst:tabular-DM-1}
+ and running the command
+ \begin{commandshell}
+latexindent.pl tabular-DM-1.tex -l=dontMeasure1.yaml -o=+-mod1
+\end{commandshell}
+ gives the output in \cref{lst:tabular-DM-1-mod1}.
+ \begin{cmhtcbraster}
+ \cmhlistingsfromfile*{demonstrations/tabular-DM-1.tex}{\texttt{tabular-DM-1.tex}}{lst:tabular-DM-1}
+ \cmhlistingsfromfile*{demonstrations/tabular-DM-1-mod1.tex}{\texttt{tabular-DM-1-mod1.tex}}{lst:tabular-DM-1-mod1}
+ \end{cmhtcbraster}
+
+ We can improve the output from \cref{lst:tabular-DM-1-mod1} by employing the settings in
+ \cref{lst:dontMeasure1a}
+ \begin{commandshell}
+latexindent.pl tabular-DM-1.tex -l=dontMeasure1a.yaml -o=+-mod1a
+\end{commandshell}
+ which gives the output in \cref{lst:dontMeasure1a}.
+
+ \begin{cmhtcbraster}
+ \cmhlistingsfromfile*{demonstrations/tabular-DM-1-mod1a.tex}{\texttt{tabular-DM-1-mod1a.tex}}{lst:tabular-DM-1-mod1a}
+ \cmhlistingsfromfile*{demonstrations/dontMeasure1a.yaml}[yaml-TCB]{\texttt{dontMeasure1a.yaml}}{lst:dontMeasure1a}
+ \end{cmhtcbraster}
+
\subsection{Indent after items, specials and headings}
\yamltitle{indentAfterItems}*{fields}
The environment names specified in \texttt{indentAfterItems} tell \texttt{latexindent.pl}
Modified: trunk/Master/texmf-dist/doc/support/latexindent/sec-fine-tuning.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/sec-fine-tuning.tex 2021-12-15 21:32:01 UTC (rev 61315)
+++ trunk/Master/texmf-dist/doc/support/latexindent/sec-fine-tuning.tex 2021-12-15 21:32:28 UTC (rev 61316)
@@ -30,7 +30,7 @@
\end{warning}
\begin{widepage}
- \cmhlistingsfromfile[style=fineTuning]{../defaultSettings.yaml}[width=.95\linewidth,before=\centering,yaml-TCB]{\texttt{fineTuning}}{lst:fineTuning}
+ \cmhlistingsfromfile*[style=fineTuning]{../defaultSettings.yaml}[width=.95\linewidth,before=\centering,yaml-TCB]{\texttt{fineTuning}}{lst:fineTuning}
\end{widepage}
The fields given in \cref{lst:fineTuning} are all \emph{regular expressions}. This manual
Modified: trunk/Master/texmf-dist/doc/support/latexindent/title.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/title.tex 2021-12-15 21:32:01 UTC (rev 61315)
+++ trunk/Master/texmf-dist/doc/support/latexindent/title.tex 2021-12-15 21:32:28 UTC (rev 61316)
@@ -8,7 +8,7 @@
sharp corners,
enhanced,
overlay={\node[anchor=north east,outer sep=2pt] at ([xshift=3cm,yshift=4mm]frame.north east) {\includegraphics[width=3cm]{logo}}; }]
- \centering\ttfamily\bfseries latexindent.pl\\[1cm] Version 3.13.2
+ \centering\ttfamily\bfseries latexindent.pl\\[1cm] Version 3.13.3
\end{tcolorbox}
}
\author{Chris Hughes \thanks{and contributors!
@@ -15,7 +15,7 @@
See \vref{sec:contributors}.
For
all communication, please visit \cite{latexindent-home}.}}
-\date{2021-11-15}
+\date{2021-12-13}
\maketitle
\begin{adjustwidth}{1cm}{1cm}
\small
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm 2021-12-15 21:32:01 UTC (rev 61315)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm 2021-12-15 21:32:28 UTC (rev 61316)
@@ -247,15 +247,15 @@
}
# search for environments
- $logger->trace('looking for ENVIRONMENTS') if $is_t_switch_active;
+ $logger->trace('*looking for ENVIRONMENTS') if $is_t_switch_active;
$self->find_environments if ${$self}{body} =~ m/$environmentBasicRegExp/s;
# search for ifElseFi blocks
- $logger->trace('looking for IFELSEFI') if $is_t_switch_active;
+ $logger->trace('*looking for IFELSEFI') if $is_t_switch_active;
$self->find_ifelsefi if ${$self}{body} =~ m/$ifElseFiBasicRegExp/s;
# search for headings (part, chapter, section, setc)
- $logger->trace('looking for HEADINGS (chapter, section, part, etc)') if $is_t_switch_active;
+ $logger->trace('*looking for HEADINGS (chapter, section, part, etc)') if $is_t_switch_active;
$self->find_heading if ${$self}{body} =~ m/$allHeadingsRegexp/s;
# the ordering of finding commands and special code blocks can change
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Environment.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Environment.pm 2021-12-15 21:32:01 UTC (rev 61315)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Environment.pm 2021-12-15 21:32:28 UTC (rev 61316)
@@ -109,6 +109,14 @@
${${$self}{linebreaksAtEnd}}{body} = 1;
}
+ # lookForAlignDelims: lookForChildCodeBlocks set to 0 means no child objects searched for
+ # see: test-cases/alignment/issue-308.tex
+ #
+ if( defined ${$self}{lookForChildCodeBlocks} and !${$self}{lookForChildCodeBlocks} ){
+ $logger->trace("lookForAlignDelims: lookForChildCodeBlocks set to 0, so child objects will *NOT* be searched for") if($is_t_switch_active);
+ return;
+ }
+
# search for items as the first order of business
$self->find_items if ${$mainSettings{indentAfterItems}}{${$self}{name}};
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm 2021-12-15 21:32:01 UTC (rev 61315)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm 2021-12-15 21:32:28 UTC (rev 61316)
@@ -49,6 +49,7 @@
{name=>"delimiterRegEx",default=>"(?<!\\\\)(&)"},
{name=>"delimiterJustification",default=>"left"},
{name=>"leadingBlankColumn",default=>-1},
+ {name=>"lookForChildCodeBlocks",default=>1},
);
sub yaml_read_settings{
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm 2021-12-15 21:32:01 UTC (rev 61315)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm 2021-12-15 21:32:28 UTC (rev 61316)
@@ -43,9 +43,11 @@
# detail items in the log
$logger->trace("*List of items: $listOfItems (see itemNames)") if $is_t_switch_active;
+ my $itemCanBeFollowedBy = qr/${${$mainSettings{fineTuning}}{items}}{canBeFollowedBy}/;
+
$itemRegExp = qr/
(
- \\((?:$listOfItems)(?:\[[^]]*?\])?(?!\S))
+ \\((?:$listOfItems)(?:$itemCanBeFollowedBy)?(?!\S))
\h*
(\R*)?
)
@@ -52,8 +54,8 @@
(
(?: # cluster-only (), don't capture
(?!
- (?:\\(?:(?:$listOfItems)(?:\[[^]]*?\])?(?!\S))) # cluster-only (), don't capture
- ). # any character, but not \\$item
+ (?:\\(?:(?:$listOfItems)(?:$itemCanBeFollowedBy)?(?!\S))) # cluster-only (), don't capture
+ ). # any character, but not \\$item
)*
)
(\R)?
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/MandatoryArgument.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/MandatoryArgument.pm 2021-12-15 21:32:01 UTC (rev 61315)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/MandatoryArgument.pm 2021-12-15 21:32:28 UTC (rev 61316)
@@ -122,6 +122,14 @@
sub tasks_particular_to_each_object{
my $self = shift;
+ # lookForAlignDelims: lookForChildCodeBlocks set to 0 means no child objects searched for
+ # see: test-cases/alignment/issue-308-command.tex
+ #
+ if( defined ${$self}{lookForChildCodeBlocks} and !${$self}{lookForChildCodeBlocks} ){
+ $logger->trace("lookForAlignDelims: lookForChildCodeBlocks set to 0, so child objects will *NOT* be searched for") if($is_t_switch_active);
+ return;
+ }
+
# search for ifElseFi blocks
$self->find_ifelsefi if ${$self}{body} =~ m/$ifElseFiBasicRegExp/s;
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/OptionalArgument.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/OptionalArgument.pm 2021-12-15 21:32:01 UTC (rev 61315)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/OptionalArgument.pm 2021-12-15 21:32:28 UTC (rev 61316)
@@ -107,6 +107,14 @@
sub tasks_particular_to_each_object{
my $self = shift;
+ # lookForAlignDelims: lookForChildCodeBlocks set to 0 means no child objects searched for
+ # see: test-cases/alignment/issue-308-command.tex
+ #
+ if( defined ${$self}{lookForChildCodeBlocks} and !${$self}{lookForChildCodeBlocks} ){
+ $logger->trace("lookForAlignDelims: lookForChildCodeBlocks set to 0, so child objects will *NOT* be searched for") if($is_t_switch_active);
+ return;
+ }
+
# search for ifElseFi blocks
$self->find_ifelsefi if ${$self}{body} =~ m/$ifElseFiBasicRegExp/s;
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm 2021-12-15 21:32:01 UTC (rev 61315)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm 2021-12-15 21:32:28 UTC (rev 61316)
@@ -238,6 +238,14 @@
return unless(${$mainSettings{specialBeginEnd}}{specialBeforeCommand});
+ # lookForAlignDelims: lookForChildCodeBlocks set to 0 means no child objects searched for
+ # see: test-cases/alignment/issue-308-special.tex
+ #
+ if( defined ${$self}{lookForChildCodeBlocks} and !${$self}{lookForChildCodeBlocks} ){
+ $logger->trace("lookForAlignDelims: lookForChildCodeBlocks set to 0, so child objects will *NOT* be searched for") if($is_t_switch_active);
+ return;
+ }
+
# search for commands with arguments
$self->find_commands_or_key_equals_values_braces;
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm 2021-12-15 21:32:01 UTC (rev 61315)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm 2021-12-15 21:32:28 UTC (rev 61316)
@@ -19,6 +19,6 @@
use Exporter qw/import/;
our @EXPORT_OK = qw/$versionNumber $versionDate/;
-our $versionNumber = '3.13.2';
-our $versionDate = '2021-11-15';
+our $versionNumber = '3.13.3';
+our $versionDate = '2021-12-13';
1
Modified: trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml 2021-12-15 21:32:01 UTC (rev 61315)
+++ trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml 2021-12-15 21:32:28 UTC (rev 61316)
@@ -1,4 +1,4 @@
-# defaultSettings.yaml for latexindent.pl, version 3.13.2, 2021-11-15
+# defaultSettings.yaml for latexindent.pl, version 3.13.3, 2021-12-13
# a script that aims to
# beautify .tex, .sty, .cls files
#
@@ -166,6 +166,7 @@
dontMeasure: 0
delimiterRegEx: '(?<!\\)(&)'
delimiterJustification: left
+ lookForChildCodeBlocks: 1
tabularx:
delims: 1
longtable: 1
@@ -633,6 +634,8 @@
name: '(?!@?if[a-zA-Z@]*?\{)@?if[a-zA-Z@]*?'
commands:
name: '[+a-zA-Z@\*0-9_\:]+?'
+ items:
+ canBeFollowedBy: '(?:\[[^]]*?\])|(?:<[^>]*?>)'
keyEqualsValuesBracesBrackets:
name: '[a-zA-Z@\*0-9_\/.:\#-]+[a-zA-Z@\*0-9_\/.\h\{\}:\#-]*?'
follow: '(?:(?<!\\)\{)|,|(?:(?<!\\)\[)'
Modified: trunk/Master/texmf-dist/scripts/latexindent/latexindent.pl
===================================================================
(Binary files differ)
More information about the tex-live-commits
mailing list.