diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-07 20:18:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-07 20:18:27 +0000 |
commit | 1e6af30cd22c38162c202393daeb98dc5b1aff04 (patch) | |
tree | b479e162ad2754243f5dde25d61e1282f4bda4d3 /Master/texmf-dist | |
parent | 3bf962c22cbfb46427a4226a45c1030577287fb2 (diff) |
latexindent (7may21)
git-svn-id: svn://tug.org/texlive/trunk@59121 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
12 files changed, 67 insertions, 31 deletions
diff --git a/Master/texmf-dist/doc/support/latexindent/README b/Master/texmf-dist/doc/support/latexindent/README index 3d68267b289..225e4ba5f34 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.9.2, 2021-04-06 + latexindent.pl, version 3.9.3, 2021-05-07 PERL script to indent code within environments, and align delimited environments in .tex files. diff --git a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf Binary files differindex 9aff38414bf..a6d1c74fa59 100644 --- a/Master/texmf-dist/doc/support/latexindent/latexindent.pdf +++ b/Master/texmf-dist/doc/support/latexindent/latexindent.pdf diff --git a/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex b/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex index 5e04637ea3e..2e5afbcdae2 100644 --- a/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex +++ b/Master/texmf-dist/doc/support/latexindent/sec-default-user-local.tex @@ -152,7 +152,8 @@ copy myfile.bak4 to myfile.bak3 %(*@@*)\end{noindent} \end{cmhlistings} - Important note: it is assumed that the \texttt{noindent} block statements appear on their own line. + Important note: it is assumed that the \texttt{noindent} block statements appear on + their own line. \yamltitle{removeTrailingWhitespace}*{fields}\label{yaml:removeTrailingWhitespace} diff --git a/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex b/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex index 8c7d9b95564..0760d467ef2 100644 --- a/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex +++ b/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex @@ -317,6 +317,13 @@ latexindent.pl myfile.tex -g other.log if you wish to change the name of this file, simply call the script with your chosen name after the \texttt{-g} switch as demonstrated above. + \announce*{2021-05-07}{log file creation updated} If \texttt{latexindent.pl} can not open the log file that you + specify, then the script will operate, and no log file will be produced; this might be + helpful to users who wish to specify the following, for example + \begin{commandshell} +latexindent.pl -g /dev/null myfile.tex +\end{commandshell} + \flagbox{-sl, --screenlog} \index{switches!-sl, --screenlog definition and details} \begin{commandshell} diff --git a/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex b/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex index c77ed24ec41..13ee49d1b48 100644 --- a/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex +++ b/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex @@ -1901,17 +1901,17 @@ latexindent.pl -m pmatrix3.tex -l DBS3.yaml \toprule Code block & Sample & \multicolumn{2}{c}{Poly-switch mapping} \\ \midrule - environment & \verb!before words!$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & BeginStartsOnOwnLine \\ - & \verb!\begin{myenv}!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & BodyStartsOnOwnLine \\ - & \verb!body of myenv!$\EndStartsOnOwnLine$ & $\EndStartsOnOwnLine$ & EndStartsOnOwnLine \\ - & \verb!\end{myenv}!$\EndFinishesWithLineBreak$ & $\EndFinishesWithLineBreak$ & EndFinishesWithLineBreak \\ - & \verb!after words! & & \\ + environment & \verb!before words!$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & BeginStartsOnOwnLine \\ + & \verb!\begin{myenv}!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & BodyStartsOnOwnLine \\ + & \verb!body of myenv!$\EndStartsOnOwnLine$ & $\EndStartsOnOwnLine$ & EndStartsOnOwnLine \\ + & \verb!\end{myenv}!$\EndFinishesWithLineBreak$ & $\EndFinishesWithLineBreak$ & EndFinishesWithLineBreak \\ + & \verb!after words! & & \\ \cmidrule{2-4} - ifelsefi & \verb!before words!$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & IfStartsOnOwnLine \\ - & \verb!\if...!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & BodyStartsOnOwnLine \\ - & \verb!body of if/or statement!$\OrStartsOnOwnLine$ & $\OrStartsOnOwnLine$ & OrStartsOnOwnLine % + ifelsefi & \verb!before words!$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & IfStartsOnOwnLine \\ + & \verb!\if...!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & BodyStartsOnOwnLine \\ + & \verb!body of if/or statement!$\OrStartsOnOwnLine$ & $\OrStartsOnOwnLine$ & OrStartsOnOwnLine % \announce{2018-04-27}{new ifElseFi code block poly-switches} \\ - & \verb!\or!$\OrFinishesWithLineBreak$ & $\OrFinishesWithLineBreak$ & OrFinishesWithLineBreak \\ + & \verb!\or!$\OrFinishesWithLineBreak$ & $\OrFinishesWithLineBreak$ & OrFinishesWithLineBreak \\ & \verb!body of if/or statement!$\ElseStartsOnOwnLine$ & $\ElseStartsOnOwnLine$ & ElseStartsOnOwnLine \\ & \verb!\else!$\ElseFinishesWithLineBreak$ & $\ElseFinishesWithLineBreak$ & ElseFinishesWithLineBreak \\ & \verb!body of else statement!$\EndStartsOnOwnLine$ & $\EndStartsOnOwnLine$ & FiStartsOnOwnLine \\ diff --git a/Master/texmf-dist/doc/support/latexindent/title.tex b/Master/texmf-dist/doc/support/latexindent/title.tex index cd892f13480..7545c5d4934 100644 --- a/Master/texmf-dist/doc/support/latexindent/title.tex +++ b/Master/texmf-dist/doc/support/latexindent/title.tex @@ -8,14 +8,14 @@ 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.9.2 + \centering\ttfamily\bfseries latexindent.pl\\[1cm] Version 3.9.3 \end{tcolorbox} } \author{Chris Hughes \thanks{and contributors! See \vref{sec:contributors}. For all communication, please visit \cite{latexindent-home}.}} -\date{2021-04-06} +\date{2021-05-07} \maketitle \begin{adjustwidth}{1cm}{1cm} \small diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm index 0b3ea9b254a..863d4d7d009 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm @@ -153,6 +153,19 @@ sub output_indented_text{ $logger->info("Not outputting to file; see -w and -o switches for more options."); } + # output the log file information + $self->output_logfile(); + + # output to screen, unless silent mode + print ${$self}{body} unless $switches{silentMode}; + + return; +} + +sub output_logfile{ + + my $self = shift; + # # put the final line in the logfile $logger->info("${$masterSettings{logFilePreferences}}{endLogFileWith}") if ${$masterSettings{logFilePreferences}}{endLogFileWith}; @@ -162,19 +175,18 @@ sub output_indented_text{ # open log file my $logfileName = $switches{logFileName}||"indent.log"; my $logfile; - open($logfile,">","${$self}{cruftDirectory}/$logfileName") or die "Can't open $logfileName"; + my $logfilePossible = 1; + open($logfile,">","${$self}{cruftDirectory}/$logfileName") or $logfilePossible =0; - foreach my $line (@{LatexIndent::Logger::logFileLines}){ - print $logfile $line,"\n"; - } + if($logfilePossible){ + foreach my $line (@{LatexIndent::Logger::logFileLines}){ + print $logfile $line,"\n"; + } - # close log file - close($logfile); - - # output to screen, unless silent mode - print ${$self}{body} unless $switches{silentMode}; + # close log file + close($logfile); + } - return; } sub process_body_of_text{ diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm index 499ca9f65a4..6902b0f48cd 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm @@ -48,8 +48,8 @@ sub file_extension_check{ if ($fileName ne "-"){ if (!$ext) { $logger->info("*File extension work:"); - $logger->info("latexindent called to act upon $fileName without a file extension;\nsearching for file with an extension in the following order (see fileExtensionPreference):"); - $logger->info(join("\n",@fileExtensions)); + $logger->info("latexindent called to act upon $fileName without a file extension;\nsearching for files in the following order (see fileExtensionPreference):"); + $logger->info($fileName.join("\n$fileName",@fileExtensions)); my $fileFound = 0; # loop through the known file extensions (see @fileExtensions) @@ -70,13 +70,15 @@ sub file_extension_check{ $logger->fatal("I searched for $fileName$_"); } $logger->fatal("but couldn't find any of them.\nConsider updating fileExtensionPreference.\nExiting, no indendation done."); - die "I couldn't find a match for $fileName in fileExtensionPreference.\nExiting, no indendation done."; + $self->output_logfile(); + die "ERROR: I couldn't find any of the following files: ".$fileName.join(", $fileName",@fileExtensions)." (see fileExtensionPreference)\nExiting, no indendation done."; } } else { # if the file has a recognised extension, check that the file exists unless( -e $fileName ){ - my $message = "I couldn't find $fileName, are you sure it exists?.\nNo indentation done.\nExiting."; + my $message = "ERROR: I couldn't find $fileName, are you sure it exists?\nNo indentation done.\nExiting."; $logger->fatal("*$message"); + $self->output_logfile(); die $message; } } diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Logger.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Logger.pm index 02bcd23dd77..35ff428eab6 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Logger.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Logger.pm @@ -49,6 +49,20 @@ sub warn{ print $logfileline,"\n" if $switches{screenlog}; } +sub fatal{ + my $self = shift; + my $logfileline = shift; + if ($logfileline =~ m/^\*/s){ + $logfileline =~ s/^\*/FATAL /s; + $logfileline =~ s/^/ /mg; + $logfileline =~ s/^\h+FATAL/FATAL/s; + } else { + $logfileline =~ s/^/ /mg; + } + push(@logFileLines,$logfileline); + print $logfileline,"\n" if $switches{screenlog}; +} + sub trace{ my $self = shift; my $logfileline = shift; diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm index 3751a17adb5..20cbab26721 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm @@ -19,6 +19,6 @@ use warnings; use Exporter qw/import/; our @EXPORT_OK = qw/$versionNumber $versionDate/; -our $versionNumber = '3.9.2'; -our $versionDate = '2021-04-06'; +our $versionNumber = '3.9.3'; +our $versionDate = '2021-05-07'; 1 diff --git a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml index a1028961116..2a927de5354 100755 --- a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml +++ b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml @@ -1,4 +1,4 @@ -# defaultSettings.yaml for latexindent.pl, version 3.9.2, 2021-04-06 +# defaultSettings.yaml for latexindent.pl, version 3.9.3, 2021-05-07 # a script that aims to # beautify .tex, .sty, .cls files # diff --git a/Master/texmf-dist/scripts/latexindent/latexindent.pl b/Master/texmf-dist/scripts/latexindent/latexindent.pl index f339ec591b4..ef24db27b25 100755 --- a/Master/texmf-dist/scripts/latexindent/latexindent.pl +++ b/Master/texmf-dist/scripts/latexindent/latexindent.pl @@ -1,5 +1,5 @@ #!/usr/bin/env perl -# latexindent.pl, version 3.9.2, 2021-04-06 +# latexindent.pl, version 3.9.3, 2021-05-07 # # 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 |