texlive[68362] trunk: latexindent (24sep23)
commits+karl at tug.org
commits+karl at tug.org
Sun Sep 24 22:23:56 CEST 2023
Revision: 68362
https://tug.org/svn/texlive?view=revision&revision=68362
Author: karl
Date: 2023-09-24 22:23:55 +0200 (Sun, 24 Sep 2023)
Log Message:
-----------
latexindent (24sep23)
Modified Paths:
--------------
trunk/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl
trunk/Master/bin/windows/latexindent.exe
trunk/Master/texmf-dist/doc/support/latexindent/README
trunk/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json
trunk/Master/texmf-dist/doc/support/latexindent/latexindent.pdf
trunk/Master/texmf-dist/doc/support/latexindent/latexindent.tex
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/windows/latexindent.exe
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/support/latexindent/README
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/README 2023-09-24 20:23:40 UTC (rev 68361)
+++ trunk/Master/texmf-dist/doc/support/latexindent/README 2023-09-24 20:23:55 UTC (rev 68362)
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- latexindent.pl, version 3.23.1, 2023-09-13
+ latexindent.pl, version 3.23.2, 2023-09-23
PERL script to indent code within environments, and align delimited
environments in .tex files.
Modified: trunk/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json 2023-09-24 20:23:40 UTC (rev 68361)
+++ trunk/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json 2023-09-24 20:23:55 UTC (rev 68362)
@@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/schema",
"$id": "latexindent-yaml-schema.json",
"title": "latexindent.pl YAML schema",
- "description": "latexindent.pl YAML schema helper, V3.23.1 2023-09-13",
+ "description": "latexindent.pl YAML schema helper, V3.23.2 2023-09-23",
"type": "object",
"properties": {
"fileExtensionPreference": {
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 2023-09-24 20:23:40 UTC (rev 68361)
+++ trunk/Master/texmf-dist/doc/support/latexindent/latexindent.tex 2023-09-24 20:23:55 UTC (rev 68362)
@@ -427,109 +427,109 @@
\lstdefinestyle{specialBeginEnd}{
style=yaml-LST,
- firstnumber=258,linerange={258-271},
+ firstnumber=258,linerange={258-272},
numbers=left,
}
\lstdefinestyle{indentAfterHeadings}{
style=yaml-LST,
- firstnumber=281,linerange={281-290},
+ firstnumber=282,linerange={282-291},
numbers=left,
}
\lstdefinestyle{noAdditionalIndentGlobalEnv}{
style=yaml-LST,
- firstnumber=339,linerange={339-340},
+ firstnumber=340,linerange={340-341},
numbers=left,
}
\lstdefinestyle{noAdditionalIndentGlobal}{
style=yaml-LST,
- firstnumber=339,linerange={339-351},
+ firstnumber=340,linerange={340-352},
numbers=left,
}
\lstdefinestyle{indentRulesGlobalEnv}{
style=yaml-LST,
- firstnumber=355,linerange={355-356},
+ firstnumber=356,linerange={356-357},
numbers=left,
}
\lstdefinestyle{indentRulesGlobal}{
style=yaml-LST,
- firstnumber=355,linerange={355-367},
+ firstnumber=356,linerange={356-368},
numbers=left,
}
\lstdefinestyle{commandCodeBlocks}{
style=yaml-LST,
- firstnumber=370,linerange={370-385},
+ firstnumber=371,linerange={371-386},
numbers=left,
}
\lstdefinestyle{modifylinebreaks}{
style=yaml-LST,
- firstnumber=500,linerange={500-502},
+ firstnumber=501,linerange={501-503},
numbers=left,
}
\lstdefinestyle{textWrapOptions}{
style=yaml-LST,
- firstnumber=530,linerange={530-531},
+ firstnumber=531,linerange={531-532},
numbers=left,
}
\lstdefinestyle{textWrapOptionsAll}{
style=yaml-LST,
- firstnumber=530,linerange={530-557},
+ firstnumber=531,linerange={531-558},
numbers=left,
}
\lstdefinestyle{oneSentencePerLine}{
style=yaml-LST,
- firstnumber=503,linerange={503-529},
+ firstnumber=504,linerange={504-530},
numbers=left,
}
\lstdefinestyle{sentencesFollow}{
style=yaml-LST,
- firstnumber=509,linerange={509-517},
+ firstnumber=510,linerange={510-518},
numbers=left,
}
\lstdefinestyle{sentencesBeginWith}{
style=yaml-LST,
- firstnumber=518,linerange={518-521},
+ firstnumber=519,linerange={519-522},
numbers=left,
}
\lstdefinestyle{sentencesEndWith}{
style=yaml-LST,
- firstnumber=522,linerange={522-527},
+ firstnumber=523,linerange={523-528},
numbers=left,
}
\lstdefinestyle{sentencesDoNOTcontain}{
style=yaml-LST,
- firstnumber=528,linerange={528-530},
+ firstnumber=529,linerange={529-530},
numbers=left,
}
\lstdefinestyle{modifylinebreaksEnv}{
style=yaml-LST,
- firstnumber=559,linerange={559-568},
+ firstnumber=560,linerange={560-569},
numbers=left,
}
\lstdefinestyle{replacements}{
style=yaml-LST,
- firstnumber=620,linerange={620-628},
+ firstnumber=621,linerange={621-629},
numbers=left,
}
\lstdefinestyle{fineTuning}{
style=yaml-LST,
- firstnumber=631,linerange={631-686},
+ firstnumber=632,linerange={632-687},
numbers=left,
}
@@ -3330,6 +3330,45 @@
\announce{2021-06-19}*{lookForThis optional for specialBeginEnd} by default, it is
assumed to be 1, which is demonstrated in \cref{lst:edge-node2}.%
+ Referencing \vref{lst:specialBeginEnd} we see that
+ \announce*{2023-09-23}{specialBeginEnd body field} each of the \texttt{specialBeginEnd}
+ fields can \emph{optionally} accept the \texttt{body} field. If the \texttt{body} field
+ is omitted, then \texttt{latexindent.pl} uses a value that means
+ \begin{quote}
+ anything except one of the begin statements from \texttt{specialBeginEnd}.
+ \end{quote}
+
+ In general, it is usually \emph{not} necessary to specify the \texttt{body} field, but
+ let's detail an example just for reference.
+
+ \begin{example}
+ We begin with the example in \cref{lst:special-body}
+
+ \cmhlistingsfromfile*{demonstrations/special-body.tex}{\texttt{special-body.tex}}{lst:special-body}
+
+ Using the settings in \cref{lst:special-body1} and running the command
+
+ \begin{commandshell}
+latexindent.pl special-body.tex -l=special-body1.yaml
+\end{commandshell}
+
+ gives the output in \cref{lst:special-body-mod1}.
+
+ \begin{cmhtcbraster}[ raster left skip=-3.5cm,]
+ \cmhlistingsfromfile*{demonstrations/special-body-mod1.tex}{\texttt{special-body.tex} using \cref{lst:special-body1}}{lst:special-body-mod1}
+ \cmhlistingsfromfile*[style=yaml-LST]{demonstrations/special-body1.yaml}[yaml-TCB]{\texttt{special-body1.yaml}}{lst:special-body1}
+ \end{cmhtcbraster}
+ We note that the output in \cref{lst:special-body-mod1} is as we would expect, even
+ \emph{without} the \texttt{body} field specified.
+
+ Another option (purely for reference) that leaves the output in
+ \cref{lst:special-body-mod1} unchanged is shown in \cref{lst:special-body2}.
+
+ \cmhlistingsfromfile*[style=yaml-LST]{demonstrations/special-body2.yaml}[yaml-TCB]{\texttt{special-body2.yaml}}{lst:special-body2}
+
+ The \texttt{body} field in \cref{lst:special-body2} means \emph{anything except ( or )}.
+ \end{example}
+
\yamltitle{indentAfterHeadings}*{fields}
This field enables the user to specify indentation rules that take effect after heading
commands such as \lstinline!\part!, \lstinline!\chapter!, \lstinline!\section!,
@@ -5488,7 +5527,7 @@
\index{regular expressions!lowercase alph a-z} \index{regular expressions!uppercase alph
A-Z}%
- \cmhlistingsfromfile*[style=oneSentencePerLine]{../defaultSettings.yaml}[MLB-TCB,width=.85\linewidth,before=\centering]{\texttt{oneSentencePerLine}}{lst:oneSentencePerLine}
+ \cmhlistingsfromfile[style=oneSentencePerLine]{../defaultSettings.yaml}[MLB-TCB,width=.85\linewidth,before=\centering]{\texttt{oneSentencePerLine}}{lst:oneSentencePerLine}
\subsubsection{oneSentencePerLine: overview}
An overview of how the oneSentencePerLine routine feature works:
@@ -5804,18 +5843,18 @@
\subsubsection{oneSentencePerLine: sentencesDoNOTcontain}
You can specify patterns that sentences do \emph{not} contain using the field
- \announce*{2023-09-09}{oneSentencePerLine: sentencesDoNOTcontain} in
+ \announce{2023-09-09}{oneSentencePerLine: sentencesDoNOTcontain} in
\cref{lst:sentencesDoNOTcontain}.
- \cmhlistingsfromfile*[style=sentencesDoNOTcontain]{../defaultSettings.yaml}[MLB-TCB,width=.9\linewidth,before=\centering]{\texttt{sentencesDoNOTcontain}}{lst:sentencesDoNOTcontain}
+ \cmhlistingsfromfile[style=sentencesDoNOTcontain]{../defaultSettings.yaml}[MLB-TCB,width=.9\linewidth,before=\centering]{\texttt{sentencesDoNOTcontain}}{lst:sentencesDoNOTcontain}
If sentences run across environments then, by default, they will \emph{not} be
- considered a sentence by \texttt{latexindent.pl}. \announce*{2023-09-09}*{updated
- example of oneSentencePerLine}
+ considered a sentence by \texttt{latexindent.pl}. \announce{2023-09-09}*{updated example
+ of oneSentencePerLine}
\begin{example}
For example, if we use the \texttt{.tex} file in \cref{lst:multiple-sentences4}
- \cmhlistingsfromfile*{demonstrations/multiple-sentences4.tex}{\texttt{multiple-sentences4.tex}}{lst:multiple-sentences4}
+ \cmhlistingsfromfile{demonstrations/multiple-sentences4.tex}{\texttt{multiple-sentences4.tex}}{lst:multiple-sentences4}
and run the command \index{switches!-l demonstration} \index{switches!-m demonstration}
@@ -5836,7 +5875,7 @@
We begin with the file in \cref{lst:sentence-dnc1}.
- \cmhlistingsfromfile*{demonstrations/sentence-dnc1.tex}{\texttt{sentence-dnc1.tex}}{lst:sentence-dnc1}
+ \cmhlistingsfromfile{demonstrations/sentence-dnc1.tex}{\texttt{sentence-dnc1.tex}}{lst:sentence-dnc1}
Upon running the following commands
@@ -5851,8 +5890,8 @@
raster force size=false,
raster column 1/.style={add to width=3cm},
]
- \cmhlistingsfromfile*{demonstrations/sentence-dnc1-mod1.tex}{\texttt{sentence-dnc1-mod1.tex}}{lst:sentence-dnc1-mod1}
- \cmhlistingsfromfile*[style=yaml-LST]{demonstrations/dnc1.yaml}[MLB-TCB,width=.45\textwidth]{\texttt{dnc1.yaml}}{lst:dnc1-yaml}
+ \cmhlistingsfromfile{demonstrations/sentence-dnc1-mod1.tex}{\texttt{sentence-dnc1-mod1.tex}}{lst:sentence-dnc1-mod1}
+ \cmhlistingsfromfile[style=yaml-LST]{demonstrations/dnc1.yaml}[MLB-TCB,width=.45\textwidth]{\texttt{dnc1.yaml}}{lst:dnc1-yaml}
\end{cmhtcbraster}
The settings in \cref{lst:dnc1-yaml} say that sentences do \emph{not} contain
@@ -5864,7 +5903,7 @@
We begin with the file in \cref{lst:sentence-dnc2}.
- \cmhlistingsfromfile*{demonstrations/sentence-dnc2.tex}{\texttt{sentence-dnc2.tex}}{lst:sentence-dnc2}
+ \cmhlistingsfromfile{demonstrations/sentence-dnc2.tex}{\texttt{sentence-dnc2.tex}}{lst:sentence-dnc2}
Upon running the following commands
@@ -5879,8 +5918,8 @@
raster force size=false,
raster column 1/.style={add to width=3cm},
]
- \cmhlistingsfromfile*{demonstrations/sentence-dnc2-mod2.tex}{\texttt{sentence-dnc2-mod2.tex}}{lst:sentence-dnc2-mod2}
- \cmhlistingsfromfile*[style=yaml-LST]{demonstrations/dnc2.yaml}[MLB-TCB,width=.45\textwidth]{\texttt{dnc2.yaml}}{lst:dnc2-yaml}
+ \cmhlistingsfromfile{demonstrations/sentence-dnc2-mod2.tex}{\texttt{sentence-dnc2-mod2.tex}}{lst:sentence-dnc2-mod2}
+ \cmhlistingsfromfile[style=yaml-LST]{demonstrations/dnc2.yaml}[MLB-TCB,width=.45\textwidth]{\texttt{dnc2.yaml}}{lst:dnc2-yaml}
\end{cmhtcbraster}
The settings in \cref{lst:dnc2-yaml} say that sentences do \emph{not} contain
@@ -5891,7 +5930,7 @@
We can turn off \texttt{sentenceDoNOTcontain} by setting it to \texttt{0} as in
\cref{lst:dnc-off-yaml}.
- \cmhlistingsfromfile*[style=yaml-LST]{demonstrations/dnc-off.yaml}[MLB-TCB,width=.45\textwidth]{\texttt{dnc-off.yaml}}{lst:dnc-off-yaml}
+ \cmhlistingsfromfile[style=yaml-LST]{demonstrations/dnc-off.yaml}[MLB-TCB,width=.45\textwidth]{\texttt{dnc-off.yaml}}{lst:dnc-off-yaml}
The settings in \cref{lst:dnc-off-yaml} mean that sentences can contain any character.
\end{example}
@@ -8877,6 +8916,7 @@
sudo groupadd docker
sudo gpasswd -a "$USER" docker
sudo systemctl restart docker
+ newgrp docker
fi
# download image and execute
@@ -8884,6 +8924,12 @@
docker run ghcr.io/cmhughes/latexindent.pl -h
\end{cmhlistings}
+ Once I have run the above, on subsequent logins I run
+ \begin{cmhlistings}[style=tcblatex,language=Bash]{\texttt{docker-install.sh}}{lst:docker-install}
+newgrp docker
+docker run ghcr.io/cmhughes/latexindent.pl -h
+\end{cmhlistings}
+
\subsection{How to format on Docker}
When you use \texttt{latexindent} with the docker image, you have to mount target \texttt{tex} file like this:
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm 2023-09-24 20:23:40 UTC (rev 68361)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm 2023-09-24 20:23:55 UTC (rev 68362)
@@ -71,14 +71,23 @@
next;
}
+ # body of specialBeginEnd
+ my $specialBodyRegEx = q();
+ if ( defined ${$BeginEnd}{body} ) {
+ $specialBodyRegEx = qr/${$BeginEnd}{body}/;
+ }
+ else {
+ $specialBodyRegEx = qr/(?: # cluster-only (), don't capture
+ (?!
+ (?:$specialBegins) # cluster-only (), don't capture
+ ). # any character, but not anything in $specialBegins
+ )*?/sx;
+ }
+
# the overall regexp
$specialAllMatchesRegExp .= ( $specialAllMatchesRegExp eq "" ? q() : "|" ) . qr/
${$BeginEnd}{begin}
- (?: # cluster-only (), don't capture
- (?!
- (?:$specialBegins) # cluster-only (), don't capture
- ). # any character, but not anything in $specialBegins
- )*?
+ $specialBodyRegEx
${$BeginEnd}{end}
/sx;
@@ -90,11 +99,7 @@
(\R*)?
)
(
- (?: # cluster-only (), don't capture
- (?!
- (?:$specialBegins) # cluster-only (), don't capture
- ). # any character, but not anything in $specialBegins
- )*?
+ $specialBodyRegEx
(\R*)?
)
(
@@ -252,6 +257,8 @@
}
+ $self->find_special;
+
return unless ( ${ $mainSettings{specialBeginEnd} }{specialBeforeCommand} );
# lookForAlignDelims: lookForChildCodeBlocks set to 0 means no child objects searched for
Modified: trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm 2023-09-24 20:23:40 UTC (rev 68361)
+++ trunk/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm 2023-09-24 20:23:55 UTC (rev 68362)
@@ -20,6 +20,6 @@
use Exporter qw/import/;
our @EXPORT_OK = qw/$versionNumber $versionDate/;
-our $versionNumber = '3.23.1';
-our $versionDate = '2023-09-13';
+our $versionNumber = '3.23.2';
+our $versionDate = '2023-09-23';
1
Modified: trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
===================================================================
--- trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml 2023-09-24 20:23:40 UTC (rev 68361)
+++ trunk/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml 2023-09-24 20:23:55 UTC (rev 68362)
@@ -1,5 +1,5 @@
#
-# latexindent.pl, version 3.23.1, 2023-09-13
+# latexindent.pl, version 3.23.2, 2023-09-23
#
# defaultSettings.yaml, the default settings for latexindent.pl
#
@@ -258,15 +258,16 @@
specialBeginEnd:
displayMath:
begin: (?<!\\)\\\[ # \[ but *not* \\[
- end: \\\] # \]
+ end: \\\] # \]
lookForThis: 1
inlineMath:
begin: (?<!\$)(?<!\\)\$(?!\$) # $ but *not* \$ or $$
- end: (?<!\\)\$(?!\$) # $ but *not* \$ or $$
+ body: [^$]*? # anything *except* $
+ end: (?<!\\)\$(?!\$) # $ but *not* \$ or $$
lookForThis: 1
displayMathTeX:
begin: \$\$ # $$
- end: \$\$ # $$
+ end: \$\$ # $$
lookForThis: 1
specialBeforeCommand: 0
Modified: trunk/Master/texmf-dist/scripts/latexindent/latexindent.pl
===================================================================
(Binary files differ)
More information about the tex-live-commits
mailing list.