From 04943edfd3de2e24289b7ca55a8e6acd2e382713 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 6 Jun 2023 20:06:48 +0000 Subject: latexindent (6jun23) git-svn-id: svn://tug.org/texlive/trunk@67296 c570f23f-e606-0410-a88d-b1316a301751 --- .../linked_scripts/latexindent/latexindent.pl | 3 +- Master/bin/windows/latexindent.exe | Bin 8705088 -> 8705120 bytes Master/texmf-dist/doc/support/latexindent/README | 2 +- .../doc/support/latexindent/contributors.bib | 17 ++++++ .../latexindent/latexindent-yaml-schema.json | 2 +- .../doc/support/latexindent/latexindent.pdf | Bin 1246969 -> 1250364 bytes .../doc/support/latexindent/latexindent.tex | 59 +++++++++++++++------ .../latexindent/LatexIndent/TrailingComments.pm | 10 ++-- .../scripts/latexindent/LatexIndent/Version.pm | 4 +- .../scripts/latexindent/defaultSettings.yaml | 5 +- .../texmf-dist/scripts/latexindent/latexindent.pl | 3 +- 11 files changed, 77 insertions(+), 28 deletions(-) diff --git a/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl b/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl index 4b8e2b75278..5dacf0bc84d 100755 --- a/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl +++ b/Build/source/texk/texlive/linked_scripts/latexindent/latexindent.pl @@ -1,5 +1,6 @@ #!/usr/bin/env perl -# latexindent.pl, version 3.21.1, 2023-05-20 +# +# latexindent.pl, version 3.22, 2023-06-01 # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/Master/bin/windows/latexindent.exe b/Master/bin/windows/latexindent.exe index 5c6280ff7f4..9ab10107dc2 100755 Binary files a/Master/bin/windows/latexindent.exe and b/Master/bin/windows/latexindent.exe differ diff --git a/Master/texmf-dist/doc/support/latexindent/README b/Master/texmf-dist/doc/support/latexindent/README index 88398cdba95..df74dc160cb 100644 --- a/Master/texmf-dist/doc/support/latexindent/README +++ b/Master/texmf-dist/doc/support/latexindent/README @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - latexindent.pl, version 3.21.1, 2023-05-20 + latexindent.pl, version 3.22, 2023-06-01 PERL script to indent code within environments, and align delimited environments in .tex files. diff --git a/Master/texmf-dist/doc/support/latexindent/contributors.bib b/Master/texmf-dist/doc/support/latexindent/contributors.bib index 3e6147f1574..50a10e91183 100644 --- a/Master/texmf-dist/doc/support/latexindent/contributors.bib +++ b/Master/texmf-dist/doc/support/latexindent/contributors.bib @@ -200,3 +200,20 @@ author = "valtterikantanen", urldate = {2023-04-07}, keywords = {contributor},} + +@online{hslootgithubspaces, + title = "feat: add devcontainer configuration", + url = "https://github.com/cmhughes/latexindent.pl/pull/443", + date = {2023-05-20}, + author = "Henrik Sloot", + urldate = {2023-05-20}, + keywords = {contributor},} + +@online{qiaojunfeng, + title = "Add w.r.t to betterFullStop", + url = "https://github.com/cmhughes/latexindent.pl/pull/447", + date = {2023-05-25}, + author = "Junfeng Qiao", + urldate = {2023-05-25}, + keywords = {contributor},} + diff --git a/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json b/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json index 4084168a8be..cf707723a9c 100644 --- a/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json +++ b/Master/texmf-dist/doc/support/latexindent/latexindent-yaml-schema.json @@ -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.21.1 2023-05-20", + "description": "latexindent.pl YAML schema helper, V3.22 2023-06-01", "type": "object", "properties": { "fileExtensionPreference": { diff --git a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf index a853ce27c94..fb04afb06c6 100644 Binary files a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf and b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf differ diff --git a/Master/texmf-dist/doc/support/latexindent/latexindent.tex b/Master/texmf-dist/doc/support/latexindent/latexindent.tex index 618b49cad16..70c2be9805f 100644 --- a/Master/texmf-dist/doc/support/latexindent/latexindent.tex +++ b/Master/texmf-dist/doc/support/latexindent/latexindent.tex @@ -523,7 +523,7 @@ \lstdefinestyle{fineTuning}{ style=yaml-LST, - firstnumber=629,linerange={629-681}, + firstnumber=629,linerange={629-684}, numbers=left, } @@ -2461,11 +2461,11 @@ latexindent.pl tabular1.tex \item \announce{2021-12-13}{lookForChildCodeBlocks feature}{lookForChildCodeBlocks} optionally instructs \texttt{latexindent.pl} to search for child code blocks or not (default: 1), discussed in \cref{sec:lookForChildCodeBlocks}; - \item \announce*{2023-05-01}{alignContentAfterDoubleBackSlash feature} + \item \announce{2023-05-01}{alignContentAfterDoubleBackSlash feature} alignContentAfterDoubleBackSlash optionally instructs \texttt{latexindent.pl} to align content \emph{after} double back slash (default: 0), discussed in \cref{sec:alignContentAfterDoubleBackSlash}; - \item \announce*{2023-05-01}{spacesAfterDoubleBackSlash feature} + \item \announce{2023-05-01}{spacesAfterDoubleBackSlash feature} spacesAfterDoubleBackSlash optionally specifies the number (integer $\geq$ 0) of spaces to be placed \emph{after} the double back slash \emph{when alignContentAfterDoubleBackSlash is active}; demonstrated in @@ -3047,17 +3047,16 @@ latexindent.pl tabular-DM-1.tex -l=dontMeasure1a.yaml -o=+-mod1a \end{example} \subsubsection{lookForAlignDelims: alignContentAfterDoubleBackSlash}\label{sec:alignContentAfterDoubleBackSlash} - You can instruct \texttt{latexindent} to align \announce*{2023-05-01}{align content - after double back slash} content after the double back slash. See also - \vref{subsec:dbs}. + You can instruct \texttt{latexindent} to align \announce{2023-05-01}{align content after + double back slash} content after the double back slash. See also \vref{subsec:dbs}. \begin{example} We consider the file in \cref{lst:tabular5}, and the default output given in \cref{lst:tabular5-default}. \begin{cmhtcbraster} - \cmhlistingsfromfile*{demonstrations/tabular5.tex}{\texttt{tabular5.tex}}{lst:tabular5} - \cmhlistingsfromfile*{demonstrations/tabular5-default.tex}{\texttt{tabular5-default.tex}}{lst:tabular5-default} + \cmhlistingsfromfile{demonstrations/tabular5.tex}{\texttt{tabular5.tex}}{lst:tabular5} + \cmhlistingsfromfile{demonstrations/tabular5-default.tex}{\texttt{tabular5-default.tex}}{lst:tabular5-default} \end{cmhtcbraster} Using the settings given in \cref{lst:alignContentAfterDBS1} and running @@ -3071,15 +3070,15 @@ latexindent.pl -s tabular5.tex -l alignContentAfterDBS1 -o=+-mod1 \begin{cmhtcbraster}[raster columns=2, raster left skip=-2.5cm, raster column skip=.03\linewidth] - \cmhlistingsfromfile*{demonstrations/tabular5-mod1.tex}{\texttt{tabular5-mod1.tex}}{lst:tabular5-mod1} - \cmhlistingsfromfile*[style=yaml-LST]{demonstrations/alignContentAfterDBS1.yaml}[yaml-TCB]{\texttt{alignContentAfterDBS1.yaml}}{lst:alignContentAfterDBS1} + \cmhlistingsfromfile{demonstrations/tabular5-mod1.tex}{\texttt{tabular5-mod1.tex}}{lst:tabular5-mod1} + \cmhlistingsfromfile[style=yaml-LST]{demonstrations/alignContentAfterDBS1.yaml}[yaml-TCB]{\texttt{alignContentAfterDBS1.yaml}}{lst:alignContentAfterDBS1} \end{cmhtcbraster} \end{example} \begin{example} When using the \texttt{alignContentAfterDoubleBackSlash} feature, then you can also specify how many spaces to insert after the double backslash; the default is 1. - \announce*{2023-05-01}{specify number of spaces after double back slash when aligning + \announce{2023-05-01}{specify number of spaces after double back slash when aligning content after double back slash} Starting from \cref{lst:tabular5} and using the the settings given in @@ -3094,8 +3093,8 @@ latexindent.pl -s tabular5.tex -l alignContentAfterDBS2 -o=+-mod2 \begin{cmhtcbraster}[raster columns=2, raster left skip=-2.5cm, raster column skip=.03\linewidth] - \cmhlistingsfromfile*{demonstrations/tabular5-mod2.tex}{\texttt{tabular5-mod2.tex}}{lst:tabular5-mod2} - \cmhlistingsfromfile*[style=yaml-LST]{demonstrations/alignContentAfterDBS2.yaml}[yaml-TCB]{\texttt{alignContentAfterDBS2.yaml}}{lst:alignContentAfterDBS2} + \cmhlistingsfromfile{demonstrations/tabular5-mod2.tex}{\texttt{tabular5-mod2.tex}}{lst:tabular5-mod2} + \cmhlistingsfromfile[style=yaml-LST]{demonstrations/alignContentAfterDBS2.yaml}[yaml-TCB]{\texttt{alignContentAfterDBS2.yaml}}{lst:alignContentAfterDBS2} \end{cmhtcbraster} \end{example} @@ -6737,9 +6736,9 @@ latexindent.pl -s -m -l alignContentAfterDBS2.yaml,DBS1.yaml tabular6.tex -o=+-m raster left skip=-3.5cm, raster right skip=-2cm, raster column skip=.03\linewidth] - \cmhlistingsfromfile*{demonstrations/tabular6.tex}{\texttt{tabular6.tex}}{lst:tabular6} - \cmhlistingsfromfile*{demonstrations/tabular6-mod1.tex}{\texttt{tabular6-mod1.tex}}{lst:tabular6-mod1} - \cmhlistingsfromfile*{demonstrations/tabular6-mod2.tex}{\texttt{tabular6-mod2.tex}}{lst:tabular6-mod2} + \cmhlistingsfromfile{demonstrations/tabular6.tex}{\texttt{tabular6.tex}}{lst:tabular6} + \cmhlistingsfromfile{demonstrations/tabular6-mod1.tex}{\texttt{tabular6-mod1.tex}}{lst:tabular6-mod1} + \cmhlistingsfromfile{demonstrations/tabular6-mod2.tex}{\texttt{tabular6-mod2.tex}}{lst:tabular6-mod2} \end{cmhtcbraster} We note that: \begin{itemize} @@ -8254,6 +8253,34 @@ latexindent.pl bib2.bib -l bibsettings1.yaml,bibsettings2.yaml -o=+-mod2 been adjusted so that \texttt{=} symbols are used as the delimiter, but only when they are \emph{not preceded} by either \texttt{v} or \texttt{spfreload}. \end{example} + + \begin{example} + We can use the \texttt{fineTuning} settings to tweak how \texttt{latexindent.pl} finds + trailing comments. \announce*{2023-06-01}{fine tuning trailing comments demonstration} + + We begin with the file in \cref{lst:finetuning5} + + \cmhlistingsfromfile*{demonstrations/finetuning5.tex}{\texttt{finetuning5.tex}}{lst:finetuning5} + + Using the settings in \cref{lst:fine-tuning3} and running the command + + \begin{commandshell} +latexindent.pl finetuning5.tex -l=fine-tuning3.yaml +\end{commandshell} + + gives the output in \cref{lst:finetuning5-mod1}. + + \begin{cmhtcbraster}[raster column skip=.01\linewidth] + \cmhlistingsfromfile*{demonstrations/finetuning5-mod1.tex}{\texttt{finetuning5-mod1.tex}}{lst:finetuning5-mod1} + \cmhlistingsfromfile*[style=yaml-LST]{demonstrations/fine-tuning3.yaml}[yaml-TCB]{\texttt{finetuning3.yaml}}{lst:fine-tuning3} + \end{cmhtcbraster} + + The settings in \cref{lst:fine-tuning3} detail that trailing comments can \emph{not} be + followed by a single space, and then the text `end'. This means that the + \texttt{specialBeginEnd} routine will be able to find the pattern \lstinline!% end! as + the \texttt{end} part. The trailing comments \texttt{123} and \texttt{456} are still + treated as trailing comments. + \end{example} % arara: pdflatex: { files: [latexindent]} \section{Conclusions and known limitations}\label{sec:knownlimitations} There are a number of known limitations of the script, and almost certainly quite a few diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/TrailingComments.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/TrailingComments.pm index bbae745d940..748d005f98e 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/TrailingComments.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/TrailingComments.pm @@ -67,16 +67,16 @@ sub remove_trailing_comments { $logger->trace("*Storing trailing comments") if $is_t_switch_active; my $notPreceededBy = qr/${${$mainSettings{fineTuning}}{trailingComments}}{notPreceededBy}/; + my $afterComment = qr/${${$mainSettings{fineTuning}}{trailingComments}}{afterComment}/; # perform the substitution ${$self}{body} =~ s/ - $notPreceededBy # not preceded by a \ - % # % + $notPreceededBy # not preceded by a \ + % # % ( - \h*? # followed by possible horizontal space - .*? # and anything else + $afterComment # anything else ) - $ # up to the end of a line + $ # up to the end of a line / # increment comment counter and store comment $commentCounter++; diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm index 59ed17e3e02..f7ed57cf8d9 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm @@ -20,6 +20,6 @@ use warnings; use Exporter qw/import/; our @EXPORT_OK = qw/$versionNumber $versionDate/; -our $versionNumber = '3.21.1'; -our $versionDate = '2023-05-20'; +our $versionNumber = '3.22'; +our $versionDate = '2023-06-01'; 1 diff --git a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml index a3582b934b2..9d16992e360 100755 --- a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml +++ b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml @@ -1,5 +1,5 @@ # -# latexindent.pl, version 3.21.1, 2023-05-20 +# latexindent.pl, version 3.22, 2023-06-01 # # defaultSettings.yaml, the default settings for latexindent.pl # @@ -648,6 +648,7 @@ fineTuning: between: _|\^|\* trailingComments: notPreceededBy: (?